RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Overview

Advanced RecyclerView

This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expandable item features. Works on API level 14 or later.

Documentation site: https://advancedrecyclerview.h6ah4i.com/

Maven Central Android Arsenal


Download the example app

Get it on Google Play

Demonstration video on YouTube

Advanced

Target platforms

  • API level 14 or later

Latest version

Recent Breaking Change Info

  • v1.0.0:
    • Migrated to AndroidX (Use v0.11.0 instead if your project uses support libraries)
    • BaseWrapperAdapter
    • Removed some deprecated features
      • SwipeableItemConstants.REACTION_CAN_SWIPE_BOTH
      • SwipeableItemConstants.REACTION_CAN_NOT_SWIPE_BOTH
      • SwipeableItemConstants.REACTION_CAN_NOT_SWIPE_BOTH_WITH_RUBBER_BAND_EFFECT
    • New DraggableItemState getDragState() method added to the DraggableItemViewHolder interface
    • New SwipeableItemState getSwipeState() method added to the SwipeableItemViewHolder interface
    • New ExpandableItemState getExpandState() method added to the ExpandableItemViewHolder interface

👉 Migration guide from v0.11.0 to v1.0.0

Getting started

This library is published on Maven Central. Just add these lines to build.gradle.

repositories {
+     mavenCentral()
}

dependencies {
+     implementation 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:1.0.0'
}

Please check the Getting Started section on the official documentation site for more details.


Examples

Please check the implementation of the simple examples.

Drag & Drop related examples

Expandable item related examples

Swipeable related examples

Headers and Footers examples

WrapperAdapter examples

Hybrid examples

Other examples

iOS Mail app like swipe action


License

This library is licensed under the Apache Software License, Version 2.0.

See LICENSE for full of the license text.

Copyright (C) 2015 Haruki Hasegawa

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • AnimatorCompatHelper Class Not Found Exception using AppCompat 26.0.0

    AnimatorCompatHelper Class Not Found Exception using AppCompat 26.0.0

    When using compat library 26.0.0 the app crash when doing Recyclerview Animations

    java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper;
         at com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager.resetAnimation(BaseItemAnimationManager.java:161)
         at com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator$DefaultItemMoveAnimationManager.addPendingAnimation(RefactoredDefaultItemAnimator.java:312)
         at com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator.animateMove(GeneralItemAnimator.java:88)
         at android.support.v7.widget.SimpleItemAnimator.animatePersistence(SimpleItemAnimator.java:140)
         at android.support.v7.widget.RecyclerView$4.processPersistent(RecyclerView.java:543)
         at android.support.v7.widget.ViewInfoStore.process(ViewInfoStore.java:239)
         at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3761)
         at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3419)
         at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3960)
    
    enhancement 
    opened by jordyamc 35
  • How to notifyDataSetChanged when delete a group?

    How to notifyDataSetChanged when delete a group?

    Hi, @h6ah4i

    I'm trying to remove a group in a ExpandableDraggableItemAdapter. But after remove, the items belows the removed item won't refresh.

    Here's my code

    public Object removeItem(int groupPos) {
        mExpandManager.notifyGroupItemRemoved(groupPos);
        Object obj = mDataList.remove(groupPos);
        return obj;
    }
    

    And there's another implementation. I try to refresh all the item below the deleted item.

    Obviously, The code is ugly. And I want to know how to make it better.

    public Object removeItem2(int groupPos) {
        long packedPos = RecyclerViewExpandableItemManager
                .getPackedPositionForGroup(groupPos);
        int realPos = mExpandManager.getFlatPosition(packedPos);
    
        notifyItemRemoved(realPos);
        notifyItemRangeChanged(realPos, 999);  // 999 because I don't know how to getItemCount();
    
        Object obj = mDataList.remove(groupPos);
        return obj;
    }
    
    question 
    opened by wliu6v 15
  • setSpanSizeLookup while dragging but not drop yet.

    setSpanSizeLookup while dragging but not drop yet.

    HI, I'm using GridLayoutManager to do drag n' drop. The problem here is that while I'm dragging item A over item B which's next to, and when the item B is pushed out, it still uses SpanSize of item A, not resize.

    My question is that how I can update SpanSize of item B when it is pushed to new place while I'm dragging (not drop yet).

    Sr for my bad English.

    enhancement question 
    opened by trieulh-ict 12
  • java.lang.IllegalStateException: Added View has RecyclerView as parent but view is not a real child. Unfiltered index:0

    java.lang.IllegalStateException: Added View has RecyclerView as parent but view is not a real child. Unfiltered index:0

    Hi, I use expandable and draggable adapter in my app. Some users crashed when use my app, but I can't response this crash.

    Here's the crash log, I want to know if there's any other people has this crash? And how to solve it?

    java.lang.IllegalStateException: Added View has RecyclerView as parent but view is not a real child. Unfiltered index:0
        at android.support.v7.widget.RecyclerView$LayoutManager.addViewInt(RecyclerView.java:6071)
        at android.support.v7.widget.RecyclerView$LayoutManager.addView(RecyclerView.java:6037)
        at android.support.v7.widget.RecyclerView$LayoutManager.addView(RecyclerView.java:6025)
        at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1378)
        at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1327)
        at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:556)
        at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2713)
        at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3011)
        at android.view.View.layout(View.java:14858)
        at android.view.ViewGroup.layout(ViewGroup.java:4646)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1673)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1527)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
        at android.view.View.layout(View.java:14858)
        at android.view.ViewGroup.layout(ViewGroup.java:4646)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
        at android.view.View.layout(View.java:14858)
        at android.view.ViewGroup.layout(ViewGroup.java:4646)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
        at android.view.View.layout(View.java:14858)
        at android.view.ViewGroup.layout(ViewGroup.java:4646)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
        at android.view.View.layout(View.java:14858)
        at android.view.ViewGroup.layout(ViewGroup.java:4646)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1673)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1527)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
        at android.view.View.layout(View.java:14858)
        at android.view.ViewGroup.layout(ViewGroup.java:4646)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
        at android.view.View.layout(View.java:14858)
        at android.view.ViewGroup.layout(ViewGroup.java:4646)
        at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2035)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1792)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1047)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5896)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
        at android.view.Choreographer.doCallbacks(Choreographer.java:574)
        at android.view.Choreographer.doFrame(Choreographer.java:544)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
        at android.os.Handler.handleCallback(Handler.java:733)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5103)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
        at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
        at dalvik.system.NativeStart.main(Native Method)
    
    opened by wliu6v 11
  • After swipe/remove of a group crash in some cases

    After swipe/remove of a group crash in some cases

    Hi. Trying to debug an issue where in some configurations the app crashes when a group item removed after swipe. In most cases it seems to work fine but in certain sets of data it seems to crash every time. It's very frustrating. It doesn't seem to happen with the sample. I understand that the lib needs stable IDs. I have those. In debugger I see that during onPerformAfterSwipeGroupReaction of MyAdapter notifyItemRemoved(flatPosition) is called. Stepping though that eventually end up in ExpandablePositionTranslator.removeGroupItem. Here it seems it's intentional that the cached items IDs and position info arrays are not adjusted and values are just copied to the removed item. But what happens soon after (once we come out of the swipe/remove) is that my adapter gets calls such as getGroupItemViewType and getGroupID etc. for a group that's not there anymore. Let's say I had 2 groups. I removed 1st group. After removal I get asked about both groups! But I only have 1 group left. It's as if the lib forgot/doesn't know that the group was removed.

    Scenario that fails for me reliably: 2 groups group 2 expanded swipe away group 1 crash. Again, this happens only with my data. The example seems to work stably. Which makes me very sad in that I can't probably be helped. Hoping that you might have at least some idea about why ExpandablePositionTranslator might get confused.

    bug question 
    opened by falsevapor 10
  • Problem implementing on tablet

    Problem implementing on tablet

    I'm using this library to try implementing the iOS option view. I follow the example but facing strange problem with the first row. When I added the item to the RecyclerView the view only display to the size of content instead of filling the whole view.

    Row

    If I try to swipe the view or add more item, it then readjust to fill the whole view.

    Then it display the option view incorrectly as you can see below. You can see that the first row doesn't span to fill the whole view as it supposed to do. First_row Second_row

    Here's the adapter layout:

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
                 xmlns:tools="http://schemas.android.com/tools"
                 xmlns:app="http://schemas.android.com/apk/res-auto"
                 android:background="#123"
                 android:layout_width="match_parent"
                 android:layout_height="@dimen/min_touch">
    
        <FrameLayout
            android:id="@+id/option_delete"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="right"
            android:background="#f25"
            android:clickable="true"
            android:foreground="?attr/selectableItemBackground">
            <ImageView
                android:id="@+id/option_delete_image"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerInside"
                android:background="#25f"
                app:srcCompat="@drawable/ic_react"
                />
        </FrameLayout>
    
        <FrameLayout
            android:id="@+id/swipeable_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#fff"
            android:clickable="true"
            android:foreground="?attr/selectableItemBackground"
            android:paddingLeft="@dimen/half_grid"
            android:paddingRight="@dimen/half_grid">
    
            <LinearLayout
                android:id="@+id/root"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="@dimen/min_touch"
                android:gravity="center_vertical"
                android:orientation="horizontal">
    
                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.6"
                    android:orientation="vertical">
                    <TextView
                        android:id="@+id/txtLabel"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="center_vertical|start"
                        tools:text="Name of the item x" />
                </LinearLayout>
                <TextView
                    android:id="@+id/txtQty"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.1"
                    android:gravity="center"
                    android:background="@color/quantity"
                    tools:text="1" />
                <TextView
                    android:id="@+id/txtPrice"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.3"
                    android:gravity="center_vertical|end"
                    tools:text="0.00 THB" />
    
            </LinearLayout>
        </FrameLayout>
    </FrameLayout>
    

    Does the fact that this recyclerview only display on the right of the screen make any difference?

    invalid question 
    opened by RobGThai 9
  • NotifyDataSetChanged caused recycleview to blink

    NotifyDataSetChanged caused recycleview to blink

    When there are items in recycleview, and I pull to refresh to get updated items from server, pass them into adapter and call notifyDataSetChanged in the adapter. It caused the recycleview to blink. The adapter here is the original adapter, not the wrapped adapter. Am I updating wrong adapter or is there any addition all steps to avoid the blink?

    question 
    opened by taingmeng 9
  • NullPointerException when expanding some/most items using support library v23.2.0

    NullPointerException when expanding some/most items using support library v23.2.0

    Hi

    After I updated from support lib v23.1.1 & advrecyclerview v0.8.1 to support library v23.2.0 using either advrecyclerview v0.8.1 or v0.8.6 --- when I expand some items in my Advanced RecyclerView I get a NullPointerException:

    03-02 16:51:47.958 19056-19056/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.spreeza.shop.dev.debug, PID: 19056 java.lang.NullPointerException: Attempt to read from field 'int android.support.v7.widget.RecyclerView$ItemAnimator$ItemHolderInfo.left' on a null object reference
    at android.support.v7.widget.SimpleItemAnimator.animateDisappearance(SimpleItemAnimator.java:78)
    at android.support.v7.widget.RecyclerView.animateDisappearance(RecyclerView.java:3246)
    at android.support.v7.widget.RecyclerView.access$700(RecyclerView.java:147)
    at android.support.v7.widget.RecyclerView$4.processDisappeared(RecyclerView.java:422)
    at android.support.v7.widget.ViewInfoStore.process(ViewInfoStore.java:231)
    at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3086)
    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2914)
    at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3277)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:122)
    at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
    at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1139)
    at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:810)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1183)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1087)
    at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:797)
    at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:811)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(ViewGroup.java:5039)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
    at android.view.View.layout(View.java:15686)
    at android.view.ViewGroup.layout(V
    

    Any ideas?

    help wanted invalid wontfix 
    opened by jhavatar 9
  • Scale Item while Dragging

    Scale Item while Dragging

    How to make the item bigger when dragging start? this is my code.

            mRecyclerViewDragDropManager.setOnItemDragEventListener(new RecyclerViewDragDropManager.OnItemDragEventListener() {
            @Override
            public void onItemDragStarted(int position) {
                View v = mRecyclerView.getChildAt(position);
                ScaleAnimation animation = new ScaleAnimation(1, 1.2f, 1, 1.2f, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 1);
                v.setAlpha(0.5f);
                animation.setFillAfter(true);
                v.startAnimation(animation);
    
            }
    
            @Override
            public void onItemDragPositionChanged(int fromPosition, int toPosition) {
    
            }
    
            @Override
            public void onItemDragFinished(int fromPosition, int toPosition, boolean result) {
            }
        });
    

    but its not working because the holder in dragging is different its just a copy of the original one.

    I think its better you add holder in onItemDrag events so every one can make any changes in Item while dragging

    enhancement question 
    opened by lkevin029 9
  • Wrong item position used when data set changes during swipe

    Wrong item position used when data set changes during swipe

    The original position of a swiped item is saved by RecyclerViewSwipeManager in startSwiping and used without further validation in finishSwiping and SwipingItemOperator's update method. Data set changes between startSwiping and finishSwiping invalidate this position - this leads to problems when the swipe action is used to remove items in onSlideAnimationEnd or similar.

    A proposed patch to fix this bug is available at http://pastebin.com/DzQZiKQD

    bug 
    opened by hroberts693 9
  • NullPointerException after migration to v. 0.8.0

    NullPointerException after migration to v. 0.8.0

    Hi, I'm trying to migrate to the new version of the library in order to use some of the newly implemented features. In my adapter, I'm implementing both the dragable, and the swipableItemAdapter interfaces. I get a NullPointerException at the end of the swipe animation, and often at the end of the drag & drop animation. Here's the stacktrace:

    java.lang.NullPointerException: Attempt to invoke interface method 'void android.support.v4.view.ViewPropertyAnimatorUpdateListener.onAnimationUpdate(android.view.View)' on a null object reference at android.support.v4.view.ViewPropertyAnimatorCompatKK$1.onAnimationUpdate(ViewPropertyAnimatorCompatKK.java:28) at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationUpdate(ViewPropertyAnimator.java:1193) at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1283) at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1207) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1248) at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:546) at android.animation.ValueAnimator.start(ValueAnimator.java:959) at android.animation.ValueAnimator.start(ValueAnimator.java:969) at android.view.ViewPropertyAnimator.startAnimation(ViewPropertyAnimator.java:905) at android.view.ViewPropertyAnimator.start(ViewPropertyAnimator.java:417) at android.support.v4.view.ViewPropertyAnimatorCompatICS.start(ViewPropertyAnimatorCompatICS.java:130) at android.support.v4.view.ViewPropertyAnimatorCompat$ICSViewPropertyAnimatorCompatImpl.start(ViewPropertyAnimatorCompat.java:497) at android.support.v4.view.ViewPropertyAnimatorCompat.start(ViewPropertyAnimatorCompat.java:1235) at com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager.startActiveItemAnimation(BaseItemAnimationManager.java:173) at com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator$SwipeDismissItemRemoveAnimationManager.onCreateAnimation(SwipeDismissItemAnimator.java:138) at com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator$SwipeDismissItemRemoveAnimationManager.onCreateAnimation(SwipeDismissItemAnimator.java:115) at com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager.createAnimation(BaseItemAnimationManager.java:152) at com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager.runPendingAnimations(BaseItemAnimationManager.java:91) at com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator.schedulePendingAnimationsByDefaultRule(GeneralItemAnimator.java:263) at com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator.onSchedulePendingAnimations(SwipeDismissItemAnimator.java:54) at com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator.runPendingAnimations(GeneralItemAnimator.java:62) at android.support.v7.widget.RecyclerView$2.run(RecyclerView.java:391) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767) at android.view.Choreographer.doCallbacks(Choreographer.java:580) at android.view.Choreographer.doFrame(Choreographer.java:549) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5306) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

    I have tried to migrate both ways, using the LegacySwipeableItemAdapter and implementing the new "SwipeableItemAdapter.onItemSwipe()" method. The result is the same. Does anyone know what the problem might be? Thanks in advance for any help. :)

    help wanted question 
    opened by vorsichtdiekurve 9
  • Replace fullspan element with other element in StaggerGridview

    Replace fullspan element with other element in StaggerGridview

    Hi! Thank you for your useful library! I have problem with my stagger gridview, I want to move full span element with other small elements in my list view as image

    309752890_803230727798302_803046527549925073_n

    I implemented Basic way from https://advancedrecyclerview.h6ah4i.com/draggable/tutorial/ to do this with StaggeredGridLayoutManager but I can only replace small element with small element and full span element with full span element. How can I move full span element with small element ? Thank you for supporting me

    opened by khainhb 0
  • setInitiateOnLongPress no longer works on Android 12

    setInitiateOnLongPress no longer works on Android 12

    On Android 12, setInitiateOnLongPress = true is ignored and drag and drop gets initiated by just a tap.

    Also another issue that might have been caused by probably the same root issue is

    I have the drag and drop manager setup as

            dragDropManager.setInitiateOnLongPress(true)
            dragDropManager.setInitiateOnMove(false)
            dragDropManager.setLongPressTimeout(750)
    

    Within an adapter on onBindViewHolder, I have a view that removes an item from the list. e.g. override fun onBindViewHolder(holder: MemberViewHolder, position: Int) { ... binding.removeBtn.setOnClickListener { circle.removeMember(memberWrapper.member.userId) notifyDataSetChanged() memberRemovalListener.onMemberRemoved(memberWrapper.member) } ... }

    The click listener set on binding.removeBtn responses to the tap of this view on Android 11 and below. However, on Android 12, the click event no longer gets fired. And it might be related to drag touch event not getting propagating down to click events.

    opened by kmspop 0
  • How to get adapter position with giving group position and child position?

    How to get adapter position with giving group position and child position?

    I have group position and child position

    val groupPos = 1
    val childPos = 2
    val packedChildPos = RecyclerViewExpandableItemManager.getPackedPositionForChild(groupPos , childPos )
    val adapterPos = RecyclerViewExpandableItemManager.getPackedPositionChild(packedChildPos)
    

    but this is incorrect. Dose anyone know what is the correct way to do it?

    Also I found it is very confusing with getPackedPositionForChild and getPackedPositionChild names. Maybe should should call them packPositionForChild and unpackPositionForChild if I understand these two methods properly?

    opened by zeroarst 1
  • Implement Filterable

    Implement Filterable

    Hello There, I am using this library which is really helpful, but I am stuck on one thing. How to implement Search functionality in this library.

    Right now I am trying and it is not giving me correct position when filterable is active other than this it is giving correct

    Filter code is here bwllow

    ` @Override public Filter getFilter() { return new Filter() { @SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint, FilterResults results) { dummyList = (List) results.values; notifyDataSetChanged(); }

            @Override
            protected FilterResults performFiltering(CharSequence constraint) {
                List<GetByModel> filteredResults = null;
                if (constraint.length() == 0) {
                    filtered = groupList;
                    filteredResults = groupList;
                } else {
                    filteredResults = getFilteredResults(constraint.toString().toLowerCase());
                }
    
                FilterResults results = new FilterResults();
                results.values = filteredResults;
    
                return results;
            }
        };
    }
    
    protected List<GetByModel> getFilteredResults(String constraint) {
        List<GetByModel> results = new ArrayList<>();
        for (GetByModel item : dummyList) {
            for (GenericModelFilterSelection genericModelFilterSelection : item.getGenericModels()) {
                if (genericModelFilterSelection.getName().toLowerCase().contains(constraint)) {
                    if (!results.contains(item)) {
                        results.add(item);
                    }
                }
            }
        }
        return results;
    }
    

    `

    opened by ahmednabeel1991 0
Releases(1.0.0)
  • 1.0.0(Dec 16, 2018)

    [Breaking changes]

    • Migrated to AndroidX
    • Removed some deprecated features
      • BaseWrapperAdapter
      • SwipeableItemConstants.REACTION_CAN_SWIPE_BOTH
      • SwipeableItemConstants.REACTION_CAN_NOT_SWIPE_BOTH
      • SwipeableItemConstants.REACTION_CAN_NOT_SWIPE_BOTH_WITH_RUBBER_BAND_EFFECT
    • New DraggableItemState getDragState() method added to the DraggableItemViewHolder interface
    • New SwipeableItemState getSwipeState() method added to the SwipeableItemViewHolder interface
    • New ExpandableItemState getExpandState() method added to the ExpandableItemViewHolder interface

    [New features & improvements]

    • Introduced DraggableItemState, no more DraggableItemConstants.STATE_FLAG_** bit operations required anymore in user code
    • Introduced SwipeableItemState, no more SwipeableItemConstants.STATE_FLAG_** bit operations required anymore in user code
    • Introduced ExpandableItemState, no more ExpandableItemConstants.STATE_FLAG_** bit operations required anymore in user code
    • Annotated many public method with @NonNull or @Nullable

    :point_right: Migration guide from v0.11.0 to v1.0.0

    Source code(tar.gz)
    Source code(zip)
Drag and drop GridView for Android

DynamicGrid Drag and drop GridView for Android. Depricated It's much better to use solutions based on recycler view. For example https://github.com/h6

Alex Askerov 920 Dec 2, 2022
A drag-and-drop scrolling grid view for Android

DraggableGridView¶ ↑ a drag-and-drop scrolling grid view for Android Including in your project¶ ↑ To start using DraggableGridView: Place libs/Draggab

Tom Quinn 565 Dec 27, 2022
Kotlin way of building RecyclerView Adapter 🧩. You do not have to write RecyclerView Adapters again and again and suffer from handling of different view types. Kiel will help you.

Kiel Kiel is a RecyclerView.Adapter with a minimalistic and convenient Kotlin DSL which provides utility on top of Android's normal RecyclerView.Adapt

ibrahim yilmaz 370 Jan 2, 2023
An Android Animation library which easily add itemanimator to RecyclerView items.

RecyclerView Animators RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations. Please feel

Daichi Furiya 11.2k Jan 5, 2023
An adapter which could be used to achieve a parallax effect on RecyclerView.

android-parallax-recycleview Integration Step 1. Add the JitPack repository to your build file repositories { maven { url "https://jitpack

Pedro Oliveira 1.6k Nov 17, 2022
. Android library that integrate sticky section headers in your RecyclerView

recyclerview-stickyheaders Recyclerview-stickyheaders is an Android library that makes it easy to integrate section headers in your RecyclerView. Thes

null 968 Nov 10, 2022
Android library providing simple way to control divider items (ItemDecoration) of RecyclerView

RecyclerView-FlexibleDivider Android library providing simple way to control divider items of RecyclerView Release Note [Release Note] (https://github

Yoshihito Ikeda 2.4k Dec 18, 2022
Android library defining adapter classes of RecyclerView to manage multiple view types

RecyclerView-MultipleViewTypeAdapter RecyclerView adapter classes for managing multiple view types Release Note [Release Note] (https://github.com/yqr

Yoshihito Ikeda 414 Nov 21, 2022
A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView.

RecyclerViewSwipeDismiss A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView. Preview How to use Add these lines to yo

xcodebuild 431 Nov 23, 2022
Pumped up RecyclerView

##Description This is an attempt to make RecyclerView easier to use. Features built in: ProgressBar while adapter hasn't been set EmptyView if adapter

Anton Malinskiy 2.6k Jan 5, 2023
A Fast Scroller for the RecyclerView world!

RecyclerViewFastScroller The RecyclerViewFastScroller is a widget that can be added to a layout and connected to a RecyclerView for fast scrolling. Th

Daniel Smith 1.1k Dec 19, 2022
ItemDecoration for RecyclerView using LinearLayoutManager for Android

RecyclerItemDecoration RecyclerItemDecoration allows you to draw divider between items in recyclerview with multiple ViewType without considering item

magiepooh 328 Dec 27, 2022
[UNMAINTAINED] Sticky Headers decorator for Android's RecyclerView

This project is no longer being maintained sticky-headers-recyclerview This decorator allows you to easily create section headers for RecyclerViews us

timehop 3.7k Dec 31, 2022
A GridView which can addHeaderView and addFooterView

Please follow me on GitHub, I need your support Github: https://github.com/liaohuqiu twitter: https://twitter.com/liaohuqiu 中文版文档 GridView with Header

Huqiu Liao 1.3k Nov 30, 2022
An Android staggered grid view which supports multiple columns with rows of varying sizes.

AndroidStaggeredGrid ##Notice - Deprecated - 09-2015 This library has been deprecated. We will no longer be shipping any updates or approving communit

Etsy, Inc. 4.8k Dec 29, 2022
Android library to display a ListView whose cells are not rigid but flabby and react to ListView scroll.

FlabbyListView This library is not maintained anymore and there will be no further releases Android library to display a ListView which cells are not

JPARDOGO 762 Nov 23, 2022
Android library to achieve in an easy way, the behaviour of the home page in the Expedia app, with a pair of auto-scroll circular parallax ListViews.

ListBuddies This library is not maintained anymore and there will be no further releases Android library of a pair of auto-scroll circular parallax Li

JPARDOGO 970 Dec 29, 2022
An android library for section headers that stick to the top

StickyListHeaders StickyListHeaders is an Android library that makes it easy to integrate section headers in your ListView. These section headers stic

Emil Sjölander 5.5k Jan 2, 2023
Android library to observe scroll events on scrollable views.

Android-ObservableScrollView Android library to observe scroll events on scrollable views. It's easy to interact with the Toolbar introduced in Androi

Soichiro Kashima 9.6k Dec 29, 2022