refactor: support Android 15 edge-to-edge system bars

This commit is contained in:
2024-11-25 18:55:00 +08:00
parent 0facd0bcbf
commit d7c26180ae
2 changed files with 6 additions and 0 deletions

View File

@@ -19,6 +19,8 @@
*
* This file is created by fankes on 2022/5/10.
*/
@file:Suppress("DEPRECATION")
package com.fankes.apperrorsdemo.ui.activity.base
import android.os.Build
@@ -44,6 +46,7 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
name = "inflate"
param(LayoutInflaterClass)
}?.get()?.invoke<VB>(layoutInflater) ?: error("binding failed")
if (Build.VERSION.SDK_INT >= 35) binding.root.fitsSystemWindows = true
setContentView(binding.root)
/** 隐藏系统的标题栏 */
supportActionBar?.hide()

View File

@@ -19,6 +19,8 @@
*
* This file is created by fankes on 2022/5/7.
*/
@file:Suppress("DEPRECATION")
package com.fankes.apperrorstracking.ui.activity.base
import android.app.ActivityManager
@@ -47,6 +49,7 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
name = "inflate"
param(LayoutInflaterClass)
}?.get()?.invoke<VB>(layoutInflater) ?: error("binding failed")
if (Build.VERSION.SDK_INT >= 35) binding.root.fitsSystemWindows = true
setContentView(binding.root)
/** 隐藏系统的标题栏 */
supportActionBar?.hide()