[android,ui] background support

This commit is contained in:
xbzk 2026-03-07 17:45:26 -03:00
parent 7a17fd8c71
commit fc2569a724
41 changed files with 593 additions and 29 deletions

View file

@ -31,6 +31,7 @@ import org.yuzu.yuzu_emu.databinding.DialogLobbyBrowserBinding
import org.yuzu.yuzu_emu.databinding.ItemLobbyRoomBinding
import org.yuzu.yuzu_emu.features.settings.model.StringSetting
import org.yuzu.yuzu_emu.network.NetPlayManager
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import java.util.Locale
class LobbyBrowser(context: Context) : BottomSheetDialog(context) {
@ -47,6 +48,7 @@ class LobbyBrowser(context: Context) : BottomSheetDialog(context) {
binding = DialogLobbyBrowserBinding.inflate(layoutInflater)
setContentView(binding.root)
BackgroundHelper.applyBackground(binding.backgroundLogo, context)
binding.emptyRefreshButton.setOnClickListener {
binding.progressBar.visibility = View.VISIBLE

View file

@ -105,6 +105,14 @@ object Settings {
const val PREF_BLACK_BACKGROUNDS = "BlackBackgrounds"
const val PREF_STATIC_THEME_COLOR = "StaticThemeColor"
// App background preference keys
const val PREF_HOME_BACKGROUND_STYLE = "HomeBackgroundStyle"
const val HOME_BACKGROUND_STYLE_NONE = 0
const val HOME_BACKGROUND_STYLE_EDEN = 1
const val HOME_BACKGROUND_STYLE_DEFAULT = HOME_BACKGROUND_STYLE_NONE
const val PREF_HOME_BACKGROUND_ALPHA = "HomeBackgroundAlpha"
const val HOME_BACKGROUND_ALPHA_DEFAULT = 40
enum class EmulationOrientation(val int: Int) {
Unspecified(0),
SensorLandscape(5),

View file

@ -33,6 +33,7 @@ import org.yuzu.yuzu_emu.features.input.NativeInput
import org.yuzu.yuzu_emu.features.settings.model.Settings
import org.yuzu.yuzu_emu.features.settings.model.view.PathSetting
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.PathUtil
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
import org.yuzu.yuzu_emu.utils.*
@ -178,8 +179,16 @@ class SettingsFragment : Fragment() {
}
presenter.onViewCreated()
applyBackgroundPreference()
setInsets()
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
private fun getPlayerIndex(): Int =
when (args.menuTag) {
Settings.MenuTag.SECTION_INPUT_PLAYER_ONE -> 0
@ -232,6 +241,10 @@ private fun getPlayerIndex(): Int =
}
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
private fun hasAllFilesPermission(): Boolean {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Environment.isExternalStorageManager()

View file

@ -29,6 +29,7 @@ import org.yuzu.yuzu_emu.features.settings.model.view.*
import org.yuzu.yuzu_emu.utils.InputHandler
import org.yuzu.yuzu_emu.utils.NativeConfig
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import androidx.fragment.app.FragmentActivity
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
@ -1071,6 +1072,26 @@ class SettingsFragmentPresenter(
add(HeaderSetting(R.string.theme_and_color))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
add(
SingleChoiceSetting(
theme,
titleId = R.string.change_app_theme,
choicesId = R.array.themeEntriesA12,
valuesId = R.array.themeValuesA12
)
)
} else {
add(
SingleChoiceSetting(
theme,
titleId = R.string.change_app_theme,
choicesId = R.array.themeEntries,
valuesId = R.array.themeValues
)
)
}
val themeMode: AbstractIntSetting = object : AbstractIntSetting {
override fun getInt(needsGlobal: Boolean): Int = IntSetting.THEME_MODE.getInt()
override fun setInt(value: Int) {
@ -1101,26 +1122,6 @@ class SettingsFragmentPresenter(
)
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
add(
SingleChoiceSetting(
theme,
titleId = R.string.change_app_theme,
choicesId = R.array.themeEntriesA12,
valuesId = R.array.themeValuesA12
)
)
} else {
add(
SingleChoiceSetting(
theme,
titleId = R.string.change_app_theme,
choicesId = R.array.themeEntries,
valuesId = R.array.themeValues
)
)
}
val staticThemeColor: AbstractIntSetting = object : AbstractIntSetting {
override fun getInt(needsGlobal: Boolean): Int =
IntSetting.STATIC_THEME_COLOR.getInt(needsGlobal)
@ -1187,6 +1188,79 @@ class SettingsFragmentPresenter(
)
)
val backgroundStyleSetting: AbstractIntSetting = object : AbstractIntSetting {
override fun getInt(needsGlobal: Boolean): Int =
BackgroundHelper.getBackgroundStyle(context)
override fun setInt(value: Int) {
BackgroundHelper.setBackgroundStyle(context, value)
settingsViewModel.setShouldRecreate(true)
}
override val key: String = Settings.PREF_HOME_BACKGROUND_STYLE
override val isRuntimeModifiable: Boolean = true
override val pairedSettingKey: String = ""
override val isSwitchable: Boolean = false
override var global: Boolean = true
override val isSaveable: Boolean = true
override val defaultValue: Int = Settings.HOME_BACKGROUND_STYLE_DEFAULT
override fun getValueAsString(needsGlobal: Boolean): String =
getInt(needsGlobal).toString()
override fun reset() {
setInt(defaultValue)
}
}
add(
SingleChoiceSetting(
backgroundStyleSetting,
titleId = R.string.home_background,
descriptionId = R.string.home_background_description,
choicesId = R.array.homeBackgroundEntries,
valuesId = R.array.homeBackgroundValues
)
)
val backgroundAlphaSetting: AbstractIntSetting = object : AbstractIntSetting {
override fun getInt(needsGlobal: Boolean): Int =
(BackgroundHelper.getBackgroundAlpha(context) * 100).toInt()
override fun setInt(value: Int) {
BackgroundHelper.setBackgroundAlpha(context, value)
settingsViewModel.setShouldRecreate(true)
}
override val key: String = Settings.PREF_HOME_BACKGROUND_ALPHA
override val isRuntimeModifiable: Boolean = true
override val pairedSettingKey: String = ""
override val isSwitchable: Boolean = false
override var global: Boolean = true
override val isSaveable: Boolean = true
override val defaultValue: Int = Settings.HOME_BACKGROUND_ALPHA_DEFAULT
override fun getValueAsString(needsGlobal: Boolean): String =
getInt(needsGlobal).toString()
override fun reset() {
setInt(defaultValue)
}
}
if (BackgroundHelper.getBackgroundStyle(context) != Settings.HOME_BACKGROUND_STYLE_NONE) {
add(
SliderSetting(
backgroundAlphaSetting,
titleId = R.string.home_background_opacity,
descriptionId = R.string.home_background_opacity_description,
min = 0,
max = 100,
units = "%"
)
)
}
add(HeaderSetting(R.string.buttons))
add(BooleanSetting.ENABLE_FOLDER_BUTTON.key)
add(BooleanSetting.ENABLE_QLAUNCH_BUTTON.key)

View file

@ -25,6 +25,7 @@ import org.yuzu.yuzu_emu.BuildConfig
import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.databinding.FragmentAboutBinding
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
import org.yuzu.yuzu_emu.NativeLibrary
@ -53,6 +54,8 @@ class AboutFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(visible = false)
applyBackgroundPreference()
binding.toolbarAbout.setNavigationOnClickListener {
binding.root.findNavController().popBackStack()
}
@ -105,6 +108,11 @@ class AboutFragment : Fragment() {
setInsets()
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
private fun openLink(link: String) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(link))
startActivity(intent)
@ -127,4 +135,8 @@ class AboutFragment : Fragment() {
windowInsets
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -25,6 +25,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentAddonsBinding
import org.yuzu.yuzu_emu.model.AddonViewModel
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.utils.AddonUtil
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.FileUtil.copyFilesTo
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
import org.yuzu.yuzu_emu.utils.collect
@ -59,6 +60,7 @@ class AddonsFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(false)
applyBackgroundPreference()
binding.toolbarAddons.setNavigationOnClickListener {
binding.root.findNavController().popBackStack()
@ -122,6 +124,7 @@ class AddonsFragment : Fragment() {
override fun onResume() {
super.onResume()
addonViewModel.onAddonsViewStarted(args.game)
applyBackgroundPreference()
}
override fun onDestroy() {
@ -202,4 +205,8 @@ class AddonsFragment : Fragment() {
windowInsets
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
package org.yuzu.yuzu_emu.fragments
@ -21,6 +21,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentAppletLauncherBinding
import org.yuzu.yuzu_emu.model.Applet
import org.yuzu.yuzu_emu.model.AppletInfo
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
class AppletLauncherFragment : Fragment() {
@ -48,6 +49,7 @@ class AppletLauncherFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(visible = false)
applyBackgroundPreference()
binding.toolbarApplets.setNavigationOnClickListener {
binding.root.findNavController().popBackStack()
@ -91,6 +93,11 @@ class AppletLauncherFragment : Fragment() {
setInsets()
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
private fun setInsets() =
ViewCompat.setOnApplyWindowInsetsListener(
binding.root
@ -108,4 +115,8 @@ class AppletLauncherFragment : Fragment() {
windowInsets
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -30,6 +30,7 @@ import org.yuzu.yuzu_emu.databinding.FragmentDriverFetcherBinding
import org.yuzu.yuzu_emu.features.fetcher.DriverGroupAdapter
import org.yuzu.yuzu_emu.model.DriverViewModel
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
import java.io.IOException
@ -141,6 +142,8 @@ class DriverFetcherFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(visible = false)
applyBackgroundPreference()
binding.toolbarDrivers.setNavigationOnClickListener {
binding.root.findNavController().popBackStack()
}
@ -154,6 +157,11 @@ class DriverFetcherFragment : Fragment() {
fetchDrivers()
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
private fun fetchDrivers() {
binding.loadingIndicator.isVisible = true
@ -242,6 +250,10 @@ class DriverFetcherFragment : Fragment() {
windowInsets
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
data class Artifact(val url: URL, val name: String)
data class Release(

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
package org.yuzu.yuzu_emu.fragments
@ -33,6 +33,7 @@ import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.utils.FileUtil
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
import org.yuzu.yuzu_emu.utils.NativeConfig
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
import org.yuzu.yuzu_emu.utils.collect
import java.io.File
@ -66,6 +67,7 @@ class DriverManagerFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(visible = false)
applyBackgroundPreference()
driverViewModel.onOpenDriverManager(args.game)
if (NativeConfig.isPerGameConfigLoaded()) {
@ -138,6 +140,11 @@ class DriverManagerFragment : Fragment() {
driverViewModel.onCloseDriverManager(args.game)
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
private fun setInsets() =
ViewCompat.setOnApplyWindowInsetsListener(
binding.root
@ -256,4 +263,8 @@ class DriverManagerFragment : Fragment() {
.setCancelable(false)
.show()
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -20,6 +20,7 @@ import org.yuzu.yuzu_emu.adapters.FreedrenoPresetAdapter
import org.yuzu.yuzu_emu.adapters.FreedrenoVariableAdapter
import org.yuzu.yuzu_emu.databinding.FragmentFreedrenoSettingsBinding
import org.yuzu.yuzu_emu.model.Game
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.NativeFreedrenoConfig
import org.yuzu.yuzu_emu.utils.FreedrenoPresets
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
@ -68,6 +69,7 @@ class FreedrenoSettingsFragment : Fragment() {
setupAdapters()
loadCurrentSettings()
setupButtonListeners()
applyBackgroundPreference()
setupWindowInsets()
}
@ -193,6 +195,16 @@ class FreedrenoSettingsFragment : Fragment() {
insets
}
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
private fun showSnackbar(message: String) {
Snackbar.make(binding.root, message, Snackbar.LENGTH_SHORT).show()
}

View file

@ -26,6 +26,7 @@ import org.yuzu.yuzu_emu.model.GameDir
import org.yuzu.yuzu_emu.model.GamesViewModel
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.ui.main.MainActivity
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
import org.yuzu.yuzu_emu.utils.collect
@ -57,6 +58,7 @@ class GameFoldersFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(visible = false)
applyBackgroundPreference()
binding.toolbarFolders.setNavigationOnClickListener {
binding.root.findNavController().popBackStack()
@ -100,6 +102,11 @@ class GameFoldersFragment : Fragment() {
setInsets()
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
override fun onStop() {
super.onStop()
gamesViewModel.onCloseGameFoldersFragment()
@ -133,4 +140,8 @@ class GameFoldersFragment : Fragment() {
windowInsets
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
package org.yuzu.yuzu_emu.fragments
@ -26,6 +26,7 @@ import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.databinding.FragmentGameInfoBinding
import org.yuzu.yuzu_emu.model.GameVerificationResult
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.GameMetadata
import org.yuzu.yuzu_emu.utils.ViewUtils.setVisible
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
@ -60,6 +61,7 @@ class GameInfoFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(false)
applyBackgroundPreference()
binding.apply {
toolbarInfo.title = args.game.title
@ -143,6 +145,11 @@ class GameInfoFragment : Fragment() {
setInsets()
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
private fun copyToClipboard(label: String, body: String) {
val clipBoard =
requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
@ -175,4 +182,8 @@ class GameInfoFragment : Fragment() {
windowInsets
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -48,6 +48,7 @@ import org.yuzu.yuzu_emu.utils.FileUtil
import org.yuzu.yuzu_emu.utils.GameIconUtils
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
import org.yuzu.yuzu_emu.utils.MemoryUtil
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.ViewUtils.marquee
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
import org.yuzu.yuzu_emu.utils.collect
@ -83,6 +84,7 @@ class GamePropertiesFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(true)
applyBackgroundPreference()
binding.buttonBack.setOnClickListener {
view.findNavController().popBackStack()
@ -487,6 +489,7 @@ class GamePropertiesFragment : Fragment() {
override fun onResume() {
super.onResume()
applyBackgroundPreference()
driverViewModel.updateDriverNameForGame(args.game)
getPlayTime()
reloadList()
@ -711,4 +714,8 @@ class GamePropertiesFragment : Fragment() {
).show()
}
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -40,6 +40,7 @@ import org.yuzu.yuzu_emu.model.DriverViewModel
import org.yuzu.yuzu_emu.model.HomeSetting
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.ui.main.MainActivity
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.FileUtil
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
import org.yuzu.yuzu_emu.utils.Log
@ -76,6 +77,7 @@ class HomeSettingsFragment : Fragment() {
findNavController().popBackStack()
}
binding.toolbarHomeSettings.title = getString(R.string.preferences_settings)
applyBackgroundPreference()
val optionsList: MutableList<HomeSetting> = mutableListOf<HomeSetting>().apply {
add(
@ -315,6 +317,7 @@ class HomeSettingsFragment : Fragment() {
override fun onResume() {
super.onResume()
driverViewModel.updateDriverNameForGame(null)
applyBackgroundPreference()
}
override fun onDestroyView() {
@ -500,4 +503,8 @@ class HomeSettingsFragment : Fragment() {
windowInsets
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.logoImage, requireContext())
}
}

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
package org.yuzu.yuzu_emu.fragments
@ -32,6 +32,7 @@ import org.yuzu.yuzu_emu.ui.main.MainActivity
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
import org.yuzu.yuzu_emu.utils.FileUtil
import org.yuzu.yuzu_emu.utils.NativeConfig
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
import org.yuzu.yuzu_emu.utils.collect
import java.io.BufferedOutputStream
@ -68,6 +69,7 @@ class InstallableFragment : Fragment() {
val mainActivity = requireActivity() as MainActivity
homeViewModel.setStatusBarShadeVisibility(visible = false)
applyBackgroundPreference()
binding.toolbarInstallables.setNavigationOnClickListener {
binding.root.findNavController().popBackStack()
@ -162,6 +164,11 @@ class InstallableFragment : Fragment() {
setInsets()
}
override fun onResume() {
super.onResume()
applyBackgroundPreference()
}
private fun setInsets() =
ViewCompat.setOnApplyWindowInsetsListener(
binding.root
@ -325,4 +332,8 @@ class InstallableFragment : Fragment() {
}
}.show(parentFragmentManager, ProgressDialogFragment.TAG)
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -21,6 +21,7 @@ import org.yuzu.yuzu_emu.adapters.ProfileAdapter
import org.yuzu.yuzu_emu.databinding.FragmentProfileManagerBinding
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.model.UserProfile
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.NativeConfig
class ProfileManagerFragment : Fragment() {
@ -49,6 +50,7 @@ class ProfileManagerFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(visible = false)
applyBackgroundPreference()
binding.toolbarProfiles.setNavigationOnClickListener {
findNavController().popBackStack()
@ -75,6 +77,7 @@ class ProfileManagerFragment : Fragment() {
override fun onResume() {
super.onResume()
loadProfiles()
applyBackgroundPreference()
}
private fun setupRecyclerView() {
@ -187,4 +190,8 @@ class ProfileManagerFragment : Fragment() {
NativeConfig.saveGlobalConfig()
_binding = null
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
}

View file

@ -40,6 +40,7 @@ import org.yuzu.yuzu_emu.model.Game
import org.yuzu.yuzu_emu.model.GamesViewModel
import org.yuzu.yuzu_emu.model.HomeViewModel
import org.yuzu.yuzu_emu.ui.main.MainActivity
import org.yuzu.yuzu_emu.utils.BackgroundHelper
import org.yuzu.yuzu_emu.utils.ViewUtils.setVisible
import org.yuzu.yuzu_emu.utils.collect
import info.debatty.java.stringsimilarity.Jaccard
@ -106,6 +107,7 @@ class GamesFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
homeViewModel.setStatusBarShadeVisibility(true)
mainActivity = requireActivity() as MainActivity
applyBackgroundPreference()
if (savedInstanceState != null) {
binding.searchText.setText(savedInstanceState.getString(SEARCH_TEXT))
@ -252,6 +254,7 @@ class GamesFragment : Fragment() {
override fun onResume() {
super.onResume()
applyBackgroundPreference()
if (getCurrentViewType() == GameAdapter.VIEW_TYPE_CAROUSEL) {
(binding.gridGames as? CarouselRecyclerView)?.setupCarousel(true)
(binding.gridGames as? CarouselRecyclerView)?.restoreScrollState(gamesViewModel.lastScrollPosition)
@ -497,6 +500,10 @@ class GamesFragment : Fragment() {
binding.addDirectory.visibility = if (showFolder) View.VISIBLE else View.GONE
}
private fun applyBackgroundPreference() {
BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext())
}
private fun setInsets() =
ViewCompat.setOnApplyWindowInsetsListener(
binding.root

View file

@ -0,0 +1,64 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
package org.yuzu.yuzu_emu.utils
import android.content.Context
import android.view.View
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import org.yuzu.yuzu_emu.R
import org.yuzu.yuzu_emu.features.settings.model.Settings
object BackgroundHelper {
fun getBackgroundStyle(context: Context): Int {
return PreferenceManager.getDefaultSharedPreferences(context).getInt(
Settings.PREF_HOME_BACKGROUND_STYLE,
Settings.HOME_BACKGROUND_STYLE_DEFAULT
)
}
fun setBackgroundStyle(context: Context, style: Int) {
PreferenceManager.getDefaultSharedPreferences(context).edit {
putInt(Settings.PREF_HOME_BACKGROUND_STYLE, style)
}
}
fun getBackgroundAlpha(context: Context): Float {
val alphaPercent = PreferenceManager.getDefaultSharedPreferences(context).getInt(
Settings.PREF_HOME_BACKGROUND_ALPHA,
Settings.HOME_BACKGROUND_ALPHA_DEFAULT
).coerceIn(0, 100)
return alphaPercent / 100f
}
fun setBackgroundAlpha(context: Context, alphaPercent: Int) {
PreferenceManager.getDefaultSharedPreferences(context).edit {
putInt(Settings.PREF_HOME_BACKGROUND_ALPHA, alphaPercent.coerceIn(0, 100))
}
}
fun applyBackground(view: View, context: Context) {
val isEnabled = getBackgroundStyle(context) != Settings.HOME_BACKGROUND_STYLE_NONE
val visibilityStrength = getBackgroundAlpha(context)
val parent = view.parent as? View
val scrim = parent?.findViewById<View>(R.id.background_scrim)
view.visibility = if (isEnabled) View.VISIBLE else View.GONE
if (!isEnabled) {
scrim?.visibility = View.GONE
return
}
if (scrim != null) {
// Keep background image opaque; control perceived intensity through a cheap flat-color scrim.
view.alpha = 1f
scrim.visibility = View.VISIBLE
scrim.alpha = (1f - visibilityStrength).coerceIn(0f, 1f)
} else {
view.alpha = visibilityStrength
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View file

@ -6,6 +6,17 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -8,6 +8,29 @@
android:clipChildren="false"
>
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/background_scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"

View file

@ -8,6 +8,17 @@
android:background="?attr/colorSurface"
>
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_about"
android:layout_width="match_parent"

View file

@ -7,6 +7,16 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_info"
android:layout_width="match_parent"

View file

@ -7,6 +7,20 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.core.widget.NestedScrollView
android:id="@+id/list_all"
android:layout_width="0dp"

View file

@ -6,6 +6,17 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -8,6 +8,17 @@
android:background="?attr/colorSurface"
>
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_about"
android:layout_width="match_parent"

View file

@ -6,6 +6,20 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_addons"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -6,6 +6,17 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_applets"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -7,6 +7,20 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_drivers"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -6,6 +6,20 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"

View file

@ -6,6 +6,20 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

View file

@ -6,6 +6,16 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_freedreno"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -7,6 +7,16 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_info"
android:layout_width="match_parent"

View file

@ -6,6 +6,20 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.core.widget.NestedScrollView
android:id="@+id/list_all"
android:layout_width="match_parent"

View file

@ -8,6 +8,29 @@
android:clipChildren="false"
>
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/background_scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"

View file

@ -6,6 +6,20 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/logo_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.12"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_home_settings"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -6,6 +6,17 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_installables"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -8,6 +8,17 @@
android:background="?attr/colorSurface"
android:fitsSystemWindows="true">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -6,6 +6,17 @@
android:layout_height="match_parent"
android:background="?attr/colorSurface">
<ImageView
android:id="@+id/background_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:alpha="0.1"
android:contentDescription="@null"
android:importantForAccessibility="no"
android:scaleType="centerCrop"
android:src="@drawable/eden_background" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_settings"
style="@style/Widget.Eden.TransparentTopAppBarLayout"

View file

@ -383,6 +383,15 @@
<item>2</item>
</integer-array>
<string-array name="homeBackgroundEntries">
<item>@string/background_none</item>
<item>@string/background_eden_default</item>
</string-array>
<integer-array name="homeBackgroundValues">
<item>0</item>
<item>1</item>
</integer-array>
<string-array name="appLanguageNames">
<item>@string/app_language_system</item>
<item>@string/app_language_english</item>

View file

@ -1160,6 +1160,12 @@
<string name="theme_material_you">Material You</string>
<string name="app_settings">App Settings</string>
<string name="theme_and_color">Theme And Color</string>
<string name="home_background">Home background</string>
<string name="home_background_description">Show a decorative background across app screens.</string>
<string name="home_background_opacity">Background opacity</string>
<string name="home_background_opacity_description">Adjust the background visibility strength.</string>
<string name="background_none">None</string>
<string name="background_eden_default">Eden (default)</string>
<!-- Theme Modes -->
<string name="change_theme_mode">Change theme mode</string>