mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-28 10:38:48 +03:00
Allow center aligned side nav icons (closes #5177)
This commit is contained in:
parent
fb7a458747
commit
6c53bb4d51
6 changed files with 23 additions and 10 deletions
|
@ -15,7 +15,7 @@ object PreferenceKeys {
|
|||
|
||||
const val hideBottomBarOnScroll = "pref_hide_bottom_bar_on_scroll"
|
||||
|
||||
const val showSideNavOnBottom = "pref_show_side_nav_on_bottom"
|
||||
const val sideNavIconAlignment = "pref_side_nav_icon_alignment"
|
||||
|
||||
const val enableTransitions = "pref_enable_transitions_key"
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class PreferencesHelper(val context: Context) {
|
|||
|
||||
fun hideBottomBarOnScroll() = flowPrefs.getBoolean(Keys.hideBottomBarOnScroll, true)
|
||||
|
||||
fun showSideNavOnBottom() = flowPrefs.getBoolean(Keys.showSideNavOnBottom, false)
|
||||
fun sideNavIconAlignment() = flowPrefs.getInt(Keys.sideNavIconAlignment, 0)
|
||||
|
||||
fun useAuthenticator() = flowPrefs.getBoolean(Keys.useAuthenticator, false)
|
||||
|
||||
|
|
|
@ -142,9 +142,13 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||
}
|
||||
|
||||
if (binding.sideNav != null) {
|
||||
preferences.showSideNavOnBottom()
|
||||
preferences.sideNavIconAlignment()
|
||||
.asImmediateFlow {
|
||||
binding.sideNav?.menuGravity = if (!it) Gravity.TOP else Gravity.BOTTOM
|
||||
binding.sideNav?.menuGravity = when (it) {
|
||||
1 -> Gravity.CENTER
|
||||
2 -> Gravity.BOTTOM
|
||||
else -> Gravity.TOP
|
||||
}
|
||||
}
|
||||
.launchIn(lifecycleScope)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import eu.kanade.tachiyomi.util.system.copyToClipboard
|
|||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import timber.log.Timber
|
||||
import java.text.DateFormat
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
|
|
|
@ -47,10 +47,17 @@ class SettingsGeneralController : SettingsController() {
|
|||
defaultValue = false
|
||||
}
|
||||
if (context.isTablet()) {
|
||||
switchPreference {
|
||||
key = Keys.showSideNavOnBottom
|
||||
titleRes = R.string.pref_move_side_nav_to_bottom
|
||||
defaultValue = false
|
||||
intListPreference {
|
||||
key = Keys.sideNavIconAlignment
|
||||
titleRes = R.string.pref_side_nav_icon_alignment
|
||||
entriesRes = arrayOf(
|
||||
R.string.alignment_top,
|
||||
R.string.alignment_center,
|
||||
R.string.alignment_bottom,
|
||||
)
|
||||
entryValues = arrayOf("0", "1", "2")
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
}
|
||||
} else {
|
||||
switchPreference {
|
||||
|
|
|
@ -161,7 +161,10 @@
|
|||
<string name="pref_date_format">Date format</string>
|
||||
<string name="pref_confirm_exit">Confirm exit</string>
|
||||
<string name="pref_hide_bottom_bar_on_scroll">Hide bottom bar on scroll</string>
|
||||
<string name="pref_move_side_nav_to_bottom">Move side navigation buttons to bottom</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_manage_notifications">Manage notifications</string>
|
||||
|
||||
<string name="pref_category_security">Security</string>
|
||||
|
|
Loading…
Reference in a new issue