mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 13:35:27 +00:00
Use WindowCompat
This commit is contained in:
parent
8a23d1da58
commit
3d06ba1878
@ -7,6 +7,7 @@ import android.os.Bundle
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.content.res.use
|
import androidx.core.content.res.use
|
||||||
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
import androidx.databinding.ViewDataBinding
|
import androidx.databinding.ViewDataBinding
|
||||||
import com.topjohnwu.magisk.BR
|
import com.topjohnwu.magisk.BR
|
||||||
@ -42,17 +43,13 @@ abstract class UIActivity<Binding : ViewDataBinding> : BaseActivity(), ViewModel
|
|||||||
.use { it.getDrawable(0) }
|
.use { it.getDrawable(0) }
|
||||||
.also { window.setBackgroundDrawable(it) }
|
.also { window.setBackgroundDrawable(it) }
|
||||||
|
|
||||||
window?.decorView?.let {
|
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||||
it.systemUiVisibility = (it.systemUiVisibility
|
|
||||||
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
||||||
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
||||||
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
window?.decorView?.post {
|
window?.decorView?.post {
|
||||||
// If navigation bar is short enough (gesture navigation enabled), make it transparent
|
// If navigation bar is short enough (gesture navigation enabled), make it transparent
|
||||||
if (window.decorView.rootWindowInsets?.systemWindowInsetBottom ?: 0 < Resources.getSystem().displayMetrics.density * 40) {
|
if ((window.decorView.rootWindowInsets?.systemWindowInsetBottom
|
||||||
|
?: 0) < Resources.getSystem().displayMetrics.density * 40) {
|
||||||
window.navigationBarColor = Color.TRANSPARENT
|
window.navigationBarColor = Color.TRANSPARENT
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
window.navigationBarDividerColor = Color.TRANSPARENT
|
window.navigationBarDividerColor = Color.TRANSPARENT
|
||||||
|
Loading…
Reference in New Issue
Block a user