mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-30 20:01:51 +01:00
Upgrade Compose
Co-authored-by: ivaniskandar <ivaniskandar@users.noreply.github.com>
This commit is contained in:
parent
5ca7c39751
commit
5a9889b562
@ -4,7 +4,7 @@ import androidx.activity.compose.BackHandler
|
|||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
import androidx.compose.animation.with
|
import androidx.compose.animation.togetherWith
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
import androidx.compose.foundation.layout.WindowInsetsSides
|
import androidx.compose.foundation.layout.WindowInsetsSides
|
||||||
@ -20,7 +20,7 @@ import cafe.adriel.voyager.core.annotation.InternalVoyagerApi
|
|||||||
import cafe.adriel.voyager.core.lifecycle.DisposableEffectIgnoringConfiguration
|
import cafe.adriel.voyager.core.lifecycle.DisposableEffectIgnoringConfiguration
|
||||||
import cafe.adriel.voyager.core.screen.Screen
|
import cafe.adriel.voyager.core.screen.Screen
|
||||||
import cafe.adriel.voyager.navigator.Navigator
|
import cafe.adriel.voyager.navigator.Navigator
|
||||||
import cafe.adriel.voyager.transitions.ScreenTransition
|
import eu.kanade.presentation.util.ScreenTransition
|
||||||
import eu.kanade.presentation.util.isTabletUi
|
import eu.kanade.presentation.util.isTabletUi
|
||||||
import tachiyomi.presentation.core.components.AdaptiveSheet as AdaptiveSheetImpl
|
import tachiyomi.presentation.core.components.AdaptiveSheet as AdaptiveSheetImpl
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ fun NavigatorAdaptiveSheet(
|
|||||||
ScreenTransition(
|
ScreenTransition(
|
||||||
navigator = sheetNavigator,
|
navigator = sheetNavigator,
|
||||||
transition = {
|
transition = {
|
||||||
fadeIn(animationSpec = tween(220, delayMillis = 90)) with
|
fadeIn(animationSpec = tween(220, delayMillis = 90)) togetherWith
|
||||||
fadeOut(animationSpec = tween(90))
|
fadeOut(animationSpec = tween(90))
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -188,7 +188,7 @@ fun AppBarActions(
|
|||||||
IconButton(
|
IconButton(
|
||||||
onClick = it.onClick,
|
onClick = it.onClick,
|
||||||
enabled = it.enabled,
|
enabled = it.enabled,
|
||||||
modifier = Modifier.tooltipAnchor(),
|
modifier = Modifier.tooltipTrigger(),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = it.icon,
|
imageVector = it.icon,
|
||||||
@ -206,7 +206,7 @@ fun AppBarActions(
|
|||||||
) {
|
) {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = { showMenu = !showMenu },
|
onClick = { showMenu = !showMenu },
|
||||||
modifier = Modifier.tooltipAnchor(),
|
modifier = Modifier.tooltipTrigger(),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Outlined.MoreVert,
|
Icons.Outlined.MoreVert,
|
||||||
@ -325,7 +325,7 @@ fun SearchToolbar(
|
|||||||
) {
|
) {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
modifier = Modifier.tooltipAnchor(),
|
modifier = Modifier.tooltipTrigger(),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Outlined.Search,
|
Icons.Outlined.Search,
|
||||||
@ -342,7 +342,7 @@ fun SearchToolbar(
|
|||||||
onClick()
|
onClick()
|
||||||
focusRequester.requestFocus()
|
focusRequester.requestFocus()
|
||||||
},
|
},
|
||||||
modifier = Modifier.tooltipAnchor(),
|
modifier = Modifier.tooltipTrigger(),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Outlined.Close,
|
Icons.Outlined.Close,
|
||||||
|
@ -49,7 +49,7 @@ fun TabbedDialog(
|
|||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
) { contentPadding ->
|
) { contentPadding ->
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val pagerState = rememberPagerState()
|
val pagerState = rememberPagerState { tabTitles.size }
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
Row {
|
Row {
|
||||||
@ -84,7 +84,6 @@ fun TabbedDialog(
|
|||||||
|
|
||||||
HorizontalPager(
|
HorizontalPager(
|
||||||
modifier = Modifier.animateContentSize(),
|
modifier = Modifier.animateContentSize(),
|
||||||
pageCount = tabTitles.size,
|
|
||||||
state = pagerState,
|
state = pagerState,
|
||||||
verticalAlignment = Alignment.Top,
|
verticalAlignment = Alignment.Top,
|
||||||
) { page ->
|
) { page ->
|
||||||
|
@ -36,7 +36,7 @@ fun TabbedScreen(
|
|||||||
onChangeSearchQuery: (String?) -> Unit = {},
|
onChangeSearchQuery: (String?) -> Unit = {},
|
||||||
) {
|
) {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val state = rememberPagerState()
|
val state = rememberPagerState { tabs.size }
|
||||||
val snackbarHostState = remember { SnackbarHostState() }
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
|
|
||||||
LaunchedEffect(startIndex) {
|
LaunchedEffect(startIndex) {
|
||||||
@ -82,7 +82,6 @@ fun TabbedScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
HorizontalPager(
|
HorizontalPager(
|
||||||
pageCount = tabs.size,
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
state = state,
|
state = state,
|
||||||
verticalAlignment = Alignment.Top,
|
verticalAlignment = Alignment.Top,
|
||||||
|
@ -54,7 +54,7 @@ fun LibraryContent(
|
|||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
val coercedCurrentPage = remember { currentPage().coerceAtMost(categories.lastIndex) }
|
val coercedCurrentPage = remember { currentPage().coerceAtMost(categories.lastIndex) }
|
||||||
val pagerState = rememberPagerState(coercedCurrentPage)
|
val pagerState = rememberPagerState(coercedCurrentPage) { categories.size }
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
var isRefreshing by remember(pagerState.currentPage) { mutableStateOf(false) }
|
var isRefreshing by remember(pagerState.currentPage) { mutableStateOf(false) }
|
||||||
@ -98,7 +98,6 @@ fun LibraryContent(
|
|||||||
LibraryPager(
|
LibraryPager(
|
||||||
state = pagerState,
|
state = pagerState,
|
||||||
contentPadding = PaddingValues(bottom = contentPadding.calculateBottomPadding()),
|
contentPadding = PaddingValues(bottom = contentPadding.calculateBottomPadding()),
|
||||||
pageCount = categories.size,
|
|
||||||
hasActiveFilters = hasActiveFilters,
|
hasActiveFilters = hasActiveFilters,
|
||||||
selectedManga = selection,
|
selectedManga = selection,
|
||||||
searchQuery = searchQuery,
|
searchQuery = searchQuery,
|
||||||
|
@ -30,7 +30,6 @@ import tachiyomi.presentation.core.util.plus
|
|||||||
fun LibraryPager(
|
fun LibraryPager(
|
||||||
state: PagerState,
|
state: PagerState,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
pageCount: Int,
|
|
||||||
hasActiveFilters: Boolean,
|
hasActiveFilters: Boolean,
|
||||||
selectedManga: List<LibraryManga>,
|
selectedManga: List<LibraryManga>,
|
||||||
searchQuery: String?,
|
searchQuery: String?,
|
||||||
@ -43,7 +42,6 @@ fun LibraryPager(
|
|||||||
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
||||||
) {
|
) {
|
||||||
HorizontalPager(
|
HorizontalPager(
|
||||||
pageCount = pageCount,
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
state = state,
|
state = state,
|
||||||
verticalAlignment = Alignment.Top,
|
verticalAlignment = Alignment.Top,
|
||||||
|
@ -18,6 +18,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|||||||
import androidx.compose.material3.DatePicker
|
import androidx.compose.material3.DatePicker
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.RadioButton
|
import androidx.compose.material3.RadioButton
|
||||||
|
import androidx.compose.material3.SelectableDates
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.material3.minimumInteractiveComponentSize
|
import androidx.compose.material3.minimumInteractiveComponentSize
|
||||||
@ -136,13 +137,14 @@ fun TrackScoreSelector(
|
|||||||
fun TrackDateSelector(
|
fun TrackDateSelector(
|
||||||
title: String,
|
title: String,
|
||||||
initialSelectedDateMillis: Long,
|
initialSelectedDateMillis: Long,
|
||||||
dateValidator: (Long) -> Boolean,
|
selectableDates: SelectableDates,
|
||||||
onConfirm: (Long) -> Unit,
|
onConfirm: (Long) -> Unit,
|
||||||
onRemove: (() -> Unit)?,
|
onRemove: (() -> Unit)?,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val pickerState = rememberDatePickerState(
|
val pickerState = rememberDatePickerState(
|
||||||
initialSelectedDateMillis = initialSelectedDateMillis,
|
initialSelectedDateMillis = initialSelectedDateMillis,
|
||||||
|
selectableDates = selectableDates,
|
||||||
)
|
)
|
||||||
AlertDialogContent(
|
AlertDialogContent(
|
||||||
modifier = Modifier.windowInsetsPadding(WindowInsets.systemBars),
|
modifier = Modifier.windowInsetsPadding(WindowInsets.systemBars),
|
||||||
@ -151,7 +153,6 @@ fun TrackDateSelector(
|
|||||||
Column {
|
Column {
|
||||||
DatePicker(
|
DatePicker(
|
||||||
state = pickerState,
|
state = pickerState,
|
||||||
dateValidator = dateValidator,
|
|
||||||
title = null,
|
title = null,
|
||||||
headline = null,
|
headline = null,
|
||||||
showModeToggle = false,
|
showModeToggle = false,
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package eu.kanade.presentation.util
|
package eu.kanade.presentation.util
|
||||||
|
|
||||||
|
import androidx.compose.animation.AnimatedContent
|
||||||
|
import androidx.compose.animation.AnimatedContentTransitionScope
|
||||||
|
import androidx.compose.animation.ContentTransform
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.ProvidableCompositionLocal
|
import androidx.compose.runtime.ProvidableCompositionLocal
|
||||||
import androidx.compose.runtime.staticCompositionLocalOf
|
import androidx.compose.runtime.staticCompositionLocalOf
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import cafe.adriel.voyager.core.model.ScreenModel
|
import cafe.adriel.voyager.core.model.ScreenModel
|
||||||
import cafe.adriel.voyager.core.model.ScreenModelStore
|
import cafe.adriel.voyager.core.model.ScreenModelStore
|
||||||
import cafe.adriel.voyager.core.screen.Screen
|
import cafe.adriel.voyager.core.screen.Screen
|
||||||
@ -10,7 +14,7 @@ import cafe.adriel.voyager.core.screen.ScreenKey
|
|||||||
import cafe.adriel.voyager.core.screen.uniqueScreenKey
|
import cafe.adriel.voyager.core.screen.uniqueScreenKey
|
||||||
import cafe.adriel.voyager.core.stack.StackEvent
|
import cafe.adriel.voyager.core.stack.StackEvent
|
||||||
import cafe.adriel.voyager.navigator.Navigator
|
import cafe.adriel.voyager.navigator.Navigator
|
||||||
import cafe.adriel.voyager.transitions.ScreenTransition
|
import cafe.adriel.voyager.transitions.ScreenTransitionContent
|
||||||
import kotlinx.coroutines.CoroutineName
|
import kotlinx.coroutines.CoroutineName
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -63,3 +67,21 @@ fun DefaultNavigatorScreenTransition(navigator: Navigator) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ScreenTransition(
|
||||||
|
navigator: Navigator,
|
||||||
|
transition: AnimatedContentTransitionScope<Screen>.() -> ContentTransform,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
content: ScreenTransitionContent = { it.Content() },
|
||||||
|
) {
|
||||||
|
AnimatedContent(
|
||||||
|
targetState = navigator.lastItem,
|
||||||
|
transitionSpec = transition,
|
||||||
|
modifier = modifier,
|
||||||
|
) { screen ->
|
||||||
|
navigator.saveableState("transition", screen) {
|
||||||
|
content(screen)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -114,7 +114,7 @@ fun WebViewScreenContent(
|
|||||||
) { contentPadding ->
|
) { contentPadding ->
|
||||||
val webClient = remember {
|
val webClient = remember {
|
||||||
object : AccompanistWebViewClient() {
|
object : AccompanistWebViewClient() {
|
||||||
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
override fun onPageStarted(view: WebView, url: String?, favicon: Bitmap?) {
|
||||||
super.onPageStarted(view, url, favicon)
|
super.onPageStarted(view, url, favicon)
|
||||||
url?.let { onUrlChange(it) }
|
url?.let { onUrlChange(it) }
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import tachiyomi.domain.backup.service.BackupPreferences
|
|||||||
import tachiyomi.domain.library.service.LibraryPreferences
|
import tachiyomi.domain.library.service.LibraryPreferences
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED
|
||||||
import tachiyomi.domain.manga.model.TriStateFilter
|
import tachiyomi.domain.manga.model.TriStateFilter
|
||||||
import uy.kohesive.injekt.Injekt
|
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@ -136,7 +135,6 @@ object Migrations {
|
|||||||
// Force MAL log out due to login flow change
|
// Force MAL log out due to login flow change
|
||||||
// v52: switched from scraping to WebView
|
// v52: switched from scraping to WebView
|
||||||
// v53: switched from WebView to OAuth
|
// v53: switched from WebView to OAuth
|
||||||
val trackManager = Injekt.get<TrackManager>()
|
|
||||||
if (trackManager.myAnimeList.isLogged) {
|
if (trackManager.myAnimeList.isLogged) {
|
||||||
trackManager.myAnimeList.logout()
|
trackManager.myAnimeList.logout()
|
||||||
context.toast(R.string.myanimelist_relogin)
|
context.toast(R.string.myanimelist_relogin)
|
||||||
|
@ -5,7 +5,7 @@ import androidx.compose.animation.AnimatedContent
|
|||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.expandVertically
|
import androidx.compose.animation.expandVertically
|
||||||
import androidx.compose.animation.shrinkVertically
|
import androidx.compose.animation.shrinkVertically
|
||||||
import androidx.compose.animation.with
|
import androidx.compose.animation.togetherWith
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.RowScope
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
@ -121,7 +121,7 @@ object HomeScreen : Screen() {
|
|||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
targetState = tabNavigator.current,
|
targetState = tabNavigator.current,
|
||||||
transitionSpec = {
|
transitionSpec = {
|
||||||
materialFadeThroughIn(initialScale = 1f, durationMillis = TabFadeDuration) with
|
materialFadeThroughIn(initialScale = 1f, durationMillis = TabFadeDuration) togetherWith
|
||||||
materialFadeThroughOut(durationMillis = TabFadeDuration)
|
materialFadeThroughOut(durationMillis = TabFadeDuration)
|
||||||
},
|
},
|
||||||
content = {
|
content = {
|
||||||
|
@ -14,6 +14,7 @@ import androidx.compose.material3.ButtonDefaults
|
|||||||
import androidx.compose.material3.FilledTonalButton
|
import androidx.compose.material3.FilledTonalButton
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.SelectableDates
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -423,6 +424,62 @@ private data class TrackDateSelectorScreen(
|
|||||||
private val start: Boolean,
|
private val start: Boolean,
|
||||||
) : Screen() {
|
) : Screen() {
|
||||||
|
|
||||||
|
private val selectableDates = object : SelectableDates {
|
||||||
|
override fun isSelectableDate(utcTimeMillis: Long): Boolean {
|
||||||
|
val dateToCheck = Instant.ofEpochMilli(utcTimeMillis)
|
||||||
|
.atZone(ZoneOffset.systemDefault())
|
||||||
|
.toLocalDate()
|
||||||
|
|
||||||
|
if (dateToCheck > LocalDate.now()) {
|
||||||
|
// Disallow future dates
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return if (start && track.finishDate > 0) {
|
||||||
|
// Disallow start date to be set later than finish date
|
||||||
|
val dateFinished = Instant.ofEpochMilli(track.finishDate)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDate()
|
||||||
|
dateToCheck <= dateFinished
|
||||||
|
} else if (!start && track.startDate > 0) {
|
||||||
|
// Disallow end date to be set earlier than start date
|
||||||
|
val dateStarted = Instant.ofEpochMilli(track.startDate)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDate()
|
||||||
|
dateToCheck >= dateStarted
|
||||||
|
} else {
|
||||||
|
// Nothing set before
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun isSelectableYear(year: Int): Boolean {
|
||||||
|
if (year > LocalDate.now().year) {
|
||||||
|
// Disallow future dates
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return if (start && track.finishDate > 0) {
|
||||||
|
// Disallow start date to be set later than finish date
|
||||||
|
val dateFinished = Instant.ofEpochMilli(track.finishDate)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDate()
|
||||||
|
.year
|
||||||
|
year <= dateFinished
|
||||||
|
} else if (!start && track.startDate > 0) {
|
||||||
|
// Disallow end date to be set earlier than start date
|
||||||
|
val dateStarted = Instant.ofEpochMilli(track.startDate)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDate()
|
||||||
|
.year
|
||||||
|
year >= dateStarted
|
||||||
|
} else {
|
||||||
|
// Nothing set before
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
@ -446,33 +503,7 @@ private data class TrackDateSelectorScreen(
|
|||||||
stringResource(R.string.track_finished_reading_date)
|
stringResource(R.string.track_finished_reading_date)
|
||||||
},
|
},
|
||||||
initialSelectedDateMillis = sm.initialSelection,
|
initialSelectedDateMillis = sm.initialSelection,
|
||||||
dateValidator = { utcMillis ->
|
selectableDates = selectableDates,
|
||||||
val dateToCheck = Instant.ofEpochMilli(utcMillis)
|
|
||||||
.atZone(ZoneOffset.systemDefault())
|
|
||||||
.toLocalDate()
|
|
||||||
|
|
||||||
if (dateToCheck > LocalDate.now()) {
|
|
||||||
// Disallow future dates
|
|
||||||
return@TrackDateSelector false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (start && track.finishDate > 0) {
|
|
||||||
// Disallow start date to be set later than finish date
|
|
||||||
val dateFinished = Instant.ofEpochMilli(track.finishDate)
|
|
||||||
.atZone(ZoneId.systemDefault())
|
|
||||||
.toLocalDate()
|
|
||||||
dateToCheck <= dateFinished
|
|
||||||
} else if (!start && track.startDate > 0) {
|
|
||||||
// Disallow end date to be set earlier than start date
|
|
||||||
val dateStarted = Instant.ofEpochMilli(track.startDate)
|
|
||||||
.atZone(ZoneId.systemDefault())
|
|
||||||
.toLocalDate()
|
|
||||||
dateToCheck >= dateStarted
|
|
||||||
} else {
|
|
||||||
// Nothing set before
|
|
||||||
true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onConfirm = { sm.setDate(it); navigator.pop() },
|
onConfirm = { sm.setDate(it); navigator.pop() },
|
||||||
onRemove = { sm.confirmRemoveDate(navigator) }.takeIf { canRemove },
|
onRemove = { sm.confirmRemoveDate(navigator) }.takeIf { canRemove },
|
||||||
onDismissRequest = navigator::pop,
|
onDismissRequest = navigator::pop,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[versions]
|
[versions]
|
||||||
compiler = "1.4.7"
|
compiler = "1.4.7"
|
||||||
compose-bom = "2023.03.00"
|
compose-bom = "2023.04.00-alpha04"
|
||||||
accompanist = "0.30.1"
|
accompanist = "0.31.2-alpha"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
activity = "androidx.activity:activity-compose:1.7.1"
|
activity = "androidx.activity:activity-compose:1.7.1"
|
||||||
|
@ -60,7 +60,7 @@ flexible-adapter-ui = "com.github.arkon.FlexibleAdapter:flexible-adapter-ui:c801
|
|||||||
photoview = "com.github.chrisbanes:PhotoView:2.3.0"
|
photoview = "com.github.chrisbanes:PhotoView:2.3.0"
|
||||||
directionalviewpager = "com.github.tachiyomiorg:DirectionalViewPager:1.0.0"
|
directionalviewpager = "com.github.tachiyomiorg:DirectionalViewPager:1.0.0"
|
||||||
insetter = "dev.chrisbanes.insetter:insetter:0.6.1"
|
insetter = "dev.chrisbanes.insetter:insetter:0.6.1"
|
||||||
compose-materialmotion = "io.github.fornewid:material-motion-compose-core:0.12.3"
|
compose-materialmotion = "io.github.fornewid:material-motion-compose-core:1.0.2"
|
||||||
compose-simpleicons = "br.com.devsrsouza.compose.icons.android:simple-icons:1.0.0"
|
compose-simpleicons = "br.com.devsrsouza.compose.icons.android:simple-icons:1.0.0"
|
||||||
|
|
||||||
logcat = "com.squareup.logcat:logcat:0.1"
|
logcat = "com.squareup.logcat:logcat:0.1"
|
||||||
|
@ -4,9 +4,9 @@ import androidx.compose.foundation.gestures.Orientation
|
|||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.pager.PageSize
|
import androidx.compose.foundation.pager.PageSize
|
||||||
import androidx.compose.foundation.pager.PagerDefaults
|
import androidx.compose.foundation.pager.PagerDefaults
|
||||||
|
import androidx.compose.foundation.pager.PagerScope
|
||||||
import androidx.compose.foundation.pager.PagerSnapDistance
|
import androidx.compose.foundation.pager.PagerSnapDistance
|
||||||
import androidx.compose.foundation.pager.PagerState
|
import androidx.compose.foundation.pager.PagerState
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -19,9 +19,8 @@ import androidx.compose.ui.unit.dp
|
|||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun HorizontalPager(
|
fun HorizontalPager(
|
||||||
pageCount: Int,
|
state: PagerState,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
state: PagerState = rememberPagerState(),
|
|
||||||
contentPadding: PaddingValues = PaddingValues(0.dp),
|
contentPadding: PaddingValues = PaddingValues(0.dp),
|
||||||
pageSize: PageSize = PageSize.Fill,
|
pageSize: PageSize = PageSize.Fill,
|
||||||
beyondBoundsPageCount: Int = 0,
|
beyondBoundsPageCount: Int = 0,
|
||||||
@ -33,12 +32,11 @@ fun HorizontalPager(
|
|||||||
pageNestedScrollConnection: NestedScrollConnection = PagerDefaults.pageNestedScrollConnection(
|
pageNestedScrollConnection: NestedScrollConnection = PagerDefaults.pageNestedScrollConnection(
|
||||||
Orientation.Horizontal,
|
Orientation.Horizontal,
|
||||||
),
|
),
|
||||||
pageContent: @Composable (page: Int) -> Unit,
|
pageContent: @Composable PagerScope.(page: Int) -> Unit,
|
||||||
) {
|
) {
|
||||||
androidx.compose.foundation.pager.HorizontalPager(
|
androidx.compose.foundation.pager.HorizontalPager(
|
||||||
pageCount = pageCount,
|
|
||||||
modifier = modifier,
|
|
||||||
state = state,
|
state = state,
|
||||||
|
modifier = modifier,
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
pageSize = pageSize,
|
pageSize = pageSize,
|
||||||
beyondBoundsPageCount = beyondBoundsPageCount,
|
beyondBoundsPageCount = beyondBoundsPageCount,
|
||||||
|
Loading…
Reference in New Issue
Block a user