mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 23:01:51 +01:00
Hide irrelevant settings on tablets
This commit is contained in:
parent
10a638c6b8
commit
1b52acdad7
@ -237,6 +237,18 @@ class MangaController :
|
|||||||
it.scrollEvents()
|
it.scrollEvents()
|
||||||
.onEach { updateToolbarTitleAlpha() }
|
.onEach { updateToolbarTitleAlpha() }
|
||||||
.launchIn(viewScope)
|
.launchIn(viewScope)
|
||||||
|
|
||||||
|
// Skips directly to chapters list if navigated to from the library
|
||||||
|
it.post {
|
||||||
|
if (!fromSource && preferences.jumpToChapters()) {
|
||||||
|
(it.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(1, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delayed in case we need to jump to chapters
|
||||||
|
it.post {
|
||||||
|
updateToolbarTitleAlpha()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Tablet layout
|
// Tablet layout
|
||||||
binding.infoRecycler?.let {
|
binding.infoRecycler?.let {
|
||||||
@ -248,19 +260,7 @@ class MangaController :
|
|||||||
|
|
||||||
chaptersAdapter?.fastScroller = binding.fastScroller
|
chaptersAdapter?.fastScroller = binding.fastScroller
|
||||||
|
|
||||||
actionFabScrollListener = actionFab?.shrinkOnScroll(chaptersRecycler)
|
actionFabScrollListener = actionFab?.shrinkOnScroll(chapterRecycler)
|
||||||
|
|
||||||
// Skips directly to chapters list if navigated to from the library
|
|
||||||
chaptersRecycler.post {
|
|
||||||
if (!fromSource && preferences.jumpToChapters()) {
|
|
||||||
(chaptersRecycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(1, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delayed in case we need to jump to chapters
|
|
||||||
binding.fullRecycler?.post {
|
|
||||||
updateToolbarTitleAlpha()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.swipeRefresh.refreshes()
|
binding.swipeRefresh.refreshes()
|
||||||
.onEach {
|
.onEach {
|
||||||
@ -340,7 +340,7 @@ class MangaController :
|
|||||||
|
|
||||||
override fun cleanupFab(fab: ExtendedFloatingActionButton) {
|
override fun cleanupFab(fab: ExtendedFloatingActionButton) {
|
||||||
fab.setOnClickListener(null)
|
fab.setOnClickListener(null)
|
||||||
actionFabScrollListener?.let { binding.fullRecycler?.removeOnScrollListener(it) }
|
actionFabScrollListener?.let { chapterRecycler.removeOnScrollListener(it) }
|
||||||
actionFab = null
|
actionFab = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1103,7 +1103,7 @@ class MangaController :
|
|||||||
|
|
||||||
// Tracker sheet - end
|
// Tracker sheet - end
|
||||||
|
|
||||||
private val chaptersRecycler: RecyclerView
|
private val chapterRecycler: RecyclerView
|
||||||
get() = binding.fullRecycler ?: binding.chaptersRecycler!!
|
get() = binding.fullRecycler ?: binding.chaptersRecycler!!
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
|||||||
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.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
|
import eu.kanade.tachiyomi.util.system.isTablet
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||||
@ -45,11 +46,13 @@ class SettingsGeneralController : SettingsController() {
|
|||||||
titleRes = R.string.pref_confirm_exit
|
titleRes = R.string.pref_confirm_exit
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
}
|
}
|
||||||
|
if (!context.isTablet()) {
|
||||||
switchPreference {
|
switchPreference {
|
||||||
key = Keys.hideBottomBar
|
key = Keys.hideBottomBar
|
||||||
titleRes = R.string.pref_hide_bottom_bar_on_scroll
|
titleRes = R.string.pref_hide_bottom_bar_on_scroll
|
||||||
defaultValue = true
|
defaultValue = true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
preference {
|
preference {
|
||||||
|
@ -28,6 +28,7 @@ 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.MinMaxNumberPicker
|
import eu.kanade.tachiyomi.widget.MinMaxNumberPicker
|
||||||
import eu.kanade.tachiyomi.widget.materialdialogs.QuadStateCheckBox
|
import eu.kanade.tachiyomi.widget.materialdialogs.QuadStateCheckBox
|
||||||
import eu.kanade.tachiyomi.widget.materialdialogs.listItemsQuadStateMultiChoice
|
import eu.kanade.tachiyomi.widget.materialdialogs.listItemsQuadStateMultiChoice
|
||||||
@ -75,12 +76,14 @@ class SettingsLibraryController : SettingsController() {
|
|||||||
}
|
}
|
||||||
.launchIn(viewScope)
|
.launchIn(viewScope)
|
||||||
}
|
}
|
||||||
|
if (!context.isTablet()) {
|
||||||
switchPreference {
|
switchPreference {
|
||||||
key = Keys.jumpToChapters
|
key = Keys.jumpToChapters
|
||||||
titleRes = R.string.pref_jump_to_chapters
|
titleRes = R.string.pref_jump_to_chapters
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
titleRes = R.string.categories
|
titleRes = R.string.categories
|
||||||
|
@ -258,3 +258,10 @@ fun Context.createFileInCacheDir(name: String): File {
|
|||||||
file.createNewFile()
|
file.createNewFile()
|
||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We consider anything with a width of >= 600dp as a tablet, i.e. with layouts in layout-sw600dp.
|
||||||
|
*/
|
||||||
|
fun Context.isTablet(): Boolean {
|
||||||
|
return resources.configuration.screenWidthDp >= 600
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user