mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-12-16 12:08:49 +00:00
Moved enforceRefreshRate SDK version check to within the function
This commit is contained in:
parent
ff4100fe34
commit
576eac5e2f
@ -84,9 +84,7 @@ class EmulationActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
RefreshRateUtil.enforceRefreshRate(this, sixtyHz = true)
|
||||
}
|
||||
RefreshRateUtil.enforceRefreshRate(this, sixtyHz = true)
|
||||
|
||||
ThemeUtil.setTheme(this)
|
||||
settingsViewModel.settings.loadSettings()
|
||||
|
||||
@ -51,9 +51,7 @@ class SettingsActivity : AppCompatActivity(), SettingsActivityView {
|
||||
override val settings: Settings get() = settingsViewModel.settings
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
RefreshRateUtil.enforceRefreshRate(this)
|
||||
}
|
||||
RefreshRateUtil.enforceRefreshRate(this)
|
||||
|
||||
ThemeUtil.setTheme(this)
|
||||
|
||||
|
||||
@ -68,9 +68,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||
override var themeId: Int = 0
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
RefreshRateUtil.enforceRefreshRate(this)
|
||||
}
|
||||
RefreshRateUtil.enforceRefreshRate(this)
|
||||
|
||||
val splashScreen = installSplashScreen()
|
||||
CitraDirectoryUtils.attemptAutomaticUpdateDirectory()
|
||||
|
||||
@ -18,8 +18,11 @@ object RefreshRateUtil {
|
||||
// but is instead the refresh rate chosen by the user in the Android system settings.
|
||||
// For example, if the user selected 120hz in the settings, but the display is capable
|
||||
// of 144hz, 120hz will be treated as the maximum within this function.
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
fun enforceRefreshRate(activity: Activity, sixtyHz: Boolean = false) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
return
|
||||
}
|
||||
|
||||
val display = activity.display
|
||||
val window = activity.window
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user