Merge "Make SystemUI RTL aware"

This commit is contained in:
Fabrice Di Meglio
2013-01-09 18:12:26 -08:00
committed by Android (Google) Code Review
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() {