@Override public boolean onListItemClick(int position) { if (getLibraryFragment().getActionMode() != null && position != -1) { toggleSelection(position); return true; } else { openManga(adapter.getItem(position)); return false; } }
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(); } }