From ae394da38734ab8faac0011674222181b934f905 Mon Sep 17 00:00:00 2001 From: Ash Date: Sun, 22 May 2022 05:06:49 +0800 Subject: [PATCH] Update dependencies --- app/build.gradle | 2 +- .../reader/ui/component/base/RYScaffold.kt | 18 +++++----- .../reader/ui/component/base/RYTextField.kt | 2 +- .../reader/ui/page/home/feeds/FeedsPage.kt | 4 +-- .../home/feeds/subscribe/SubscribeDialog.kt | 2 +- .../ash/reader/ui/page/home/flow/FlowPage.kt | 5 +-- .../ash/reader/ui/page/home/flow/SearchBar.kt | 2 +- .../reading/{ReadBar.kt => ReadingBar.kt} | 6 ++-- .../ui/page/home/reading/ReadingPage.kt | 17 +++++++--- .../reader/ui/page/settings/SettingsPage.kt | 2 ++ .../page/settings/color/ColorAndStylePage.kt | 4 ++- .../ui/page/settings/color/DarkThemePage.kt | 5 ++- .../color/feeds/FeedsPageStylePage.kt | 4 ++- .../settings/color/flow/FlowPageStylePage.kt | 4 ++- .../settings/interaction/InteractionPage.kt | 7 ++-- .../page/settings/languages/LanguagesPage.kt | 6 ++-- build.gradle | 33 ++++++++++++++----- 17 files changed, 79 insertions(+), 44 deletions(-) rename app/src/main/java/me/ash/reader/ui/page/home/reading/{ReadBar.kt => ReadingBar.kt} (97%) diff --git a/app/build.gradle b/app/build.gradle index 16cbc01..5964199 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -116,7 +116,7 @@ dependencies { implementation "org.conscrypt:conscrypt-android:2.5.2" // https://square.github.io/okhttp/changelogs/changelog/ - implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.6" + implementation "com.squareup.okhttp3:okhttp:$okhttp" implementation "com.squareup.retrofit2:retrofit:$retrofit2" implementation "com.squareup.retrofit2:converter-gson:$retrofit2" diff --git a/app/src/main/java/me/ash/reader/ui/component/base/RYScaffold.kt b/app/src/main/java/me/ash/reader/ui/component/base/RYScaffold.kt index c2c3ffe..773aed4 100644 --- a/app/src/main/java/me/ash/reader/ui/component/base/RYScaffold.kt +++ b/app/src/main/java/me/ash/reader/ui/component/base/RYScaffold.kt @@ -1,13 +1,8 @@ package me.ash.reader.ui.component.base import androidx.compose.foundation.background -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.navigationBarsPadding -import androidx.compose.foundation.layout.statusBarsPadding -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.SmallTopAppBar -import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.foundation.layout.* +import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -28,7 +23,7 @@ fun RYScaffold( floatingActionButton: (@Composable () -> Unit)? = null, content: @Composable () -> Unit = {}, ) { - androidx.compose.material3.Scaffold( + Scaffold( modifier = Modifier .background( MaterialTheme.colorScheme.surfaceColorAtElevation( @@ -62,7 +57,12 @@ fun RYScaffold( ) } }, - content = { content() }, + content = { + Column { + Spacer(modifier = Modifier.height(it.calculateTopPadding())) + content() + } + }, bottomBar = { bottomBar?.invoke() }, floatingActionButton = { floatingActionButton?.invoke() }, ) diff --git a/app/src/main/java/me/ash/reader/ui/component/base/RYTextField.kt b/app/src/main/java/me/ash/reader/ui/component/base/RYTextField.kt index 12dad9e..e881e88 100644 --- a/app/src/main/java/me/ash/reader/ui/component/base/RYTextField.kt +++ b/app/src/main/java/me/ash/reader/ui/component/base/RYTextField.kt @@ -39,7 +39,7 @@ fun RYTextField( TextField( modifier = Modifier.focusRequester(focusRequester), colors = TextFieldDefaults.textFieldColors( - backgroundColor = Color.Transparent, + containerColor = Color.Transparent, ), maxLines = 1, enabled = !readOnly, diff --git a/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsPage.kt b/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsPage.kt index d05e283..4ed4ee6 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsPage.kt @@ -67,7 +67,7 @@ fun FeedsPage( val newVersion = LocalNewVersionNumber.current val skipVersion = LocalSkipVersionNumber.current - val currentVersion by remember { mutableStateOf(context.getCurrentVersion()) } + val currentVersion = remember { context.getCurrentVersion() } val owner = LocalLifecycleOwner.current var isSyncing by remember { mutableStateOf(false) } @@ -89,7 +89,7 @@ fun FeedsPage( ) { result -> feedsViewModel.exportAsOpml { string -> result?.let { uri -> - context.contentResolver.openOutputStream(uri)?.let { outputStream -> + context.contentResolver.openOutputStream(uri)?.use { outputStream -> outputStream.write(string.toByteArray()) } } diff --git a/app/src/main/java/me/ash/reader/ui/page/home/feeds/subscribe/SubscribeDialog.kt b/app/src/main/java/me/ash/reader/ui/page/home/feeds/subscribe/SubscribeDialog.kt index 4e44430..9d122b2 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/feeds/subscribe/SubscribeDialog.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/feeds/subscribe/SubscribeDialog.kt @@ -45,7 +45,7 @@ fun SubscribeDialog( val groupsState = subscribeUiState.groups.collectAsState(initial = emptyList()) val launcher = rememberLauncherForActivityResult(ActivityResultContracts.GetContent()) { it?.let { uri -> - context.contentResolver.openInputStream(uri)?.let { inputStream -> + context.contentResolver.openInputStream(uri)?.use { inputStream -> subscribeViewModel.importFromInputStream(inputStream) } } diff --git a/app/src/main/java/me/ash/reader/ui/page/home/flow/FlowPage.kt b/app/src/main/java/me/ash/reader/ui/page/home/flow/FlowPage.kt index b67e8f5..3fba040 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/flow/FlowPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/flow/FlowPage.kt @@ -240,10 +240,7 @@ fun FlowPage( } } item { - Spacer(modifier = Modifier.height(64.dp)) - if (pagingItems.loadState.source.refresh is LoadState.NotLoading && pagingItems.itemCount != 0) { - Spacer(modifier = Modifier.height(64.dp)) - } + Spacer(modifier = Modifier.height(128.dp)) Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) } } diff --git a/app/src/main/java/me/ash/reader/ui/page/home/flow/SearchBar.kt b/app/src/main/java/me/ash/reader/ui/page/home/flow/SearchBar.kt index c327c92..9c6e0b6 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/flow/SearchBar.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/flow/SearchBar.kt @@ -62,7 +62,7 @@ fun SearchBar( .fillMaxWidth() .focusRequester(focusRequester), colors = TextFieldDefaults.textFieldColors( - backgroundColor = Color.Transparent, + containerColor = Color.Transparent, focusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent, ), diff --git a/app/src/main/java/me/ash/reader/ui/page/home/reading/ReadBar.kt b/app/src/main/java/me/ash/reader/ui/page/home/reading/ReadingBar.kt similarity index 97% rename from app/src/main/java/me/ash/reader/ui/page/home/reading/ReadBar.kt rename to app/src/main/java/me/ash/reader/ui/page/home/reading/ReadingBar.kt index e3bf3a2..a5af7e8 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/reading/ReadBar.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/reading/ReadingBar.kt @@ -26,7 +26,7 @@ import me.ash.reader.R import me.ash.reader.ui.component.base.CanBeDisabledIconButton @Composable -fun ReadBar( +fun ReadingBar( modifier: Modifier = Modifier, disabled: Boolean, isUnread: Boolean, @@ -40,9 +40,7 @@ fun ReadBar( var fullContent by remember { mutableStateOf(isFullContent) } Surface( - modifier = Modifier - .background(MaterialTheme.colorScheme.surface) - .navigationBarsPadding(), + modifier = modifier.background(MaterialTheme.colorScheme.surface), tonalElevation = 0.dp, ) { Box( diff --git a/app/src/main/java/me/ash/reader/ui/page/home/reading/ReadingPage.kt b/app/src/main/java/me/ash/reader/ui/page/home/reading/ReadingPage.kt index e1bf4e6..f6fef8c 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/reading/ReadingPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/reading/ReadingPage.kt @@ -80,6 +80,7 @@ fun ReadingPage( articleWithFeed = readingUiState.articleWithFeed, isLoading = readingUiState.isLoading, listState = readingUiState.listState, + isShowToolBar = readingUiState.articleWithFeed == null || !isScrollDown, ) Box( modifier = Modifier @@ -186,6 +187,7 @@ private fun Content( articleWithFeed: ArticleWithFeed?, listState: LazyListState, isLoading: Boolean, + isShowToolBar: Boolean, ) { if (articleWithFeed == null) return val context = LocalContext.current @@ -195,7 +197,13 @@ private fun Content( modifier = Modifier .fillMaxSize() .statusBarsPadding() - .navigationBarsPadding() + .run { + if (isShowToolBar) { + navigationBarsPadding() + } else { + this + } + } .drawVerticalScrollbar(listState), state = listState, ) { @@ -242,8 +250,8 @@ private fun Content( ) } item { - Spacer(modifier = Modifier.height(64.dp)) - Spacer(modifier = Modifier.height(64.dp)) + Spacer(modifier = Modifier.height(128.dp)) + Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) } } } @@ -263,7 +271,8 @@ private fun BottomBar( enter = fadeIn() + expandVertically(), exit = fadeOut() + shrinkVertically(), ) { - ReadBar( + ReadingBar( + modifier = Modifier.navigationBarsPadding(), disabled = false, isUnread = articleWithFeed.article.isUnread, isStarred = articleWithFeed.article.isStarred, diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/SettingsPage.kt b/app/src/main/java/me/ash/reader/ui/page/settings/SettingsPage.kt index 9d13f7f..6821916 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/SettingsPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/SettingsPage.kt @@ -138,6 +138,8 @@ fun SettingsPage( launchSingleTop = true } } + } + item { Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) } } diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/color/ColorAndStylePage.kt b/app/src/main/java/me/ash/reader/ui/page/settings/color/ColorAndStylePage.kt index 818498e..9f5b697 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/color/ColorAndStylePage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/color/ColorAndStylePage.kt @@ -182,7 +182,9 @@ fun ColorAndStylePage( enable = false, onClick = {}, ) {} - Spacer(modifier = Modifier.height(24.dp)) + } + item { + Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) } } } diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/color/DarkThemePage.kt b/app/src/main/java/me/ash/reader/ui/page/settings/color/DarkThemePage.kt index 88b7441..be16636 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/color/DarkThemePage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/color/DarkThemePage.kt @@ -1,6 +1,6 @@ package me.ash.reader.ui.page.settings.color -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ArrowBack @@ -77,6 +77,9 @@ fun DarkThemePage( } } } + item { + Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) + } } } ) diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/color/feeds/FeedsPageStylePage.kt b/app/src/main/java/me/ash/reader/ui/page/settings/color/feeds/FeedsPageStylePage.kt index 108e0c3..2c4095f 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/color/feeds/FeedsPageStylePage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/color/feeds/FeedsPageStylePage.kt @@ -185,7 +185,9 @@ fun FeedsPageStylePage( filterBarTonalElevationDialogVisible = true }, ) {} - Spacer(modifier = Modifier.height(24.dp)) + } + item { + Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) } } } diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/color/flow/FlowPageStylePage.kt b/app/src/main/java/me/ash/reader/ui/page/settings/color/flow/FlowPageStylePage.kt index 0161668..d8c7116 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/color/flow/FlowPageStylePage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/color/flow/FlowPageStylePage.kt @@ -247,7 +247,9 @@ fun FlowPageStylePage( filterBarTonalElevationDialogVisible = true }, ) {} - Spacer(modifier = Modifier.height(24.dp)) + } + item { + Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) } } } diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/interaction/InteractionPage.kt b/app/src/main/java/me/ash/reader/ui/page/settings/interaction/InteractionPage.kt index 6ca2abc..e8b39cc 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/interaction/InteractionPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/interaction/InteractionPage.kt @@ -1,8 +1,6 @@ package me.ash.reader.ui.page.settings.interaction -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.ArrowBack @@ -70,6 +68,9 @@ fun InteractionPage( }, ) {} } + item { + Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) + } } } ) diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/languages/LanguagesPage.kt b/app/src/main/java/me/ash/reader/ui/page/settings/languages/LanguagesPage.kt index f7dddc1..0268562 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/languages/LanguagesPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/languages/LanguagesPage.kt @@ -2,8 +2,7 @@ package me.ash.reader.ui.page.settings.languages import android.content.Intent import android.net.Uri -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.KeyboardArrowRight @@ -88,6 +87,9 @@ fun LanguagesPage( } } } + item { + Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) + } } } ) diff --git a/build.gradle b/build.gradle index 02bfb71..3cea2b7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,37 @@ buildscript { ext { - compose = '1.2.0-alpha07' - accompanist = '0.24.6-alpha' - material3 = '1.0.0-alpha09' - lifecycle = '2.5.0-alpha06' - navigation = '2.5.0-alpha04' + // https://developer.android.com/jetpack/androidx/releases/compose-ui + compose = '1.2.0-beta02' + // https://github.com/google/accompanist/releases + accompanist = '0.24.7-alpha' + // https://developer.android.com/jetpack/androidx/releases/compose-material3 + material3 = '1.0.0-alpha12' + // https://developer.android.com/jetpack/androidx/releases/lifecycle + lifecycle = '2.5.0-rc01' + // https://developer.android.com/jetpack/androidx/releases/navigation + navigation = '2.5.0-rc01' + // https://developer.android.com/jetpack/androidx/releases/paging paging = '3.1.1' + // https://developer.android.com/jetpack/androidx/releases/room room = '2.5.0-alpha01' + // https://developer.android.com/jetpack/androidx/releases/datastore datastore = '1.0.0' + // https://developer.android.com/jetpack/androidx/releases/work work = '2.8.0-alpha02' - profileinstaller = '1.2.0-alpha02' + // https://developer.android.com/jetpack/androidx/releases/profileinstaller + profileinstaller = '1.2.0-beta02' + // https://square.github.io/okhttp/changelogs/changelog/ + okhttp = '5.0.0-alpha.7' retrofit2 = '2.9.0' - coil = '2.0.0-rc03' + // https://coil-kt.github.io/coil/changelog/ + coil = '2.1.0' + // https://mvnrepository.com/artifact/com.rometools/rome rome = '1.18.0' + // https://github.com/dankito/Readability4J readability4j = '1.0.8' + // https://github.com/mdewilde/opml-parser opmlParser = '2.2.0' + // http://bigbadaboom.github.io/androidsvg/release_notes.html androidSVG = '1.4' } @@ -27,7 +44,7 @@ buildscript { plugins { id 'com.android.application' version '7.1.1' apply false id 'com.android.library' version '7.1.1' apply false - id 'org.jetbrains.kotlin.android' version '1.6.10' apply false + id 'org.jetbrains.kotlin.android' version '1.6.21' apply false } task clean(type: Delete) {