Deck

Additional

Language
Kotlin
Version
0.1 (Dec 3, 2017)
Created
Dec 2, 2017
Updated
Dec 24, 2018 (Retired)
Owner
Bloder (bloderxd)
Contributors
Hendra Wijaya Djiono (hendrawd)
Bloder (bloderxd)
2
Activity
Badge
Generate
Download
Source code

Deck

What is it?

Deck is a library that permits you to apply a beautiful animation in your view pager, and this animations looks like a deck... yeah, I'm not good with names.

How does it works?

First of all you need to declare it in your layout xml file

<com.example.lib.Deck
        android:id="@+id/deck_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

Then you can set the padding(Optional)

private val deckPager by lazy { activity.findViewById<Deck>(R.id.deck_pager) }

Set padding based on percentage of the screen width

deckPager.setPercentagePadding(activity, 8)

or set padding based on dp value

deckPager.setDpPadding(activity, 16)
Remember you can set all other view pager properties with deck

Deck properties

These are all properties supported in deck's xml

<com.example.lib.Deck
        android:id="@+id/deck_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:padding_percentage="8"
        app:padding_dp="16dp"/>

Import

Add JitPack maven repository reference in your project

repositories {
    maven { url 'https://jitpack.io' }
}

then add deck reference in your gradle dependencies

Gradle
dependencies {
    compile 'com.github.bloderxd:deck:0.1'
}
Gradle v3.0+
dependencies {
    implementation 'com.github.bloderxd:deck:0.1'
}

License

MIT License

Copyright (c) 2017 Bloder

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.