diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 6c6e207..dd86bd2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -78,6 +78,7 @@ public class NavigationBarView extends LinearLayout { private BackButtonDrawable mBackIcon, mBackLandIcon; private Drawable mRecentIcon; private Drawable mRecentLandIcon; + private Drawable mHomeIcon, mHomeLandIcon; private NavigationBarViewTaskSwitchHelper mTaskSwitchHelper; private DeadZone mDeadZone; @@ -90,6 +91,8 @@ public class NavigationBarView extends LinearLayout { // performs manual animation in sync with layout transitions private final NavTransitionListener mTransitionListener = new NavTransitionListener(); + private Resources mThemedResources; + private OnVerticalChangedListener mOnVerticalChangedListener; private boolean mIsLayoutRtl; private boolean mLayoutTransitionsEnabled; @@ -260,11 +263,44 @@ public class NavigationBarView extends LinearLayout { mBackLandIcon = new BackButtonDrawable(res.getDrawable(R.drawable.ic_sysbar_back_land)); mRecentIcon = res.getDrawable(R.drawable.ic_sysbar_recent); mRecentLandIcon = res.getDrawable(R.drawable.ic_sysbar_recent_land); + mHomeIcon = res.getDrawable(R.drawable.ic_sysbar_home); + mHomeLandIcon = res.getDrawable(R.drawable.ic_sysbar_home_land); + } + + public void updateResources(Resources res) { + mThemedResources = res; + getIcons(mThemedResources); + mBarTransitions.updateResources(res); + for (int i = 0; i < mRotatedViews.length; i++) { + ViewGroup container = (ViewGroup) mRotatedViews[i]; + if (container != null) { + updateLightsOutResources(container); + } + } + } + + private void updateLightsOutResources(ViewGroup container) { + ViewGroup lightsOut = (ViewGroup) container.findViewById(R.id.lights_out); + if (lightsOut != null) { + final int nChildren = lightsOut.getChildCount(); + for (int i = 0; i < nChildren; i++) { + final View child = lightsOut.getChildAt(i); + if (child instanceof ImageView) { + final ImageView iv = (ImageView) child; + // clear out the existing drawable, this is required since the + // ImageView keeps track of the resource ID and if it is the same + // it will not update the drawable. + iv.setImageDrawable(null); + iv.setImageDrawable(mThemedResources.getDrawable( + R.drawable.ic_sysbar_lights_out_dot_large)); + } + } + } } @Override public void setLayoutDirection(int layoutDirection) { - getIcons(getContext().getResources()); + getIcons(mThemedResources != null ? mThemedResources : getContext().getResources()); super.setLayoutDirection(layoutDirection); } @@ -298,13 +334,13 @@ public class NavigationBarView extends LinearLayout { mBackIcon.setImeVisible(backAlt); ((ImageView)getRecentsButton()).setImageDrawable(mVertical ? mRecentLandIcon : mRecentIcon); + ((ImageView)getHomeButton()).setImageDrawable(mVertical ? mHomeLandIcon : mHomeIcon); final boolean showImeButton = ((hints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0); getImeSwitchButton().setVisibility(showImeButton ? View.VISIBLE : View.INVISIBLE); // Update menu button in case the IME state has changed. setMenuVisibility(mShowMenu, true); - setDisabledFlags(mDisabledFlags, true); } |