// Path: app/src/main/java/net/hyx/app/volumenotification/helper/ItemTouchListener.java
// public interface ItemTouchListener {
// 
//     boolean onItemMove(int fromPosition, int toPosition);
//     void onItemSwiped(int position);
// }
// 
// Path: app/src/main/java/net/hyx/app/volumenotification/helper/RecyclerViewListener.java
// public interface RecyclerViewListener {
// 
//     void onItemSelected();
//     void onItemClear();
// }


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import net.hyx.app.volumenotification.helper.ItemTouchListener;
import net.hyx.app.volumenotification.helper.RecyclerViewListener;

    @Override
    public boolean isItemViewSwipeEnabled() {
        return true;
    }

    @Override
    public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
        int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
        int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
        return makeMovementFlags(dragFlags, swipeFlags);
    }

    @Override
    public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder source, @NonNull RecyclerView.ViewHolder target) {
        if (source.getItemViewType() != target.getItemViewType()) {
            return false;
        }
        return listener.onItemMove(source.getAdapterPosition(), target.getAdapterPosition());
    }

    @Override
    public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
        listener.onItemSwiped(viewHolder.getAdapterPosition());
    }

    @Override
    public void onSelectedChanged(@Nullable RecyclerView.ViewHolder viewHolder, int actionState) {
        super.onSelectedChanged(viewHolder, actionState);
        if (viewHolder != null) {
// Path: app/src/main/java/net/hyx/app/volumenotification/helper/ItemTouchListener.java
// public interface ItemTouchListener {
// 
//     boolean onItemMove(int fromPosition, int toPosition);
//     void onItemSwiped(int position);
// }
// 
// Path: app/src/main/java/net/hyx/app/volumenotification/helper/RecyclerViewListener.java
// public interface RecyclerViewListener {
// 
//     void onItemSelected();
//     void onItemClear();
// }


// Path: app/src/main/java/net/hyx/app/volumenotification/adapter/ItemTouchAdapter.java
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import net.hyx.app.volumenotification.helper.ItemTouchListener;
import net.hyx.app.volumenotification.helper.RecyclerViewListener;


    @Override
    public boolean isItemViewSwipeEnabled() {
        return true;
    }

    @Override
    public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
        int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
        int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
        return makeMovementFlags(dragFlags, swipeFlags);
    }

    @Override
    public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder source, @NonNull RecyclerView.ViewHolder target) {
        if (source.getItemViewType() != target.getItemViewType()) {
            return false;
        }
        return listener.onItemMove(source.getAdapterPosition(), target.getAdapterPosition());
    }

    @Override
    public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
        listener.onItemSwiped(viewHolder.getAdapterPosition());
    }

    @Override
    public void onSelectedChanged(@Nullable RecyclerView.ViewHolder viewHolder, int actionState) {
        super.onSelectedChanged(viewHolder, actionState);
        if (viewHolder != null) {
            RecyclerViewListener itemViewHolder = (RecyclerViewListener) viewHolder;