EasyFlipViewPager — The Flip Animations For Your ViewPager
Tags: android, opensource, showdev, developer
Published: 2018-12-14 09:53:56

---
title: EasyFlipViewPager — The Flip Animations For Your ViewPager
published: true
tags: android, opensource, showdev, developer
canonical_url: https://android.jlelse.eu/easyflipviewpager-the-flip-animations-for-your-viewpager-fd66b34f4703
cover_image: https://cdn-images-1.medium.com/max/729/0*Nl-2uLm27Qej1Roc.png
---

### EasyFlipViewPager — The Flip Animations For Your ViewPager

#### A behind the scenes story of an open source Android library to create book & card flipping animations in ViewPager

About 2 years ago, in January 2017, I released my first open source library [**EasyFlipView**](https://github.com/wajahatkarim3/EasyFlipView)on Github. At that time, I was working on an English vocabulary type app for a client. One particular task was to create flashcards which had English word on one side and the meaning on other sides. I wanted to make it like a real card which can be flipped. A simple google search gave me plenty of easy code snippets and resources to create flipping animations and I put it in the app. The client loved it and I continued with the app development.

![](https://cdn-images-1.medium.com/max/253/0*ACFgmrklCmzm4qKG.gif)<figcaption>The demo of <a href="http://github.com/wajahatkarim3/EasyFlipView">EasyFlipView</a> library</figcaption>

After the project, I had an interesting encounter with another client. He indirectly motivated me to do open source contributions. I wanted to experiment it fast and put something on Github before my motivation fades away. And then this flipping animation hit me. It was almost ready. All I had to do was upload on [jCenter](http://jcenter.bintray.com)and create a good ReadMe on Github.

It looked like easy but it was hell of a job. It took me days to finish and put in on Github. I didn’t know much about open source or how to market the library etc. But I did it. And I believe it was the beginner’s luck that the library started getting stars and forks. And quickly I crossed 500 stars. It was a crazy and amazing experience. And this made me addicted to the open source. I shared my experience in more details on [this article](https://android.jlelse.eu/my-journey-to-500-stars-on-github-b881cf2bd18).

[Inside The First-timer’s Journey from 0 to 500 Stars on Github](https://android.jlelse.eu/my-journey-to-500-stars-on-github-b881cf2bd18)

But stars and forks are not the effective metrics for any open source Android library. These metrics tells the creator about other developers’ interest in the library. But the real metric is how much downloads it get and how many apps use it.

* * *

Over the 2 years duration, [EasyFlipView](http://github.com/wajahatkarim3/EasyFlipView)has been downloaded for about 31,000 times. I cannot imagine that my little piece of code has been downloaded so many times and these developers have put their trust in my code. That’s one of the best and most satisfying feeling for any developer who puts code on Github and makes it open source.

![](https://cdn-images-1.medium.com/max/1024/1*KxdunZWs2xKEABZvPTjUrg.png)<figcaption>The downloads stats for <a href="https://bintray.com/wajahatkarim3/EasyFlipView/">EasyFlipView library from Bintray</a></figcaption>

I still cannot find which apps really use EasyFlipView until any app has credited it or put the license in their app. I don’t know how to find these apps. But I can see the countries where the library is used from. United States, India, and China are the top 3 countries for the EasyFlipView libray clearly.

![](https://cdn-images-1.medium.com/max/1024/1*s3EWuCKY7op0Gsr8lwfTlw.png)<figcaption>The download location stats for <a href="https://bintray.com/wajahatkarim3/EasyFlipView/">EasyFlipView library from Bintray</a></figcaption>

The library has been performing really well for me. There has been some issues as well and also some amazing developers helped me fix those issues and contributed in it. It was a great achievement for me. Even some guys made YouTube video tutorials on how to use EasyFlipView to create flipping animations. In one video, this library was used in Xamarin. I never couldn’t imagine this. A big thanks to the [**EDMT Dev**](https://www.facebook.com/edmtdev/) and [**VideoTutoriales Andr**](https://twitter.com/VideoTutAndroid) **.**

{% youtube Zbt0h5y7HTk %}

{% youtube 2-ZI1rSM9QQ %}

{% youtube xacptJxva4s %}

* * *

This library made a huge impact on my life as a developer and I put a big stop on freelance and services providing work and have been doing open source since then along with a full-time job. You can check [EasyFlipView](https://github.com/wajahatkarim3/EasyFlipView)on this link. Please star ( ⭐️) it to help me cross 1000 stars on Github.

{% github wajahatkarim3/EasyFlipView %}

* * *

But why am I telling you about EasyFlipView all along? The title says something else. Right? The EasyFlipView had an issue which was open for a while. The issue was to add a capability to flip the view manually by touch and gestures.

![](https://cdn-images-1.medium.com/max/1024/1*GxiJxzyoPoFzvyGxwcogFw.png)<figcaption>The <a href="https://github.com/wajahatkarim3/EasyFlipView/issues/15">issue of flipping layout manually</a> from <a href="https://github.com/wajahatkarim3/EasyFlipView/">EasyFlipView library</a></figcaption>

I wanted to fix it but couldn’t do for multiple reasons. So, recently I started work on a book based app and having love for good UI/UX, I wanted to add book page flip animation in the app. I was using ViewPager for book pages, so that's where I get this idea to create a custom PageTransformer for book page flipping effect. I got the inspiration design from Author name at [Uplabs](https://medium.com/u/559b0105cd29) and I thought to create a library which will give me a demo like this.

[Onboarding Bookstore Demo at UpLabs by Star Liu](https://www.uplabs.com/posts/onboarding-animation-expore)

Luckily, creating this library was also helping me solve a[long-due issue on EasyFlipView library](https://github.com/wajahatkarim3/EasyFlipView/issues/15). So it was a win-win for me in every case. Now the only thing left was to create the library. I didn’t know much about PageTransformer or animations for ViewPager. I started looking on GitHub, StackOverflow and countless blogs. But I didn't find anything highly useful. I had some code snippets to play around for page transformations in ViewPager. So after 2 days' experimentation, I managed to create a simple but not too smooth page flip animation. I coded more, tweaked some values, added some more customization and voila. It worked. Overall it took me about a week with 2-3 hours work daily. Next task was to create a library with easy to use and easy to understand interface for developers.

> In my experience I have learned that creating libraries makes you a better developer because you are not writing code for app users who won’t care about the code. Rather you are writing for developers who will use your code. So you have to write code that’s easy to use and easy to understand for other developers.

From a custom PageTransformer class code to a reusable library available on jCenter, it took me about 7-8 more days. You might be wondering why so much time? After all, its just [uploading on Bintray](https://android.jlelse.eu/publishing-your-android-kotlin-or-java-library-to-jcenter-from-android-studio-1b24977fe450). Well, it's not that easy because this step doesn't involve code.

> Documentation is the most boring work for any developer. There are a lots of good open source projects which never got good feedback or users because of their poor and bad documentation. A great Read Me is the soul of any open source project.

* * *

### 🎶 🎵 Enter the “EasyFlipViewPager” 🎶 🎵

I started work from creating the library. I named it as [**EasyFlipViewPager**](https://github.com/wajahatkarim3/EasyFlipViewPager). I wrote Android module and [uploaded on Bintray to put on jcenter](https://android.jlelse.eu/publishing-your-android-kotlin-or-java-library-to-jcenter-from-android-studio-1b24977fe450). I follow this list for every single open source library I put on Github.

![](https://cdn-images-1.medium.com/max/1024/0*G3GDBHy9cZZGBczB.png)<figcaption>My checklist to put any Android library on Github</figcaption>

This is a lot of work. Next I created demo examples for the library. I recorded the screens with [Mobizen app](https://play.google.com/store/apps/details?id=com.rsupport.mvagent&hl=en). Edited the videos, [converted these into GIF images](https://ezgif.com/). Wrote the Read Me. Created a simple logo. Wrote the documentation. Added license and credits etc. Somehow finished the whole list. The jcenter approval took 2 days. The [Android Arsenal](https://android-arsenal.com/details/1/7357) approval took me 5 days. A few other places hasn’t responded yet. Its been already 9 days. This is the Read me checklist I follow.

![](https://cdn-images-1.medium.com/max/1024/0*u-WeRBBMjRc1VeqP.png)<figcaption>My Read Me checklist for Github Projects</figcaption>

And then the library was ready and [available at Github](https://github.com/wajahatkarim3/EasyFlipViewPager) for use. You can checkout it on the following link to see the result of all the hard work mentioned above.

{% github wajahatkarim3/EasyFlipViewPager %}

* * *

### The Library Demo

You can check the library example demo on this [YouTube video](https://www.youtube.com/watch?v=ibuHv06wdhs) or you can [download this APK file](https://github.com/wajahatkarim3/EasyFlipViewPager/blob/master/EasyFlipViewPager-Demo.apk?raw=true) to test it on your android devices.

{% youtube ibuHv06wdhs %}

* * *

### 📄 How to Use

First you will have to add the library in your android projects. The library is available at jCenter and can be added by putting this line in your app’s build.gradle file.

![](https://cdn-images-1.medium.com/max/931/1*EJTDCGMbyuIG7lN2TJarTg.png)

Now there are two types of flipping animations in this library.

#### 📖 Book Page Flipping

Set the object of BookPageFlipTransformer to your ViewPager by calling setPageTransformer() method.

![](https://cdn-images-1.medium.com/max/1024/1*qrtKoMlE0ZQ7GK-ti75tng.png)<figcaption>The <a href="https://github.com/wajahatkarim3/EasyFlipViewPager#-book-flip-example">book flip demo from EasyFlipViewLibrary</a> on Github</figcaption>

And your ViewPager will change pages with flipping animation.

![](https://cdn-images-1.medium.com/max/336/0*DBFFixkQw_ePwjXb.gif)<figcaption>The book demo of <a href="https://github.com/wajahatkarim3/EasyFlipViewPager">EasyFlipViewPager </a>library</figcaption>

* * *

### 💳 Card Flipping

This was more like my previous library EasyFlipView. But this works on ViewPager instead of custom views. All you have to do is set object of CardFlipPageTransformer to your ViewPager by calling setPageTransformerMethod.

![](https://cdn-images-1.medium.com/max/1024/1*UuxdGpTnSE2cDbFQacIWUA.png)<figcaption>The <a href="https://github.com/wajahatkarim3/EasyFlipViewPager#-card-flip-example">card flip demo of EasyFlipViewPager</a> on Github</figcaption>

And you will get something like shown in the poker care demo. Also, if you enable scaling then your cards will also scale along with flipping as shown in the tour gallery demo.

![](https://cdn-images-1.medium.com/max/336/1*9FNpou-ApoltxosfQYrt8Q.gif)

![](https://cdn-images-1.medium.com/max/336/1*Ao1CvtrXHpqs8HT6KZGsDg.gif)<figcaption>The <a href="https://github.com/wajahatkarim3/EasyFlipViewPager#-card-flip-example">Card Flipping Demo of EasyFlipViewPager</a> — With Scaling (left) and Without Scaling (right)</figcaption>

* * *

### What’s Next

This library still needs some work and some new features like [PDF support](https://github.com/wajahatkarim3/EasyFlipViewPager/issues/5), custom ViewPager view class with support of XML attributes to make usage more simpler and easier. Also, I want to add the flipping animation in RecyclerView elements by creating a custom LayoutManager class. And an Activity transition to switch from one activity to another through flipping animation.

* * *

### How Can You Help Me?

I need your help in making this project better. Please star/fork ( ⭐️) the library on Github and send me pull requests if you want to contribute in any way. I would love and appreciate your contributions.

{% github wajahatkarim3/EasyFlipViewPager %}

Also, share the library or this article on social media, friends, colleagues etc. And don’t forget to clap this article. Thank you for reading.

* * * 
*Update (14–12–2018):* The [EasyFlipViewPager](https://github.com/wajahatkarim3/EasyFlipViewPager) library is now in [Github Trending in Kotlin](https://github.com/trending/kotlin?since=daily) language on 14th December, 2018. Thank you guys for your support and love. :)

![](https://cdn-images-1.medium.com/max/1250/1*tbJOqRrvGuFQjJVqQqg07w.png)<figcaption>The <a href="https://github.com/wajahatkarim3/EasyFlipViewPager">EasyFlipViewPager</a> library trending #1 on Github in Kotlin</figcaption>

* * *

**Wajahat Karim** is a graduate from NUST, Islamabad, an experienced mobile developer, an active open source contributor, and co-author of two books [Learning Android Intents](https://www.amazon.com/Learning-Android-Intents-Muhammad-Usama/dp/1783289635) and [Mastering Android Game Development with Unity](https://www.amazon.com/Mastering-Android-Game-Development-Unity/dp/1783550775/). In his spare time, he likes to spend time with his family, do experiments on coding, loves to write about lots of things (mostly on blog and medium) and is passionate contributor to open source. In June 2018, one of his library became #1 on [Github Trending](https://github.com/trending). [His libraries](http://github.com/wajahatkarim3) have about 2000 stars on Github and are being used in various apps by the developers all around the globe. Follow him on Twitter and [Medium](https://medium.com/@wajahatkarim3) to get more updates about his work in Writing, Android and Open Source.

[Wajahat Karim (@WajahatKarim) | Twitter](https://twitter.com/WajahatKarim)

Also, if you have any questions you’d like him to answer, contact him through his website at [wajahatkarim.com](http://wajahatkarim.com) with DEAR WAJAHAT in the subject line.

* * *