android: frontend: Use android builtin ok/yes/no/cancel strings where possible.

This commit is contained in:
bunnei 2019-08-30 18:25:41 -04:00 committed by xperia64
parent 339193597a
commit 8fddac5da8
4 changed files with 15 additions and 28 deletions

View File

@ -307,7 +307,7 @@ public final class NativeLibrary {
if (!yesNo) { if (!yesNo) {
builder builder
.setCancelable(false) .setCancelable(false)
.setPositiveButton("OK", (dialog, whichButton) -> .setPositiveButton(android.R.string.ok, (dialog, whichButton) ->
{ {
dialog.dismiss(); dialog.dismiss();
synchronized (lock) { synchronized (lock) {
@ -318,7 +318,7 @@ public final class NativeLibrary {
alertResult = false; alertResult = false;
builder builder
.setPositiveButton("Yes", (dialog, whichButton) -> .setPositiveButton(android.R.string.yes, (dialog, whichButton) ->
{ {
alertResult = true; alertResult = true;
dialog.dismiss(); dialog.dismiss();
@ -326,7 +326,7 @@ public final class NativeLibrary {
lock.notify(); lock.notify();
} }
}) })
.setNegativeButton("No", (dialog, whichButton) -> .setNegativeButton(android.R.string.no, (dialog, whichButton) ->
{ {
alertResult = false; alertResult = false;
dialog.dismiss(); dialog.dismiss();

View File

@ -252,12 +252,12 @@ public final class EmulationActivity extends AppCompatActivity {
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setTitle(R.string.emulation_close_game) .setTitle(R.string.emulation_close_game)
.setMessage(R.string.emulation_close_game_message) .setMessage(R.string.emulation_close_game_message)
.setPositiveButton(R.string.yes, (dialogInterface, i) -> .setPositiveButton(android.R.string.yes, (dialogInterface, i) ->
{ {
mEmulationFragment.stopEmulation(); mEmulationFragment.stopEmulation();
exitWithAnimation(); exitWithAnimation();
}) })
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> .setNegativeButton(android.R.string.cancel, (dialogInterface, i) ->
{ {
}).setOnDismissListener(dialogInterface -> }).setOnDismissListener(dialogInterface ->
{ {
@ -507,7 +507,7 @@ public final class EmulationActivity extends AppCompatActivity {
(dialog, indexSelected, isChecked) -> editor (dialog, indexSelected, isChecked) -> editor
.putBoolean("buttonToggle" + indexSelected, isChecked)); .putBoolean("buttonToggle" + indexSelected, isChecked));
builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> builder.setPositiveButton(android.R.string.ok, (dialogInterface, i) ->
{ {
editor.apply(); editor.apply();
@ -529,17 +529,13 @@ public final class EmulationActivity extends AppCompatActivity {
seekbar.setMax(150); seekbar.setMax(150);
seekbar.setProgress(mPreferences.getInt("controlScale", 50)); seekbar.setProgress(mPreferences.getInt("controlScale", 50));
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onStartTrackingTouch(SeekBar seekBar) { public void onStartTrackingTouch(SeekBar seekBar) { }
// Do nothing
}
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
value.setText(String.valueOf(progress + 50)); value.setText(String.valueOf(progress + 50));
} }
public void onStopTrackingTouch(SeekBar seekBar) { public void onStopTrackingTouch(SeekBar seekBar) { }
// Do nothing
}
}); });
value.setText(String.valueOf(seekbar.getProgress() + 50)); value.setText(String.valueOf(seekbar.getProgress() + 50));
@ -570,13 +566,8 @@ public final class EmulationActivity extends AppCompatActivity {
private void resetOverlay() { private void resetOverlay() {
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setTitle(getString(R.string.emulation_touch_overlay_reset)) .setTitle(getString(R.string.emulation_touch_overlay_reset))
.setPositiveButton(R.string.yes, (dialogInterface, i) -> .setPositiveButton(android.R.string.yes, (dialogInterface, i) -> mEmulationFragment.resetInputOverlay())
{ .setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> { })
mEmulationFragment.resetInputOverlay();
})
.setNegativeButton(R.string.cancel, (dialogInterface, i) ->
{
})
.create() .create()
.show(); .show();
} }

View File

@ -205,8 +205,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
}; };
builder.setView(view); builder.setView(view);
builder.setPositiveButton(R.string.ok, ok); builder.setPositiveButton(android.R.string.ok, ok);
builder.setNegativeButton(R.string.cancel, defaultCancelListener); builder.setNegativeButton(android.R.string.cancel, defaultCancelListener);
mDialog = builder.show(); mDialog = builder.show();
} }
@ -223,8 +223,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
builder.setTitle(item.getNameId()); builder.setTitle(item.getNameId());
builder.setView(view); builder.setView(view);
builder.setPositiveButton(R.string.ok, this); builder.setPositiveButton(android.R.string.ok, this);
builder.setNegativeButton(R.string.cancel, defaultCancelListener); builder.setNegativeButton(android.R.string.cancel, defaultCancelListener);
builder.setNeutralButton(R.string.slider_default, (DialogInterface dialog, int which) -> { builder.setNeutralButton(R.string.slider_default, (DialogInterface dialog, int which) -> {
seekbar.setProgress(item.getDefaultValue()); seekbar.setProgress(item.getDefaultValue());
onClick(dialog, which); onClick(dialog, which);
@ -262,7 +262,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
} }
dialog.setMessage(String.format(mContext.getString(messageResId), mContext.getString(item.getNameId()))); dialog.setMessage(String.format(mContext.getString(messageResId), mContext.getString(item.getNameId())));
dialog.setButton(AlertDialog.BUTTON_NEGATIVE, mContext.getString(R.string.cancel), this); dialog.setButton(AlertDialog.BUTTON_NEGATIVE, mContext.getString(android.R.string.cancel), this);
dialog.setButton(AlertDialog.BUTTON_NEUTRAL, mContext.getString(R.string.clear), (dialogInterface, i) -> dialog.setButton(AlertDialog.BUTTON_NEUTRAL, mContext.getString(R.string.clear), (dialogInterface, i) ->
{ {
item.removeOldMapping(); item.removeOldMapping();

View File

@ -75,10 +75,6 @@
<string name="audio_stretch_description">Stretches audio to reduce stuttering. When enabled, increases audio latency and slightly reduces performance.</string> <string name="audio_stretch_description">Stretches audio to reduce stuttering. When enabled, increases audio latency and slightly reduces performance.</string>
<!-- Miscellaneous --> <!-- Miscellaneous -->
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="clear">Clear</string> <string name="clear">Clear</string>
<string name="disabled">Disabled</string> <string name="disabled">Disabled</string>
<string name="other">Other</string> <string name="other">Other</string>