@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));
             }
           });
 }
 @Override
 public void movePhotos2AnotherCategory() {
   mRxCategory
       .getAllCategories()
       .observeOn(AndroidSchedulers.mainThread())
       .subscribe(
           categories -> {
             final String[] categoryIdStringArray = new String[categories.size()];
             final String[] categoryLabelArray = new String[categories.size()];
             for (int i = 0; i < categoryIdStringArray.length; i++) {
               categoryIdStringArray[i] = categories.get(i).getId() + "";
               categoryLabelArray[i] = categories.get(i).getLabel();
             }
             mAlbumView.showMovePhotos2AnotherCategoryDialog(
                 categoryIdStringArray, categoryLabelArray);
           });
 }
 @Override
 public void changePhotosCategory(int toCategoryId) {
   if (mCategoryId != toCategoryId) {
     mRxPhotoNote
         .findByCategoryId(mCategoryId, mAlbumSortKind)
         .observeOn(AndroidSchedulers.mainThread())
         .map(
             photoNoteList -> {
               TreeMap<Integer, PhotoNote> map = getTreeMap();
               for (int i = 0; i < photoNoteList.size(); i++) {
                 PhotoNote photoNote = photoNoteList.get(i);
                 if (photoNote.isSelected()) {
                   photoNote.setSelected(false);
                   photoNote.setCategoryId(toCategoryId);
                   map.put(i, photoNote);
                 }
               }
               int times = 0;
               for (Map.Entry<Integer, PhotoNote> entry : map.entrySet()) {
                 photoNoteList.remove(entry.getValue());
                 mAlbumView.notifyItemRemoved(entry.getKey() - times); // todo 这个在这里合适吗?觉得严重的不合适
                 mRxPhotoNote.updatePhotoNote(entry.getValue()).subscribe();
                 times++;
               }
               return map.size();
             })
         .subscribe(
             integer -> {
               mRxCategory
                   .updateChangeCategory(mCategoryId, toCategoryId, integer)
                   .subscribe(
                       categories -> {
                         mRxPhotoNote
                             .refreshByCategoryId(mCategoryId, ComparatorFactory.FACTORY_NOT_SORT)
                             .subscribe();
                         mRxPhotoNote
                             .refreshByCategoryId(toCategoryId, ComparatorFactory.FACTORY_NOT_SORT)
                             .subscribe();
                         EventBus.getDefault().post(new CategoryMoveEvent());
                       });
             });
   }
 }