diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index dccf51a3..bc27f12a 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -27,8 +27,6 @@ android:exported="true" android:hardwareAccelerated="true" android:launchMode="singleTask" - android:resizeableActivity="false" - android:screenOrientation="portrait" android:theme="@style/LaunchTheme" android:windowSoftInputMode="adjustResize"> diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt b/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt index 19c8b1bd..f0f5782c 100644 --- a/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt +++ b/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt @@ -16,8 +16,10 @@ package com.yubico.authenticator +import android.annotation.SuppressLint import android.content.* import android.content.SharedPreferences.OnSharedPreferenceChangeListener +import android.content.pm.ActivityInfo import android.content.pm.PackageManager import android.hardware.camera2.CameraCharacteristics import android.hardware.camera2.CameraManager @@ -71,6 +73,12 @@ class MainActivity : FlutterFragmentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + if (resources.getBoolean(R.bool.portrait_only)) { + @SuppressLint("SourceLockedOrientationActivity") + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + } + WindowCompat.setDecorFitsSystemWindows(window, false) allowScreenshots(false) diff --git a/android/app/src/main/res/values-sw533dp/bools.xml b/android/app/src/main/res/values-sw533dp/bools.xml new file mode 100644 index 00000000..4a4d8ab3 --- /dev/null +++ b/android/app/src/main/res/values-sw533dp/bools.xml @@ -0,0 +1,4 @@ + + + false + \ No newline at end of file diff --git a/android/app/src/main/res/values-xlarge/bools.xml b/android/app/src/main/res/values-xlarge/bools.xml new file mode 100644 index 00000000..4a4d8ab3 --- /dev/null +++ b/android/app/src/main/res/values-xlarge/bools.xml @@ -0,0 +1,4 @@ + + + false + \ No newline at end of file diff --git a/android/app/src/main/res/values/bools.xml b/android/app/src/main/res/values/bools.xml new file mode 100644 index 00000000..1a61e5a6 --- /dev/null +++ b/android/app/src/main/res/values/bools.xml @@ -0,0 +1,4 @@ + + + true + \ No newline at end of file