Make SystemUI RTL aware

- mirror vibrate and silent statusbar icons
- add code for updating icons when Locale is changed

See bug #5429822 UI should be mirrored for RTL locales (Arabic, Hebrew, farsi)

Change-Id: Ib7125d7f01ed8d1b8d63c2a9b119eb173efcf49f
This commit is contained in:
Fabrice Di Meglio
2013-01-09 15:42:31 -08:00
parent fdc6e4a603
commit 82fca5d27d
8 changed files with 30 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -118,12 +118,7 @@ public class StatusBarIconView extends AnimatedImageView {
mIcon = icon.clone();
setContentDescription(icon.contentDescription);
if (!iconEquals) {
Drawable drawable = getIcon(icon);
if (drawable == null) {
Slog.w(TAG, "No icon for slot " + mSlot);
return false;
}
setImageDrawable(drawable);
if (!updateDrawable(false /* no clear */)) return false;
}
if (!levelEquals) {
setImageLevel(icon.iconLevel);
@@ -149,6 +144,23 @@ public class StatusBarIconView extends AnimatedImageView {
return true;
}
public void updateDrawable() {
updateDrawable(true /* with clear */);
}
private boolean updateDrawable(boolean withClear) {
Drawable drawable = getIcon(mIcon);
if (drawable == null) {
Slog.w(TAG, "No icon for slot " + mSlot);
return false;
}
if (withClear) {
setImageDrawable(null);
}
setImageDrawable(drawable);
return true;
}
private Drawable getIcon(StatusBarIcon icon) {
return getIcon(getContext(), icon);
}

View File

@@ -837,6 +837,16 @@ public class PhoneStatusBar extends BaseStatusBar {
mWindowManager.addView(mIntruderAlertView, lp);
}
public void refreshAllStatusBarIcons() {
final int count = mStatusIcons.getChildCount();
for (int n = 0; n < count; n++) {
View child = mStatusIcons.getChildAt(n);
if (child instanceof StatusBarIconView) {
((StatusBarIconView) child).updateDrawable();
}
}
}
public void addIcon(String slot, int index, int viewIndex, StatusBarIcon icon) {
if (SPEW) Slog.d(TAG, "addIcon slot=" + slot + " index=" + index + " viewIndex=" + viewIndex
+ " icon=" + icon);
@@ -984,6 +994,8 @@ public class PhoneStatusBar extends BaseStatusBar {
mNotificationButton.setImageDrawable(null);
mNotificationButton.setImageResource(R.drawable.ic_notifications);
}
refreshAllStatusBarIcons();
}
private void updateShowSearchHoldoff() {