diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java | 44 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java | 28 |
2 files changed, 51 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 23be30c7d0f6..435a5960bea7 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -2897,15 +2897,7 @@ public final class NotificationPanelViewController implements Dumpable { mHeadsUpManager.addListener(mOnHeadsUpChangedListener); mHeadsUpTouchHelper = new HeadsUpTouchHelper(headsUpManager, mNotificationStackScrollLayoutController.getHeadsUpCallback(), - NotificationPanelViewController.this); - } - - public void setTrackedHeadsUp(ExpandableNotificationRow pickedChild) { - if (pickedChild != null) { - updateTrackingHeadsUp(pickedChild); - mExpandingFromHeadsUp = true; - } - // otherwise we update the state when the expansion is finished + new HeadsUpNotificationViewControllerImpl()); } private void onClosingFinished() { @@ -2953,7 +2945,8 @@ public final class NotificationPanelViewController implements Dumpable { } /** Called when a HUN is dragged up or down to indicate the starting height for shade motion. */ - public void setHeadsUpDraggingStartingHeight(int startHeight) { + @VisibleForTesting + void setHeadsUpDraggingStartingHeight(int startHeight) { mHeadsUpStartHeight = startHeight; float scrimMinFraction; if (mSplitShadeEnabled) { @@ -2987,10 +2980,6 @@ public final class NotificationPanelViewController implements Dumpable { mScrimController.setPanelScrimMinFraction(mMinFraction); } - public void clearNotificationEffects() { - mCentralSurfaces.clearNotificationEffects(); - } - private boolean isPanelVisibleBecauseOfHeadsUp() { return (mHeadsUpManager.hasPinnedHeadsUp() || mHeadsUpAnimatingAway) && mBarState == StatusBarState.SHADE; @@ -5143,6 +5132,33 @@ public final class NotificationPanelViewController implements Dumpable { } } + private final class HeadsUpNotificationViewControllerImpl implements + HeadsUpTouchHelper.HeadsUpNotificationViewController { + @Override + public void setHeadsUpDraggingStartingHeight(int startHeight) { + NotificationPanelViewController.this.setHeadsUpDraggingStartingHeight(startHeight); + } + + @Override + public void setTrackedHeadsUp(ExpandableNotificationRow pickedChild) { + if (pickedChild != null) { + updateTrackingHeadsUp(pickedChild); + mExpandingFromHeadsUp = true; + } + // otherwise we update the state when the expansion is finished + } + + @Override + public void startExpand(float x, float y, boolean startTracking, float expandedHeight) { + startExpandMotion(x, y, startTracking, expandedHeight); + } + + @Override + public void clearNotificationEffects() { + mCentralSurfaces.clearNotificationEffects(); + } + } + private final class ShadeAccessibilityDelegate extends AccessibilityDelegate { @Override public void onInitializeAccessibilityNodeInfo(View host, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java index 90d0b697337a..16c2e36af6b8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpTouchHelper.java @@ -21,7 +21,6 @@ import android.view.MotionEvent; import android.view.ViewConfiguration; import com.android.systemui.Gefingerpoken; -import com.android.systemui.shade.NotificationPanelViewController; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; @@ -31,21 +30,21 @@ import com.android.systemui.statusbar.notification.row.ExpandableView; */ public class HeadsUpTouchHelper implements Gefingerpoken { - private HeadsUpManagerPhone mHeadsUpManager; - private Callback mCallback; + private final HeadsUpManagerPhone mHeadsUpManager; + private final Callback mCallback; private int mTrackingPointer; - private float mTouchSlop; + private final float mTouchSlop; private float mInitialTouchX; private float mInitialTouchY; private boolean mTouchingHeadsUpView; private boolean mTrackingHeadsUp; private boolean mCollapseSnoozes; - private NotificationPanelViewController mPanel; + private final HeadsUpNotificationViewController mPanel; private ExpandableNotificationRow mPickedChild; public HeadsUpTouchHelper(HeadsUpManagerPhone headsUpManager, Callback callback, - NotificationPanelViewController notificationPanelView) { + HeadsUpNotificationViewController notificationPanelView) { mHeadsUpManager = headsUpManager; mCallback = callback; mPanel = notificationPanelView; @@ -116,7 +115,7 @@ public class HeadsUpTouchHelper implements Gefingerpoken { int startHeight = (int) (mPickedChild.getActualHeight() + mPickedChild.getTranslationY()); mPanel.setHeadsUpDraggingStartingHeight(startHeight); - mPanel.startExpandMotion(x, y, true /* startTracking */, startHeight); + mPanel.startExpand(x, y, true /* startTracking */, startHeight); // This call needs to be after the expansion start otherwise we will get a // flicker of one frame as it's not expanded yet. mHeadsUpManager.unpinAll(true); @@ -181,4 +180,19 @@ public class HeadsUpTouchHelper implements Gefingerpoken { boolean isExpanded(); Context getContext(); } + + /** The controller for a view that houses heads up notifications. */ + public interface HeadsUpNotificationViewController { + /** Called when a HUN is dragged to indicate the starting height for shade motion. */ + void setHeadsUpDraggingStartingHeight(int startHeight); + + /** Sets notification that is being expanded. */ + void setTrackedHeadsUp(ExpandableNotificationRow expandableNotificationRow); + + /** Called when a MotionEvent is about to trigger expansion. */ + void startExpand(float newX, float newY, boolean startTracking, float expandedHeight); + + /** Clear any effects that were added for the expansion. */ + void clearNotificationEffects(); + } } |