fix: android 15 warnings
This commit is contained in:
@@ -28,12 +28,14 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
// Align with modern Android Gradle Plugin requirements
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
||||
// Generate JVM bytecode targeting Java 17
|
||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
@@ -10,23 +10,8 @@ class MainActivity : FlutterActivity() {
|
||||
private lateinit var backgroundStreamingHandler: BackgroundStreamingHandler
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// Enable edge-to-edge display for Android 15+ compatibility
|
||||
// This ensures proper handling of system bars and insets
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
||||
// For Android 15+ (API 35), try to use enableEdgeToEdge if available
|
||||
try {
|
||||
// Use reflection to call EdgeToEdge.enable() for forward compatibility
|
||||
val edgeToEdgeClass = Class.forName("androidx.activity.EdgeToEdge")
|
||||
val enableMethod = edgeToEdgeClass.getMethod("enable", android.app.Activity::class.java)
|
||||
enableMethod.invoke(null, this)
|
||||
} catch (e: Exception) {
|
||||
// Fallback to WindowCompat if EdgeToEdge is not available
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
}
|
||||
} else {
|
||||
// For older versions, use WindowCompat for backward compatibility
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
}
|
||||
// Ensure content draws behind system bars (backwards compatible helper)
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
@@ -45,4 +30,4 @@ class MainActivity : FlutterActivity() {
|
||||
backgroundStreamingHandler.cleanup()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
<!-- Android 15+ edge-to-edge configuration -->
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">always</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<!-- Do not set status/navigation bar colors on API 35+ -->
|
||||
<item name="android:enforceNavigationBarContrast">false</item>
|
||||
<item name="android:enforceStatusBarContrast">false</item>
|
||||
</style>
|
||||
@@ -25,9 +24,8 @@
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
<!-- Android 15+ edge-to-edge configuration -->
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<!-- Do not set status/navigation bar colors on API 35+ -->
|
||||
<item name="android:enforceNavigationBarContrast">false</item>
|
||||
<item name="android:enforceStatusBarContrast">false</item>
|
||||
</style>
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user