@Override public int getItemCount() { if (mainMenuAdapter.getEditMode()) { return row.getNumberOfBranches() + 1; } return row.getNumberOfBranches(); }
// Returns the view type of the item at position for the purposes of view recycling. @Override public int getItemViewType(int position) { if (mainMenuAdapter.getEditMode()) { if (position == getItemCount() - 1) { return ADDBUTTON; } else { if (row.getBranches().get(position).getPrice() == null) { return CATAGORYITEM; } else { return PRICEITEM; } } } else { if (row.getBranches().get(position).getPrice() == null) { return CATAGORYITEM; } else { return PRICEITEM; } } }