From 1cf41c14aae685a76af0a140e5bf2563a8372e1c Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 12 Aug 2014 20:06:19 +0200 Subject: [PATCH] Reuse existing TouchHelpers on rotation Recreating them caused some bugs when touching during the rotation. Currently there is no need to recreate them. Bug: 15598792 Change-Id: I7255bd0102427e6847b63ce7f6346248aaa4054f --- .../stack/NotificationStackScrollLayout.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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 fec5e74b9d143..82445ade90532 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -209,6 +209,15 @@ public class NotificationStackScrollLayout extends ViewGroup public NotificationStackScrollLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); + int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height); + int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height); + mExpandHelper = new ExpandHelper(getContext(), this, + minHeight, maxHeight); + mExpandHelper.setEventSource(this); + mExpandHelper.setScrollAdapter(this); + + mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, getContext()); + mSwipeHelper.setLongPressListener(mLongPressListener); initView(context); if (DEBUG) { setWillNotDraw(false); @@ -246,10 +255,6 @@ public class NotificationStackScrollLayout extends ViewGroup mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverflingDistance = configuration.getScaledOverflingDistance(); - float densityScale = getResources().getDisplayMetrics().density; - float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop(); - mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, getContext()); - mSwipeHelper.setLongPressListener(mLongPressListener); mSidePaddings = context.getResources() .getDimensionPixelSize(R.dimen.notification_side_padding); @@ -264,12 +269,6 @@ public class NotificationStackScrollLayout extends ViewGroup mPaddingBetweenElementsNormal = context.getResources() .getDimensionPixelSize(R.dimen.notification_padding); updatePadding(mAmbientState.isDimmed()); - int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height); - int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height); - mExpandHelper = new ExpandHelper(getContext(), this, - minHeight, maxHeight); - mExpandHelper.setEventSource(this); - mExpandHelper.setScrollAdapter(this); mMinTopOverScrollToEscape = getResources().getDimensionPixelSize( R.dimen.min_top_overscroll_to_qs); mNotificationTopPadding = getResources().getDimensionPixelSize(