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
@@ -15,8 +15,11 @@ import android.content.res.Resources
import android.graphics.Color
import android.net.ConnectivityManager
import android.net.Uri
import android.os.Build
import android.os.PowerManager
import android.view.Display
import android.view.View
import android.view.WindowManager
import android.widget.Toast
import androidx.annotation.AttrRes
import androidx.annotation.ColorInt
@@ -172,6 +175,14 @@ val Context.powerManager: PowerManager
val Context.keyguardManager: KeyguardManager
get() = getSystemService()!!
val Context.displayCompat: Display?
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
display
} else {
@Suppress("DEPRECATION")
getSystemService<WindowManager>()?.defaultDisplay
}
/**
* Convenience method to acquire a partial wake lock.
*/