Java Code Examples for android.support.v7.widget.helper.ItemTouchHelper#ACTION_STATE_IDLE

The following examples show how to use android.support.v7.widget.helper.ItemTouchHelper#ACTION_STATE_IDLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleItemTouchHelperCallback.java    From RecyclerViewUndoSwipe with Apache License 2.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        // Let the view holder know that this item is being moved or dragged
        ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
        itemViewHolder.onItemSelected(context);
    }

    super.onSelectedChanged(viewHolder, actionState);

   /* final boolean swiping = actionState == ItemTouchHelper.ACTION_STATE_SWIPE;
    swipeRefreshLayout.setEnabled(!swiping);*/
}
 
Example 2
Source File: ItemDragHelperCallback.java    From NetEasyNews with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        ItemDragVHListener itemViewHolder = (ItemDragVHListener) viewHolder;
        itemViewHolder.onItemSelected();
    }
    super.onSelectedChanged(viewHolder, actionState);
}
 
Example 3
Source File: SimpleItemTouchHelperCallback.java    From ankihelper with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
        itemViewHolder.onItemSelected();
    }

    super.onSelectedChanged(viewHolder, actionState);
}
 
Example 4
Source File: SimpleItemTouchHelperCallback.java    From FastAccess with GNU General Public License v3.0 5 votes vote down vote up
@Override public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        if (viewHolder instanceof ItemTouchHelperViewHolder) {
            ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
            itemViewHolder.onItemSelected();
        }
    }
    super.onSelectedChanged(viewHolder, actionState);
}
 
Example 5
Source File: RecyItemTouchHelperCallback.java    From RecyclerViewEvent with Apache License 2.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        viewHolder.itemView.setBackgroundColor(Color.LTGRAY);
    }
    super.onSelectedChanged(viewHolder, actionState);
}
 
Example 6
Source File: MyItemTouchHelperCallback.java    From MaterialDesignDemo with MIT License 5 votes vote down vote up
/**
 * 当item被拖拽或侧滑时触发
 *
 * @param viewHolder
 * @param actionState 当前item的状态
 */
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    super.onSelectedChanged(viewHolder, actionState);
    //不管是拖拽或是侧滑,背景色都要变化
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE)
        viewHolder.itemView.setBackgroundColor(viewHolder.itemView.getContext().getResources().getColor(android.R.color.darker_gray));
}
 
Example 7
Source File: SimpleItemTouchHelperCallback.java    From Xrv with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 8
Source File: TabListTouchHelperCallback.java    From photosearcher with Apache License 2.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        ((IItemTouchHelperViewHolder) viewHolder).onItemSelected();
    }
    super.onSelectedChanged(viewHolder, actionState);
}
 
Example 9
Source File: SimpleItemTouchHelperCallback.java    From GithubTrends with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 10
Source File: SimpleItemTouchHelperCallback.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        // Let the view holder know that this item is being moved or dragged
        ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
        itemViewHolder.onItemSelected(context);
    }

    super.onSelectedChanged(viewHolder, actionState);

   /* final boolean swiping = actionState == ItemTouchHelper.ACTION_STATE_SWIPE;
    swipeRefreshLayout.setEnabled(!swiping);*/
}
 
Example 11
Source File: SimpleItemTouchHelperCallback.java    From NewsMe with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 12
Source File: SimpleItemTouchHelperCallback.java    From homeassist with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 13
Source File: QueueActivity.java    From PainlessMusicPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        if (viewHolder instanceof ItemTouchHelperViewHolder) {
            ((ItemTouchHelperViewHolder) viewHolder).onItemSelected();
        }
    }

    super.onSelectedChanged(viewHolder, actionState);
}
 
Example 14
Source File: SimpleItemTouchHelperCallback.java    From friendly-plans with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    // We only want the active item to change
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE && 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);
}
 
Example 15
Source File: TodoItemTouchHelperCallback.java    From ToDoList with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 16
Source File: SimpleItemTouchHelperCallback.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
    // We only want the active item
    if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
        if (viewHolder instanceof ItemTouchHelperViewHolder) {
            ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
            itemViewHolder.onItemSelected();
        }
    }

    super.onSelectedChanged(viewHolder, actionState);
}
 
Example 17
Source File: ConversationsOverviewFragment.java    From Conversations with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder,
							float dX, float dY, int actionState, boolean isCurrentlyActive) {
	super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
	if(actionState != ItemTouchHelper.ACTION_STATE_IDLE){
		Paint paint = new Paint();
		paint.setColor(StyledAttributes.getColor(activity,R.attr.conversations_overview_background));
		paint.setStyle(Paint.Style.FILL);
		c.drawRect(viewHolder.itemView.getLeft(),viewHolder.itemView.getTop()
				,viewHolder.itemView.getRight(),viewHolder.itemView.getBottom(), paint);
	}
}
 
Example 18
Source File: SimpleItemTouchHelperCallback.java    From YTPlayer with GNU General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 19
Source File: ItemDragCallback.java    From ForPDA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
    int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
    int swipeFlags = ItemTouchHelper.ACTION_STATE_IDLE;
    return makeMovementFlags(dragFlags, swipeFlags);
}
 
Example 20
Source File: NormalAdapter.java    From PowerRecyclerView with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public int[] getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
    return new int[]{ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT, ItemTouchHelper.ACTION_STATE_IDLE};
}