Added tabletUI option: "Automatic" (#6208)

* added automatic tablet ui option; useful for foldables

* set automatic as default, rename setting

* remove redundant checks

Co-authored-by: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com>

* remove redundant checks

Co-authored-by: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com>

* fix defaultValue

Co-authored-by: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com>
This commit is contained in:
OncePunchedMan
2021-11-11 22:32:28 +01:00
committed by GitHub
parent bfcc883f01
commit 41952f0215
5 changed files with 6 additions and 11 deletions

View File

@@ -316,6 +316,7 @@ fun Context.isTablet(): Boolean {
fun Context.prepareTabletUiContext(): Context {
val configuration = resources.configuration
val expected = when (Injekt.get<PreferencesHelper>().tabletUiMode().get()) {
PreferenceValues.TabletUiMode.AUTOMATIC -> isTablet()
PreferenceValues.TabletUiMode.ALWAYS -> true
PreferenceValues.TabletUiMode.LANDSCAPE -> configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
PreferenceValues.TabletUiMode.NEVER -> false