OSDN Git Service

Fixed a bug where parts weren't scrollable
authorSelim Cinek <cinek@google.com>
Fri, 8 Sep 2017 22:03:12 +0000 (15:03 -0700)
committerSelim Cinek <cinek@google.com>
Fri, 8 Sep 2017 22:04:43 +0000 (15:04 -0700)
The shelf and small notifications weren't scrollable
because we were requiring a minimum height. This
is not needed in order to scroll and it is removed.

Fixes: 65298525
Test: scroll on shelf in the shade, it should work now.
Change-Id: I74f522c94198c2337d324f087c3d2cf1370b5116

packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java

index 4e592db..75532d9 100644 (file)
@@ -23,14 +23,12 @@ import android.animation.PropertyValuesHolder;
 import android.animation.TimeAnimator;
 import android.animation.ValueAnimator;
 import android.animation.ValueAnimator.AnimatorUpdateListener;
-import android.annotation.ColorInt;
 import android.annotation.FloatRange;
 import android.annotation.Nullable;
 import android.content.Context;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.graphics.Canvas;
-import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.PointF;
 import android.graphics.PorterDuff;
@@ -1083,6 +1081,20 @@ public class NotificationStackScrollLayout extends ViewGroup
 
     @Override
     public ExpandableView getChildAtPosition(float touchX, float touchY) {
+        return getChildAtPosition(touchX, touchY, true /* requireMinHeight */);
+
+    }
+
+    /**
+     * Get the child at a certain screen location.
+     *
+     * @param touchX the x coordinate
+     * @param touchY the y coordinate
+     * @param requireMinHeight Whether a minimum height is required for a child to be returned.
+     * @return the child at the given location.
+     */
+    private ExpandableView getChildAtPosition(float touchX, float touchY,
+            boolean requireMinHeight) {
         // find the view under the pointer, accounting for GONE views
         final int count = getChildCount();
         for (int childIdx = 0; childIdx < count; childIdx++) {
@@ -1101,7 +1113,7 @@ public class NotificationStackScrollLayout extends ViewGroup
             int left = 0;
             int right = getWidth();
 
-            if (bottom - top >= mMinInteractionHeight
+            if ((bottom - top >= mMinInteractionHeight || !requireMinHeight)
                     && touchY >= top && touchY <= bottom && touchX >= left && touchX <= right) {
                 if (slidingChild instanceof ExpandableNotificationRow) {
                     ExpandableNotificationRow row = (ExpandableNotificationRow) slidingChild;
@@ -3220,7 +3232,7 @@ public class NotificationStackScrollLayout extends ViewGroup
             case MotionEvent.ACTION_DOWN: {
                 final int y = (int) ev.getY();
                 mScrolledToTopOnFirstDown = isScrolledToTop();
-                if (getChildAtPosition(ev.getX(), y) == null) {
+                if (getChildAtPosition(ev.getX(), y, false /* requireMinHeight */) == null) {
                     setIsBeingDragged(false);
                     recycleVelocityTracker();
                     break;