mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 03:23:07 +00:00
Prevent deadzone and bitrate from dropping below 1
This commit is contained in:
parent
e3a477a243
commit
c96f9fb635
@ -49,6 +49,12 @@ public class ControllerHandler {
|
|||||||
|
|
||||||
public ControllerHandler(NvConnection conn, int deadzonePercentage) {
|
public ControllerHandler(NvConnection conn, int deadzonePercentage) {
|
||||||
this.conn = conn;
|
this.conn = conn;
|
||||||
|
|
||||||
|
// 1% is the lowest possible deadzone we support
|
||||||
|
if (deadzonePercentage <= 0) {
|
||||||
|
deadzonePercentage = 1;
|
||||||
|
}
|
||||||
|
|
||||||
this.stickDeadzone = (double)deadzonePercentage / 100.0;
|
this.stickDeadzone = (double)deadzonePercentage / 100.0;
|
||||||
|
|
||||||
// We want limelight-common to scale the axis values to match Xinput values
|
// We want limelight-common to scale the axis values to match Xinput values
|
||||||
|
@ -23,7 +23,7 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
private String dialogMessage, suffix;
|
private String dialogMessage, suffix;
|
||||||
private int defaultValue, maxValue, currentValue;
|
private int defaultValue, maxValue, minValue, currentValue;
|
||||||
|
|
||||||
public SeekBarPreference(Context context, AttributeSet attrs) {
|
public SeekBarPreference(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@ -47,9 +47,10 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
suffix = context.getString(suffixId);
|
suffix = context.getString(suffixId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get default and max seekbar values
|
// Get default, min, and max seekbar values
|
||||||
defaultValue = attrs.getAttributeIntValue(SCHEMA_URL, "defaultValue", PreferenceConfiguration.getDefaultBitrate(context));
|
defaultValue = attrs.getAttributeIntValue(SCHEMA_URL, "defaultValue", PreferenceConfiguration.getDefaultBitrate(context));
|
||||||
maxValue = attrs.getAttributeIntValue(SCHEMA_URL, "max", 100);
|
maxValue = attrs.getAttributeIntValue(SCHEMA_URL, "max", 100);
|
||||||
|
minValue = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -79,6 +80,11 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int value, boolean b) {
|
public void onProgressChanged(SeekBar seekBar, int value, boolean b) {
|
||||||
|
if (value < minValue) {
|
||||||
|
seekBar.setProgress(minValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String t = String.valueOf(value);
|
String t = String.valueOf(value);
|
||||||
valueText.setText(suffix == null ? t : t.concat(suffix.length() > 1 ? " "+suffix : suffix));
|
valueText.setText(suffix == null ? t : t.concat(suffix.length() > 1 ? " "+suffix : suffix));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user