File tree Expand file tree Collapse file tree
packages/SystemUI/src/com/android/systemui/statusbar/phone Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ public class ObservableScrollView extends ScrollView {
3434 private float mLastX ;
3535 private float mLastY ;
3636 private boolean mBlockFlinging ;
37+ private boolean mTouchCancelled ;
3738
3839 public ObservableScrollView (Context context , AttributeSet attrs ) {
3940 super (context , attrs );
@@ -87,9 +88,20 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
8788
8889 @ Override
8990 public boolean dispatchTouchEvent (MotionEvent ev ) {
90- boolean isEndGuesture = (ev .getAction () == MotionEvent .ACTION_UP
91- || ev .getAction () == MotionEvent .ACTION_CANCEL );
92- if (!mTouchEnabled && !isEndGuesture ) {
91+ if (ev .getAction () == MotionEvent .ACTION_DOWN ) {
92+ if (!mTouchEnabled ) {
93+ mTouchCancelled = true ;
94+ return false ;
95+ }
96+ mTouchCancelled = false ;
97+ } else if (mTouchCancelled ) {
98+ return false ;
99+ } else if (!mTouchEnabled ) {
100+ MotionEvent cancel = MotionEvent .obtain (ev );
101+ cancel .setAction (MotionEvent .ACTION_CANCEL );
102+ super .dispatchTouchEvent (ev );
103+ cancel .recycle ();
104+ mTouchCancelled = true ;
93105 return false ;
94106 }
95107 return super .dispatchTouchEvent (ev );
You can’t perform that action at this time.
0 commit comments