More bottom sheet improvements (#5183)

* Edge-to-edge bottom sheet when possible

* ReaderSettingsSheet: Animate background dim changes

* Adjust modal bottom sheet in-out animation

* Use public method to get bottom sheet behavior

* Set bottom sheet peek size to 50% screen height

The current auto peek height gives too low value on landscape orientation

* Set bottom sheet navigation bar scrim when needed
This commit is contained in:
Ivan Iskandar
2021-05-29 09:36:09 +07:00
committed by GitHub
parent aed6e12119
commit 9f744bc445
11 changed files with 125 additions and 28 deletions
@@ -1,7 +1,12 @@
package eu.kanade.tachiyomi.util.view
import android.content.Context
import android.graphics.Color
import android.os.Build
import android.view.View
import android.view.Window
import eu.kanade.tachiyomi.util.system.InternalResourceHelper
import eu.kanade.tachiyomi.util.system.getResourceColor
fun Window.showBar() {
decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
@@ -22,3 +27,18 @@ fun Window.defaultBar() {
}
fun Window.isDefaultBar() = decorView.systemUiVisibility == View.SYSTEM_UI_FLAG_VISIBLE
/**
* Sets navigation bar color to transparent if system's config_navBarNeedsScrim is false,
* otherwise it will use the theme navigationBarColor with 70% opacity.
*/
fun Window.setNavigationBarTransparentCompat(context: Context) {
navigationBarColor = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q &&
!InternalResourceHelper.getBoolean(context, "config_navBarNeedsScrim", true)
) {
Color.TRANSPARENT
} else {
// Set navbar scrim 70% of navigationBarColor
context.getResourceColor(android.R.attr.navigationBarColor, 0.7F)
}
}