Factor out keyguard components of StatusBarHeaderView
Make the header on keyguard a separate view, and move all Keyguard
components from StatusBarHeader into KeyguardHeaderView.
Change-Id: I1e2400d5c91898df3824fd8f27b10750d576a62c
diff --git a/packages/SystemUI/res/layout/keyguard_status_bar.xml b/packages/SystemUI/res/layout/keyguard_status_bar.xml
new file mode 100644
index 0000000..d4b1214
--- /dev/null
+++ b/packages/SystemUI/res/layout/keyguard_status_bar.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2014 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<!-- Extends RelativeLayout -->
+<com.android.systemui.statusbar.phone.KeyguardStatusBarView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ android:id="@+id/keyguard_header"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/status_bar_header_height_keyguard"
+ android:baselineAligned="false"
+ >
+
+ <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch"
+ android:layout_width="@dimen/multi_user_switch_width_keyguard"
+ android:layout_height="@dimen/status_bar_header_height_keyguard"
+ android:layout_alignParentEnd="true"
+ android:background="@drawable/ripple_drawable"
+ android:layout_marginEnd="@dimen/multi_user_switch_keyguard_margin">
+ <ImageView android:id="@+id/multi_user_avatar"
+ android:layout_width="@dimen/multi_user_avatar_keyguard_size"
+ android:layout_height="@dimen/multi_user_avatar_keyguard_size"
+ android:layout_gravity="center"
+ android:scaleType="centerInside"/>
+ </com.android.systemui.statusbar.phone.MultiUserSwitch>
+
+ <LinearLayout android:id="@+id/system_icons_super_container"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/status_bar_header_height"
+ android:layout_toStartOf="@id/multi_user_switch"
+ android:layout_alignWithParentIfMissing="true"
+ android:layout_marginStart="16dp"
+ android:paddingEnd="2dp">
+ <FrameLayout android:id="@+id/system_icons_container"
+ android:layout_width="wrap_content"
+ android:layout_height="@dimen/status_bar_height"
+ android:layout_gravity="center_vertical"
+ >
+ <include layout="@layout/system_icons" />
+ </FrameLayout>
+ <TextView android:id="@+id/battery_level"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginStart="@dimen/header_battery_margin_keyguard"
+ android:paddingEnd="@dimen/battery_level_padding_end"
+ android:textColor="#ffffff"
+ android:visibility="gone"
+ android:textSize="12sp"/>
+ </LinearLayout>
+
+ <com.android.keyguard.CarrierText
+ android:id="@+id/keyguard_carrier_text"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/status_bar_header_height_keyguard"
+ android:layout_marginStart="@dimen/keyguard_carrier_text_margin"
+ android:layout_toStartOf="@id/system_icons_super_container"
+ android:gravity="center_vertical"
+ android:ellipsize="marquee"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="#ffffff"
+ android:singleLine="true" />
+
+</com.android.systemui.statusbar.phone.KeyguardStatusBarView>
diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml
index 19dc36d..beb8e00 100644
--- a/packages/SystemUI/res/layout/status_bar.xml
+++ b/packages/SystemUI/res/layout/status_bar.xml
@@ -82,33 +82,9 @@
android:layout_height="match_parent"
android:orientation="horizontal"
>
- <LinearLayout android:id="@+id/system_icons"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- >
- <com.android.systemui.statusbar.AlphaOptimizedLinearLayout
- android:id="@+id/statusIcons"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:gravity="center_vertical"
- android:orientation="horizontal"/>
- <include layout="@layout/signal_cluster_view"
- android:id="@+id/signal_cluster"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="2dp"
- />
- <!-- battery must be padded below to match assets -->
- <com.android.systemui.BatteryMeterView
- android:id="@+id/battery"
- android:layout_height="16dp"
- android:layout_width="10.5dp"
- android:layout_marginBottom="0.33dp"
- android:layout_marginStart="4dip"
- />
- </LinearLayout>
+ <include layout="@layout/system_icons" />
+
<com.android.systemui.statusbar.policy.Clock
android:id="@+id/clock"
android:textAppearance="@style/TextAppearance.StatusBar.Clock"
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index 9af2879..53a832a 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -50,6 +50,10 @@
android:visibility="gone"
/>
+ <include
+ layout="@layout/keyguard_status_bar"
+ android:visibility="invisible" />
+
<com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer
style="@style/NotificationsQuickSettings"
android:id="@+id/notification_container_parent"
diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml
index b260a4a..1afde69 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml
@@ -68,7 +68,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- android:layout_marginStart="@dimen/header_battery_margin_keyguard"
+ android:layout_marginStart="@dimen/header_battery_margin_expanded"
android:paddingEnd="@dimen/battery_level_padding_end"
android:textColor="#ffffff"
android:textSize="12sp"/>
@@ -139,18 +139,6 @@
android:visibility="gone"
/>
- <com.android.keyguard.CarrierText
- android:id="@+id/keyguard_carrier_text"
- android:layout_width="match_parent"
- android:layout_height="@dimen/status_bar_header_height_keyguard"
- android:layout_marginStart="@dimen/keyguard_carrier_text_margin"
- android:layout_toStartOf="@id/system_icons_super_container"
- android:gravity="center_vertical"
- android:ellipsize="marquee"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="#ffffff"
- android:singleLine="true" />
-
<include
android:id="@+id/qs_detail_header"
layout="@layout/qs_detail_header"
diff --git a/packages/SystemUI/res/layout/system_icons.xml b/packages/SystemUI/res/layout/system_icons.xml
new file mode 100644
index 0000000..69f9c142
--- /dev/null
+++ b/packages/SystemUI/res/layout/system_icons.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2014 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/system_icons"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical">
+
+ <com.android.systemui.statusbar.AlphaOptimizedLinearLayout android:id="@+id/statusIcons"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"/>
+
+ <include layout="@layout/signal_cluster_view"
+ android:id="@+id/signal_cluster"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="2dp"/>
+
+ <!-- battery must be padded below to match assets -->
+ <com.android.systemui.BatteryMeterView android:id="@+id/battery"
+ android:layout_height="16dp"
+ android:layout_width="10.5dp"
+ android:layout_marginBottom="0.33dp"
+ android:layout_marginStart="4dip"/>
+</LinearLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
new file mode 100644
index 0000000..bf66c41
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.systemui.statusbar.phone;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.android.systemui.R;
+import com.android.systemui.statusbar.policy.BatteryController;
+import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
+import com.android.systemui.statusbar.policy.UserInfoController;
+
+/**
+ * The header group on Keyguard.
+ */
+public class KeyguardStatusBarView extends RelativeLayout
+ implements BatteryController.BatteryStateChangeCallback {
+
+ private boolean mBatteryCharging;
+ private boolean mKeyguardUserSwitcherShowing;
+ private boolean mBatteryListening;
+
+ private View mSystemIconsSuperContainer;
+ private MultiUserSwitch mMultiUserSwitch;
+ private ImageView mMultiUserAvatar;
+ private TextView mBatteryLevel;
+
+ private BatteryController mBatteryController;
+ private KeyguardUserSwitcher mKeyguardUserSwitcher;
+
+ private int mSystemIconsSwitcherHiddenExpandedMargin;
+
+ public KeyguardStatusBarView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mSystemIconsSuperContainer = findViewById(R.id.system_icons_super_container);
+ mMultiUserSwitch = (MultiUserSwitch) findViewById(R.id.multi_user_switch);
+ mMultiUserAvatar = (ImageView) findViewById(R.id.multi_user_avatar);
+ mBatteryLevel = (TextView) findViewById(R.id.battery_level);
+ loadDimens();
+ updateUserSwitcher();
+ }
+
+ private void loadDimens() {
+ mSystemIconsSwitcherHiddenExpandedMargin = getResources().getDimensionPixelSize(
+ R.dimen.system_icons_switcher_hidden_expanded_margin);
+ }
+
+ private void updateVisibilities() {
+ mMultiUserSwitch.setVisibility(!mKeyguardUserSwitcherShowing ? VISIBLE : GONE);
+ mBatteryLevel.setVisibility(mBatteryCharging ? View.VISIBLE : View.GONE);
+ }
+
+ private void updateSystemIconsLayoutParams() {
+ RelativeLayout.LayoutParams lp =
+ (LayoutParams) mSystemIconsSuperContainer.getLayoutParams();
+ int marginEnd = mKeyguardUserSwitcherShowing ? mSystemIconsSwitcherHiddenExpandedMargin : 0;
+ if (marginEnd != lp.getMarginEnd()) {
+ lp.setMarginEnd(marginEnd);
+ mSystemIconsSuperContainer.setLayoutParams(lp);
+ }
+ }
+
+ public void setListening(boolean listening) {
+ if (listening == mBatteryListening) {
+ return;
+ }
+ mBatteryListening = listening;
+ if (mBatteryListening) {
+ mBatteryController.addStateChangedCallback(this);
+ } else {
+ mBatteryController.removeStateChangedCallback(this);
+ }
+ }
+
+ private void updateUserSwitcher() {
+ boolean keyguardSwitcherAvailable = mKeyguardUserSwitcher != null;
+ mMultiUserSwitch.setClickable(keyguardSwitcherAvailable);
+ mMultiUserSwitch.setFocusable(keyguardSwitcherAvailable);
+ mMultiUserSwitch.setKeyguardMode(keyguardSwitcherAvailable);
+ }
+
+ public void setBatteryController(BatteryController batteryController) {
+ mBatteryController = batteryController;
+ }
+
+ public void setUserInfoController(UserInfoController userInfoController) {
+ userInfoController.addListener(new UserInfoController.OnUserInfoChangedListener() {
+ @Override
+ public void onUserInfoChanged(String name, Drawable picture) {
+ mMultiUserAvatar.setImageDrawable(picture);
+ }
+ });
+ }
+
+ @Override
+ public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
+ mBatteryLevel.setText(getResources().getString(R.string.battery_level_template, level));
+ boolean changed = mBatteryCharging != charging;
+ mBatteryCharging = charging;
+ if (changed) {
+ updateVisibilities();
+ }
+ }
+
+ @Override
+ public void onPowerSaveChanged() {
+ // could not care less
+ }
+
+ public void setKeyguardUserSwitcher(KeyguardUserSwitcher keyguardUserSwitcher) {
+ mKeyguardUserSwitcher = keyguardUserSwitcher;
+ mMultiUserSwitch.setKeyguardUserSwitcher(keyguardUserSwitcher);
+ updateUserSwitcher();
+ }
+
+ public void setKeyguardUserSwitcherShowing(boolean showing) {
+ mKeyguardUserSwitcherShowing = showing;
+ updateVisibilities();
+ updateSystemIconsLayoutParams();
+ }
+
+ @Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index cccfb7b..e7e18cf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -60,6 +60,7 @@
private KeyguardAffordanceHelper mAfforanceHelper;
private StatusBarHeaderView mHeader;
+ private KeyguardStatusBarView mKeyguardStatusBar;
private View mQsContainer;
private QSPanel mQsPanel;
private View mKeyguardStatusView;
@@ -153,6 +154,7 @@
super.onFinishInflate();
mHeader = (StatusBarHeaderView) findViewById(R.id.header);
mHeader.setOnClickListener(this);
+ mKeyguardStatusBar = (KeyguardStatusBarView) findViewById(R.id.keyguard_header);
mKeyguardStatusView = findViewById(R.id.keyguard_status_view);
mQsContainer = findViewById(R.id.quick_settings_container);
mQsPanel = (QSPanel) findViewById(R.id.quick_settings_panel);
@@ -196,8 +198,7 @@
// Update Clock Pivot
mKeyguardStatusView.setPivotX(getWidth() / 2);
- mKeyguardStatusView.setPivotY(
- (FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
+ mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
// Calculate quick setting heights.
mQsMinExpansionHeight = mHeader.getCollapsedHeight() + mQsPeekHeight;
@@ -223,10 +224,11 @@
private void positionClockAndNotifications() {
boolean animate = mNotificationStackScroller.isAddOrRemoveAnimationPending();
int stackScrollerPadding;
- if (mStatusBar.getBarState() != StatusBarState.KEYGUARD) {
+ if (mStatusBarState != StatusBarState.KEYGUARD) {
int bottom = mHeader.getCollapsedHeight();
- stackScrollerPadding = bottom + mQsPeekHeight
- + mNotificationTopPadding;
+ stackScrollerPadding = mStatusBarState == StatusBarState.SHADE
+ ? bottom + mQsPeekHeight + mNotificationTopPadding
+ : mKeyguardStatusBar.getHeight() + mNotificationTopPadding;
mTopPaddingAdjustment = 0;
} else {
mClockPositionAlgorithm.setup(
@@ -671,6 +673,7 @@
public void setBarState(int statusBarState) {
boolean keyguardShowing = statusBarState == StatusBarState.KEYGUARD
|| statusBarState == StatusBarState.SHADE_LOCKED;
+ mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE);
if (!mKeyguardShowing && keyguardShowing) {
setQsTranslation(mQsExpansionHeight);
mHeader.setTranslationY(0f);
@@ -682,9 +685,11 @@
private void updateQsState() {
boolean expandVisually = mQsExpanded || mStackScrollerOverscrolling;
- mHeader.setExpanded(expandVisually, mStackScrollerOverscrolling);
- mNotificationStackScroller.setScrollingEnabled(mStatusBarState != StatusBarState.KEYGUARD
- && (!mQsExpanded || mQsExpansionFromOverscroll));
+ mHeader.setVisibility((mQsExpanded || !mKeyguardShowing) ? View.VISIBLE : View.INVISIBLE);
+ mHeader.setExpanded(mQsExpanded && !mStackScrollerOverscrolling);
+ mNotificationStackScroller.setScrollingEnabled(
+ mStatusBarState != StatusBarState.KEYGUARD && (!mQsExpanded
+ || mQsExpansionFromOverscroll));
mQsPanel.setVisibility(expandVisually ? View.VISIBLE : View.INVISIBLE);
mQsContainer.setVisibility(
mKeyguardShowing && !expandVisually ? View.INVISIBLE : View.VISIBLE);
@@ -993,7 +998,6 @@
}
private void updateHeaderShade() {
- mHeader.setAlpha(1f);
mHeader.setTranslationY(getHeaderTranslation());
setQsTranslation(mQsExpansionHeight);
}
@@ -1014,7 +1018,6 @@
}
private void updateHeaderKeyguard() {
- mHeader.setTranslationY(0f);
float alpha;
if (mStatusBar.getBarState() == StatusBarState.KEYGUARD) {
@@ -1032,7 +1035,7 @@
}
alpha = Math.max(0, Math.min(alpha, 1));
alpha = (float) Math.pow(alpha, 0.75);
- mHeader.setAlpha(alpha);
+ mKeyguardStatusBar.setAlpha(alpha);
mKeyguardBottomArea.setAlpha(alpha);
setQsTranslation(mQsExpansionHeight);
}
@@ -1062,21 +1065,24 @@
mIsExpanding = false;
mScrollYOverride = -1;
if (mExpandedHeight == 0f) {
- mHeader.setListening(false);
- mQsPanel.setListening(false);
+ setListening(false);
} else {
- mHeader.setListening(true);
- mQsPanel.setListening(true);
+ setListening(true);
}
mTwoFingerQsExpand = false;
mTwoFingerQsExpandPossible = false;
}
+ private void setListening(boolean listening) {
+ mHeader.setListening(listening);
+ mKeyguardStatusBar.setListening(listening);
+ mQsPanel.setListening(listening);
+ }
+
@Override
public void instantExpand() {
super.instantExpand();
- mHeader.setListening(true);
- mQsPanel.setListening(true);
+ setListening(true);
}
@Override
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 20a4092..6e7266e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -252,6 +252,8 @@
// left-hand icons
LinearLayout mStatusIcons;
+ LinearLayout mStatusIconsKeyguard;
+
// the icons themselves
IconMerger mNotificationIcons;
View mNotificationIconArea;
@@ -273,6 +275,7 @@
// top bar
StatusBarHeaderView mHeader;
+ KeyguardStatusBarView mKeyguardStatusBar;
View mKeyguardStatusView;
KeyguardBottomAreaView mKeyguardBottomArea;
boolean mLeaveOpenOnKeyguardHide;
@@ -695,6 +698,8 @@
mHeader = (StatusBarHeaderView) mStatusBarWindow.findViewById(R.id.header);
mHeader.setActivityStarter(this);
+ mKeyguardStatusBar = (KeyguardStatusBarView) mStatusBarWindow.findViewById(R.id.keyguard_header);
+ mStatusIconsKeyguard = (LinearLayout) mKeyguardStatusBar.findViewById(R.id.statusIcons);
mKeyguardStatusView = mStatusBarWindow.findViewById(R.id.keyguard_status_view);
mKeyguardBottomArea =
(KeyguardBottomAreaView) mStatusBarWindow.findViewById(R.id.keyguard_bottom_area);
@@ -744,10 +749,13 @@
mZenModeController = mVolumeComponent.getZenController();
mCastController = new CastControllerImpl(mContext);
final SignalClusterView signalCluster =
- (SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster);
-
+ (SignalClusterView) mStatusBarView.findViewById(R.id.signal_cluster);
+ final SignalClusterView signalClusterKeyguard =
+ (SignalClusterView) mKeyguardStatusBar.findViewById(R.id.signal_cluster);
mNetworkController.addSignalCluster(signalCluster);
+ mNetworkController.addSignalCluster(signalClusterKeyguard);
signalCluster.setNetworkController(mNetworkController);
+ signalClusterKeyguard.setNetworkController(mNetworkController);
final boolean isAPhone = mNetworkController.hasVoiceCallingFeature();
if (isAPhone) {
mNetworkController.addEmergencyLabelView(mHeader);
@@ -783,8 +791,8 @@
mKeyguardMonitor = new KeyguardMonitor();
mKeyguardUserSwitcher = new KeyguardUserSwitcher(mContext,
- (ViewStub) mStatusBarWindow.findViewById(R.id.keyguard_user_switcher), mHeader,
- mUserSwitcherController);
+ (ViewStub) mStatusBarWindow.findViewById(R.id.keyguard_user_switcher),
+ mKeyguardStatusBar, mUserSwitcherController);
// Set up the quick settings tile panel
@@ -808,9 +816,11 @@
// User info. Trigger first load.
mHeader.setUserInfoController(mUserInfoController);
+ mKeyguardStatusBar.setUserInfoController(mUserInfoController);
mUserInfoController.reloadUserInfo();
mHeader.setBatteryController(mBatteryController);
+ mKeyguardStatusBar.setBatteryController(mBatteryController);
mHeader.setNextAlarmController(mNextAlarmController);
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
@@ -1167,6 +1177,7 @@
public void refreshAllStatusBarIcons() {
refreshAllIconsForLayout(mStatusIcons);
+ refreshAllIconsForLayout(mStatusIconsKeyguard);
refreshAllIconsForLayout(mNotificationIcons);
}
@@ -1186,19 +1197,26 @@
StatusBarIconView view = new StatusBarIconView(mContext, slot, null);
view.set(icon);
mStatusIcons.addView(view, viewIndex, new LinearLayout.LayoutParams(mIconSize, mIconSize));
+ view = new StatusBarIconView(mContext, slot, null);
+ view.set(icon);
+ mStatusIconsKeyguard.addView(view, viewIndex,
+ new LinearLayout.LayoutParams(mIconSize, mIconSize));
}
public void updateIcon(String slot, int index, int viewIndex,
StatusBarIcon old, StatusBarIcon icon) {
if (SPEW) Log.d(TAG, "updateIcon slot=" + slot + " index=" + index + " viewIndex=" + viewIndex
+ " old=" + old + " icon=" + icon);
- StatusBarIconView view = (StatusBarIconView)mStatusIcons.getChildAt(viewIndex);
+ StatusBarIconView view = (StatusBarIconView) mStatusIcons.getChildAt(viewIndex);
+ view.set(icon);
+ view = (StatusBarIconView) mStatusIconsKeyguard.getChildAt(viewIndex);
view.set(icon);
}
public void removeIcon(String slot, int index, int viewIndex) {
if (SPEW) Log.d(TAG, "removeIcon slot=" + slot + " index=" + index + " viewIndex=" + viewIndex);
mStatusIcons.removeViewAt(viewIndex);
+ mStatusIconsKeyguard.removeViewAt(viewIndex);
}
public UserHandle getCurrentUserHandle() {
@@ -3378,11 +3396,9 @@
}
if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
mKeyguardBottomArea.setVisibility(View.VISIBLE);
- mHeader.setKeyguardShowing(true);
mScrimController.setKeyguardShowing(true);
} else {
mKeyguardBottomArea.setVisibility(View.GONE);
- mHeader.setKeyguardShowing(false);
mScrimController.setKeyguardShowing(false);
}
mNotificationPanel.setBarState(mState);
@@ -3401,14 +3417,14 @@
final boolean bottomGone = mKeyguardBottomArea.getVisibility() == View.GONE;
if (mDozing) {
mNotificationPanel.setBackgroundColor(0xff000000);
- mHeader.setVisibility(View.INVISIBLE);
+ mKeyguardStatusBar.setVisibility(View.INVISIBLE);
if (!bottomGone) {
mKeyguardBottomArea.setVisibility(View.INVISIBLE);
}
mStackScroller.setDark(true, false /*animate*/);
} else {
mNotificationPanel.setBackground(null);
- mHeader.setVisibility(View.VISIBLE);
+ mKeyguardStatusBar.setVisibility(View.VISIBLE);
if (!bottomGone) {
mKeyguardBottomArea.setVisibility(View.VISIBLE);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
index 197bb39..039b908 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
@@ -38,7 +38,6 @@
import com.android.systemui.qs.QSPanel;
import com.android.systemui.qs.QSTile;
import com.android.systemui.statusbar.policy.BatteryController;
-import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.NextAlarmController;
import com.android.systemui.statusbar.policy.UserInfoController;
@@ -50,9 +49,6 @@
private boolean mExpanded;
private boolean mListening;
- private boolean mOverscrolled;
- private boolean mKeyguardShowing;
- private boolean mCharging;
private ViewGroup mSystemIconsContainer;
private View mSystemIconsSuperContainer;
@@ -60,7 +56,6 @@
private View mClock;
private View mTime;
private View mAmPm;
- private View mKeyguardCarrierText;
private MultiUserSwitch mMultiUserSwitch;
private ImageView mMultiUserAvatar;
private View mDateCollapsed;
@@ -77,29 +72,19 @@
private TextView mAlarmStatus;
private boolean mShowEmergencyCallsOnly;
- private boolean mKeyguardUserSwitcherShowing;
private boolean mAlarmShowing;
private AlarmClockInfo mNextAlarm;
private int mCollapsedHeight;
private int mExpandedHeight;
- private int mKeyguardHeight;
- private int mKeyguardWidth = ViewGroup.LayoutParams.MATCH_PARENT;
- private int mNormalWidth;
- private int mPadding;
private int mMultiUserExpandedMargin;
private int mMultiUserCollapsedMargin;
- private int mMultiUserKeyguardMargin;
- private int mSystemIconsSwitcherHiddenExpandedMargin;
+
private int mClockMarginBottomExpanded;
private int mClockMarginBottomCollapsed;
private int mMultiUserSwitchWidthCollapsed;
private int mMultiUserSwitchWidthExpanded;
- private int mMultiUserSwitchWidthKeyguard;
- private int mBatteryPaddingEnd;
- private int mBatteryMarginExpanded;
- private int mBatteryMarginKeyguard;
/**
* In collapsed QS, the clock and avatar are scaled down a bit post-layout to allow for a nice
@@ -107,13 +92,12 @@
*/
private float mClockCollapsedScaleFactor;
private float mAvatarCollapsedScaleFactor;
- private float mAvatarKeyguardScaleFactor;
private ActivityStarter mActivityStarter;
private BatteryController mBatteryController;
private NextAlarmController mNextAlarmController;
private QSPanel mQSPanel;
- private KeyguardUserSwitcher mKeyguardUserSwitcher;
+
private final Rect mClipBounds = new Rect();
@@ -139,7 +123,6 @@
mClock = findViewById(R.id.clock);
mTime = findViewById(R.id.time_view);
mAmPm = findViewById(R.id.am_pm_view);
- mKeyguardCarrierText = findViewById(R.id.keyguard_carrier_text);
mMultiUserSwitch = (MultiUserSwitch) findViewById(R.id.multi_user_switch);
mMultiUserAvatar = (ImageView) findViewById(R.id.multi_user_avatar);
mDateCollapsed = findViewById(R.id.date_collapsed);
@@ -187,7 +170,7 @@
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
if (mCaptureValues) {
- if (mExpanded && !mOverscrolled) {
+ if (mExpanded) {
captureLayoutValues(mExpandedValues);
} else {
captureLayoutValues(mCollapsedValues);
@@ -207,18 +190,11 @@
mCollapsedHeight = getResources().getDimensionPixelSize(R.dimen.status_bar_header_height);
mExpandedHeight = getResources().getDimensionPixelSize(
R.dimen.status_bar_header_height_expanded);
- mKeyguardHeight = getResources().getDimensionPixelSize(
- R.dimen.status_bar_header_height_keyguard);
- mNormalWidth = getLayoutParams().width;
- mPadding = getResources().getDimensionPixelSize(R.dimen.notification_side_padding);
mMultiUserExpandedMargin =
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_expanded_margin);
mMultiUserCollapsedMargin =
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_collapsed_margin);
- mMultiUserKeyguardMargin =
- getResources().getDimensionPixelSize(R.dimen.multi_user_switch_keyguard_margin);
- mSystemIconsSwitcherHiddenExpandedMargin = getResources().getDimensionPixelSize(
- R.dimen.system_icons_switcher_hidden_expanded_margin);
+
mClockMarginBottomExpanded =
getResources().getDimensionPixelSize(R.dimen.clock_expanded_bottom_margin);
mClockMarginBottomCollapsed =
@@ -227,23 +203,12 @@
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_width_collapsed);
mMultiUserSwitchWidthExpanded =
getResources().getDimensionPixelSize(R.dimen.multi_user_switch_width_expanded);
- mMultiUserSwitchWidthKeyguard =
- getResources().getDimensionPixelSize(R.dimen.multi_user_switch_width_keyguard);
mAvatarCollapsedScaleFactor =
getResources().getDimensionPixelSize(R.dimen.multi_user_avatar_collapsed_size)
/ (float) mMultiUserAvatar.getLayoutParams().width;
- mAvatarKeyguardScaleFactor =
- getResources().getDimensionPixelSize(R.dimen.multi_user_avatar_keyguard_size)
- / (float) mMultiUserAvatar.getLayoutParams().width;
mClockCollapsedScaleFactor =
(float) getResources().getDimensionPixelSize(R.dimen.qs_time_collapsed_size)
/ (float) getResources().getDimensionPixelSize(R.dimen.qs_time_expanded_size);
- mBatteryPaddingEnd =
- getResources().getDimensionPixelSize(R.dimen.battery_level_padding_end);
- mBatteryMarginExpanded =
- getResources().getDimensionPixelSize(R.dimen.header_battery_margin_expanded);
- mBatteryMarginKeyguard =
- getResources().getDimensionPixelSize(R.dimen.header_battery_margin_keyguard);
}
public void setActivityStarter(ActivityStarter activityStarter) {
@@ -259,7 +224,7 @@
}
public int getCollapsedHeight() {
- return mKeyguardShowing ? mKeyguardHeight : mCollapsedHeight;
+ return mCollapsedHeight;
}
public int getExpandedHeight() {
@@ -274,107 +239,49 @@
updateListeners();
}
- public void setExpanded(boolean expanded, boolean overscrolled) {
+ public void setExpanded(boolean expanded) {
boolean changed = expanded != mExpanded;
- boolean overscrollChanged = overscrolled != mOverscrolled;
mExpanded = expanded;
- mOverscrolled = overscrolled;
- if (changed || overscrollChanged) {
+ if (changed) {
updateHeights();
updateVisibilities();
updateSystemIconsLayoutParams();
- updateZTranslation();
updateClickTargets();
- updateWidth();
- updatePadding();
updateMultiUserSwitch();
if (mQSPanel != null) {
- mQSPanel.setExpanded(expanded && !overscrolled);
+ mQSPanel.setExpanded(expanded);
}
updateClockScale();
updateAvatarScale();
updateClockLp();
- updateBatteryLevelPaddingEnd();
- updateBatteryLevelLp();
requestCaptureValues();
}
}
private void updateHeights() {
- boolean onKeyguardAndCollapsed = mKeyguardShowing && !mExpanded;
- int height;
- if (mExpanded && !mOverscrolled) {
- height = mExpandedHeight;
- } else if (onKeyguardAndCollapsed) {
- height = mKeyguardHeight;
- } else {
- height = mCollapsedHeight;
- }
+ int height = mExpanded ? mExpandedHeight : mCollapsedHeight;
ViewGroup.LayoutParams lp = getLayoutParams();
if (lp.height != height) {
lp.height = height;
setLayoutParams(lp);
}
- int systemIconsContainerHeight = onKeyguardAndCollapsed ? mKeyguardHeight : mCollapsedHeight;
- lp = mSystemIconsSuperContainer.getLayoutParams();
- if (lp.height != systemIconsContainerHeight) {
- lp.height = systemIconsContainerHeight;
- mSystemIconsSuperContainer.setLayoutParams(lp);
- }
- lp = mMultiUserSwitch.getLayoutParams();
- if (lp.height != systemIconsContainerHeight) {
- lp.height = systemIconsContainerHeight;
- mMultiUserSwitch.setLayoutParams(lp);
- }
- }
-
- private void updateWidth() {
- int width = (mKeyguardShowing && !mExpanded) ? mKeyguardWidth : mNormalWidth;
- ViewGroup.LayoutParams lp = getLayoutParams();
- if (width != lp.width) {
- lp.width = width;
- setLayoutParams(lp);
- }
}
private void updateVisibilities() {
- boolean onKeyguardAndCollapsed = mKeyguardShowing && !mExpanded;
- if (onKeyguardAndCollapsed) {
- setBackground(null);
- } else {
- setBackgroundResource(R.drawable.notification_header_bg);
- }
- mDateGroup.setVisibility(onKeyguardAndCollapsed ? View.INVISIBLE : View.VISIBLE);
- mClock.setVisibility(onKeyguardAndCollapsed ? View.INVISIBLE : View.VISIBLE);
- mKeyguardCarrierText.setVisibility(onKeyguardAndCollapsed ? View.VISIBLE : View.GONE);
- mDateCollapsed.setVisibility(mExpanded && !mOverscrolled && mAlarmShowing
- ? View.VISIBLE : View.INVISIBLE);
- mDateExpanded.setVisibility(mExpanded && !mOverscrolled && mAlarmShowing
- ? View.INVISIBLE : View.VISIBLE);
- mAlarmStatus.setVisibility(mExpanded && !mOverscrolled && mAlarmShowing
- ? View.VISIBLE : View.INVISIBLE);
- mSettingsButton.setVisibility(mExpanded && !mOverscrolled ? View.VISIBLE : View.INVISIBLE);
+ mDateCollapsed.setVisibility(mExpanded && mAlarmShowing ? View.VISIBLE : View.INVISIBLE);
+ mDateExpanded.setVisibility(mExpanded && mAlarmShowing ? View.INVISIBLE : View.VISIBLE);
+ mAlarmStatus.setVisibility(mExpanded && mAlarmShowing ? View.VISIBLE : View.INVISIBLE);
+ mSettingsButton.setVisibility(mExpanded ? View.VISIBLE : View.INVISIBLE);
mQsDetailHeader.setVisibility(mExpanded ? View.VISIBLE : View.GONE);
- if (mStatusIcons != null) {
- mStatusIcons.setVisibility(mKeyguardShowing && (!mExpanded || mOverscrolled)
- ? View.VISIBLE : View.GONE);
- }
if (mSignalCluster != null) {
updateSignalClusterDetachment();
}
- mEmergencyCallsOnly.setVisibility(mExpanded && !mOverscrolled && mShowEmergencyCallsOnly
- ? VISIBLE : GONE);
- mMultiUserSwitch.setVisibility(mExpanded || !mKeyguardUserSwitcherShowing
- ? VISIBLE : GONE);
- mBatteryLevel.setVisibility(mKeyguardShowing && mCharging || mExpanded && !mOverscrolled
- ? View.VISIBLE : View.GONE);
- if (mExpanded && !mOverscrolled && mKeyguardUserSwitcherShowing) {
- mKeyguardUserSwitcher.hide();
- }
+ mEmergencyCallsOnly.setVisibility(mExpanded && mShowEmergencyCallsOnly ? VISIBLE : GONE);
+ mBatteryLevel.setVisibility(mExpanded ? View.VISIBLE : View.GONE);
}
private void updateSignalClusterDetachment() {
- boolean detached = mExpanded && !mOverscrolled;
+ boolean detached = mExpanded;
if (detached != mSignalClusterDetached) {
if (detached) {
getOverlay().add(mSignalCluster);
@@ -388,16 +295,13 @@
private void updateSystemIconsLayoutParams() {
RelativeLayout.LayoutParams lp = (LayoutParams) mSystemIconsSuperContainer.getLayoutParams();
- lp.addRule(RelativeLayout.START_OF, mExpanded && !mOverscrolled
+ int rule = mExpanded
? mSettingsButton.getId()
- : mMultiUserSwitch.getId());
- lp.removeRule(ALIGN_PARENT_START);
- if (mMultiUserSwitch.getVisibility() == GONE) {
- lp.setMarginEnd(mSystemIconsSwitcherHiddenExpandedMargin);
- } else {
- lp.setMarginEnd(0);
+ : mMultiUserSwitch.getId();
+ if (rule != lp.getRules()[RelativeLayout.START_OF]) {
+ lp.addRule(RelativeLayout.START_OF, rule);
+ mSystemIconsSuperContainer.setLayoutParams(lp);
}
- mSystemIconsSuperContainer.setLayoutParams(lp);
}
private void updateListeners() {
@@ -411,12 +315,9 @@
}
private void updateAvatarScale() {
- if (mExpanded && !mOverscrolled) {
+ if (mExpanded) {
mMultiUserAvatar.setScaleX(1f);
mMultiUserAvatar.setScaleY(1f);
- } else if (mKeyguardShowing) {
- mMultiUserAvatar.setScaleX(mAvatarKeyguardScaleFactor);
- mMultiUserAvatar.setScaleY(mAvatarKeyguardScaleFactor);
} else {
mMultiUserAvatar.setScaleX(mAvatarCollapsedScaleFactor);
mMultiUserAvatar.setScaleY(mAvatarCollapsedScaleFactor);
@@ -432,7 +333,7 @@
}
private float getTimeScale() {
- return !mExpanded || mOverscrolled ? mClockCollapsedScaleFactor : 1f;
+ return !mExpanded ? mClockCollapsedScaleFactor : 1f;
}
private void updateAmPmTranslation() {
@@ -440,20 +341,9 @@
mAmPm.setTranslationX((rtl ? 1 : -1) * mTime.getWidth() * (1 - mTime.getScaleX()));
}
- private void updateBatteryLevelPaddingEnd() {
- mBatteryLevel.setPaddingRelative(0, 0,
- mKeyguardShowing && !mExpanded ? 0 : mBatteryPaddingEnd, 0);
- }
-
@Override
public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
mBatteryLevel.setText(getResources().getString(R.string.battery_level_template, level));
- boolean changed = mCharging != charging;
- mCharging = charging;
- if (changed) {
- updateVisibilities();
- requestCaptureValues();
- }
}
@Override
@@ -474,35 +364,14 @@
private void updateClickTargets() {
- setClickable(!mKeyguardShowing || mExpanded);
+ setClickable(mExpanded);
- boolean keyguardSwitcherAvailable =
- mKeyguardUserSwitcher != null && mKeyguardShowing && !mExpanded;
- mMultiUserSwitch.setClickable(mExpanded || keyguardSwitcherAvailable);
- mMultiUserSwitch.setKeyguardMode(keyguardSwitcherAvailable);
mSystemIconsSuperContainer.setClickable(mExpanded);
mAlarmStatus.setClickable(mNextAlarm != null && mNextAlarm.getShowIntent() != null);
}
- private void updateZTranslation() {
-
- // If we are on the Keyguard, we need to set our z position to zero, so we don't get
- // shadows.
- if (mKeyguardShowing && !mExpanded) {
- setZ(0);
- } else {
- setTranslationZ(0);
- }
- }
-
- private void updatePadding() {
- boolean padded = !mKeyguardShowing || mExpanded;
- int padding = padded ? mPadding : 0;
- setPaddingRelative(padding, 0, padding, 0);
- }
-
private void updateClockLp() {
- int marginBottom = mExpanded && !mOverscrolled
+ int marginBottom = mExpanded
? mClockMarginBottomExpanded
: mClockMarginBottomCollapsed;
LayoutParams lp = (LayoutParams) mDateGroup.getLayoutParams();
@@ -515,12 +384,9 @@
private void updateMultiUserSwitch() {
int marginEnd;
int width;
- if (mExpanded && !mOverscrolled) {
+ if (mExpanded) {
marginEnd = mMultiUserExpandedMargin;
width = mMultiUserSwitchWidthExpanded;
- } else if (mKeyguardShowing) {
- marginEnd = mMultiUserKeyguardMargin;
- width = mMultiUserSwitchWidthKeyguard;
} else {
marginEnd = mMultiUserCollapsedMargin;
width = mMultiUserSwitchWidthCollapsed;
@@ -533,19 +399,8 @@
}
}
- private void updateBatteryLevelLp() {
- int marginStart = mExpanded && !mOverscrolled
- ? mBatteryMarginExpanded
- : mBatteryMarginKeyguard;
- MarginLayoutParams lp = (MarginLayoutParams) mBatteryLevel.getLayoutParams();
- if (marginStart != lp.getMarginStart()) {
- lp.setMarginStart(marginStart);
- mBatteryLevel.setLayoutParams(lp);
- }
- }
-
public void setExpansion(float t) {
- if (mOverscrolled) {
+ if (!mExpanded) {
t = 0f;
}
mCurrentT = t;
@@ -580,6 +435,9 @@
mSignalCluster = systemIcons.findViewById(R.id.signal_cluster);
mSystemIcons = systemIcons;
updateVisibilities();
+ if (mStatusIcons != null) {
+ mStatusIcons.setVisibility(View.GONE);
+ }
}
public void onSystemIconsDetached() {
@@ -598,20 +456,6 @@
mSystemIcons = null;
}
- public void setKeyguardShowing(boolean keyguardShowing) {
- mKeyguardShowing = keyguardShowing;
- updateHeights();
- updateWidth();
- updateVisibilities();
- updateZTranslation();
- updatePadding();
- updateMultiUserSwitch();
- updateClickTargets();
- updateBatteryLevelPaddingEnd();
- updateAvatarScale();
- mCaptureValues = true;
- }
-
public void setUserInfoController(UserInfoController userInfoController) {
userInfoController.addListener(new UserInfoController.OnUserInfoChangedListener() {
@Override
@@ -651,11 +495,6 @@
mMultiUserSwitch.setQsPanel(qsp);
}
- public void setKeyguarUserSwitcher(KeyguardUserSwitcher keyguardUserSwitcher) {
- mKeyguardUserSwitcher = keyguardUserSwitcher;
- mMultiUserSwitch.setKeyguardUserSwitcher(keyguardUserSwitcher);
- }
-
@Override
public boolean shouldDelayChildPressedState() {
return true;
@@ -668,17 +507,6 @@
}
}
- public void setKeyguardUserSwitcherShowing(boolean showing) {
- mKeyguardUserSwitcherShowing = showing;
- updateVisibilities();
- updateSystemIconsLayoutParams();
- }
-
- @Override
- public boolean hasOverlappingRendering() {
- return !mKeyguardShowing || mExpanded;
- }
-
@Override
protected void dispatchSetPressed(boolean pressed) {
// We don't want that everything lights up when we click on the header, so block the request
@@ -700,11 +528,11 @@
target.batteryY = mSystemIconsSuperContainer.getTop() + mSystemIconsContainer.getTop();
target.batteryLevelAlpha = getAlphaForVisibility(mBatteryLevel);
target.settingsAlpha = getAlphaForVisibility(mSettingsButton);
- target.settingsTranslation = mExpanded && !mOverscrolled
+ target.settingsTranslation = mExpanded
? 0
: mMultiUserSwitch.getLeft() - mSettingsButton.getLeft();
target.signalClusterAlpha = mSignalClusterDetached ? 0f : 1f;
- target.settingsRotation = !mExpanded || mOverscrolled ? 90f : 0f;
+ target.settingsRotation = !mExpanded ? 90f : 0f;
}
private float getAlphaForVisibility(View v) {
@@ -735,7 +563,7 @@
mMultiUserAvatar.setY(values.avatarY - mMultiUserSwitch.getTop());
mSystemIconsSuperContainer.setX(values.batteryX - mSystemIconsContainer.getRight());
mSystemIconsSuperContainer.setY(values.batteryY - mSystemIconsContainer.getTop());
- if (mSignalCluster != null && mExpanded && !mOverscrolled) {
+ if (mSignalCluster != null && mExpanded) {
mSignalCluster.setX(mSystemIconsSuperContainer.getX()
- mSignalCluster.getWidth());
mSignalCluster.setY(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java
index 2be566c..6795842 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java
@@ -16,10 +16,6 @@
package com.android.systemui.statusbar.policy;
-import com.android.systemui.R;
-import com.android.systemui.statusbar.phone.StatusBarHeaderView;
-import com.android.systemui.statusbar.phone.UserAvatarView;
-
import android.content.Context;
import android.database.DataSetObserver;
import android.provider.Settings;
@@ -29,6 +25,10 @@
import android.view.ViewStub;
import android.widget.TextView;
+import com.android.systemui.R;
+import com.android.systemui.statusbar.phone.KeyguardStatusBarView;
+import com.android.systemui.statusbar.phone.UserAvatarView;
+
/**
* Manages the user switcher on the Keyguard.
*/
@@ -40,23 +40,23 @@
"lockscreenSimpleUserSwitcher";
private final ViewGroup mUserSwitcher;
- private final StatusBarHeaderView mHeader;
+ private final KeyguardStatusBarView mStatusBarView;
private final Adapter mAdapter;
private final boolean mSimpleUserSwitcher;
public KeyguardUserSwitcher(Context context, ViewStub userSwitcher,
- StatusBarHeaderView header, UserSwitcherController userSwitcherController) {
+ KeyguardStatusBarView statusBarView, UserSwitcherController userSwitcherController) {
if (context.getResources().getBoolean(R.bool.config_keyguardUserSwitcher) || ALWAYS_ON) {
mUserSwitcher = (ViewGroup) userSwitcher.inflate();
- mHeader = header;
- mHeader.setKeyguarUserSwitcher(this);
+ mStatusBarView = statusBarView;
+ mStatusBarView.setKeyguardUserSwitcher(this);
mAdapter = new Adapter(context, userSwitcherController);
mAdapter.registerDataSetObserver(mDataSetObserver);
mSimpleUserSwitcher = Settings.Global.getInt(context.getContentResolver(),
SIMPLE_USER_SWITCHER_GLOBAL_SETTING, 0) != 0;
} else {
mUserSwitcher = null;
- mHeader = null;
+ mStatusBarView = null;
mAdapter = null;
mSimpleUserSwitcher = false;
}
@@ -84,7 +84,7 @@
if (mUserSwitcher != null) {
// TODO: animate
mUserSwitcher.setVisibility(View.VISIBLE);
- mHeader.setKeyguardUserSwitcherShowing(true);
+ mStatusBarView.setKeyguardUserSwitcherShowing(true);
}
}
@@ -92,7 +92,7 @@
if (mUserSwitcher != null) {
// TODO: animate
mUserSwitcher.setVisibility(View.GONE);
- mHeader.setKeyguardUserSwitcherShowing(false);
+ mStatusBarView.setKeyguardUserSwitcherShowing(false);
}
}