twotoasters/JazzyListView

doJazzinessImpl NPE

sbaar opened this issue · 4 comments

On 1.21 using recycler view
at com.twotoasters.jazzylistview.JazzyHelper.doJazzinessImpl(JazzyHelper.java:197)
at com.twotoasters.jazzylistview.JazzyHelper.doJazziness(JazzyHelper.java:189)
at com.twotoasters.jazzylistview.JazzyHelper.onScrolled(JazzyHelper.java:115)
at com.twotoasters.jazzylistview.recyclerview.JazzyRecyclerViewScrollListener.onScrolled(JazzyRecyclerViewScrollListener.java:24)
at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:2872)
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)

particularly
private void doJazzinessImpl(View item, int position, int scrollDirection) {
ViewPropertyAnimator animator = item.animate().setDuration(600L).setInterpolator(new AccelerateDecelerateInterpolator());
scrollDirection = scrollDirection > 0?1:-1;
this.mTransitionEffect.initView(item, position, scrollDirection);
this.mTransitionEffect.setupAnimation(item, position, scrollDirection, animator);
animator.start();
}

item is null. This happens pretty rarely. Basically what happens is I'm selecting a list of users on the left side of a sliding pane layout and clearing then adding to then notifyingdataSetChanged on a jazzylistview on the right side of the sliding pane layout. It may have something to do with there being two different view types in my listview, but I'm not sure. It seems like sometimes in onScrolled

        for(i = 0; firstVisibleItem + i < this.mFirstVisibleItem; ++i) {
            View indexBeforeLast = viewGroup.getChildAt(i);
            this.doJazziness(indexBeforeLast, firstVisibleItem + i, -1);
        }

indexBeforeLast is returning null.

Unless there is something wrong with the arithmetic to iterate through visible views my instinct is just to abort in doJazzinessImpl if item is null

I haven't been able to make a project specifically for this bug but after forking and putting in an npe catch with logging, it seems to iterate over position 3-9 when there are only 3 items currently. It seems to happen a lot more frequently when switching between lists with 1 view type to a list with 2 view types.

Im getting exactly the same exception. Any news on this yet?

sbaar commented

Nope. Just had to copy the project and put in a try catch
On Jul 15, 2015 10:09 AM, "Jesus Alonso Garcia" notifications@github.com
wrote:

Im getting exactly the same exception. Any news on this yet?


Reply to this email directly or view it on GitHub
#37 (comment)
.

Ok thx! I'll do that then.