diff options
author | Daniel Sandler <dsandler@android.com> | 2012-05-02 15:07:51 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2012-05-03 01:14:07 -0400 |
commit | 21b274e8a05d83e2a6996aaeec619deaca728de4 (patch) | |
tree | 221df041ed7982a26f868d19cb283a064b8ff2f9 /packages | |
parent | 22930da77f7c2d0461474a162d0d25b9dca00875 (diff) | |
download | frameworks_base-21b274e8a05d83e2a6996aaeec619deaca728de4.zip frameworks_base-21b274e8a05d83e2a6996aaeec619deaca728de4.tar.gz frameworks_base-21b274e8a05d83e2a6996aaeec619deaca728de4.tar.bz2 |
Large-screen notification panel size + positioning.
On sw600 devices we show the notification panel in a smaller
rectangle, centered in portrait and left-aligned in
landscape.
Also remove a bunch of -large resources that shouldn't be
used anymore.
Bug: 6297838
Change-Id: I8ed3445ccb7df16e30870a4322d89786467c54df
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/res/layout-sw600dp/super_status_bar.xml | 38 | ||||
-rw-r--r-- | packages/SystemUI/res/layout/status_bar_expanded.xml | 204 | ||||
-rw-r--r-- | packages/SystemUI/res/values-large-port/dimens.xml | 24 | ||||
-rw-r--r-- | packages/SystemUI/res/values-large/colors.xml | 6 | ||||
-rw-r--r-- | packages/SystemUI/res/values-large/config.xml | 26 | ||||
-rw-r--r-- | packages/SystemUI/res/values-large/dimens.xml | 27 | ||||
-rw-r--r-- | packages/SystemUI/res/values-large/strings.xml | 33 | ||||
-rw-r--r-- | packages/SystemUI/res/values-sw600dp-land/dimens.xml | 26 | ||||
-rw-r--r-- | packages/SystemUI/res/values-sw600dp-port/config.xml | 25 | ||||
-rw-r--r-- | packages/SystemUI/res/values-sw600dp-port/dimens.xml | 28 | ||||
-rw-r--r-- | packages/SystemUI/res/values-sw600dp/dimens.xml | 29 | ||||
-rw-r--r-- | packages/SystemUI/res/values/dimens.xml | 8 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 150 |
13 files changed, 248 insertions, 376 deletions
diff --git a/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml new file mode 100644 index 0000000..8e86234 --- /dev/null +++ b/packages/SystemUI/res/layout-sw600dp/super_status_bar.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +** +** Copyright 2012, 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. +*/ +--> + +<!-- This is the combined status bar / notification panel window. --> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" + android:fitsSystemWindows="true" + > + + <include layout="@layout/status_bar_expanded" + android:layout_width="@dimen/notification_panel_width" + android:layout_height="match_parent" + android:layout_gravity="center_horizontal|top" + /> + + <include layout="@layout/status_bar" + android:layout_width="match_parent" + android:layout_height="@*android:dimen/status_bar_height" + /> + +</FrameLayout> diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index eb1e1c0..1de4ab8 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -21,120 +21,114 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui" - android:focusable="true" - android:descendantFocusability="afterDescendants" + android:id="@+id/notification_panel" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:background="@drawable/notification_tracking_bg" + android:paddingTop="@*android:dimen/status_bar_height" + android:layout_marginLeft="@dimen/notification_panel_margin_left" > - <FrameLayout + <RelativeLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:id="@+id/notification_panel" - android:background="@drawable/notification_tracking_bg" - android:paddingTop="@*android:dimen/status_bar_height" + android:layout_height="52dp" + android:paddingTop="3dp" + android:paddingBottom="5dp" + android:paddingRight="3dp" + android:background="@drawable/notification_header_bg" > + <com.android.systemui.statusbar.policy.DateView android:id="@+id/date" + android:textAppearance="@style/TextAppearance.StatusBar.Date" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_alignParentLeft="true" + android:singleLine="true" + android:gravity="center_vertical|left" + android:paddingLeft="16dp" + /> + <!-- + <com.android.systemui.statusbar.phone.CarrierLabel + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginTop="1dp" + android:layout_marginLeft="5dp" + android:layout_gravity="center_vertical" + android:paddingBottom="1dp" + android:paddingLeft="4dp" + android:textAppearance="?android:attr/textAppearanceLarge" + android:textColor="?android:attr/textColorSecondary" + /> + --> - <RelativeLayout - android:layout_width="match_parent" - android:layout_height="52dp" - android:paddingTop="3dp" - android:paddingBottom="5dp" - android:paddingRight="3dp" - android:background="@drawable/notification_header_bg" - > - <com.android.systemui.statusbar.policy.DateView android:id="@+id/date" - android:textAppearance="@style/TextAppearance.StatusBar.Date" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_alignParentLeft="true" - android:singleLine="true" - android:gravity="center_vertical|left" - android:paddingLeft="16dp" - /> - <!-- - <com.android.systemui.statusbar.phone.CarrierLabel - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_marginTop="1dp" - android:layout_marginLeft="5dp" - android:layout_gravity="center_vertical" - android:paddingBottom="1dp" - android:paddingLeft="4dp" - android:textAppearance="?android:attr/textAppearanceLarge" - android:textColor="?android:attr/textColorSecondary" - /> - --> - - <ImageView android:id="@+id/settings_button" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_toRightOf="@id/date" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:src="@drawable/ic_notify_quicksettings" - android:contentDescription="@string/accessibility_settings_button" - /> - - <ImageView android:id="@+id/clear_all_button" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_alignParentRight="true" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:src="@drawable/ic_notify_clear" - android:contentDescription="@string/accessibility_clear_all" - /> - </RelativeLayout> - - <View - android:layout_width="match_parent" - android:layout_height="2dp" - android:layout_marginTop="52dp" - android:background="@drawable/status_bar_hr" + <ImageView android:id="@+id/settings_button" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_toRightOf="@id/date" + android:paddingLeft="8dp" + android:paddingRight="8dp" + android:src="@drawable/ic_notify_quicksettings" + android:contentDescription="@string/accessibility_settings_button" /> - - <ScrollView - android:id="@+id/scroll" - android:layout_width="match_parent" + + <ImageView android:id="@+id/clear_all_button" + android:layout_width="wrap_content" android:layout_height="match_parent" - android:fadingEdge="none" - android:overScrollMode="ifContentScrolls" - android:layout_marginTop="54dp" - android:layout_marginBottom="34dp" - > - <com.android.systemui.statusbar.policy.NotificationRowLayout - android:id="@+id/latestItems" - android:layout_width="match_parent" - android:layout_height="wrap_content" - systemui:rowHeight="@dimen/notification_height" - /> - </ScrollView> - - <ImageView + android:layout_alignParentRight="true" + android:paddingLeft="8dp" + android:paddingRight="8dp" + android:src="@drawable/ic_notify_clear" + android:contentDescription="@string/accessibility_clear_all" + /> + </RelativeLayout> + + <View + android:layout_width="match_parent" + android:layout_height="2dp" + android:layout_marginTop="52dp" + android:background="@drawable/status_bar_hr" + /> + + <ScrollView + android:id="@+id/scroll" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fadingEdge="none" + android:overScrollMode="ifContentScrolls" + android:layout_marginTop="54dp" + android:layout_marginBottom="34dp" + > + <com.android.systemui.statusbar.policy.NotificationRowLayout + android:id="@+id/latestItems" android:layout_width="match_parent" android:layout_height="wrap_content" - android:src="@drawable/title_bar_shadow" - android:layout_marginTop="54dp" - android:scaleType="fitXY" - /> - - <com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close" + systemui:rowHeight="@dimen/notification_height" + /> + </ScrollView> + + <ImageView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:src="@drawable/title_bar_shadow" + android:layout_marginTop="54dp" + android:scaleType="fitXY" + /> + + <com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close" + android:layout_width="match_parent" + android:layout_height="@dimen/close_handle_height" + android:layout_gravity="bottom" + android:orientation="vertical" + > + <ImageView android:layout_width="match_parent" - android:layout_height="@dimen/close_handle_height" + android:layout_height="34dp" android:layout_gravity="bottom" - android:orientation="vertical" - > - <ImageView - android:layout_width="match_parent" - android:layout_height="34dp" - android:layout_gravity="bottom" - android:scaleType="fitXY" - android:src="@drawable/status_bar_close_on" - /> - - </com.android.systemui.statusbar.phone.CloseDragHandle> - - </FrameLayout><!-- end of sliding panel --> + android:scaleType="fitXY" + android:src="@drawable/status_bar_close_on" + /> + + </com.android.systemui.statusbar.phone.CloseDragHandle> -</FrameLayout><!-- end of window -->
\ No newline at end of file +</FrameLayout><!-- end of sliding panel -->
\ No newline at end of file diff --git a/packages/SystemUI/res/values-large-port/dimens.xml b/packages/SystemUI/res/values-large-port/dimens.xml deleted file mode 100644 index 56effa3..0000000 --- a/packages/SystemUI/res/values-large-port/dimens.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - * Copyright (c) 2010, 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. -*/ ---> -<resources> - <!-- gap on either side of status bar notification icons --> - <dimen name="status_bar_icon_padding">2dp</dimen> -</resources> - - - diff --git a/packages/SystemUI/res/values-large/colors.xml b/packages/SystemUI/res/values-large/colors.xml deleted file mode 100644 index a7a70c3..0000000 --- a/packages/SystemUI/res/values-large/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <drawable name="status_bar_background">#000000</drawable> - <drawable name="notification_icon_area_smoke">#aa000000</drawable> -</resources> - diff --git a/packages/SystemUI/res/values-large/config.xml b/packages/SystemUI/res/values-large/config.xml deleted file mode 100644 index 4014f8d..0000000 --- a/packages/SystemUI/res/values-large/config.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2010, 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources> - <!-- Whether or not we show the number in the bar. --> - <bool name="config_statusBarShowNumber">false</bool> -</resources> - diff --git a/packages/SystemUI/res/values-large/dimens.xml b/packages/SystemUI/res/values-large/dimens.xml deleted file mode 100644 index 9d89e21..0000000 --- a/packages/SystemUI/res/values-large/dimens.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - * Copyright (c) 2010, 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. -*/ ---> -<resources> - <!-- The width of the ticker, including the icon --> - <dimen name="notification_ticker_width">360dp</dimen> - <!-- Status bar panel bottom offset (height of status bar - overlap) --> - <dimen name="status_bar_panel_bottom_offset">36dp</dimen> - <!-- gap on either side of status bar notification icons --> - <dimen name="status_bar_icon_padding">8dp</dimen> -</resources> - - diff --git a/packages/SystemUI/res/values-large/strings.xml b/packages/SystemUI/res/values-large/strings.xml deleted file mode 100644 index f04dc04..0000000 --- a/packages/SystemUI/res/values-large/strings.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright (c) 2010, 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. - */ ---> -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <!-- The text for the button in the notification window-shade that clears - all of the currently visible notifications. [CHAR LIMIT=10]--> - <string name="status_bar_clear_all_button">Clear all</string> - - <!-- Separator for PLMN and SPN in network name. --> - <string name="status_bar_network_name_separator" translatable="false">" – "</string> - - <!-- Title for the pseudo-notification shown when notifications are disabled (do-not-disturb - mode) --> - <string name="notifications_off_title">Notifications off</string> - - <!-- Content text for do-not-disturb mode notification --> - <string name="notifications_off_text">Tap here to turn notifications back on.</string> -</resources> diff --git a/packages/SystemUI/res/values-sw600dp-land/dimens.xml b/packages/SystemUI/res/values-sw600dp-land/dimens.xml new file mode 100644 index 0000000..afa0b20 --- /dev/null +++ b/packages/SystemUI/res/values-sw600dp-land/dimens.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (c) 2012, 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. +*/ +--> +<resources> + <!-- Layout parameters for the notification panel --> + <dimen name="notification_panel_margin_bottom">0dp</dimen> + <dimen name="notification_panel_margin_left">32dp</dimen> + + <!-- Gravity for the notification panel --> + <!-- 0x33 = left|top --> + <integer name="notification_panel_layout_gravity">0x33</integer> +</resources> diff --git a/packages/SystemUI/res/values-sw600dp-port/config.xml b/packages/SystemUI/res/values-sw600dp-port/config.xml deleted file mode 100644 index ab7661a..0000000 --- a/packages/SystemUI/res/values-sw600dp-port/config.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2011, 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. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources> - <integer name="config_maxNotificationIcons">3</integer> -</resources> - diff --git a/packages/SystemUI/res/values-sw600dp-port/dimens.xml b/packages/SystemUI/res/values-sw600dp-port/dimens.xml deleted file mode 100644 index 39eade6..0000000 --- a/packages/SystemUI/res/values-sw600dp-port/dimens.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - * Copyright (c) 2011, 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. -*/ ---> -<resources> - <!-- gap on either side of status bar notification icons --> - <dimen name="status_bar_icon_padding">0dp</dimen> - - <!-- The width of the view containing non-menu status bar icons --> - <dimen name="navigation_key_width">70dip</dimen> - - <!-- The width of the view containing the menu status bar icon --> - <dimen name="navigation_menu_key_width">40dip</dimen> -</resources> - diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml new file mode 100644 index 0000000..43ae557 --- /dev/null +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (c) 2012, 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. +*/ +--> +<resources> + <!-- The width of the notification panel window --> + <dimen name="notification_panel_width">446dp</dimen> + + <!-- Layout parameters for the notification panel --> + <dimen name="notification_panel_margin_bottom">192dp</dimen> + <dimen name="notification_panel_margin_left">0dp</dimen> + + <!-- Gravity for the notification panel --> + <!-- 0x33 = center_horizontal|top --> + <integer name="notification_panel_layout_gravity">0x31</integer> +</resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index f7b8cc9..e92dbc5 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -120,4 +120,12 @@ <!-- Height of the draggable handle at the bottom of the phone notification panel --> <dimen name="close_handle_height">34dp</dimen> + + <!-- Layout parameters for the notification panel --> + <dimen name="notification_panel_margin_bottom">0dp</dimen> + <dimen name="notification_panel_margin_left">0dp</dimen> + + <!-- Gravity for the notification panel --> + <!-- 0x37 = fill_horizontal|top --> + <integer name="notification_panel_layout_gravity">0x37</integer> </resources> 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 0125b64..48f5f27 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -46,6 +46,7 @@ import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; import android.util.Slog; +import android.util.TypedValue; import android.view.Display; import android.view.Gravity; import android.view.IWindowManager; @@ -61,6 +62,7 @@ import android.view.WindowManagerImpl; import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RemoteViews; @@ -158,6 +160,9 @@ public class PhoneStatusBar extends BaseStatusBar { View mNotificationPanel; // the sliding/resizing panel within the notification window ScrollView mScrollView; View mExpandedContents; + int mNotificationPanelMarginBottomPx, mNotificationPanelMarginLeftPx; + int mNotificationPanelGravity; + // top bar View mClearButton; View mSettingsButton; @@ -279,6 +284,17 @@ public class PhoneStatusBar extends BaseStatusBar { if (DEBUG) { mStatusBarWindow.setBackgroundColor(0x6000FF80); } + mStatusBarWindow.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + if (mExpanded && !mAnimating) { + animateCollapse(); + } + } + return true; + }}); + mStatusBarView = (PhoneStatusBarView) mStatusBarWindow.findViewById(R.id.status_bar); mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel); @@ -1111,7 +1127,7 @@ public class PhoneStatusBar extends BaseStatusBar { // Expand the window to encompass the full screen in anticipation of the drag. // This is only possible to do atomically because the status bar is at the top of the screen! WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams(); - lp.height = mDisplayMetrics.heightPixels; + lp.height = ViewGroup.LayoutParams.MATCH_PARENT; final WindowManager wm = WindowManagerImpl.getDefault(); wm.updateViewLayout(mStatusBarWindow, lp); @@ -1162,7 +1178,7 @@ public class PhoneStatusBar extends BaseStatusBar { if (mAnimating) { y = (int)mAnimY; } else { - y = mDisplayMetrics.heightPixels-1; + y = getExpandedViewMaxHeight()-1; } // Let the fling think that we're open so it goes in the right direction // and doesn't try to re-open the windowshade. @@ -1224,7 +1240,7 @@ public class PhoneStatusBar extends BaseStatusBar { if (SPEW) Slog.d(TAG, "doAnimation before mAnimY=" + mAnimY); incrementAnim(); if (SPEW) Slog.d(TAG, "doAnimation after mAnimY=" + mAnimY); - if (mAnimY >= mDisplayMetrics.heightPixels-1) { + if (mAnimY >= getExpandedViewMaxHeight()-1) { if (SPEW) Slog.d(TAG, "Animation completed to expanded state."); mAnimating = false; updateExpandedViewPos(EXPANDED_FULL_OPEN); @@ -1329,7 +1345,7 @@ public class PhoneStatusBar extends BaseStatusBar { if (mExpanded) { if (!always && ( vel > mFlingCollapseMinVelocityPx - || (y > (mDisplayMetrics.heightPixels*(1f-mCollapseMinDisplayFraction)) && + || (y > (getExpandedViewMaxHeight()*(1f-mCollapseMinDisplayFraction)) && vel > -mFlingExpandMinVelocityPx))) { // We are expanded, but they didn't move sufficiently to cause // us to retract. Animate back to the expanded position. @@ -1348,7 +1364,7 @@ public class PhoneStatusBar extends BaseStatusBar { } else { if (always || ( vel > mFlingExpandMinVelocityPx - || (y > (mDisplayMetrics.heightPixels*(1f-mExpandMinDisplayFraction)) && + || (y > (getExpandedViewMaxHeight()*(1f-mExpandMinDisplayFraction)) && vel > -mFlingCollapseMinVelocityPx))) { // We are collapsed, and they moved enough to allow us to // expand. Animate in the notifications. @@ -1412,7 +1428,8 @@ public class PhoneStatusBar extends BaseStatusBar { // mViewDelta = mAbsPos[1] + mTrackingView.getHeight() - y; } if ((!mExpanded && y < hitSize) || - (mExpanded && y > (mDisplayMetrics.heightPixels-hitSize))) { + // @@ add taps outside the panel if it's not full-screen + (mExpanded && y > (getExpandedViewMaxHeight()-hitSize))) { // We drop events at the edge of the screen to make the windowshade come // down by accident less, especially when pushing open a device with a keyboard @@ -1864,15 +1881,22 @@ public class PhoneStatusBar extends BaseStatusBar { return a < 0f ? 0f : (a > 1f ? 1f : a); } + int getExpandedViewMaxHeight() { + return mDisplayMetrics.heightPixels - mNotificationPanelMarginBottomPx; + } + void updateExpandedViewPos(int expandedPosition) { if (SPEW) { Slog.d(TAG, "updateExpandedViewPos before expandedPosition=" + expandedPosition //+ " mTrackingParams.y=" + ((mTrackingParams == null) ? "?" : mTrackingParams.y) - + " mTrackingPosition=" + mTrackingPosition); + + " mTrackingPosition=" + mTrackingPosition + + " gravity=" + mNotificationPanelGravity); } int panelh = 0; - final int disph = mDisplayMetrics.heightPixels; + final boolean portrait = mDisplayMetrics.heightPixels > mDisplayMetrics.widthPixels; + + final int disph = getExpandedViewMaxHeight(); // If the expanded view is not visible, make sure they're still off screen. // Maybe the view was resized. @@ -1906,113 +1930,25 @@ public class PhoneStatusBar extends BaseStatusBar { mTrackingPosition = panelh; - final View cropView = mNotificationPanel; - ViewGroup.LayoutParams lp = cropView.getLayoutParams(); + FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationPanel.getLayoutParams(); lp.height = panelh; + lp.gravity = mNotificationPanelGravity; + lp.leftMargin = mNotificationPanelMarginLeftPx; if (SPEW) { - Slog.v(TAG, "updated cropView height=" + panelh); + Slog.v(TAG, "updated cropView height=" + panelh + " grav=" + lp.gravity); } - cropView.setLayoutParams(lp); + mNotificationPanel.setLayoutParams(lp); // woo, special effects final int barh = getCloseViewHeight() + getStatusBarHeight(); final float frac = saturate((float)(panelh - barh) / (disph - barh)); final int color = ((int)(0xB0 * Math.sin(frac * 1.57f))) << 24; mStatusBarWindow.setBackgroundColor(color); - -// Slog.d(TAG, String.format("updateExpanded: pos=%d frac=%.2f col=0x%08x", pos, frac, color)); - -// if (mExpandedParams != null) { -// if (mCloseView.getWindowVisibility() == View.VISIBLE) { -// mCloseView.getLocationInWindow(mPositionTmp); -// final int closePos = mPositionTmp[1]; -// -// mExpandedContents.getLocationInWindow(mPositionTmp); -// final int contentsBottom = mPositionTmp[1] + mExpandedContents.getHeight(); -// -// mExpandedParams.y = pos + mTrackingView.getHeight() -// - (mTrackingParams.height-closePos) - contentsBottom; -// -// if (SPEW) { -// Slog.d(PhoneStatusBar.TAG, -// "pos=" + pos + -// " trackingHeight=" + mTrackingView.getHeight() + -// " (trackingParams.height - closePos)=" + -// (mTrackingParams.height - closePos) + -// " contentsBottom=" + contentsBottom); -// } -// -// } else { -// // If the tracking view is not yet visible, then we can't have -// // a good value of the close view location. We need to wait for -// // it to be visible to do a layout. -// mExpandedParams.y = -mDisplayMetrics.heightPixels; -// } -// int max = h; -// if (mExpandedParams.y > max) { -// mExpandedParams.y = max; -// } -// int min = mTrackingPosition; -// if (mExpandedParams.y < min) { -// mExpandedParams.y = min; -// } -// -// boolean visible = (mTrackingPosition + mTrackingView.getHeight()) > h; -// if (!visible) { -// // if the contents aren't visible, move the expanded view way off screen -// // because the window itself extends below the content view. -// mExpandedParams.y = -disph; -// } -// mExpandedDialog.getWindow().setAttributes(mExpandedParams); -// -// // As long as this isn't just a repositioning that's not supposed to affect -// // the user's perception of what's showing, call to say that the visibility -// // has changed. (Otherwise, someone else will call to do that). -// if (expandedPosition != EXPANDED_LEAVE_ALONE) { -// if (SPEW) Slog.d(TAG, "updateExpandedViewPos visibilityChanged(" + visible + ")"); -// visibilityChanged(visible); -// } -// } -// -// if (SPEW) { -// Slog.d(TAG, "updateExpandedViewPos after expandedPosition=" + expandedPosition -// + " mTrackingParams.y=" + mTrackingParams.y -// + " mTrackingPosition=" + mTrackingPosition -// + " mExpandedParams.y=" + mExpandedParams.y -// + " mExpandedParams.height=" + mExpandedParams.height); -// } - } - - int getExpandedHeight() { - return mDisplayMetrics.heightPixels; } void updateDisplaySize() { mDisplay.getMetrics(mDisplayMetrics); -// if (DEBUG) { -// Slog.d(TAG, "updateDisplaySize: " + mDisplayMetrics); -// } -// updateExpandedSize(); } -// void updateExpandedSize() { -// if (DEBUG) { -// Slog.d(TAG, "updateExpandedSize()"); -// } -// if (mStatusBarWindow != null && mDisplayMetrics != null) { -// mExpandedParams.width = mDisplayMetrics.widthPixels; -// mExpandedParams.height = getExpandedHeight(); -// if (!mExpandedVisible) { -// updateExpandedInvisiblePosition(); -// } else { -// mExpandedDialog.getWindow().setAttributes(mExpandedParams); -// } -// if (DEBUG) { -// Slog.d(TAG, "updateExpandedSize: height=" + mExpandedParams.height + " " + -// (mExpandedVisible ? "VISIBLE":"INVISIBLE")); -// } -// } -// } - void performDisableActions(int net) { int old = mDisabled; int diff = net ^ old; @@ -2152,8 +2088,9 @@ public class PhoneStatusBar extends BaseStatusBar { animateCollapse(excludeRecents); } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) { - repositionNavigationBar(); updateResources(); + repositionNavigationBar(); + updateExpandedViewPos(EXPANDED_LEAVE_ALONE); } } }; @@ -2228,6 +2165,15 @@ public class PhoneStatusBar extends BaseStatusBar { mCollapseAccelPx = res.getDimension(R.dimen.collapse_accel); mFlingGestureMaxXVelocityPx = res.getDimension(R.dimen.fling_gesture_max_x_velocity); + + mNotificationPanelMarginBottomPx + = (int) res.getDimension(R.dimen.notification_panel_margin_bottom); + mNotificationPanelMarginLeftPx + = (int) res.getDimension(R.dimen.notification_panel_margin_left); + mNotificationPanelGravity = res.getInteger(R.integer.notification_panel_layout_gravity); + if (mNotificationPanelGravity <= 0) { + mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP; + } if (false) Slog.v(TAG, "updateResources"); } |