Ejemplo n.º 1
0
 @Override
 public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
   switch (item.getItemId()) {
     case R.id.action_move_to_category:
       moveMangasToCategories(getPresenter().selectedMangas);
       return true;
     case R.id.action_delete:
       getPresenter().deleteMangas();
       destroyActionModeIfNeeded();
       return true;
   }
   return false;
 }
Ejemplo n.º 2
0
  private void toggleSelection(int position) {
    LibraryFragment f = getLibraryFragment();

    adapter.toggleSelection(position, false);
    f.getPresenter().setSelection(adapter.getItem(position), adapter.isSelected(position));

    int count = f.getPresenter().selectedMangas.size();
    if (count == 0) {
      f.destroyActionModeIfNeeded();
    } else {
      f.setContextTitle(count);
      f.invalidateActionMode();
    }
  }
Ejemplo n.º 3
0
 private void moveMangasToCategories(List<Manga> mangas) {
   new MaterialDialog.Builder(getActivity())
       .title(R.string.action_move_category)
       .items(getPresenter().getCategoriesNames())
       .itemsCallbackMultiChoice(
           null,
           (dialog, which, text) -> {
             getPresenter().moveMangasToCategories(which, mangas);
             destroyActionModeIfNeeded();
             return true;
           })
       .positiveText(R.string.button_ok)
       .negativeText(R.string.button_cancel)
       .show();
 }