From b03ebc1fa4d2fd4321ff736ddd9eda239fa2fdde Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 3 Jun 2021 23:00:41 -0400 Subject: [PATCH] Update tablet UI - Only used when width is >= 720dp instead of 600dp (typically 10" tablets) - Fix fastscroll in manga view (fixes #5267) --- app/build.gradle.kts | 2 +- .../util/system/ContextExtensions.kt | 4 ++-- .../main_activity.xml | 1 + .../manga_controller.xml | 21 ++++++++----------- 4 files changed, 13 insertions(+), 15 deletions(-) rename app/src/main/res/{layout-sw600dp => layout-w720dp}/main_activity.xml (99%) rename app/src/main/res/{layout-sw600dp => layout-w720dp}/manga_controller.xml (84%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 0b4857128..aca12c678 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -156,7 +156,7 @@ dependencies { implementation("androidx.work:work-runtime-ktx:2.7.0-alpha04") // UI library - implementation("com.google.android.material:material:1.4.0-beta01") + implementation("com.google.android.material:material:1.4.0-rc01") "standardImplementation"("com.google.firebase:firebase-core:19.0.0") 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 9f6ddb878..39878510f 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 @@ -271,8 +271,8 @@ fun Context.createFileInCacheDir(name: String): File { } /** - * We consider anything with a width of >= 600dp as a tablet, i.e. with layouts in layout-sw600dp. + * 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.screenWidthDp >= 600 + return (resources.displayMetrics.widthPixels / resources.displayMetrics.density) >= 720 } diff --git a/app/src/main/res/layout-sw600dp/main_activity.xml b/app/src/main/res/layout-w720dp/main_activity.xml similarity index 99% rename from app/src/main/res/layout-sw600dp/main_activity.xml rename to app/src/main/res/layout-w720dp/main_activity.xml index 9da7d3677..697d50fa2 100644 --- a/app/src/main/res/layout-sw600dp/main_activity.xml +++ b/app/src/main/res/layout-w720dp/main_activity.xml @@ -75,6 +75,7 @@ style="@style/Widget.MaterialComponents.NavigationRailView.Colored" android:layout_width="wrap_content" android:layout_height="0dp" + app:elevation="0dp" app:itemIconTint="@color/nav_selector" app:itemRippleColor="?attr/rippleSecondaryColor" app:itemTextColor="@color/nav_selector" diff --git a/app/src/main/res/layout-sw600dp/manga_controller.xml b/app/src/main/res/layout-w720dp/manga_controller.xml similarity index 84% rename from app/src/main/res/layout-sw600dp/manga_controller.xml rename to app/src/main/res/layout-w720dp/manga_controller.xml index c1a233365..0953a47f3 100644 --- a/app/src/main/res/layout-sw600dp/manga_controller.xml +++ b/app/src/main/res/layout-w720dp/manga_controller.xml @@ -50,18 +50,6 @@ app:layout_constraintTop_toTopOf="parent" tools:listitem="@layout/chapters_item" /> - - + +