Android: Don't assume SliderSetting minimum is 0
This commit is contained in:
parent
a7b9e6857b
commit
fb2e633e1e
|
@ -8,10 +8,10 @@ public class FloatSliderSetting extends SliderSetting
|
||||||
{
|
{
|
||||||
protected AbstractFloatSetting mSetting;
|
protected AbstractFloatSetting mSetting;
|
||||||
|
|
||||||
public FloatSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int max,
|
public FloatSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int min,
|
||||||
String units)
|
int max, String units)
|
||||||
{
|
{
|
||||||
super(titleId, descriptionId, max, units);
|
super(titleId, descriptionId, min, max, units);
|
||||||
mSetting = setting;
|
mSetting = setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ public final class IntSliderSetting extends SliderSetting
|
||||||
{
|
{
|
||||||
private AbstractIntSetting mSetting;
|
private AbstractIntSetting mSetting;
|
||||||
|
|
||||||
public IntSliderSetting(AbstractIntSetting setting, int titleId, int descriptionId, int max,
|
public IntSliderSetting(AbstractIntSetting setting, int titleId, int descriptionId, int min,
|
||||||
String units)
|
int max, String units)
|
||||||
{
|
{
|
||||||
super(titleId, descriptionId, max, units);
|
super(titleId, descriptionId, min, max, units);
|
||||||
mSetting = setting;
|
mSetting = setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||||
|
|
||||||
public final class PercentSliderSetting extends FloatSliderSetting
|
public final class PercentSliderSetting extends FloatSliderSetting
|
||||||
{
|
{
|
||||||
public PercentSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int max,
|
public PercentSliderSetting(AbstractFloatSetting setting, int titleId, int descriptionId, int min,
|
||||||
String units)
|
int max, String units)
|
||||||
{
|
{
|
||||||
super(setting, titleId, descriptionId, max, units);
|
super(setting, titleId, descriptionId, min, max, units);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,18 +4,25 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings;
|
||||||
|
|
||||||
public abstract class SliderSetting extends SettingsItem
|
public abstract class SliderSetting extends SettingsItem
|
||||||
{
|
{
|
||||||
|
private int mMin;
|
||||||
private int mMax;
|
private int mMax;
|
||||||
private String mUnits;
|
private String mUnits;
|
||||||
|
|
||||||
public SliderSetting(int nameId, int descriptionId, int max, String units)
|
public SliderSetting(int nameId, int descriptionId, int min, int max, String units)
|
||||||
{
|
{
|
||||||
super(nameId, descriptionId);
|
super(nameId, descriptionId);
|
||||||
|
mMin = min;
|
||||||
mMax = max;
|
mMax = max;
|
||||||
mUnits = units;
|
mUnits = units;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract int getSelectedValue(Settings settings);
|
public abstract int getSelectedValue(Settings settings);
|
||||||
|
|
||||||
|
public int getMin()
|
||||||
|
{
|
||||||
|
return mMin;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMax()
|
public int getMax()
|
||||||
{
|
{
|
||||||
return mMax;
|
return mMax;
|
||||||
|
|
|
@ -239,6 +239,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
||||||
|
|
||||||
SeekBar seekbar = view.findViewById(R.id.seekbar);
|
SeekBar seekbar = view.findViewById(R.id.seekbar);
|
||||||
|
|
||||||
|
seekbar.setMin(item.getMin());
|
||||||
seekbar.setMax(item.getMax());
|
seekbar.setMax(item.getMax());
|
||||||
seekbar.setProgress(mSeekbarProgress);
|
seekbar.setProgress(mSeekbarProgress);
|
||||||
seekbar.setKeyProgressIncrement(5);
|
seekbar.setKeyProgressIncrement(5);
|
||||||
|
|
|
@ -234,8 +234,8 @@ public final class SettingsFragmentPresenter
|
||||||
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_OVERRIDE_REGION_SETTINGS,
|
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_OVERRIDE_REGION_SETTINGS,
|
||||||
R.string.override_region_settings, 0));
|
R.string.override_region_settings, 0));
|
||||||
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_AUTO_DISC_CHANGE, R.string.auto_disc_change, 0));
|
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_AUTO_DISC_CHANGE, R.string.auto_disc_change, 0));
|
||||||
sl.add(new PercentSliderSetting(FloatSetting.MAIN_EMULATION_SPEED, R.string.speed_limit, 0, 200,
|
sl.add(new PercentSliderSetting(FloatSetting.MAIN_EMULATION_SPEED, R.string.speed_limit, 0, 0,
|
||||||
"%"));
|
200, "%"));
|
||||||
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_ANALYTICS_ENABLED, R.string.analytics, 0));
|
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_ANALYTICS_ENABLED, R.string.analytics, 0));
|
||||||
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_ENABLE_SAVESTATES, R.string.enable_save_states,
|
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_ENABLE_SAVESTATES, R.string.enable_save_states,
|
||||||
R.string.enable_save_states_description));
|
R.string.enable_save_states_description));
|
||||||
|
@ -334,7 +334,8 @@ public final class SettingsFragmentPresenter
|
||||||
dspEngineEntries, dspEngineValues));
|
dspEngineEntries, dspEngineValues));
|
||||||
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_AUDIO_STRETCH, R.string.audio_stretch,
|
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_AUDIO_STRETCH, R.string.audio_stretch,
|
||||||
R.string.audio_stretch_description));
|
R.string.audio_stretch_description));
|
||||||
sl.add(new IntSliderSetting(IntSetting.MAIN_AUDIO_VOLUME, R.string.audio_volume, 0, 100, "%"));
|
sl.add(new IntSliderSetting(IntSetting.MAIN_AUDIO_VOLUME, R.string.audio_volume, 0, 0, 100,
|
||||||
|
"%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPathsSettings(ArrayList<SettingsItem> sl)
|
private void addPathsSettings(ArrayList<SettingsItem> sl)
|
||||||
|
@ -407,7 +408,7 @@ public final class SettingsFragmentPresenter
|
||||||
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_OVERCLOCK_ENABLE, R.string.overclock_enable,
|
sl.add(new CheckBoxSetting(BooleanSetting.MAIN_OVERCLOCK_ENABLE, R.string.overclock_enable,
|
||||||
R.string.overclock_enable_description));
|
R.string.overclock_enable_description));
|
||||||
sl.add(new PercentSliderSetting(FloatSetting.MAIN_OVERCLOCK, R.string.overclock_title,
|
sl.add(new PercentSliderSetting(FloatSetting.MAIN_OVERCLOCK, R.string.overclock_title,
|
||||||
R.string.overclock_title_description, 400, "%"));
|
R.string.overclock_title_description, 0, 400, "%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addGcPadSettings(ArrayList<SettingsItem> sl)
|
private void addGcPadSettings(ArrayList<SettingsItem> sl)
|
||||||
|
@ -649,9 +650,9 @@ public final class SettingsFragmentPresenter
|
||||||
sl.add(new SingleChoiceSetting(IntSetting.GFX_STEREO_MODE, R.string.stereoscopy_mode, 0,
|
sl.add(new SingleChoiceSetting(IntSetting.GFX_STEREO_MODE, R.string.stereoscopy_mode, 0,
|
||||||
R.array.stereoscopyEntries, R.array.stereoscopyValues));
|
R.array.stereoscopyEntries, R.array.stereoscopyValues));
|
||||||
sl.add(new IntSliderSetting(IntSetting.GFX_STEREO_DEPTH, R.string.stereoscopy_depth,
|
sl.add(new IntSliderSetting(IntSetting.GFX_STEREO_DEPTH, R.string.stereoscopy_depth,
|
||||||
R.string.stereoscopy_depth_description, 100, "%"));
|
R.string.stereoscopy_depth_description, 0, 100, "%"));
|
||||||
sl.add(new IntSliderSetting(IntSetting.GFX_STEREO_CONVERGENCE_PERCENTAGE,
|
sl.add(new IntSliderSetting(IntSetting.GFX_STEREO_CONVERGENCE_PERCENTAGE,
|
||||||
R.string.stereoscopy_convergence, R.string.stereoscopy_convergence_description, 200,
|
R.string.stereoscopy_convergence, R.string.stereoscopy_convergence_description, 0, 200,
|
||||||
"%"));
|
"%"));
|
||||||
sl.add(new CheckBoxSetting(BooleanSetting.GFX_STEREO_SWAP_EYES, R.string.stereoscopy_swap_eyes,
|
sl.add(new CheckBoxSetting(BooleanSetting.GFX_STEREO_SWAP_EYES, R.string.stereoscopy_swap_eyes,
|
||||||
R.string.stereoscopy_swap_eyes_description));
|
R.string.stereoscopy_swap_eyes_description));
|
||||||
|
|
Loading…
Reference in New Issue