Dim navbar in details
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
4
app/src/main/res/color-v23/bg_dim_bottomsheet.xml
Normal file
4
app/src/main/res/color-v23/bg_dim_bottomsheet.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.78" android:color="?colorSurfaceContainerLow" />
|
||||
</selector>
|
||||
5
app/src/main/res/color/bg_dim_bottomsheet.xml
Normal file
5
app/src/main/res/color/bg_dim_bottomsheet.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- https://stackoverflow.com/questions/54685474/theme-attributes-in-color-selector-for-api-22 -->
|
||||
<item android:color="@color/dim2" />
|
||||
</selector>
|
||||
@@ -318,12 +318,12 @@
|
||||
tools:layout="@layout/sheet_chapters_pages" />
|
||||
|
||||
<org.koitharu.kotatsu.core.ui.widgets.WindowInsetHolder
|
||||
android:id="@+id/navbarDim"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@color/bg_dim_bottomsheet"
|
||||
android:elevation="9dp"
|
||||
tools:layout_height="10dp"
|
||||
android:id="@+id/navbarDim"
|
||||
android:background="@color/dim2" />
|
||||
tools:layout_height="10dp" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
Reference in New Issue
Block a user