Skip to content

Commit

Permalink
Merge pull request #9 from ozgurg/dev
Browse files Browse the repository at this point in the history
release: v2.2.0
  • Loading branch information
ozgurg authored Jul 15, 2022
2 parents 8fff377 + 1ab5e22 commit 4a47421
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 2 deletions.
Binary file added .github/preview/sharp/SoundOnOff.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencyResolutionManagement {
```gradle
// App level build.gradle
dependencies {
implementation "com.github.ozgurg:ToggleIconView:2.1.1"
implementation "com.github.ozgurg:ToggleIconView:2.2.0"
}
```

Expand Down Expand Up @@ -86,6 +86,7 @@ _All icons have the same duration and interpolator, but I manually capture their
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/rounded/PlayPause.gif) | [Rounded] PlayPause<br />`og.android.lib.toggleiconview.rounded.PlayPause` |
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/PlayPause.gif) | [Sharp] PlayPause<br />`og.android.lib.toggleiconview.sharp.PlayPause` |
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/rounded/SoundOnOff.gif) | [Rounded] SoundOnOff<br />`og.android.lib.toggleiconview.rounded.SoundOnOff` |
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/SoundOnOff.gif) | [Sharp] SoundOnOff<br />`og.android.lib.toggleiconview.sharp.SoundOnOff` |
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/FlashOnOff.gif) | [Sharp] FlashOnOff<br />`og.android.lib.toggleiconview.sharp.FlashOnOff` |

## How I create my own icon?
Expand Down
2 changes: 1 addition & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ afterEvaluate {

groupId = "com.github.ozgurg"
artifactId = "toggle-icon-view"
version = "2.1.1"
version = "2.2.0"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package og.android.lib.toggleiconview.sharp

import android.content.Context
import android.util.AttributeSet
import og.android.lib.toggleiconview.R
import og.android.lib.toggleiconview.ToggleIconView

class SoundOnOff @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) :
ToggleIconView(
context, attrs, defStyleAttr,
R.drawable.sharp_sound_on_to_off,
R.drawable.sharp_sound_off_to_on
)
45 changes: 45 additions & 0 deletions lib/src/main/res/drawable/sharp_sound_off_to_on.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="path"
android:fillColor="@android:color/black"
android:pathData="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z" />
<clip-path
android:name="mask"
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" />
<path
android:fillColor="@android:color/black"
android:pathData="M 3 9 L 3 15 L 7 15 L 12 20 L 12 4 L 7 9 L 3 9 Z M 16.5 12 C 16.5 10.23 15.48 8.71 14 7.97 L 14 16.02 C 15.48 15.29 16.5 13.77 16.5 12 Z M 14 3.23 L 14 5.29 C 16.89 6.15 19 8.83 19 12 C 19 15.17 16.89 17.85 14 18.71 L 14 20.77 C 18.01 19.86 21 16.28 21 12 C 21 7.72 18.01 4.14 14 3.23 Z" />
</vector>
</aapt:attr>

<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:propertyName="pathData"
android:valueFrom="M 19.73 22 L 21 20.73 L 3.27 3 L 2 4.27 Z"
android:valueTo="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z"
android:valueType="pathType" />
</aapt:attr>
</target>

<target android:name="mask">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:propertyName="pathData"
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"
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"
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
45 changes: 45 additions & 0 deletions lib/src/main/res/drawable/sharp_sound_on_to_off.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="path"
android:fillColor="@android:color/black"
android:pathData="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z" />
<clip-path
android:name="mask"
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" />
<path
android:fillColor="@android:color/black"
android:pathData="M 3 9 L 3 15 L 7 15 L 12 20 L 12 4 L 7 9 L 3 9 Z M 16.5 12 C 16.5 10.23 15.48 8.71 14 7.97 L 14 16.02 C 15.48 15.29 16.5 13.77 16.5 12 Z M 14 3.23 L 14 5.29 C 16.89 6.15 19 8.83 19 12 C 19 15.17 16.89 17.85 14 18.71 L 14 20.77 C 18.01 19.86 21 16.28 21 12 C 21 7.72 18.01 4.14 14 3.23 Z" />
</vector>
</aapt:attr>

<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:propertyName="pathData"
android:valueFrom="M 2 4.27 L 3.27 3 L 3.27 3 L 2 4.27 Z"
android:valueTo="M 19.73 22 L 21 20.73 L 3.27 3 L 2 4.27 Z"
android:valueType="pathType" />
</aapt:attr>
</target>

<target android:name="mask">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:propertyName="pathData"
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"
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"
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
10 changes: 10 additions & 0 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
android:layout_height="0dp"
android:layout_weight="1" />

<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="1dp" />

<include
layout="@layout/demo_sharp_sound_on_off"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />

<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="4dp" />
Expand Down
57 changes: 57 additions & 0 deletions sample/src/main/res/layout/demo_sharp_sound_on_off.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="Sharp: Sound On/Off"
android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textStyle="bold" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">

<og.android.lib.toggleiconview.sharp.SoundOnOff
android:id="@+id/muteUnmute24"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="#f00" />

<com.google.android.material.divider.MaterialDivider
android:layout_width="1dp"
android:layout_height="64dp"
android:layout_marginHorizontal="24dp" />

<og.android.lib.toggleiconview.sharp.SoundOnOff
android:id="@+id/muteUnmute48"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="#000"
app:checked="true" />

<com.google.android.material.divider.MaterialDivider
android:layout_width="1dp"
android:layout_height="64dp"
android:layout_marginHorizontal="24dp" />

<og.android.lib.toggleiconview.sharp.SoundOnOff
android:id="@+id/muteUnmute96"
android:layout_width="96dp"
android:layout_height="96dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:tint="#00f" />
</LinearLayout>
</LinearLayout>

0 comments on commit 4a47421

Please sign in to comment.