use of com.example.verificationcodejavademo.model.CaptchaGetIt in project captcha by anji-plus.
the class BlockPuzzleDialog method loadCaptcha.
private void loadCaptcha() {
Map<String, Object> params = new HashMap<>();
params.put("captchaType", "blockPuzzle");
JSONObject jsonObject = new JSONObject(params);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
RetrofitUtils.getServerApi().getAsync(body).compose(RxHelper.observableIO2Main(mContext)).subscribe(new BaseObserver<CaptchaGetIt>(mContext, true) {
@Override
public void onSuccess(CaptchaGetIt data) {
baseImageBase64 = data.getOriginalImageBase64();
slideImageBase64 = data.getJigsawImageBase64();
token = data.getToken();
key = data.getSecretKey();
dragView.setUp(ImageUtil.base64ToBitmap(baseImageBase64), ImageUtil.base64ToBitmap(slideImageBase64));
dragView.setSBUnMove(true);
initEvent();
}
@Override
public void onFailure(Throwable e, String errorMsg) {
dragView.setSBUnMove(false);
Toast.makeText(mContext, errorMsg, Toast.LENGTH_SHORT).show();
}
});
}
Aggregations