Skip to content

Commit a8b40c2

Browse files
committed
first commit
0 parents  commit a8b40c2

File tree

32 files changed

+977
-0
lines changed

32 files changed

+977
-0
lines changed

.gitignore

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.gradle
2+
/local.properties
3+
/.idea/workspace.xml
4+
.DS_Store
5+
/build
6+
# built application files
7+
*.apk
8+
*.ap_
9+
10+
# files for the dex VM
11+
*.dex
12+
13+
# Java class files
14+
*.class
15+
.DS_Store
16+
17+
# generated files
18+
bin/
19+
gen/
20+
Wiki/
21+
22+
# Local configuration file (sdk path, etc)
23+
local.properties
24+
25+
# Eclipse project files
26+
.classpath
27+
.project
28+
.settings/
29+
30+
# Proguard folder generated by Eclipse
31+
proguard/
32+
33+
#Android Studio
34+
build/
35+
36+
# Intellij project files
37+
*.iml
38+
*.ipr
39+
*.iws
40+
.idea/
41+
42+
#gradle
43+
.gradle/

build.gradle

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
jcenter()
6+
}
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:1.1.0'
9+
10+
// NOTE: Do not place your application dependencies here; they belong
11+
// in the individual module build.gradle files
12+
}
13+
}
14+
15+
allprojects {
16+
repositories {
17+
jcenter()
18+
}
19+
}

demo/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

demo/build.gradle

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "23.0.0"
6+
7+
defaultConfig {
8+
applicationId "com.fenjuly.toggleexpandlayout"
9+
minSdkVersion 16
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 fileTree(dir: 'libs', include: ['*.jar'])
24+
compile 'com.android.support:appcompat-v7:23.0.0'
25+
compile 'com.kyleduo.switchbutton:library:1.2.9'
26+
compile project(':library')
27+
}

demo/proguard-rules.pro

+17
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 /Users/liurongchan/Development/Android/AndroidSDK/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+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.fenjuly.toggleexpandlayout;
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+
}

demo/src/main/AndroidManifest.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.fenjuly.toggleexpandlayout" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:theme="@style/AppTheme" >
10+
<activity
11+
android:name=".MainActivity"
12+
android:label="@string/app_name" >
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package com.fenjuly.toggleexpandlayout;
2+
3+
import android.annotation.TargetApi;
4+
import android.os.Bundle;
5+
import android.support.v7.app.ActionBarActivity;
6+
import android.view.View;
7+
import android.widget.CompoundButton;
8+
9+
import com.fenjuly.mylibrary.ToggleExpandLayout;
10+
import com.kyleduo.switchbutton.SwitchButton;
11+
12+
13+
public class MainActivity extends ActionBarActivity {
14+
15+
int count = 0;
16+
@Override
17+
@TargetApi(21)
18+
protected void onCreate(Bundle savedInstanceState) {
19+
super.onCreate(savedInstanceState);
20+
setContentView(R.layout.activity_main);
21+
final ToggleExpandLayout layout = (ToggleExpandLayout) findViewById(R.id.toogleLayout);
22+
SwitchButton switchButton = (SwitchButton) findViewById(R.id.switch_button);
23+
24+
layout.setOnToggleTouchListener(new ToggleExpandLayout.OnToggleTouchListener() {
25+
@Override
26+
public void onStartOpen() {
27+
}
28+
29+
@Override
30+
public void onOpen() {
31+
int childCount = layout.getChildCount();
32+
for(int i = 0; i < childCount; i++) {
33+
View view = layout.getChildAt(i);
34+
view.setElevation(dp2px(1));
35+
}
36+
}
37+
38+
@Override
39+
public void onStartClose() {
40+
int childCount = layout.getChildCount();
41+
for(int i = 0; i < childCount; i++) {
42+
View view = layout.getChildAt(i);
43+
view.setElevation(dp2px(i));
44+
}
45+
}
46+
47+
@Override
48+
public void onClosed() {
49+
50+
}
51+
});
52+
53+
switchButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
54+
@Override
55+
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
56+
if (isChecked) {
57+
layout.open();
58+
} else {
59+
layout.close();
60+
}
61+
}
62+
});
63+
layout.setOnClickListener(new View.OnClickListener() {
64+
65+
@Override
66+
public void onClick(View v) {
67+
if (count % 2 == 0) {
68+
layout.open();
69+
} else {
70+
layout.close();
71+
}
72+
count++;
73+
}
74+
});
75+
76+
}
77+
78+
public float dp2px(float dp) {
79+
final float scale = getResources().getDisplayMetrics().density;
80+
return dp * scale + 0.5f;
81+
}
82+
}
+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:background="#aebec5"
7+
tools:context=".MainActivity"
8+
>
9+
10+
<com.fenjuly.mylibrary.ToggleExpandLayout
11+
android:id="@+id/toogleLayout"
12+
android:layout_marginTop="15dp"
13+
android:layout_marginLeft="15dp"
14+
android:layout_width="match_parent"
15+
android:layout_height="match_parent"
16+
>
17+
18+
<LinearLayout
19+
android:id="@+id/id2"
20+
android:layout_width="300dp"
21+
android:layout_height="80dp"
22+
android:background="#ffffff"
23+
android:elevation="2dp"
24+
android:outlineProvider="bounds"
25+
>
26+
<RelativeLayout
27+
android:layout_width="match_parent"
28+
android:layout_height="match_parent"
29+
>
30+
<TextView
31+
android:id="@+id/first_menu"
32+
android:layout_width="wrap_content"
33+
android:layout_height="wrap_content"
34+
android:layout_marginTop="8dp"
35+
android:layout_marginLeft="8dp"
36+
android:text="Set date"
37+
/>
38+
<TextView
39+
android:layout_below="@+id/first_menu"
40+
android:layout_marginTop="4dp"
41+
android:layout_marginLeft="8dp"
42+
android:layout_width="wrap_content"
43+
android:layout_height="wrap_content"
44+
android:text="23 August 2015"
45+
android:textColor="#cccccc"/>
46+
</RelativeLayout>
47+
48+
</LinearLayout>
49+
50+
<LinearLayout
51+
android:id="@+id/id3"
52+
android:layout_width="300dp"
53+
android:layout_height="80dp"
54+
android:background="#ffffff"
55+
android:elevation="3dp"
56+
android:outlineProvider="bounds"
57+
>
58+
<RelativeLayout
59+
android:layout_width="match_parent"
60+
android:layout_height="match_parent"
61+
>
62+
<TextView
63+
android:id="@+id/second_menu"
64+
android:layout_width="wrap_content"
65+
android:layout_height="wrap_content"
66+
android:layout_marginTop="8dp"
67+
android:layout_marginLeft="8dp"
68+
android:text="Set time"
69+
/>
70+
<TextView
71+
android:layout_below="@+id/second_menu"
72+
android:layout_marginTop="4dp"
73+
android:layout_marginLeft="8dp"
74+
android:layout_width="wrap_content"
75+
android:layout_height="wrap_content"
76+
android:text="15:47"
77+
android:textColor="#cccccc"/>
78+
</RelativeLayout>
79+
80+
</LinearLayout>
81+
82+
<LinearLayout
83+
android:id="@+id/id4"
84+
android:layout_width="300dp"
85+
android:layout_height="80dp"
86+
android:background="#ffffff"
87+
android:elevation="4dp"
88+
android:outlineProvider="bounds"
89+
>
90+
<RelativeLayout
91+
android:layout_width="match_parent"
92+
android:layout_height="match_parent"
93+
>
94+
<TextView
95+
android:id="@+id/menu"
96+
android:layout_width="wrap_content"
97+
android:layout_height="wrap_content"
98+
android:layout_marginTop="8dp"
99+
android:layout_marginLeft="8dp"
100+
android:text="Automatic date and time"
101+
/>
102+
<TextView
103+
android:layout_below="@+id/menu"
104+
android:layout_marginTop="4dp"
105+
android:layout_marginLeft="8dp"
106+
android:layout_width="wrap_content"
107+
android:layout_height="wrap_content"
108+
android:text="Use network provide time"
109+
android:textColor="#cccccc"/>
110+
<com.kyleduo.switchbutton.SwitchButton
111+
android:id="@+id/switch_button"
112+
android:layout_alignParentRight="true"
113+
android:layout_marginRight="10dp"
114+
android:layout_width="wrap_content"
115+
android:layout_height="wrap_content"
116+
android:padding="16dp"
117+
style="@style/MD" />
118+
</RelativeLayout>
119+
</LinearLayout>
120+
121+
</com.fenjuly.mylibrary.ToggleExpandLayout>
122+
</RelativeLayout>

demo/src/main/res/menu/menu_main.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:app="http://schemas.android.com/apk/res-auto"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
tools:context=".MainActivity">
5+
<item android:id="@+id/action_settings"
6+
android:title="@string/action_settings"
7+
android:orderInCategory="100"
8+
app:showAsAction="never"/>
9+
</menu>
3.34 KB
Loading
2.15 KB
Loading
4.73 KB
Loading
7.54 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources>
2+
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
3+
(such as screen margins) for screens with more than 820dp of available width. This
4+
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
5+
<dimen name="activity_horizontal_margin">64dp</dimen>
6+
</resources>

demo/src/main/res/values/dimens.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<!-- Default screen margins, per the Android Design guidelines. -->
3+
<dimen name="activity_horizontal_margin">16dp</dimen>
4+
<dimen name="activity_vertical_margin">16dp</dimen>
5+
</resources>

demo/src/main/res/values/strings.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources>
2+
<string name="app_name">ToggleExpandLayout</string>
3+
4+
<string name="hello_world">Hello world!</string>
5+
<string name="action_settings">Settings</string>
6+
</resources>

demo/src/main/res/values/styles.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<resources>
2+
3+
<!-- Base application theme. -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5+
<!-- Customize your theme here. -->
6+
</style>
7+
8+
</resources>

0 commit comments

Comments
 (0)