From 109423039d0993a8487a336fe1d619b287eb00b7 Mon Sep 17 00:00:00 2001 From: Xiaohui Chen Date: Wed, 16 Dec 2015 16:38:13 -0800 Subject: [PATCH] sysui: small refactor and delete dead code Bug: 26068752 Change-Id: I1af018ff9b74779ea663fc9e90b47a8fad70447e --- .../statusbar/phone/NavigationBarView.java | 11 +++---- .../systemui/statusbar/phone/PhoneStatusBar.java | 35 ++++++++++------------ 2 files changed, 19 insertions(+), 27 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 6c0c0ae37cbc..efa8f5b94721 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -231,6 +231,10 @@ public class NavigationBarView extends LinearLayout { return mCurrentView; } + public View[] getAllViews() { + return mRotatedViews; + } + public KeyButtonView getRecentsButton() { return (KeyButtonView) getCurrentView().findViewById(R.id.recent_apps); } @@ -341,7 +345,6 @@ public class NavigationBarView extends LinearLayout { // Update menu button in case the IME state has changed. setMenuVisibility(mShowMenu, true); - setDisabledFlags(mDisabledFlags, true); } @@ -398,12 +401,6 @@ public class NavigationBarView extends LinearLayout { } } - private void setVisibleOrGone(View view, boolean visible) { - if (view != null) { - view.setVisibility(visible ? VISIBLE : GONE); - } - } - public void setLayoutTransitionsEnabled(boolean enabled) { mLayoutTransitionsEnabled = enabled; updateLayoutTransitionsEnabled(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 78497abe16ba..c853fb41902e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -495,7 +495,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, private final ShadeUpdates mShadeUpdates = new ShadeUpdates(); - private int mDrawCount; private Runnable mLaunchTransitionEndRunnable; private boolean mLaunchTransitionFadingAway; private ExpandableNotificationRow mDraggedDownRow; @@ -670,8 +669,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, protected PhoneStatusBarView makeStatusBarView() { final Context context = mContext; - Resources res = context.getResources(); - updateDisplaySize(); // populates mDisplayMetrics updateResources(); @@ -835,23 +832,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mZenModeController = mVolumeComponent.getZenController(); } mCastController = new CastControllerImpl(mContext); - final SignalClusterView signalCluster = - (SignalClusterView) mStatusBarView.findViewById(R.id.signal_cluster); - final SignalClusterView signalClusterKeyguard = - (SignalClusterView) mKeyguardStatusBar.findViewById(R.id.signal_cluster); - final SignalClusterView signalClusterQs = - (SignalClusterView) mHeader.findViewById(R.id.signal_cluster); - mNetworkController.addSignalCallback(signalCluster); - mNetworkController.addSignalCallback(signalClusterKeyguard); - signalCluster.setSecurityController(mSecurityController); - signalCluster.setNetworkController(mNetworkController); - signalClusterKeyguard.setSecurityController(mSecurityController); - signalClusterKeyguard.setNetworkController(mNetworkController); - if (signalClusterQs != null) { - mNetworkController.addSignalCallback(signalClusterQs); - signalClusterQs.setSecurityController(mSecurityController); - signalClusterQs.setNetworkController(mNetworkController); - } + + initSignalCluster(mStatusBarView); + initSignalCluster(mKeyguardStatusBar); + initSignalCluster(mHeader); + final boolean isAPhone = mNetworkController.hasVoiceCallingFeature(); if (isAPhone) { mNetworkController.addEmergencyListener(mHeader); @@ -977,6 +962,16 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, }}); } + private void initSignalCluster(View containerView) { + SignalClusterView signalCluster = + (SignalClusterView) containerView.findViewById(R.id.signal_cluster); + if (signalCluster != null) { + mNetworkController.addSignalCallback(signalCluster); + signalCluster.setSecurityController(mSecurityController); + signalCluster.setNetworkController(mNetworkController); + } + } + /** Returns true if the app shelf should be shown in the nav bar. */ private boolean shouldShowAppShelf() { // Allow adb to override the default shelf behavior: -- 2.11.0