Allow center aligned side nav icons

This commit is contained in:
arkon 2021-06-03 09:30:50 -04:00 committed by Jays2Kings
parent b7f5ed751d
commit 1e138ab476
5 changed files with 19 additions and 10 deletions

View File

@ -202,7 +202,7 @@ object PreferenceKeys {
const val hideBottomNavOnScroll = "hide_bottom_nav_on_scroll"
const val showSideNavOnBottom = "show_side_nav_on_bottom"
const val sideNavIconAlignment = "pref_side_nav_icon_alignment"
const val showSeriesInShortcuts = "show_series_shortcuts"
const val showSourcesInShortcuts = "show_sources_shortcuts"

View File

@ -394,7 +394,7 @@ class PreferencesHelper(val context: Context) {
fun hideBottomNavOnScroll() = flowPrefs.getBoolean(Keys.hideBottomNavOnScroll, true)
fun showSideNavOnBottom() = flowPrefs.getBoolean(Keys.showSideNavOnBottom, false)
fun sideNavIconAlignment() = flowPrefs.getInt(Keys.sideNavIconAlignment, 0)
fun showNsfwSource() = flowPrefs.getBoolean(Keys.showNsfwSource, true)
fun showNsfwExtension() = flowPrefs.getBoolean(Keys.showNsfwExtension, true)

View File

@ -369,9 +369,13 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
binding.toolbar.setIncognitoMode(it)
binding.cardToolbar.setIncognitoMode(it)
}
preferences.showSideNavOnBottom()
preferences.sideNavIconAlignment()
.asImmediateFlowIn(lifecycleScope) {
binding.sideNav?.menuGravity = if (!it) Gravity.TOP else Gravity.BOTTOM
binding.sideNav?.menuGravity = when (it) {
1 -> Gravity.CENTER
2 -> Gravity.BOTTOM
else -> Gravity.TOP
}
}
setExtensionsBadge()
setFloatingToolbar(canShowFloatingToolbar(router.backstack.lastOrNull()?.controller), changeBG = false)

View File

@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.util.system.getPrefTheme
import eu.kanade.tachiyomi.util.system.isInNightMode
import eu.kanade.tachiyomi.util.system.isTablet
import kotlinx.coroutines.flow.launchIn
import java.util.Locale
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
class SettingsGeneralController : SettingsController() {
@ -77,10 +76,16 @@ class SettingsGeneralController : SettingsController() {
defaultValue = true
}
switchPreference {
key = Keys.showSideNavOnBottom
titleRes = R.string.move_side_nav_to_bottom
defaultValue = false
intListPreference(activity) {
key = Keys.sideNavIconAlignment
titleRes = R.string.side_nav_icon_alignment
entriesRes = arrayOf(
R.string.top,
R.string.center,
R.string.bottom,
)
entryRange = 0..2
defaultValue = 0
isVisible = activity?.isTablet() == true
}

View File

@ -619,7 +619,7 @@
<string name="updated_to_">Updated to v%1$s</string>
<string name="secure_screen">Secure screen</string>
<string name="hide_bottom_nav">Auto-hide bottom navigation</string>
<string name="move_side_nav_to_bottom">Move side navigation buttons to bottom</string>
<string name="side_nav_icon_alignment">Side navigation icon alignment</string>
<string name="follow_system_theme">Follow system theme</string>
<string name="hides_on_scroll">Hides when scrolling</string>
<string name="hide_app_block_screenshots">Hide app contents when switching apps and block screenshots</string>