|
|
|
@ -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) |
|
|
|
|