Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daimajia/ViewPagerTransforms
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.
https://github.com/daimajia/ViewPagerTransforms
Last synced: about 1 month ago
JSON representation
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.
- Host: GitHub
- URL: https://github.com/daimajia/ViewPagerTransforms
- Owner: daimajia
- License: apache-2.0
- Fork: true (ToxicBakery/ViewPagerTransforms)
- Created: 2014-05-29T02:07:42.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-29T12:48:53.000Z (over 10 years ago)
- Last Synced: 2024-04-15T09:13:21.147Z (8 months ago)
- Language: Java
- Size: 916 KB
- Stars: 46
- Watchers: 5
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - ViewPagerTransforms - Library containing common animations needed for transforming ViewPager scrolling for Android v13+. (etc)
- awesome - ViewPagerTransforms - Library containing common animations needed for transforming ViewPager scrolling for Android v13+. (etc)
README
ViewPagerTransforms
===================Library containing common animations needed for transforming ViewPager scrolling on Android v13+. This library is a rewrite of the [JazzyViewPager](https://github.com/jfeinstein10/JazzyViewPager) library and owes credit of the animation concepts directly to its source. The purpose of this rewrite is to provide an easier to use and extend implementation of ViewPager animations.
![Demo](http://i.imgur.com/rvhE2ns.gif)
#Getting Started
Simply import this project into your IDE and reference the Library as an Android Library Project from your project. After configuration, instantiate the transformer animation you wish to use and set it as the [page transformer](http://developer.android.com/reference/android/support/v4/view/ViewPager.html#setPageTransformer(boolean, android.support.v4.view.ViewPager.PageTransformer)).
```java
// Reference (or instantiate) a ViewPager instance and apply a transformer
pager = (ViewPager) findViewById(R.id.container);
pager.setAdapter(mAdapter);
pager.setPageTransformer(true, new RotateUpTransformer());
```#Creating Custom Transforms
All ViewPagerTransform implementations extend [ABaseTransformer](https://github.com/ToxicBakery/ViewPagerTransforms/blob/master/ViewPagerTransformsLibrary/src/com/ToxicBakery/viewpager/transforms/ABaseTransformer.java) providing useful hooks improving readability of animations and basic functionality important when switching between animations. [ABaseTransformer](https://github.com/ToxicBakery/ViewPagerTransforms/blob/master/ViewPagerTransformsLibrary/src/com/ToxicBakery/viewpager/transforms/ABaseTransformer.java) provides three lifecycle hooks and two flags for default handling of hiding offscreen fragments and mimicking the default paging functionality of the ViewPager.
* [preTransform(View view, float position)](https://github.com/ToxicBakery/ViewPagerTransforms/blob/master/ViewPagerTransformsLibrary/src/com/ToxicBakery/viewpager/transforms/ABaseTransformer.java#L42)
* Default implementation resets the animation state of the fragment to defaults that will place it on the screen if its position permits.
* [onTransform(View view, float position)](https://github.com/ToxicBakery/ViewPagerTransforms/blob/master/ViewPagerTransformsLibrary/src/com/ToxicBakery/viewpager/transforms/ABaseTransformer.java#L14)
* Animations should perform all or most of their work inside this callback.
* [postTransform(View view, float position)](https://github.com/ToxicBakery/ViewPagerTransforms/blob/master/ViewPagerTransformsLibrary/src/com/ToxicBakery/viewpager/transforms/ABaseTransformer.java#L75)
* Default implementation does nothing. This provides a logical location for any additional work to be done that is not directly related to the animation.