Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 384eb97

Browse files
authored
Update README.md
1 parent ae21af7 commit 384eb97

File tree

1 file changed

+55
-48
lines changed

1 file changed

+55
-48
lines changed

‎README.md

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
- [Automatic Swipe](#automatic-swipe)
2222
- [Cancel](#cancel)
2323
- [Rewind](#rewind)
24-
- [Overlay](#overlay)
24+
- [Overlay View](#overlay-view)
25+
- [Overlay Interpolator](#overlay-interpolator)
2526
- [Paging](#paging)
2627
- [Reloading](#reloading)
2728
- [Stack From](#stack-from)
@@ -41,12 +42,10 @@
4142

4243
# Setup
4344

44-
```java
45-
CardStackLayoutManager manager = new CardStackLayoutManager();
46-
CardStackAdapter adapter = new CardStackAdapter();
47-
CardStackView cardStackView = findViewById(R.id.card_stack_view);
48-
cardStackView.setLayoutManager(manager);
49-
cardStackView.setAdapter(adapter);
45+
```kotlin
46+
val cardStackView = findViewById<CardStackView>(R.id.card_stack_view)
47+
cardStackView.layoutManager = CardStackLayoutManager()
48+
cardStackView.adapter = CardStackAdapter()
5049
```
5150

5251
# Features
@@ -59,20 +58,20 @@ cardStackView.setAdapter(adapter);
5958

6059
![AutomaticSwipe](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-automatic-swipe.gif)
6160

62-
```java
63-
CardStackView.swipe();
61+
```kotlin
62+
CardStackView.swipe()
6463
```
6564

6665
You can set custom swipe animation.
6766

68-
```
69-
SwipeAnimationSetting setting = new SwipeAnimationSetting.Builder()
70-
.setDirection(Direction.Right)
71-
.setDuration(200)
72-
.setInterpolator(new AccelerateInterpolator())
73-
.build();
74-
CardStackLayoutManager.setSwipeAnimationSetting(setting);
75-
CardStackView.swipe();
67+
```kotlin
68+
val setting = SwipeAnimationSetting.Builder()
69+
.setDirection(Direction.Right)
70+
.setDuration(Duration.Normal.duration)
71+
.setInterpolator(AccelerateInterpolator())
72+
.build()
73+
CardStackLayoutManager.setSwipeAnimationSetting(setting)
74+
CardStackView.swipe()
7675
```
7776

7877
## Cancel
@@ -85,23 +84,23 @@ Manual swipe is canceled when the card is dragged less than threshold.
8584

8685
![Rewind](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-rewind.gif)
8786

88-
```java
89-
CardStackView.rewind();
87+
```kotlin
88+
CardStackView.rewind()
9089
```
9190

9291
You can set custom rewind animation.
9392

94-
```java
95-
RewindAnimationSetting setting = new RewindAnimationSetting.Builder()
96-
.setDirection(Direction.Bottom)
97-
.setDuration(200)
98-
.setInterpolator(new DecelerateInterpolator())
99-
.build();
100-
CardStackLayoutManager.setRewindAnimationSetting(setting);
101-
CardStackView.rewind();
93+
```kotlin
94+
val setting = RewindAnimationSetting.Builder()
95+
.setDirection(Direction.Bottom)
96+
.setDuration(Duration.Normal.duration)
97+
.setInterpolator(DecelerateInterpolator())
98+
.build()
99+
CardStackLayoutManager.setRewindAnimationSetting(setting)
100+
CardStackView.rewind()
102101
```
103102

104-
## Overlay
103+
## Overlay View
105104

106105
| Value | Sample |
107106
| :----: | :----: |
@@ -128,6 +127,14 @@ Put overlay view in your item layout of RecyclerView.
128127
| Top | top_overlay |
129128
| Bottom | bottom_overlay |
130129

130+
## Overlay Interpolator
131+
132+
You can set own interpolator to define the rate of change of alpha.
133+
134+
```kotlin
135+
CardStackLayoutManager.setOverlayInterpolator(LinearInterpolator())
136+
```
137+
131138
## Paging
132139

133140
You can implement paging by using following two ways.
@@ -137,7 +144,7 @@ You can implement paging by using following two ways.
137144

138145
**Caution**
139146

140-
You should **not** call `RecyclerView.Adapter.notifyDataSetChanged` for paging because this method will reset top position and maybe occur a perfomance issue.
147+
You should **NOT** call `RecyclerView.Adapter.notifyDataSetChanged` for paging because this method will reset top position and maybe occur a perfomance issue.
141148

142149
## Reloading
143150

@@ -153,8 +160,8 @@ You can implement reloading by calling `RecyclerView.Adapter.notifyDataSetChange
153160
| | Left | ![StackFrom-Left](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-stack-from-left.png) |
154161
| | Right | ![StackFrom-Right](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-stack-from-right.png) |
155162

156-
```java
157-
CardStackLayoutManager.setStackFrom(StackFrom.None);
163+
```kotlin
164+
CardStackLayoutManager.setStackFrom(StackFrom.None)
158165
```
159166

160167
## Visible Count
@@ -165,8 +172,8 @@ CardStackLayoutManager.setStackFrom(StackFrom.None);
165172
| ✅ | 3 | ![VisibleCount-3](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-visible-count-3.png) |
166173
| | 4 | ![VisibleCount-4](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-visible-count-4.png) |
167174

168-
```java
169-
CardStackLayoutManager.setVisibleCount(3);
175+
```kotlin
176+
CardStackLayoutManager.setVisibleCount(3)
170177
```
171178

172179
## Translation Interval
@@ -177,8 +184,8 @@ CardStackLayoutManager.setVisibleCount(3);
177184
| ✅ | 8dp | ![TranslationInterval-8dp](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-translation-interval-8dp.png) |
178185
| | 12dp | ![TranslationInterval-12dp](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-translation-interval-12dp.png) |
179186

180-
```java
181-
CardStackLayoutManager.setTranslationInterval(8f);
187+
```kotlin
188+
CardStackLayoutManager.setTranslationInterval(8.0f)
182189
```
183190

184191
## Scale Interval
@@ -188,8 +195,8 @@ CardStackLayoutManager.setTranslationInterval(8f);
188195
| ✅ | 95% | ![ScaleInterval-95%](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-scale-interval-95.png) |
189196
| | 90% | ![ScaleInterval-90%](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-scale-interval-90.png) |
190197

191-
```java
192-
CardStackLayoutManager.setScaleInterval(0.95f);
198+
```kotlin
199+
CardStackLayoutManager.setScaleInterval(0.95f)
193200
```
194201

195202
## Max Degree
@@ -199,8 +206,8 @@ CardStackLayoutManager.setScaleInterval(0.95f);
199206
| ✅ | 20° | ![MaxDegree-20](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-max-degree-20.png) |
200207
| | 0° | ![MaxDegree-0](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-max-degree-0.png) |
201208

202-
```java
203-
CardStackLayoutManager.setMaxDegree(20f);
209+
```kotlin
210+
CardStackLayoutManager.setMaxDegree(20.0f)
204211
```
205212

206213
## Swipe Direction
@@ -211,8 +218,8 @@ CardStackLayoutManager.setMaxDegree(20f);
211218
| | Vertical | ![SwipeDirection-Vertical](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-direction-vertical.gif) |
212219
| | Freedom | ![SwipeDirection-Freedom](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-direction-freedom.gif) |
213220

214-
```java
215-
CardStackLayoutManager.setDirections(Direction.HORIZONTAL);
221+
```kotlin
222+
CardStackLayoutManager.setDirections(Direction.HORIZONTAL)
216223
```
217224

218225
## Swipe Threshold
@@ -222,8 +229,8 @@ CardStackLayoutManager.setDirections(Direction.HORIZONTAL);
222229
| ✅ | 30% | ![SwipeThreshold-30%](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-threshold-30.gif) |
223230
| | 10% | ![SwipeThreshold-10%](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-threshold-10.gif) |
224231

225-
```java
226-
CardStackLayoutManager.setSwipeThreshold(0.3f);
232+
```kotlin
233+
CardStackLayoutManager.setSwipeThreshold(0.3f)
227234
```
228235

229236
## Swipe Restriction
@@ -235,9 +242,9 @@ CardStackLayoutManager.setSwipeThreshold(0.3f);
235242
| false | true | ![SwipeRestriction-CanScrollVerticalOnly](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-restriction-can-scroll-vertical-only.gif) |
236243
| false | false | ![SwipeRestriction-CannotSwipe](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipe-restriction-cannot-swipe.gif) |
237244

238-
```java
239-
CardStackLayoutManager.setCanScrollHorizontal(true);
240-
CardStackLayoutManager.setCanScrollVertical(true);
245+
```kotlin
246+
CardStackLayoutManager.setCanScrollHorizontal(true)
247+
CardStackLayoutManager.setCanScrollVertical(true)
241248
```
242249

243250
## Swipeable Method
@@ -249,8 +256,8 @@ CardStackLayoutManager.setCanScrollVertical(true);
249256
| | Manual | ![SwipwableMethod-Manual](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipeable-method-manual.gif) |
250257
| | None | ![SwipwableMethod-None](https://github.com/yuyakaido/images/blob/master/CardStackView/sample-swipeable-method-none.gif) |
251258

252-
```java
253-
CardStackLayoutManager.setSwipeableMethod(SwipeableMethod.AutomaticAndManual);
259+
```kotlin
260+
CardStackLayoutManager.setSwipeableMethod(SwipeableMethod.AutomaticAndManual)
254261
```
255262

256263
# Public Interfaces

0 commit comments

Comments
 (0)