Пример #1
0
 public void bind(VH holder, int pos) {
   if (pos == _opened)
     ExpandableIdeaUtil.openViewHolder(
         holder, holder.getBottomView(), holder.getTopView(), false);
   else
     ExpandableIdeaUtil.closeViewHolder(
         holder, holder.getBottomView(), holder.getTopView(), false);
 }
Пример #2
0
    @SuppressWarnings("unchecked")
    public void toggle(VH holder) {
      if (_opened == holder.getPosition()) {
        _opened = -1;
        ExpandableIdeaUtil.closeViewHolder(
            holder, holder.getBottomView(), holder.getTopView(), true);
      } else {
        int previous = _opened;
        _opened = holder.getPosition();
        ExpandableIdeaUtil.openViewHolder(
            holder, holder.getBottomView(), holder.getTopView(), true);

        final VH oldHolder =
            (VH) ((RecyclerView) holder.itemView.getParent()).findViewHolderForPosition(previous);
        if (oldHolder != null)
          ExpandableIdeaUtil.closeViewHolder(
              oldHolder, oldHolder.getBottomView(), oldHolder.getTopView(), true);
      }
    }