Skip to content

Commit 0fb33d3

Browse files
committed
Update README.md
1 parent 6f39982 commit 0fb33d3

File tree

1 file changed

+101
-83
lines changed

1 file changed

+101
-83
lines changed

README.md

Lines changed: 101 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Build Status](https://travis-ci.org/skydoves/ElasticViews.svg?branch=master)](https://travis-ci.org/skydoves/ElasticViews)
55
[![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23336-orange.svg)](https://androidweekly.net/issues/issue-336) <br>
66

7-
A library that lets you implement elastic touch animation easily.
7+
An easy way to implement elastic touch effect for Android.
88

99
![gif0](https://user-images.githubusercontent.com/24237865/48674497-53e2f180-eb90-11e8-86fb-476f841b3e32.gif)
1010
![gif1](https://user-images.githubusercontent.com/24237865/48674498-53e2f180-eb90-11e8-8313-aa94b34a40d2.gif)
@@ -18,7 +18,7 @@ repositories {
1818
}
1919
2020
dependencies {
21-
implementation "com.github.skydoves:elasticviews:2.0.2"
21+
implementation "com.github.skydoves:elasticviews:2.0.3"
2222
}
2323
```
2424

@@ -55,17 +55,17 @@ public void onClick(View v) {
5555
### ElasticButton
5656
```gradle
5757
<com.skydoves.elasticviews.ElasticButton
58-
android:id="@+id/elasticbutton"
59-
android:layout_width="match_parent"
60-
android:layout_height="50dp"
61-
app:button_backgroundColor="#30354b"
62-
app:button_round="20"
63-
app:button_scale="0.7"
64-
app:button_duration="400"
65-
app:button_labelText="Elastic Button"
66-
app:button_labelColor="#ffffff"
67-
app:button_labelSize="16"
68-
app:button_labelStyle="bold"/>
58+
android:id="@+id/elasticbutton"
59+
android:layout_width="match_parent"
60+
android:layout_height="50dp"
61+
app:button_backgroundColor="#30354b"
62+
app:button_round="20"
63+
app:button_scale="0.7"
64+
app:button_duration="400"
65+
app:button_labelText="Elastic Button"
66+
app:button_labelColor="#ffffff"
67+
app:button_labelSize="16"
68+
app:button_labelStyle="bold"/>
6969
```
7070

7171
### ElasticButton use like TextView
@@ -77,112 +77,130 @@ app:button_backgroundColor="@android:color/transparent"
7777
### ElasticCheckButton
7878
```gradle
7979
<com.skydoves.elasticviews.ElasticCheckButton
80-
android:id="@+id/elasticcheckbutton"
81-
android:layout_width="match_parent"
82-
android:layout_height="50dp"
83-
app:checkbutton_backgroundColor="#30354b"
84-
app:checkbutton_round="30"
85-
app:checkbutton_scale="0.9"
86-
app:checkbutton_duration="400"
87-
app:checkbutton_labelText="Elastic CheckButton"
88-
app:checkbutton_labelColor="#ffffff"
89-
app:checkbutton_labelSize="16"
90-
app:checkbutton_labelStyle="bold"
91-
app:checkbutton_alpha="0.5"
92-
app:checkbutton_ischecked="false"/>
80+
android:id="@+id/elasticcheckbutton"
81+
android:layout_width="match_parent"
82+
android:layout_height="50dp"
83+
app:checkbutton_backgroundColor="#30354b"
84+
app:checkbutton_round="30"
85+
app:checkbutton_scale="0.9"
86+
app:checkbutton_duration="400"
87+
app:checkbutton_labelText="Elastic CheckButton"
88+
app:checkbutton_labelColor="#ffffff"
89+
app:checkbutton_labelSize="16"
90+
app:checkbutton_labelStyle="bold"
91+
app:checkbutton_alpha="0.5"
92+
app:checkbutton_ischecked="false"/>
9393
```
9494

9595
### ElasticImageView
9696
```gradle
9797
<com.skydoves.elasticviews.ElasticImageView
98-
android:id="@+id/elasticimageview"
99-
android:layout_width="64dp"
100-
android:layout_height="64dp"
101-
android:scaleType="fitXY"
102-
android:src="@drawable/ic_question"
103-
app:imageview_duration="500"
104-
app:imageview_scale="0.7"/>
98+
android:id="@+id/elasticimageview"
99+
android:layout_width="64dp"
100+
android:layout_height="64dp"
101+
android:scaleType="fitXY"
102+
android:src="@drawable/ic_question"
103+
app:imageview_duration="500"
104+
app:imageview_scale="0.7"/>
105105
```
106106

107107
### ElasticFloatingButton
108108
```gradle
109109
<com.skydoves.elasticviews.ElasticFloatingActionButton
110-
android:id="@+id/elasticfab"
111-
android:layout_width="64dp"
112-
android:layout_height="64dp"
113-
android:src="@drawable/ic_add"
114-
app:fabSize="normal"
115-
app:fabutton_duration="400"
116-
app:fabutton_scale="0.85"/>
110+
android:id="@+id/elasticfab"
111+
android:layout_width="64dp"
112+
android:layout_height="64dp"
113+
android:src="@drawable/ic_add"
114+
app:fabSize="normal"
115+
app:fabutton_duration="400"
116+
app:fabutton_scale="0.85"/>
117117
```
118118

119119
### ElasticLayout
120-
ElasticLayout gives elastic animation to all child views.
120+
ElasticLayout implements elastic animation to all child views.
121121

122122
```gradle
123123
<com.skydoves.elasticviews.ElasticLayout
124-
android:id="@+id/elasticlayout"
125-
android:layout_width="match_parent"
126-
android:layout_height="80dp"
127-
app:layout_backgroundColor="#30354b"
128-
app:layout_duration="500"
129-
app:layout_scale="0.85">
130-
131-
<TextView
132-
android:id="@+id/textView0"
133-
android:layout_width="match_parent"
134-
android:layout_height="wrap_content"
135-
android:text="This is"
136-
android:textColor="#ffffff"
137-
android:textSize="18sp" />
138-
139-
<TextView
140-
android:layout_below="@+id/textView1"
141-
android:layout_width="match_parent"
142-
android:layout_height="wrap_content"
143-
android:layout_alignParentBottom="true"
144-
android:text="ElasticLayout"
145-
android:textColor="#ffffff"
146-
android:textSize="18sp"
147-
android:gravity="end" />
124+
android:id="@+id/elasticlayout"
125+
android:layout_width="match_parent"
126+
android:layout_height="80dp"
127+
app:layout_backgroundColor="#30354b"
128+
app:layout_duration="500"
129+
app:layout_scale="0.85">
130+
131+
<TextView
132+
android:id="@+id/textView0"
133+
android:layout_width="match_parent"
134+
android:layout_height="wrap_content"
135+
android:text="This is"
136+
android:textColor="#ffffff"
137+
android:textSize="18sp" />
138+
139+
<TextView
140+
android:layout_below="@+id/textView1"
141+
android:layout_width="match_parent"
142+
android:layout_height="wrap_content"
143+
android:layout_alignParentBottom="true"
144+
android:text="ElasticLayout"
145+
android:textColor="#ffffff"
146+
android:textSize="18sp"
147+
android:gravity="end" />
148148
</com.skydoves.elasticviews.ElasticLayout>
149149
```
150150

151151
### ElasticAnmimation
152-
ElasticAnimation lets we can implement elastic animation on all of the views. <br>
152+
ElasticAnimation implements elastic animations for android views or view groups. <br>
153153
```java
154154
new ElasticAnimation(clickedView).setScaleX(0.9f).setScaleY(0.9f).setDuration(400)
155155
.setOnFinishListener(onFinishListener).doAction();
156156
```
157-
or we can set ViewPropertyAnimatorListener using setListener method and detect animation start and end.
157+
158+
#### ViewPropertyAnimatorListener
159+
we can set `ViewPropertyAnimatorListener` using `setListener` method and detect animation's status.
158160
```java
159161
.setListener(new ViewPropertyAnimatorListener() {
160-
@Override
161-
public void onAnimationStart(View view) {
162-
}
163-
164-
@Override
165-
public void onAnimationEnd(View view) {
166-
finishListener.onFinished();
167-
}
168-
169-
@Override
170-
public void onAnimationCancel(View view) {
171-
}
162+
@Override
163+
public void onAnimationStart(View view) {
164+
// do something
165+
}
166+
167+
Override
168+
public void onAnimationEnd(View view) {
169+
finishListener.onFinished();
170+
}
171+
172+
Override
173+
public void onAnimationCancel(View view) {
174+
// do something
175+
}
172176
});
173177
```
174178

175179
#### Kotlin Extension
176180
ElasticAnimation supports kotlin extension `elasticAnimation`.
177181
```kotlin
178182
val anim = textView.elasticAnimation(0.8f, 0.8f, 400, object: ElasticFinishListener {
179-
override fun onFinished() {
180-
// do anything
181-
}
182-
})
183+
override fun onFinished() {
184+
// do anything
185+
}
186+
})
183187
anim.doAction()
184188
```
185189

190+
#### Kotlin dsl
191+
```kotlin
192+
elasticAnimation(this) {
193+
setDuration(duration)
194+
setScaleX(scale)
195+
setScaleY(scale)
196+
setOnFinishListener(object : ElasticFinishListener {
197+
override fun onFinished() {
198+
onClick()
199+
}
200+
})
201+
}.doAction()
202+
```
203+
186204
#### Example : Normal Button
187205
we can implement animation on all of the views like below.
188206
```java

0 commit comments

Comments
 (0)