diff options
7 files changed, 87 insertions, 27 deletions
diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml index 1b35537..585658e 100644 --- a/packages/SystemUI/res/layout/status_bar.xml +++ b/packages/SystemUI/res/layout/status_bar.xml @@ -77,26 +77,24 @@ <LinearLayout android:id="@+id/system_icon_area" android:layout_width="wrap_content" android:layout_height="match_parent" - android:orientation="horizontal"> - - <LinearLayout android:id="@+id/statusIcons" + android:orientation="horizontal" + > + <LinearLayout android:id="@+id/system_icons" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" - android:orientation="horizontal"/> - - <LinearLayout - android:id="@+id/signal_battery_cluster" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:paddingStart="2dp" - android:orientation="horizontal" - android:gravity="center" > - <include layout="@layout/signal_cluster_view" + <LinearLayout 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 @@ -107,7 +105,6 @@ android:layout_marginStart="4dip" /> </LinearLayout> - <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_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml index adfa1e4..3759f82 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml @@ -65,6 +65,12 @@ /> </RelativeLayout> + <FrameLayout android:id="@+id/system_icons_container" + android:layout_width="wrap_content" + android:layout_height="@dimen/status_bar_header_height" + android:layout_alignParentEnd="true" + android:layout_marginEnd="16dp" + /> <TextView android:id="@+id/header_debug_info" android:visibility="invisible" diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml index f9b022c..e95f3c3 100644 --- a/packages/SystemUI/res/layout/super_status_bar.xml +++ b/packages/SystemUI/res/layout/super_status_bar.xml @@ -37,7 +37,8 @@ <include layout="@layout/status_bar_expanded" android:layout_width="@dimen/notification_panel_width" android:layout_height="match_parent" - android:layout_gravity="start|top" /> + android:layout_gravity="start|top" + android:visibility="gone" /> </com.android.systemui.statusbar.phone.PanelHolder> </com.android.systemui.statusbar.phone.StatusBarWindowView> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index c6fdc16..50df706 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -153,7 +153,7 @@ <dimen name="close_handle_underlap">32dp</dimen> <!-- Height of the status bar header bar --> - <dimen name="status_bar_header_height">48dp</dimen> + <dimen name="status_bar_header_height">56dp</dimen> <!-- Height of the status bar header bar when expanded --> <dimen name="status_bar_header_height_expanded">144dp</dimen> 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 377ef9c..c74911f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -24,9 +24,11 @@ import android.util.AttributeSet; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; +import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; +import android.widget.LinearLayout; import com.android.systemui.R; import com.android.systemui.statusbar.ExpandableView; @@ -424,6 +426,34 @@ public class NotificationPanelView extends PanelView implements } @Override + public void setVisibility(int visibility) { + int oldVisibility = getVisibility(); + super.setVisibility(visibility); + if (visibility != oldVisibility) { + reparentStatusIcons(visibility == VISIBLE); + } + } + + /** + * When the notification panel gets expanded, we need to move the status icons in the header + * card. + */ + private void reparentStatusIcons(boolean toHeader) { + if (mStatusBar == null) { + return; + } + LinearLayout systemIcons = mStatusBar.getSystemIcons(); + if (systemIcons.getParent() != null) { + ((ViewGroup) systemIcons.getParent()).removeView(systemIcons); + } + if (toHeader) { + mHeader.attachSystemIcons(systemIcons); + } else { + mStatusBar.reattachSystemIcons(); + } + } + + @Override protected boolean isScrolledToBottom() { if (!isInSettings()) { return mNotificationStackScroller.isScrolledToBottom(); 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 fa31b33..a9a504e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -29,7 +29,6 @@ import static com.android.systemui.statusbar.phone.BarTransitions.MODE_TRANSLUCE import android.animation.Animator; import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.app.ActivityManager; import android.app.ActivityManagerNative; @@ -205,6 +204,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // right-hand icons LinearLayout mSystemIconArea; + LinearLayout mSystemIcons; // left-hand icons LinearLayout mStatusIcons; @@ -230,7 +230,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, QuickSettingsContainerView mSettingsContainer; // top bar - View mNotificationPanelHeader; + StatusBarHeaderView mHeader; View mKeyguardStatusView; KeyguardBottomAreaView mKeyguardBottomArea; boolean mLeaveOpenOnKeyguardHide; @@ -607,6 +607,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mPixelFormat = PixelFormat.OPAQUE; mSystemIconArea = (LinearLayout) mStatusBarView.findViewById(R.id.system_icon_area); + mSystemIcons = (LinearLayout) mStatusBarView.findViewById(R.id.system_icons); mStatusIcons = (LinearLayout)mStatusBarView.findViewById(R.id.statusIcons); mNotificationIcons = (IconMerger)mStatusBarView.findViewById(R.id.notificationIcons); mMoreIcon = mStatusBarView.findViewById(R.id.moreIcon); @@ -631,7 +632,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mExpandedContents = mStackScroller; - mNotificationPanelHeader = mStatusBarWindow.findViewById(R.id.header); + mHeader = (StatusBarHeaderView) mStatusBarWindow.findViewById(R.id.header); mKeyguardStatusView = mStatusBarWindow.findViewById(R.id.keyguard_status_view); mKeyguardBottomArea = (KeyguardBottomAreaView) mStatusBarWindow.findViewById(R.id.keyguard_bottom_area); @@ -640,7 +641,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, R.id.keyguard_indication_text); mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date); - mDateTimeView = mNotificationPanelHeader.findViewById(R.id.datetime); + mDateTimeView = mHeader.findViewById(R.id.datetime); if (mDateTimeView != null) { mDateTimeView.setOnClickListener(mClockClickListener); mDateTimeView.setEnabled(true); @@ -2717,19 +2718,16 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mKeyguardIndicationTextView.setVisibility(View.VISIBLE); mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase); mKeyguardCarrierLabel.setVisibility(View.VISIBLE); - mNotificationPanelHeader.setVisibility(View.GONE); mNotificationPanel.closeQs(); - mSettingsContainer.setKeyguardShowing(true); } else { mKeyguardStatusView.setVisibility(View.GONE); mKeyguardBottomArea.setVisibility(View.GONE); mKeyguardIndicationTextView.setVisibility(View.GONE); mKeyguardCarrierLabel.setVisibility(View.GONE); - mNotificationPanelHeader.setVisibility(View.VISIBLE); - - mSettingsContainer.setKeyguardShowing(false); } + mSettingsContainer.setKeyguardShowing(mState == StatusBarState.KEYGUARD); + mHeader.setKeyguardShowing(mState == StatusBarState.KEYGUARD); updateStackScrollerState(); updatePublicMode(); @@ -2885,4 +2883,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public ViewGroup getQuickSettingsOverlayParent() { return mNotificationPanel; } + + public LinearLayout getSystemIcons() { + return mSystemIcons; + } + + /** + * Reattaches the system icons to its normal parent in collapsed status bar. + */ + public void reattachSystemIcons() { + mSystemIconArea.addView(mSystemIcons, 0); + } } 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 fd53d15..6b3c94e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java @@ -32,6 +32,8 @@ public class StatusBarHeaderView extends RelativeLayout { private boolean mExpanded; private View mBackground; + private ViewGroup mSystemIconsContainer; + private View mDateTime; private int mCollapsedHeight; private int mExpandedHeight; @@ -44,12 +46,13 @@ public class StatusBarHeaderView extends RelativeLayout { protected void onFinishInflate() { super.onFinishInflate(); mBackground = findViewById(R.id.background); + mSystemIconsContainer = (ViewGroup) findViewById(R.id.system_icons_container); + mDateTime = findViewById(R.id.datetime); loadDimens(); } private void loadDimens() { - mCollapsedHeight = getResources().getDimensionPixelSize( - R.dimen.status_bar_header_height); + mCollapsedHeight = getResources().getDimensionPixelSize(R.dimen.status_bar_header_height); mExpandedHeight = getResources().getDimensionPixelSize( R.dimen.status_bar_header_height_expanded); } @@ -88,4 +91,18 @@ public class StatusBarHeaderView extends RelativeLayout { public View getBackgroundView() { return mBackground; } + + public void attachSystemIcons(LinearLayout systemIcons) { + mSystemIconsContainer.addView(systemIcons); + } + + public void setKeyguardShowing(boolean keyguardShowing) { + mBackground.setVisibility(keyguardShowing ? View.INVISIBLE : View.VISIBLE); + mDateTime.setVisibility(keyguardShowing ? View.INVISIBLE : View.VISIBLE); + if (keyguardShowing) { + setZ(0); + } else { + setTranslationZ(0); + } + } } |