mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Make jumping to manga chapters optional
This commit is contained in:
parent
f2f6628693
commit
2cb7624953
@ -67,6 +67,8 @@ object PreferenceKeys {
|
|||||||
|
|
||||||
const val landscapeColumns = "pref_library_columns_landscape_key"
|
const val landscapeColumns = "pref_library_columns_landscape_key"
|
||||||
|
|
||||||
|
const val jumpToChapters = "jump_to_chapters"
|
||||||
|
|
||||||
const val updateOnlyNonCompleted = "pref_update_only_non_completed_key"
|
const val updateOnlyNonCompleted = "pref_update_only_non_completed_key"
|
||||||
|
|
||||||
const val autoUpdateTrack = "pref_auto_update_manga_sync_key"
|
const val autoUpdateTrack = "pref_auto_update_manga_sync_key"
|
||||||
|
@ -131,6 +131,8 @@ class PreferencesHelper(val context: Context) {
|
|||||||
|
|
||||||
fun landscapeColumns() = flowPrefs.getInt(Keys.landscapeColumns, 0)
|
fun landscapeColumns() = flowPrefs.getInt(Keys.landscapeColumns, 0)
|
||||||
|
|
||||||
|
fun jumpToChapters() = prefs.getBoolean(Keys.jumpToChapters, false)
|
||||||
|
|
||||||
fun updateOnlyNonCompleted() = prefs.getBoolean(Keys.updateOnlyNonCompleted, false)
|
fun updateOnlyNonCompleted() = prefs.getBoolean(Keys.updateOnlyNonCompleted, false)
|
||||||
|
|
||||||
fun autoUpdateTrack() = prefs.getBoolean(Keys.autoUpdateTrack, true)
|
fun autoUpdateTrack() = prefs.getBoolean(Keys.autoUpdateTrack, true)
|
||||||
|
@ -72,6 +72,8 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) :
|
|||||||
private var chaptersHeaderAdapter: MangaChaptersHeaderAdapter? = null
|
private var chaptersHeaderAdapter: MangaChaptersHeaderAdapter? = null
|
||||||
private var chaptersAdapter: ChaptersAdapter? = null
|
private var chaptersAdapter: ChaptersAdapter? = null
|
||||||
|
|
||||||
|
private var skippedInfoOnOpen: Boolean = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action mode for multiple selection.
|
* Action mode for multiple selection.
|
||||||
*/
|
*/
|
||||||
@ -305,9 +307,10 @@ class MangaInfoChaptersController(private val fromSource: Boolean = false) :
|
|||||||
// Update view.
|
// Update view.
|
||||||
mangaInfoAdapter?.update(manga, source)
|
mangaInfoAdapter?.update(manga, source)
|
||||||
|
|
||||||
// Skips directly to chapters list by default if navigated to from the library
|
// Skips directly to chapters list if navigated to from the library
|
||||||
if (!fromSource) {
|
if (!fromSource && !skippedInfoOnOpen && preferences.jumpToChapters()) {
|
||||||
(binding.recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(1, 0)
|
(binding.recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(1, 0)
|
||||||
|
skippedInfoOnOpen = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Initialize manga.
|
// Initialize manga.
|
||||||
|
@ -72,6 +72,11 @@ class SettingsLibraryController : SettingsController() {
|
|||||||
}
|
}
|
||||||
.launchIn(scope)
|
.launchIn(scope)
|
||||||
}
|
}
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.jumpToChapters
|
||||||
|
titleRes = R.string.pref_jump_to_chapters
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
|
@ -172,6 +172,7 @@
|
|||||||
<string name="portrait">Portrait</string>
|
<string name="portrait">Portrait</string>
|
||||||
<string name="landscape">Landscape</string>
|
<string name="landscape">Landscape</string>
|
||||||
<string name="default_columns">Default</string>
|
<string name="default_columns">Default</string>
|
||||||
|
<string name="pref_jump_to_chapters">Jump to chapters on open</string>
|
||||||
|
|
||||||
<string name="pref_category_library_update">Updates</string>
|
<string name="pref_category_library_update">Updates</string>
|
||||||
<string name="pref_library_update_interval">Library update frequency</string>
|
<string name="pref_library_update_interval">Library update frequency</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user