From b008223661fe74cad382b1c89d4b66f7ec0baee4 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 8 Jul 2023 17:47:10 -0400 Subject: [PATCH] Minor reorganization --- .../more/settings/screen/SettingsAdvancedScreen.kt | 1 + .../more/settings/screen/SettingsMainScreen.kt | 1 + .../more/settings/screen/SettingsSearchScreen.kt | 12 +++++++----- .../more/settings/screen/{ => about}/AboutScreen.kt | 2 +- .../{ => about}/OpenSourceLibraryLicenseScreen.kt | 2 +- .../screen/{ => about}/OpenSourceLicensesScreen.kt | 2 +- .../screen/{ => advanced}/ClearDatabaseScreen.kt | 2 +- .../more/settings/screen/debug/DebugInfoScreen.kt | 2 +- .../eu/kanade/tachiyomi/ui/setting/SettingsScreen.kt | 2 +- 9 files changed, 15 insertions(+), 11 deletions(-) rename app/src/main/java/eu/kanade/presentation/more/settings/screen/{ => about}/AboutScreen.kt (99%) rename app/src/main/java/eu/kanade/presentation/more/settings/screen/{ => about}/OpenSourceLibraryLicenseScreen.kt (98%) rename app/src/main/java/eu/kanade/presentation/more/settings/screen/{ => about}/OpenSourceLicensesScreen.kt (97%) rename app/src/main/java/eu/kanade/presentation/more/settings/screen/{ => advanced}/ClearDatabaseScreen.kt (99%) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt index c74437b855..20a91ee0d6 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt @@ -28,6 +28,7 @@ import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow import eu.kanade.domain.base.BasePreferences import eu.kanade.presentation.more.settings.Preference +import eu.kanade.presentation.more.settings.screen.advanced.ClearDatabaseScreen import eu.kanade.presentation.more.settings.screen.debug.DebugInfoScreen import eu.kanade.presentation.util.collectAsState import eu.kanade.tachiyomi.R diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt index 5b094865b3..6bd98f9dd5 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt @@ -44,6 +44,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBarActions import eu.kanade.presentation.components.UpIcon +import eu.kanade.presentation.more.settings.screen.about.AboutScreen import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget import eu.kanade.presentation.util.LocalBackPress import eu.kanade.presentation.util.Screen diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt index fa83921405..a5dc8a620a 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt @@ -1,6 +1,5 @@ package eu.kanade.presentation.more.settings.screen -import android.content.res.Resources import androidx.compose.animation.Crossfade import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column @@ -39,12 +38,14 @@ import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow @@ -52,7 +53,6 @@ import eu.kanade.presentation.components.UpIcon import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.util.Screen import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.util.system.isLTR import tachiyomi.presentation.core.components.material.Divider import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.screens.EmptyScreen @@ -165,6 +165,8 @@ private fun SearchResult( ) { if (searchKey.isEmpty()) return + val isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr + val index = getIndex() val result by produceState?>(initialValue = null, searchKey) { value = index.asSequence() @@ -200,7 +202,7 @@ private fun SearchResult( SearchResultItem( route = settingsData.route, title = p.title, - breadcrumbs = getLocalizedBreadcrumb(path = settingsData.title, node = categoryTitle), + breadcrumbs = getLocalizedBreadcrumb(path = settingsData.title, node = categoryTitle, isLtr = isLtr), highlightKey = p.title, ) } @@ -265,11 +267,11 @@ private fun getIndex() = settingScreens ) } -private fun getLocalizedBreadcrumb(path: String, node: String?): String { +private fun getLocalizedBreadcrumb(path: String, node: String?, isLtr: Boolean): String { return if (node == null) { path } else { - if (Resources.getSystem().isLTR) { + if (isLtr) { // This locale reads left to right. "$path > $node" } else { diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/AboutScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/AboutScreen.kt similarity index 99% rename from app/src/main/java/eu/kanade/presentation/more/settings/screen/AboutScreen.kt rename to app/src/main/java/eu/kanade/presentation/more/settings/screen/about/AboutScreen.kt index 655e97e85e..6f42edb7ae 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/AboutScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/AboutScreen.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.more.settings.screen +package eu.kanade.presentation.more.settings.screen.about import android.content.Context import androidx.compose.animation.AnimatedVisibility diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/OpenSourceLibraryLicenseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt similarity index 98% rename from app/src/main/java/eu/kanade/presentation/more/settings/screen/OpenSourceLibraryLicenseScreen.kt rename to app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt index 2a35fb017d..ffc7bf5449 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/OpenSourceLibraryLicenseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLibraryLicenseScreen.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.more.settings.screen +package eu.kanade.presentation.more.settings.screen.about import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/OpenSourceLicensesScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLicensesScreen.kt similarity index 97% rename from app/src/main/java/eu/kanade/presentation/more/settings/screen/OpenSourceLicensesScreen.kt rename to app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLicensesScreen.kt index 6ca9b5831c..e5b94adb83 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/OpenSourceLicensesScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/about/OpenSourceLicensesScreen.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.more.settings.screen +package eu.kanade.presentation.more.settings.screen.about import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt similarity index 99% rename from app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt rename to app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt index 54580d96bd..89e0d951c0 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/ClearDatabaseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.more.settings.screen +package eu.kanade.presentation.more.settings.screen.advanced import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/DebugInfoScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/DebugInfoScreen.kt index 4588c5fe23..8f656aa955 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/DebugInfoScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/DebugInfoScreen.kt @@ -12,7 +12,7 @@ import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.more.settings.PreferenceScaffold -import eu.kanade.presentation.more.settings.screen.AboutScreen +import eu.kanade.presentation.more.settings.screen.about.AboutScreen import eu.kanade.presentation.util.Screen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.DeviceUtil diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsScreen.kt index 8a18219ad4..5a6d05025b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsScreen.kt @@ -12,10 +12,10 @@ import androidx.compose.ui.Modifier import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.navigator.currentOrThrow -import eu.kanade.presentation.more.settings.screen.AboutScreen import eu.kanade.presentation.more.settings.screen.SettingsAppearanceScreen import eu.kanade.presentation.more.settings.screen.SettingsBackupScreen import eu.kanade.presentation.more.settings.screen.SettingsMainScreen +import eu.kanade.presentation.more.settings.screen.about.AboutScreen import eu.kanade.presentation.util.DefaultNavigatorScreenTransition import eu.kanade.presentation.util.LocalBackPress import eu.kanade.presentation.util.Screen