chore: fix more warnings
This commit is contained in:
@@ -2,6 +2,7 @@ package app.cogwheel.conduit
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.core.view.WindowCompat
|
||||
|
||||
@@ -10,7 +11,23 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// Enable edge-to-edge display for Android 15+ compatibility
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
// 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)
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user