SetupWizard: Handle all touch events in EnableAccessibilityController

Change-Id: Icf15be21c90d32305a9c1f8b9835eb473acf1f33
(cherry picked from commit 0fde3a04cc62396b524aadb6a1a30f573a4b1b38)
This commit is contained in:
cretin45 2015-04-08 12:09:55 -07:00 committed by Ed Carrigan
parent e79aa7f0bf
commit 6d63e95342
2 changed files with 17 additions and 7 deletions

View File

@ -124,7 +124,9 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
mRootView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return mEnableAccessibilityController.onInterceptTouchEvent(event);
return
mEnableAccessibilityController.onInterceptTouchEvent(event) &
mEnableAccessibilityController.onTouchEvent(event);
}
});
registerReceiver(mSetupData, mSetupData.getIntentFilter());

View File

@ -130,7 +130,7 @@ public class EnableAccessibilityController {
// accessibility service, then we have nothing to do.
if (accessibilityManager.isEnabled()
&& !accessibilityManager.getEnabledAccessibilityServiceList(
AccessibilityServiceInfo.FEEDBACK_SPOKEN).isEmpty()) {
AccessibilityServiceInfo.FEEDBACK_SPOKEN).isEmpty()) {
return false;
}
@ -168,7 +168,7 @@ public class EnableAccessibilityController {
mHandler.sendEmptyMessageDelayed(MESSAGE_SPEAK_WARNING,
SPEAK_WARNING_DELAY_MILLIS);
mHandler.sendEmptyMessageDelayed(MESSAGE_ENABLE_ACCESSIBILITY,
ENABLE_ACCESSIBILITY_DELAY_MILLIS);
ENABLE_ACCESSIBILITY_DELAY_MILLIS);
return true;
}
return false;
@ -188,8 +188,14 @@ public class EnableAccessibilityController {
if (pointerCount > 2) {
cancel();
}
} break;
}
break;
case MotionEvent.ACTION_MOVE: {
//We only care about a 2 fingered move
if (pointerCount < 2) {
cancel();
return false;
}
final float firstPointerMove = MathUtils.dist(event.getX(0),
event.getY(0), mFirstPointerDownX, mFirstPointerDownY);
if (Math.abs(firstPointerMove) > mTouchSlop) {
@ -200,11 +206,13 @@ public class EnableAccessibilityController {
if (Math.abs(secondPointerMove) > mTouchSlop) {
cancel();
}
} break;
}
break;
case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_CANCEL: {
cancel();
} break;
}
break;
}
return true;
}
@ -287,4 +295,4 @@ public class EnableAccessibilityController {
}
}
}
}
}