From 4cee432a82aff287dbdfb9378688a89c2a355bc4 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sun, 23 Feb 2025 18:06:35 +0200 Subject: [PATCH] Dim navbar in details --- .../koitharu/kotatsu/core/util/ext/Android.kt | 17 ----------------- .../kotatsu/details/ui/DetailsActivity.kt | 4 ---- .../main/res/color-v23/bg_dim_bottomsheet.xml | 4 ++++ app/src/main/res/color/bg_dim_bottomsheet.xml | 5 +++++ app/src/main/res/layout/activity_details.xml | 6 +++--- 5 files changed, 12 insertions(+), 24 deletions(-) create mode 100644 app/src/main/res/color-v23/bg_dim_bottomsheet.xml create mode 100644 app/src/main/res/color/bg_dim_bottomsheet.xml diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Android.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Android.kt index 01c1f0cba..049f64a87 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Android.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/util/ext/Android.kt @@ -139,23 +139,6 @@ fun SyncResult.onError(error: Throwable) { error.printStackTraceDebug() } -fun Window.setNavigationBarTransparentCompat(context: Context, elevation: Float, alphaFactor: Float = 0.7f) { - navigationBarColor = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && - !context.getSystemBoolean("config_navBarNeedsScrim", true) - ) { - Color.TRANSPARENT - } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O_MR1) { - val baseColor = context.getThemeColor(android.R.attr.navigationBarColor) - ColorUtils.setAlphaComponent(baseColor, (Color.alpha(baseColor) * alphaFactor).toInt()) - } else { - // Set navbar scrim 70% of navigationBarColor - ElevationOverlayProvider(context).compositeOverlayIfNeeded( - context.getThemeColor(materialR.attr.colorSurfaceContainer, alphaFactor), - elevation, - ) - } -} - val Context.animatorDurationScale: Float get() = Settings.Global.getFloat(this.contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, 1f) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt index 8d5cbd1ff..3cc077011 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt @@ -79,7 +79,6 @@ import org.koitharu.kotatsu.core.util.ext.mangaSourceExtra import org.koitharu.kotatsu.core.util.ext.observe import org.koitharu.kotatsu.core.util.ext.observeEvent import org.koitharu.kotatsu.core.util.ext.parentView -import org.koitharu.kotatsu.core.util.ext.setNavigationBarTransparentCompat import org.koitharu.kotatsu.core.util.ext.textAndVisible import org.koitharu.kotatsu.databinding.ActivityDetailsBinding import org.koitharu.kotatsu.databinding.LayoutDetailsTableBinding @@ -465,9 +464,6 @@ class DetailsActivity : viewBinding.scrollView.updatePadding( bottom = insets.bottom, ) - viewBinding.containerBottomSheet?.let { bs -> - window.setNavigationBarTransparentCompat(this, bs.elevation, 0.9f) - } } private fun onHistoryChanged(info: HistoryInfo, isLoading: Boolean) = with(infoBinding) { diff --git a/app/src/main/res/color-v23/bg_dim_bottomsheet.xml b/app/src/main/res/color-v23/bg_dim_bottomsheet.xml new file mode 100644 index 000000000..c2e9c2c67 --- /dev/null +++ b/app/src/main/res/color-v23/bg_dim_bottomsheet.xml @@ -0,0 +1,4 @@ + + + + diff --git a/app/src/main/res/color/bg_dim_bottomsheet.xml b/app/src/main/res/color/bg_dim_bottomsheet.xml new file mode 100644 index 000000000..209550cf3 --- /dev/null +++ b/app/src/main/res/color/bg_dim_bottomsheet.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/layout/activity_details.xml b/app/src/main/res/layout/activity_details.xml index dc32df6c2..59ee39455 100644 --- a/app/src/main/res/layout/activity_details.xml +++ b/app/src/main/res/layout/activity_details.xml @@ -318,12 +318,12 @@ tools:layout="@layout/sheet_chapters_pages" /> + tools:layout_height="10dp" />