Android: Use the newly added style for all dialogs

For consistency, and in case I missed any cases where not specifing
a theme could lead to a crash on Android TV.
This commit is contained in:
JosJuice 2020-04-02 15:02:41 +02:00
parent ff0c36b21a
commit 163b176bab
7 changed files with 22 additions and 17 deletions

View File

@ -463,7 +463,8 @@ public final class NativeLibrary
{ {
// Create object used for waiting. // Create object used for waiting.
final Object lock = new Object(); final Object lock = new Object();
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity) AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity,
R.style.DolphinDialogBase)
.setTitle(caption) .setTitle(caption)
.setMessage(text); .setMessage(text);

View File

@ -738,7 +738,7 @@ public final class EmulationActivity extends AppCompatActivity
{ {
final SharedPreferences.Editor editor = mPreferences.edit(); final SharedPreferences.Editor editor = mPreferences.edit();
boolean[] enabledButtons = new boolean[14]; boolean[] enabledButtons = new boolean[14];
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
builder.setTitle(R.string.emulation_toggle_controls); builder.setTitle(R.string.emulation_toggle_controls);
if (sIsGameCubeGame || mPreferences.getInt("wiiController", 3) == 0) if (sIsGameCubeGame || mPreferences.getInt("wiiController", 3) == 0)
{ {
@ -795,7 +795,7 @@ public final class EmulationActivity extends AppCompatActivity
public void chooseDoubleTapButton() public void chooseDoubleTapButton()
{ {
final SharedPreferences.Editor editor = mPreferences.edit(); final SharedPreferences.Editor editor = mPreferences.edit();
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
int currentController = int currentController =
mPreferences.getInt("wiiController", InputOverlay.OVERLAY_WIIMOTE_NUNCHUCK); mPreferences.getInt("wiiController", InputOverlay.OVERLAY_WIIMOTE_NUNCHUCK);
@ -857,7 +857,7 @@ public final class EmulationActivity extends AppCompatActivity
value.setText(String.valueOf(seekbar.getProgress() + 50)); value.setText(String.valueOf(seekbar.getProgress() + 50));
units.setText("%"); units.setText("%");
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
builder.setTitle(R.string.emulation_control_scale); builder.setTitle(R.string.emulation_control_scale);
builder.setView(view); builder.setView(view);
builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) ->
@ -876,7 +876,7 @@ public final class EmulationActivity extends AppCompatActivity
private void chooseController() private void chooseController()
{ {
final SharedPreferences.Editor editor = mPreferences.edit(); final SharedPreferences.Editor editor = mPreferences.edit();
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
builder.setTitle(R.string.emulation_choose_controller); builder.setTitle(R.string.emulation_choose_controller);
builder.setSingleChoiceItems(R.array.controllersEntries, builder.setSingleChoiceItems(R.array.controllersEntries,
mPreferences.getInt("wiiController", 3), mPreferences.getInt("wiiController", 3),
@ -902,7 +902,7 @@ public final class EmulationActivity extends AppCompatActivity
private void showMotionControlsOptions() private void showMotionControlsOptions()
{ {
final SharedPreferences.Editor editor = mPreferences.edit(); final SharedPreferences.Editor editor = mPreferences.edit();
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
builder.setTitle(R.string.emulation_motion_controls); builder.setTitle(R.string.emulation_motion_controls);
builder.setSingleChoiceItems(R.array.motionControlsEntries, builder.setSingleChoiceItems(R.array.motionControlsEntries,
mPreferences.getInt("motionControlsEnabled", 0), mPreferences.getInt("motionControlsEnabled", 0),
@ -938,7 +938,7 @@ public final class EmulationActivity extends AppCompatActivity
} }
final SharedPreferences.Editor editor = mPreferences.edit(); final SharedPreferences.Editor editor = mPreferences.edit();
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
builder.setTitle(R.string.emulation_screen_orientation); builder.setTitle(R.string.emulation_screen_orientation);
builder.setSingleChoiceItems(R.array.orientationEntries, initialIndex, builder.setSingleChoiceItems(R.array.orientationEntries, initialIndex,
(dialog, indexSelected) -> (dialog, indexSelected) ->
@ -1055,7 +1055,7 @@ public final class EmulationActivity extends AppCompatActivity
} }
}); });
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
builder.setTitle(getString(R.string.emulation_ir_sensitivity)); builder.setTitle(getString(R.string.emulation_ir_sensitivity));
builder.setView(view); builder.setView(view);
builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> builder.setPositiveButton(R.string.ok, (dialogInterface, i) ->
@ -1090,7 +1090,7 @@ public final class EmulationActivity extends AppCompatActivity
private void resetOverlay() private void resetOverlay()
{ {
new AlertDialog.Builder(this) new AlertDialog.Builder(this, R.style.DolphinDialogBase)
.setTitle(getString(R.string.emulation_touch_overlay_reset)) .setTitle(getString(R.string.emulation_touch_overlay_reset))
.setPositiveButton(R.string.yes, (dialogInterface, i) -> .setPositiveButton(R.string.yes, (dialogInterface, i) ->
{ {

View File

@ -137,7 +137,7 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
if (gameId.isEmpty()) if (gameId.isEmpty())
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(activity); AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.DolphinDialogBase);
builder.setTitle("Game Settings"); builder.setTitle("Game Settings");
builder.setMessage("Files without game IDs don't support game-specific settings."); builder.setMessage("Files without game IDs don't support game-specific settings.");

View File

@ -218,7 +218,7 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
@Override @Override
public void showGameIniJunkDeletionQuestion() public void showGameIniJunkDeletionQuestion()
{ {
new AlertDialog.Builder(this) new AlertDialog.Builder(this, R.style.DolphinDialogBase)
.setTitle(getString(R.string.game_ini_junk_title)) .setTitle(getString(R.string.game_ini_junk_title))
.setMessage(getString(R.string.game_ini_junk_question)) .setMessage(getString(R.string.game_ini_junk_question))
.setPositiveButton(R.string.yes, (dialogInterface, i) -> mPresenter.clearSettings()) .setPositiveButton(R.string.yes, (dialogInterface, i) -> mPresenter.clearSettings())

View File

@ -192,7 +192,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
int value = getSelectionForSingleChoiceValue(item); int value = getSelectionForSingleChoiceValue(item);
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(),
R.style.DolphinDialogBase);
builder.setTitle(item.getNameId()); builder.setTitle(item.getNameId());
builder.setSingleChoiceItems(item.getChoicesId(), value, this); builder.setSingleChoiceItems(item.getChoicesId(), value, this);
@ -205,7 +206,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
mClickedItem = item; mClickedItem = item;
mClickedPosition = position; mClickedPosition = position;
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(),
R.style.DolphinDialogBase);
builder.setTitle(item.getNameId()); builder.setTitle(item.getNameId());
builder.setSingleChoiceItems(item.getChoicesId(), item.getSelectValueIndex(), this); builder.setSingleChoiceItems(item.getChoicesId(), item.getSelectValueIndex(), this);
@ -221,7 +223,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
int value = getSelectionForSingleChoiceDynamicDescriptionsValue(item); int value = getSelectionForSingleChoiceDynamicDescriptionsValue(item);
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(),
R.style.DolphinDialogBase);
builder.setTitle(item.getNameId()); builder.setTitle(item.getNameId());
builder.setSingleChoiceItems(item.getChoicesId(), value, this); builder.setSingleChoiceItems(item.getChoicesId(), value, this);
@ -234,7 +237,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
mClickedItem = item; mClickedItem = item;
mClickedPosition = position; mClickedPosition = position;
mSeekbarProgress = item.getSelectedValue(); mSeekbarProgress = item.getSelectedValue();
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(),
R.style.DolphinDialogBase);
LayoutInflater inflater = LayoutInflater.from(mView.getActivity()); LayoutInflater inflater = LayoutInflater.from(mView.getActivity());
View view = inflater.inflate(R.layout.dialog_seekbar, null); View view = inflater.inflate(R.layout.dialog_seekbar, null);

View File

@ -58,7 +58,7 @@ public final class ConfirmRunnableViewHolder extends SettingViewHolder
String alertTitle = mContext.getString(mItem.getNameId()); String alertTitle = mContext.getString(mItem.getNameId());
String alertText = mContext.getString(mItem.getAlertText()); String alertText = mContext.getString(mItem.getAlertText());
AlertDialog.Builder builder = new AlertDialog.Builder(mContext) AlertDialog.Builder builder = new AlertDialog.Builder(mContext, R.style.DolphinDialogBase)
.setTitle(alertTitle) .setTitle(alertTitle)
.setMessage(alertText); .setMessage(alertText);

View File

@ -62,7 +62,7 @@ public class PermissionsHandler
private static void showMessageOKCancel(final FragmentActivity activity, String message, private static void showMessageOKCancel(final FragmentActivity activity, String message,
DialogInterface.OnClickListener okListener) DialogInterface.OnClickListener okListener)
{ {
new AlertDialog.Builder(activity) new AlertDialog.Builder(activity, R.style.DolphinDialogBase)
.setMessage(message) .setMessage(message)
.setPositiveButton(android.R.string.ok, okListener) .setPositiveButton(android.R.string.ok, okListener)
.setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> .setNegativeButton(android.R.string.cancel, (dialogInterface, i) ->