startActivityForResult 获取返回值的封装,实现链式调用
allprojects {
repositories {
maven { url 'https://www.jitpack.io' }
}
}
dependencies {
compile 'com.github.lwugang:ActivityResult:v2.0.1'
}
startActivityForResult(new Intent(),1);
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//获取数据
}
AResult.of(this)
.className(TestActivity.class)//目标Activity类名
//transition 动画
.options(ActivityOptionsCompat.makeScaleUpAnimation(v,(int)v.getX(),(int)v.getY(),
v.getWidth()/2,v.getHeight()/2).toBundle()).forResult(new AResultListener() {
@Override public void onReceiveResult(Intent data) {
// 结果处理,也就是onActivityResult方法一样,只有当 setResult(Activity.RESULT_OK)才会执行
}
});
- 1.v2.0.1
- 1.1 移除拦截器概念,简化操作
- 1.2 增强IntentBuilder实现
- 1.3 新增BundleCompat 快速创建Bundle