All Projects → Chrisvin → Liquidswipe

Chrisvin / Liquidswipe

Licence: mit
Android LiquidSwipe Library

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Liquidswipe

Concentriconboarding
Android Concentric Onboarding library
Stars: ✭ 42 (-94.17%)
Mutual labels:  library, viewpager, page, pager
Transformerslayout
🔥 App金刚区导航菜单,类似淘宝、QQ音乐等APP导航,方格布局横向多行滑动翻页带滚动条
Stars: ✭ 258 (-64.22%)
Mutual labels:  viewpager, page, pager
Layerjs
layerJS: Javascript UI composition framework
Stars: ✭ 1,825 (+153.12%)
Mutual labels:  library, swipe
Kau
An extensive collection of Kotlin Android Utils
Stars: ✭ 182 (-74.76%)
Mutual labels:  library, swipe
Walk-Through-Screen
This library provides easy ways to add onboarding or pager screens with different animation and indicators.
Stars: ✭ 31 (-95.7%)
Mutual labels:  viewpager, pager
Shviewpager
A simple view pager for iOS. Compatible with iOS 8.0 or later.
Stars: ✭ 127 (-82.39%)
Mutual labels:  viewpager, pager
Swipelayout
A library what allows you to execute a swipe for the android platform
Stars: ✭ 150 (-79.2%)
Mutual labels:  library, swipe
react-native-viewpager-carousel
a flexible viewpager library with carousel functionality
Stars: ✭ 39 (-94.59%)
Mutual labels:  swipe, viewpager
Googlenewsstandanimation Android
Navigation pattern like in Google News Stand app with transitions
Stars: ✭ 130 (-81.97%)
Mutual labels:  library, swipe
Cmpagetitleview
✍️一分钟集成类似抖音,新浪微博,腾讯视频,网易新闻,今日头条等常见的标题栏样式,api灵活易扩展,支持Cocoapods和Masonry布局,支持ChildController的完整生命周期
Stars: ✭ 270 (-62.55%)
Mutual labels:  viewpager, pager
Cardslideview
一行代码实现ViewPager卡片效果,比ViewPager2更强大,底层同样是RecyclerView
Stars: ✭ 301 (-58.25%)
Mutual labels:  viewpager, page
MetalRecyclerPagerView
RecyclerView implementation for Android which makes it look and feel like ViewPager with item margins support (mutliple views effect).
Stars: ✭ 26 (-96.39%)
Mutual labels:  swipe, viewpager
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+667.41%)
Mutual labels:  swipe, viewpager
Reside-Menu
By applying viewpager animation you can also make AMAZING Reside Menu's
Stars: ✭ 72 (-90.01%)
Mutual labels:  viewpager, pager
Jxpagelistview
高仿闲鱼、转转、京东、中央天气预报等主流APP列表底部分页滚动视图
Stars: ✭ 377 (-47.71%)
Mutual labels:  page, pager
Infinitecycleviewpager
Infinite cycle ViewPager with two-way orientation and interactive effect.
Stars: ✭ 5,720 (+693.34%)
Mutual labels:  library, viewpager
Python Progressbar
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
Stars: ✭ 682 (-5.41%)
Mutual labels:  library
Easyflipviewpager
📖 The library for creating book and card flip animations in ViewPager in Android
Stars: ✭ 698 (-3.19%)
Mutual labels:  viewpager
Terminaltables
Generate simple tables in terminals from a nested list of strings.
Stars: ✭ 685 (-4.99%)
Mutual labels:  library
Android Dragdismissactivity
A smooth, easy-to-implement, drag to dismiss Android Activity.
Stars: ✭ 682 (-5.41%)
Mutual labels:  library

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

<androidx.constraintlayout.widget.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.jem.liquidswipe.LiquidSwipeViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

Use a LiquidSwipeLayout as the base container in the fragment layouts

<?xml version="1.0" encoding="utf-8"?>
<com.jem.liquidswipe.layout.LiquidSwipeConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DummyFragment">

    <!--  Fill with your views, just like you would in a normal ConstraintLayout  -->

</com.jem.liquidswipe.layout.LiquidSwipeConstraintLayout>

<!--  Also supports LiquidSwipeFrameLayout & LiquidSwipeLinearLayout  -->

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].