mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-25 05:53:05 +00:00
Display bitrate in Mbps
This commit is contained in:
parent
fd6675a3a3
commit
32171bb70c
@ -14,6 +14,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
// Based on a Stack Overflow example: http://stackoverflow.com/questions/1974193/slider-on-my-preferencescreen
|
||||
public class SeekBarPreference extends DialogPreference
|
||||
{
|
||||
@ -30,6 +32,7 @@ public class SeekBarPreference extends DialogPreference
|
||||
private final int maxValue;
|
||||
private final int minValue;
|
||||
private final int stepSize;
|
||||
private final int divisor;
|
||||
private int currentValue;
|
||||
|
||||
public SeekBarPreference(Context context, AttributeSet attrs) {
|
||||
@ -59,6 +62,7 @@ public class SeekBarPreference extends DialogPreference
|
||||
maxValue = attrs.getAttributeIntValue(ANDROID_SCHEMA_URL, "max", 100);
|
||||
minValue = attrs.getAttributeIntValue(SEEKBAR_SCHEMA_URL, "min", 1);
|
||||
stepSize = attrs.getAttributeIntValue(SEEKBAR_SCHEMA_URL, "step", 1);
|
||||
divisor = attrs.getAttributeIntValue(SEEKBAR_SCHEMA_URL, "divisor", 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,7 +105,14 @@ public class SeekBarPreference extends DialogPreference
|
||||
return;
|
||||
}
|
||||
|
||||
String t = String.valueOf(value);
|
||||
String t;
|
||||
if (divisor != 1) {
|
||||
float floatValue = roundedValue / (float)divisor;
|
||||
t = String.format((Locale)null, "%.1f", floatValue);
|
||||
}
|
||||
else {
|
||||
t = String.valueOf(value);
|
||||
}
|
||||
valueText.setText(suffix == null ? t : t.concat(suffix.length() > 1 ? " "+suffix : suffix));
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@
|
||||
<string name="summary_fps_list">Increase for a smoother video stream. Decrease for better performance on lower end devices.</string>
|
||||
<string name="title_seekbar_bitrate">Video bitrate</string>
|
||||
<string name="summary_seekbar_bitrate">Increase for better image quality. Decrease to improve performance on slower connections.</string>
|
||||
<string name="suffix_seekbar_bitrate">Kbps</string>
|
||||
<string name="suffix_seekbar_bitrate_mbps">Mbps</string>
|
||||
<string name="title_checkbox_stretch_video">Stretch video to full-screen</string>
|
||||
|
||||
<string name="category_audio_settings">Audio Settings</string>
|
||||
|
@ -24,8 +24,9 @@
|
||||
seekbar:min="500"
|
||||
seekbar:step="500"
|
||||
android:max="100000"
|
||||
seekbar:divisor="1000"
|
||||
android:summary="@string/summary_seekbar_bitrate"
|
||||
android:text="@string/suffix_seekbar_bitrate"
|
||||
android:text="@string/suffix_seekbar_bitrate_mbps"
|
||||
android:title="@string/title_seekbar_bitrate" />
|
||||
<CheckBoxPreference
|
||||
android:key="checkbox_stretch_video"
|
||||
|
Loading…
x
Reference in New Issue
Block a user