Skip to content

Commit

Permalink
Merge pull request #15 from ozgurg/dev
Browse files Browse the repository at this point in the history
release: v3.1.0
  • Loading branch information
ozgurg authored May 17, 2023
2 parents 094a92d + 61641da commit 729d49f
Show file tree
Hide file tree
Showing 35 changed files with 193 additions and 40 deletions.
Binary file added .github/preview/sharp/CameraSwitch.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:3.0.2"
implementation "com.github.ozgurg:ToggleIconView:3.1.0"
}
```

Expand Down Expand Up @@ -101,6 +101,7 @@ _All icons have the same duration (`@android:integer/config_shortAnimTime`) and
| ![](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` |
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/AirplaneModeOnOff.gif) | [Sharp] AirplaneModeOnOff<br />`og.android.lib.toggleiconview.sharp.AirplaneModeOnOff` |
| ![](https://raw.githubusercontent.com/ozgurg/ToggleIconView/master/.github/preview/sharp/CameraSwitch.gif) | [Sharp] CameraSwitch<br />`og.android.lib.toggleiconview.sharp.CameraSwitch` |

## How do you create your custom icon?

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
id "com.android.application" version "7.3.0-rc01" apply false
id "com.android.library" version "7.3.0-rc01" apply false
id "com.android.application" version "8.0.1" apply false
id "com.android.library" version "8.0.1" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
}
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jul 11 06:04:39 TRT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
7 changes: 4 additions & 3 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
namespace "og.android.lib.toggleiconview"
}

dependencies {
implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.appcompat:appcompat:1.5.1"
implementation "androidx.core:core-ktx:1.9.0" // FIXME: Upgrading to 1.10.1 causes deprecated class error
implementation "androidx.appcompat:appcompat:1.6.1"
}

afterEvaluate {
Expand All @@ -39,7 +40,7 @@ afterEvaluate {

groupId = "com.github.ozgurg"
artifactId = "toggle-icon-view"
version = "3.0.2"
version = "3.1.0"
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions lib/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ abstract class ToggleIconView @JvmOverloads constructor(
open fun setOnCheckedChangeListener(listener: (view: ToggleIconView, isChecked: Boolean) -> Unit) {
mOnCheckedChangeListener = listener
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class PlayPause @JvmOverloads constructor(
context, attrs, defStyleAttr,
R.drawable.rounded_play_to_pause,
R.drawable.rounded_pause_to_play
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class SoundOnOff @JvmOverloads constructor(
context, attrs, defStyleAttr,
R.drawable.rounded_sound_on_to_off,
R.drawable.rounded_sound_off_to_on
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class AirplaneModeOnOff @JvmOverloads constructor(
context, attrs, defStyleAttr,
R.drawable.sharp_airplanemode_on_to_off,
R.drawable.sharp_airplanemode_off_to_on
)
)
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 CameraSwitch @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) :
ToggleIconView(
context, attrs, defStyleAttr,
R.drawable.camera_switch,
R.drawable.camera_switch
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class FlashOnOff @JvmOverloads constructor(
context, attrs, defStyleAttr,
R.drawable.sharp_flash_on_to_off,
R.drawable.sharp_flash_off_to_on
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class PlayPause @JvmOverloads constructor(
context, attrs, defStyleAttr,
R.drawable.sharp_play_to_pause,
R.drawable.sharp_pause_to_play
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class SoundOnOff @JvmOverloads constructor(
context, attrs, defStyleAttr,
R.drawable.sharp_sound_on_to_off,
R.drawable.sharp_sound_off_to_on
)
)
37 changes: 37 additions & 0 deletions lib/src/main/res/drawable/camera_switch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<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">
<group
android:name="group"
android:pivotX="12"
android:pivotY="12">
<path
android:fillColor="@android:color/black"
android:pathData="M 16 7 L 15 7 L 14 6 L 10 6 L 9 7 L 8 7 C 6.9 7 6 7.9 6 9 L 6 15 C 6 16.1 6.9 17 8 17 L 16 17 C 17.1 17 18 16.1 18 15 L 18 9 C 18 7.9 17.1 7 16 7 Z M 12 14 C 10.9 14 10 13.1 10 12 C 10 10.9 10.9 10 12 10 C 13.1 10 14 10.9 14 12 C 14 13.1 13.1 14 12 14 Z" />
<path
android:fillColor="@android:color/black"
android:pathData="M 8.57 0.51 L 13.05 4.99 L 13.05 2.04 C 17.77 2.51 21.53 6.27 22 10.99 C 22 10.99 24 10.99 24 10.99 C 23.34 3.02 15.49 -1.59 8.57 0.51 Z" />
<path
android:fillColor="@android:color/black"
android:pathData="M 10.95 21.96 C 6.23 21.49 2.47 17.73 2 13.01 C 2 13.01 0 13.01 0 13.01 C 0.66 20.98 8.51 25.59 15.43 23.49 L 10.95 19.01 L 10.95 21.96 Z" />
</group>
</vector>
</aapt:attr>

<target android:name="group">
<aapt:attr name="android:animation">
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:interpolator="@android:interpolator/fast_out_slow_in"
android:propertyName="rotation"
android:valueFrom="0"
android:valueTo="360"
android:valueType="floatType" />
</aapt:attr>
</target>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/rounded_pause_to_play.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
android:valueType="floatType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/rounded_play_to_pause.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
android:valueType="floatType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/rounded_sound_off_to_on.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/rounded_sound_on_to_off.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/sharp_airplanemode_off_to_on.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/sharp_airplanemode_on_to_off.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/sharp_flash_off_to_on.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/sharp_flash_on_to_off.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/sharp_pause_to_play.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
android:valueType="floatType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/sharp_play_to_pause.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
android:valueType="floatType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/sharp_sound_off_to_on.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/drawable/sharp_sound_on_to_off.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
android:valueType="pathType" />
</aapt:attr>
</target>
</animated-vector>
</animated-vector>
2 changes: 1 addition & 1 deletion lib/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
<attr name="checkedTooltipText" format="string" />
<attr name="uncheckedTooltipText" format="string" />
</declare-styleable>
</resources>
</resources>
7 changes: 4 additions & 3 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
namespace "og.android.sample.toggleiconview"
}

dependencies {
implementation "androidx.core:core-ktx:1.9.0"
implementation "com.google.android.material:material:1.6.1"
implementation "androidx.core:core-ktx:1.9.0" // FIXME: Upgrading to 1.10.1 causes deprecated class error
implementation "com.google.android.material:material:1.9.0"
implementation project(":lib")
}
}
5 changes: 2 additions & 3 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="og.android.sample.toggleiconview">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:icon="@drawable/ic_launcher"
android:label="ToggleIconView Sample"
Expand All @@ -14,4 +13,4 @@
</intent-filter>
</activity>
</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ class MainActivity : AppCompatActivity() {
}
}
}
}
}
34 changes: 33 additions & 1 deletion sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,37 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="24dp">

<TextView
style="@style/DemoPrimaryTitle"
android:text="Camera Switch" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">

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

<TextView
style="@style/DemoSecondaryTitle"
android:text="Sharp" />

<og.android.lib.toggleiconview.sharp.CameraSwitch style="@style/DemoIcon" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</ScrollView>
2 changes: 1 addition & 1 deletion sample/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
<item name="android:layout_height">48dp</item>
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
</style>
</resources>
</resources>
Loading

0 comments on commit 729d49f

Please sign in to comment.