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/
This commit is contained in:
arkon 2022-04-24 22:16:36 -04:00
parent 06bec0ad54
commit 0b77b78f6a
10 changed files with 6 additions and 96 deletions

View File

@ -13,8 +13,6 @@ object PreferenceKeys {
const val defaultOrientationType = "pref_default_orientation_type_key" 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 autoUpdateTrack = "pref_auto_update_manga_sync_key"
const val downloadOnlyOverWifi = "pref_download_only_over_wifi_key" const val downloadOnlyOverWifi = "pref_download_only_over_wifi_key"
@ -43,8 +41,6 @@ object PreferenceKeys {
const val migrationSortingMode = "pref_migration_sorting" const val migrationSortingMode = "pref_migration_sorting"
const val migrationSortingDirection = "pref_migration_direction" const val migrationSortingDirection = "pref_migration_direction"
const val startScreen = "start_screen"
const val hideNotificationContent = "hide_notification_content" const val hideNotificationContent = "hide_notification_content"
const val autoUpdateMetadata = "auto_update_metadata" const val autoUpdateMetadata = "auto_update_metadata"

View File

@ -44,12 +44,8 @@ class PreferencesHelper(val context: Context) {
"backup", "backup",
).toUri() ).toUri()
fun startScreen() = prefs.getInt(Keys.startScreen, 1)
fun confirmExit() = prefs.getBoolean(Keys.confirmExit, false) 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 sideNavIconAlignment() = flowPrefs.getInt("pref_side_nav_icon_alignment", 0)
fun useAuthenticator() = flowPrefs.getBoolean("use_biometric_lock", false) 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 landscapeColumns() = flowPrefs.getInt("pref_library_columns_landscape_key", 0)
fun jumpToChapters() = prefs.getBoolean(Keys.jumpToChapters, false)
fun autoUpdateTrack() = prefs.getBoolean(Keys.autoUpdateTrack, true) fun autoUpdateTrack() = prefs.getBoolean(Keys.autoUpdateTrack, true)
fun lastUsedSource() = flowPrefs.getLong("last_catalogue_source", -1) fun lastUsedSource() = flowPrefs.getLong("last_catalogue_source", -1)

View File

@ -83,15 +83,7 @@ class MainActivity : BaseActivity() {
private lateinit var router: Router private lateinit var router: Router
private val startScreenId by lazy { private val startScreenId = R.id.nav_library
when (preferences.startScreen()) {
2 -> R.id.nav_history
3 -> R.id.nav_updates
4 -> R.id.nav_browse
else -> R.id.nav_library
}
}
private var isConfirmingExit: Boolean = false private var isConfirmingExit: Boolean = false
private var isHandlingShortcut: Boolean = false private var isHandlingShortcut: Boolean = false

View File

@ -265,18 +265,6 @@ class MangaController :
.build() .build()
it.adapter = ConcatAdapter(config, mangaInfoAdapter, chaptersHeaderAdapter, chaptersAdapter) 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() it.scrollStateChanges()
.onEach { _ -> .onEach { _ ->
// Disable swipe refresh when view is not at the top // Disable swipe refresh when view is not at the top

View File

@ -93,10 +93,10 @@ class SettingsAppearanceController : SettingsController() {
} }
} }
if (context.isTablet()) {
preferenceCategory { preferenceCategory {
titleRes = R.string.pref_category_navigation titleRes = R.string.pref_category_navigation
if (context.isTablet()) {
intListPreference { intListPreference {
bindTo(preferences.sideNavIconAlignment()) bindTo(preferences.sideNavIconAlignment())
titleRes = R.string.pref_side_nav_icon_alignment titleRes = R.string.pref_side_nav_icon_alignment
@ -108,11 +108,6 @@ class SettingsAppearanceController : SettingsController() {
entryValues = arrayOf("0", "1", "2") entryValues = arrayOf("0", "1", "2")
summary = "%s" summary = "%s"
} }
} else {
switchPreference {
bindTo(preferences.hideBottomBarOnScroll())
titleRes = R.string.pref_hide_bottom_bar_on_scroll
}
} }
} }

View File

@ -7,8 +7,6 @@ import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.preference.bindTo import eu.kanade.tachiyomi.util.preference.bindTo
import eu.kanade.tachiyomi.util.preference.defaultValue 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.onClick
import eu.kanade.tachiyomi.util.preference.preference import eu.kanade.tachiyomi.util.preference.preference
import eu.kanade.tachiyomi.util.preference.switchPreference import eu.kanade.tachiyomi.util.preference.switchPreference
@ -20,19 +18,6 @@ class SettingsGeneralController : SettingsController() {
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply { override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
titleRes = R.string.pref_category_general 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 { switchPreference {
bindTo(preferences.showUpdatesNavBadge()) bindTo(preferences.showUpdatesNavBadge())
titleRes = R.string.pref_library_update_show_tab_badge titleRes = R.string.pref_library_update_show_tab_badge

View File

@ -35,7 +35,6 @@ import eu.kanade.tachiyomi.util.preference.preferenceCategory
import eu.kanade.tachiyomi.util.preference.summaryRes import eu.kanade.tachiyomi.util.preference.summaryRes
import eu.kanade.tachiyomi.util.preference.switchPreference import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.titleRes 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.QuadStateTextView
import eu.kanade.tachiyomi.widget.materialdialogs.setQuadStateMultiChoiceItems import eu.kanade.tachiyomi.widget.materialdialogs.setQuadStateMultiChoiceItems
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
@ -84,13 +83,6 @@ class SettingsLibraryController : SettingsController() {
} }
.launchIn(viewScope) .launchIn(viewScope)
} }
if (!context.isTablet()) {
switchPreference {
key = Keys.jumpToChapters
titleRes = R.string.pref_jump_to_chapters
defaultValue = false
}
}
} }
preferenceCategory { preferenceCategory {

View File

@ -8,22 +8,12 @@ import android.os.Parcel
import android.os.Parcelable import android.os.Parcelable
import android.util.AttributeSet import android.util.AttributeSet
import android.view.ViewPropertyAnimator 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.customview.view.AbsSavedState
import androidx.interpolator.view.animation.FastOutLinearInInterpolator import androidx.interpolator.view.animation.FastOutLinearInInterpolator
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator import androidx.interpolator.view.animation.LinearOutSlowInInterpolator
import androidx.lifecycle.findViewTreeLifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.bottomnavigation.BottomNavigationView
import eu.kanade.tachiyomi.R 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 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( class TachiyomiBottomNavigationView @JvmOverloads constructor(
context: Context, context: Context,
@ -36,25 +26,6 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor(
private var currentState = STATE_UP private var currentState = STATE_UP
init {
// Hide on scroll
doOnLayout {
findViewTreeLifecycleOwner()?.lifecycleScope?.let { scope ->
Injekt.get<PreferencesHelper>().hideBottomBarOnScroll()
.asImmediateFlow {
updateLayoutParams<CoordinatorLayout.LayoutParams> {
behavior = if (it) {
HideBottomNavigationOnScrollBehavior()
} else {
null
}
}
}
.launchIn(scope)
}
}
}
override fun onSaveInstanceState(): Parcelable { override fun onSaveInstanceState(): Parcelable {
val superState = super.onSaveInstanceState() val superState = super.onSaveInstanceState()
return SavedState(superState).also { return SavedState(superState).also {
@ -120,8 +91,7 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor(
currentAnimator = null currentAnimator = null
postInvalidate() postInvalidate()
} }
}, })
)
} }
internal class SavedState : AbsSavedState { internal class SavedState : AbsSavedState {

View File

@ -86,6 +86,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:clickable="true" android:clickable="true"
app:layout_behavior="eu.kanade.tachiyomi.widget.HideBottomNavigationOnScrollBehavior"
app:layout_insetEdge="bottom" app:layout_insetEdge="bottom"
app:menu="@menu/main_nav" app:menu="@menu/main_nav"
tools:ignore="KeyboardInaccessibleWidget" /> tools:ignore="KeyboardInaccessibleWidget" />

View File

@ -170,14 +170,12 @@
<string name="alignment_top">Top</string> <string name="alignment_top">Top</string>
<string name="alignment_center">Center</string> <string name="alignment_center">Center</string>
<string name="alignment_bottom">Bottom</string> <string name="alignment_bottom">Bottom</string>
<string name="pref_hide_bottom_bar_on_scroll">Hide bottom bar on scroll</string>
<string name="pref_category_timestamps">Timestamps</string> <string name="pref_category_timestamps">Timestamps</string>
<string name="pref_relative_format">Relative timestamps</string> <string name="pref_relative_format">Relative timestamps</string>
<string name="pref_relative_time_short">Short (Today, Yesterday)</string> <string name="pref_relative_time_short">Short (Today, Yesterday)</string>
<string name="pref_relative_time_long">Long (Short+, n days ago)</string> <string name="pref_relative_time_long">Long (Short+, n days ago)</string>
<string name="pref_date_format">Date format</string> <string name="pref_date_format">Date format</string>
<string name="pref_start_screen">Start screen</string>
<string name="pref_confirm_exit">Confirm exit</string> <string name="pref_confirm_exit">Confirm exit</string>
<string name="pref_manage_notifications">Manage notifications</string> <string name="pref_manage_notifications">Manage notifications</string>
@ -210,7 +208,6 @@
<string name="pref_library_columns">Items per row</string> <string name="pref_library_columns">Items per row</string>
<string name="portrait">Portrait</string> <string name="portrait">Portrait</string>
<string name="landscape">Landscape</string> <string name="landscape">Landscape</string>
<string name="pref_jump_to_chapters">Jump to chapters on open</string>
<string name="pref_category_library_update">Global update</string> <string name="pref_category_library_update">Global update</string>
<string name="pref_library_update_interval">Automatic updates</string> <string name="pref_library_update_interval">Automatic updates</string>