twotoasters / jazzylistview Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
JazzyRecyclerViewScrollListener scrollListener = new JazzyRecyclerViewScrollListener();
scrollListener.setTransitionEffect(JazzyHelper.SLIDE_IN);
mRecyclerView.addOnScrollListener(scrollListener);
if RecyclerView scroll not smooth(means got stuck)
java.lang.NullPointerException
Attempt to invoke virtual method 'android.view.ViewPropertyAnimator android.view.View.animate()' on a null object reference
com.twotoasters.jazzylistview.JazzyHelper.doJazzinessImpl(JazzyHelper.java:197)
com.twotoasters.jazzylistview.JazzyHelper.doJazziness(JazzyHelper.java:189)
com.twotoasters.jazzylistview.JazzyHelper.onScrolled(JazzyHelper.java:115)
com.twotoasters.jazzylistview.recyclerview.JazzyRecyclerViewScrollListener.onScrolled(JazzyRecyclerViewScrollListener.java:24)
android.support.v7.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:3634)
android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3806)
android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
android.view.Choreographer.doCallbacks(Choreographer.java:580)
android.view.Choreographer.doFrame(Choreographer.java:549)
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
android.os.Handler.handleCallback(Handler.java:739)
android.os.Handler.dispatchMessage(Handler.java:95)
android.os.Looper.loop(Looper.java:135)
android.app.ActivityThread.main(ActivityThread.java:5254)
java.lang.reflect.Method.invoke(Native Method)
java.lang.reflect.Method.invoke(Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
JazzyHelper throws Null Pointer Exception while scroll very (very) fast (only on recyclerview)
NullPointerException
System.err: at jazzylistview.JazzyHelper.doJazzinessImpl(JazzyHelper.java:204)
System.err: at jazzylistview.JazzyHelper.doJazziness(JazzyHelper.java:195)
System.err: at jazzylistview.JazzyHelper.onScrolled(JazzyHelper.java:121)
System.err: at jazzylistview.JazzyRecyclerViewScrollListener.onScrolled(JazzyRecyclerViewScrollListener.java:37)
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
returns
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewPropertyAnimator android.view.View.animate()' on a null object reference
And Force Close
when i use FastScroll
The problem: Sample app crashes on first scroll.
To recreate:
Download JLV from github.
Download the referenced 9 old androids jarfile
Build in Eclipse
Run on GS3
I use ListView footer to indicate page loading, when loading next page, I scroll up and down again and again, after adapter notify, it throws NPE. you can see the issue in my fork SimpleListWithHeadersAndFootersActivity
java.lang.NullPointerException:
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:122)
at com.twotoasters.jazzylistview.recyclerview.JazzyRecyclerViewScrollListener.onScrolled (JazzyRecyclerViewScrollListener.java:24)
It Doesn't Provide Any Support to show List Fragments..
Hi,
I was trying to include the Jazzy effect in a ExpandableListView. I just took the code from the JazzyListView but I extended from ExpandableListView instead of ListView
package com.twotoasters.jazzylistview;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ExpandableListView;
public class JazzyExpandableListView extends ExpandableListView {
private final JazzyHelper mHelper;
public JazzyExpandableListView(Context context) {
super(context);
mHelper = init(context, null);
}
public JazzyExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
mHelper = init(context, attrs);
}
public JazzyExpandableListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mHelper = init(context, attrs);
}
private JazzyHelper init(Context context, AttributeSet attrs) {
JazzyHelper helper = new JazzyHelper(context, attrs);
super.setOnScrollListener(helper);
return helper;
}
@Override
public final void setOnScrollListener(OnScrollListener l) {
mHelper.setOnScrollListener(l);
}
/**
* Sets the desired transition effect.
*
* @param transitionEffect Numeric constant representing a bundled transition effect.
*/
public void setTransitionEffect(int transitionEffect) {
mHelper.setTransitionEffect(transitionEffect);
}
/**
* Sets the desired transition effect.
*
* @param transitionEffect The non-bundled transition provided by the client.
*/
public void setTransitionEffect(JazzyEffect transitionEffect) {
mHelper.setTransitionEffect(transitionEffect);
}
/**
* Sets whether new items or all items should be animated when they become visible.
*
* @param onlyAnimateNew True if only new items should be animated; false otherwise.
*/
public void setShouldOnlyAnimateNewItems(boolean onlyAnimateNew) {
mHelper.setShouldOnlyAnimateNewItems(onlyAnimateNew);
}
/**
* If true animation will only occur when scrolling without the users finger on the screen.
*
* @param onlyFlingEvents
*/
public void setShouldOnlyAnimateFling(boolean onlyFling) {
mHelper.setShouldOnlyAnimateFling(onlyFling);
}
/**
* Stop animations after the list has reached a certain velocity. When the list slows down
* it will start animating again. This gives a performance boost as well as preventing
* the list from animating under the users finger if they suddenly stop it.
*
* @param itemsPerSecond, set to JazzyHelper.MAX_VELOCITY_OFF to turn off max velocity.
* While 13 is a good default, it is dependent on the size of your items.
*/
public void setMaxAnimationVelocity(int itemsPerSecond) {
mHelper.setMaxAnimationVelocity(itemsPerSecond);
}
/**
* Enable this if you are using a list with items that should act like grid items.
*
* @param simulateGridWithList
*/
public void setSimulateGridWithList(boolean simulateGridWithList) {
mHelper.setSimulateGridWithList(simulateGridWithList);
setClipChildren(!simulateGridWithList);
}
}
My problem is that when I enable fast scrolling I get aq NullPointerException
java.lang.NullPointerException
E/AndroidRuntime(20260): at com.nineoldandroids.view.ViewPropertyAnimatorICS.(ViewPropertyAnimatorICS.java:22)
E/AndroidRuntime(20260): at com.nineoldandroids.view.ViewPropertyAnimator.animate(ViewPropertyAnimator.java:62)
E/AndroidRuntime(20260): at com.twotoasters.jazzylistview.JazzyHelper.doJazzinessImpl(JazzyHelper.java:196)
i tried putting an additional check in the JazzyHelper to check if the element is null, but when I do that, it does not look quite right because the first and last visible elements sometimes disappear.
Is there anything I could do to make this work?
is that possible to add a bottom loading bar?
how to stop animation effect on listview scroll ?
i want animation only on first time list loading.
this works
recyclerView.setAdapter(adapter);
JazzyRecyclerViewScrollListener listener = new JazzyRecyclerViewScrollListener();
listener.setTransitionEffect(new SlideInEffect());
recyclerView.setOnScrollListener(listener);
this does not from the readme
recyclerView.setTransitionEffect(new SlideInEffect());
I have a list that have automatic scroll in api 19 and above, but in api 17 there is not a scroll
Quickly slide the list anr~~~
Hi
Thank you for your great library! 👍 this is the best ListView and RecyclerView animation library on the plant! :)
You can make it even better by adding:
Hi,
I need to apply pulltorefresh and as well JazzyListView animation to the listview . how can i apply.
I want to play animation only once, for example when scroll listview down, the anim is played (card, curl...). But I don't want anim play again when I scroll up.
Could not find property 'BINTRAY_USER' on com.jfrog.bintray.gradle.BintrayExtension_Decorated@3c9c63d1.
This bug is not occur often but only when the list goes really long and fast.
03-02 18:17:32.403 15537-15537/com.buildsystemexample.app.test_native E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.buildsystemexample.app.test_native, PID: 15537
java.lang.NullPointerException
at com.nineoldandroids.view.ViewPropertyAnimatorICS.<init>(ViewPropertyAnimatorICS.java:22)
at com.nineoldandroids.view.ViewPropertyAnimator.animate(ViewPropertyAnimator.java:62)
at com.twotoasters.jazzylistview.JazzyHelper.doJazzinessImpl(JazzyHelper.java:195)
at com.twotoasters.jazzylistview.JazzyHelper.doJazziness(JazzyHelper.java:187)
at com.twotoasters.jazzylistview.JazzyHelper.onScroll(JazzyHelper.java:103)
at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1417)
at android.widget.GridView.layoutChildren(GridView.java:1305)
at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4209)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:543)
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:5146)
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:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)
The behaviour of jazzylistview with CoordinatorLayout, isn't the same as normal reclycerview
the toolbar with appbarlayput doesn't move up
recyclerView.setTransitionEffect(new SlideInEffect());
this one does not work in V23
I want to customize the duration of the animation and see the animation only pull down list.
Give me an example.
Thanks
On Nexus 5 stock (4.4.3) the animation are sometimes overlapped by black diagonal stripes, sometimes the rows are dotted-transparent. only during animations
Hi,
Thanks for your excellent library but Can you remove the dependency on NineOldAndroid.jar
I wanna use this library on android 4.0 above & that's why I don't wanna use the NineOldAndroid.jar dependency.
Can you put the .jar please?
I am using JazzyListView with a SLIDE_IN effect and I have fast scrolling enabled in my ListView. When I fast scroll it does not work quite right because the first visible item is many times not visible. Could it be somehow possible to disable the animation when fast scrolling and re-enable it once we stop?
Thanks
M
Hi twotoasters..
I just knew your awesome library (JazzyListView) from "Libraries for developers" application I downloaded on Play Store.
Therefore I want to install it in my project. But I don't understand how to do that.
So, could you tell me how to install your library into my application's project?
Details explanation would be nice for me. Sorry for this, because I'm still newbie.
That's all I want to know.
Your answers will be expected.
600 ms is too long and not really standard in other animations which are usually 200-300ms. It should be customizable. Since duration is in the JazzyHelper class I don't really know where the best place to make the modification would be, but making it not final would be a start. As of now I'll just have to include the library source manually.
The constructor originally looks like:
public JazzyListView(Context context) {
this(context, null);
}
public JazzyListView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public JazzyListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mHelper = new JazzyHelper(context, attrs);
super.setOnScrollListener(mHelper);
}
Maybe it should be like this:
public JazzyListView(Context context) {
super(context);
mHelper = new JazzyHelper(context, null);
super.setOnScrollListener(mHelper);
}
public JazzyListView(Context context, AttributeSet attrs) {
super(context, attrs);
mHelper = new JazzyHelper(context, attrs);
super.setOnScrollListener(mHelper);
}
public JazzyListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mHelper = new JazzyHelper(context, attrs);
super.setOnScrollListener(mHelper);
}
It seems that you passed 0 to the defStyle causes this problem
the action click is not throw in Android O
java.lang.NullPointerException:
at com.twotoasters.jazzylistview.b.b (Unknown Source)
at com.twotoasters.jazzylistview.b.a (Unknown Source:65)
at com.twotoasters.jazzylistview.b.a (Unknown Source:37)
at com.twotoasters.jazzylistview.b.onScroll (Unknown Source)
at android.widget.AbsListView.invokeOnItemScrollListener (AbsListView.java:2168)
at android.widget.ListView.layoutChildren (ListView.java:2103)
at android.widget.AbsListView.onLayout (AbsListView.java:2952)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1791)
at android.widget.LinearLayout.layoutHorizontal (LinearLayout.java:1780)
at android.widget.LinearLayout.onLayout (LinearLayout.java:1546)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.support.v4.view.ViewPager.onLayout (Unknown Source:261)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.support.design.widget.f.b (Unknown Source:135)
at android.support.design.widget.m.a (Unknown Source)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.a (Unknown Source)
at android.support.design.widget.CoordinatorLayout.onLayout (Unknown Source:42)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1791)
at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1635)
at android.widget.LinearLayout.onLayout (LinearLayout.java:1544)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.support.v4.widget.DrawerLayout.onLayout (Unknown Source:59)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:323)
at android.widget.FrameLayout.onLayout (FrameLayout.java:261)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1791)
at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1635)
at android.widget.LinearLayout.onLayout (LinearLayout.java:1544)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:323)
at android.widget.FrameLayout.onLayout (FrameLayout.java:261)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1791)
at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1635)
at android.widget.LinearLayout.onLayout (LinearLayout.java:1544)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:323)
at android.widget.FrameLayout.onLayout (FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout (DecorView.java:955)
at android.view.View.layout (View.java:20964)
at android.view.ViewGroup.layout (ViewGroup.java:6440)
at android.view.ViewRootImpl.performLayout (ViewRootImpl.java:3027)
at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2714)
at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1843)
at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7978)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:911)
at android.view.Choreographer.doCallbacks (Choreographer.java:723)
at android.view.Choreographer.doFrame (Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:897)
at android.os.Handler.handleCallback (Handler.java:790)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:7000)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Hi,
I'm using this library to add animations on grid in my app, but I got this error:
A/OpenGLRenderer﹕ Error: Ambient Vertex Buffer overflow!!! used 463, total 284
A/libc﹕ Fatal signal 6 (SIGABRT), code -6 in tid 27814 (hwuiTask1)
Can you help me on this?
This is occurred only on Android Lollipop 5.1
I tested on pre-Lollipop Android versions without problems.
UPDATE: I got this problem only with some type of animations, like "Twirl" and "Cards".
Thanks!
I'm using JazzyListView with DobList. Apart from the following, I'm really happy with this combination.
For some reasons, DobLists loading footer doesn't appear at all.
The footer is added correctly by DobList (ListView.getFooterViewsCount() is increased by one after adding it).
It's set to be visible from the start of requesting more products to the time when the results arrive.
But it doesn't appear at all.
Could this be a bug in JazzyListView?
i have a RecyclerView.Adapter class. and i want cast it to ListAdapter
but (returns error (Can not cast))
public void setAdapter() {
RecyclerAdapter adapter = new RecyclerAdapter(context);
cv.setAdapter((ListAdapter) adapter);
}
please help !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.