android: Make adjustScale reflect changes without closing the dialog
This commit is contained in:
parent
775a4a8fc2
commit
6438c5e6c3
@ -84,7 +84,7 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
buttonsActionsMap
|
buttonsActionsMap
|
||||||
.append(R.id.menu_emulation_show_overlay, EmulationActivity.MENU_ACTION_SHOW_OVERLAY);
|
.append(R.id.menu_emulation_show_overlay, EmulationActivity.MENU_ACTION_SHOW_OVERLAY);
|
||||||
buttonsActionsMap
|
buttonsActionsMap
|
||||||
.append(R.id.menu_emulation_open_settings,EmulationActivity.MENU_ACTION_OPEN_SETTINGS);
|
.append(R.id.menu_emulation_open_settings, EmulationActivity.MENU_ACTION_OPEN_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private View mDecorView;
|
private View mDecorView;
|
||||||
@ -439,6 +439,7 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
|
setControlScale(seekbar.getProgress());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -448,26 +449,29 @@ public final class EmulationActivity extends AppCompatActivity {
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(R.string.emulation_control_scale);
|
builder.setTitle(R.string.emulation_control_scale);
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
|
final int previousProgress = seekbar.getProgress();
|
||||||
builder.setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> {
|
builder.setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> {
|
||||||
|
setControlScale(previousProgress);
|
||||||
});
|
});
|
||||||
builder.setPositiveButton(android.R.string.ok, (dialogInterface, i) ->
|
builder.setPositiveButton(android.R.string.ok, (dialogInterface, i) ->
|
||||||
{
|
{
|
||||||
SharedPreferences.Editor editor = mPreferences.edit();
|
setControlScale(seekbar.getProgress());
|
||||||
editor.putInt("controlScale", seekbar.getProgress());
|
|
||||||
editor.apply();
|
|
||||||
mEmulationFragment.refreshInputOverlay();
|
|
||||||
});
|
});
|
||||||
builder.setNeutralButton(R.string.slider_default, (dialogInterface, i) -> {
|
builder.setNeutralButton(R.string.slider_default, (dialogInterface, i) -> {
|
||||||
SharedPreferences.Editor editor = mPreferences.edit();
|
setControlScale(50);
|
||||||
editor.putInt("controlScale", 50);
|
|
||||||
editor.apply();
|
|
||||||
mEmulationFragment.refreshInputOverlay();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog alertDialog = builder.create();
|
AlertDialog alertDialog = builder.create();
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setControlScale(int scale) {
|
||||||
|
SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
|
editor.putInt("controlScale", scale);
|
||||||
|
editor.apply();
|
||||||
|
mEmulationFragment.refreshInputOverlay();
|
||||||
|
}
|
||||||
|
|
||||||
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))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user