6.6.3 - Alpha5 - 修复 Android 15 UI 模式顶部内容被状态栏覆盖的问题

This commit is contained in:
SuperMonster003
2025-05-25 20:51:17 +08:00
parent 38118dd1a4
commit 6159302829
3 changed files with 19 additions and 2 deletions

View File

@@ -12,12 +12,18 @@ import android.view.KeyEvent
import android.view.Menu
import android.view.MenuItem
import android.view.MotionEvent
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.graphics.drawable.toDrawable
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isNotEmpty
import org.autojs.autojs.AbstractAutoJs.Companion.isInrt
import org.autojs.autojs.annotation.ScriptInterface
import org.autojs.autojs.app.OnActivityResultDelegate
import org.autojs.autojs.core.eventloop.EventEmitter
import org.autojs.autojs.core.eventloop.SimpleEvent
import org.autojs.autojs.engine.JavaScriptEngine
@@ -81,6 +87,17 @@ class ScriptExecuteActivity : AppCompatActivity() {
ViewUtils.addWindowFlags(this, WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
@Suppress("DEPRECATION")
ViewUtils.appendSystemUiVisibility(this, SYSTEM_UI_FLAG_LAYOUT_STABLE or SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content)) { v, insets ->
val sysBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(0, sysBars.top, 0, sysBars.bottom)
WindowInsetsCompat.CONSUMED
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
ViewUtils.setNavigationBarBackgroundColor(this, getColor(R.color.black_alpha_44))
}
val executionId = intent.getIntExtra(EXTRA_EXECUTION_ID, ScriptExecution.NO_ID)
if (executionId == ScriptExecution.NO_ID) {
super.finish()

View File

@@ -38,8 +38,7 @@ abstract class BaseActivity : AppCompatActivity() {
if (handleNavigationBarContrastEnforcedAutomatically) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
@Suppress("DEPRECATION")
window.navigationBarColor = getColor(R.color.black_alpha_44)
ViewUtils.setNavigationBarBackgroundColor(this, getColor(R.color.black_alpha_44))
}
}