[android, desktop] Firebomb pre-alpha banner (#195)

Signed-off-by: crueter <swurl@swurl.xyz>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/195
Co-authored-by: crueter <swurl@swurl.xyz>
Co-committed-by: crueter <swurl@swurl.xyz>
This commit is contained in:
crueter 2025-06-17 01:59:05 +00:00 committed by crueter
parent 6aeba9de66
commit 704d4e4428
5 changed files with 8 additions and 133 deletions

View file

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
package org.yuzu.yuzu_emu.features.settings.model
import org.yuzu.yuzu_emu.R
@ -36,7 +35,6 @@ object Settings {
const val PREF_FIRST_APP_LAUNCH = "FirstApplicationLaunch"
const val PREF_SHOULD_SHOW_DRIVER_WARNING = "ShouldShowDriverWarning"
const val PREF_SHOULD_SHOW_PRE_ALPHA_WARNING = "ShouldShowPreAlphaWarning"
const val PREF_SHOULD_SHOW_PRE_ALPHA_BANNER = "ShouldShowPreAlphaBanner"
const val PREF_SHOULD_SHOW_EDENS_VEIL_DIALOG = "ShouldShowEdensVeilDialog"
const val PREF_MEMORY_WARNING_SHOWN = "MemoryWarningShown"
const val SECTION_STATS_OVERLAY = "Stats Overlay"

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
package org.yuzu.yuzu_emu.ui
@ -162,12 +162,6 @@ class GamesFragment : Fragment() {
}
setInsets()
val shouldDisplayPreAlphaBanner =
PreferenceManager.getDefaultSharedPreferences(requireContext())
.getBoolean(Settings.PREF_SHOULD_SHOW_PRE_ALPHA_BANNER, true)
if (shouldDisplayPreAlphaBanner) {
addPreAlphaBanner()
}
}
val applyGridGamesBinding = {
@ -238,86 +232,6 @@ class GamesFragment : Fragment() {
navController.navigate(R.id.action_gamesFragment_to_homeSettingsFragment)
}
private fun addPreAlphaBanner() {
val preAlphaBanner = TextView(requireContext()).apply {
id = "pre_alpha_banner".hashCode()
layoutParams = ConstraintLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
marginStart = resources.getDimensionPixelSize(R.dimen.spacing_med)
marginEnd = resources.getDimensionPixelSize(R.dimen.spacing_med)
topMargin = resources.getDimensionPixelSize(R.dimen.spacing_large)
topToBottom = R.id.frame_search
}
setPadding(
resources.getDimensionPixelSize(R.dimen.spacing_med),
resources.getDimensionPixelSize(R.dimen.spacing_large),
resources.getDimensionPixelSize(R.dimen.spacing_med),
resources.getDimensionPixelSize(R.dimen.spacing_med)
)
setBackgroundColor(
MaterialColors.getColor(
this,
com.google.android.material.R.attr.colorPrimary
)
)
text = getString(R.string.pre_alpha_warning)
setTextAppearance(
com.google.android.material.R.style.TextAppearance_Material3_HeadlineSmall
)
setTextColor(
MaterialColors.getColor(
this,
com.google.android.material.R.attr.colorOnError
)
)
gravity = Gravity.CENTER
}
val closeButton = ImageButton(requireContext()).apply {
id = "pre_alpha_close_button".hashCode()
layoutParams = ConstraintLayout.LayoutParams(
resources.getDimensionPixelSize(R.dimen.spacing_large),
resources.getDimensionPixelSize(R.dimen.spacing_large)
).apply {
startToStart = "pre_alpha_banner".hashCode()
topToTop = "pre_alpha_banner".hashCode()
bottomToBottom = "pre_alpha_banner".hashCode()
marginStart = resources.getDimensionPixelSize(R.dimen.spacing_large) * 2
topMargin = resources.getDimensionPixelSize(R.dimen.spacing_small)
}
setImageResource(android.R.drawable.ic_menu_close_clear_cancel)
setColorFilter(
MaterialColors.getColor(
this,
com.google.android.material.R.attr.colorOnError
)
)
setBackgroundColor(Color.Transparent.toArgb())
setOnClickListener {
PreferenceManager.getDefaultSharedPreferences(requireContext())
.edit() {
putBoolean(Settings.PREF_SHOULD_SHOW_PRE_ALPHA_BANNER, false)
}
binding.root.removeView(preAlphaBanner)
binding.root.removeView(this)
binding.swipeRefresh.updateLayoutParams<ConstraintLayout.LayoutParams> {
topToBottom = R.id.frame_search
}
}
}
binding.root.addView(preAlphaBanner)
binding.root.addView(closeButton)
binding.swipeRefresh.updateLayoutParams<ConstraintLayout.LayoutParams> {
topToBottom = preAlphaBanner.id
}
}
private fun showViewMenu(anchor: View) {
val popup = PopupMenu(requireContext(), anchor)
popup.menuInflater.inflate(R.menu.menu_game_views, popup.menu)