Browse Source
[android,ui] feat fullscreen app setting (#3676)
[android,ui] feat fullscreen app setting (#3676)
why not? i like it a lot on both phone and TV. toggle in app settings. disabled by default so no hassle. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3676 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: xbzk <xbzk@eden-emu.dev> Co-committed-by: xbzk <xbzk@eden-emu.dev>lizzie/draw-state-inline
committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
12 changed files with 223 additions and 10 deletions
-
23src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/ChatDialog.kt
-
17src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/LobbyBrowser.kt
-
27src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/NetPlayDialog.kt
-
2src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt
-
17src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsActivity.kt
-
35src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt
-
18src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsSubscreenActivity.kt
-
20src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ProfileManagerFragment.kt
-
13src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt
-
52src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/FullscreenHelper.kt
-
7src/android/app/src/main/res/layout/fragment_profile_manager.xml
-
2src/android/app/src/main/res/values/strings.xml
@ -0,0 +1,52 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project |
||||
|
// SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
|
package org.yuzu.yuzu_emu.utils |
||||
|
|
||||
|
import android.app.Activity |
||||
|
import android.content.Context |
||||
|
import android.view.Window |
||||
|
import androidx.core.content.edit |
||||
|
import androidx.core.view.ViewCompat |
||||
|
import androidx.core.view.WindowInsetsCompat |
||||
|
import androidx.core.view.WindowInsetsControllerCompat |
||||
|
import androidx.preference.PreferenceManager |
||||
|
import org.yuzu.yuzu_emu.features.settings.model.Settings |
||||
|
|
||||
|
object FullscreenHelper { |
||||
|
fun isFullscreenEnabled(context: Context): Boolean { |
||||
|
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean( |
||||
|
Settings.PREF_APP_FULLSCREEN, |
||||
|
Settings.APP_FULLSCREEN_DEFAULT |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
fun setFullscreenEnabled(context: Context, enabled: Boolean) { |
||||
|
PreferenceManager.getDefaultSharedPreferences(context).edit { |
||||
|
putBoolean(Settings.PREF_APP_FULLSCREEN, enabled) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
fun shouldHideSystemBars(activity: Activity): Boolean { |
||||
|
val rootInsets = ViewCompat.getRootWindowInsets(activity.window.decorView) |
||||
|
val barsCurrentlyHidden = |
||||
|
rootInsets?.isVisible(WindowInsetsCompat.Type.systemBars())?.not() ?: false |
||||
|
return isFullscreenEnabled(activity) || barsCurrentlyHidden |
||||
|
} |
||||
|
|
||||
|
fun applyToWindow(window: Window, hideSystemBars: Boolean) { |
||||
|
val controller = WindowInsetsControllerCompat(window, window.decorView) |
||||
|
|
||||
|
if (hideSystemBars) { |
||||
|
controller.hide(WindowInsetsCompat.Type.systemBars()) |
||||
|
controller.systemBarsBehavior = |
||||
|
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE |
||||
|
} else { |
||||
|
controller.show(WindowInsetsCompat.Type.systemBars()) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
fun applyToActivity(activity: Activity) { |
||||
|
applyToWindow(activity.window, isFullscreenEnabled(activity)) |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue