From aa8df317af7ae48a1ca2ea8aa98ad63ca34ed4a8 Mon Sep 17 00:00:00 2001 From: hank121314 Date: Mon, 13 Mar 2023 13:46:38 +0800 Subject: [PATCH] citra_android: fix DiskShaderCacheProgress crash (#6346) --- .../disk_shader_cache/DiskShaderCacheProgress.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/android/app/src/main/java/org/citra/citra_emu/disk_shader_cache/DiskShaderCacheProgress.java b/src/android/app/src/main/java/org/citra/citra_emu/disk_shader_cache/DiskShaderCacheProgress.java index 1e3111739..ceaacc12a 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/disk_shader_cache/DiskShaderCacheProgress.java +++ b/src/android/app/src/main/java/org/citra/citra_emu/disk_shader_cache/DiskShaderCacheProgress.java @@ -6,7 +6,6 @@ package org.citra.citra_emu.disk_shader_cache; import android.app.Activity; import android.app.Dialog; -import android.content.DialogInterface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -56,10 +55,10 @@ public class DiskShaderCacheProgress { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - final Activity emulationActivity = Objects.requireNonNull(getActivity()); + final Activity emulationActivity = requireActivity(); - final String title = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("title")); - final String message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message")); + final String title = Objects.requireNonNull(requireArguments().getString("title")); + final String message = Objects.requireNonNull(requireArguments().getString("message")); LayoutInflater inflater = LayoutInflater.from(emulationActivity); View view = inflater.inflate(R.layout.dialog_progress_bar, null); @@ -75,15 +74,17 @@ public class DiskShaderCacheProgress { finishLock.notifyAll(); } - return new MaterialAlertDialogBuilder(emulationActivity) + dialog = new MaterialAlertDialogBuilder(emulationActivity) + .setView(view) .setTitle(title) .setMessage(message) .setNegativeButton(android.R.string.cancel, (dialog, which) -> emulationActivity.onBackPressed()) .create(); + return dialog; } private void onUpdateProgress(String msg, int progress, int max) { - Objects.requireNonNull(getActivity()).runOnUiThread(() -> { + requireActivity().runOnUiThread(() -> { progressBar.setProgress(progress); progressBar.setMax(max); progressText.setText(String.format("%d/%d", progress, max));