@Test public void checkVersion() { }
@Override public void checkVersion(String currentVersion) { addSubscriber( mModel.getVersionDetails() .compose(RxUtils.switchSchedulers()) .filter(new Predicate<Version>() { @Override public boolean test(Version version) throws Exception { return Float.valueOf(currentVersion.replace("v", "")) < Float.valueOf(version.getTag_name().replace("v", "")); } }) .map(new Function<Version, String>() { @Override public String apply(Version version) throws Exception { StringBuilder content = new StringBuilder(); Resources resources = App.getContext().getResources(); mView.setNewVersionName(version.getTag_name()); content.append(resources.getString(R.string.dialog_versionName)).append(version.getTag_name()).append("\n") .append(resources.getString(R.string.dialog_versionSize)).append(FileUtil.getFormatSize(version.getAssets().get(0).getSize())).append("\n") .append(resources.getString(R.string.dialog_versionContent)).append("\n").append(version.getBody()); return content.toString(); } }) .subscribeWith(new DefaultObserver<String>(mView, true, true){ @Override public void onNext(String s){ super.onNext(s); mView.showUpdataDialog(s); } }) ); }
MainPresenter extends BaseActivityPresenter<MainContract.View> implements MainContract.Presenter { @Override public void checkVersion(String currentVersion) { addSubscriber( mModel.getVersionDetails() .compose(RxUtils.switchSchedulers()) .filter(new Predicate<Version>() { @Override public boolean test(Version version) throws Exception { return Float.valueOf(currentVersion.replace("v", "")) < Float.valueOf(version.getTag_name().replace("v", "")); } }) .map(new Function<Version, String>() { @Override public String apply(Version version) throws Exception { StringBuilder content = new StringBuilder(); Resources resources = App.getContext().getResources(); mView.setNewVersionName(version.getTag_name()); content.append(resources.getString(R.string.dialog_versionName)).append(version.getTag_name()).append("\n") .append(resources.getString(R.string.dialog_versionSize)).append(FileUtil.getFormatSize(version.getAssets().get(0).getSize())).append("\n") .append(resources.getString(R.string.dialog_versionContent)).append("\n").append(version.getBody()); return content.toString(); } }) .subscribeWith(new DefaultObserver<String>(mView, true, true){ @Override public void onNext(String s){ super.onNext(s); mView.showUpdataDialog(s); } }) ); } }
MainPresenter extends BaseActivityPresenter<MainContract.View> implements MainContract.Presenter { @Override public void checkVersion(String currentVersion) { addSubscriber( mModel.getVersionDetails() .compose(RxUtils.switchSchedulers()) .filter(new Predicate<Version>() { @Override public boolean test(Version version) throws Exception { return Float.valueOf(currentVersion.replace("v", "")) < Float.valueOf(version.getTag_name().replace("v", "")); } }) .map(new Function<Version, String>() { @Override public String apply(Version version) throws Exception { StringBuilder content = new StringBuilder(); Resources resources = App.getContext().getResources(); mView.setNewVersionName(version.getTag_name()); content.append(resources.getString(R.string.dialog_versionName)).append(version.getTag_name()).append("\n") .append(resources.getString(R.string.dialog_versionSize)).append(FileUtil.getFormatSize(version.getAssets().get(0).getSize())).append("\n") .append(resources.getString(R.string.dialog_versionContent)).append("\n").append(version.getBody()); return content.toString(); } }) .subscribeWith(new DefaultObserver<String>(mView, true, true){ @Override public void onNext(String s){ super.onNext(s); mView.showUpdataDialog(s); } }) ); } @Inject  MainPresenter(DataModel dataModel); }
MainPresenter extends BaseActivityPresenter<MainContract.View> implements MainContract.Presenter { @Override public void checkVersion(String currentVersion) { addSubscriber( mModel.getVersionDetails() .compose(RxUtils.switchSchedulers()) .filter(new Predicate<Version>() { @Override public boolean test(Version version) throws Exception { return Float.valueOf(currentVersion.replace("v", "")) < Float.valueOf(version.getTag_name().replace("v", "")); } }) .map(new Function<Version, String>() { @Override public String apply(Version version) throws Exception { StringBuilder content = new StringBuilder(); Resources resources = App.getContext().getResources(); mView.setNewVersionName(version.getTag_name()); content.append(resources.getString(R.string.dialog_versionName)).append(version.getTag_name()).append("\n") .append(resources.getString(R.string.dialog_versionSize)).append(FileUtil.getFormatSize(version.getAssets().get(0).getSize())).append("\n") .append(resources.getString(R.string.dialog_versionContent)).append("\n").append(version.getBody()); return content.toString(); } }) .subscribeWith(new DefaultObserver<String>(mView, true, true){ @Override public void onNext(String s){ super.onNext(s); mView.showUpdataDialog(s); } }) ); } @Inject  MainPresenter(DataModel dataModel); @Override void subscribeEvent(); @Override void setCurrentItem(int position); @Override int getCurrentItem(); @Override boolean getNightModeState(); @Override boolean getStatusBarState(); @Override boolean getAutoUpdataState(); @Override void checkVersion(String currentVersion); }
MainPresenter extends BaseActivityPresenter<MainContract.View> implements MainContract.Presenter { @Override public void checkVersion(String currentVersion) { addSubscriber( mModel.getVersionDetails() .compose(RxUtils.switchSchedulers()) .filter(new Predicate<Version>() { @Override public boolean test(Version version) throws Exception { return Float.valueOf(currentVersion.replace("v", "")) < Float.valueOf(version.getTag_name().replace("v", "")); } }) .map(new Function<Version, String>() { @Override public String apply(Version version) throws Exception { StringBuilder content = new StringBuilder(); Resources resources = App.getContext().getResources(); mView.setNewVersionName(version.getTag_name()); content.append(resources.getString(R.string.dialog_versionName)).append(version.getTag_name()).append("\n") .append(resources.getString(R.string.dialog_versionSize)).append(FileUtil.getFormatSize(version.getAssets().get(0).getSize())).append("\n") .append(resources.getString(R.string.dialog_versionContent)).append("\n").append(version.getBody()); return content.toString(); } }) .subscribeWith(new DefaultObserver<String>(mView, true, true){ @Override public void onNext(String s){ super.onNext(s); mView.showUpdataDialog(s); } }) ); } @Inject  MainPresenter(DataModel dataModel); @Override void subscribeEvent(); @Override void setCurrentItem(int position); @Override int getCurrentItem(); @Override boolean getNightModeState(); @Override boolean getStatusBarState(); @Override boolean getAutoUpdataState(); @Override void checkVersion(String currentVersion);  }