예제 #1
0
 @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));
                         }
                       });
             } else {
               mAlbumView.showToast(mContext.getResources().getString(R.string.toast_fail));
             }
           });
 }
예제 #2
0
 @Override
 public boolean checkStorageEnough() {
   if (!FilePathUtils.isSDCardStoredEnough()) {
     mAlbumView.showToast(mContext.getResources().getString(R.string.no_space));
     return false;
   }
   return true;
 }