From ccc4144f3cc2264c3ae75d492983e9577f352af1 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 27 Oct 2022 16:50:44 -0400 Subject: [PATCH] Remove side nav icon alignment preference Simplifying it to just always be centered, which is what most Google apps seem to be doing anyway. --- .../java/eu/kanade/domain/ui/UiPreferences.kt | 2 -- .../screen/SettingsAppearanceScreen.kt | 25 +------------------ .../kanade/tachiyomi/ui/main/MainActivity.kt | 13 ---------- .../main/res/layout-sw720dp/main_activity.xml | 3 ++- i18n/src/main/res/values/strings.xml | 4 --- 5 files changed, 3 insertions(+), 44 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt b/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt index 69868bb13..9a7577fee 100644 --- a/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt +++ b/app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt @@ -16,8 +16,6 @@ class UiPreferences( private val preferenceStore: PreferenceStore, ) { - fun sideNavIconAlignment() = preferenceStore.getInt("pref_side_nav_icon_alignment", 0) - fun themeMode() = preferenceStore.getEnum( "pref_theme_mode_key", if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { ThemeMode.SYSTEM } else { ThemeMode.LIGHT }, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt index cb9cbec8b..e423712ce 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAppearanceScreen.kt @@ -19,7 +19,6 @@ import eu.kanade.domain.ui.model.setAppCompatDelegateThemeMode import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.util.collectAsState import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.util.system.isAutoTabletUiAvailable import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.drop @@ -105,22 +104,11 @@ class SettingsAppearanceScreen : SearchableSettings { context: Context, uiPreferences: UiPreferences, ): Preference.PreferenceGroup { - val tabletUiModePref = uiPreferences.tabletUiMode() - val tabletUiMode by tabletUiModePref.collectAsState() - - val isTabletUiAvailable = remember(tabletUiMode) { // won't survive config change - when (tabletUiMode) { - TabletUiMode.AUTOMATIC -> context.resources.configuration.isAutoTabletUiAvailable() - TabletUiMode.NEVER -> false - else -> true - } - } - return Preference.PreferenceGroup( title = stringResource(R.string.pref_category_display), preferenceItems = listOf( Preference.PreferenceItem.ListPreference( - pref = tabletUiModePref, + pref = uiPreferences.tabletUiMode(), title = stringResource(R.string.pref_tablet_ui_mode), entries = TabletUiMode.values().associateWith { stringResource(it.titleResId) }, onValueChanged = { @@ -128,17 +116,6 @@ class SettingsAppearanceScreen : SearchableSettings { true }, ), - Preference.PreferenceItem.ListPreference( - pref = uiPreferences.sideNavIconAlignment(), - title = stringResource(R.string.pref_side_nav_icon_alignment), - subtitle = "%s", - enabled = isTabletUiAvailable, - entries = mapOf( - 0 to stringResource(R.string.alignment_top), - 1 to stringResource(R.string.alignment_center), - 2 to stringResource(R.string.alignment_bottom), - ), - ), ), ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 6bb4c3370..366d9a64a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -6,7 +6,6 @@ import android.content.Intent import android.graphics.Color import android.os.Build import android.os.Bundle -import android.view.Gravity import android.view.ViewGroup import android.view.Window import android.widget.Toast @@ -158,18 +157,6 @@ class MainActivity : BaseActivity() { } setSplashScreenExitAnimation(splashScreen) - if (binding.sideNav != null) { - uiPreferences.sideNavIconAlignment() - .asHotFlow { - binding.sideNav?.menuGravity = when (it) { - 1 -> Gravity.CENTER - 2 -> Gravity.BOTTOM - else -> Gravity.TOP - } - } - .launchIn(lifecycleScope) - } - nav.setOnItemSelectedListener { item -> val id = item.itemId diff --git a/app/src/main/res/layout-sw720dp/main_activity.xml b/app/src/main/res/layout-sw720dp/main_activity.xml index cf51be786..8d5efb178 100644 --- a/app/src/main/res/layout-sw720dp/main_activity.xml +++ b/app/src/main/res/layout-sw720dp/main_activity.xml @@ -63,7 +63,8 @@ android:paddingTop="?attr/actionBarSize" app:elevation="1dp" app:layout_constraintStart_toStartOf="parent" - app:menu="@menu/main_nav" /> + app:menu="@menu/main_nav" + app:menuGravity="center" /> Yotsuba Tidal Wave Pure black dark mode - Side navigation icon alignment - Top - Center - Bottom Timestamps Relative timestamps Short (Today, Yesterday)