使用rxjava解决回调地域的倒三角问题

Observable.create(new AsyncOnSubscribe<Object, Object>() {
@Override
protected Object generateState() {
return null;
}

@Override
protected Object next(Object state, long requested, Observer<Observable<?>> observer) {
    return null;
}

}).flatMap(new Func1<Object, Observable<?>>() {
@Override
public Observable<?> call(Object o) {
return null;
}
}).subscribe(new Observer() {
@Override
public void onCompleted() {

}


@Override
public void onError(Throwable e) {


}


@Override
public void onNext(Object o) {


}

});

int y1 = 800;
int y2 = 1000;
int x1 = 200;
int x2 = 400;
int x3 = 600;
int x4 = 800;

Path path1 = new Path();
path1.moveTo(x1, y1);
path1.lineTo(x1, y2);

Path path2 = new Path();
path2.moveTo(x1, y2);
path2.lineTo(x2, y2);

Path path3 = new Path();
path3.moveTo(x2, y2);
path3.lineTo(x4, y2);

Path path4 = new Path();
path4.moveTo(x3, y2);
path4.lineTo(x4, y1);

//rxjava 解决回调地狱

service.dispatchGesture(new GestureDescription.Builder()
.addStroke(new GestureDescription.StrokeDescription(path1, 0, 1000))
.build(), new AccessibilityService.GestureResultCallback() {
@Override
public void onCompleted(GestureDescription gestureDescription) {
super.onCompleted(gestureDescription);
service.dispatchGesture(new GestureDescription.Builder()
.addStroke(new GestureDescription.StrokeDescription(path2, 0, 1000))
.build(), new AccessibilityService.GestureResultCallback() {
@Override
public void onCompleted(GestureDescription gestureDescription) {
super.onCompleted(gestureDescription);
service.dispatchGesture(new GestureDescription.Builder()
.addStroke(new GestureDescription.StrokeDescription(path3, 0, 1000))
.build(), new AccessibilityService.GestureResultCallback() {
@Override
public void onCompleted(GestureDescription gestureDescription) {
super.onCompleted(gestureDescription);
service.dispatchGesture(new GestureDescription.Builder()
.addStroke(new GestureDescription.StrokeDescription(path4, 0, 1000))
.build(), null, null);
}
}, null);
}
}, null);
}
}, null);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值