hide update and history buttons option (#324)

* hide update and history buttons option

* Move updates and history button in More then hiding

Co-authored-by: jobobby04 <jobobby04@users.noreply.github.com>
This commit is contained in:
simakover 2021-05-23 00:17:35 +05:00 committed by GitHub
parent b63df25f7b
commit 63139a5c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 46 additions and 0 deletions

View File

@ -15,6 +15,10 @@ object PreferenceKeys {
const val hideBottomBar = "pref_hide_bottom_bar_on_scroll"
const val hideUpdatesButton = "pref_hide_updates_button"
const val hideHistoryButton = "pref_hide_history_button"
const val enableTransitionsPager = "pref_enable_transitions_pager_key"
const val enableTransitionsWebtoon = "pref_enable_transitions_webtoon_key"

View File

@ -66,6 +66,10 @@ class PreferencesHelper(val context: Context) {
fun hideBottomBar() = flowPrefs.getBoolean(Keys.hideBottomBar, true)
fun hideUpdatesButton() = flowPrefs.getBoolean(Keys.hideUpdatesButton, false)
fun hideHistoryButton() = flowPrefs.getBoolean(Keys.hideHistoryButton, false)
fun bottomBarLabels() = flowPrefs.getBoolean(Keys.bottomBarLabels, true)
fun useBiometricLock() = flowPrefs.getBoolean(Keys.useBiometricLock, false)

View File

@ -515,6 +515,10 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
if (visible) {
if (collapse) {
bottomNavAnimator.expand()
val navUpdates = binding.bottomNav.menu.findItem(R.id.nav_updates)
navUpdates.isVisible = !preferences.hideUpdatesButton().get()
val navHistory = binding.bottomNav.menu.findItem(R.id.nav_history)
navHistory.isVisible = !preferences.hideHistoryButton().get()
}
bottomViewNavigationBehavior?.slideUp(binding.bottomNav)

View File

@ -16,6 +16,8 @@ import eu.kanade.tachiyomi.ui.base.controller.RootController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.category.CategoryController
import eu.kanade.tachiyomi.ui.download.DownloadController
import eu.kanade.tachiyomi.ui.recent.history.HistoryController
import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController
import eu.kanade.tachiyomi.ui.setting.SettingsController
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
import eu.kanade.tachiyomi.util.preference.add
@ -75,6 +77,26 @@ class MoreController :
}
preferenceCategory {
if (preferences.hideUpdatesButton().get()) {
preference {
titleRes = R.string.label_recent_updates
iconRes = R.drawable.ic_new_releases_state
iconTint = tintColor
onClick {
router.pushController(UpdatesController().withFadeTransaction())
}
}
}
if (preferences.hideHistoryButton().get()) {
preference {
titleRes = R.string.label_recent_manga
iconRes = R.drawable.ic_history_24dp
iconTint = tintColor
onClick {
router.pushController(HistoryController().withFadeTransaction())
}
}
}
preference {
titleRes = R.string.label_download_queue

View File

@ -51,6 +51,16 @@ class SettingsGeneralController : SettingsController() {
titleRes = R.string.pref_hide_bottom_bar_on_scroll
defaultValue = true
}
switchPreference {
key = Keys.hideUpdatesButton
titleRes = R.string.pref_hide_updates_button
defaultValue = false
}
switchPreference {
key = Keys.hideHistoryButton
titleRes = R.string.pref_hide_history_button
defaultValue = false
}
switchPreference {
key = Keys.bottomBarLabels
titleRes = R.string.pref_show_bottom_bar_labels

View File

@ -165,6 +165,8 @@
<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_hide_updates_button">Move Update button to the More tab</string>
<string name="pref_hide_history_button">Move History button to the More tab</string>
<string name="pref_show_bottom_bar_labels">Always show bottom bar labels</string>
<string name="pref_manage_notifications">Manage notifications</string>