diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 06032e3a4..a73ba1616 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -24,7 +24,7 @@ android:name=".MainActivity" android:exported="true" android:theme="@style/Theme.Memories.NoActionBar" - android:configChanges="orientation|screenSize"> + android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|density|screenSize|smallestScreenSize"> diff --git a/android/app/src/main/java/gallery/memories/MainActivity.kt b/android/app/src/main/java/gallery/memories/MainActivity.kt index b554a5dd4..87c9726f4 100644 --- a/android/app/src/main/java/gallery/memories/MainActivity.kt +++ b/android/app/src/main/java/gallery/memories/MainActivity.kt @@ -75,6 +75,10 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(binding.root) + // Set fullscreen mode if in landscape + val orientation = resources.configuration.orientation + setFullscreen(orientation == Configuration.ORIENTATION_LANDSCAPE) + // Restore last known look restoreTheme() @@ -99,9 +103,9 @@ class MainActivity : AppCompatActivity() { override fun onDestroy() { super.onDestroy() - binding.webview.removeAllViews(); + binding.webview.removeAllViews() binding.coordinator.removeAllViews() - binding.webview.destroy(); + binding.webview.destroy() nativex.destroy() } @@ -132,7 +136,7 @@ class MainActivity : AppCompatActivity() { } override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { - if (event.getAction() == KeyEvent.ACTION_DOWN) { + if (event.action == KeyEvent.ACTION_DOWN) { when (keyCode) { KeyEvent.KEYCODE_BACK -> { if (binding.webview.canGoBack()) { @@ -268,7 +272,7 @@ class MainActivity : AppCompatActivity() { if (BuildConfig.DEBUG) { Toast.makeText(this, "Debugging enabled", Toast.LENGTH_SHORT).show() binding.webview.clearCache(true) - WebView.setWebContentsDebuggingEnabled(true); + WebView.setWebContentsDebuggingEnabled(true) } // Welcome page or actual app @@ -288,7 +292,7 @@ class MainActivity : AppCompatActivity() { if (host != null) return true // Load welcome page - binding.webview.loadUrl("file:///android_asset/welcome.html"); + binding.webview.loadUrl("file:///android_asset/welcome.html") return false }