Android LiquidSwipe Library

Overview

LiquidSwipe

Android LiquidSwipe Library

License: MIT API

Default Touch Interactive

LiquidSwipe is a viewpager library that can be used to make awesome onboarding designs. (Default Demo apk) (TouchInteractive Demo apk)

If you like this, you'll like ConcentricOnboarding as well.

Demo app

To run the demo project, clone the repository and run it via Android Studio.
(OR)
Download the latest demo apk from releases.

Usage

Set up the dependency

  1. Add the JitPack repository to your root build.gradle at the end of repositories:
allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
  1. Add the LiquidSwipe dependency in the build.gradle:
implementation 'com.github.Chrisvin:LiquidSwipe:1.3'

Use LiquidSwipeViewPager instead of the normal ViewPager

">

   

    
    


   

Use a LiquidSwipeLayout as the base container in the fragment layouts

">


   

    


   


Note : Dokka generated documentation on LiquidSwipeLayouts

And you're done, easy-peasy. ^_^

Touch Interactive - Making the LiquidSwipe wave center Y value match the touch Y value

Rather than having the wave center Y value always be layout.height/2 , it would be more aesthetically pleasing for it to be the same as the touch Y value. The following code can be used to dynamically change the waveCenterY based on the touch position on the LiquidSwipeViewPager. (The reason this isn't done internally in the library is because the viewpager layouts don't get the touch events when said touch events are consumed directly by the viewpager)

  1. In the Activity/Fragment class containing the LiquidSwipeViewPager
// Create an array of LiquidSwipeCPP, one for each layout in the PagerAdapter
val liquidSwipeClipPathProviders = Array(titleArray.count()) {
    LiquidSwipeClipPathProvider()
}

// Pass the LiquidSwipeCPP array to the adapter
viewpager.adapter = CustomPagerAdapter(this, liquidSwipeClipPathProviders)
// Similar logic can also be applied for your custom FragmentPagerAdapter/FragmentStatePagerAdapter

// Listen to onTouch events on the viewpager and update the waveCenterY value of the LiquidSwipeCPPs
viewpager.setOnTouchListener { _, event ->
    val waveCenterY = event.y
    liquidSwipeClipPathProviders.map {
        it.waveCenterY = waveCenterY
    }
    false
}
  1. In the PagerAdapter
// Set the layout's clipPathProvider to the corresponding `LiquidSwipeClipPathProvider`
(layout as? LiquidSwipeLayout)?.clipPathProvider = liquidSwipeClipPathProviders[position]

The above code has been showcased in the demo app, feel free to look at it for reference.

Note: This is not a perfect solution, in fact some artifacts might occur due to the quick waveCenterY value jumps. But for now, this is the cleanest solution I can think of. Anyone else with a better solution is welcome to fork and submit a pull request. :)

Creating custom swipe animations

The concept for the ClipPathProvider in LiquidSwipe is the same as that in the EasyReveal library (If you haven't already, then you should really check it out, infact the first version of LiquidSwipe used EasyReveal as a dependency).

You can create your own swipe animation by extending the ClipPathProvider and implementing the getPath() method. getPath() provides the Path for a given percent value on the provided view. The path gotten from getPath() is then used to clip the view using canvas.clipPath(path, op) (The op value is provided by the ClipPathProvider as well). You can then set your custom ClipPathProvider to your layouts.

API Documentation

Documentation generated using Dokka : chrisvin.github.io/LiquidSwipe

Bugs and Feedback

For bugs, questions and discussions please use the Github Issues.

Credits

  1. Cuberto's liquid-swipe for iOS - Source of inspiration
  2. Alvaro Fabre - Designer of the lottie animations in the demo app

License

MIT License

Copyright (c) 2019 Jem

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • Crash

    Crash

    when i convert it in ontouchListener swipe and when i swipe more than 4-5 pages it gives this error java.lang.ArrayIndexOutOfBoundsException: length=5; index=5 at com.example.liquidswipedemo.CustomPagerAdapter.instantiateItem(CustomPagerAdapter.kt:27) at androidx.viewpager.widget.ViewPager.addNewItem(ViewPager.java:1010) at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1224) at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092) at androidx.viewpager.widget.ViewPager$3.run(ViewPager.java:273) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:977) at android.view.Choreographer.doCallbacks(Choreographer.java:785) at android.view.Choreographer.doFrame(Choreographer.java:714) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:963) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6819) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:497) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:912)

    opened by UmairAhmed420 4
  • just a suggestion.... new idea

    just a suggestion.... new idea

    your library is awesome .... can you implement one more thing in this library? that is how about when we swipe it detects gesture from where of screen user is swiping so the liquid effects goes there or start from there not from a static position which is mentioned ios library

    opened by UmairAhmed420 2
  • Add support for ViewPager2

    Add support for ViewPager2

    Current LiquidSwipeViewPager is extended from androidx.viewpager.widget.ViewPager.

    Create LiquidSwipeViewPager which would extend androidx.viewpager2.widget.ViewPager2.

    enhancement 
    opened by Chrisvin 1
  • Swipe arrow icon color conflicts with the color of the next background

    Swipe arrow icon color conflicts with the color of the next background

    The icon that is used swipe to the next page has the same color as the next background and therefore appears invisible. How do i customize the color of the Icon?

    opened by Joealtidore1 0
  • Touch Interaction not working in java code

    Touch Interaction not working in java code

    I have made the app in java so I am having problem regarding touch interaction part because some function don't match in kotlin and java. Please provide code for java too.

    opened by CoderHermione 2
  • How to animate from bottom to top

    How to animate from bottom to top

    I want to animate the layout with similar animation but from bottom to top. How can I achieve this animation.

    Sorry for posting this question in the issue.

    It will be very helpful if you guide me to solve the problem.

    enhancement good first issue question 
    opened by Naveen3921 1
Releases(1.3)
Owner
Chrisvin Jem
Programmer
Chrisvin Jem
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 31, 2022
Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.

Android ViewPagerIndicator Paging indicator widgets that are compatible with the ViewPager from the Android Support Library to improve discoverability

Jake Wharton 10.2k Jan 3, 2023
ViewPagers library for Android

freepager Ready-to-use view pagers for your project. Based on Swipes navigation demo repository Usage: Gradle: dependencies { compile 'pro.alexza

Alex Zaitsev 460 Nov 25, 2022
Android library for fluid tablayout animation as seen on Snapchat.

SnapTabLayout Show some ❤️ and star the repo to support the project This library is the implementation of TabLayout as seen on popular messaging app S

Niranjan Kurambhatti 714 Dec 25, 2022
Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.

Android ViewPagerIndicator Paging indicator widgets that are compatible with the ViewPager from the Android Support Library to improve discoverability

Jake Wharton 10.2k Jan 5, 2023
Android Concentric Onboarding library

Android Concentric Onboarding library

Chrisvin Jem 50 Sep 13, 2022
A Material Design ViewPager easy to use library

MaterialViewPager Material Design ViewPager easy to use library Sample And have a look on a sample Youtube Video : Youtube Link Download In your modul

Florent CHAMPIGNY 8.2k Dec 29, 2022
Pixplicity 915 Nov 8, 2022
Library for Sliding Tab With Color Icons!

Sliding Tab With Color Icons Sliding Tab With Color Icons! Kindly use the following links to use this library: In build.gradle (Project) allprojects {

Prabhakar Thota 35 Jan 22, 2022
A simple app that consumes The Ricky & Morty API to display the tv show characters, was trying to learn about pagination with the paging 3 library

Ricky&MortyAPIDemo A simple app that consumes The Rick and Morty API which is a REST and GraphQL API based on the television show Rick and Morty. I wa

Joel Kanyi 9 Jul 12, 2022
Circular motion is a ViewPager library that can be used to make Awesome Onboarding designs.

CircularMotion Android Circular Motion Onboarding library Circular motion is a ViewPager library that can be used to make Awesome Onboarding designs.

Farham Hosseini 4 Nov 5, 2021
Three material Dots Indicators for view pagers in Android !

Material View Pager Dots Indicator This library makes it possible to represent View Pager Dots Indicator with 3 different awesome styles ! It supports

Tommy Buonomo 2.8k Jan 5, 2023
A pager for Android with parallax effect

ParallaxPagerTransformer A pager transformer for Android with parallax effect Installation in your build.gradle file dependencies { // ... com

Javier Gonzalez 654 Dec 29, 2022
A nicer-looking, more intuitive and highly customizable alternative for radio buttons and dropdowns for Android.

SwipeSelector Undergoing for some API changes for a 2.0 major version, see example usage in the sample module! What and why? Bored of dull looking rad

Iiro Krankka 1.1k Dec 9, 2022
Android auto scroll viewpager or viewpager in viewpager

Android Auto Scroll ViewPager ViewPager which can auto scrolling, cycling, decelerating. ViewPager which can be slided normal in parent ViewPager. Att

Trinea 1.7k Dec 10, 2022
An android ViewPager extension allowing infinite scrolling

NO LONGER MAINTAINED LoopingViewPager An android ViewPager extension allowing infinite scrolling. You can use it with "standart" PagerAdapter (inflati

Leszek Mzyk 992 Nov 10, 2022
Augment Android's ViewPager with wrap-around functionality.

Infinite View Pager Augment Android's ViewPager with wrap-around functionality. Original StackOverflow question: http://stackoverflow.com/questions/75

Antony Tran 692 Dec 14, 2022
[Development stopped in 2014. Unfinished and not stable - not recommended to use.] An easy-to-use ViewPager subclass with parallax background effect for Android apps.

Development stopped in 2014 Not developed since 2014. Unfinished and not stable - not recommended to use. ParallaxViewPager An easy-to-use ViewPager s

Andras Kindler 437 Dec 29, 2022
Android - A ViewPager page indicator that displays the current page number and (optionally) the page count

NumericPageIndicator A ViewPager page indicator that displays the current page number and (optionally) the page count. It can also display buttons to

Manuel Peinado Gallego 253 Nov 16, 2022