Skip to content

Commit

Permalink
updated sample
Browse files Browse the repository at this point in the history
  • Loading branch information
zagum committed Jan 9, 2017
1 parent 22411d9 commit 3667d68
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,19 @@ Usage
-----
Set icon (vector or image) to SwitchIconView and enjoy switchable icon in your app :)

Default implementation:

```xml
<com.github.zagum.switchicon.SwitchIconView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:si_image="@drawable/ic_cloud"/>
```
Use app:si_tint_color to set color to your icon. Default color is black;

Fully customized implementation:

```xml
<com.github.zagum.switchicon.SwitchIconView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
app:si_animation_duration="500"
app:si_disabled_alpha=".3"
app:si_image="@drawable/ic_cloud"
app:si_padding="8dp"
app:si_tint_color="#ff3c00"/>
app:si_disabled_alpha=".5"
app:si_tint_color="#ff3c00"
app:srcCompat="@drawable/ic_cloud"/>
```

Public methods:
Expand Down
2 changes: 2 additions & 0 deletions switchicon-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ android {
targetSdkVersion 25
versionCode 1
versionName "1.0"

vectorDrawables.useSupportLibrary = true
}
}
13 changes: 7 additions & 6 deletions switchicon-sample/src/main/res/layout/activity_sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="8dp"
app:si_animation_duration="500"
app:si_disabled_alpha=".5"
app:si_image="@drawable/ic_cloud"
app:si_padding="8dp"
app:si_tint_color="#ff3c00"/>
app:si_tint_color="#ff3c00"
app:srcCompat="@drawable/ic_cloud"/>

<TextView
android:id="@+id/textView2"
Expand All @@ -46,9 +46,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:si_image="@drawable/ic_timer"
app:si_padding="8dp"
app:si_tint_color="#7956f9"/>
android:padding="8dp"
android:scaleType="fitXY"
app:si_tint_color="#7956f9"
app:srcCompat="@drawable/ic_timer"/>

<TextView
android:layout_width="wrap_content"
Expand Down

0 comments on commit 3667d68

Please sign in to comment.