Skip to content

Commit 5438f5d

Browse files
authored
Merge pull request #10 from ozgurg/dev
release: v2.3.0
2 parents 4a47421 + ffa99f5 commit 5438f5d

25 files changed

+902
-72
lines changed
76.4 KB
Loading

.github/sample.gif

96.3 KB
Loading

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencyResolutionManagement {
3939
```gradle
4040
// App level build.gradle
4141
dependencies {
42-
implementation "com.github.ozgurg:ToggleIconView:2.2.0"
42+
implementation "com.github.ozgurg:ToggleIconView:2.3.0"
4343
}
4444
```
4545

@@ -73,21 +73,22 @@ anything you can with `AppCompatImageView`.
7373

7474
### Events
7575

76-
| Event | Description |
77-
|------------------------------------------------------------------------|----------------------------------------------------|
76+
| Event | Description |
77+
|------------------------------------------------------------------------|-----------------------------------------------------|
7878
| `onCheckedChanged(toggleIconView: ToggleIconView, isChecked: Boolean)` | Triggers when the checked state of the icon changed |
7979

8080
## Built-in icons
8181

8282
_All icons have the same duration and interpolator, but I manually capture their previews; so timings may look different._
8383

84-
| Preview | Package |
85-
|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
86-
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/rounded/PlayPause.gif) | [Rounded] PlayPause<br />`og.android.lib.toggleiconview.rounded.PlayPause` |
87-
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/PlayPause.gif) | [Sharp] PlayPause<br />`og.android.lib.toggleiconview.sharp.PlayPause` |
88-
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/rounded/SoundOnOff.gif) | [Rounded] SoundOnOff<br />`og.android.lib.toggleiconview.rounded.SoundOnOff` |
89-
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/SoundOnOff.gif) | [Sharp] SoundOnOff<br />`og.android.lib.toggleiconview.sharp.SoundOnOff` |
90-
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/FlashOnOff.gif) | [Sharp] FlashOnOff<br />`og.android.lib.toggleiconview.sharp.FlashOnOff` |
84+
| Preview | Package |
85+
|-----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
86+
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/rounded/PlayPause.gif) | [Rounded] PlayPause<br />`og.android.lib.toggleiconview.rounded.PlayPause` |
87+
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/PlayPause.gif) | [Sharp] PlayPause<br />`og.android.lib.toggleiconview.sharp.PlayPause` |
88+
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/rounded/SoundOnOff.gif) | [Rounded] SoundOnOff<br />`og.android.lib.toggleiconview.rounded.SoundOnOff` |
89+
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/SoundOnOff.gif) | [Sharp] SoundOnOff<br />`og.android.lib.toggleiconview.sharp.SoundOnOff` |
90+
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/FlashOnOff.gif) | [Sharp] FlashOnOff<br />`og.android.lib.toggleiconview.sharp.FlashOnOff` |
91+
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/AirplaneModeOnOff.gif) | [Sharp] AirplaneModeOnOff<br />`og.android.lib.toggleiconview.sharp.AirplaneModeOnOff` |
9192

9293
## How I create my own icon?
9394

lib/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ afterEvaluate {
3939

4040
groupId = "com.github.ozgurg"
4141
artifactId = "toggle-icon-view"
42-
version = "2.2.0"
42+
version = "2.3.0"
4343
}
4444
}
4545
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package og.android.lib.toggleiconview.sharp
2+
3+
import android.content.Context
4+
import android.util.AttributeSet
5+
import og.android.lib.toggleiconview.R
6+
import og.android.lib.toggleiconview.ToggleIconView
7+
8+
class AirplaneModeOnOff @JvmOverloads constructor(
9+
context: Context,
10+
attrs: AttributeSet? = null,
11+
defStyleAttr: Int = 0
12+
) :
13+
ToggleIconView(
14+
context, attrs, defStyleAttr,
15+
R.drawable.sharp_airplanemode_on_to_off,
16+
R.drawable.sharp_airplanemode_off_to_on
17+
)

lib/src/main/res/drawable/rounded_sound_off_to_on.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
android:viewportWidth="24"
88
android:viewportHeight="24">
99
<path
10-
android:name="path"
10+
android:name="strike"
1111
android:fillColor="@android:color/black"
1212
android:pathData="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z" />
1313
<clip-path
@@ -19,7 +19,7 @@
1919
</vector>
2020
</aapt:attr>
2121

22-
<target android:name="path">
22+
<target android:name="strike">
2323
<aapt:attr name="android:animation">
2424
<objectAnimator
2525
android:duration="@android:integer/config_shortAnimTime"

lib/src/main/res/drawable/rounded_sound_on_to_off.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
android:viewportWidth="24"
88
android:viewportHeight="24">
99
<path
10-
android:name="path"
10+
android:name="strike"
1111
android:fillColor="@android:color/black"
1212
android:pathData="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z" />
1313
<clip-path
@@ -19,7 +19,7 @@
1919
</vector>
2020
</aapt:attr>
2121

22-
<target android:name="path">
22+
<target android:name="strike">
2323
<aapt:attr name="android:animation">
2424
<objectAnimator
2525
android:duration="@android:integer/config_shortAnimTime"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt">
3+
<aapt:attr name="android:drawable">
4+
<vector
5+
android:width="24dp"
6+
android:height="24dp"
7+
android:viewportWidth="24"
8+
android:viewportHeight="24">
9+
<path
10+
android:name="strike"
11+
android:fillColor="@android:color/black"
12+
android:pathData="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z" />
13+
<clip-path
14+
android:name="mask"
15+
android:pathData="M 0 0 L 24 0 L 24 24 L 0 24 L 0 0 Z M 4.54 1.73 L 3.27 3 L 3.27 3 L 4.54 1.73 Z" />
16+
<path
17+
android:fillColor="@android:color/black"
18+
android:pathData="M 22 16 L 22 14 L 13.5 9 L 13.5 3.5 C 13.5 2.67 12.83 2 12 2 C 11.17 2 10.5 2.67 10.5 3.5 L 10.5 9 L 2 14 L 2 16 L 10.5 13.5 L 10.5 19 L 8 20.5 L 8 22 L 12 21 L 16 22 L 16 20.5 L 13.5 19 L 13.5 13.5 L 22 16 Z" />
19+
</vector>
20+
</aapt:attr>
21+
22+
<target android:name="strike">
23+
<aapt:attr name="android:animation">
24+
<objectAnimator
25+
android:duration="@android:integer/config_shortAnimTime"
26+
android:interpolator="@android:interpolator/fast_out_slow_in"
27+
android:propertyName="pathData"
28+
android:valueFrom="M 19.73 22 L 21 20.73 L 3.27 3 L 2 4.27 Z"
29+
android:valueTo="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z"
30+
android:valueType="pathType" />
31+
</aapt:attr>
32+
</target>
33+
34+
<target android:name="mask">
35+
<aapt:attr name="android:animation">
36+
<objectAnimator
37+
android:duration="@android:integer/config_shortAnimTime"
38+
android:interpolator="@android:interpolator/fast_out_slow_in"
39+
android:propertyName="pathData"
40+
android:valueFrom="M 0 0 L 24 0 L 24 24 L 0 24 L 0 0 Z M 4.54 1.73 L 3.27 3 L 21 20.73 L 22.27 19.46 Z"
41+
android:valueTo="M 0 0 L 24 0 L 24 24 L 0 24 L 0 0 Z M 4.54 1.73 L 3.27 3 L 3.27 3 L 4.54 1.73 Z"
42+
android:valueType="pathType" />
43+
</aapt:attr>
44+
</target>
45+
</animated-vector>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt">
3+
<aapt:attr name="android:drawable">
4+
<vector
5+
android:width="24dp"
6+
android:height="24dp"
7+
android:viewportWidth="24"
8+
android:viewportHeight="24">
9+
<path
10+
android:name="strike"
11+
android:fillColor="@android:color/black"
12+
android:pathData="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z" />
13+
<clip-path
14+
android:name="mask"
15+
android:pathData="M 0 0 L 24 0 L 24 24 L 0 24 L 0 0 Z M 4.54 1.73 L 3.27 3 L 3.27 3 L 4.54 1.73 Z" />
16+
<path
17+
android:fillColor="@android:color/black"
18+
android:pathData="M 22 16 L 22 14 L 13.5 9 L 13.5 3.5 C 13.5 2.67 12.83 2 12 2 C 11.17 2 10.5 2.67 10.5 3.5 L 10.5 9 L 2 14 L 2 16 L 10.5 13.5 L 10.5 19 L 8 20.5 L 8 22 L 12 21 L 16 22 L 16 20.5 L 13.5 19 L 13.5 13.5 L 22 16 Z" />
19+
</vector>
20+
</aapt:attr>
21+
22+
<target android:name="strike">
23+
<aapt:attr name="android:animation">
24+
<objectAnimator
25+
android:duration="@android:integer/config_shortAnimTime"
26+
android:interpolator="@android:interpolator/fast_out_slow_in"
27+
android:propertyName="pathData"
28+
android:valueFrom="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z"
29+
android:valueTo="M 19.73 22 L 21 20.73 L 3.27 3 L 2 4.27 Z"
30+
android:valueType="pathType" />
31+
</aapt:attr>
32+
</target>
33+
34+
<target android:name="mask">
35+
<aapt:attr name="android:animation">
36+
<objectAnimator
37+
android:duration="@android:integer/config_shortAnimTime"
38+
android:interpolator="@android:interpolator/fast_out_slow_in"
39+
android:propertyName="pathData"
40+
android:valueFrom="M 0 0 L 24 0 L 24 24 L 0 24 L 0 0 Z M 4.54 1.73 L 3.27 3 L 3.27 3 L 4.54 1.73 Z"
41+
android:valueTo="M 0 0 L 24 0 L 24 24 L 0 24 L 0 0 Z M 4.54 1.73 L 3.27 3 L 21 20.73 L 22.27 19.46 Z"
42+
android:valueType="pathType" />
43+
</aapt:attr>
44+
</target>
45+
</animated-vector>

lib/src/main/res/drawable/sharp_flash_off_to_on.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
<path
1010
android:name="strike"
1111
android:fillColor="@android:color/black"
12-
android:pathData="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z"
13-
android:strokeWidth="1" />
12+
android:pathData="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z" />
1413
<clip-path
1514
android:name="mask"
1615
android:pathData="M 0 0 L 24 0 L 24 24 L 0 24 L 0 0 Z M 4.54 1.73 L 3.27 3 L 3.27 3 L 4.54 1.73 Z" />
1716
<path
1817
android:fillColor="@android:color/black"
19-
android:pathData="M 7 2 L 7 13 L 10 13 L 10 22 L 17 10 L 13 10 L 17 2 Z"
20-
android:strokeWidth="1" />
18+
android:pathData="M 7 2 L 7 13 L 10 13 L 10 22 L 17 10 L 13 10 L 17 2 Z" />
2119
</vector>
2220
</aapt:attr>
2321

@@ -44,4 +42,4 @@
4442
android:valueType="pathType" />
4543
</aapt:attr>
4644
</target>
47-
</animated-vector>
45+
</animated-vector>

0 commit comments

Comments
 (0)