Implemented locking screen orientation to portrait on phones as there some dialogs / EditTexts are almost unusable. TODO: setting this in BaseActivity is quite bad
This commit is contained in:
parent
470952ddde
commit
44e15e4aeb
|
@ -1,7 +1,9 @@
|
||||||
package net.dankito.banking.ui.android.activities
|
package net.dankito.banking.ui.android.activities
|
||||||
|
|
||||||
|
import android.content.pm.ActivityInfo
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
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.di.BankingComponent
|
||||||
import net.dankito.banking.ui.android.util.CurrentActivityTracker
|
import net.dankito.banking.ui.android.util.CurrentActivityTracker
|
||||||
import org.slf4j.LoggerFactory
|
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?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
log.info("Creating Activity $this")
|
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)
|
super.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="isTablet">true</bool>
|
||||||
|
</resources>
|
|
@ -1,6 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<bool name="isTablet">false</bool>
|
||||||
|
|
||||||
|
|
||||||
<declare-styleable name="Theme">
|
<declare-styleable name="Theme">
|
||||||
|
|
||||||
<attr name="fabTextColor" format="reference"/>
|
<attr name="fabTextColor" format="reference"/>
|
||||||
|
|
Loading…
Reference in New Issue