diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 547aa6b..b5db72c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,17 +2,24 @@ - + - + - - diff --git a/app/src/main/java/icu/fur93/esp32_car/MainActivity.kt b/app/src/main/java/icu/fur93/esp32_car/MainActivity.kt index f04ec7d..bd538c0 100644 --- a/app/src/main/java/icu/fur93/esp32_car/MainActivity.kt +++ b/app/src/main/java/icu/fur93/esp32_car/MainActivity.kt @@ -13,11 +13,13 @@ import android.bluetooth.le.ScanResult import android.bluetooth.le.ScanSettings import android.content.pm.ActivityInfo import android.content.pm.PackageManager +import android.os.Build import android.os.Bundle import android.os.Handler import android.os.Looper import android.os.ParcelUuid import android.util.Log +import android.view.WindowManager import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.* @@ -35,12 +37,12 @@ import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsControllerCompat import icu.fur93.esp32_car.ui.component.Joystick import icu.fur93.esp32_car.ui.component.JoystickState +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch import java.util.UUID import java.text.SimpleDateFormat import java.util.Date import java.util.Locale -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch class MainActivity : ComponentActivity() { private val serviceUUID = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E" @@ -79,7 +81,10 @@ class MainActivity : ComponentActivity() { super.onCreate(savedInstanceState) // 设置全屏显示 - WindowCompat.setDecorFitsSystemWindows(window, false) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + window.attributes.layoutInDisplayCutoutMode = + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES + } // 隐藏状态栏和导航栏 WindowInsetsControllerCompat(window, window.decorView).let { controller -> @@ -421,7 +426,7 @@ fun GamepadScreen( Text("IN2: ${carController.carState.value.motorDState.in2}") } - // 设备选择���钮 + // 设备选择按钮 Button( onClick = { showDeviceList = true }, ) {