From 0b77b78f6a360d759241ac42b1dcf0fe66b27d50 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 24 Apr 2022 22:16:36 -0400 Subject: [PATCH] Remove some minor settings Some spring cleaning to remove some unnecessary complexity so things are easier to maintain. - Start screen: redundant with app shortcuts in Android 7.1+ - Jump to chapters: irrelevant in tablet mode and people can scroll a tiny bit if they really have to - Option to not scroll away bottom nav: issues with fast scroll will be irrelevant with it being replaced or removed in the Compose migrations Get ready for people malding over their special needs. https://xkcd.com/1172/ --- .../data/preference/PreferenceKeys.kt | 4 --- .../data/preference/PreferencesHelper.kt | 6 ---- .../kanade/tachiyomi/ui/main/MainActivity.kt | 10 +----- .../tachiyomi/ui/manga/MangaController.kt | 12 ------- .../setting/SettingsAppearanceController.kt | 11 ++----- .../ui/setting/SettingsGeneralController.kt | 15 --------- .../ui/setting/SettingsLibraryController.kt | 8 ----- .../widget/TachiyomiBottomNavigationView.kt | 32 +------------------ app/src/main/res/layout/main_activity.xml | 1 + app/src/main/res/values/strings.xml | 3 -- 10 files changed, 6 insertions(+), 96 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 026f40722..a84bfbba1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -13,8 +13,6 @@ object PreferenceKeys { const val defaultOrientationType = "pref_default_orientation_type_key" - const val jumpToChapters = "jump_to_chapters" - const val autoUpdateTrack = "pref_auto_update_manga_sync_key" const val downloadOnlyOverWifi = "pref_download_only_over_wifi_key" @@ -43,8 +41,6 @@ object PreferenceKeys { const val migrationSortingMode = "pref_migration_sorting" const val migrationSortingDirection = "pref_migration_direction" - const val startScreen = "start_screen" - const val hideNotificationContent = "hide_notification_content" const val autoUpdateMetadata = "auto_update_metadata" diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index aa7272169..00185224f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -44,12 +44,8 @@ class PreferencesHelper(val context: Context) { "backup", ).toUri() - fun startScreen() = prefs.getInt(Keys.startScreen, 1) - fun confirmExit() = prefs.getBoolean(Keys.confirmExit, false) - fun hideBottomBarOnScroll() = flowPrefs.getBoolean("pref_hide_bottom_bar_on_scroll", true) - fun sideNavIconAlignment() = flowPrefs.getInt("pref_side_nav_icon_alignment", 0) fun useAuthenticator() = flowPrefs.getBoolean("use_biometric_lock", false) @@ -162,8 +158,6 @@ class PreferencesHelper(val context: Context) { fun landscapeColumns() = flowPrefs.getInt("pref_library_columns_landscape_key", 0) - fun jumpToChapters() = prefs.getBoolean(Keys.jumpToChapters, false) - fun autoUpdateTrack() = prefs.getBoolean(Keys.autoUpdateTrack, true) fun lastUsedSource() = flowPrefs.getLong("last_catalogue_source", -1) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index eceffc24e..b1092ff0d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -83,15 +83,7 @@ class MainActivity : BaseActivity() { private lateinit var router: Router - private val startScreenId by lazy { - when (preferences.startScreen()) { - 2 -> R.id.nav_history - 3 -> R.id.nav_updates - 4 -> R.id.nav_browse - else -> R.id.nav_library - } - } - + private val startScreenId = R.id.nav_library private var isConfirmingExit: Boolean = false private var isHandlingShortcut: Boolean = false diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index e5e94552e..60f0929d8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -265,18 +265,6 @@ class MangaController : .build() it.adapter = ConcatAdapter(config, mangaInfoAdapter, chaptersHeaderAdapter, chaptersAdapter) - // Skips directly to chapters list if navigated to from the library - it.post { - if (!fromSource && preferences.jumpToChapters()) { - val mainActivityAppBar = (activity as? MainActivity)?.binding?.appbar - (it.layoutManager as LinearLayoutManager).scrollToPositionWithOffset( - 1, - mainActivityAppBar?.height ?: 0, - ) - mainActivityAppBar?.isLifted = true - } - } - it.scrollStateChanges() .onEach { _ -> // Disable swipe refresh when view is not at the top diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt index b39e17140..a89885fc5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt @@ -93,10 +93,10 @@ class SettingsAppearanceController : SettingsController() { } } - preferenceCategory { - titleRes = R.string.pref_category_navigation + if (context.isTablet()) { + preferenceCategory { + titleRes = R.string.pref_category_navigation - if (context.isTablet()) { intListPreference { bindTo(preferences.sideNavIconAlignment()) titleRes = R.string.pref_side_nav_icon_alignment @@ -108,11 +108,6 @@ class SettingsAppearanceController : SettingsController() { entryValues = arrayOf("0", "1", "2") summary = "%s" } - } else { - switchPreference { - bindTo(preferences.hideBottomBarOnScroll()) - titleRes = R.string.pref_hide_bottom_bar_on_scroll - } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index 3c42ec80b..648861591 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -7,8 +7,6 @@ import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.preference.bindTo import eu.kanade.tachiyomi.util.preference.defaultValue -import eu.kanade.tachiyomi.util.preference.entriesRes -import eu.kanade.tachiyomi.util.preference.intListPreference import eu.kanade.tachiyomi.util.preference.onClick import eu.kanade.tachiyomi.util.preference.preference import eu.kanade.tachiyomi.util.preference.switchPreference @@ -20,19 +18,6 @@ class SettingsGeneralController : SettingsController() { override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply { titleRes = R.string.pref_category_general - intListPreference { - key = Keys.startScreen - titleRes = R.string.pref_start_screen - entriesRes = arrayOf( - R.string.label_library, - R.string.label_recent_updates, - R.string.label_recent_manga, - R.string.browse, - ) - entryValues = arrayOf("1", "3", "2", "4") - defaultValue = "1" - summary = "%s" - } switchPreference { bindTo(preferences.showUpdatesNavBadge()) titleRes = R.string.pref_library_update_show_tab_badge diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index 93263b04d..2932d5256 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -35,7 +35,6 @@ import eu.kanade.tachiyomi.util.preference.preferenceCategory import eu.kanade.tachiyomi.util.preference.summaryRes import eu.kanade.tachiyomi.util.preference.switchPreference import eu.kanade.tachiyomi.util.preference.titleRes -import eu.kanade.tachiyomi.util.system.isTablet import eu.kanade.tachiyomi.widget.materialdialogs.QuadStateTextView import eu.kanade.tachiyomi.widget.materialdialogs.setQuadStateMultiChoiceItems import kotlinx.coroutines.flow.combine @@ -84,13 +83,6 @@ class SettingsLibraryController : SettingsController() { } .launchIn(viewScope) } - if (!context.isTablet()) { - switchPreference { - key = Keys.jumpToChapters - titleRes = R.string.pref_jump_to_chapters - defaultValue = false - } - } } preferenceCategory { diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt index 169dad27f..dae4a0084 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt @@ -8,22 +8,12 @@ import android.os.Parcel import android.os.Parcelable import android.util.AttributeSet import android.view.ViewPropertyAnimator -import androidx.coordinatorlayout.widget.CoordinatorLayout -import androidx.core.view.doOnLayout -import androidx.core.view.updateLayoutParams import androidx.customview.view.AbsSavedState import androidx.interpolator.view.animation.FastOutLinearInInterpolator import androidx.interpolator.view.animation.LinearOutSlowInInterpolator -import androidx.lifecycle.findViewTreeLifecycleOwner -import androidx.lifecycle.lifecycleScope import com.google.android.material.bottomnavigation.BottomNavigationView import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.util.preference.asImmediateFlow import eu.kanade.tachiyomi.util.system.applySystemAnimatorScale -import kotlinx.coroutines.flow.launchIn -import uy.kohesive.injekt.Injekt -import uy.kohesive.injekt.api.get class TachiyomiBottomNavigationView @JvmOverloads constructor( context: Context, @@ -36,25 +26,6 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor( private var currentState = STATE_UP - init { - // Hide on scroll - doOnLayout { - findViewTreeLifecycleOwner()?.lifecycleScope?.let { scope -> - Injekt.get().hideBottomBarOnScroll() - .asImmediateFlow { - updateLayoutParams { - behavior = if (it) { - HideBottomNavigationOnScrollBehavior() - } else { - null - } - } - } - .launchIn(scope) - } - } - } - override fun onSaveInstanceState(): Parcelable { val superState = super.onSaveInstanceState() return SavedState(superState).also { @@ -120,8 +91,7 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor( currentAnimator = null postInvalidate() } - }, - ) + }) } internal class SavedState : AbsSavedState { diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index bec77973d..62edad854 100644 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -86,6 +86,7 @@ android:layout_height="wrap_content" android:layout_gravity="bottom" android:clickable="true" + app:layout_behavior="eu.kanade.tachiyomi.widget.HideBottomNavigationOnScrollBehavior" app:layout_insetEdge="bottom" app:menu="@menu/main_nav" tools:ignore="KeyboardInaccessibleWidget" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aab991a66..c9e325366 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -170,14 +170,12 @@ Top Center Bottom - Hide bottom bar on scroll Timestamps Relative timestamps Short (Today, Yesterday) Long (Short+, n days ago) Date format - Start screen Confirm exit Manage notifications @@ -210,7 +208,6 @@ Items per row Portrait Landscape - Jump to chapters on open Global update Automatic updates