use of com.yydcdut.note.bus.CategoryCreateEvent in project PhotoNoter by yydcdut.
the class AlbumPresenterImpl method createCategory.
@Override
public void createCategory(String newCategoryLabel) {
mRxCategory.getAllCategories().observeOn(AndroidSchedulers.mainThread()).subscribe(categories -> {
int totalNumber = categories.size();
if (!TextUtils.isEmpty(newCategoryLabel)) {
mRxCategory.saveCategory(newCategoryLabel, 0, totalNumber, true).observeOn(AndroidSchedulers.mainThread()).subscribe(categories1 -> {
boolean success = false;
for (Category category : categories1) {
if (category.getLabel().equals(newCategoryLabel)) {
mAlbumView.changeActivityListMenuCategoryChecked(category);
EventBus.getDefault().post(new CategoryCreateEvent());
success = true;
break;
}
}
if (!success) {
mAlbumView.showToast(mContext.getResources().getString(R.string.toast_fail));
}
}, (throwable -> YLog.e(throwable)));
} else {
mAlbumView.showToast(mContext.getResources().getString(R.string.toast_fail));
}
}, (throwable -> YLog.e(throwable)));
}
Aggregations