Permalink
Browse files

updated sample project

  • Loading branch information...
1 parent b3e5091 commit 2b2f2d7476540df8043a43c2758448ad3db4bf64 @zagum committed Jan 12, 2017
@@ -9,8 +9,10 @@
private SwitchIconView switchIcon1;
private SwitchIconView switchIcon2;
+ private SwitchIconView switchIcon3;
private View button1;
private View button2;
+ private View button3;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -19,8 +21,10 @@ protected void onCreate(Bundle savedInstanceState) {
switchIcon1 = (SwitchIconView) findViewById(R.id.switchIconView1);
switchIcon2 = (SwitchIconView) findViewById(R.id.switchIconView2);
+ switchIcon3 = (SwitchIconView) findViewById(R.id.switchIconView3);
button1 = findViewById(R.id.button1);
button2 = findViewById(R.id.button2);
+ button3 = findViewById(R.id.button3);
button1.setOnClickListener(new View.OnClickListener() {
@Override
@@ -32,7 +36,12 @@ public void onClick(View v) {
@Override
public void onClick(View v) {
switchIcon2.switchState();
- switchIcon1.setIconEnabled(!switchIcon1.isIconEnabled());
+ }
+ });
+ button3.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ switchIcon3.switchState();
}
});
}
@@ -0,0 +1,12 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp"
+ android:height="32dp"
+ android:viewportHeight="24.0"
+ android:viewportWidth="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
+</vector>
@@ -21,8 +21,10 @@
android:padding="8dp"
app:si_animation_duration="500"
app:si_disabled_alpha=".5"
- app:si_tint_color="#ff3c00"
+ app:si_disabled_color="#b7b7b7"
app:si_enabled="false"
+ app:si_no_dash="true"
+ app:si_tint_color="#ff3c00"
app:srcCompat="@drawable/ic_cloud"/>
<TextView
@@ -59,4 +61,33 @@
</LinearLayout>
+ <LinearLayout
+ android:id="@+id/button3"
+ android:orientation="vertical"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_marginLeft="24dp"
+ android:background="?selectableItemBackgroundBorderless"
+ android:gravity="center">
+
+ <com.github.zagum.switchicon.SwitchIconView
+ android:id="@+id/switchIconView3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:padding="8dp"
+ app:si_disabled_alpha=".5"
+ app:si_disabled_color="#dadada"
+ app:si_enabled="false"
+ app:si_tint_color="#ffb700"
+ app:srcCompat="@drawable/ic_camera"/>
+
+ <TextView
+ android:id="@+id/textView3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/camera"/>
+
+ </LinearLayout>
+
</LinearLayout>
@@ -2,4 +2,5 @@
<string name="app_name">SwitchIconView</string>
<string name="sync">Sync</string>
<string name="alarm">Alarm</string>
+ <string name="camera">Camera</string>
</resources>

0 comments on commit 2b2f2d7

Please sign in to comment.