@Test public void testUpdateTransactionDetailInfo() { Single.fromCallable(new Callable<String>() { @Override public String call() throws Exception { return "0x2e95e3ce0a54951eb9a99152a6d5827872dfb4fd"; } }).flatMap(new Function<String, SingleSource<String>>() { @Override public SingleSource<String> apply(String s) throws Exception { if (TextUtils.isEmpty(s)) { return Single.fromCallable(new Callable<String>() { @Override public String call() throws Exception { return "0x2e95e3ce0a54951eb9a99152a6d5827872dfb4fd"; } }); } else { return Single.just(s); } } }).subscribe(new Consumer<String>() { @Override public void accept(String s) throws Exception { System.out.println("====================" + s); } }); }
@SuppressLint("CheckResult") @Override public void updateTransactionDetailInfo(Transaction transaction) { if (transaction.equals(mTransaction)) { getWalletNameByAddressFromWalletDB(transaction.getFrom()) .flatMap(new Function<String, SingleSource<String>>() { @Override public SingleSource<String> apply(String s) throws Exception { if (TextUtils.isEmpty(s)) { return getWalletNameByAddressFromAddressDB(transaction.getFrom()); } else { return Single.just(s); } } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(RxUtils.bindToLifecycle(getView())) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<String>() { @Override public void accept(String walletName) throws Exception { if (isViewAttached()) { getView().setTransactionDetailInfo(transaction, mQueryAddressList, walletName); } } }); } }
TransactionDetailPresenter extends BasePresenter<TransactionDetailContract.View> implements TransactionDetailContract.Presenter { @SuppressLint("CheckResult") @Override public void updateTransactionDetailInfo(Transaction transaction) { if (transaction.equals(mTransaction)) { getWalletNameByAddressFromWalletDB(transaction.getFrom()) .flatMap(new Function<String, SingleSource<String>>() { @Override public SingleSource<String> apply(String s) throws Exception { if (TextUtils.isEmpty(s)) { return getWalletNameByAddressFromAddressDB(transaction.getFrom()); } else { return Single.just(s); } } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(RxUtils.bindToLifecycle(getView())) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<String>() { @Override public void accept(String walletName) throws Exception { if (isViewAttached()) { getView().setTransactionDetailInfo(transaction, mQueryAddressList, walletName); } } }); } } }
TransactionDetailPresenter extends BasePresenter<TransactionDetailContract.View> implements TransactionDetailContract.Presenter { @SuppressLint("CheckResult") @Override public void updateTransactionDetailInfo(Transaction transaction) { if (transaction.equals(mTransaction)) { getWalletNameByAddressFromWalletDB(transaction.getFrom()) .flatMap(new Function<String, SingleSource<String>>() { @Override public SingleSource<String> apply(String s) throws Exception { if (TextUtils.isEmpty(s)) { return getWalletNameByAddressFromAddressDB(transaction.getFrom()); } else { return Single.just(s); } } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(RxUtils.bindToLifecycle(getView())) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<String>() { @Override public void accept(String walletName) throws Exception { if (isViewAttached()) { getView().setTransactionDetailInfo(transaction, mQueryAddressList, walletName); } } }); } }  }
TransactionDetailPresenter extends BasePresenter<TransactionDetailContract.View> implements TransactionDetailContract.Presenter { @SuppressLint("CheckResult") @Override public void updateTransactionDetailInfo(Transaction transaction) { if (transaction.equals(mTransaction)) { getWalletNameByAddressFromWalletDB(transaction.getFrom()) .flatMap(new Function<String, SingleSource<String>>() { @Override public SingleSource<String> apply(String s) throws Exception { if (TextUtils.isEmpty(s)) { return getWalletNameByAddressFromAddressDB(transaction.getFrom()); } else { return Single.just(s); } } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(RxUtils.bindToLifecycle(getView())) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<String>() { @Override public void accept(String walletName) throws Exception { if (isViewAttached()) { getView().setTransactionDetailInfo(transaction, mQueryAddressList, walletName); } } }); } }  @Override void init(); @SuppressLint("CheckResult") @Override void loadData(); @SuppressLint("CheckResult") @Override void updateTransactionDetailInfo(Transaction transaction); }
TransactionDetailPresenter extends BasePresenter<TransactionDetailContract.View> implements TransactionDetailContract.Presenter { @SuppressLint("CheckResult") @Override public void updateTransactionDetailInfo(Transaction transaction) { if (transaction.equals(mTransaction)) { getWalletNameByAddressFromWalletDB(transaction.getFrom()) .flatMap(new Function<String, SingleSource<String>>() { @Override public SingleSource<String> apply(String s) throws Exception { if (TextUtils.isEmpty(s)) { return getWalletNameByAddressFromAddressDB(transaction.getFrom()); } else { return Single.just(s); } } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(RxUtils.bindToLifecycle(getView())) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<String>() { @Override public void accept(String walletName) throws Exception { if (isViewAttached()) { getView().setTransactionDetailInfo(transaction, mQueryAddressList, walletName); } } }); } }  @Override void init(); @SuppressLint("CheckResult") @Override void loadData(); @SuppressLint("CheckResult") @Override void updateTransactionDetailInfo(Transaction transaction);  }