Show volume number in volume control ui
The volume can be controlled in 25 steps. Respectively, the ui shown
goes from 0 to 25.
An alternative would have been to display a percentage, but that would
mean that one volume button press would jump 4% up, which doesn't look
great.
Bug: 162302410
Test: flash system ui && click +/- volume controls
Result: https://hsv.googleplex.com/5706562045739008
Change-Id: I295cf055937fae067f8ccc34eff656f42f85f072
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
<com.android.keyguard.AlphaOptimizedImageButton
|
||||
android:id="@+id/volume_row_icon"
|
||||
style="@style/VolumeButtons"
|
||||
android:layout_width="@dimen/volume_dialog_tap_target_size"
|
||||
android:layout_height="@dimen/volume_dialog_tap_target_size"
|
||||
android:layout_width="@dimen/tv_volume_dialog_bubble_size"
|
||||
android:layout_height="@dimen/tv_volume_dialog_bubble_size"
|
||||
android:background="@drawable/ripple_drawable_20dp"
|
||||
android:tint="@color/accent_tint_color_selector"
|
||||
android:soundEffectsEnabled="false" />
|
||||
@@ -62,6 +62,13 @@
|
||||
android:layout_gravity="center"
|
||||
android:rotation="0" />
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:id="@+id/volume_number"
|
||||
android:layout_width="@dimen/tv_volume_dialog_bubble_size"
|
||||
android:layout_height="@dimen/tv_volume_dialog_bubble_size"
|
||||
android:maxLength="2"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/accent_tint_color_selector"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/volume_dnd_icon"/>
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
<resources>
|
||||
<!-- Width of volume bar -->
|
||||
<dimen name="volume_dialog_row_width">252dp</dimen>
|
||||
<dimen name="volume_dialog_tap_target_size">36dp</dimen>
|
||||
<dimen name="tv_volume_dialog_bubble_size">36dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -421,6 +421,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
row.dndIcon = row.view.findViewById(R.id.dnd_icon);
|
||||
row.slider = row.view.findViewById(R.id.volume_row_slider);
|
||||
row.slider.setOnSeekBarChangeListener(new VolumeSeekBarChangeListener(row));
|
||||
row.number = row.view.findViewById(R.id.volume_number);
|
||||
|
||||
row.anim = null;
|
||||
|
||||
@@ -1090,6 +1091,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
final int vlevel = row.ss.muted && (!isRingStream && !zenMuted) ? 0
|
||||
: row.ss.level;
|
||||
updateVolumeRowSliderH(row, enableSlider, vlevel);
|
||||
if (row.number != null) row.number.setText(Integer.toString(vlevel));
|
||||
}
|
||||
|
||||
private boolean isStreamMuted(final StreamState streamState) {
|
||||
@@ -1115,6 +1117,10 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
row.icon.setImageTintList(tint);
|
||||
row.icon.setImageAlpha(alpha);
|
||||
row.cachedTint = tint;
|
||||
if (row.number != null) {
|
||||
row.number.setTextColor(tint);
|
||||
row.number.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateVolumeRowSliderH(VolumeRow row, boolean enable, int vlevel) {
|
||||
@@ -1458,6 +1464,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
private TextView header;
|
||||
private ImageButton icon;
|
||||
private SeekBar slider;
|
||||
private TextView number;
|
||||
private int stream;
|
||||
private StreamState ss;
|
||||
private long userAttempt; // last user-driven slider change
|
||||
|
||||
Reference in New Issue
Block a user