@Test public void loadData() { Wallet wallet = new Wallet(); wallet.setName("高富帅"); wallet.setChainId("103"); wallet.setAddress("0x2e95e3ce0a54951eb9a99152a6d5827872dfb4fd"); Flowable.fromCallable(new Callable<Bitmap>() { @Override public Bitmap call() throws Exception { String text = wallet.getPrefixAddress(); if (!TextUtils.isEmpty(text) && !text.toLowerCase().startsWith("0x")){ text = "0x" + text; } return QRCodeEncoder.syncEncodeQRCode(GZipUtil.compress(text), DensityUtil.dp2px(application, 250f)); } }).compose(RxUtils.getFlowableSchedulerTransformer()) .subscribe(new Consumer<Bitmap>() { @Override public void accept(Bitmap bitmap) throws Exception { if (bitmap != null) { presenter.getView().setWalletAddressQrCode(bitmap); } } }); }
@Override public void loadData() { walletEntity = WalletManager.getInstance().getSelectedWallet(); if (isViewAttached() && walletEntity != null) { getView().setWalletInfo(walletEntity); Flowable.fromCallable(new Callable<Bitmap>() { @Override public Bitmap call() throws Exception { String text = walletEntity.getPrefixAddress(); return QRCodeEncoder.syncEncodeQRCode(text, DensityUtil.dp2px(getContext(), 250f)); } }).compose(RxUtils.getFlowableSchedulerTransformer()) .subscribe(new Consumer<Bitmap>() { @Override public void accept(Bitmap bitmap) throws Exception { mQRCodeBitmap = bitmap; if (isViewAttached() && bitmap != null) { getView().setWalletAddressQrCode(bitmap); } } }); } }
ReceiveTransactionPresenter extends BasePresenter<ReceiveTransationContract.View> implements ReceiveTransationContract.Presenter { @Override public void loadData() { walletEntity = WalletManager.getInstance().getSelectedWallet(); if (isViewAttached() && walletEntity != null) { getView().setWalletInfo(walletEntity); Flowable.fromCallable(new Callable<Bitmap>() { @Override public Bitmap call() throws Exception { String text = walletEntity.getPrefixAddress(); return QRCodeEncoder.syncEncodeQRCode(text, DensityUtil.dp2px(getContext(), 250f)); } }).compose(RxUtils.getFlowableSchedulerTransformer()) .subscribe(new Consumer<Bitmap>() { @Override public void accept(Bitmap bitmap) throws Exception { mQRCodeBitmap = bitmap; if (isViewAttached() && bitmap != null) { getView().setWalletAddressQrCode(bitmap); } } }); } } }
ReceiveTransactionPresenter extends BasePresenter<ReceiveTransationContract.View> implements ReceiveTransationContract.Presenter { @Override public void loadData() { walletEntity = WalletManager.getInstance().getSelectedWallet(); if (isViewAttached() && walletEntity != null) { getView().setWalletInfo(walletEntity); Flowable.fromCallable(new Callable<Bitmap>() { @Override public Bitmap call() throws Exception { String text = walletEntity.getPrefixAddress(); return QRCodeEncoder.syncEncodeQRCode(text, DensityUtil.dp2px(getContext(), 250f)); } }).compose(RxUtils.getFlowableSchedulerTransformer()) .subscribe(new Consumer<Bitmap>() { @Override public void accept(Bitmap bitmap) throws Exception { mQRCodeBitmap = bitmap; if (isViewAttached() && bitmap != null) { getView().setWalletAddressQrCode(bitmap); } } }); } }  }
ReceiveTransactionPresenter extends BasePresenter<ReceiveTransationContract.View> implements ReceiveTransationContract.Presenter { @Override public void loadData() { walletEntity = WalletManager.getInstance().getSelectedWallet(); if (isViewAttached() && walletEntity != null) { getView().setWalletInfo(walletEntity); Flowable.fromCallable(new Callable<Bitmap>() { @Override public Bitmap call() throws Exception { String text = walletEntity.getPrefixAddress(); return QRCodeEncoder.syncEncodeQRCode(text, DensityUtil.dp2px(getContext(), 250f)); } }).compose(RxUtils.getFlowableSchedulerTransformer()) .subscribe(new Consumer<Bitmap>() { @Override public void accept(Bitmap bitmap) throws Exception { mQRCodeBitmap = bitmap; if (isViewAttached() && bitmap != null) { getView().setWalletAddressQrCode(bitmap); } } }); } }  Wallet getWalletEntity(); void setWalletEntity(Wallet walletEntity); Bitmap getmQRCodeBitmap(); void setmQRCodeBitmap(Bitmap mQRCodeBitmap); @Override void loadData(); @Override void shareView(); @Override void copy(); }
ReceiveTransactionPresenter extends BasePresenter<ReceiveTransationContract.View> implements ReceiveTransationContract.Presenter { @Override public void loadData() { walletEntity = WalletManager.getInstance().getSelectedWallet(); if (isViewAttached() && walletEntity != null) { getView().setWalletInfo(walletEntity); Flowable.fromCallable(new Callable<Bitmap>() { @Override public Bitmap call() throws Exception { String text = walletEntity.getPrefixAddress(); return QRCodeEncoder.syncEncodeQRCode(text, DensityUtil.dp2px(getContext(), 250f)); } }).compose(RxUtils.getFlowableSchedulerTransformer()) .subscribe(new Consumer<Bitmap>() { @Override public void accept(Bitmap bitmap) throws Exception { mQRCodeBitmap = bitmap; if (isViewAttached() && bitmap != null) { getView().setWalletAddressQrCode(bitmap); } } }); } }  Wallet getWalletEntity(); void setWalletEntity(Wallet walletEntity); Bitmap getmQRCodeBitmap(); void setmQRCodeBitmap(Bitmap mQRCodeBitmap); @Override void loadData(); @Override void shareView(); @Override void copy();  }