Skip to content

Commit 73cfeb4

Browse files
author
hupei
committed
init
0 parents  commit 73cfeb4

Some content is hidden

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

67 files changed

+2538
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.iml
2+
.idea
3+
.gradle
4+
/local.properties
5+
/.idea/workspace.xml
6+
/.idea/libraries
7+
.DS_Store
8+
/build
9+
/captures
10+
.externalNativeBuild

app/.gitignore

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

app/build.gradle

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "23.0.3"
6+
defaultConfig {
7+
applicationId "com.mylhyl.circledialog.sample"
8+
minSdkVersion 16
9+
targetSdkVersion 23
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
productFlavors {
21+
}
22+
}
23+
24+
dependencies {
25+
compile fileTree(include: ['*.jar'], dir: 'libs')
26+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27+
exclude group: 'com.android.support', module: 'support-annotations'
28+
})
29+
compile 'com.android.support:appcompat-v7:23.4.0'
30+
testCompile 'junit:junit:4.12'
31+
compile project(':circledialog')
32+
}

app/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 E:\android\android-sdk-windows/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,26 @@
1+
package com.mylhyl.circledialog.sample;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumentation test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.mylhyl.circledialog.sample", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.mylhyl.circledialog.sample">
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+
</application>
19+
20+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
package com.mylhyl.circledialog.sample;
2+
3+
import android.graphics.Color;
4+
import android.os.Bundle;
5+
import android.os.Handler;
6+
import android.support.v4.app.DialogFragment;
7+
import android.support.v7.app.AppCompatActivity;
8+
import android.view.View;
9+
import android.widget.AdapterView;
10+
import android.widget.ArrayAdapter;
11+
import android.widget.ListView;
12+
import android.widget.Toast;
13+
14+
import com.mylhyl.circledialog.CircleDialog;
15+
import com.mylhyl.circledialog.callback.ConfigButton;
16+
import com.mylhyl.circledialog.callback.ConfigDialog;
17+
import com.mylhyl.circledialog.callback.ConfigText;
18+
import com.mylhyl.circledialog.callback.ConfigTitle;
19+
import com.mylhyl.circledialog.params.ButtonParams;
20+
import com.mylhyl.circledialog.params.DialogParams;
21+
import com.mylhyl.circledialog.params.TextParams;
22+
import com.mylhyl.circledialog.params.TitleParams;
23+
24+
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
25+
26+
@Override
27+
protected void onCreate(Bundle savedInstanceState) {
28+
super.onCreate(savedInstanceState);
29+
setContentView(R.layout.activity_main);
30+
ListView listView = (ListView) findViewById(R.id.listView);
31+
listView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1
32+
, new String[]{"提示框", "确定框", "换头像", "消息框", "输入框", "进度框", "动态改变内容", "动态改变items"}));
33+
listView.setOnItemClickListener(this);
34+
}
35+
36+
@Override
37+
public void onItemClick(final AdapterView<?> parent, View view, int position, long id) {
38+
switch (position) {
39+
case 0:
40+
new CircleDialog.Builder(this)
41+
.setTitle("标题")
42+
.setText("提示框")
43+
.setPositive("确定", null)
44+
.show();
45+
break;
46+
case 1:
47+
new CircleDialog.Builder(this)
48+
.setCanceledOnTouchOutside(false)
49+
.setCancelable(false)
50+
.setTitle("标题")
51+
.setText("确定框")
52+
.setNegative("取消", null)
53+
.setPositive("确定", new View.OnClickListener() {
54+
@Override
55+
public void onClick(View v) {
56+
Toast.makeText(MainActivity.this, "确定", Toast.LENGTH_SHORT).show();
57+
}
58+
})
59+
.show();
60+
break;
61+
case 2:
62+
final String[] items = {"拍照", "从相册选择", "小视频"};
63+
// List<People> items = new ArrayList<>();
64+
// items.add(new People(1, "拍照"));
65+
// items.add(new People(2, "从相册选择"));
66+
// items.add(new People(3, "小视频"));
67+
68+
new CircleDialog.Builder(this)
69+
.configDialog(new ConfigDialog() {
70+
@Override
71+
public void onConfig(DialogParams params) {
72+
params.animStyle = R.style.dialogWindowAnim;
73+
}
74+
})
75+
.setTitle("标题")
76+
.setTitleColor(Color.BLUE)
77+
.setItems(items, new AdapterView.OnItemClickListener() {
78+
@Override
79+
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
80+
81+
}
82+
})
83+
.setNegative("取消", null)
84+
.configNegative(new ConfigButton() {
85+
@Override
86+
public void onConfig(ButtonParams params) {
87+
params.textColor = Color.RED;
88+
}
89+
})
90+
.show();
91+
break;
92+
case 3:
93+
final DialogFragment dialogFragment = new CircleDialog.Builder(this)
94+
.setCanceledOnTouchOutside(false)
95+
.setCancelable(false)
96+
.setText("消息框")
97+
.setTextColor(Color.BLACK)
98+
.configText(new ConfigText() {
99+
@Override
100+
public void onConfig(TextParams params) {
101+
params.height = 300;
102+
params.textSize = 70;
103+
}
104+
})
105+
.show();
106+
107+
new Handler().postDelayed(new Runnable() {
108+
@Override
109+
public void run() {
110+
dialogFragment.dismiss();
111+
}
112+
}, 5000);
113+
break;
114+
}
115+
}
116+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android">
3+
<scale
4+
android:interpolator="@android:anim/accelerate_interpolator"
5+
android:fromXScale="1.0"
6+
android:toXScale="1.0"
7+
android:fromYScale="0.0"
8+
android:toYScale="1.0"
9+
android:pivotX="0%"
10+
android:pivotY="100%"
11+
android:fillAfter="false"
12+
android:duration="400"/>
13+
</set>
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android">
3+
<scale
4+
android:interpolator="@android:anim/accelerate_interpolator"
5+
android:fromXScale="1.0"
6+
android:toXScale="1.0"
7+
android:fromYScale="1.0"
8+
android:toYScale="0.0"
9+
android:pivotX="0%"
10+
android:pivotY="100%"
11+
android:fillAfter="false"
12+
android:duration="400"/>
13+
</set>
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:id="@+id/activity_main"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
android:paddingBottom="@dimen/activity_vertical_margin"
9+
android:paddingLeft="@dimen/activity_horizontal_margin"
10+
android:paddingRight="@dimen/activity_horizontal_margin"
11+
android:paddingTop="@dimen/activity_vertical_margin"
12+
tools:context="com.mylhyl.circledialog.sample.MainActivity">
13+
14+
<ListView
15+
android:id="@+id/listView"
16+
android:layout_width="match_parent"
17+
android:layout_height="match_parent"/>
18+
</RelativeLayout>
3.34 KB
Loading
2.15 KB
Loading
4.73 KB
Loading
7.54 KB
Loading
10.2 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>

app/src/main/res/values/colors.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#3F51B5</color>
4+
<color name="colorPrimaryDark">#303F9F</color>
5+
<color name="colorAccent">#FF4081</color>
6+
</resources>

app/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>

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

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">CircleDialog</string>
3+
</resources>

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

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<resources>
2+
3+
<!-- Base application theme. -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light">
5+
<!-- Customize your theme here. -->
6+
<item name="colorPrimary">@color/colorPrimary</item>
7+
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8+
<item name="colorAccent">@color/colorAccent</item>
9+
</style>
10+
<style name="dialogWindowAnim" parent="android:Animation" mce_bogus="1">
11+
<item name="android:windowEnterAnimation">@anim/dialog_enter_anim</item>
12+
<item name="android:windowExitAnimation">@anim/dialog_exit_anim</item>
13+
</style>
14+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.mylhyl.circledialog.sample;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11+
*/
12+
public class ExampleUnitTest {
13+
@Test
14+
public void addition_isCorrect() throws Exception {
15+
assertEquals(4, 2 + 2);
16+
}
17+
}

build.gradle

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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:2.2.3'
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+
}
20+
21+
task clean(type: Delete) {
22+
delete rootProject.buildDir
23+
}

circledialog/.gitignore

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

circledialog/build.gradle

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 23
5+
buildToolsVersion "23.0.3"
6+
defaultConfig {
7+
minSdkVersion 16
8+
targetSdkVersion 23
9+
versionCode 1
10+
versionName "1.0"
11+
}
12+
buildTypes {
13+
release {
14+
minifyEnabled false
15+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
16+
}
17+
}
18+
productFlavors {
19+
}
20+
}
21+
22+
dependencies {
23+
compile 'com.android.support:appcompat-v7:23.4.0'
24+
}

0 commit comments

Comments
 (0)