Option to move nav rail buttons to bottom of screen

This commit is contained in:
Jays2Kings 2021-05-23 00:28:43 -04:00
parent d82d738f38
commit c84526274a
5 changed files with 18 additions and 0 deletions

View File

@ -202,6 +202,8 @@ object PreferenceKeys {
const val hideBottomNavOnScroll = "hide_bottom_nav_on_scroll"
const val showSideNavOnBottom = "show_side_nav_on_bottom"
const val showMangaAppShortcuts = "show_manga_app_shortcuts"
const val createLegacyBackup = "create_legacy_backup"

View File

@ -394,6 +394,8 @@ class PreferencesHelper(val context: Context) {
fun hideBottomNavOnScroll() = flowPrefs.getBoolean(Keys.hideBottomNavOnScroll, true)
fun showSideNavOnBottom() = flowPrefs.getBoolean(Keys.showSideNavOnBottom, false)
fun showNsfwSource() = flowPrefs.getBoolean(Keys.showNsfwSource, true)
fun showNsfwExtension() = flowPrefs.getBoolean(Keys.showNsfwExtension, true)
fun labelNsfwExtension() = prefs.getBoolean(Keys.labelNsfwExtension, true)

View File

@ -12,6 +12,7 @@ import android.os.Bundle
import android.os.Handler
import android.provider.Settings
import android.view.GestureDetector
import android.view.Gravity
import android.view.Menu
import android.view.MenuItem
import android.view.MotionEvent
@ -365,6 +366,10 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
binding.toolbar.setIncognitoMode(it)
binding.cardToolbar.setIncognitoMode(it)
}
preferences.showSideNavOnBottom()
.asImmediateFlowIn(lifecycleScope) {
binding.sideNav?.menuGravity = if (!it) Gravity.TOP else Gravity.BOTTOM
}
setExtensionsBadge()
setFloatingToolbar(canShowFloatingToolbar(router.backstack.lastOrNull()?.controller), changeBG = false)
}

View File

@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.util.system.LocaleHelper
import eu.kanade.tachiyomi.util.system.appDelegateNightMode
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
@ -76,6 +77,13 @@ class SettingsGeneralController : SettingsController() {
defaultValue = true
}
switchPreference {
key = Keys.showSideNavOnBottom
titleRes = R.string.move_side_nav_to_bottom
defaultValue = false
isVisible = activity?.isTablet() == true
}
switchPreference {
key = Keys.showMangaAppShortcuts
titleRes = R.string.app_shortcuts

View File

@ -610,6 +610,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="app_shortcuts">App shortcuts</string>
<string name="show_recent_in_shortcuts">Show recent sources and series in app shortcuts</string>
<string name="follow_system_theme">Follow system theme</string>