summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2012-04-27 17:33:44 -0700
committerJim Miller <jaggies@google.com>2012-05-06 22:39:18 -0700
commit354619c1cc1b4668c81c5368b2256335cc9e8538 (patch)
treeee4afffcfe5988d5ce3e5562e9712cd97b2c00e4
parentb709528407614642b2384063426d60ea12490607 (diff)
downloadframeworks_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
-rw-r--r--core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java101
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml8
-rw-r--r--core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml7
-rw-r--r--core/res/res/layout/keyguard_screen_tab_unlock.xml3
-rw-r--r--core/res/res/layout/keyguard_screen_tab_unlock_land.xml5
-rw-r--r--core/res/res/values-sw600dp-land/arrays.xml4
-rwxr-xr-xcore/res/res/values/attrs.xml11
-rw-r--r--packages/SystemUI/res/drawable-hdpi/navbar_search_bg_scrim.9.pngbin0 -> 21892 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/navbar_search_bg_scrim.9.pngbin0 -> 11004 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/navbar_search_bg_scrim.9.pngbin0 -> 34907 bytes
-rw-r--r--packages/SystemUI/res/drawable/navbar_search_bg_scrim.pngbin7955 -> 0 bytes
-rw-r--r--packages/SystemUI/res/layout-land/status_bar_search_panel.xml7
-rw-r--r--packages/SystemUI/res/layout-port/status_bar_search_panel.xml7
-rw-r--r--packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml23
-rw-r--r--packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml74
-rw-r--r--packages/SystemUI/res/values-sw600dp/dimens.xml14
-rw-r--r--packages/SystemUI/res/values/dimens.xml12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java39
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java4
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewManager.java1
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java7
22 files changed, 243 insertions, 86 deletions
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index 624dea8..3ba2bc6 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -32,6 +32,7 @@ import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
+import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
@@ -99,8 +100,11 @@ public class MultiWaveView extends View {
private float mTapRadius;
private float mWaveCenterX;
private float mWaveCenterY;
- private float mVerticalOffset;
+ private int mMaxTargetHeight;
+ private int mMaxTargetWidth;
private float mHorizontalOffset;
+ private float mVerticalOffset;
+
private float mOuterRadius = 0.0f;
private float mHitRadius = 0.0f;
private float mSnapMargin = 0.0f;
@@ -142,6 +146,9 @@ public class MultiWaveView extends View {
private int mTargetDescriptionsResourceId;
private int mDirectionDescriptionsResourceId;
private boolean mAlwaysTrackFinger;
+ private int mHorizontalInset;
+ private int mVerticalInset;
+ private int mGravity = Gravity.TOP;
public MultiWaveView(Context context) {
this(context, null);
@@ -153,10 +160,9 @@ public class MultiWaveView extends View {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MultiWaveView);
mOuterRadius = a.getDimension(R.styleable.MultiWaveView_outerRadius, mOuterRadius);
- mHorizontalOffset = a.getDimension(R.styleable.MultiWaveView_horizontalOffset,
- mHorizontalOffset);
- mVerticalOffset = a.getDimension(R.styleable.MultiWaveView_verticalOffset,
- mVerticalOffset);
+// mHorizontalOffset = a.getDimension(R.styleable.MultiWaveView_horizontalOffset,
+// mHorizontalOffset);
+// mVerticalOffset = a.getDimension(R.styleable.MultiWaveView_verticalOffset, mVerticalOffset);
mHitRadius = a.getDimension(R.styleable.MultiWaveView_hitRadius, mHitRadius);
mSnapMargin = a.getDimension(R.styleable.MultiWaveView_snapMargin, mSnapMargin);
mVibrationDuration = a.getInt(R.styleable.MultiWaveView_vibrationDuration,
@@ -169,6 +175,7 @@ public class MultiWaveView extends View {
mOuterRing = new TargetDrawable(res,
a.peekValue(R.styleable.MultiWaveView_waveDrawable).resourceId);
mAlwaysTrackFinger = a.getBoolean(R.styleable.MultiWaveView_alwaysTrackFinger, false);
+ mGravity = a.getInt(R.styleable.MultiWaveView_gravity, Gravity.TOP);
// Read chevron animation drawables
final int chevrons[] = { R.styleable.MultiWaveView_leftChevronDrawable,
@@ -231,16 +238,16 @@ public class MultiWaveView extends View {
@Override
protected int getSuggestedMinimumWidth() {
- // View should be large enough to contain the background + target drawable on either edge
- return mOuterRing.getWidth()
- + (mTargetDrawables.size() > 0 ? (mTargetDrawables.get(0).getWidth()/2) : 0);
+ // View should be large enough to contain the background + handle and
+ // target drawable on either edge.
+ return mOuterRing.getWidth() + mMaxTargetWidth;
}
@Override
protected int getSuggestedMinimumHeight() {
- // View should be large enough to contain the unlock ring + target drawable on either edge
- return mOuterRing.getHeight()
- + (mTargetDrawables.size() > 0 ? (mTargetDrawables.get(0).getHeight()/2) : 0);
+ // View should be large enough to contain the unlock ring + target and
+ // target drawable on either edge
+ return mOuterRing.getHeight() + mMaxTargetHeight;
}
private int resolveMeasured(int measureSpec, int desired)
@@ -265,9 +272,10 @@ public class MultiWaveView extends View {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int minimumWidth = getSuggestedMinimumWidth();
final int minimumHeight = getSuggestedMinimumHeight();
- int viewWidth = resolveMeasured(widthMeasureSpec, minimumWidth);
- int viewHeight = resolveMeasured(heightMeasureSpec, minimumHeight);
- setMeasuredDimension(viewWidth, viewHeight);
+ int computedWidth = resolveMeasured(widthMeasureSpec, minimumWidth);
+ int computedHeight = resolveMeasured(heightMeasureSpec, minimumHeight);
+ setupGravity((computedWidth - minimumWidth), (computedHeight - minimumHeight));
+ setMeasuredDimension(computedWidth, computedHeight);
}
private void switchToState(int state, float x, float y) {
@@ -521,14 +529,25 @@ public class MultiWaveView extends View {
TypedArray array = res.obtainTypedArray(resourceId);
int count = array.length();
ArrayList<TargetDrawable> targetDrawables = new ArrayList<TargetDrawable>(count);
+ int maxWidth = mHandleDrawable.getWidth();
+ int maxHeight = mHandleDrawable.getHeight();
for (int i = 0; i < count; i++) {
TypedValue value = array.peekValue(i);
- targetDrawables.add(new TargetDrawable(res, value != null ? value.resourceId : 0));
+ TargetDrawable target= new TargetDrawable(res, value != null ? value.resourceId : 0);
+ targetDrawables.add(target);
+ maxWidth = Math.max(maxWidth, target.getWidth());
+ maxHeight = Math.max(maxHeight, target.getHeight());
+ }
+ if (mMaxTargetWidth != maxWidth || mMaxTargetHeight != maxHeight) {
+ mMaxTargetWidth = maxWidth;
+ mMaxTargetHeight = maxHeight;
+ requestLayout(); // required to resize layout and call updateTargetPositions()
+ } else {
+ updateTargetPositions();
}
array.recycle();
mTargetResourceId = resourceId;
mTargetDrawables = targetDrawables;
- updateTargetPositions();
}
/**
@@ -638,23 +657,27 @@ public class MultiWaveView extends View {
boolean handled = false;
switch (action) {
case MotionEvent.ACTION_DOWN:
+ if (DEBUG) Log.v(TAG, "*** DOWN ***");
handleDown(event);
handled = true;
break;
case MotionEvent.ACTION_MOVE:
+ if (DEBUG) Log.v(TAG, "*** MOVE ***");
handleMove(event);
handled = true;
break;
case MotionEvent.ACTION_UP:
+ if (DEBUG) Log.v(TAG, "*** UP ***");
handleMove(event);
handleUp(event);
handled = true;
break;
case MotionEvent.ACTION_CANCEL:
- handleMove(event);
+ if (DEBUG) Log.v(TAG, "*** CANCEL ***");
+ // handleMove(event);
handleCancel(event);
handled = true;
break;
@@ -795,6 +818,11 @@ public class MultiWaveView extends View {
}
mGrabbedState = newState;
if (mOnTriggerListener != null) {
+ if (newState == OnTriggerListener.NO_HANDLE) {
+ mOnTriggerListener.onReleased(this, OnTriggerListener.CENTER_HANDLE);
+ } else {
+ mOnTriggerListener.onGrabbed(this, OnTriggerListener.CENTER_HANDLE);
+ }
mOnTriggerListener.onGrabbedStateChange(this, mGrabbedState);
}
}
@@ -832,13 +860,45 @@ public class MultiWaveView extends View {
moveHandleTo(centerX, centerY, false);
}
+ private void setupGravity(int dx, int dy) {
+ final int layoutDirection = getResolvedLayoutDirection();
+ final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
+
+ switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
+ case Gravity.LEFT:
+ mHorizontalInset = 0;
+ break;
+ case Gravity.RIGHT:
+ mHorizontalInset = dx;
+ break;
+ case Gravity.CENTER_HORIZONTAL:
+ default:
+ mHorizontalInset = dx / 2;
+ break;
+ }
+ switch (absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK) {
+ case Gravity.TOP:
+ mVerticalInset = 0;
+ break;
+ case Gravity.BOTTOM:
+ mVerticalInset = dy;
+ break;
+ case Gravity.CENTER_VERTICAL:
+ default:
+ mVerticalInset = dy / 2;
+ break;
+ }
+ }
+
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
final int width = right - left;
final int height = bottom - top;
- float newWaveCenterX = mHorizontalOffset + Math.max(width, mOuterRing.getWidth() ) / 2;
- float newWaveCenterY = mVerticalOffset + Math.max(height, mOuterRing.getHeight()) / 2;
+ float newWaveCenterX = mHorizontalOffset + mHorizontalInset
+ + Math.max(width, mMaxTargetWidth + mOuterRing.getWidth()) / 2;
+ float newWaveCenterY = mVerticalOffset + mVerticalInset
+ + Math.max(height, + mMaxTargetHeight + mOuterRing.getHeight()) / 2;
if (newWaveCenterX != mWaveCenterX || newWaveCenterY != mWaveCenterY) {
if (mWaveCenterX == 0 && mWaveCenterY == 0) {
performInitialLayout(newWaveCenterX, newWaveCenterY);
@@ -848,9 +908,8 @@ public class MultiWaveView extends View {
mOuterRing.setX(mWaveCenterX);
mOuterRing.setY(Math.max(mWaveCenterY, mWaveCenterY));
-
- updateTargetPositions();
}
+ updateTargetPositions();
if (DEBUG) dump();
}
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
index 73dadb4..66cf98d 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
@@ -85,10 +85,10 @@
<com.android.internal.widget.multiwaveview.MultiWaveView
android:id="@+id/unlock_widget"
android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentBottom="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_gravity="center"
+ android:gravity="center"
android:targetDrawables="@array/lockscreen_targets_with_camera"
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
@@ -99,8 +99,6 @@
android:snapMargin="@dimen/multiwaveview_snap_margin"
android:hitRadius="@dimen/multiwaveview_hit_radius"
android:rightChevronDrawable="@drawable/ic_lockscreen_chevron_right"
- android:horizontalOffset="0dip"
- android:verticalOffset="60dip"
android:feedbackCount="3"
android:vibrationDuration="20"
/>
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
index 10b1ace..65b442b 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
@@ -84,10 +84,11 @@
<com.android.internal.widget.multiwaveview.MultiWaveView
android:id="@+id/unlock_widget"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:layout_rowSpan="7"
android:layout_gravity="center_vertical|center_horizontal"
+ android:gravity="center"
android:targetDrawables="@array/lockscreen_targets_with_camera"
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
@@ -100,8 +101,6 @@
android:rightChevronDrawable="@drawable/ic_lockscreen_chevron_right"
android:feedbackCount="3"
android:vibrationDuration="20"
- android:horizontalOffset="0dip"
- android:verticalOffset="0dip"
/>
<!-- emergency call button shown when sim is PUKd and tab_selector is hidden -->
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml
index 0ec8f75..3fd3023 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml
@@ -129,6 +129,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
+ android:gravity="top"
android:targetDrawables="@array/lockscreen_targets_with_camera"
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
@@ -139,8 +140,6 @@
android:snapMargin="@dimen/multiwaveview_snap_margin"
android:hitRadius="@dimen/multiwaveview_hit_radius"
android:rightChevronDrawable="@drawable/ic_lockscreen_chevron_right"
- android:horizontalOffset="0dip"
- android:verticalOffset="60dip"
android:feedbackCount="3"
android:vibrationDuration="20"
/>
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
index 294f91e..cd03c10 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock_land.xml
@@ -131,9 +131,10 @@
<!-- Column 2 -->
<com.android.internal.widget.multiwaveview.MultiWaveView
android:id="@+id/unlock_widget"
- android:layout_width="200dip"
+ android:layout_width="302dip"
android:layout_height="match_parent"
android:layout_rowSpan="7"
+ android:gravity="center"
android:targetDrawables="@array/lockscreen_targets_with_camera"
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
@@ -146,8 +147,6 @@
android:topChevronDrawable="@drawable/ic_lockscreen_chevron_up"
android:feedbackCount="3"
android:vibrationDuration="20"
- android:horizontalOffset="0dip"
- android:verticalOffset="0dip"
/>
<!-- Music transport control -->
diff --git a/core/res/res/values-sw600dp-land/arrays.xml b/core/res/res/values-sw600dp-land/arrays.xml
index 6304bc0..6a09cf8 100644
--- a/core/res/res/values-sw600dp-land/arrays.xml
+++ b/core/res/res/values-sw600dp-land/arrays.xml
@@ -57,14 +57,14 @@
<array name="lockscreen_targets_with_camera">
<item>@drawable/ic_lockscreen_unlock</item>
- <item>@null</item>
+ <item>@drawable/ic_lockscreen_search</item>
<item>@drawable/ic_lockscreen_camera</item>
<item>@null</item>
</array>
<array name="lockscreen_target_descriptions_with_camera">
<item>@string/description_target_unlock</item>
- <item>@null</item>
+ <item>@string/description_target_search</item>
<item>@string/description_target_camera</item>
<item>@null</item>
</array>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 9fa666e..484de0d 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3107,7 +3107,7 @@
<attr name="singleLine" format="boolean" />
<!-- Specifies whether the widget is enabled. The interpretation of the enabled state varies by subclass.
For example, a non-enabled EditText prevents the user from editing the contained text, and
- a non-enabled Button prevents the user from tapping the button.
+ a non-enabled Button prevents the user from tapping the button.
The appearance of enabled and non-enabled widgets may differ, if the drawables referenced
from evaluating state_enabled differ. -->
<attr name="enabled" format="boolean" />
@@ -5378,12 +5378,17 @@
<!-- Number of waves/chevrons to show in animation. -->
<attr name="feedbackCount" format="integer" />
- <!-- Used to shift center of pattern vertically. -->
+ <!-- {@deprecated Not used by the framework. Use android:gravity instead}
+ Used to shift center of pattern vertically. -->
<attr name="verticalOffset" format="dimension" />
- <!-- Used to shift center of pattern horizontally. -->
+ <!-- {@deprecated Not used by the framework. Use android:gravity instead}
+ Used to shift center of pattern horizontally. -->
<attr name="horizontalOffset" format="dimension" />
+ <!-- How the items in this layout should be positioned -->
+ <attr name="gravity" />
+
<!-- Used when the handle shouldn't wait to be hit before following the finger -->
<attr name="alwaysTrackFinger" format="boolean" />
</declare-styleable>
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
new file mode 100644
index 0000000..4c163a2
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/navbar_search_bg_scrim.9.png
Binary files differ
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
new file mode 100644
index 0000000..21c5abd
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/navbar_search_bg_scrim.9.png
Binary files differ
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
new file mode 100644
index 0000000..7874c63
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/navbar_search_bg_scrim.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/navbar_search_bg_scrim.png b/packages/SystemUI/res/drawable/navbar_search_bg_scrim.png
deleted file mode 100644
index d595ed2..0000000
--- a/packages/SystemUI/res/drawable/navbar_search_bg_scrim.png
+++ /dev/null
Binary files differ
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);
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
index 7100e89..7f432bf 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
@@ -181,6 +181,7 @@ public class KeyguardViewManager implements KeyguardWindowController {
( View.STATUS_BAR_DISABLE_BACK
| View.STATUS_BAR_DISABLE_HOME
);
+ Log.v(TAG, "KGVM: Set visibility on " + mKeyguardHost + " to " + visFlags);
mKeyguardHost.setSystemUiVisibility(visFlags);
mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 2408d7f..8320b1d 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -717,9 +717,10 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
@Override
public void onClockVisibilityChanged() {
- int visFlags = getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_CLOCK;
- setSystemUiVisibility(visFlags
- | (mUpdateMonitor.isClockVisible() ? View.STATUS_BAR_DISABLE_CLOCK : 0));
+ int visFlags = (getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_CLOCK)
+ | (mUpdateMonitor.isClockVisible() ? View.STATUS_BAR_DISABLE_CLOCK : 0);
+ Log.v(TAG, "Set visibility on " + this + " to " + visFlags);
+ setSystemUiVisibility(visFlags);
}
// We need to stop the biometric unlock when a phone call comes in