parent
b1fa07aedd
commit
1ffe7511f2
@ -1,13 +1,18 @@
|
||||
package eu.kanade.tachiyomi.util.system
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Build
|
||||
import android.view.WindowInsets
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
fun WindowInsets.getBottomInsets(): Int {
|
||||
return when (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
true -> mandatorySystemGestureInsets.bottom
|
||||
false -> systemWindowInsetBottom
|
||||
}
|
||||
fun WindowInsets.getBottomGestureInsets(): Int {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) mandatorySystemGestureInsets.bottom
|
||||
else systemWindowInsetBottom
|
||||
}
|
||||
|
||||
/** returns if device using gesture nav and supports true edge to edge */
|
||||
fun WindowInsets.isBottomTappable(): Boolean {
|
||||
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q &&
|
||||
systemWindowInsetBottom != tappableElementInsets.bottom)
|
||||
}
|
||||
|
||||
/** returns if device is in landscape with 2/3 button mode */
|
||||
fun WindowInsets.hasSideNavBar(): Boolean = systemWindowInsetLeft > 0 || systemWindowInsetRight > 0
|
||||
|
Loading…
Reference in new issue