Skip to content

Commit 91caef8

Browse files
committed
add demo
0 parents  commit 91caef8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2477
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures

.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "23.0.2"
6+
7+
defaultConfig {
8+
applicationId "ch.ielse.demo"
9+
minSdkVersion 10
10+
targetSdkVersion 23
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile 'com.android.support:appcompat-v7:23.3.0'
24+
compile 'com.android.support:design:23.3.0'
25+
compile project(':switchbutton')
26+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in D:\a_work\DevelopEnvironment\sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package ch.ielse.view;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest package="ch.ielse.demo"
3+
xmlns:android="http://schemas.android.com/apk/res/android">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:supportsRtl="true"
10+
android:theme="@style/AppTheme">
11+
<activity android:name=".MainActivity">
12+
<intent-filter>
13+
<action android:name="android.intent.action.MAIN"/>
14+
15+
<category android:name="android.intent.category.LAUNCHER"/>
16+
</intent-filter>
17+
</activity>
18+
<activity android:name=".APIIntroActivity"/>
19+
<activity android:name=".SizeIntroActivity"/>
20+
<activity android:name=".NormalActivity"/>
21+
<activity android:name=".ListActivity"/>
22+
<activity android:name=".RecyclerActivity"/>
23+
</application>
24+
25+
</manifest>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package ch.ielse.demo;
2+
3+
import android.os.Bundle;
4+
import android.support.v7.app.AppCompatActivity;
5+
import android.support.v7.widget.Toolbar;
6+
import android.view.View;
7+
8+
import ch.ielse.view.SwitchView;
9+
10+
public class APIIntroActivity extends AppCompatActivity {
11+
12+
@Override
13+
protected void onCreate(Bundle savedInstanceState) {
14+
super.onCreate(savedInstanceState);
15+
setContentView(R.layout.activity_api_intro);
16+
17+
((Toolbar) findViewById(R.id.toolbar)).setNavigationOnClickListener(new View.OnClickListener() {
18+
@Override
19+
public void onClick(View v) {
20+
APIIntroActivity.this.finish();
21+
}
22+
});
23+
24+
final SwitchView vSwitch1 = (SwitchView) findViewById(R.id.v_switch_1);
25+
findViewById(R.id.b_1_1).setOnClickListener(new View.OnClickListener() {
26+
@Override
27+
public void onClick(View v) {
28+
vSwitch1.setOpened(true);
29+
}
30+
});
31+
findViewById(R.id.b_1_2).setOnClickListener(new View.OnClickListener() {
32+
@Override
33+
public void onClick(View v) {
34+
vSwitch1.setOpened(false);
35+
}
36+
});
37+
findViewById(R.id.b_1_3).setOnClickListener(new View.OnClickListener() {
38+
@Override
39+
public void onClick(View v) {
40+
vSwitch1.toggleSwitch(true);
41+
}
42+
});
43+
44+
findViewById(R.id.b_1_4).setOnClickListener(new View.OnClickListener() {
45+
@Override
46+
public void onClick(View v) {
47+
vSwitch1.toggleSwitch(false);
48+
}
49+
});
50+
51+
final SwitchView vSwitch2 = (SwitchView) findViewById(R.id.v_switch_2);
52+
findViewById(R.id.b_2_1).setOnClickListener(new View.OnClickListener() {
53+
@Override
54+
public void onClick(View v) {
55+
vSwitch2.setShadow(true);
56+
}
57+
});
58+
findViewById(R.id.b_2_2).setOnClickListener(new View.OnClickListener() {
59+
@Override
60+
public void onClick(View v) {
61+
vSwitch2.setShadow(false);
62+
}
63+
});
64+
65+
final SwitchView vSwitch3 = (SwitchView) findViewById(R.id.v_switch_3);
66+
findViewById(R.id.b_3_1).setOnClickListener(new View.OnClickListener() {
67+
@Override
68+
public void onClick(View v) {
69+
vSwitch3.setColor(0xFF4FC3F7, 0x4FC3F7);
70+
}
71+
});
72+
findViewById(R.id.b_3_2).setOnClickListener(new View.OnClickListener() {
73+
@Override
74+
public void onClick(View v) {
75+
vSwitch3.setColor(0xFF546E7A, 0xFF455A64);
76+
}
77+
});
78+
findViewById(R.id.b_3_3).setOnClickListener(new View.OnClickListener() {
79+
@Override
80+
public void onClick(View v) {
81+
vSwitch3.setColor(0xFFFFC400, 0xFFFFAB00);
82+
}
83+
});
84+
}
85+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package ch.ielse.demo;
2+
3+
/**
4+
* Created by LY on 2016/9/13.
5+
*/
6+
public class ItemObject {
7+
String title;
8+
boolean isOpened;
9+
}

0 commit comments

Comments
 (0)