@Test public void deleteWallet() { List<Wallet> list = new ArrayList<>(); Wallet wallet = new Wallet(); wallet.setCreateTime(1115448481); wallet.setName("001"); wallet.setAddress("0xfb1b74328f936973a59620d683e1b1acb487d9e7"); AccountBalance balance = new AccountBalance(); balance.setFree("10000000084489"); balance.setLock("0"); wallet.setAccountBalance(balance); list.add(wallet); Wallet wallet2 = new Wallet(); wallet2.setCreateTime(1115448485); wallet2.setName("002"); wallet2.setAddress("0x2e95e3ce0a54951eb9a99152a6d5827872dfb4fd"); AccountBalance balance2 = new AccountBalance(); balance2.setFree("1000000005655655"); balance2.setLock("0"); wallet2.setAccountBalance(balance2); list.add(wallet2); Wallet wallet3 = new Wallet(); wallet3.setName("003"); wallet3.setAddress("0xca4b151b0b100ae53c9d78dd136905e681622ee7"); wallet3.setCreateTime(1115448483); AccountBalance balance3 = new AccountBalance(); balance3.setFree("10000000056556584855"); balance3.setLock("0"); wallet3.setAccountBalance(balance3); list.add(wallet3); Wallet wallet4 = new Wallet(); wallet4.setName("004"); wallet4.setCreateTime(1115448486); AccountBalance balance4 = new AccountBalance(); balance4.setFree("1000000001156584855"); balance4.setLock("0"); wallet4.setAccountBalance(balance4); list.add(wallet4); System.out.println("---------------------------"); Single.fromCallable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return list.remove(wallet4); } }) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean isSuccess) throws Exception { Log.d("==============", "boolean" + "=====>" + isSuccess); System.out.println( "boolean" + "=====>" + isSuccess); } }); Log.d("==============" , "list" + "=====>" + list.toString() + "length" + "==========>" +list.size()); }
@Override public void deleteWallet() { Single .fromCallable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return WalletManager.getInstance().deleteWallet(mWalletEntity); } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(bindToLifecycle()) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean isSuccess) throws Exception { if (isSuccess && isViewAttached()) { EventPublisher.getInstance().sendWalletNumberChangeEvent(); currentActivity().finish(); } } }); }
ManageWalletPresenter extends BasePresenter<ManageWalletContract.View> implements ManageWalletContract.Presenter { @Override public void deleteWallet() { Single .fromCallable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return WalletManager.getInstance().deleteWallet(mWalletEntity); } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(bindToLifecycle()) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean isSuccess) throws Exception { if (isSuccess && isViewAttached()) { EventPublisher.getInstance().sendWalletNumberChangeEvent(); currentActivity().finish(); } } }); } }
ManageWalletPresenter extends BasePresenter<ManageWalletContract.View> implements ManageWalletContract.Presenter { @Override public void deleteWallet() { Single .fromCallable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return WalletManager.getInstance().deleteWallet(mWalletEntity); } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(bindToLifecycle()) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean isSuccess) throws Exception { if (isSuccess && isViewAttached()) { EventPublisher.getInstance().sendWalletNumberChangeEvent(); currentActivity().finish(); } } }); }  }
ManageWalletPresenter extends BasePresenter<ManageWalletContract.View> implements ManageWalletContract.Presenter { @Override public void deleteWallet() { Single .fromCallable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return WalletManager.getInstance().deleteWallet(mWalletEntity); } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(bindToLifecycle()) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean isSuccess) throws Exception { if (isSuccess && isViewAttached()) { EventPublisher.getInstance().sendWalletNumberChangeEvent(); currentActivity().finish(); } } }); }  @Override void init(Wallet wallet); @Override Wallet getWalletData(); @Override void showWalletInfo(); @Override void validPassword(int viewType, Credentials credentials); @Override void deleteObservedWallet(); @Override void deleteWallet(); @Override void modifyName(String name); @Override void modifyHDName(String name); @Override void backup(); @Override boolean isExists(String walletName); }
ManageWalletPresenter extends BasePresenter<ManageWalletContract.View> implements ManageWalletContract.Presenter { @Override public void deleteWallet() { Single .fromCallable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return WalletManager.getInstance().deleteWallet(mWalletEntity); } }) .compose(RxUtils.getSingleSchedulerTransformer()) .compose(bindToLifecycle()) .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity())) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean isSuccess) throws Exception { if (isSuccess && isViewAttached()) { EventPublisher.getInstance().sendWalletNumberChangeEvent(); currentActivity().finish(); } } }); }  @Override void init(Wallet wallet); @Override Wallet getWalletData(); @Override void showWalletInfo(); @Override void validPassword(int viewType, Credentials credentials); @Override void deleteObservedWallet(); @Override void deleteWallet(); @Override void modifyName(String name); @Override void modifyHDName(String name); @Override void backup(); @Override boolean isExists(String walletName);  }