From bb428b2536834609fc1574bebceb18166a5fe5fc Mon Sep 17 00:00:00 2001 From: severianremi Date: Thu, 22 Feb 2018 17:13:42 +0200 Subject: [PATCH] Create README.md --- README.md | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..9c366e4 --- /dev/null +++ b/README.md @@ -0,0 +1,136 @@ +# Koloda-Android + +# Koloda + +## Requirements +- Android SDK 15+ + +## Usage + +Add to your root build.gradle: +```Groovy +allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } + } +``` + +Add the dependency: +```Groovy +dependencies { + compile 'com.github.Yalantis:Koloda-Android:-SNAPSHOT' + } +``` + +## How to use this library in your project? + +First of all, add `Koloda` to the xml layout of your activity, so it looks like that: + +```xml + + +``` + +Create your adapter and set it to Koloda adapter +```Kotlin +adapter = YourAdapter(data) +koloda.adapter = adapter +``` + +## Customization + +For customization ui Koloda you can use such attributes value : + +To control the card position by scale lower cards set koloda_card_scale_diff attributes float value in layout. The range of ScaleDiff is 0.01 - 0.1. The default value for ScaleDiff is 0.04f +```xml + +``` + +To control distance between cards set value to koloda_card_offsetY in dp. The default value for CardOffsetY is 16dp. +```xml + +``` +Change angle for card when swipe it you can set value to koloda_card_rotate_angle. The default value for CardRotateAngle is 30 +```xml + +``` + +Also you can change visible cards count in desk with koloda_max_visible_cards attributes. The default value for CardsVisible is 3 +```xml + +``` + +Kolod has reloadPreviousCard() method which reload previous card +```Kotlin +koloda.reloadPreviousCard() +``` + +Kolod has reloadAdapterData() method which reload all data(Start show data from the beginning) +```Kotlin +koloda.reloadAdapterData() +``` + +Also, you can realize automatic swipe using onButtonClicks(isSwipeCardToRight: Boolean) method: +```Kotlin +koloda.onButtonClick(false) - swipe to left +koloda.onButtonClick(true) - swipe to right +``` + +Also you can create `KolodaListener` and use all the methods of the `KolodaListener`. This interface provides empty implementations of the methods. For any custom animation callback handle you can create any custom listener that cares only about a subset of the methods of this listener can simply implement the interface directly: +
onNewTopCard(position: Int)
+onCardDrag(position: Int, cardView: View, progress: Float)
+onCardSwipedLeft(position: Int)
+onCardSwipedRight(position: Int)
+onClickRight(position: Int)
+onClickLeft(position: Int)
+onCardSingleTap(position: Int)
+onCardDoubleTap(position: Int)
+onCardLongPress(position: Int)
+onEmptyDeck()
+ + +## Let us know! + +We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation. + +## License + + The MIT License (MIT) + + Copyright © 2018 Yalantis, https://yalantis.com + + 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.