@Test public void insertNodeList(){ List<Node> nodeList = new ArrayList<>(); Node node =new Node(); node.setNodeAddress("https: node.setDefaultNode(false); node.setMainNetworkNode(false); node.setChecked(false); node.setChainId("103"); node.setFormatCorrect(false); nodeList.add(node); Node node2 =new Node(); node2.setNodeAddress("https: node2.setDefaultNode(true); node2.setMainNetworkNode(true); node2.setChecked(false); node2.setChainId("103"); node2.setFormatCorrect(false); nodeList.add(node2); Node node3 =new Node(); node3.setNodeAddress("https: node3.setDefaultNode(true); node3.setMainNetworkNode(false); node3.setChecked(false); node3.setChainId("103"); node3.setFormatCorrect(false); nodeList.add(node3); Flowable.fromIterable(nodeList) .map(new Function<Node, NodeEntity>() { @Override public NodeEntity apply(Node node) throws Exception { return node.createNodeInfo(); } }).toList() .map(new Function<List<NodeEntity>, Boolean>() { @Override public Boolean apply(List<NodeEntity> nodeEntities) throws Exception { return nodeEntities.size()> 0; } }).subscribeOn(Schedulers.io()) .compose(new SchedulersTransformer()) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean aBoolean) throws Exception { if (aBoolean.booleanValue()) { System.out.println(R.string.save_node_succeed); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { Log.e("NodesettingsPresenterTest", throwable.getMessage()); } }); }
private void insertNodeList(List<Node> nodeEntityList) { NodeManager.getInstance() .insertNodeList(nodeEntityList) .compose(new SchedulersTransformer()) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean aBoolean) throws Exception { if (aBoolean.booleanValue()) { showLongToast(string(R.string.save_node_succeed)); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { Log.e(TAG, throwable.getMessage()); } }); }
NodeSettingsPresenter extends BasePresenter<NodeSettingsContract.View> implements NodeSettingsContract.Presenter { private void insertNodeList(List<Node> nodeEntityList) { NodeManager.getInstance() .insertNodeList(nodeEntityList) .compose(new SchedulersTransformer()) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean aBoolean) throws Exception { if (aBoolean.booleanValue()) { showLongToast(string(R.string.save_node_succeed)); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { Log.e(TAG, throwable.getMessage()); } }); } }
NodeSettingsPresenter extends BasePresenter<NodeSettingsContract.View> implements NodeSettingsContract.Presenter { private void insertNodeList(List<Node> nodeEntityList) { NodeManager.getInstance() .insertNodeList(nodeEntityList) .compose(new SchedulersTransformer()) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean aBoolean) throws Exception { if (aBoolean.booleanValue()) { showLongToast(string(R.string.save_node_succeed)); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { Log.e(TAG, throwable.getMessage()); } }); }  }
NodeSettingsPresenter extends BasePresenter<NodeSettingsContract.View> implements NodeSettingsContract.Presenter { private void insertNodeList(List<Node> nodeEntityList) { NodeManager.getInstance() .insertNodeList(nodeEntityList) .compose(new SchedulersTransformer()) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean aBoolean) throws Exception { if (aBoolean.booleanValue()) { showLongToast(string(R.string.save_node_succeed)); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { Log.e(TAG, throwable.getMessage()); } }); }  @Override void fetchNodes(); @Override void updateNode(Node nodeEntity, boolean isChecked); }
NodeSettingsPresenter extends BasePresenter<NodeSettingsContract.View> implements NodeSettingsContract.Presenter { private void insertNodeList(List<Node> nodeEntityList) { NodeManager.getInstance() .insertNodeList(nodeEntityList) .compose(new SchedulersTransformer()) .subscribe(new Consumer<Boolean>() { @Override public void accept(Boolean aBoolean) throws Exception { if (aBoolean.booleanValue()) { showLongToast(string(R.string.save_node_succeed)); } } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { Log.e(TAG, throwable.getMessage()); } }); }  @Override void fetchNodes(); @Override void updateNode(Node nodeEntity, boolean isChecked);  }