use of com.stardust.concurrent.VolatileBox in project Auto.js by hyb1996.
the class GlobalActionAutomator method gesturesWithoutHandler.
@RequiresApi(api = Build.VERSION_CODES.N)
private boolean gesturesWithoutHandler(GestureDescription description) {
prepareLooperIfNeeded();
final VolatileBox<Boolean> result = new VolatileBox<>(false);
Handler handler = new Handler(Looper.myLooper());
mService.dispatchGesture(description, new AccessibilityService.GestureResultCallback() {
@Override
public void onCompleted(GestureDescription gestureDescription) {
result.set(true);
quitLoop();
}
@Override
public void onCancelled(GestureDescription gestureDescription) {
result.set(false);
quitLoop();
}
}, handler);
Looper.loop();
return result.get();
}
Aggregations