From bf1b7f44b641686b012e1d28ca46ed222162df87 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 18 Oct 2021 11:03:27 -0400 Subject: [PATCH] Change tablet UI threshold to w720dp (closes #6054) Was previously sw720dp. Now matches J2K. --- .../tachiyomi/util/system/ContextExtensions.kt | 12 ++++++------ .../main_activity.xml | 0 .../manga_controller.xml | 0 .../manga_info_header.xml | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename app/src/main/res/{layout-sw720dp => layout-w720dp}/main_activity.xml (100%) rename app/src/main/res/{layout-sw720dp => layout-w720dp}/manga_controller.xml (100%) rename app/src/main/res/{layout-sw720dp => layout-w720dp}/manga_info_header.xml (100%) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index f02bef0e1..b97e2f6b6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -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-sw720dp. + * We consider anything with a width of >= 720dp as a tablet, i.e. with layouts in layout-w720dp. */ fun Context.isTablet(): Boolean { - return resources.configuration.smallestScreenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP + return resources.configuration.screenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP } fun Context.prepareTabletUiContext(): Context { @@ -320,13 +320,13 @@ fun Context.prepareTabletUiContext(): Context { PreferenceValues.TabletUiMode.LANDSCAPE -> configuration.orientation == Configuration.ORIENTATION_LANDSCAPE PreferenceValues.TabletUiMode.NEVER -> false } - if (configuration.smallestScreenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP != expected) { + if (configuration.screenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP != expected) { val overrideConf = Configuration() overrideConf.setTo(configuration) - overrideConf.smallestScreenWidthDp = if (expected) { - overrideConf.smallestScreenWidthDp.coerceAtLeast(TABLET_UI_MIN_SCREEN_WIDTH_DP) + overrideConf.screenWidthDp = if (expected) { + overrideConf.screenWidthDp.coerceAtLeast(TABLET_UI_MIN_SCREEN_WIDTH_DP) } else { - overrideConf.smallestScreenWidthDp.coerceAtMost(TABLET_UI_MIN_SCREEN_WIDTH_DP - 1) + overrideConf.screenWidthDp.coerceAtMost(TABLET_UI_MIN_SCREEN_WIDTH_DP - 1) } return createConfigurationContext(overrideConf) } diff --git a/app/src/main/res/layout-sw720dp/main_activity.xml b/app/src/main/res/layout-w720dp/main_activity.xml similarity index 100% rename from app/src/main/res/layout-sw720dp/main_activity.xml rename to app/src/main/res/layout-w720dp/main_activity.xml diff --git a/app/src/main/res/layout-sw720dp/manga_controller.xml b/app/src/main/res/layout-w720dp/manga_controller.xml similarity index 100% rename from app/src/main/res/layout-sw720dp/manga_controller.xml rename to app/src/main/res/layout-w720dp/manga_controller.xml diff --git a/app/src/main/res/layout-sw720dp/manga_info_header.xml b/app/src/main/res/layout-w720dp/manga_info_header.xml similarity index 100% rename from app/src/main/res/layout-sw720dp/manga_info_header.xml rename to app/src/main/res/layout-w720dp/manga_info_header.xml