Giter VIP home page Giter VIP logo

h6ah4i / android-advancedrecyclerview Goto Github PK

View Code? Open in Web Editor NEW
5.3K 200.0 863.0 8.9 MB

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

Home Page: https://advancedrecyclerview.h6ah4i.com/

License: Apache License 2.0

Java 90.56% CSS 2.39% JavaScript 2.65% Smalltalk 0.71% C# 3.69%
android recyclerview drag-and-drop swipe expandable header footer

android-advancedrecyclerview's People

Contributors

akshaychordiya avatar anirudhaagashe avatar ascat avatar barend-xebia avatar h6ah4i avatar mluedke2 avatar pn avatar polyak01 avatar seansstewart avatar skyfishjy avatar sowrabh avatar t7costa avatar thefex avatar vinayak-garg avatar wakim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-advancedrecyclerview's Issues

NPE

com.h6ah4i.android.widget.advrecyclerview.animator.impl.ItemRemoveAnimationManager.dispatchFinished (ItemRemoveAnimationManager.java:54) com.h6ah4i.android.widget.advrecyclerview.animator.impl.ItemRemoveAnimationManager.dispatchFinished (ItemRemoveAnimationManager.java:24) com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager$BaseAnimatorListener.onAnimationEnd (BaseItemAnimationManager.java:227)

version 0.6.1

Documentation

Hi

For those noobs / newcomers, it would be great to have some nice documentation please. A tutorial, if you like. We could go through each class and understand it, but the 'table' on the main screen does not help. There's far too much going on and it would be great to learn how to 'add new features' on top of this recycler view, as it seems quite generic at the moment. Like for example, if we were to add 'multi-select' capabilities, would that be simple to add to this?

Play Store Video

Not a very big deal, but the play store video when viewed from a Mobile Device (Web is fine) looks like this and the entire screen is cut off. Play store plays all videos in landscape I believe.

  • Just thought I'd let you be aware of the issue @h6ah4i
    [Using an HTC One M7]

screenshot_2015-02-02-11-49-20

Issues with stable ids

Such as when the source is a dynamic amount of information. (Potentially 10-50 items depending on the data passed)

Force expand/colapse

I wish I could expand/collapse group programatically without allowing user to do that. Is that possible in current implementation?

I think it would be possible if you make ExpandableRecyclerViewWrapperAdapter public :)

Repeated animation problem

After Drag&Drop the dragged cell restores to original position and starts the translation animation again to its dropped position. How can I fix this? Thank a lot.

onlick child item?

Can you support onlick child item? ( not swip )
Demo: click one row then make a toast return position item

onPerformAfterSwipeReaction() when the swipe animation is actually finished ?

I have successfully implemented a draggable and swipeable recyclerview and it works great. That's pretty cool. The thing is when I swipe an item I update some data in sqlite database with recursive methods and it takes some time, in which the UI freezes.

I tried to move that code within a Runnable and display a ProgressBar until its done. The container goes off the screen well, then it freezes during some time with the item view background (it's ok, I display the Progress Bar) but I loose the animation of the container going back to the screen, it just pop. I am not able to change the background resource for the item view when onPerformAfterSwipeReaction() has been called, not sure why.

It seems that the swipe works like that :
container swiping off the screen
onPerformAfterSwipeReaction
what you want to do here
container coming back to the screen

when what I would like is something like that :
container swiping off the screen
onPerformAfterSwipeReaction
container coming back to the screen
what you want to do here

Can you or someone can think of a workaround or am I just missing something obvious ?
I can provide screenshots or capture if it's needed. Thank you for your work.

EDIT : I was setting the progress bar visibility to gone in the handler's post() method. That was why (I think) the animation was not showing. I will try to notify the user of the background task's progress differently. I think it's more Android-related even if an event like onSwipeAnimationFinish() could be very convenient IMO. That library is nevertheless awesome, thanks again for your work.

How to swipe?

It just doesn't swipe. It displays, scrolls and everything, but items just stay at the same place when trying to swipe them horizontally. Here's what I did:

  • Wrapped my adapter using RecyclerViewSwipeManager#createWrappedAdapter()
  • Attached my recycler using RecyclerViewSwipeManager#attachRecyclerView()
  • Used SwipeDismissItemAnimator as animator
  • Made my adapter implement SwipeableItemAdapter:
    • onGetSwipeReactionType() always returns RecyclerViewSwipeManager.REACTION_CAN_SWIPE_BOTH
    • onSetSwipeBackground() does nothing
    • onSwipeItem() always returns RecyclerViewSwipeManager.AFTER_SWIPE_REACTION_DEFAULT
    • onPerformAfterSwipeReaction() does nothing
  • Made my view holder extend AbstractSwipeableItemViewHolder:
    • Content layout is wrapped into a FrameLayout
    • Content layout is returned in getSwipeableContainerView()
  • Overrode getItemId(), returning a unique ID for each item

I also did the RecyclerViewTouchActionGuardManager thing from the example.

What did I miss?

My next step would by copying the whole example into my project and clean up line by line. This will take me hours. Any hints from anyone who went through this would be greatly appreciated.

Activity declared in Manifest

I noticed that you have a TestActivity declared in library's manifest. When using the library, the compiler warns about it.

warning: A class activity declared in the AndroidManifest.xml cannot be found in the compile path: [com.h6ah4i.android.widget.advrecyclerview.TestActivity]

If it isn't strictly necessary, would be good to remove its declaration to avoid those kind of warnings.

Do not apply ItemAnimator to GroupItems

Currently i have the issue that i want to rotate the expand/collapse indicator when a GroupItem is pressed.
This animation isn't shown because there is also the default Item animation.
Could you apply this animation just to the child items?

Tmp detached View recycled before it's removed from RecyclerView causing FATAL EXCEPTION

I am trying to mimic the Lollipop notifications behavior with your library. I only use the Swipe To Dismiss part, without pinning. The swipe of one item works well, but if I swipe out two items without letting the first item the time to be completely dismissed, my app crash with the stack trace below, without any reference of my own project files inside... I don't know what to do... I checked many things in my project and I still can't find the source of this crash... it seems that a ViewHolder in my RecyclerView has been declared available too soon, and the RecyclerView try to use it before it is really available... I would be very grateful to anyone helping me to find the source of this bug.

java.lang.IllegalArgumentException: Tmp detached view should be removed from RecyclerView before it can be recycled: ViewHolder{42241e38 position=2 id=222, oldPos=-1, pLpos:-1 tmpDetached no parent}
            at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:4250)
            at android.support.v7.widget.RecyclerView.removeAnimatingView(RecyclerView.java:888)
            at android.support.v7.widget.RecyclerView.access$5100(RecyclerView.java:131)
            at android.support.v7.widget.RecyclerView$ItemAnimatorRestoreListener.onMoveFinished(RecyclerView.java:8736)
            at android.support.v7.widget.RecyclerView$ItemAnimator.dispatchMoveFinished(RecyclerView.java:9061)
            at com.h6ah4i.android.widget.advrecyclerview.animator.impl.ItemMoveAnimationManager.dispatchFinished(ItemMoveAnimationManager.java:54)
            at com.h6ah4i.android.widget.advrecyclerview.animator.impl.ItemMoveAnimationManager.dispatchFinished(ItemMoveAnimationManager.java:24)
            at com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager$BaseAnimatorListener.onAnimationEnd(BaseItemAnimationManager.java:227)
            at android.support.v4.view.ViewPropertyAnimatorCompatJB$1.onAnimationEnd(ViewPropertyAnimatorCompatJB.java:47)
            at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1030)
            at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1056)
            at android.animation.ValueAnimator.cancel(ValueAnimator.java:969)
            at android.view.ViewPropertyAnimator.animatePropertyBy(ViewPropertyAnimator.java:882)
            at android.view.ViewPropertyAnimator.animateProperty(ViewPropertyAnimator.java:838)
            at android.view.ViewPropertyAnimator.translationY(ViewPropertyAnimator.java:584)
            at android.support.v4.view.ViewPropertyAnimatorCompatICS.translationY(ViewPropertyAnimatorCompatICS.java:38)
            at android.support.v4.view.ViewPropertyAnimatorCompat$ICSViewPropertyAnimatorCompatImpl.translationY(ViewPropertyAnimatorCompat.java:358)
            at android.support.v4.view.ViewPropertyAnimatorCompat.translationY(ViewPropertyAnimatorCompat.java:695)
            at com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator$SwipeDismissItemMoveAnimationManager.onAnimationCancel(SwipeDismissItemAnimator.java:352)
            at com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator$SwipeDismissItemMoveAnimationManager.onAnimationCancel(SwipeDismissItemAnimator.java:304)
            at com.h6ah4i.android.widget.advrecyclerview.animator.impl.BaseItemAnimationManager$BaseAnimatorListener.onAnimationCancel(BaseItemAnimationManager.java:236)
            at android.support.v4.view.ViewPropertyAnimatorCompatJB$1.onAnimationCancel(ViewPropertyAnimatorCompatJB.java:42)
            at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationCancel(ViewPropertyAnimator.java:1012)
            at android.animation.ValueAnimator.cancel(ValueAnimator.java:966)
            at android.view.ViewPropertyAnimator.cancel(ViewPropertyAnimator.java:412)
            at android.support.v4.view.ViewPropertyAnimatorCompatICS.cancel(ViewPropertyAnimatorCompatICS.java:102)
            at android.support.v4.view.ViewPropertyAnimatorCompat$ICSViewPropertyAnimatorCompatImpl.cancel(ViewPropertyAnimatorCompat.java:438)
            at android.support.v4.view.ViewPropertyAnimatorCompat.cancel(ViewPropertyAnimatorCompat.java:1001)
            at com.h6ah4i.android.widget.advrecyclerview.swipeable.ItemSlidingAnimator.endAnimation(ItemSlidingAnimator.java:214)
            at com.h6ah4i.android.widget.advrecyclerview.swipeable.ItemSlidingAnimator.animateSlideInternal(ItemSlidingAnimator.java:165)
            at com.h6ah4i.android.widget.advrecyclerview.swipeable.ItemSlidingAnimator.animateSlideInternalCompat(ItemSlidingAnimator.java:125)
            at com.h6ah4i.android.widget.advrecyclerview.swipeable.ItemSlidingAnimator.slideToSpecifiedPositionInternal(ItemSlidingAnimator.java:77)
            at com.h6ah4i.android.widget.advrecyclerview.swipeable.ItemSlidingAnimator.slideToDefaultPosition(ItemSlidingAnimator.java:53)
            at com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwi

recyclerview in ScrollView or ViewPager

Currently, if the RecyclerView is embedded in a ScrollView or ViewPager, there is a race condition with them on dragging/swiping. Sometimes it does drag/swipe, many times it does not. To the user, the app feels broken. I make heavy use of ScrollViews and ViewPagers, so this is an important issue for me.

For drag&drop or swipe to work well in a ScrollView or ViewPager, the touch listeners must call recyclerView.getParent().requestDisallowInterceptTouchEvent(true), on MotionEvent.ACTION_DOWN, although they cannot know yet, whether the touch is a drag/swipe or just a click. (And they might need to intercept touch events of their children, too.) Then, they must watch the following touch events. If the user moves outside the touchSlop then they must start animating a drag/swipe if they are set up to it or re-allow the parents to intercept events (and maybe resend the events they received so far?). If the touch moves up before it leaves the touchSlop they must consider it a click and act on it, if they are set up for it, or tell the RecyclerView's parents/child about it. I think this is possible only, if the there is only a single touch listener for the recycler view, that takes full responsibility, as otherwise there would again be a race condition between touch listeners.

Do you agree share my understanding? Can you imagine changing this library to make it ScrollView/ViewPager embeddable?

Thanks a lot!

Notify Item Insert/Remove for ExpandableRecyclerView

How would I notify the adapter that a child item whose parent isn't expanded was removed? Since the parent is not expanded that child item does not have a position. I do not really want to use notifyDataSetChanged() as this is not efficient when i have a large dataSet. I tried notifying the wrappedAdapter but that seems to not work.

Implementation

Hi,

I'm looking to add this library into my project but I'm at a loss as to where to start. The sample code is way to much for me to go through. I have two array lists (one for the group, one for the child) and I think I've figured out how to add it in but nothing works. In the sample for expandable, @h6ah4i uses an abstract class to insert the data, id and everything. They used AbstractExpandableItemAdapter and AbstractExpandableItemViewHolder. But in the readme, they say you should extend ExpandableItemAdapter and ExpandableViewHolder and that's it. I don't know how to reference objects in my list items since both list items have different id's for the things they contain. This should be easier for people to add into their projects. Maybe my knowledge isn't up to par with everyone else's since I'm having a difficult time putting this all together in my project. All I wanted was to make a list with a button and when that button is clicked on the list, the list item expands. Now I'm not even sure if I can do that.

If anyone can help me out, that'd be great. If not, it was worth a try and I'll try something else.

Using CardView as Layout Parent for Swipeable item adapter causes ClassCastException

Thanks for your library, it's fantastic! There's however a ClassCastException when a CardView is used as the parent layout for the swipeable item adapter. Full log output and layout xml follow.

04-12 21:43:18.146  24070-24070/com.myfab5.mobile.myfab5 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4169dd40)
04-12 21:43:18.162  24070-24070/com.myfab5.mobile.myfab5 E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.myfab5.mobile.myfab5, PID: 24070
    java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawableWithShadow
            at android.support.v7.widget.CardViewEclairMr1.getShadowBackground(CardViewEclairMr1.java:159)
            at android.support.v7.widget.CardViewEclairMr1.getMinWidth(CardViewEclairMr1.java:150)
            at android.support.v7.widget.CardView.onMeasure(CardView.java:181)
            at android.view.View.measure(View.java:16537)
            at android.support.v7.widget.RecyclerView$LayoutManager.measureChildWithMargins(RecyclerView.java:5555)
            at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1332)
            at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1269)
            at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:523)
            at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:1988)
            at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:2237)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1594)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
            at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
            at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
            at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
            at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
            at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
            at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
            at android.view.View.layout(View.java:14857)
            at android.view.ViewGroup.layout(ViewGroup.java:4643)
            at android.view.ViewRootImpl.per
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    android:id="@+id/card_view"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginBottom="@dimen/quarter_margin"
    android:layout_marginLeft="@dimen/quarter_margin"
    android:layout_marginRight="@dimen/quarter_margin"
    card_view:cardCornerRadius="4dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:weightSum="10">

        <RelativeLayout
            android:id="@+id/container"
            android:layout_width="0px"
            android:layout_height="match_parent"
            android:layout_weight="9"
            android:background="?attr/selectableItemBackground"
            android:orientation="vertical">

            <TextView
                android:id="@+id/text_view"
                android:layout_width="44dp"
                android:layout_height="44dp"
                android:layout_alignParentTop="true"
                android:layout_marginBottom="4dp"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginTop="4dp"
                android:background="@drawable/circle_background"
                android:gravity="center"
                android:padding="3dp"
                android:text="@string/business_ranking"
                android:textColor="@color/white"
                android:textSize="18sp" />

            <TextView
                android:id="@+id/text_view_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBaseline="@+id/text_view"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginTop="4dp"
                android:layout_toRightOf="@id/text_view"
                android:text="@string/text_view_2"
                android:textColor="@color/black"
                android:textSize="18sp" />

            <ImageView
                android:id="@+id/image_view"
                android:layout_width="@dimen/inline_photo_size"
                android:layout_height="@dimen/inline_photo_size"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/text_view"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginTop="@dimen/activity_vertical_margin"
                android:background="@drawable/image_placeholder" />

            <TextView
                android:id="@+id/text_view_3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/image_view"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_toRightOf="@+id/image_view"
                android:gravity="left"
                android:text="@string/hello_world"
                android:textSize="14sp" />
        </RelativeLayout>

        <ImageView
            android:id="@+id/drag_handle"
            android:layout_width="0px"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:src="@drawable/ic_reorder_grey_600_24dp" />
    </LinearLayout>
</android.support.v7.widget.CardView>

How to grouping drag & drop..

I have section list...

SECTION 1
item 1
item 2
item 3
SECTION 2
item 4
item 5
item 6


I want SECTION is that do not move...
Is it possible?

SECTION 1
item 1
item 2
item 4
SECTION 2
item 3
item 5
item 6

Thank-you for great lib.

overscrolling effect

The overscroll effect is shown too early. The item is not at the top at this moment.

draggable_recyclerview

Listener to handle click/touch on group item

Hi there,
I would like to do some changes with the group item's view when click occured on it.
Because your RecyclerViewExpandableItemManager handle the touch on the RecyclerView I can't attach OnClickListener to my View.
I recommend you do a listener which can set up for the manager class with View and MotionEvent and call it before you return in your onInterceptTouchEvent method.

Selector for state_pressed="true" is slow!

I've only tried it with the expandable recycler view, but the pressed state for a group item doesn't register unless you hold it for like 1 sec, which is basically a long pressed click.

edit: I'm thinking this might be a feature actually..as this prevents group items from highlighting unnecessarily every time you are trying to scroll.

[DOC] build.gradle config

In "Getting started" is missing the jcentral() repository

repositories {
    jcenter()
}

dependencies {
    compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.6.1'
}

Can't set child item draggable range in children group

onGetChildItemDraggableRange() method only set child drag range in group session.But can't set range in itself session.Because I have a child item at last index, i need it can't draggable.
I can override onMoveChildItem() method when drag in a session.but when i drag it cross other session group,It's will crash.It's always move it.....Help me

Crash if AbstractExpandableItemAdapter return always GroupId=0

My adapter extend AbstractExpandableItemAdapter.
When

@OverRide
public long getGroupId(int position) {
return position;
}
Its work ok.

When
@OverRide
public long getGroupId(int position) {
return 0;
}
I have crash:

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 16(offset:-1).state:20
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3651)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3609)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1859)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1311)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1274)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:525)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2072)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:2415)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1594)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:907)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
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:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
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:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
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:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
at android.view.View.layout(View.java:15671)
at android.view.ViewGroup.layout(ViewGroup.java:5038)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2086)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1843)

"settle back into place" animation on drag end

it would be nice to have a animation of the dragged element back into it's old place or into its new place on drag end. (they way it happens in the Play Music app right now). do you plan on implementing this feature?
thanks for the great library!

ClassCastException bug

[Feb. 2, 2015] I've got a crash report on Developer Console.

  • Application version: 0.6
  • Android version: Android 5.0
  • Device: Nexus 5 (hammerhead)
java.lang.ClassCastException: com.h6ah4i.android.example.advrecyclerview.demo_eds.MyExpandableDraggableSwipeableItemAdapter$MyChildViewHolder cannot be cast to com.h6ah4i.android.example.advrecyclerview.demo_eds.MyExpandableDraggableSwipeableItemAdapter$MyGroupViewHolder
at com.h6ah4i.android.example.advrecyclerview.demo_eds.MyExpandableDraggableSwipeableItemAdapter.onSetGroupItemSwipeBackground(MyExpandableDraggableSwipeableItemAdapter.java:38)
at com.h6ah4i.android.widget.advrecyclerview.expandable.ExpandableRecyclerViewWrapperAdapter.onSetSwipeBackground(ExpandableRecyclerViewWrapperAdapter.java:373)
at com.h6ah4i.android.widget.advrecyclerview.swipeable.SwipeableItemWrapperAdapter.setSwipeBackgroundDrawable(SwipeableItemWrapperAdapter.java:200)
at com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager.applySlideItem(RecyclerViewSwipeManager.java:525)
at com.h6ah4i.android.widget.advrecyclerview.swipeable.SwipeableItemWrapperAdapter.onBindViewHolder(SwipeableItemWrapperAdapter.java:129)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:4138)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3448)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:3340)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1810)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1306)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1269)
at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1097)
at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:957)
at android.support.v7.widget.RecyclerView.scrollByInternal(RecyclerView.java:985)
at android.support.v7.widget.RecyclerView.scrollBy(RecyclerView.java:954)
at com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.scrollByYAndGetScrolledAmount(RecyclerViewDragDropManager.java:603)
at com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.handleScrollOnDragging(RecyclerViewDragDropManager.java:570)
at com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager$ScrollOnDraggingProcessRunnable.run(RecyclerViewDragDropManager.java:827)
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:5221)
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)

Enhancement to Swiping

I believe it would be more useful to swipe and reveal a predetermined View/ViewGroup rather than a drawable as I think most people implementing this functionality would want to have buttons with click handlers etc displayed after swiping. (See example in the ReadMe image at https://github.com/47deg/android-swipelistview)

I would also prefer a pinned item to leave a small part of itself (or a dedicated grabhandle view) showing to indicate it can be dragged back into view.

Another point would be when an item is pinned, I attempted to swipe it back to unpin it which actually triggered the "swipe to delete" action after causing the pinned item to instantly reappear back in its default location.

Apart from those points, I think this is the most slick Recyclerview extension library I have seen to date.

sticky headers

A nice feature would be to be able to integrate section headers in your recyclerview.

feature: hook to determine if item can be moved

i do not think this is possible right now, but it would be great to have. :) i have the use case of section headers.
the list looks like:
SECTION A
list item 1 type a
list item 2 type a
list item 3 type a
SECTION B
list item 1 type b
list item 2 type b
list item 3 type b

i want only the list items of type a to be drag-sortable.
right now it is for example possible to drag list item 1 (type a) above 'SECTION A'.

onMoveItem() crash?

Hi,
We got this crash report couple of times in last few weeks since we moved to Advanced Recycler View.

https://gist.github.com/mazurio/ce9b2b3cc4d95a7c710b

We are currently using stable ids and also each id is unique by random number so it shouldn't crash, the crash happened when there were two items and I started dragging it back and forth.

Any ideas? I haven't updated the library yet to the newest one, 0.6.0 is currently used.

Damian

Begin drag and drop using OnLongClick

Is it possible to start dragging when an item has been long clicked? This would be really useful as a lot of users seem to be doing that initially when they want to reorder the list.

Thanks
RM

SwipeManager

I believe the SwipeManager when calling attach here:
https://github.com/h6ah4i/android-advancedrecyclerview/blob/master/library/src/main/java/com/h6ah4i/android/widget/advrecyclerview/swipeable/RecyclerViewSwipeManager.java#L138

Then going here:
https://github.com/h6ah4i/android-advancedrecyclerview/blob/master/library/src/main/java/com/h6ah4i/android/widget/advrecyclerview/utils/WrapperAdapterUtils.java#L27

Should check if:

adapter.getClass().isInstance(class)

at least thats how I got my code to work with it. I don't see how the super class could be an instance of the subclass adapter? It would have to be the opposite right?

Things that would truly make your library awesome

Hi, I used 2 libraries before switching to yours, one was called the UltimateRecyclerView, and the other one was SuperRecyclerView, I wont be getting into the specifics of what bugs they had and made me jump here but here s what I am trying to accomplish

1)SwipeRefreshLayout functionality at the top
2)A load more at the bottom [infinite scrolling]
3)Expandable items
4)Swipe to dismiss where an item may be dimissed successfully if the background operation such as deleting from a cloud storage service or database succeeded. The item may appear back once again if the operation fails.
5) An empty view to show some view or layout when the recyclerview has no data to display.

I am well aware of DragAdapter in your code and I have seen some samples as well, the doubt I have is whether I can implement all the above mentioned points in Unison together, also can you please guide me on the undo Swipe Dismiss part, thanks for your replies, wonderful library and time in advance.

Swiping twice same item

Hi,

is it possible with this library to swipe twice same item in the same direction?
normally when you swipe you can set item as pinned or simply remove item.

Thanks!

ARV doesn't work with SDK 11 on tablet

I've set the app's minSdkVersion to 11, which is Honeycomb/3.0. the childView isn't showing at all, and the layout gets distorted. What's the base SDK version used by the library? I am using a Toshiba tablet with API 13 installed. Can this plugin support tablets?

Click effect on GroupView

Hi,

I noticed that when user clicks on a group in order to expand or collapse it, the "click effect" (for example ripple effect) is catched by something and it is not shown.
Instead, while keeping the item pressed, the ripple effect is shown.
This happens both in your example and in my application.

If I change "onCheckCanExpandOrCollapseGroup" in order to return FALSE, the click effect is shown, but obviously the item is not expanded/collapsed.

Is there a way to fix it?

Thanks in advance

Unnecessary call of onCreateGroupViewHolder()

Hi,

I noticed a problem of unnecessary calling of onCreateGroupViewHolder() method after group item is clicked. This represents badly because in onCheckCanExpandOrCollapseGroup() method I check the expand parameter based on which I set expand or collapse arrow image.

Expand arrow is set by default in the layout and this is a sequence which happens to me:

  • I click on group item
  • in the onCheckCanExpandOrCollapseGroup() i set the collapse image
  • onCreateGroupViewHolder() is called setting the image to default value (expand)
  • it results with expanded list and expand drawable which is inconsistent.

I didn't had this issue with 0.6.2 and recyclerview-v7:21.0.3. It happens on versions 0.7.1 and 22.2.0.

getAdapter results in NPE

I have an abstract method onPhotoActivityResult that is called on the execution of onActivityResult of the super class. In this method, I've called recyclerView.getAdapter().notifyDataSetChanged() but it throws out a NPE. I have set the recyclerView's adapter after an AsyncTask-handled task's execution. what went wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.