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
parent ad4fdc814e
commit 781913f230
4 changed files with 15 additions and 28 deletions

View File

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

View File

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

View File

@ -205,8 +205,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
};
builder.setView(view);
builder.setPositiveButton(R.string.ok, ok);
builder.setNegativeButton(R.string.cancel, defaultCancelListener);
builder.setPositiveButton(android.R.string.ok, ok);
builder.setNegativeButton(android.R.string.cancel, defaultCancelListener);
mDialog = builder.show();
}
@ -223,8 +223,8 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
builder.setTitle(item.getNameId());
builder.setView(view);
builder.setPositiveButton(R.string.ok, this);
builder.setNegativeButton(R.string.cancel, defaultCancelListener);
builder.setPositiveButton(android.R.string.ok, this);
builder.setNegativeButton(android.R.string.cancel, defaultCancelListener);
builder.setNeutralButton(R.string.slider_default, (DialogInterface dialog, int which) -> {
seekbar.setProgress(item.getDefaultValue());
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.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) ->
{
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>
<!-- 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="disabled">Disabled</string>
<string name="other">Other</string>