use of de.djuelg.neuronizer.presentation.ui.flexibleadapter.TodoListHeaderViewModel in project Neuronizer by djuelg.
the class TodoListFragment method editSelectedHeader.
private void editSelectedHeader() {
int position = mAdapter.getSelectedPositions().get(0);
TodoListHeaderViewModel headerVH = (TodoListHeaderViewModel) mAdapter.getItem(position);
if (headerVH != null) {
TodoListHeader header = headerVH.getHeader();
showEditHeaderDialog(this, header.getUuid(), header.getTitle(), header.getPosition(), header.isExpanded());
}
mActionModeHelper.destroyActionModeIfCan();
}
use of de.djuelg.neuronizer.presentation.ui.flexibleadapter.TodoListHeaderViewModel in project Neuronizer by djuelg.
the class TodoListFragment method onDestroyActionMode.
@Override
public void onDestroyActionMode(ActionMode mode) {
changeAppbarColor(getActivity(), R.color.colorPrimary);
for (IHeader header : mAdapter.getHeaderItems()) {
TodoListHeaderViewModel vm = (TodoListHeaderViewModel) header;
boolean shouldExpand = vm.getHeader().isExpanded();
if (shouldExpand && !omitActionModeExpansion)
mAdapter.expand(vm);
}
}
use of de.djuelg.neuronizer.presentation.ui.flexibleadapter.TodoListHeaderViewModel in project Neuronizer by djuelg.
the class TodoListFragment method permanentDeleteItems.
public void permanentDeleteItems(List<Integer> positions) {
if (mAdapter == null || mPresenter == null)
return;
for (int position : positions) {
AbstractFlexibleItem adapterItem = mAdapter.getItem(position);
if (adapterItem != null) {
switch(adapterItem.getLayoutRes()) {
case R.layout.todo_list_header:
if (mActionModeHelper != null)
mActionModeHelper.destroyActionModeIfCan();
mPresenter.deleteHeader(((TodoListHeaderViewModel) adapterItem).getHeader().getUuid());
break;
case R.layout.todo_list_item:
mPresenter.deleteItem(((TodoListItemViewModel) adapterItem).getItem().getUuid());
break;
}
}
mAdapter.removeItem(position);
}
mListener.onUpdateAllWidgets(50);
}
Aggregations