[] An Android library which allows developers to easily add animations to ListView items

Overview

DEPRECATED

ListViewAnimations is deprecated in favor of new RecyclerView solutions. No new development will be taking place, but the existing versions will still function normally.

Thanks for your support!

ListViewAnimations

ListViewAnimations is an Open Source Android library that allows developers to easily create ListViews with animations. Feel free to use it all you want in your Android apps provided that you cite this project and include the license in your app.

Features

ListViewAnimations provides the following features:

  • Appearance animations for items in ListViews, GridViews, other AbsListViews;
    • Built in animations include Alpha, SwingRightIn, SwingLeftIn, SwingBottomIn, SwingRightIn and ScaleIn.
    • Other animations can easily be added
    • StickyListHeaders is supported, other implementations can easily be added.
  • Swipe-to-Dismiss, Swipe-To-Dismiss with contextual undo;
  • Drag-and-Drop reordering;
  • Animate addition of items;
  • Smoothly expand your items to reveal more content;

Setup

The library consists of separate modules:

  • lib-core: The core of the library, and contains appearance animations.
  • lib-manipulation: Contains the item manipulation options, such as Swipe-to-Dismiss, and Drag-and-Drop.
  • lib-core-slh: An extension of lib-core to support StickyListHeaders.

When using lib-manipulation or lib-core-slh, lib-core is included as well.

Add the following to your build.gradle:

repositories {
	mavenCentral()
}

dependencies {
	compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
	compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
	compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
}

Or:

Or:

Add the following to your pom.xml:

<dependency>
	<groupId>com.nhaarman.listviewanimations</groupId>
	<artifactId>lib-core</artifactId>
	<version>3.1.0</version>
</dependency>
<dependency>
	<groupId>com.nhaarman.listviewanimations</groupId>
	<artifactId>lib-manipulation</artifactId>
	<version>3.1.0</version>
</dependency>
<dependency>
	<groupId>com.nhaarman.listviewanimations</groupId>
	<artifactId>lib-core-slh</artifactId>
	<version>3.1.0</version>
</dependency>

Getting Started

Contribute

Please do! I'm happy to review and accept pull requests.
Please read Contributing before you do.

Developed By

  • Niek Haarman

Special Thanks

License

Copyright 2014 Niek Haarman

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
  • Undoview adjustable height

    Undoview adjustable height

    I have added 2 features:

    1. Modified the "inflate" method for the "undo" layout, now a parent is provided otherwise the layout_* parameters of the "undo" view are ignored (It's impossible to set a fixed height to the undo view directly from the xml)
    2. Added a new api setKeepHeight(boolean) to the ContextualUndoAdapter: with this is possible to set the height of the undo view as the height of the content view. The default is "false"

    Thanks, Giuseppe

    opened by PiDyGB 6
  • Support For Api 8

    Support For Api 8

    I know you rejected the previous pull request, but check this out. I fixed most of the issues. Very minor problems remained with drag&drop. Try the example app on an emulator and see for yourself. 10% of potential customers is a lot for applications with million or more installs. It would be good to support API >= 8.

    • Add support for API >= 8 for the example app with AppCompat library.
    • Updated Drag&Drop code to use NineOldAndroids. Fixed most of the problems for API < 14. The only problem left is that the mobileView does not become invisible...
    • Fixed a problem which prevented running the app on an Emulator without Google Play Store.
    • Fixed issue #254 (looks like recycling was still a problem on >= 14 but much less visible than < 14)
    opened by ertanden 5
  • Split library

    Split library

    Splits library in lib-core and lib-manipulation. Basically, everything in package com.nhaarman.listviewanimations.itemmanipulation has moved to lib-manipulation.

    Libraries can be accessed like this:

    compile 'com.nhaarman.listviewanimations:lib-core:3.0.0'
    compile 'com.nhaarman.listviewanimations:lib-manipulation:3.0.0'
    

    lib-manipulation requires lib-core to be present. For now, -SNAPSHOT releases are present.

    Fixes #190

    opened by nhaarman 5
  • Expand scroll

    Expand scroll

    Fix #66

    I don't know what will happen if you use this in a Dialog. I'm going to test this code the next week. And probability I will rebase it.

    I post it looking for comments and issues.

    opened by BraisGabin 5
  • ACTION_CANCEL was doing the same as ACTION_UP

    ACTION_CANCEL was doing the same as ACTION_UP

    This causes issues when a parent view tries to steal a MotionEvent using onInterceptTouchEvent (such as a DrawerLayout opening the side menu).

    I've added an implementation for ACTION_CANCEL (looking at the latest romannurik code). This solves issue #65 on your issue tracker.

    I hope I did this pull request right, I'm a bit new to the entire Github thing.

    opened by wdullaer 4
  • ContextualUndoAdapter, How to click item ?

    ContextualUndoAdapter, How to click item ?

    I am not really sure how to deal with item click on ContextualUndoAdapter. The example doesn't mention it. There are at least two ways item click is handled:

    1. By hooking a View.OnClickListener to a view in the row. This view will no longer respond to swipe though.
    2. By hooking AdapterView.OnItemClickListener to the listview. In this case we need to restrict which clicks go to that listener. Consider the case of Undo Layout that looks like device-2013-11-05-123834 If mUndoActionId corresponds to "Tap to Undo" view then clicking the other views (like "Deleted") will still trigger OnItemClick. I propose root view of the undo layout is set with null listener. With it other views except mUndoActionId will not respond to click. But I do not know if other people have different needs / customizations of their own Undo Layout.
    opened by inmyth 4
  • New Features:

    New Features:

    This is kind of a big update.

    The idea was to add swipemenu support using the full power of ListViewAnimations I based my work in this ios implementation

    So i did it in steps :

    • use nineoldandroids everywhere and bring back support to < 14
    • added removal animation support
    • refactored the logic of DynamicListView for draganddrop, swipetodismiss, and other future features to work together
    • replace SwipeUndoView with DynamicListItemView : simple view which can support all features
    • implemented swipe menus

    I hope you are going to like it and that you will be willing to merge it ;) In the future i want to add custom transformation support just like MGSwipeTableCell does. I prepared everything to do so.

    opened by farfromrefug 3
  • SwipeDismiss with Timer

    SwipeDismiss with Timer

    Resolve the problem with Timer in SwipeDismiss. As I understood the problem still exist, so is when we do deletion some one, and in time of counting do deletion some other below that, we have problem with the timer, so it is resolve the problem. I guess there exist better solution, but this is also is worked fine.

    invalid 
    opened by tarasokunev 3
  • Tweaked SwipeDismissListViewTouchListener

    Tweaked SwipeDismissListViewTouchListener

    To reflect the change made here https://code.google.com/p/dashclock/source/browse/main/src/com/google/android/apps/dashclock/ui/SwipeDismissListViewTouchListener.java

    certainly seems to make the swipe action a lot more usable.

    opened by storkme 3
  • Contextual Undo feature

    Contextual Undo feature

    This implements a ContextualUndoAdapter, used as a Decorator to add a GMail-like Swipe To Dismiss + Contextual Undo behaviour. To see it in action navigate to the ContextualUndoActivity in the example.

    There's still lots of duplicated code in the OnTouchListener, but I wanted to keep the pull request small without changing too much existing code. This should be fairly intuitive to use, even without commenting the code. If you prefer to have Javadoc comments on the main functionalities please let me know and I'll try to follow your style.

    opened by frankiesardo 3
  • Bugfix (crash and inconsistent onItemMoved)

    Bugfix (crash and inconsistent onItemMoved)

    Hello. This fixes crashes on my phone (out of bound Exception... adapter getItemId gets called after getCount()) Also : I need onItemMoved to be called even when the user drops it in the same position :

    My use case : When I start dragging, I make some changes to the list (I model a tree) When the user stops dragging, I need to revert those changes. If the onItemEvent isn't fired when the user drops it in the same position, my data is in an inconsistent state.

    Also, the developper can check if original position == new position in onItemMoved

    Thanks for this library

    opened by Lakedaemon 2
  • Swappable returns a boolean for saying if the swap occured or not

    Swappable returns a boolean for saying if the swap occured or not

    I'm not sure if this is actually useful for anyone, but in my app it was useful to be able to have a drag and drop interface where some elements could not be dragged below a certain point. I changed Swappable to return a boolean which says if the swap actually happened. If it doesn't, it prevents the animation from playing. This prevents the animations from freaking out when you drag over something that you can't drag to.

    opened by mr 0
  • Update AndroidManifest.xml

    Update AndroidManifest.xml

    Removed android:allowBackup="true" because it forces the Android Project I'm working on to also use it otherwise it will throw a Manifest Merger conflict.

    opened by mihaicristianpetrescu 3
  • Crash app when drag and drop item in listview

    Crash app when drag and drop item in listview

    Hi all,

    I use listviewanimations in my app, and sometime app force close when i drag and drop item in listview

    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference at com.nhaarman.listviewanimations.itemmanipulation.dragdrop.DragAndDropHandler$LSwitchViewAnimator$AnimateSwitchViewOnPreDrawListener.onPreDraw(DragAndDropHandler.java:588) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:921) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2214) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1230) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6748) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777) at android.view.Choreographer.doCallbacks(Choreographer.java:590) at android.view.Choreographer.doFrame(Choreographer.java:560) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6117) 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:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

    I don't understand why althought at line 588 in DragAndDropHandler.java really check not null before

    opened by khiemvu 1
  • adding removeAll to more closely mirror arraylist methods

    adding removeAll to more closely mirror arraylist methods

    for uses where u need to remove more than one object at a time prior to notifying data set changes

    i have a gridview with AbsListView.MultiChoiceModeListener implemented so a user can check multiple objects and click delete - with a loop and remove() once at a time, many notify were called, messing up view hierarchy a bit/glitchy

    opened by trippedout 0
  • Moving canceled

    Moving canceled

    I use the library for tree data structure. Before I start dragging item in tree-view, I must collapse selected view if it has some children. Then I have to expand it again after dropping.

    Example:

    
    listView.setOnItemLongClickListener(
            new AdapterView.OnItemLongClickListener() {
                @Override
                public boolean onItemLongClick(final AdapterView<?> parent, final View view,
                                               final int position, final long id) {
                    myAdapter.setCollapsed(position);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            listView.startDragging(position);
                        }
                    }, 50);
                    return true;
                }
            }
    );
    
    listView.setOnItemMovedListener(new OnItemMovedListener() {
        @Override
        public void onItemMoved(int to, int from) {
            myAdapter.setExpanded(from);
        }
    
    });
    
    listView.setOnItemMovingCanceledListener(new OnItemMovingCanceledListener() {
        @Override
        public void onItemMovingCanceled(int originalPosition) {
            myAdapter.setExpanded(originalPosition);
        }
    });
    
    
    
    opened by ochkarik05 0
Releases(3.1.0)
Owner
Niek Haarman
Niek Haarman
An Android library which provides simple Item animations to RecyclerView items

RecyclerViewItemAnimators Library Travis master: This repo provides: Appearance animations Simple animators for the item views Quick start You can now

Gabriele Mariotti 3.1k Dec 16, 2022
💠Metaphor is the library to easily add Material Motion animations

Metaphor Metaphor is the library to easily add Material Motion animations. Who's using Metaphor? ?? Check out who's using Metaphor Include in your pro

Ranbir Singh 132 Dec 25, 2022
Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animations painless.

AnimatableCompose Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animation painless. What you can create from M

Emir Demirli 12 Jan 2, 2023
A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.

SuperForwardView About A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix. GIF Design Credi

Ertugrul 77 Dec 9, 2022
🪐 Jetpack Compose animation library that allows you to implement animations such as shared element transition.

Orbitary ?? Jetpack Compose animation library that allows you to implement animations such as shared element transition. Download Gradle Add the depen

Jaewoong Eum 503 Dec 30, 2022
🪐 Jetpack Compose animation library that allows you to implement animations such as shared element transition.

?? Jetpack Compose animation library that allows you to implement animations such as shared element transition.

Jaewoong Eum 504 Jan 2, 2023
Easily add slide to dismiss functionality to an Activity

Slidr Easily add slide-to-dismiss functionality to your Activity by calling Slidr.attach(this) in your onCreate(..) method. Usage An example usage: pu

Drew Heavner 2.7k Jan 6, 2023
FragmentTransactionExtended is a library which provide us a set of custom animations between fragments.

FragmentTransactionExtended FragmentTransactionExtended is a library which provide us a set of custom animations between fragments. FragmentTransactio

Antonio Corrales 1.1k Dec 29, 2022
Android Library that lights items for tutorials or walk-throughs etc...

Spotlight Gradle dependencies { implementation 'com.github.takusemba:spotlight:x.x.x' } Usage val spotlight = Spotlight.Builder(this) .setTarg

TakuSemba 3.4k Jan 4, 2023
Trying to play with Jetpack compose low level animations APIs, which are animate*AsState APIs.

ComposeSimpleAnimation Trying to play with Jetpack compose low level animations APIs, which are animate*AsState APIs that I needed in another project.

Mustafa Ibrahim 39 Dec 10, 2022
Android library which allows you to swipe down from an activity to close it.

Android Sliding Activity Library Easily create activities that can slide vertically on the screen and fit well into the Material Design age. Features

Jake Klinker 1.3k Nov 25, 2022
Introduction your app to the user , Easy to use and set Items as you want

Introduction App This lib helps to introduce the App-by view page based on Kotlin. Features Easy Set up Items: Title, Describe, Background, Buttons Ap

S.M.Zendehbad 0 May 6, 2022
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.

ViewPagerTransforms Library containing common animations needed for transforming ViewPager scrolling on Android v13+. This library is a rewrite of the

Ian Thomas 2.5k Dec 29, 2022
Android library to create complex multi-state animations.

MultiStateAnimation Android library to create complex multi-state animations. Overview A class that allows for complex multi-state animations using An

Keepsafe 405 Nov 11, 2022
Lightweight Android library for cool activity transition animations

Bungee min SDK 16 (Android Jellybean 4.1) written in Java A lightweight, easy-to-use Android library that provides awesome activity transition animati

Dean Spencer 172 Nov 18, 2022
Library provides an easy way to a add shimmer effect in Android Compose project.

Add a shimmer effect to the layout in Android Compose

Valery 66 Dec 14, 2022
An Android library to build form and form validations easily.

FormBuilder An Android library to build form and form validations easily. Example COMING SOON Requirements Android 4.3+ Installation Add edit your bui

Dario Pellegrini 48 Jun 30, 2022
Android Library to create Lottie animation view dialog easily with a lot of customization

LottieDialog Android Library to create Lottie animation view dialog easily with a lot of customization Why you should use Lottie Dialog You have no li

Amr Hesham 39 Oct 7, 2022
Android Library to create Lottie animation view dialog easily with a lot of customization

Android Library to create Lottie animation view dialog easily with a lot of customization

Amr Hesham 39 Oct 7, 2022