private void changeText(TextView view, TextItemPinned item) { view.setText(item.getLabel()); }
/** * Creates a Group using a label for grouping items * * @param items the list of items * @param label the String that rapresent the label to be shown */ public Group(List<ItemPinned> items, String label) { this.items = items; if (this.items != null) { for (int i = 0; i < this.items.size(); i++) { ItemPinned itemPinned = this.items.get(i); initItemPosition(itemPinned, i); if (this.items.get(i) instanceof TextItemPinned) ((TextItemPinned) this.items.get(i)).setLabel(label); } } }
if (!hashMap.containsKey(item.select().substring(0, 1).toUpperCase())) { List<ItemPinned> list = new ArrayList<>(); list.add(new TextItemPinned(item)); hashMap.get(item.select().substring(0, 1).toUpperCase()).add(new TextItemPinned(item));
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof PinnedViewHolder) { ItemPinned currentItem = mListWrapper.getItemPinned(position); if (currentItem.isVisible()) { ((PinnedViewHolder) holder).viewPin.setVisibility(View.VISIBLE); } else { ((PinnedViewHolder) holder).viewPin.setVisibility(View.INVISIBLE); } if (currentItem instanceof TextItemPinned) { ((TextView) ((PinnedViewHolder) holder).viewPin) .setText(((TextItemPinned) currentItem).getLabel()); } else if (currentItem instanceof ImageItemPinned) { ((ImageView) ((PinnedViewHolder) holder).viewPin) .setImageResource(((ImageItemPinned) currentItem).getImage()); } } }