Search in sources :

Example 1 with ItemTouchHelperViewHolder

use of com.marshalchen.ultimaterecyclerview.itemTouchHelper.ItemTouchHelperViewHolder in project MyDiary by erttyy8821.

the class MemoItemTouchHelperCallback method onSelectedChanged.

@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    // We only want the active item to change
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        if (viewHolder instanceof ItemTouchHelperViewHolder) {
            // Let the view holder know that this item is being moved or dragged
            ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
            itemViewHolder.onItemSelected();
        }
    }
    super.onSelectedChanged(viewHolder, actionState);
}
Also used : ItemTouchHelperViewHolder(com.marshalchen.ultimaterecyclerview.itemTouchHelper.ItemTouchHelperViewHolder)

Example 2 with ItemTouchHelperViewHolder

use of com.marshalchen.ultimaterecyclerview.itemTouchHelper.ItemTouchHelperViewHolder in project MyDiary by erttyy8821.

the class MemoItemTouchHelperCallback method clearView.

@Override
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
    super.clearView(recyclerView, viewHolder);
    viewHolder.itemView.setAlpha(ALPHA_FULL);
    //Save db & modify adapter sort first
    mAdapter.onItemMoveFinish();
    if (viewHolder instanceof ItemTouchHelperViewHolder) {
        // Tell the view holder it's time to restore the idle state
        ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
        itemViewHolder.onItemClear();
    }
}
Also used : ItemTouchHelperViewHolder(com.marshalchen.ultimaterecyclerview.itemTouchHelper.ItemTouchHelperViewHolder)

Aggregations

ItemTouchHelperViewHolder (com.marshalchen.ultimaterecyclerview.itemTouchHelper.ItemTouchHelperViewHolder)2