Update dependencies

This commit is contained in:
Syer10
2024-03-28 20:05:00 -04:00
parent bb2c5ed30d
commit 1a71938a44
19 changed files with 88 additions and 77 deletions

View File

@@ -0,0 +1,19 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package ca.gosyer.jui.domain.library.model
import androidx.compose.runtime.Stable
import kotlinx.serialization.Serializable
@Serializable
@Stable
enum class JobStatus {
PENDING,
RUNNING,
COMPLETE,
FAILED,
}

View File

@@ -1,76 +1,76 @@
[versions] [versions]
# Kotlin # Kotlin
kotlin = "1.9.21" kotlin = "1.9.23"
coroutines = "1.7.3" coroutines = "1.8.0"
# Serialization # Serialization
json = "1.6.2" json = "1.6.3"
# Compose # Compose
composeGradle = "1.5.11" composeGradle = "1.6.1"
# Compose Libraries # Compose Libraries
voyager = "1.0.0-rc10" voyager = "1.0.0-rc10"
accompanist = "0.30.1" accompanist = "0.30.1"
googleAccompanist = "0.30.1" googleAccompanist = "0.30.1"
imageloader = "1.7.1" imageloader = "1.7.8"
materialDialogs = "0.9.4" materialDialogs = "0.9.5"
# Android # Android
androidGradle = "8.1.4" androidGradle = "8.3.1"
core = "1.12.0" core = "1.12.0"
appCompat = "1.7.0-alpha03" appCompat = "1.7.0-alpha03"
activityCompose = "1.8.1" activityCompose = "1.8.2"
work = "2.9.0" work = "2.9.0"
# Android Lifecycle # Android Lifecycle
lifecycle = "2.6.2" lifecycle = "2.7.0"
# Swing # Swing
darklaf = "3.0.2" darklaf = "3.0.2"
# Ksp # Ksp
ksp = "1.9.21-1.0.15" ksp = "1.9.23-1.0.19"
# Dependency Injection # Dependency Injection
kotlinInject = "0.6.3" kotlinInject = "0.6.3"
# Network # Network
ktor = "2.3.6" ktor = "2.3.9"
ktorfit = "1.10.2" ktorfit = "1.12.0"
# Logging # Logging
slf4j = "2.0.9" slf4j = "2.0.12"
log4j = "2.22.0" log4j = "2.23.1"
kmlogging = "1.3.0" kmlogging = "1.4.2"
# Storage # Storage
okio = "3.6.0" okio = "3.9.0"
appDirs = "1.1.1" appDirs = "1.2.0"
# Preferences # Preferences
multiplatformSettings = "1.0.0-alpha01" multiplatformSettings = "1.0.0-alpha01"
# Utility # Utility
desugarJdkLibs = "2.0.4" desugarJdkLibs = "2.0.4"
aboutLibraries = "10.9.2" aboutLibraries = "11.1.1"
dateTime = "0.5.0" dateTime = "0.6.0-RC.2"
immutableCollections = "0.3.6" immutableCollections = "0.3.7"
korge = "5.1.0" korge = "5.4.0"
gradleDownloadTask = "5.4.0" gradleDownloadTask = "5.4.0"
# Localization # Localization
moko = "0.23.0" moko = "0.23.0"
# BuildConfigs # BuildConfigs
buildconfig = "4.2.0" buildconfig = "5.3.5"
buildkonfig = "0.15.1" buildkonfig = "0.15.1"
# Linter # Linter
kotlinter = "4.1.0" kotlinter = "4.3.0"
# Version updates # Version updates
versions = "0.50.0" versions = "0.51.0"
# Optimizer # Optimizer
proguard = "7.4.1" proguard = "7.4.1"

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

17
gradlew vendored
View File

@@ -83,7 +83,8 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command:
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# shell script including quotes and variable substitutions, so put them in # and any embedded shellness will be escaped.
# double quotes to make sure that they get re-expanded; and # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# * put everything else in single quotes, so that it's not re-expanded. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

View File

@@ -40,4 +40,5 @@ fun getMaterialDialogProperties(
windowTitle = title, windowTitle = title,
windowIcon = icon, windowIcon = icon,
windowIsResizable = resizable, windowIsResizable = resizable,
isWindowDialog = false,
) )

View File

@@ -22,6 +22,7 @@ import com.seiko.imageloader.component.ComponentRegistryBuilder
import com.seiko.imageloader.component.fetcher.MokoResourceFetcher import com.seiko.imageloader.component.fetcher.MokoResourceFetcher
import com.seiko.imageloader.component.keyer.Keyer import com.seiko.imageloader.component.keyer.Keyer
import com.seiko.imageloader.component.mapper.Mapper import com.seiko.imageloader.component.mapper.Mapper
import com.seiko.imageloader.intercept.bitmapMemoryCacheConfig
import com.seiko.imageloader.option.Options import com.seiko.imageloader.option.Options
import com.seiko.imageloader.option.OptionsBuilder import com.seiko.imageloader.option.OptionsBuilder
import io.ktor.http.Url import io.ktor.http.Url
@@ -56,7 +57,7 @@ class ImageLoaderProvider
} }
interceptor { interceptor {
diskCache { imageCache } diskCache { imageCache }
memoryCacheConfig { configure(context) } bitmapMemoryCacheConfig { configure(context) }
} }
} }
} }

View File

@@ -43,10 +43,10 @@ import androidx.compose.material.Surface
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.contentColorFor import androidx.compose.material.contentColorFor
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowBack import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.automirrored.rounded.Sort
import androidx.compose.material.icons.rounded.Close import androidx.compose.material.icons.rounded.Close
import androidx.compose.material.icons.rounded.Search import androidx.compose.material.icons.rounded.Search
import androidx.compose.material.icons.rounded.Sort
import androidx.compose.material.ripple.rememberRipple import androidx.compose.material.ripple.rememberRipple
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.CompositionLocalProvider
@@ -168,7 +168,11 @@ private fun WideToolbar(
AnimatedVisibility( AnimatedVisibility(
!displayController.sideMenuVisible, !displayController.sideMenuVisible,
) { ) {
ActionIcon(displayController::openSideMenu, "Open nav", Icons.Rounded.Sort) ActionIcon(
displayController::openSideMenu,
"Open nav",
Icons.AutoMirrored.Rounded.Sort,
)
} }
} }
@@ -257,7 +261,7 @@ private fun ThinToolbar(
}, },
) { ) {
Icon( Icon(
if (closeIcon === ToolbarDefault) Icons.Rounded.ArrowBack else closeIcon, if (closeIcon === ToolbarDefault) Icons.AutoMirrored.Rounded.ArrowBack else closeIcon,
stringResource(MR.strings.action_close), stringResource(MR.strings.action_close),
) )
} }

View File

@@ -28,12 +28,10 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.layout.widthIn
@@ -284,7 +282,7 @@ fun <T> ChoiceDialog(
submit() submit()
}, },
) )
Box(Modifier.matchParentSize().height(IntrinsicSize.Min)) { Box(Modifier.matchParentSize()) {
VerticalScrollbar( VerticalScrollbar(
rememberScrollbarAdapter(listState), rememberScrollbarAdapter(listState),
Modifier.align(Alignment.CenterEnd) Modifier.align(Alignment.CenterEnd)
@@ -332,7 +330,7 @@ fun <T> MultiSelectDialog(
onFinished(indexes.map { items[it].first }.toImmutableList()) onFinished(indexes.map { items[it].first }.toImmutableList())
}, },
) )
Box(Modifier.matchParentSize().height(IntrinsicSize.Min)) { Box(Modifier.matchParentSize()) {
VerticalScrollbar( VerticalScrollbar(
rememberScrollbarAdapter(listState), rememberScrollbarAdapter(listState),
Modifier.align(Alignment.CenterEnd) Modifier.align(Alignment.CenterEnd)

View File

@@ -37,7 +37,7 @@ import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold import androidx.compose.material.Scaffold
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.List import androidx.compose.material.icons.automirrored.outlined.List
import androidx.compose.material.icons.rounded.Add import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.Delete import androidx.compose.material.icons.rounded.Delete
import androidx.compose.material.icons.rounded.Edit import androidx.compose.material.icons.rounded.Edit
@@ -183,7 +183,7 @@ private fun CategoryRow(
Column { Column {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
Icon( Icon(
imageVector = Icons.Outlined.List, imageVector = Icons.AutoMirrored.Outlined.List,
modifier = Modifier.padding(16.dp), modifier = Modifier.padding(16.dp),
tint = MaterialTheme.colors.primary, tint = MaterialTheme.colors.primary,
contentDescription = null, contentDescription = null,

View File

@@ -9,7 +9,6 @@ package ca.gosyer.jui.ui.extensions.components
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsets
@@ -318,7 +317,7 @@ fun LanguageDialog(
setLangs(indexes.map { list[it].first }.toSet()) setLangs(indexes.map { list[it].first }.toSet())
}, },
) )
Box(Modifier.matchParentSize().height(IntrinsicSize.Min)) { Box(Modifier.matchParentSize()) {
VerticalScrollbar( VerticalScrollbar(
rememberScrollbarAdapter(listState), rememberScrollbarAdapter(listState),
Modifier.align(Alignment.CenterEnd) Modifier.align(Alignment.CenterEnd)

View File

@@ -35,7 +35,6 @@ import ca.gosyer.jui.uicore.components.scrollbarPadding
import ca.gosyer.jui.uicore.resources.stringResource import ca.gosyer.jui.uicore.resources.stringResource
import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.ui.compose.Libraries import com.mikepenz.aboutlibraries.ui.compose.Libraries
import com.mikepenz.aboutlibraries.ui.compose.util.StableLibrary
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
@Composable @Composable
@@ -59,10 +58,10 @@ fun LicensesContent() {
val state = rememberLazyListState() val state = rememberLazyListState()
val uriHandler = LocalUriHandler.current val uriHandler = LocalUriHandler.current
Libraries( Libraries(
libraries = remember(libs) { libs.libraries.map { StableLibrary(it) }.toImmutableList() }, libraries = remember(libs) { libs.libraries.toImmutableList() },
lazyListState = state, lazyListState = state,
onLibraryClick = { onLibraryClick = {
it.library.website?.let(uriHandler::openUri) it.website?.let(uriHandler::openUri)
}, },
contentPadding = WindowInsets.bottomNav.add( contentPadding = WindowInsets.bottomNav.add(
WindowInsets.navigationBars.only( WindowInsets.navigationBars.only(

View File

@@ -194,7 +194,7 @@ fun CategorySelectDialog(
onPositiveClick(indexes.map { categories[it] }, oldCategories) onPositiveClick(indexes.map { categories[it] }, oldCategories)
}, },
) )
Box(Modifier.matchParentSize().height(IntrinsicSize.Min)) { Box(Modifier.matchParentSize()) {
VerticalScrollbar( VerticalScrollbar(
rememberScrollbarAdapter(listState), rememberScrollbarAdapter(listState),
Modifier.align(Alignment.CenterEnd) Modifier.align(Alignment.CenterEnd)

View File

@@ -25,6 +25,7 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.Scaffold import androidx.compose.material.Scaffold
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.Label
import androidx.compose.material.icons.rounded.BookmarkAdd import androidx.compose.material.icons.rounded.BookmarkAdd
import androidx.compose.material.icons.rounded.BookmarkRemove import androidx.compose.material.icons.rounded.BookmarkRemove
import androidx.compose.material.icons.rounded.Close import androidx.compose.material.icons.rounded.Close
@@ -34,7 +35,6 @@ import androidx.compose.material.icons.rounded.Download
import androidx.compose.material.icons.rounded.Favorite import androidx.compose.material.icons.rounded.Favorite
import androidx.compose.material.icons.rounded.FavoriteBorder import androidx.compose.material.icons.rounded.FavoriteBorder
import androidx.compose.material.icons.rounded.FlipToBack import androidx.compose.material.icons.rounded.FlipToBack
import androidx.compose.material.icons.rounded.Label
import androidx.compose.material.icons.rounded.Public import androidx.compose.material.icons.rounded.Public
import androidx.compose.material.icons.rounded.Refresh import androidx.compose.material.icons.rounded.Refresh
import androidx.compose.material.icons.rounded.RemoveDone import androidx.compose.material.icons.rounded.RemoveDone
@@ -312,7 +312,7 @@ private fun getActionItems(
if (categoryItemVisible) { if (categoryItemVisible) {
ActionItem( ActionItem(
name = stringResource(MR.strings.edit_categories), name = stringResource(MR.strings.edit_categories),
icon = Icons.Rounded.Label, icon = Icons.AutoMirrored.Rounded.Label,
doAction = setCategories, doAction = setCategories,
) )
} else { } else {

View File

@@ -36,9 +36,9 @@ import androidx.compose.material.Surface
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.TextButton import androidx.compose.material.TextButton
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.NavigateBefore
import androidx.compose.material.icons.automirrored.rounded.NavigateNext
import androidx.compose.material.icons.rounded.ChevronLeft import androidx.compose.material.icons.rounded.ChevronLeft
import androidx.compose.material.icons.rounded.NavigateBefore
import androidx.compose.material.icons.rounded.NavigateNext
import androidx.compose.material.icons.rounded.SkipNext import androidx.compose.material.icons.rounded.SkipNext
import androidx.compose.material.icons.rounded.SkipPrevious import androidx.compose.material.icons.rounded.SkipPrevious
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@@ -318,7 +318,7 @@ private fun NavigateChapters(
OutlinedButton(loadPrevChapter, Modifier.weight(0.5F)) { OutlinedButton(loadPrevChapter, Modifier.weight(0.5F)) {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
val nextChapter = stringResource(MR.strings.nav_prev_chapter) val nextChapter = stringResource(MR.strings.nav_prev_chapter)
Icon(Icons.Rounded.NavigateBefore, nextChapter) Icon(Icons.AutoMirrored.Rounded.NavigateBefore, nextChapter)
Text(nextChapter, fontSize = 10.sp) Text(nextChapter, fontSize = 10.sp)
} }
} }
@@ -326,7 +326,7 @@ private fun NavigateChapters(
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
val nextChapter = stringResource(MR.strings.nav_next_chapter) val nextChapter = stringResource(MR.strings.nav_next_chapter)
Text(nextChapter, fontSize = 10.sp) Text(nextChapter, fontSize = 10.sp)
Icon(Icons.Rounded.NavigateNext, nextChapter) Icon(Icons.AutoMirrored.Rounded.NavigateNext, nextChapter)
} }
} }
} }

View File

@@ -22,8 +22,8 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.Scaffold import androidx.compose.material.Scaffold
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ChromeReaderMode
import androidx.compose.material.icons.rounded.Backup import androidx.compose.material.icons.rounded.Backup
import androidx.compose.material.icons.rounded.ChromeReaderMode
import androidx.compose.material.icons.rounded.Code import androidx.compose.material.icons.rounded.Code
import androidx.compose.material.icons.rounded.CollectionsBookmark import androidx.compose.material.icons.rounded.CollectionsBookmark
import androidx.compose.material.icons.rounded.Computer import androidx.compose.material.icons.rounded.Computer
@@ -110,7 +110,7 @@ fun SettingsScreenContent(navigator: Navigator) {
item { item {
PreferenceRow( PreferenceRow(
title = stringResource(MR.strings.settings_reader), title = stringResource(MR.strings.settings_reader),
icon = Icons.Rounded.ChromeReaderMode, icon = Icons.AutoMirrored.Rounded.ChromeReaderMode,
onClick = { navigator push SettingsReaderScreen() }, onClick = { navigator push SettingsReaderScreen() },
) )
} }

View File

@@ -34,7 +34,7 @@ import androidx.compose.material.Icon
import androidx.compose.material.Scaffold import androidx.compose.material.Scaffold
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowForward import androidx.compose.material.icons.automirrored.rounded.ArrowForward
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
@@ -185,7 +185,7 @@ fun GlobalSearchItem(
fontSize = 12.sp, fontSize = 12.sp,
) )
} }
Icon(Icons.Rounded.ArrowForward, stringResource(MR.strings.action_search)) Icon(Icons.AutoMirrored.Rounded.ArrowForward, stringResource(MR.strings.action_search))
} }
Spacer(Modifier.height(4.dp)) Spacer(Modifier.height(4.dp))

View File

@@ -56,8 +56,8 @@ class UpdatesScreenViewModel
private val _isLoading = MutableStateFlow(true) private val _isLoading = MutableStateFlow(true)
val isLoading = _isLoading.asStateFlow() val isLoading = _isLoading.asStateFlow()
val updates = updatesPager.updates.map { val updates = updatesPager.updates.map { updates ->
it.map { updates.map {
when (it) { when (it) {
is UpdatesPager.Updates.Date -> UpdatesUI.Header(it.date) is UpdatesPager.Updates.Date -> UpdatesUI.Header(it.date)
is UpdatesPager.Updates.Update -> UpdatesUI.Item(ChapterDownloadItem(it.manga, it.chapter)) is UpdatesPager.Updates.Update -> UpdatesUI.Item(ChapterDownloadItem(it.manga, it.chapter))

View File

@@ -36,10 +36,8 @@ import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Density
import androidx.compose.ui.util.fastForEach import androidx.compose.ui.util.fastForEach
import androidx.compose.ui.util.fastMaxBy import androidx.compose.ui.util.fastMaxBy
import androidx.compose.ui.util.fastSumBy
import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.distinctUntilChanged
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.sign import kotlin.math.sign
@@ -242,9 +240,9 @@ private fun lazyListSnapLayoutInfoProvider(
get() = lazyListState.layoutInfo get() = lazyListState.layoutInfo
// Single page snapping is the default // Single page snapping is the default
override fun Density.calculateApproachOffset(initialVelocity: Float): Float = 0f override fun calculateApproachOffset(initialVelocity: Float): Float = 0f
override fun Density.calculateSnappingOffset(currentVelocity: Float): Float { override fun calculateSnappingOffset(currentVelocity: Float): Float {
var lowerBoundOffset = Float.NEGATIVE_INFINITY var lowerBoundOffset = Float.NEGATIVE_INFINITY
var upperBoundOffset = Float.POSITIVE_INFINITY var upperBoundOffset = Float.POSITIVE_INFINITY
@@ -279,7 +277,7 @@ private fun lazyListSnapLayoutInfoProvider(
} }
@OptIn(ExperimentalFoundationApi::class) @OptIn(ExperimentalFoundationApi::class)
private fun Density.calculateDistanceToDesiredSnapPosition( private fun calculateDistanceToDesiredSnapPosition(
mainAxisViewPortSize: Int, mainAxisViewPortSize: Int,
beforeContentPadding: Int, beforeContentPadding: Int,
afterContentPadding: Int, afterContentPadding: Int,
@@ -291,7 +289,7 @@ private fun lazyListSnapLayoutInfoProvider(
val containerSize = mainAxisViewPortSize - beforeContentPadding - afterContentPadding val containerSize = mainAxisViewPortSize - beforeContentPadding - afterContentPadding
val desiredDistance = with(snapPositionInLayout) { val desiredDistance = with(snapPositionInLayout) {
position(containerSize, itemSize, itemIndex) position(containerSize, itemSize, beforeContentPadding, afterContentPadding, itemIndex)
}.toFloat() }.toFloat()
return itemOffset - desiredDistance return itemOffset - desiredDistance
@@ -326,15 +324,6 @@ private fun lazyListSnapLayoutInfoProvider(
0f 0f
} }
} }
override fun Density.calculateSnapStepSize(): Float =
with(layoutInfo) {
if (visibleItemsInfo.isNotEmpty()) {
visibleItemsInfo.fastSumBy { it.size } / visibleItemsInfo.size.toFloat()
} else {
0f
}
}
} }
@Composable @Composable