diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/activities/BaseActivity.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/activities/BaseActivity.kt index e6c79e0d..45dae8df 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/activities/BaseActivity.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/activities/BaseActivity.kt @@ -1,7 +1,9 @@ package net.dankito.banking.ui.android.activities +import android.content.pm.ActivityInfo import android.os.Bundle import androidx.appcompat.app.AppCompatActivity +import net.dankito.banking.ui.android.R import net.dankito.banking.ui.android.di.BankingComponent import net.dankito.banking.ui.android.util.CurrentActivityTracker import org.slf4j.LoggerFactory @@ -24,9 +26,18 @@ abstract class BaseActivity : AppCompatActivity() { } + open val isRunningOnTablet: Boolean + get() = resources.getBoolean(R.bool.isTablet) + + override fun onCreate(savedInstanceState: Bundle?) { log.info("Creating Activity $this") + // a bit bad as it not clearly visible that orientation lock is done here + if (isRunningOnTablet == false) { // lock screen to portrait mode on phones as there app really looks bad and some EditTexts are almost unusable + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + } + super.onCreate(savedInstanceState) } diff --git a/ui/BankingAndroidApp/src/main/res/values-sw600dp/attrs.xml b/ui/BankingAndroidApp/src/main/res/values-sw600dp/attrs.xml new file mode 100644 index 00000000..8e66f10e --- /dev/null +++ b/ui/BankingAndroidApp/src/main/res/values-sw600dp/attrs.xml @@ -0,0 +1,4 @@ + + + true + diff --git a/ui/BankingAndroidApp/src/main/res/values/attrs.xml b/ui/BankingAndroidApp/src/main/res/values/attrs.xml index 80960823..46f0e108 100644 --- a/ui/BankingAndroidApp/src/main/res/values/attrs.xml +++ b/ui/BankingAndroidApp/src/main/res/values/attrs.xml @@ -1,6 +1,9 @@ + false + +