From 26c8440ae10b19838a83da4c5e09a6489c5b915c Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Mon, 30 Jan 2023 13:17:02 -0500 Subject: [PATCH] Android: Set each slider step size manually --- .../model/view/FloatSliderSetting.java | 4 ++-- .../settings/model/view/IntSliderSetting.java | 4 ++-- .../model/view/PercentSliderSetting.java | 4 ++-- .../settings/model/view/SliderSetting.java | 9 ++++++- .../features/settings/ui/SettingsAdapter.java | 12 +--------- .../ui/SettingsFragmentPresenter.java | 24 ++++++++++--------- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.java index f7dfd51745..167c5a471b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FloatSliderSetting.java @@ -13,9 +13,9 @@ public class FloatSliderSetting extends SliderSetting protected AbstractFloatSetting mSetting; public FloatSliderSetting(Context context, AbstractFloatSetting setting, int titleId, - int descriptionId, int min, int max, String units) + int descriptionId, int min, int max, String units, int stepSize) { - super(context, titleId, descriptionId, min, max, units); + super(context, titleId, descriptionId, min, max, units, stepSize); mSetting = setting; } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.java index 8bcfed7967..b7268dfc7e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/IntSliderSetting.java @@ -13,9 +13,9 @@ public final class IntSliderSetting extends SliderSetting private AbstractIntSetting mSetting; public IntSliderSetting(Context context, AbstractIntSetting setting, int titleId, - int descriptionId, int min, int max, String units) + int descriptionId, int min, int max, String units, int stepSize) { - super(context, titleId, descriptionId, min, max, units); + super(context, titleId, descriptionId, min, max, units, stepSize); mSetting = setting; } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.java index d238a15162..7d79f5a888 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/PercentSliderSetting.java @@ -11,9 +11,9 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings; public final class PercentSliderSetting extends FloatSliderSetting { public PercentSliderSetting(Context context, AbstractFloatSetting setting, int titleId, - int descriptionId, int min, int max, String units) + int descriptionId, int min, int max, String units, int stepSize) { - super(context, setting, titleId, descriptionId, min, max, units); + super(context, setting, titleId, descriptionId, min, max, units, stepSize); } @Override diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.java index 6a01e5c277..48961839c0 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SliderSetting.java @@ -11,14 +11,16 @@ public abstract class SliderSetting extends SettingsItem private int mMin; private int mMax; private String mUnits; + private int mStepSize; public SliderSetting(Context context, int nameId, int descriptionId, int min, int max, - String units) + String units, int stepSize) { super(context, nameId, descriptionId); mMin = min; mMax = max; mUnits = units; + mStepSize = stepSize; } public abstract int getSelectedValue(Settings settings); @@ -38,6 +40,11 @@ public abstract class SliderSetting extends SettingsItem return mUnits; } + public int getStepSize() + { + return mStepSize; + } + @Override public int getType() { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java index 4fd9313237..a042e7aaaf 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java @@ -298,17 +298,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter sl) @@ -621,9 +621,9 @@ public final class SettingsFragmentPresenter sl.add(new SwitchSetting(mContext, BooleanSetting.SYSCONF_WIIMOTE_MOTOR, R.string.wiimote_rumble, 0)); sl.add(new IntSliderSetting(mContext, IntSetting.SYSCONF_SPEAKER_VOLUME, - R.string.wiimote_volume, 0, 0, 127, "")); + R.string.wiimote_volume, 0, 0, 127, "", 1)); sl.add(new IntSliderSetting(mContext, IntSetting.SYSCONF_SENSOR_BAR_SENSITIVITY, - R.string.sensor_bar_sensitivity, 0, 1, 5, "")); + R.string.sensor_bar_sensitivity, 0, 1, 5, "", 1)); sl.add(new SingleChoiceSetting(mContext, IntSetting.SYSCONF_SENSOR_BAR_POSITION, R.string.sensor_bar_position, 0, R.array.sensorBarPositionEntries, R.array.sensorBarPositionValues)); @@ -735,7 +735,7 @@ public final class SettingsFragmentPresenter sl.add(new SwitchSetting(mContext, BooleanSetting.MAIN_OVERCLOCK_ENABLE, R.string.overclock_enable, R.string.overclock_enable_description)); sl.add(new PercentSliderSetting(mContext, FloatSetting.MAIN_OVERCLOCK, R.string.overclock_title, - R.string.overclock_title_description, 0, 400, "%")); + R.string.overclock_title_description, 0, 400, "%", 1)); AbstractIntSetting mem1Setting = new AbstractIntSetting() { @@ -805,8 +805,10 @@ public final class SettingsFragmentPresenter sl.add(new SwitchSetting(mContext, BooleanSetting.MAIN_RAM_OVERRIDE_ENABLE, R.string.enable_memory_size_override, R.string.enable_memory_size_override_description)); - sl.add(new IntSliderSetting(mContext, mem1Setting, R.string.main_mem1_size, 0, 24, 64, "MB")); - sl.add(new IntSliderSetting(mContext, mem2Setting, R.string.main_mem2_size, 0, 64, 128, "MB")); + sl.add(new IntSliderSetting(mContext, mem1Setting, R.string.main_mem1_size, 0, 24, 64, "MB", + 1)); + sl.add(new IntSliderSetting(mContext, mem2Setting, R.string.main_mem2_size, 0, 64, 128, "MB", + 1)); sl.add(new HeaderSetting(mContext, R.string.gpu_options, 0)); sl.add(new SingleChoiceSetting(mContext, synchronizeGpuThread, R.string.synchronize_gpu_thread, @@ -1030,7 +1032,7 @@ public final class SettingsFragmentPresenter R.string.log_render_time_to_file_description)); sl.add(new IntSliderSetting(mContext, IntSetting.GFX_PERF_SAMP_WINDOW, R.string.performance_sample_window, R.string.performance_sample_window_description, 0, - 10000, "ms")); + 10000, "ms", 100)); } private void addAdvancedGraphicsSettings(ArrayList sl) @@ -1070,7 +1072,7 @@ public final class SettingsFragmentPresenter sl.add(new SwitchSetting(mContext, BooleanSetting.GFX_INTERNAL_RESOLUTION_FRAME_DUMPS, R.string.internal_resolution_dumps, R.string.internal_resolution_dumps_description)); sl.add(new IntSliderSetting(mContext, IntSetting.GFX_PNG_COMPRESSION_LEVEL, - R.string.png_compression_level, 0, 0, 9, "")); + R.string.png_compression_level, 0, 0, 9, "", 1)); sl.add(new HeaderSetting(mContext, R.string.debugging, 0)); sl.add(new SwitchSetting(mContext, BooleanSetting.GFX_ENABLE_WIREFRAME, @@ -1143,10 +1145,10 @@ public final class SettingsFragmentPresenter sl.add(new SingleChoiceSetting(mContext, IntSetting.GFX_STEREO_MODE, R.string.stereoscopy_mode, 0, R.array.stereoscopyEntries, R.array.stereoscopyValues)); sl.add(new IntSliderSetting(mContext, IntSetting.GFX_STEREO_DEPTH, R.string.stereoscopy_depth, - R.string.stereoscopy_depth_description, 0, 100, "%")); + R.string.stereoscopy_depth_description, 0, 100, "%", 1)); sl.add(new IntSliderSetting(mContext, IntSetting.GFX_STEREO_CONVERGENCE_PERCENTAGE, R.string.stereoscopy_convergence, R.string.stereoscopy_convergence_description, 0, 200, - "%")); + "%", 1)); sl.add(new SwitchSetting(mContext, BooleanSetting.GFX_STEREO_SWAP_EYES, R.string.stereoscopy_swap_eyes, R.string.stereoscopy_swap_eyes_description)); }