use of android.accessibilityservice.GestureDescription in project robolectric by robolectric.
the class ShadowAccessibilityServiceTest method setCanDispatchGestures_false_stopsRecordingDispatchedGestures.
@Test
@Config(minSdk = N)
public void setCanDispatchGestures_false_stopsRecordingDispatchedGestures() {
GestureDescription gestureDescription = createTestGesture();
GestureResultCallback gestureResultCallback = createEmptyGestureResultCallback();
shadow.setCanDispatchGestures(false);
service.dispatchGesture(gestureDescription, gestureResultCallback, /*handler=*/
null);
assertThat(shadow.getGesturesDispatched()).isEmpty();
}
use of android.accessibilityservice.GestureDescription in project robolectric by robolectric.
the class ShadowAccessibilityServiceTest method setCanDispatchGestures_false_causesDispatchGestureToReturnFalse.
@Test
@Config(minSdk = N)
public void setCanDispatchGestures_false_causesDispatchGestureToReturnFalse() {
GestureDescription gestureDescription = createTestGesture();
GestureResultCallback gestureResultCallback = createEmptyGestureResultCallback();
shadow.setCanDispatchGestures(false);
assertThat(service.dispatchGesture(gestureDescription, gestureResultCallback, /*handler=*/
null)).isFalse();
}
use of android.accessibilityservice.GestureDescription in project WeChatLuckyMoney by geeeeeeeeek.
the class HongbaoService method openPacket.
private void openPacket() {
DisplayMetrics metrics = getResources().getDisplayMetrics();
float dpi = metrics.densityDpi;
Log.d(TAG, "openPacket!" + dpi);
if (android.os.Build.VERSION.SDK_INT <= 23) {
mUnpackNode.performAction(AccessibilityNodeInfo.ACTION_CLICK);
} else {
if (android.os.Build.VERSION.SDK_INT > 23) {
Path path = new Path();
if (640 == dpi) {
// 1440
path.moveTo(720, 1575);
} else if (320 == dpi) {
// 720p
path.moveTo(355, 780);
} else if (480 == dpi) {
// 1080p
path.moveTo(533, 1115);
}
GestureDescription.Builder builder = new GestureDescription.Builder();
GestureDescription gestureDescription = builder.addStroke(new GestureDescription.StrokeDescription(path, 450, 50)).build();
dispatchGesture(gestureDescription, new GestureResultCallback() {
@Override
public void onCompleted(GestureDescription gestureDescription) {
Log.d(TAG, "onCompleted");
mMutex = false;
super.onCompleted(gestureDescription);
}
@Override
public void onCancelled(GestureDescription gestureDescription) {
Log.d(TAG, "onCancelled");
mMutex = false;
super.onCancelled(gestureDescription);
}
}, null);
}
}
}
Aggregations