Remove side nav icon alignment preference

Simplifying it to just always be centered, which is what most Google apps seem to be doing anyway.
This commit is contained in:
arkon 2022-10-27 16:50:44 -04:00
parent d5b4bb49b1
commit ccc4144f3c
5 changed files with 3 additions and 44 deletions

View File

@ -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 },

View File

@ -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),
),
),
),
)
}

View File

@ -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

View File

@ -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" />
<eu.kanade.tachiyomi.widget.TachiyomiChangeHandlerFrameLayout
android:id="@+id/controller_container"

View File

@ -187,10 +187,6 @@
<string name="theme_yotsuba">Yotsuba</string>
<string name="theme_tidalwave">Tidal Wave</string>
<string name="pref_dark_theme_pure_black">Pure black dark mode</string>
<string name="pref_side_nav_icon_alignment">Side navigation icon alignment</string>
<string name="alignment_top">Top</string>
<string name="alignment_center">Center</string>
<string name="alignment_bottom">Bottom</string>
<string name="pref_category_timestamps">Timestamps</string>
<string name="pref_relative_format">Relative timestamps</string>
<string name="pref_relative_time_short">Short (Today, Yesterday)</string>