diff options
author | Jim Miller <jaggies@google.com> | 2012-04-27 17:33:44 -0700 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2012-05-06 22:39:18 -0700 |
commit | 354619c1cc1b4668c81c5368b2256335cc9e8538 (patch) | |
tree | ee4afffcfe5988d5ce3e5562e9712cd97b2c00e4 /packages/SystemUI | |
parent | b709528407614642b2384063426d60ea12490607 (diff) | |
download | frameworks_base-354619c1cc1b4668c81c5368b2256335cc9e8538.zip frameworks_base-354619c1cc1b4668c81c5368b2256335cc9e8538.tar.gz frameworks_base-354619c1cc1b4668c81c5368b2256335cc9e8538.tar.bz2 |
Fix 6397736: Swipe up to search layout fixes
This fixes several layout issues on phones and tablets with MultiWaveView.
It adds a new background scrim to be shown behind the MultiWaveView
on the navigation bar.
MultiWaveView is updated to handle gravity constraints which makes layouts
much more flexible across devices.
Change-Id: I64068f4eaa81ef6c464247049117d53432fcacbd
Diffstat (limited to 'packages/SystemUI')
13 files changed, 139 insertions, 43 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/navbar_search_bg_scrim.9.png b/packages/SystemUI/res/drawable-hdpi/navbar_search_bg_scrim.9.png Binary files differnew file mode 100644 index 0000000..4c163a2 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/navbar_search_bg_scrim.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/navbar_search_bg_scrim.9.png b/packages/SystemUI/res/drawable-mdpi/navbar_search_bg_scrim.9.png Binary files differnew file mode 100644 index 0000000..21c5abd --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/navbar_search_bg_scrim.9.png diff --git a/packages/SystemUI/res/drawable-xhdpi/navbar_search_bg_scrim.9.png b/packages/SystemUI/res/drawable-xhdpi/navbar_search_bg_scrim.9.png Binary files differnew file mode 100644 index 0000000..7874c63 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/navbar_search_bg_scrim.9.png diff --git a/packages/SystemUI/res/drawable/navbar_search_bg_scrim.png b/packages/SystemUI/res/drawable/navbar_search_bg_scrim.png Binary files differdeleted file mode 100644 index d595ed2..0000000 --- a/packages/SystemUI/res/drawable/navbar_search_bg_scrim.png +++ /dev/null diff --git a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml b/packages/SystemUI/res/layout-land/status_bar_search_panel.xml index 2adee33..5d4d989 100644 --- a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml +++ b/packages/SystemUI/res/layout-land/status_bar_search_panel.xml @@ -34,17 +34,18 @@ <RelativeLayout android:id="@+id/search_panel_container" - android:layout_width="230dip" + android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentRight="true"> <com.android.internal.widget.multiwaveview.MultiWaveView android:id="@+id/multi_wave_view" android:orientation="vertical" - android:layout_width="match_parent" + android:layout_width="@dimen/navbar_search_panel_height" android:layout_height="match_parent" android:layout_alignParentBottom="true" android:background="@drawable/navbar_search_bg_scrim" + android:gravity="left" prvandroid:targetDrawables="@array/navbar_search_targets" prvandroid:targetDescriptions="@array/navbar_search_target_descriptions" @@ -54,8 +55,6 @@ prvandroid:outerRadius="@dimen/navbar_search_target_placement_radius" prvandroid:snapMargin="@dimen/navbar_search_snap_margin" prvandroid:hitRadius="@dimen/navbar_search_hit_radius" - prvandroid:verticalOffset="0dip" - prvandroid:horizontalOffset="60dip" prvandroid:feedbackCount="0" prvandroid:vibrationDuration="0" prvandroid:alwaysTrackFinger="true"/> diff --git a/packages/SystemUI/res/layout-port/status_bar_search_panel.xml b/packages/SystemUI/res/layout-port/status_bar_search_panel.xml index 463fa04..2486b75 100644 --- a/packages/SystemUI/res/layout-port/status_bar_search_panel.xml +++ b/packages/SystemUI/res/layout-port/status_bar_search_panel.xml @@ -35,16 +35,17 @@ <RelativeLayout android:id="@+id/search_panel_container" android:layout_width="match_parent" - android:layout_height="230dip" + android:layout_height="wrap_content" android:layout_alignParentBottom="true"> <com.android.internal.widget.multiwaveview.MultiWaveView android:id="@+id/multi_wave_view" android:orientation="horizontal" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="@dimen/navbar_search_panel_height" android:layout_alignParentBottom="true" android:background="@drawable/navbar_search_bg_scrim" + android:gravity="top" prvandroid:targetDrawables="@array/navbar_search_targets" prvandroid:targetDescriptions="@array/navbar_search_target_descriptions" @@ -54,8 +55,6 @@ prvandroid:outerRadius="@dimen/navbar_search_target_placement_radius" prvandroid:snapMargin="@dimen/navbar_search_snap_margin" prvandroid:hitRadius="@dimen/navbar_search_hit_radius" - prvandroid:horizontalOffset="0dip" - prvandroid:verticalOffset="60dip" prvandroid:feedbackCount="0" prvandroid:vibrationDuration="0" prvandroid:alwaysTrackFinger="true"/> diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml index 6e33e27..4b2fbc7 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml @@ -29,23 +29,32 @@ <RelativeLayout android:id="@+id/search_bg_protect" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="0dip"> + android:layout_height="wrap_content"> <RelativeLayout android:id="@+id/search_panel_container" android:layout_width="wrap_content" - android:layout_height="230dip" + android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:layout_alignParentLeft="true"> + android:layout_centerHorizontal="true"> + + <View + android:layout_width="0dip" + android:layout_height="0dip" + android:layout_alignTop="@id/multi_wave_view" + android:layout_alignLeft="@id/multi_wave_view" + android:layout_alignRight="@id/multi_wave_view" + android:layout_alignBottom="@id/multi_wave_view" + android:layout_marginBottom="@dimen/navigation_bar_size" + android:background="@drawable/navbar_search_bg_scrim"/> <com.android.internal.widget.multiwaveview.MultiWaveView android:id="@+id/multi_wave_view" android:orientation="horizontal" android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_height="@dimen/navbar_search_panel_height" android:layout_alignParentBottom="true" - android:background="@drawable/navbar_search_bg_scrim" + android:gravity="top" prvandroid:targetDrawables="@array/navbar_search_targets" prvandroid:targetDescriptions="@array/navbar_search_target_descriptions" @@ -55,8 +64,6 @@ prvandroid:outerRadius="@dimen/navbar_search_target_placement_radius" prvandroid:snapMargin="@dimen/navbar_search_snap_margin" prvandroid:hitRadius="@dimen/navbar_search_hit_radius" - prvandroid:horizontalOffset="0dip" - prvandroid:verticalOffset="60dip" prvandroid:feedbackCount="0" prvandroid:vibrationDuration="0" prvandroid:alwaysTrackFinger="true"/> diff --git a/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml b/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml new file mode 100644 index 0000000..b4872c7 --- /dev/null +++ b/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* apps/common/assets/default/default/skins/StatusBar.xml +** +** 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. +*/ +--> + +<com.android.systemui.SearchPanelView + xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android" + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/search_panel_container" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:paddingBottom="0dip"> + + <RelativeLayout + android:id="@+id/search_bg_protect" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <RelativeLayout + android:id="@+id/search_panel_container" + android:layout_width="wrap_content" + android:layout_height="@dimen/navbar_search_panel_height" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true"> + + <View + android:layout_width="0dip" + android:layout_height="0dip" + android:layout_alignTop="@id/multi_wave_view" + android:layout_alignLeft="@id/multi_wave_view" + android:layout_alignRight="@id/multi_wave_view" + android:layout_alignBottom="@id/multi_wave_view" + android:layout_marginBottom="@dimen/navigation_bar_size" + android:background="@drawable/navbar_search_bg_scrim"/> + + <com.android.internal.widget.multiwaveview.MultiWaveView + android:id="@+id/multi_wave_view" + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_alignParentBottom="true" + + prvandroid:targetDrawables="@array/navbar_search_targets" + prvandroid:targetDescriptions="@array/navbar_search_target_descriptions" + prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions" + prvandroid:handleDrawable="@drawable/navbar_search_handle" + prvandroid:waveDrawable="@drawable/navbar_search_outerring" + prvandroid:outerRadius="@dimen/navbar_search_target_placement_radius" + prvandroid:snapMargin="@dimen/navbar_search_snap_margin" + prvandroid:hitRadius="@dimen/navbar_search_hit_radius" + prvandroid:feedbackCount="0" + prvandroid:vibrationDuration="0" + prvandroid:alwaysTrackFinger="true"/> + + </RelativeLayout> + + </RelativeLayout> + +</com.android.systemui.SearchPanelView> diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index 43ae557..50a61b1 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -19,11 +19,21 @@ <!-- 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> + <!-- 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> + + <!-- Default target placement radius for navigation bar search target --> + <dimen name="navbar_search_target_placement_radius">182dip</dimen> + + <!-- Diameter of outer shape drawable shown in navbar search--> + <dimen name="navbar_search_outerring_diameter">364dp</dimen> + + <!-- Height of search panel including navigation bar height --> + <dimen name="navbar_search_panel_height">300dip</dimen> + </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index e92dbc5..276d74b 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -116,13 +116,19 @@ <dimen name="navbar_search_hit_radius">60dip</dimen> <!-- Diameter of outer shape drawable shown in navbar search--> - <dimen name="navbar_search_outerring_diameter">300dip</dimen> + <dimen name="navbar_search_outerring_diameter">270dp</dimen> + + <!-- Threshold for swipe-up gesture to activate search dialog --> + <dimen name="navbar_search_up_threshhold">20dip</dimen> + + <!-- Height of search panel including navigation bar height --> + <dimen name="navbar_search_panel_height">230dip</dimen> <!-- 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> + <!-- 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 --> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java index f725724..e074a80 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java @@ -16,22 +16,28 @@ package com.android.systemui.statusbar; +import android.util.Slog; import android.view.MotionEvent; import android.view.Surface; -import android.view.VelocityTracker; import android.view.View; +import com.android.systemui.R; + public class DelegateViewHelper { - private static final int VELOCITY_THRESHOLD = 1000; - private VelocityTracker mVelocityTracker; private View mDelegateView; private View mSourceView; private BaseStatusBar mBar; private int[] mTempPoint = new int[2]; + private float[] mDownPoint = new float[2]; private int mOrientation; + private float mTriggerThreshhold; public DelegateViewHelper(View sourceView) { mSourceView = sourceView; + if (mSourceView != null) { + mTriggerThreshhold = mSourceView.getContext().getResources() + .getDimension(R.dimen.navbar_search_up_threshhold); + } } public void setDelegateView(View view) { @@ -49,30 +55,25 @@ public class DelegateViewHelper { public boolean onInterceptTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: - mVelocityTracker = VelocityTracker.obtain(); - break; - case MotionEvent.ACTION_CANCEL: - case MotionEvent.ACTION_UP: - mVelocityTracker.recycle(); - mVelocityTracker = null; + mDownPoint[0] = event.getX(); + mDownPoint[1] = event.getY(); break; } - if (mVelocityTracker != null) { - if (mDelegateView != null && mDelegateView.getVisibility() != View.VISIBLE) { - mVelocityTracker.addMovement(event); - mVelocityTracker.computeCurrentVelocity(1000); + if (mDelegateView != null) { + if (mDelegateView.getVisibility() != View.VISIBLE && event.getAction() != MotionEvent.ACTION_CANCEL) { final boolean isVertical = (mOrientation == Surface.ROTATION_90 || mOrientation == Surface.ROTATION_270); - float velocity = isVertical ? - mVelocityTracker.getXVelocity() - : - mVelocityTracker.getYVelocity(); - if (velocity > VELOCITY_THRESHOLD) { - if (mDelegateView != null && mDelegateView.getVisibility() != View.VISIBLE) { + final int historySize = event.getHistorySize(); + for (int k = 0; k < historySize + 1; k++) { + float x = k < historySize ? event.getHistoricalX(k) : event.getX(); + float y = k < historySize ? event.getHistoricalY(k) : event.getY(); + final float distance = isVertical ? (mDownPoint[0] - x) : (mDownPoint[1] - y); + if (distance > mTriggerThreshhold) { mBar.showSearchPanel(); + break; } } } - } - if (mDelegateView != null) { mSourceView.getLocationOnScreen(mTempPoint); float deltaX = mTempPoint[0]; float deltaY = mTempPoint[1]; 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 3b00300..ed1445d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -451,7 +451,7 @@ public class PhoneStatusBar extends BaseStatusBar { @Override protected void updateSearchPanel() { super.updateSearchPanel(); - mSearchPanelView.setStatusBarView(mStatusBarView); + mSearchPanelView.setStatusBarView(mNavigationBarView); mNavigationBarView.setDelegateView(mSearchPanelView); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 6e87dd7..6fd8e42 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -1072,8 +1072,8 @@ public class TabletStatusBar extends BaseStatusBar implements mTicker.halt(); } } - if ((diff & (StatusBarManager.DISABLE_RECENT - | StatusBarManager.DISABLE_BACK + if ((diff & (StatusBarManager.DISABLE_RECENT + | StatusBarManager.DISABLE_BACK | StatusBarManager.DISABLE_HOME)) != 0) { setNavigationVisibility(state); |