Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/wajahatkarim3/EasyFlipViewPager

📖 The library for creating book and card flip animations in ViewPager in Android
https://github.com/wajahatkarim3/EasyFlipViewPager

android android-library animation flip flip-animation page-transformer pageflip pagetransformer transformations transformer viewpager viewpager-transformer viewpagertransformer

Last synced: 3 months ago
JSON representation

📖 The library for creating book and card flip animations in ViewPager in Android

Lists

README

        

New in the EasyFlipViewPager 
The article on how this library was created is now published. You can read it on this link here. →.














































Built with ❤︎ by
Wajahat Karim and

contributors









## 📖 Full Demo Video
[![Demo Video](https://img.youtube.com/vi/ibuHv06wdhs/0.jpg)](https://www.youtube.com/watch?v=ibuHv06wdhs)

## 📱 Download Demo on Android
Download the [APK file from here](https://github.com/wajahatkarim3/EasyFlipViewPager/blob/master/EasyFlipViewPagerDemo-2.0.0.apk?raw=true) on your Android phone and enjoy the Demo App :)

## 💥 Achievements
* #1 on [Github Trending in Kotlin](https://github.com/trending/kotlin?since=daily) language on 14th December, 2018
* Mentioned in an [article about behind-the-scenes of this library](https://android.jlelse.eu/easyflipviewpager-the-flip-animations-for-your-viewpager-fd66b34f4703) on [AndroidPub](https://android.jlelse.eu/)

## 💻 Installation

>> **Since the [v1.2.0](https://github.com/wajahatkarim3/EasyFlipViewPager/releases/tag/1.2.0), all new updates will only support `androidx` widgets. If you want to use `android.support`, then use [v1.0.0](https://github.com/wajahatkarim3/EasyFlipViewPager/releases/tag/1.0.0).**

Add `EasyFlipViewPager` in app's ```build.gradle``` file:

```groovy
implementation 'com.wajahatkarim:easyflipviewpager:2.0.1'
```
Or add `EasyFlipViewPager` as a new dependency inside your `pom.xml`
```xml

com.wajahatkarim
easyflipviewpager
2.0.1
pom

```
## ❓ Usage

### ViewPager
Just create an object of either [`BookFlipPageTransformer`](https://github.com/wajahatkarim3/EasyFlipViewPager/blob/master/easyflipviewpager/src/main/java/com/wajahatkarim3/easyflipviewpager/BookFlipPageTransformer.java) or [`CardFlipPageTransformer`](https://github.com/wajahatkarim3/EasyFlipViewPager/blob/master/easyflipviewpager/src/main/java/com/wajahatkarim3/easyflipviewpager/CardFlipPageTransformer.java) and assign it to your `ViewPager` object by calling `ViewPager#setPageTransformer(true, myTransformerObject)`.

### ViewPager2
Use these new `PageTransformer` classes for `ViewPager2` instance: [`BookFlipPageTransformer2`](https://github.com/wajahatkarim3/EasyFlipViewPager/blob/master/easyflipviewpager/src/main/java/com/wajahatkarim3/easyflipviewpager/BookFlipPageTransformer2.java) or [`CardFlipPageTransformer2`](https://github.com/wajahatkarim3/EasyFlipViewPager/blob/master/easyflipviewpager/src/main/java/com/wajahatkarim3/easyflipviewpager/CardFlipPageTransformer2.java)

### 💳 Card Flip Example
```java
// Get ViewPager2 and Set Adapter
myViewPager2 = findViewById(R.id.myViewPager2);
pagerAdapter = new MyPagerAdapter(this);
myViewPager2.setAdapter(pagerAdapter);

// Create an object of page transformer
CardFlipPageTransformer2 cardFlipPageTransformer = new CardFlipPageTransformer2();

// Enable / Disable scaling while flipping. If false, then card will only flip as in Poker card example.
// Otherwise card will also scale like in Gallery demo. By default, its true.
cardFlipPageTransformer.setScalable(false);

// Assign the page transformer to the ViewPager2.
myViewPager2.setPageTransformer(cardFlipPageTransformer);
```

### 📄 Book Flip Example
```java
// Get ViewPager2 and Set Adapter
myViewPager2 = findViewById(R.id.myViewPager2);
pagerAdapter2 = new MyPagerAdapter(this);
myViewPager2.setAdapter(pagerAdapter);

// Create an object of page transformer
BookFlipPageTransformer2 bookFlipPageTransformer = new BookFlipPageTransformer2();

// Enable / Disable scaling while flipping. If true, then next page will scale in (zoom in). By default, its true.
bookFlipPageTransformer.setEnableScale(true);

// The amount of scale the page will zoom. By default, its 5 percent.
bookFlipPageTransformer.setScaleAmountPercent(10f);

// Assign the page transformer to the ViewPager2.
myViewPager2.setPageTransformer(bookFlipPageTransformer);
```

## 👨 Developed By



**Wajahat Karim**

[![Twitter](https://img.shields.io/badge/-twitter-grey?logo=twitter)](https://twitter.com/WajahatKarim)
[![Web](https://img.shields.io/badge/-web-grey?logo=appveyor)](https://wajahatkarim.com/)
[![Medium](https://img.shields.io/badge/-medium-grey?logo=medium)](https://medium.com/@wajahatkarim3)
[![Linkedin](https://img.shields.io/badge/-linkedin-grey?logo=linkedin)](https://www.linkedin.com/in/wajahatkarim/)

## 👍 How to Contribute
1. Fork it
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create new Pull Request

## 📃 License

Copyright 2020 Wajahat Karim

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.