diff options
author | Selim Cinek <cinek@google.com> | 2015-07-29 17:04:36 -0700 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2015-07-30 23:05:42 +0000 |
commit | 0fccc729fd3b19a62efd90ae13b207faa3d1e8bb (patch) | |
tree | 48d2440a8203b6230e661b8204f40e5e67c9b0a6 /packages | |
parent | 26ae600b5fb8c657b4f8dc2700374c701c9e50ec (diff) | |
download | frameworks_base-0fccc729fd3b19a62efd90ae13b207faa3d1e8bb.zip frameworks_base-0fccc729fd3b19a62efd90ae13b207faa3d1e8bb.tar.gz frameworks_base-0fccc729fd3b19a62efd90ae13b207faa3d1e8bb.tar.bz2 |
The heads up now correctly dissapears when clicking
Bug: 22729955
Change-Id: I977b36823bf936baab527f932b1e5576241f4d71
Diffstat (limited to 'packages')
7 files changed, 41 insertions, 2 deletions
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml index 6d84727..8eef23e 100644 --- a/packages/SystemUI/res/values/ids.xml +++ b/packages/SystemUI/res/values/ids.xml @@ -49,5 +49,6 @@ <!-- For notification icons for which targetSdk < L, this caches whether the icon is grayscale --> <item type="id" name="icon_is_grayscale" /> + <item type="id" name="is_clicked_heads_up_tag" /> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 9c37263..00fa653 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1525,6 +1525,7 @@ public abstract class BaseStatusBar extends SystemUI implements // // In most cases, when FLAG_AUTO_CANCEL is set, the notification will // become canceled shortly by NoMan, but we can't assume that. + HeadsUpManager.setIsClickedNotification(row, true); mHeadsUpManager.releaseImmediately(notificationKey); } new Thread() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index f8bd793..17fd7a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -32,7 +32,6 @@ import android.util.MathUtils; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; -import android.view.ViewRootImpl; import android.view.ViewTreeObserver; import android.view.WindowInsets; import android.view.accessibility.AccessibilityEvent; @@ -203,10 +202,12 @@ public class NotificationPanelView extends PanelView implements private int mPositionMinSideMargin; private int mLastOrientation = -1; private boolean mClosingWithAlphaFadeOut; + private boolean mHeadsUpAnimatingAway; private Runnable mHeadsUpExistenceChangedRunnable = new Runnable() { @Override public void run() { + mHeadsUpAnimatingAway = false; notifyBarPanelExpansionChanged(); } }; @@ -2292,6 +2293,7 @@ public class NotificationPanelView extends PanelView implements mHeadsUpExistenceChangedRunnable.run(); updateNotificationTranslucency(); } else { + mHeadsUpAnimatingAway = true; mNotificationStackScroller.runAfterAnimationFinished( mHeadsUpExistenceChangedRunnable); } @@ -2382,4 +2384,8 @@ public class NotificationPanelView extends PanelView implements public void clearNotificattonEffects() { mStatusBar.clearNotificationEffects(); } + + protected boolean isPanelVisibleBecauseOfHeadsUp() { + return mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpAnimatingAway; + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 0d20d52..8b25e08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -1009,10 +1009,12 @@ public abstract class PanelView extends FrameLayout { protected void notifyBarPanelExpansionChanged() { mBar.panelExpansionChanged(this, mExpandedFraction, mExpandedFraction > 0f || mPeekPending - || mPeekAnimator != null || mInstantExpanding || mHeadsUpManager.hasPinnedHeadsUp() + || mPeekAnimator != null || mInstantExpanding || isPanelVisibleBecauseOfHeadsUp() || mTracking || mHeightAnimator != null); } + protected abstract boolean isPanelVisibleBecauseOfHeadsUp(); + /** * Gets called when the user performs a click anywhere in the empty area of the panel. * diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java index a81a962..ed9b123 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java @@ -51,6 +51,7 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL private static final String TAG = "HeadsUpManager"; private static final boolean DEBUG = false; private static final String SETTING_HEADS_UP_SNOOZE_LENGTH_MS = "heads_up_snooze_length_ms"; + private static final int TAG_CLICKED_NOTIFICATION = R.id.is_clicked_heads_up_tag; private final int mHeadsUpNotificationDecay; private final int mMinimumDisplayTime; @@ -526,6 +527,15 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL }); } + public static void setIsClickedNotification(View child, boolean clicked) { + child.setTag(TAG_CLICKED_NOTIFICATION, clicked ? true : null); + } + + public static boolean isClickedHeadsUpNotification(View child) { + Boolean clicked = (Boolean) child.getTag(TAG_CLICKED_NOTIFICATION); + return clicked != null && clicked; + } + /** * This represents a notification and how long it is in a heads up mode. It also manages its * lifecycle automatically when created. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 0d89b21..23d9b9f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -222,6 +222,7 @@ public class NotificationStackScrollLayout extends ViewGroup private int[] mTempInt2 = new int[2]; private boolean mGenerateChildOrderChangedEvent; private HashSet<Runnable> mAnimationFinishedRunnables = new HashSet<>(); + private HashSet<View> mClearOverlayViewsWhenFinished = new HashSet<>(); private HashSet<Pair<ExpandableNotificationRow, Boolean>> mHeadsUpChangeAnimations = new HashSet<>(); private HeadsUpManager mHeadsUpManager; @@ -1656,6 +1657,11 @@ public class NotificationStackScrollLayout extends ViewGroup mAddedHeadsUpChildren.remove(child); return false; } + if (isClickedHeadsUp(child)) { + // An animation is already running, add it to the Overlay + mClearOverlayViewsWhenFinished.add(child); + return true; + } if (mIsExpanded && mAnimationsEnabled && !isChildInInvisibleGroup(child)) { if (!mChildrenToAddAnimated.contains(child)) { // Generate Animations @@ -1671,6 +1677,10 @@ public class NotificationStackScrollLayout extends ViewGroup return false; } + private boolean isClickedHeadsUp(View child) { + return HeadsUpManager.isClickedHeadsUpNotification(child); + } + /** * Remove a removed child view from the heads up animations if it was just added there * @@ -2327,6 +2337,13 @@ public class NotificationStackScrollLayout extends ViewGroup public void onChildAnimationFinished() { requestChildrenUpdate(); runAnimationFinishedRunnables(); + clearViewOverlays(); + } + + private void clearViewOverlays() { + for (View view : mClearOverlayViewsWhenFinished) { + getOverlay().remove(view); + } } private void runAnimationFinishedRunnables() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java index 5b8fe89..97c7d30 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -29,6 +29,7 @@ import com.android.systemui.R; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.SpeedBumpView; +import com.android.systemui.statusbar.policy.HeadsUpManager; import java.util.ArrayList; import java.util.HashSet; @@ -670,6 +671,7 @@ public class StackStateAnimator { animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { + HeadsUpManager.setIsClickedNotification(child, false); child.setTag(TAG_ANIMATOR_TRANSLATION_Y, null); child.setTag(TAG_START_TRANSLATION_Y, null); child.setTag(TAG_END_TRANSLATION_Y, null); |