add landscape support for tablet devices

This commit is contained in:
Adam Velebil 2023-02-24 14:59:57 +01:00
parent 47e577c947
commit 3cfdc56dad
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10
5 changed files with 20 additions and 2 deletions

View File

@ -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">

View File

@ -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)

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="portrait_only">false</bool>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="portrait_only">false</bool>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="portrait_only">true</bool>
</resources>