mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 22:41:48 +01:00
Use sw720dp for tablet UI threshold
This commit is contained in:
parent
abf31f4a79
commit
d2fc6d9f44
@ -307,10 +307,10 @@ fun Context.createFileInCacheDir(name: String): File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We consider anything with a width of >= 720dp as a tablet, i.e. with layouts in layout-w720dp.
|
* We consider anything with a width of >= 720dp as a tablet, i.e. with layouts in layout-sw720dp.
|
||||||
*/
|
*/
|
||||||
fun Context.isTablet(): Boolean {
|
fun Context.isTablet(): Boolean {
|
||||||
return resources.configuration.screenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP
|
return resources.configuration.smallestScreenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.prepareTabletUiContext(): Context {
|
fun Context.prepareTabletUiContext(): Context {
|
||||||
@ -320,13 +320,13 @@ fun Context.prepareTabletUiContext(): Context {
|
|||||||
PreferenceValues.TabletUiMode.LANDSCAPE -> configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
PreferenceValues.TabletUiMode.LANDSCAPE -> configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||||
PreferenceValues.TabletUiMode.NEVER -> false
|
PreferenceValues.TabletUiMode.NEVER -> false
|
||||||
}
|
}
|
||||||
if (configuration.screenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP != expected) {
|
if (configuration.smallestScreenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP != expected) {
|
||||||
val overrideConf = Configuration()
|
val overrideConf = Configuration()
|
||||||
overrideConf.setTo(configuration)
|
overrideConf.setTo(configuration)
|
||||||
overrideConf.screenWidthDp = if (expected) {
|
overrideConf.smallestScreenWidthDp = if (expected) {
|
||||||
overrideConf.screenWidthDp.coerceAtLeast(TABLET_UI_MIN_SCREEN_WIDTH_DP)
|
overrideConf.smallestScreenWidthDp.coerceAtLeast(TABLET_UI_MIN_SCREEN_WIDTH_DP)
|
||||||
} else {
|
} else {
|
||||||
overrideConf.screenWidthDp.coerceAtMost(TABLET_UI_MIN_SCREEN_WIDTH_DP - 1)
|
overrideConf.smallestScreenWidthDp.coerceAtMost(TABLET_UI_MIN_SCREEN_WIDTH_DP - 1)
|
||||||
}
|
}
|
||||||
return createConfigurationContext(overrideConf)
|
return createConfigurationContext(overrideConf)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user