Follow screen rotation even to Portrait on Android with Opt-in (#3936)

This commit is contained in:
SomeTroglodyte
2021-05-19 22:27:23 +02:00
committed by GitHub
parent 929c357663
commit 3e3bda42e5
13 changed files with 164 additions and 20 deletions

View File

@ -1,6 +1,7 @@
package com.unciv.app
import android.content.Intent
import android.content.pm.ActivityInfo
import android.os.Build
import android.os.Bundle
import androidx.core.app.NotificationManagerCompat
@ -29,12 +30,19 @@ open class AndroidLauncher : AndroidApplication() {
if (externalfilesDir != null) GameSaver.externalFilesDirForAndroid = externalfilesDir.path
}
val config = AndroidApplicationConfiguration().apply { useImmersiveMode = true; }
// Manage orientation lock
val limitOrientationsHelper = LimitOrientationsHelperAndroid(this)
limitOrientationsHelper.limitOrientations(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
val config = AndroidApplicationConfiguration().apply {
useImmersiveMode = true;
}
val androidParameters = UncivGameParameters(
version = BuildConfig.VERSION_NAME,
crashReportSender = CrashReportSenderAndroid(this),
fontImplementation = NativeFontAndroid(Fonts.ORIGINAL_FONT_SIZE.toInt()),
customSaveLocationHelper = customSaveLocationHelper
customSaveLocationHelper = customSaveLocationHelper,
limitOrientationsHelper = limitOrientationsHelper
)
val game = UncivGame(androidParameters)
initialize(game, config)
@ -89,4 +97,4 @@ open class AndroidLauncher : AndroidApplication() {
}
}
class AndroidTvLauncher:AndroidLauncher()
class AndroidTvLauncher:AndroidLauncher()