all dialog popups now use M3 styles

This commit is contained in:
izzy2lost
2025-08-25 07:58:09 -04:00
parent 5c2b3c9786
commit 26151a6259
5 changed files with 31 additions and 14 deletions
@@ -15,7 +15,8 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
// Use Material 3 dialog builder for pergame settings dialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.fragment.app.DialogFragment;
public class GameSettingsDialogFragment extends DialogFragment {
@@ -181,7 +182,9 @@ public class GameSettingsDialogFragment extends DialogFragment {
spResolution.setSelection(0);
}
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
// Use MaterialAlertDialogBuilder with Material 3 overlay for the main dialog
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ctx,
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog);
builder.setTitle("Per-Game Settings")
.setView(view)
.setNegativeButton("Cancel", (d, w) -> d.dismiss())
@@ -211,7 +214,8 @@ public class GameSettingsDialogFragment extends DialogFragment {
if (btnImport != null) {
btnImport.setOnClickListener(v -> {
final String[] choices = new String[]{"Import as Cheats", "Import as Patch Codes"};
new AlertDialog.Builder(ctx)
new MaterialAlertDialogBuilder(ctx,
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog)
.setTitle("Import PNACH")
.setItems(choices, (dlg, which) -> {
boolean asCheats = (which == 0);
@@ -18,6 +18,8 @@ import android.view.WindowInsetsController;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
// Import MaterialAlertDialogBuilder for Material 3 styling
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.fragment.app.DialogFragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -150,7 +152,8 @@ public class GamesCoverDialogFragment extends DialogFragment {
View btnDownload = root.findViewById(R.id.btn_download);
if (btnDownload != null) btnDownload.setOnClickListener(v -> startDownloadCovers());
AlertDialog dialog = new AlertDialog.Builder(requireContext())
AlertDialog dialog = new MaterialAlertDialogBuilder(requireContext(),
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog)
.setView(root)
.create();
return dialog;
@@ -1,7 +1,8 @@
package com.izzy2lost.psx2;
import android.app.Activity;
import android.app.AlertDialog;
// Use MaterialAlertDialogBuilder to adopt Material 3 styling for all dialogs.
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
@@ -242,7 +243,8 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF
final String[] urisFinal = uris;
if (namesFinal.length == 0) {
new AlertDialog.Builder(this)
new MaterialAlertDialogBuilder(this,
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog)
.setTitle("GAMES")
.setMessage("No games found. Pick a folder?")
.setNegativeButton("Cancel", null)
@@ -1324,7 +1326,8 @@ public class MainActivity extends AppCompatActivity implements GamesCoverDialogF
}
private void showExitDialog() {
new AlertDialog.Builder(this)
new MaterialAlertDialogBuilder(this,
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog)
.setTitle("Exit App")
.setMessage("Do you want to exit PSX2?")
.setIcon(android.R.drawable.ic_dialog_alert)
@@ -13,7 +13,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
// Import MaterialAlertDialogBuilder for Material 3 dialogs
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.fragment.app.DialogFragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -126,7 +127,8 @@ public class SavesDialogFragment extends DialogFragment {
Bitmap bitmap = BitmapFactory.decodeByteArray(screenshotData, 0, screenshotData.length);
// Create enlarged screenshot dialog
AlertDialog.Builder builder = new AlertDialog.Builder(context);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context,
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog);
View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_screenshot_preview, null);
ImageView enlargedImageView = dialogView.findViewById(R.id.iv_enlarged_screenshot);
@@ -195,7 +197,8 @@ public class SavesDialogFragment extends DialogFragment {
recyclerView.setAdapter(adapter);
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(ctx,
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog);
builder.setTitle("Save States")
.setView(view)
.setNegativeButton("Cancel", (d, w) -> d.dismiss());
@@ -15,7 +15,8 @@ import android.content.res.ColorStateList;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
// Use MaterialAlertDialogBuilder for Material 3 dialogs.
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.fragment.app.DialogFragment;
import androidx.core.widget.CompoundButtonCompat;
import androidx.core.content.ContextCompat;
@@ -138,7 +139,8 @@ public class SettingsDialogFragment extends DialogFragment {
if (btnPower != null) {
btnPower.setOnClickListener(v -> {
new AlertDialog.Builder(requireContext())
new MaterialAlertDialogBuilder(requireContext(),
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog)
.setTitle("Power Off")
.setMessage("Quit the app?")
.setNegativeButton("Cancel", null)
@@ -161,7 +163,8 @@ public class SettingsDialogFragment extends DialogFragment {
if (btnReboot != null) {
btnReboot.setOnClickListener(v -> {
new AlertDialog.Builder(requireContext())
new MaterialAlertDialogBuilder(requireContext(),
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog)
.setTitle("Reboot")
.setMessage("Restart the current game?")
.setNegativeButton("Cancel", null)
@@ -229,7 +232,8 @@ public class SettingsDialogFragment extends DialogFragment {
swAsyncTextureLoading.setChecked(savedAsyncTextureLoading);
if (swDevHud != null) swDevHud.setChecked(savedHud);
AlertDialog.Builder b = new AlertDialog.Builder(requireContext());
MaterialAlertDialogBuilder b = new MaterialAlertDialogBuilder(requireContext(),
com.google.android.material.R.style.ThemeOverlay_Material3_MaterialAlertDialog);
b.setTitle("Graphics Settings")
.setView(view)
.setNegativeButton("Cancel", (d, w) -> d.dismiss())