Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ToxicBakery/ViewPagerTransforms
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.
https://github.com/ToxicBakery/ViewPagerTransforms
android kotlin-android viewpager viewpagertransforms
Last synced: 3 months ago
JSON representation
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.
- Host: GitHub
- URL: https://github.com/ToxicBakery/ViewPagerTransforms
- Owner: ToxicBakery
- License: apache-2.0
- Created: 2014-05-13T02:52:53.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-02-17T16:58:37.000Z (almost 4 years ago)
- Last Synced: 2024-07-31T18:16:45.967Z (6 months ago)
- Topics: android, kotlin-android, viewpager, viewpagertransforms
- Language: Kotlin
- Homepage: https://toxicbakery.github.io/ViewPagerTransforms/
- Size: 1.33 MB
- Stars: 2,567
- Watchers: 96
- Forks: 489
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- -awesome-android-ui - ViewPagerTransforms - 2.0) | <img src="/art/ViewPagerTransforms.gif" width="49%"> (Index `(light-weight pages)`)
- awesome-android-ui - ViewPagerTransforms - 2.0) | <img src="/art/ViewPagerTransforms.gif" width="49%"> (Index `(light-weight pages)`)
- awesome-kotlin - ViewPagerTransforms - Library containing common animations needed for transforming ViewPager scrolling for Android v13+. (Libraries)
- awesome-github-android-ui - ViewPagerTransforms - 包含视图页滚动常见动画的库 (ViewPager)
- awesome-android-ui - ViewPagerTransforms - 2.0) | <img src="/art/ViewPagerTransforms.gif" width="49%"> (Index)
- awesome-android-ui - https://github.com/ToxicBakery/ViewPagerTransforms
- awesome-android-ui - https://github.com/ToxicBakery/ViewPagerTransforms
README
[![CircleCI](https://circleci.com/gh/ToxicBakery/ViewPagerTransforms.svg?style=svg)](https://circleci.com/gh/ToxicBakery/ViewPagerTransforms)
[![License](https://img.shields.io/badge/license-Apache%202.0%20License-blue.svg)](https://github.com/ToxicBakery/ViewPagerTransforms/blob/master/LICENSE)
[![Maven Central](https://img.shields.io/maven-metadata/v/https/oss.sonatype.org/content/repositories/releases/com/ToxicBakery/viewpager/transforms/view-pager-transforms/maven-metadata.xml.svg)](https://oss.sonatype.org/content/repositories/releases/com/ToxicBakery/viewpager/transforms/view-pager-transforms)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 (Gradle / Android Studio)
Add gradle dependency to your application.
```gradle
implementation 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:2.0.24'
```After configuration, instantiate the transformer animation you wish to use and set it as the [page transformer](https://developer.android.com/reference/android/support/v4/view/ViewPager.html#setpagetransformer_1).
```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/library/src/main/java/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/library/src/main/java/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.
* [onPreTransform(View view, float position)](https://github.com/ToxicBakery/ViewPagerTransforms/blob/master/library/src/main/java/com/ToxicBakery/viewpager/transforms/ABaseTransformer.java#L85)
* 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/library/src/main/java/com/ToxicBakery/viewpager/transforms/ABaseTransformer.java#L33)
* Animations should perform all or most of their work inside this callback.
* [onPostTransform(View view, float position)](https://github.com/ToxicBakery/ViewPagerTransforms/blob/master/library/src/main/java/com/ToxicBakery/viewpager/transforms/ABaseTransformer.java#L116)
* Default implementation does nothing. This provides a logical location for any additional work to be done that is not directly related to the animation.## Building
This project is built with Gradle using the Gradle Wrapper script.```bash
./gradlew build
```## Creating Local Versions
You can modify this project and create local packages with via the maven publish plugin used in the build scripts.```bash
./gradlew publishToMavenLocal
```