mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Android: Change slider step size based on range
Credit to JosJuice for the slider formula
This commit is contained in:
parent
e70b57fe8a
commit
937e08980e
@ -286,7 +286,18 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||||||
slider.setValueFrom(item.getMin());
|
slider.setValueFrom(item.getMin());
|
||||||
slider.setValueTo(item.getMax());
|
slider.setValueTo(item.getMax());
|
||||||
slider.setValue(mSeekbarProgress);
|
slider.setValue(mSeekbarProgress);
|
||||||
slider.setStepSize(1);
|
|
||||||
|
// Sliders can get frustrating to use with a small step size and large ranges
|
||||||
|
int maxRange = item.getMax();
|
||||||
|
if (maxRange <= 100)
|
||||||
|
{
|
||||||
|
slider.setStepSize(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
slider.setStepSize((int) Math.pow(10, Math.ceil(Math.log10(maxRange)) - 2));
|
||||||
|
}
|
||||||
|
|
||||||
slider.addOnChangeListener(this);
|
slider.addOnChangeListener(this);
|
||||||
|
|
||||||
mDialog = new MaterialAlertDialogBuilder(mView.getActivity())
|
mDialog = new MaterialAlertDialogBuilder(mView.getActivity())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user