diff options
-rw-r--r-- | packages/SystemUI/res/anim/heads_up_exit.xml | 12 | ||||
-rw-r--r-- | packages/SystemUI/res/drawable-hdpi/heads_up_window_bg.9.png | bin | 779 -> 0 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-mdpi/heads_up_window_bg.9.png | bin | 500 -> 0 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-sw600dp-xhdpi/heads_up_window_bg.9.png | bin | 2226 -> 1391 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-sw600dp-xxhdpi/heads_up_window_bg.9.png | bin | 2028 -> 1207 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-xhdpi/heads_up_window_bg.9.png | bin | 965 -> 0 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable-xxhdpi/heads_up_window_bg.9.png | bin | 2028 -> 0 bytes | |||
-rw-r--r-- | packages/SystemUI/res/drawable/heads_up_notification_row_bg.xml | 21 | ||||
-rw-r--r-- | packages/SystemUI/res/layout-sw600dp/heads_up.xml | 31 | ||||
-rw-r--r-- | packages/SystemUI/res/layout/heads_up.xml | 28 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 1 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java | 86 |
12 files changed, 116 insertions, 63 deletions
diff --git a/packages/SystemUI/res/anim/heads_up_exit.xml b/packages/SystemUI/res/anim/heads_up_exit.xml index 05c144a..2cad8f6 100644 --- a/packages/SystemUI/res/anim/heads_up_exit.xml +++ b/packages/SystemUI/res/anim/heads_up_exit.xml @@ -1,13 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > - <scale - android:interpolator="@android:interpolator/accelerate_quad" - android:fromXScale="1.0" android:toXScale="0.7" - android:fromYScale="1.0" android:toYScale="0.7" - android:pivotX="50%" android:pivotY="50%" - android:duration="@android:integer/config_shortAnimTime" /> - <alpha + <translate + android:interpolator="@android:interpolator/overshoot" + android:fromYDelta="0" android:toYDelta="-50%" + android:duration="@android:integer/config_shortAnimTime" /> + <alpha android:interpolator="@android:interpolator/accelerate_quad" android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="@android:integer/config_shortAnimTime" /> diff --git a/packages/SystemUI/res/drawable-hdpi/heads_up_window_bg.9.png b/packages/SystemUI/res/drawable-hdpi/heads_up_window_bg.9.png Binary files differdeleted file mode 100644 index 3b952d0..0000000 --- a/packages/SystemUI/res/drawable-hdpi/heads_up_window_bg.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-mdpi/heads_up_window_bg.9.png b/packages/SystemUI/res/drawable-mdpi/heads_up_window_bg.9.png Binary files differdeleted file mode 100644 index a0ab991..0000000 --- a/packages/SystemUI/res/drawable-mdpi/heads_up_window_bg.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-sw600dp-xhdpi/heads_up_window_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-xhdpi/heads_up_window_bg.9.png Binary files differindex 6002cfb..31eb8f7 100644 --- a/packages/SystemUI/res/drawable-sw600dp-xhdpi/heads_up_window_bg.9.png +++ b/packages/SystemUI/res/drawable-sw600dp-xhdpi/heads_up_window_bg.9.png diff --git a/packages/SystemUI/res/drawable-sw600dp-xxhdpi/heads_up_window_bg.9.png b/packages/SystemUI/res/drawable-sw600dp-xxhdpi/heads_up_window_bg.9.png Binary files differindex 586a738..c76d0e1 100644 --- a/packages/SystemUI/res/drawable-sw600dp-xxhdpi/heads_up_window_bg.9.png +++ b/packages/SystemUI/res/drawable-sw600dp-xxhdpi/heads_up_window_bg.9.png diff --git a/packages/SystemUI/res/drawable-xhdpi/heads_up_window_bg.9.png b/packages/SystemUI/res/drawable-xhdpi/heads_up_window_bg.9.png Binary files differdeleted file mode 100644 index 42e5593..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/heads_up_window_bg.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxhdpi/heads_up_window_bg.9.png b/packages/SystemUI/res/drawable-xxhdpi/heads_up_window_bg.9.png Binary files differdeleted file mode 100644 index 586a738..0000000 --- a/packages/SystemUI/res/drawable-xxhdpi/heads_up_window_bg.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable/heads_up_notification_row_bg.xml b/packages/SystemUI/res/drawable/heads_up_notification_row_bg.xml deleted file mode 100644 index 59d9fcf..0000000 --- a/packages/SystemUI/res/drawable/heads_up_notification_row_bg.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?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. ---> - -<selector xmlns:android="http://schemas.android.com/apk/res/android" - android:exitFadeDuration="@android:integer/config_mediumAnimTime"> - <item android:state_pressed="true" - android:drawable="@drawable/heads_up_notification_bg_pressed" /> -</selector> diff --git a/packages/SystemUI/res/layout-sw600dp/heads_up.xml b/packages/SystemUI/res/layout-sw600dp/heads_up.xml new file mode 100644 index 0000000..71f7c21 --- /dev/null +++ b/packages/SystemUI/res/layout-sw600dp/heads_up.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2014, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<com.android.systemui.statusbar.policy.HeadsUpNotificationView + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="wrap_content" + android:layout_width="match_parent" + > + <FrameLayout + android:id="@+id/content_holder" + android:layout_height="wrap_content" + android:layout_width="@dimen/notification_panel_width" + android:layout_marginStart="@dimen/notification_panel_margin_left" + android:background="@drawable/heads_up_window_bg" + /> +</com.android.systemui.statusbar.policy.HeadsUpNotificationView> diff --git a/packages/SystemUI/res/layout/heads_up.xml b/packages/SystemUI/res/layout/heads_up.xml index 564dc51..3a58b84 100644 --- a/packages/SystemUI/res/layout/heads_up.xml +++ b/packages/SystemUI/res/layout/heads_up.xml @@ -17,25 +17,11 @@ ** limitations under the License. */ --> - -<!-- android:background="@drawable/status_bar_closed_default_background" --> <com.android.systemui.statusbar.policy.HeadsUpNotificationView - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:orientation="vertical" - > - <FrameLayout - android:layout_height="wrap_content" - android:layout_width="@dimen/notification_panel_width" - android:id="@+id/content_slider" - android:layout_marginStart="@dimen/notification_panel_margin_left" - > - <FrameLayout - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:id="@+id/content_holder" - android:background="@drawable/heads_up_window_bg" - /> - </FrameLayout> -</com.android.systemui.statusbar.policy.HeadsUpNotificationView> + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="wrap_content" + android:layout_width="@dimen/notification_panel_width" + android:id="@+id/content_holder" + android:layout_marginStart="@dimen/notification_panel_margin_left" + android:background="@drawable/notification_panel_bg" + />
\ No newline at end of file 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 2114991..f5f61f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -855,7 +855,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { PixelFormat.TRANSLUCENT); lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; lp.gravity = Gravity.TOP; - lp.y = getStatusBarHeight(); lp.setTitle("Heads Up"); lp.packageName = mContext.getPackageName(); lp.windowAnimations = R.style.Animation_StatusBar_HeadsUp; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java index 491c35e..f4bc4a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java @@ -28,6 +28,7 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import com.android.systemui.ExpandHelper; +import com.android.systemui.Gefingerpoken; import com.android.systemui.R; import com.android.systemui.SwipeHelper; import com.android.systemui.statusbar.BaseStatusBar; @@ -42,13 +43,13 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. private final int mTouchSensitivityDelay; private SwipeHelper mSwipeHelper; + private EdgeSwipeHelper mEdgeSwipeHelper; private BaseStatusBar mBar; private ExpandHelper mExpandHelper; - private long mStartTouchTime; + private long mStartTouchTime; private ViewGroup mContentHolder; - private ViewGroup mContentSlider; private NotificationData.Entry mHeadsUp; @@ -72,7 +73,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. public boolean setNotification(NotificationData.Entry headsUp) { mHeadsUp = headsUp; - mHeadsUp.row.setExpanded(false); + mHeadsUp.row.setExpanded(true); mHeadsUp.row.setShowingPublic(false); if (mContentHolder == null) { // too soon! @@ -83,7 +84,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. mContentHolder.setAlpha(1f); mContentHolder.removeAllViews(); mContentHolder.addView(mHeadsUp.row); - mSwipeHelper.snapChild(mContentSlider, 1f); + mSwipeHelper.snapChild(mContentHolder, 1f); mStartTouchTime = System.currentTimeMillis() + mTouchSensitivityDelay; return true; } @@ -94,10 +95,11 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. public void setMargin(int notificationPanelMarginPx) { if (SPEW) Log.v(TAG, "setMargin() " + notificationPanelMarginPx); - if (mContentSlider != null) { - FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mContentSlider.getLayoutParams(); + if (mContentHolder != null && + mContentHolder.getLayoutParams() instanceof FrameLayout.LayoutParams) { + FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mContentHolder.getLayoutParams(); lp.setMarginStart(notificationPanelMarginPx); - mContentSlider.setLayoutParams(lp); + mContentHolder.setLayoutParams(lp); } } @@ -122,15 +124,17 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. @Override public void onAttachedToWindow() { float densityScale = getResources().getDisplayMetrics().density; - float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop(); + final ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext()); + float pagingTouchSlop = viewConfiguration.getScaledPagingTouchSlop(); + float touchSlop = viewConfiguration.getScaledTouchSlop(); mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop); + mEdgeSwipeHelper = new EdgeSwipeHelper(touchSlop); int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height); int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height); mExpandHelper = new ExpandHelper(getContext(), this, minHeight, maxHeight); mContentHolder = (ViewGroup) findViewById(R.id.content_holder); - mContentSlider = (ViewGroup) findViewById(R.id.content_slider); if (mHeadsUp != null) { // whoops, we're on already! @@ -144,7 +148,8 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. if (System.currentTimeMillis() < mStartTouchTime) { return true; } - return mSwipeHelper.onInterceptTouchEvent(ev) + return mEdgeSwipeHelper.onInterceptTouchEvent(ev) + || mSwipeHelper.onInterceptTouchEvent(ev) || mExpandHelper.onInterceptTouchEvent(ev) || super.onInterceptTouchEvent(ev); } @@ -157,7 +162,8 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. return false; } mBar.resetHeadsUpDecayTimer(); - return mSwipeHelper.onTouchEvent(ev) + return mEdgeSwipeHelper.onTouchEvent(ev) + || mSwipeHelper.onTouchEvent(ev) || mExpandHelper.onTouchEvent(ev) || super.onTouchEvent(ev); } @@ -226,11 +232,65 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. @Override public View getChildAtPosition(MotionEvent ev) { - return mContentSlider; + return mContentHolder; } @Override public View getChildContentView(View v) { - return mContentSlider; + return mContentHolder; + } + + private class EdgeSwipeHelper implements Gefingerpoken { + private static final boolean DEBUG_EDGE_SWIPE = false; + private final float mTouchSlop; + private boolean mConsuming; + private float mFirstY; + private float mFirstX; + + public EdgeSwipeHelper(float touchSlop) { + mTouchSlop = touchSlop; + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + switch (ev.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + if (DEBUG_EDGE_SWIPE) Log.d(TAG, "action down " + ev.getY()); + mFirstX = ev.getX(); + mFirstY = ev.getY(); + mConsuming = false; + break; + + case MotionEvent.ACTION_MOVE: + if (DEBUG_EDGE_SWIPE) Log.d(TAG, "action move " + ev.getY()); + final float dY = ev.getY() - mFirstY; + final float daX = Math.abs(ev.getX() - mFirstX); + final float daY = Math.abs(dY); + if (!mConsuming && (4f * daX) < daY && daY > mTouchSlop) { + if (dY > 0) { + if (DEBUG_EDGE_SWIPE) Log.d(TAG, "found an open"); + mBar.animateExpandNotificationsPanel(); + } + if (dY < 0) { + if (DEBUG_EDGE_SWIPE) Log.d(TAG, "found a close"); + mBar.onHeadsUpDismissed(); + } + mConsuming = true; + } + break; + + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + if (DEBUG_EDGE_SWIPE) Log.d(TAG, "action done" ); + mConsuming = false; + break; + } + return mConsuming; + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + return mConsuming; + } } }
\ No newline at end of file |