Skip to content

Commit

Permalink
Update Dependencies & Reader UI
Browse files Browse the repository at this point in the history
This commit updates the following dependencies:
- KSP to 2.0.21-1.0.26
- WorkManager to 2.10.0-rc01
- Firebase BOM to 33.5.1

It also refines the Reader UI:
- Removes the `exitAlwaysScrollBehavior` to improve reader bottom bar appearance.
- Modifies the ReaderTopBar and BottomBar to animate in and out smoothly.
- Adds a modifier to the History screen's `SwipeToDismissBox` for customizability.
  • Loading branch information
jacobrein committed Oct 28, 2024
1 parent 94825c8 commit a0d0108
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ fun HistoryUi(
SnackbarResult.ActionPerformed -> item
}
}
}
},
)
} else {
HistoryItemPlaceholder()
Expand All @@ -200,6 +200,7 @@ private fun HistoryItem(
dao: HistoryDao,
logoDrawable: Drawable?,
scope: CoroutineScope,
modifier: Modifier = Modifier,
onError: () -> Unit,
) {
var showPopup by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -233,6 +234,7 @@ private fun HistoryItem(

SwipeToDismissBox(
state = dismissState,
modifier = modifier,
backgroundContent = {
val direction = dismissState.dismissDirection
val color by animateColorAsState(
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ generativeai = "0.9.0"
gradle = "8.7.1"

kotlin = "2.0.21"
kspVersion = "2.0.21-1.0.25"
kspVersion = "2.0.21-1.0.26"

androidxBaselineprofileGradlePlugin = "1.3.3"
composeCollapsable = "0.4.0"
Expand Down Expand Up @@ -33,7 +33,7 @@ jetbrainsCompiler = "1.5.1"
accompanist = "0.36.0"
okhttpVersion = "4.12.0"
ktorVersion = "3.0.0"
workVersion = "2.10.0-beta01"
workVersion = "2.10.0-rc01"
ziplineVersion = "1.1.0"
landscapist = "2.4.1"
protobufVersion = "4.26.1"
Expand Down Expand Up @@ -303,7 +303,7 @@ androidxWebkit = "androidx.webkit:webkit:1.12.1"

mlkitTranslate = "com.google.mlkit:translate:17.0.3"
mlkitLanguage = "com.google.mlkit:language-id:17.0.6"
firebasePlatform = "com.google.firebase:firebase-bom:33.4.0"
firebasePlatform = "com.google.firebase:firebase-bom:33.5.1"
firebaseDatabase = { group = "com.google.firebase", name = "firebase-database" }
firebaseFirestore = { group = "com.google.firebase", name = "firebase-firestore" }
firebaseAuth = { group = "com.google.firebase", name = "firebase-auth" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,13 @@ internal fun FloatingBottomBar(
chapterChange: () -> Unit,
onChapterShow: () -> Unit,
modifier: Modifier = Modifier,
showFloatBar: Boolean = true,
onShowFloatBarChange: (Boolean) -> Unit = {},
exitAlwaysScrollBehavior: FloatingAppBarScrollBehavior? = null,
) {
Box(
modifier = Modifier.fillMaxWidth()
) {
var showFloatBar by remember { mutableStateOf(false) }
HorizontalFloatingAppBar(
modifier = modifier
.align(Alignment.BottomEnd)
Expand Down Expand Up @@ -255,7 +256,7 @@ internal fun FloatingBottomBar(
scrollBehavior = exitAlwaysScrollBehavior,
content = {
FilledIconButton(
onClick = { showFloatBar = !showFloatBar },
onClick = { onShowFloatBarChange(!showFloatBar) },
modifier = Modifier
.width(64.dp)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.ModalDrawerSheet
import androidx.compose.material3.ModalNavigationDrawer
import androidx.compose.material3.Scaffold
import androidx.compose.material3.TimePickerDefaults
import androidx.compose.material3.rememberDrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -79,6 +80,7 @@ import eu.wewox.pagecurl.config.rememberPageCurlConfig
import eu.wewox.pagecurl.page.PageCurl
import eu.wewox.pagecurl.page.PageCurlState
import eu.wewox.pagecurl.page.rememberPageCurlState
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.koin.compose.koinInject

Expand Down Expand Up @@ -195,11 +197,14 @@ fun ReadView(

val floatingBottomBar by mangaSettingsHandling.rememberUseFloatingReaderBottomBar()

val exitAlwaysScrollBehavior = FloatingAppBarDefaults.exitAlwaysScrollBehavior(exitDirection = FloatingAppBarExitDirection.Bottom)
var showFloatBar by remember { mutableStateOf(false) }

LaunchedEffect(showItems) {
if (showItems) {
exitAlwaysScrollBehavior.state.offset = 0f
delay(250)
showFloatBar = true
} else {
showFloatBar = false
}
}

Expand Down Expand Up @@ -267,8 +272,16 @@ fun ReadView(
topBar = {
AnimatedVisibility(
visible = showItems,
enter = slideInVertically { -it } + fadeIn(),
exit = slideOutVertically { -it } + fadeOut()
enter = slideInVertically(
animationSpec = MaterialTheme.motionScheme.fastSpatialSpec()
) { -it } + fadeIn(
animationSpec = MaterialTheme.motionScheme.fastSpatialSpec()
),
exit = slideOutVertically(
animationSpec = MaterialTheme.motionScheme.fastSpatialSpec()
) { -it } + fadeOut(
animationSpec = MaterialTheme.motionScheme.fastSpatialSpec()
)
) {
ReaderTopBar(
pages = pages,
Expand Down Expand Up @@ -299,7 +312,8 @@ fun ReadView(
chapterChange = ::showToast,
onChapterShow = { scope.launch { drawerState.open() } },
vm = readVm,
exitAlwaysScrollBehavior = exitAlwaysScrollBehavior.takeIf { showItems }
showFloatBar = showFloatBar,
onShowFloatBarChange = { showFloatBar = it },
)
} else {
BottomBar(
Expand All @@ -317,7 +331,6 @@ fun ReadView(
}
}
},
modifier = Modifier.nestedScroll(exitAlwaysScrollBehavior)
) { p ->
Box(
modifier = if (showBlur)
Expand Down

0 comments on commit a0d0108

Please sign in to comment.