From 10e85ff40c3fe0090bc951c2c2cedfa18f5caa47 Mon Sep 17 00:00:00 2001 From: Ryan Meredith Date: Tue, 8 Sep 2020 06:14:58 -0400 Subject: [PATCH 1/2] Android: Remove unnecessary getString calls --- .../dolphinemu/activities/EmulationActivity.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 3ffd0e93ec..76a5d7e4c5 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -857,9 +857,9 @@ public final class EmulationActivity extends AppCompatActivity .putBoolean("buttonToggleWii" + indexSelected, isChecked)); } } - builder.setNeutralButton(getString(R.string.emulation_toggle_all), + builder.setNeutralButton(R.string.emulation_toggle_all, (dialogInterface, i) -> mEmulationFragment.toggleInputOverlayVisibility()); - builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> + builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> { editor.apply(); @@ -893,7 +893,7 @@ public final class EmulationActivity extends AppCompatActivity builder.setSingleChoiceItems(buttonList, currentValue, (DialogInterface dialog, int which) -> editor.putInt("doubleTapButton", InputOverlayPointer.DOUBLE_TAP_OPTIONS.get(which))); - builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> + builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> { editor.commit(); mEmulationFragment.initInputPointer(); @@ -938,7 +938,7 @@ public final class EmulationActivity extends AppCompatActivity AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); builder.setTitle(R.string.emulation_control_scale); builder.setView(view); - builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> + builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> { SharedPreferences.Editor editor = mPreferences.edit(); editor.putInt("controlScale", seekbar.getProgress()); @@ -971,7 +971,7 @@ public final class EmulationActivity extends AppCompatActivity NativeLibrary.ReloadWiimoteConfig(); }); - builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> + builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> { editor.apply(); mEmulationFragment.refreshInputOverlay(); @@ -1004,7 +1004,7 @@ public final class EmulationActivity extends AppCompatActivity NativeLibrary.ReloadWiimoteConfig(); }); - builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> editor.apply()); + builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> editor.apply()); AlertDialog alertDialog = builder.create(); alertDialog.show(); @@ -1031,7 +1031,7 @@ public final class EmulationActivity extends AppCompatActivity int orientation = orientationValues[indexSelected]; editor.putInt("emulationActivityOrientation", orientation); }); - builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> + builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> { editor.apply(); updateOrientation(); From 1aacb575de053df7a888ff681cbf6e8a740e1b68 Mon Sep 17 00:00:00 2001 From: Ryan Meredith Date: Tue, 8 Sep 2020 06:20:19 -0400 Subject: [PATCH 2/2] Android: Remove calling create immediately before show --- .../activities/EmulationActivity.java | 19 ++++++------------- .../settings/ui/SettingsActivity.java | 1 - .../dolphinemu/utils/Analytics.java | 1 - .../dolphinemu/utils/PermissionsHandler.java | 1 - 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 76a5d7e4c5..182180ae64 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -866,8 +866,7 @@ public final class EmulationActivity extends AppCompatActivity mEmulationFragment.refreshInputOverlay(); }); - AlertDialog alertDialog = builder.create(); - alertDialog.show(); + builder.show(); } public void chooseDoubleTapButton() @@ -899,8 +898,7 @@ public final class EmulationActivity extends AppCompatActivity mEmulationFragment.initInputPointer(); }); - AlertDialog alertDialog = builder.create(); - alertDialog.show(); + builder.show(); } private void adjustScale() @@ -947,8 +945,7 @@ public final class EmulationActivity extends AppCompatActivity mEmulationFragment.refreshInputOverlay(); }); - AlertDialog alertDialog = builder.create(); - alertDialog.show(); + builder.show(); } private void chooseController() @@ -977,8 +974,7 @@ public final class EmulationActivity extends AppCompatActivity mEmulationFragment.refreshInputOverlay(); }); - AlertDialog alertDialog = builder.create(); - alertDialog.show(); + builder.show(); } private void showMotionControlsOptions() @@ -1006,8 +1002,7 @@ public final class EmulationActivity extends AppCompatActivity }); builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> editor.apply()); - AlertDialog alertDialog = builder.create(); - alertDialog.show(); + builder.show(); } private void chooseOrientation() @@ -1037,8 +1032,7 @@ public final class EmulationActivity extends AppCompatActivity updateOrientation(); }); - AlertDialog alertDialog = builder.create(); - alertDialog.show(); + builder.show(); } private void setIRSensitivity() @@ -1180,7 +1174,6 @@ public final class EmulationActivity extends AppCompatActivity .setNegativeButton(R.string.cancel, (dialogInterface, i) -> { }) - .create() .show(); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java index 8dbc4b46b7..12e585540a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsActivity.java @@ -186,7 +186,6 @@ public final class SettingsActivity extends AppCompatActivity implements Setting .setMessage(getString(R.string.game_ini_junk_question)) .setPositiveButton(R.string.yes, (dialogInterface, i) -> mPresenter.clearSettings()) .setNegativeButton(R.string.no, null) - .create() .show(); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Analytics.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Analytics.java index f9ff6e535b..65f1df9edf 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Analytics.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Analytics.java @@ -59,7 +59,6 @@ public class Analytics sPrefsEditor.apply(); SettingsFile.firstAnalyticsAdd(false); }) - .create() .show(); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PermissionsHandler.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PermissionsHandler.java index a8b0bf63a9..f1cc444f94 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PermissionsHandler.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PermissionsHandler.java @@ -68,7 +68,6 @@ public class PermissionsHandler .setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> Toast.makeText(activity, R.string.write_permission_needed, Toast.LENGTH_SHORT) .show()) - .create() .show(); } }