From d981245723dfb5b4feab5f6b8e2d656726ffe48b Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 15 Apr 2021 10:05:47 -0400 Subject: [PATCH] Remove toolbar snapping --- .../kanade/tachiyomi/ui/main/MainActivity.kt | 17 +++++++---------- .../util/system/InternalResourceHelper.kt | 19 ++++++++++--------- app/src/main/res/layout/main_activity.xml | 2 +- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index e577638ac..b4282ec5e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -98,15 +98,7 @@ class MainActivity : BaseViewBindingActivity() { WindowCompat.setDecorFitsSystemWindows(window, false) binding.appbar.applyInsetter { type(navigationBars = true, statusBars = true) { - padding(left = true, right = true) - } - type(statusBars = true) { - margin(top = true) - } - } - binding.bottomNav.applyInsetter { - type(navigationBars = true) { - padding() + padding(left = true, top = true, right = true) } } binding.rootFab.applyInsetter { @@ -114,6 +106,11 @@ class MainActivity : BaseViewBindingActivity() { margin() } } + binding.bottomNav.applyInsetter { + type(navigationBars = true) { + padding() + } + } // Make sure navigation bar is on bottom before we modify it ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets -> @@ -124,7 +121,7 @@ class MainActivity : BaseViewBindingActivity() { Color.TRANSPARENT } else { // Set navbar scrim 70% of navigationBarColor - getResourceColor(android.R.attr.navigationBarColor, .7F) + getResourceColor(android.R.attr.navigationBarColor, 0.7F) } } insets diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/InternalResourceHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/InternalResourceHelper.kt index a46f73502..6570b7ffc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/InternalResourceHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/InternalResourceHelper.kt @@ -4,15 +4,6 @@ import android.content.Context import android.content.res.Resources object InternalResourceHelper { - /** - * Get resource id from system resources - * @param resName resource name to get - * @param type resource type of [resName] to get - * @return 0 if not available - */ - private fun getResourceId(resName: String, type: String): Int { - return Resources.getSystem().getIdentifier(resName, type, "android") - } fun getBoolean(context: Context, resName: String, defaultValue: Boolean): Boolean { val id = getResourceId(resName, "bool") @@ -22,4 +13,14 @@ object InternalResourceHelper { defaultValue } } + + /** + * Get resource id from system resources + * @param resName resource name to get + * @param type resource type of [resName] to get + * @return 0 if not available + */ + private fun getResourceId(resName: String, type: String): Int { + return Resources.getSystem().getIdentifier(resName, type, "android") + } } diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index cbd72ac50..6606e12cd 100644 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -19,7 +19,7 @@ android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:theme="?attr/actionBarTheme" - app:layout_scrollFlags="scroll|enterAlways|snap" /> + app:layout_scrollFlags="scroll|enterAlways" />