diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt index a8ec82e560..5566423af6 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GamePropertiesAdapter.kt @@ -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 // SPDX-FileCopyrightText: 2023 yuzu Emulator Project @@ -10,6 +10,8 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.core.content.res.ResourcesCompat import androidx.lifecycle.LifecycleOwner +import com.google.android.material.button.MaterialButton +import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.databinding.CardInstallableIconBinding import org.yuzu.yuzu_emu.databinding.CardSimpleOutlinedBinding import org.yuzu.yuzu_emu.model.GameProperty @@ -89,29 +91,33 @@ class GamePropertiesAdapter( val hasVisibleActions = submenuProperty.secondaryActions?.any { it.isShown } == true + binding.layoutSecondaryActions.removeAllViews() + binding.dividerSecondaryActions.setVisible(false) if (hasVisibleActions) { - binding.dividerSecondaryActions.setVisible(true) binding.layoutSecondaryActions.setVisible(true) - submenuProperty.secondaryActions!!.forEach { secondaryAction -> - if (secondaryAction.isShown) { - val button = com.google.android.material.button.MaterialButton( - binding.root.context, - null, - com.google.android.material.R.attr.materialButtonOutlinedStyle - ).apply { - setIconResource(secondaryAction.iconId) - iconSize = (18 * binding.root.context.resources.displayMetrics.density).toInt() - text = binding.root.context.getString(secondaryAction.descriptionId) - contentDescription = binding.root.context.getString(secondaryAction.descriptionId) - setOnClickListener { secondaryAction.action.invoke() } - } - binding.layoutSecondaryActions.addView(button) + val visibleActions = submenuProperty.secondaryActions!!.filter { it.isShown } + val inflater = LayoutInflater.from(binding.root.context) + visibleActions.forEachIndexed { index, secondaryAction -> + val button = inflater.inflate( + R.layout.item_secondary_action_button, + binding.layoutSecondaryActions, + false + ) as MaterialButton + button.setIconResource(secondaryAction.iconId) + button.text = "" + button.contentDescription = binding.root.context + .getString(secondaryAction.descriptionId) + button.tooltipText = binding.root.context + .getString(secondaryAction.descriptionId) + if (index == visibleActions.lastIndex) { + (button.layoutParams as ViewGroup.MarginLayoutParams).marginEnd = 0 } + button.setOnClickListener { secondaryAction.action.invoke() } + binding.layoutSecondaryActions.addView(button) } } else { - binding.dividerSecondaryActions.setVisible(false) binding.layoutSecondaryActions.setVisible(false) } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/LobbyBrowser.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/LobbyBrowser.kt index 57fd551e02..95f92237cf 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/LobbyBrowser.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/dialogs/LobbyBrowser.kt @@ -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.dialogs @@ -30,6 +30,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) { @@ -46,6 +47,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 diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt index 37a331b385..d15f03652c 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt @@ -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.features.settings.model @@ -27,7 +27,7 @@ object Settings { SECTION_APP_SETTINGS(R.string.app_settings), SECTION_CUSTOM_PATHS(R.string.preferences_custom_paths), SECTION_DEBUG(R.string.preferences_debug), - SECTION_FREEDRENO(R.string.gpu_driver_settings), + SECTION_FREEDRENO(R.string.freedreno_settings_title), SECTION_APPLETS(R.string.applets_menu); } @@ -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), diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt index 2f527b5f62..00dc7883f8 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragment.kt @@ -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 // SPDX-FileCopyrightText: 2023 yuzu Emulator Project @@ -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.* @@ -98,23 +99,8 @@ class SettingsFragment : Fragment() { activity ) - binding.toolbarSettingsLayout.title = if (args.menuTag == Settings.MenuTag.SECTION_ROOT && - args.game != null - ) { - args.game!!.title - } else { - when (args.menuTag) { - Settings.MenuTag.SECTION_INPUT_PLAYER_ONE -> Settings.getPlayerString(1) - Settings.MenuTag.SECTION_INPUT_PLAYER_TWO -> Settings.getPlayerString(2) - Settings.MenuTag.SECTION_INPUT_PLAYER_THREE -> Settings.getPlayerString(3) - Settings.MenuTag.SECTION_INPUT_PLAYER_FOUR -> Settings.getPlayerString(4) - Settings.MenuTag.SECTION_INPUT_PLAYER_FIVE -> Settings.getPlayerString(5) - Settings.MenuTag.SECTION_INPUT_PLAYER_SIX -> Settings.getPlayerString(6) - Settings.MenuTag.SECTION_INPUT_PLAYER_SEVEN -> Settings.getPlayerString(7) - Settings.MenuTag.SECTION_INPUT_PLAYER_EIGHT -> Settings.getPlayerString(8) - else -> getString(args.menuTag.titleId) - } - } + val toolbarTitle = resolveToolbarTitle() + configureToolbar(toolbarTitle) binding.listSettings.apply { adapter = settingsAdapter @@ -193,10 +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 @@ -210,6 +202,27 @@ class SettingsFragment : Fragment() { else -> -1 } + private fun resolveToolbarTitle(): String { + if (args.menuTag == Settings.MenuTag.SECTION_ROOT && args.game != null) { + return args.game!!.title + } + return when (args.menuTag) { + Settings.MenuTag.SECTION_INPUT_PLAYER_ONE -> Settings.getPlayerString(1) + Settings.MenuTag.SECTION_INPUT_PLAYER_TWO -> Settings.getPlayerString(2) + Settings.MenuTag.SECTION_INPUT_PLAYER_THREE -> Settings.getPlayerString(3) + Settings.MenuTag.SECTION_INPUT_PLAYER_FOUR -> Settings.getPlayerString(4) + Settings.MenuTag.SECTION_INPUT_PLAYER_FIVE -> Settings.getPlayerString(5) + Settings.MenuTag.SECTION_INPUT_PLAYER_SIX -> Settings.getPlayerString(6) + Settings.MenuTag.SECTION_INPUT_PLAYER_SEVEN -> Settings.getPlayerString(7) + Settings.MenuTag.SECTION_INPUT_PLAYER_EIGHT -> Settings.getPlayerString(8) + else -> getString(args.menuTag.titleId) + } + } + + private fun configureToolbar(title: String) { + binding.toolbarSettings.title = title + } + private fun setInsets() { ViewCompat.setOnApplyWindowInsetsListener( binding.root @@ -228,6 +241,10 @@ class SettingsFragment : Fragment() { } } + private fun applyBackgroundPreference() { + BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext()) + } + private fun hasAllFilesPermission(): Boolean { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { Environment.isExternalStorageManager() diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt index 77104e0614..f90e0e1cfa 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -6,7 +6,6 @@ package org.yuzu.yuzu_emu.features.settings.ui import android.annotation.SuppressLint import android.os.Build import android.widget.Toast -import androidx.preference.PreferenceManager import org.yuzu.yuzu_emu.NativeLibrary import org.yuzu.yuzu_emu.R import org.yuzu.yuzu_emu.YuzuApplication @@ -27,11 +26,10 @@ import org.yuzu.yuzu_emu.features.settings.model.Settings.MenuTag import org.yuzu.yuzu_emu.features.settings.model.ShortSetting import org.yuzu.yuzu_emu.features.settings.model.StringSetting import org.yuzu.yuzu_emu.features.settings.model.view.* -import org.yuzu.yuzu_emu.utils.GpuDriverHelper import org.yuzu.yuzu_emu.utils.InputHandler import org.yuzu.yuzu_emu.utils.NativeConfig import org.yuzu.yuzu_emu.utils.DirectoryInitialization -import androidx.core.content.edit +import org.yuzu.yuzu_emu.utils.BackgroundHelper import androidx.fragment.app.FragmentActivity import org.yuzu.yuzu_emu.fragments.MessageDialogFragment @@ -183,16 +181,6 @@ class SettingsFragmentPresenter( menuKey = MenuTag.SECTION_DEBUG ) ) - if (GpuDriverHelper.isAdrenoGpu() && !NativeConfig.isPerGameConfigLoaded()) { - add( - SubmenuSetting( - titleId = R.string.gpu_driver_settings, - descriptionId = R.string.freedreno_settings_title, - iconId = R.drawable.ic_graphics, - menuKey = MenuTag.SECTION_FREEDRENO - ) - ) - } add( SubmenuSetting( titleId = R.string.applets_menu, @@ -1084,27 +1072,6 @@ 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) { @@ -1126,6 +1093,35 @@ class SettingsFragmentPresenter( } } + add( + SingleChoiceSetting( + themeMode, + titleId = R.string.change_theme_mode, + choicesId = R.array.themeModeEntries, + valuesId = R.array.themeModeValues + ) + ) + + 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) @@ -1149,15 +1145,6 @@ class SettingsFragmentPresenter( } } - add( - SingleChoiceSetting( - themeMode, - titleId = R.string.change_theme_mode, - choicesId = R.array.themeModeEntries, - valuesId = R.array.themeModeValues - ) - ) - if (IntSetting.THEME.getInt() != 1) { add( SingleChoiceSetting( @@ -1201,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) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt index 9745970c5b..984e3ed1a0 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt @@ -1,7 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - -// 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 @@ -28,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 @@ -54,7 +52,9 @@ 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() @@ -108,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) @@ -130,4 +135,8 @@ class AboutFragment : Fragment() { windowInsets } + + private fun applyBackgroundPreference() { + BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt index 573549d84b..fe67041213 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddonsFragment.kt @@ -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.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 @@ -60,6 +61,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() + applyBackgroundPreference() addonViewModel.refreshAddons() } @@ -201,4 +204,8 @@ class AddonsFragment : Fragment() { windowInsets } + + private fun applyBackgroundPreference() { + BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt index 3ab171a8d4..4b55ed1ede 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AppletLauncherFragment.kt @@ -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()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverFetcherFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverFetcherFragment.kt index 525fbd9f91..37998a03d0 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverFetcherFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverFetcherFragment.kt @@ -29,6 +29,8 @@ import org.yuzu.yuzu_emu.R 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 @@ -87,6 +89,7 @@ class DriverFetcherFragment : Fragment() { private lateinit var driverGroupAdapter: DriverGroupAdapter private val driverViewModel: DriverViewModel by activityViewModels() + private val homeViewModel: HomeViewModel by activityViewModels() private fun parseAdrenoModel(): Int { if (gpuModel == null) { @@ -138,6 +141,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() @@ -152,6 +157,11 @@ class DriverFetcherFragment : Fragment() { fetchDrivers() } + override fun onResume() { + super.onResume() + applyBackgroundPreference() + } + private fun fetchDrivers() { binding.loadingIndicator.isVisible = true @@ -240,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( diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt index 23334f05eb..1d514ba9d4 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt @@ -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()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/FreedrenoSettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/FreedrenoSettingsFragment.kt index 40111272d5..0bf7200fd9 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/FreedrenoSettingsFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/FreedrenoSettingsFragment.kt @@ -20,8 +20,10 @@ 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 class FreedrenoSettingsFragment : Fragment() { @@ -67,6 +69,7 @@ class FreedrenoSettingsFragment : Fragment() { setupAdapters() loadCurrentSettings() setupButtonListeners() + applyBackgroundPreference() setupWindowInsets() } @@ -74,10 +77,15 @@ class FreedrenoSettingsFragment : Fragment() { binding.toolbarFreedreno.setNavigationOnClickListener { requireActivity().onBackPressedDispatcher.onBackPressed() } - if (isPerGameConfig) { - binding.toolbarFreedreno.title = getString(R.string.freedreno_per_game_title) - binding.toolbarFreedreno.subtitle = game!!.title - } + + binding.toolbarFreedreno.title = getString( + if (isPerGameConfig) { + R.string.freedreno_per_game_title + } else { + R.string.freedreno_settings_title + } + ) + binding.toolbarFreedreno.subtitle = null } private fun setupAdapters() { @@ -175,16 +183,28 @@ class FreedrenoSettingsFragment : Fragment() { private fun setupWindowInsets() { ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets -> - val systemInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()) - binding.root.updatePadding( - left = systemInsets.left, - right = systemInsets.right, - bottom = systemInsets.bottom - ) + val barInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()) + val cutoutInsets = insets.getInsets(WindowInsetsCompat.Type.displayCutout()) + + val leftInsets = barInsets.left + cutoutInsets.left + val rightInsets = barInsets.right + cutoutInsets.right + + binding.appbarFreedreno.updateMargins(left = leftInsets, right = rightInsets) + binding.scrollFreedreno.updateMargins(left = leftInsets, right = rightInsets) + binding.scrollFreedreno.updatePadding(bottom = barInsets.bottom) 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() } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt index 9c43d2c6e1..b459c82719 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameFoldersFragment.kt @@ -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()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt index 7863e40ff5..4c1f641a20 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GameInfoFragment.kt @@ -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()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt index 97b0470feb..6bf40607b5 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/GamePropertiesFragment.kt @@ -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 @@ -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() @@ -310,6 +312,21 @@ class GamePropertiesFragment : Fragment() { ) ) + if (!args.game.isHomebrew) { + add( + SubmenuProperty( + R.string.add_ons, + R.string.add_ons_description, + R.drawable.ic_edit, + action = { + val action = GamePropertiesFragmentDirections + .actionPerGamePropertiesFragmentToAddonsFragment(args.game) + binding.root.findNavController().navigate(action) + } + ) + ) + } + if (GpuDriverHelper.supportsCustomDriverLoading()) { add( SubmenuProperty( @@ -341,18 +358,6 @@ class GamePropertiesFragment : Fragment() { } if (!args.game.isHomebrew) { - add( - SubmenuProperty( - R.string.add_ons, - R.string.add_ons_description, - R.drawable.ic_edit, - action = { - val action = GamePropertiesFragmentDirections - .actionPerGamePropertiesFragmentToAddonsFragment(args.game) - binding.root.findNavController().navigate(action) - } - ) - ) add( InstallableProperty( R.string.save_data, @@ -484,6 +489,7 @@ class GamePropertiesFragment : Fragment() { override fun onResume() { super.onResume() + applyBackgroundPreference() driverViewModel.updateDriverNameForGame(args.game) getPlayTime() reloadList() @@ -708,4 +714,8 @@ class GamePropertiesFragment : Fragment() { ).show() } } + + private fun applyBackgroundPreference() { + BackgroundHelper.applyBackground(binding.backgroundLogo, requireContext()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt index 918478bf85..f186bb9bdd 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt @@ -1,9 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - package org.yuzu.yuzu_emu.fragments import android.Manifest @@ -43,8 +40,11 @@ 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 +import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins class HomeSettingsFragment : Fragment() { private var _binding: FragmentHomeSettingsBinding? = null @@ -71,8 +71,13 @@ class HomeSettingsFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - homeViewModel.setStatusBarShadeVisibility(visible = true) + homeViewModel.setStatusBarShadeVisibility(visible = false) mainActivity = requireActivity() as MainActivity + applyBackgroundPreference() + binding.toolbarHomeSettings.setNavigationOnClickListener { + findNavController().popBackStack() + } + binding.toolbarHomeSettings.title = getString(R.string.preferences_settings) val optionsList: MutableList = mutableListOf().apply { add( @@ -144,6 +149,18 @@ class HomeSettingsFragment : Fragment() { driverViewModel.selectedDriverTitle ) ) + if (GpuDriverHelper.isAdrenoGpu()) { + add( + HomeSetting( + R.string.freedreno_settings_title, + R.string.gpu_driver_settings, + R.drawable.ic_graphics, + { + binding.root.findNavController().navigate(R.id.freedrenoSettingsFragment) + } + ) + ) + } add( HomeSetting( R.string.multiplayer, @@ -300,6 +317,7 @@ class HomeSettingsFragment : Fragment() { override fun onResume() { super.onResume() driverViewModel.updateDriverNameForGame(null) + applyBackgroundPreference() } override fun onDestroyView() { @@ -465,21 +483,28 @@ class HomeSettingsFragment : Fragment() { } private fun setInsets() = - ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view, windowInsets -> + ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, windowInsets -> val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) val cutoutInsets = windowInsets.getInsets(WindowInsetsCompat.Type.displayCutout()) + binding.appbarHomeSettings.updateMargins( + left = barInsets.left + cutoutInsets.left, + right = barInsets.right + cutoutInsets.right + ) + binding.scrollViewSettings.updatePadding( - top = barInsets.top + bottom = barInsets.bottom ) binding.homeSettingsList.updatePadding( left = barInsets.left + cutoutInsets.left, - top = cutoutInsets.top, - right = barInsets.right + cutoutInsets.right, - bottom = barInsets.bottom + right = barInsets.right + cutoutInsets.right ) windowInsets } + + private fun applyBackgroundPreference() { + BackgroundHelper.applyBackground(binding.logoImage, requireContext()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt index 1b94d5f1a6..c605552f3e 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/InstallableFragment.kt @@ -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()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ProfileManagerFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ProfileManagerFragment.kt index 6ee34105e7..dcc2299169 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ProfileManagerFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ProfileManagerFragment.kt @@ -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()) + } } diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt index 6931a1f9d5..5eccb23038 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/GamesFragment.kt @@ -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 diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BackgroundHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BackgroundHelper.kt new file mode 100644 index 0000000000..b15f3ec296 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/BackgroundHelper.kt @@ -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(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 + } + } +} diff --git a/src/android/app/src/main/res/drawable-nodpi/eden_background.webp b/src/android/app/src/main/res/drawable-nodpi/eden_background.webp new file mode 100644 index 0000000000..2af59a8dc4 Binary files /dev/null and b/src/android/app/src/main/res/drawable-nodpi/eden_background.webp differ diff --git a/src/android/app/src/main/res/drawable/item_release_box.xml b/src/android/app/src/main/res/drawable/item_release_box.xml index 2f2ada1961..4e4ec10dcd 100644 --- a/src/android/app/src/main/res/drawable/item_release_box.xml +++ b/src/android/app/src/main/res/drawable/item_release_box.xml @@ -1,7 +1,7 @@ - + @@ -11,4 +11,4 @@ android:top="12dp" android:right="12dp" android:bottom="12dp" /> - \ No newline at end of file + diff --git a/src/android/app/src/main/res/layout-land/fragment_games.xml b/src/android/app/src/main/res/layout-land/fragment_games.xml index da778eab69..0c9ec209d1 100644 --- a/src/android/app/src/main/res/layout-land/fragment_games.xml +++ b/src/android/app/src/main/res/layout-land/fragment_games.xml @@ -8,6 +8,29 @@ android:clipChildren="false" > + + + + @@ -103,7 +131,12 @@ style="@style/EdenCard" android:layout_width="42dp" android:layout_height="42dp" + android:background="@android:color/transparent" app:cardCornerRadius="21dp" + app:cardBackgroundColor="@android:color/transparent" + app:cardElevation="0dp" + app:strokeColor="?attr/colorOutline" + app:strokeWidth="1dp" android:padding="8dp" > @@ -127,7 +160,12 @@ style="@style/EdenCard" android:layout_width="42dp" android:layout_height="42dp" + android:background="@android:color/transparent" app:cardCornerRadius="21dp" + app:cardBackgroundColor="@android:color/transparent" + app:cardElevation="0dp" + app:strokeColor="?attr/colorOutline" + app:strokeWidth="1dp" android:padding="8dp" > @@ -151,7 +189,12 @@ style="@style/EdenCard" android:layout_width="42dp" android:layout_height="42dp" + android:background="@android:color/transparent" app:cardCornerRadius="21dp" + app:cardBackgroundColor="@android:color/transparent" + app:cardElevation="0dp" + app:strokeColor="?attr/colorOutline" + app:strokeWidth="1dp" android:padding="8dp" > @@ -239,4 +282,4 @@ app:rippleColor="#99FFFFFF" /> - \ No newline at end of file + diff --git a/src/android/app/src/main/res/layout-w1000dp/card_installable_icon.xml b/src/android/app/src/main/res/layout-w1000dp/card_installable_icon.xml index 59ee1aad30..6fe4256c49 100644 --- a/src/android/app/src/main/res/layout-w1000dp/card_installable_icon.xml +++ b/src/android/app/src/main/res/layout-w1000dp/card_installable_icon.xml @@ -12,70 +12,83 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" - android:orientation="horizontal" - android:gravity="center_vertical" + android:orientation="vertical" android:paddingHorizontal="24dp" android:paddingVertical="16dp"> - - + android:gravity="center_vertical" + android:orientation="horizontal"> - + - + android:layout_weight="1" + android:orientation="vertical"> + + + + + + -