Fix Volume icons for RTL languages
- add mirrored version of the icons
- make VolumePanel respond to layout direction changes
- make AudioService propagate layout direction changes to the VolumePanel
Change-Id: Ibb884ab81641c319a9b7bea1381066f3f19581f0
diff --git a/core/java/android/view/VolumePanel.java b/core/java/android/view/VolumePanel.java
index 6251c45..d20bbd6 100644
--- a/core/java/android/view/VolumePanel.java
+++ b/core/java/android/view/VolumePanel.java
@@ -336,6 +336,11 @@
listenToRingerMode();
}
+ public void setLayoutDirection(int layoutDirection) {
+ mPanel.setLayoutDirection(layoutDirection);
+ updateStates();
+ }
+
private void listenToRingerMode() {
final IntentFilter filter = new IntentFilter();
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
@@ -459,6 +464,8 @@
private void updateSlider(StreamControl sc) {
sc.seekbarView.setProgress(getStreamVolume(sc.streamType));
final boolean muted = isMuted(sc.streamType);
+ // Force reloading the image resource
+ sc.icon.setImageDrawable(null);
sc.icon.setImageResource(muted ? sc.iconMuteRes : sc.iconRes);
if (sc.streamType == AudioManager.STREAM_RING &&
mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_audio_notification.png b/core/res/res/drawable-ldrtl-hdpi/ic_audio_notification.png
new file mode 100644
index 0000000..62ef692
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/ic_audio_notification.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_audio_notification_mute.png b/core/res/res/drawable-ldrtl-hdpi/ic_audio_notification_mute.png
new file mode 100644
index 0000000..40123e3
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/ic_audio_notification_mute.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_audio_phone.png b/core/res/res/drawable-ldrtl-hdpi/ic_audio_phone.png
new file mode 100644
index 0000000..968f5ee
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/ic_audio_phone.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif.png b/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif.png
new file mode 100644
index 0000000..e5f0dcf
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif_mute.png b/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif_mute.png
new file mode 100644
index 0000000..371e32f
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif_mute.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif_vibrate.png b/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif_vibrate.png
new file mode 100644
index 0000000..e05e8f5
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/ic_audio_ring_notif_vibrate.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_audio_vol.png b/core/res/res/drawable-ldrtl-hdpi/ic_audio_vol.png
new file mode 100644
index 0000000..81a8422
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/ic_audio_vol.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/ic_audio_vol_mute.png b/core/res/res/drawable-ldrtl-hdpi/ic_audio_vol_mute.png
new file mode 100644
index 0000000..371e32f
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/ic_audio_vol_mute.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_audio_notification.png b/core/res/res/drawable-ldrtl-mdpi/ic_audio_notification.png
new file mode 100644
index 0000000..d9843e0
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/ic_audio_notification.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_audio_notification_mute.png b/core/res/res/drawable-ldrtl-mdpi/ic_audio_notification_mute.png
new file mode 100644
index 0000000..2159cab
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/ic_audio_notification_mute.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_audio_phone.png b/core/res/res/drawable-ldrtl-mdpi/ic_audio_phone.png
new file mode 100644
index 0000000..b5af351
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/ic_audio_phone.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif.png b/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif.png
new file mode 100644
index 0000000..6341be6
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif_mute.png b/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif_mute.png
new file mode 100644
index 0000000..b4c3a54
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif_mute.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif_vibrate.png b/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif_vibrate.png
new file mode 100644
index 0000000..835773e
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/ic_audio_ring_notif_vibrate.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_audio_vol.png b/core/res/res/drawable-ldrtl-mdpi/ic_audio_vol.png
new file mode 100644
index 0000000..947d1f9
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/ic_audio_vol.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/ic_audio_vol_mute.png b/core/res/res/drawable-ldrtl-mdpi/ic_audio_vol_mute.png
new file mode 100644
index 0000000..b4c3a54
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/ic_audio_vol_mute.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_audio_notification.png b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_notification.png
new file mode 100644
index 0000000..43aedea
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_notification.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_audio_notification_mute.png b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_notification_mute.png
new file mode 100644
index 0000000..4e87f77
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_notification_mute.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_audio_phone.png b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_phone.png
new file mode 100644
index 0000000..1066d03
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_phone.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif.png b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif.png
new file mode 100644
index 0000000..daf9213
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif_mute.png b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif_mute.png
new file mode 100644
index 0000000..83d3bdd
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif_mute.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif_vibrate.png b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif_vibrate.png
new file mode 100644
index 0000000..4de95aa
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_ring_notif_vibrate.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_audio_vol.png b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_vol.png
new file mode 100644
index 0000000..8132926
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_vol.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/ic_audio_vol_mute.png b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_vol_mute.png
new file mode 100644
index 0000000..83d3bdd
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/ic_audio_vol_mute.png
Binary files differ
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 9aac0e6..fb66df0 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -5991,6 +5991,7 @@
}
}
}
+ mVolumePanel.setLayoutDirection(config.getLayoutDirection());
} catch (Exception e) {
Log.e(TAG, "Error retrieving device orientation: " + e);
}