private void checkFirstDialogIfNeed() {
Utils.fakeRequest(“http://www.api1.com”, new HttpCallBack() {
@Override
public void onOk() {
showADialog();
}
@Override
public void onFailure() {
// //请求失败直接跳过,请求注册协议
// checkRegisterAgreement();
checkNeedShowH5();
}
});
}
private void showADialog() {
new AlertDialog.Builder(this)
.setTitle(“这是一条有态度的广告”)
.setPositiveButton(“我看完了”, null)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
// //弹框结束后请求注册协议
// checkRegisterAgreement();
//现在产品要插入一个H5页面优先请求
checkNeedShowH5();
}
}).create().show();
}
private void checkRegisterAgreement() {
Utils.fakeRequest(“http://www.api2.com”, new HttpCallBack() {
@Override
public void onOk() {
showBDialog();
}
@Override
public void onFailure() {
//do nothing
}
});
}
private void showBDialog() {
new AlertDialog.Builder(this)
.setTitle(“这是注册协议”)
.setPositiveButton(“我看完了”, null)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
//do nothing
}
}).create().show();
}
private void checkNeedShowH5() {
Utils.fakeRequest(“http://www.api3.com”, new HttpCallBack() {
@Override
public void onOk() {
toH5Page();
}
@Override
public void onFailure() {
checkRegisterAgreement();
}
});
}
private void toH5Page() {
startActivityForResult(new Intent(this, TestH5Activity.class), REQUEST_CODE_H5);
}
@Override
protected void onActivityRe