// Path: omegarecyclerview/src/main/java/com/omega_r/libs/omegarecyclerview/sticky_decoration/BaseStickyDecoration.java
// @SuppressWarnings("rawtypes")
// public abstract class BaseStickyDecoration extends RecyclerView.ItemDecoration {
// 
//     public static final long NO_STICKY_ID = -1L;
// 
//     @Nullable
//     protected StickyAdapter mStickyAdapter;
//     protected int mItemSpace;
// 
//     public BaseStickyDecoration(@Nullable StickyAdapter adapter) {
//         mStickyAdapter = adapter;
//     }
// 
//     public boolean onTouchEvent(@NonNull RecyclerView parent, @NonNull MotionEvent ev, boolean defaultResult) {
//         return defaultResult;
//     }
// 
//     @CallSuper
//     public final void setStickyAdapter(@Nullable StickyAdapter adapter) {
//         mStickyAdapter = adapter;
//     }
// 
//     public final void setItemSpace(int itemSpace) {
//         mItemSpace = itemSpace;
//     }
// 
//     protected final boolean hasSticker(int position) {
//         return mStickyAdapter != null && mStickyAdapter.getStickyId(position) != NO_STICKY_ID;
//     }
// 
// }
// 
// Path: omegarecyclerview/src/main/java/com/omega_r/libs/omegarecyclerview/sticky_decoration/StickyAdapter.java
// public interface StickyAdapter<T extends RecyclerView.ViewHolder> {
// 
//     long getStickyId(int position);
// 
//     T onCreateStickyViewHolder(ViewGroup parent);
// 
//     void onBindStickyViewHolder(T viewHolder, int position);
// 
//     void onClickStickyViewHolder(long id);
// 
//     interface Mode {
// 
//         int HEADER = 0;
//         int MIDDLE = 1;
// 
//     }
// 
// }
// 
// Path: omegarecyclerview/src/main/java/com/omega_r/libs/omegarecyclerview/utils/ViewUtils.java
// public static boolean isReverseLayout(@Nullable RecyclerView recyclerView) {
//     if (recyclerView == null) return false;
//     RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
//     if (layoutManager == null) return false;
//     if (layoutManager instanceof LinearLayoutManager) {
//         return ((LinearLayoutManager) layoutManager).getReverseLayout();
//     }
//     return false;
// }


import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.util.Pair;
import androidx.recyclerview.widget.RecyclerView;
import com.omega_r.libs.omegarecyclerview.sticky_decoration.BaseStickyDecoration;
import com.omega_r.libs.omegarecyclerview.sticky_decoration.StickyAdapter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.omega_r.libs.omegarecyclerview.utils.ViewUtils.isReverseLayout;

    private final DrawingInfo mDrawingInfo = new DrawingInfo();
    private final SparseArray<Pair<Integer, View>> mRecyclerViewItemsByAdapterPosition = new SparseArray<>();
    private final List<Integer> mAdapterPositions = new ArrayList<>();

    ExpandableStickyDecoration(@Nullable StickyAdapter adapter,
                               @Nullable OmegaExpandableRecyclerView.Adapter expandableAdapter) {
        super(adapter);
        mExpandableAdapter = expandableAdapter;
    }

    void setExpandableAdapter(@Nullable OmegaExpandableRecyclerView.Adapter adapter) {
        mExpandableAdapter = adapter;
    }

    @Override
    public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        mDrawingInfo.reset();
        mRecyclerViewItemsByAdapterPosition.clear();
        mAdapterPositions.clear();

        for (int layoutPos = 0; layoutPos < parent.getChildCount(); layoutPos++) {
            View child = parent.getChildAt(layoutPos);
            int adapterPosition = parent.getChildAdapterPosition(child);
            mRecyclerViewItemsByAdapterPosition.put(adapterPosition, Pair.create(layoutPos, child));
            mAdapterPositions.add(adapterPosition);
        }

        Collections.sort(mAdapterPositions);

// Path: omegarecyclerview/src/main/java/com/omega_r/libs/omegarecyclerview/sticky_decoration/BaseStickyDecoration.java
// @SuppressWarnings("rawtypes")
// public abstract class BaseStickyDecoration extends RecyclerView.ItemDecoration {
// 
//     public static final long NO_STICKY_ID = -1L;
// 
//     @Nullable
//     protected StickyAdapter mStickyAdapter;
//     protected int mItemSpace;
// 
//     public BaseStickyDecoration(@Nullable StickyAdapter adapter) {
//         mStickyAdapter = adapter;
//     }
// 
//     public boolean onTouchEvent(@NonNull RecyclerView parent, @NonNull MotionEvent ev, boolean defaultResult) {
//         return defaultResult;
//     }
// 
//     @CallSuper
//     public final void setStickyAdapter(@Nullable StickyAdapter adapter) {
//         mStickyAdapter = adapter;
//     }
// 
//     public final void setItemSpace(int itemSpace) {
//         mItemSpace = itemSpace;
//     }
// 
//     protected final boolean hasSticker(int position) {
//         return mStickyAdapter != null && mStickyAdapter.getStickyId(position) != NO_STICKY_ID;
//     }
// 
// }
// 
// Path: omegarecyclerview/src/main/java/com/omega_r/libs/omegarecyclerview/sticky_decoration/StickyAdapter.java
// public interface StickyAdapter<T extends RecyclerView.ViewHolder> {
// 
//     long getStickyId(int position);
// 
//     T onCreateStickyViewHolder(ViewGroup parent);
// 
//     void onBindStickyViewHolder(T viewHolder, int position);
// 
//     void onClickStickyViewHolder(long id);
// 
//     interface Mode {
// 
//         int HEADER = 0;
//         int MIDDLE = 1;
// 
//     }
// 
// }
// 
// Path: omegarecyclerview/src/main/java/com/omega_r/libs/omegarecyclerview/utils/ViewUtils.java
// public static boolean isReverseLayout(@Nullable RecyclerView recyclerView) {
//     if (recyclerView == null) return false;
//     RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
//     if (layoutManager == null) return false;
//     if (layoutManager instanceof LinearLayoutManager) {
//         return ((LinearLayoutManager) layoutManager).getReverseLayout();
//     }
//     return false;
// }


// Path: omegarecyclerview_expandable/src/main/java/com/omega_r/libs/omegarecyclerview_expandable/ExpandableStickyDecoration.java
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.util.Pair;
import androidx.recyclerview.widget.RecyclerView;
import com.omega_r.libs.omegarecyclerview.sticky_decoration.BaseStickyDecoration;
import com.omega_r.libs.omegarecyclerview.sticky_decoration.StickyAdapter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.omega_r.libs.omegarecyclerview.utils.ViewUtils.isReverseLayout;


    private final DrawingInfo mDrawingInfo = new DrawingInfo();
    private final SparseArray<Pair<Integer, View>> mRecyclerViewItemsByAdapterPosition = new SparseArray<>();
    private final List<Integer> mAdapterPositions = new ArrayList<>();

    ExpandableStickyDecoration(@Nullable StickyAdapter adapter,
                               @Nullable OmegaExpandableRecyclerView.Adapter expandableAdapter) {
        super(adapter);
        mExpandableAdapter = expandableAdapter;
    }

    void setExpandableAdapter(@Nullable OmegaExpandableRecyclerView.Adapter adapter) {
        mExpandableAdapter = adapter;
    }

    @Override
    public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        mDrawingInfo.reset();
        mRecyclerViewItemsByAdapterPosition.clear();
        mAdapterPositions.clear();

        for (int layoutPos = 0; layoutPos < parent.getChildCount(); layoutPos++) {
            View child = parent.getChildAt(layoutPos);
            int adapterPosition = parent.getChildAdapterPosition(child);
            mRecyclerViewItemsByAdapterPosition.put(adapterPosition, Pair.create(layoutPos, child));
            mAdapterPositions.add(adapterPosition);
        }

        Collections.sort(mAdapterPositions);

        if (isReverseLayout(parent)) {