├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── github
│ │ └── yanjiabin
│ │ └── extenddialog
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── yanjiabin
│ │ │ └── extenddialog
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable
│ │ └── shape_red.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── dialog.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── github
│ └── yanjiabin
│ └── extenddialog
│ └── ExampleUnitTest.java
├── build.gradle
├── extendsdialoglib
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── github
│ │ └── yanjiabin
│ │ └── extendsdialoglib
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── yanjiabin
│ │ │ └── extendsdialoglib
│ │ │ ├── DialogViewHolder.java
│ │ │ └── ExtendsDialog.java
│ └── res
│ │ ├── anim
│ │ ├── dialog_in_bottom.xml
│ │ ├── dialog_in_left.xml
│ │ ├── dialog_in_right.xml
│ │ ├── dialog_in_top.xml
│ │ ├── dialog_out_bottom.xml
│ │ ├── dialog_out_left.xml
│ │ ├── dialog_out_right.xml
│ │ ├── dialog_out_top.xml
│ │ ├── scale_dialog_in_anim.xml
│ │ ├── scale_dialog_out_anim.xml
│ │ ├── slide_in.xml
│ │ └── slide_out.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── github
│ └── yanjiabin
│ └── extendsdialoglib
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── 帮助文档.md
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
11 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # ExtendDialog
3 | 一款实用起来比较方便的dialog工具.
4 | # ExtendsDialog 使用方式
5 | ## 添加依赖
6 | 1.在project目录的build.gradle的allprojects节点添加
7 | ```java maven { url "https://jitpack.io" }```
8 | 如下:
9 | ```java
10 | allprojects {
11 | repositories {
12 | jcenter()
13 | maven { url "https://jitpack.io" }
14 | }
15 | }
16 | ```
17 | 2.在自己Modul的build.gradle中添加```compile 'com.github.yanjiabin:ExtendDialog:1.0''```
18 | 如下:
19 | ```java
20 | dependencies {
21 | compile 'com.github.yanjiabin:ExtendDialog:1.0'
22 | }
23 | ```
24 | ## 开始使用
25 | * 准备好自己的dialog布局文件 例如 ```R.layout.dialog```
26 | ```java
27 | ExtendsDialog mExtendsDialog = new ExtendsDialog(this, R.layout.dialog) {
28 | @Override
29 | public void convert(DialogViewHolder holder) {
30 | //holder有很多操作布局方法 自己点进去看源码
31 | holder.setText()
32 | }
33 | };
34 | mExtendsDialog.fromBottom().backgroundLight(0.2).fullWidth().showDialog();
35 | ```
36 | * ExtendsDialog的API:
37 | ```java
38 | showDialog() 显示dialog
39 | dismiss() dismiss dialog
40 | backgroundLight(double light) 弹出时背景亮度 值为0.0~1.0 1.0表示全黑 0.0表示全白
41 | fromBottomToMiddle() 从底部一直弹到中间
42 | fromBottom() 从底部弹出 显示在底部
43 | fromLeftToMiddle() 从左边一直弹到中间退出也是到左边
44 | fromRightToMiddle() 从右边一直弹到中间退出也是到右边
45 | fromTop() 从顶部弹出 从顶部弹出 保持在顶部
46 | fromTopToMiddle() 从顶部谈到中间 从顶部弹出 保持在中间
47 | showDialog( int style) 显示一个Dialog自定义一个弹出方式 具体怎么写 可以模仿上面的
48 | showDialog(boolean isAnimation) 如果为true 就显示默认的一个缩放动画
49 | fullScreen() 全屏显示
50 | fullWidth() 全屏宽度
51 | fullHeight() 全屏高度
52 | setWidthAndHeight(int width, int height) 自定义宽高
53 | setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) 当dialog弹出是 按键的点击事件会被dialog获取
54 | setDialogDismissListener(OnDismissListener listener) 设置dismiss监听
55 | setOnCancelListener(OnCancelListener listener) 设置取消监听
56 | setCancelAble(boolean cancel) 设置能否被取消
57 | setCanceledOnTouchOutside(boolean cancel) 设置点击其他地方能否被取消
58 | setViewVisibleOrNot(int id,boolean isShow) true表示要显示该空间false表示要隐藏该控件
59 | setImageRes(int viewId, int imageRes) 设置本地的图片资源给控件
60 | ```
61 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.3"
6 | defaultConfig {
7 | applicationId "com.github.yanjiabin.extenddialog"
8 | minSdkVersion 16
9 | targetSdkVersion 25
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 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.+'
28 | testCompile 'junit:junit:4.12'
29 | compile 'com.github.yanjiabin:ExtendDialog:1.0'
30 | }
31 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\MeiY\AppData\Local\Android\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 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/github/yanjiabin/extenddialog/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.github.yanjiabin.extenddialog;
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 Testing documentation
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.github.yanjiabin.extenddialog", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/github/yanjiabin/extenddialog/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.github.yanjiabin.extenddialog;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 |
7 | import com.github.yanjiabin.extendsdialoglib.DialogViewHolder;
8 | import com.github.yanjiabin.extendsdialoglib.ExtendsDialog;
9 |
10 | public class MainActivity extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_main);
16 | }
17 |
18 | public void clickme(View view) {
19 | ExtendsDialog extendsDialog = new ExtendsDialog(this,R.layout.dialog) {
20 | @Override
21 | public void convert(DialogViewHolder holder) {
22 |
23 | }
24 | }.setCanceledOnTouchOutside(true).fullWidth().showDialog();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_red.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ExtendDialog
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/github/yanjiabin/extenddialog/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.github.yanjiabin.extenddialog;
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 Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
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.3.3'
9 | // NOTE: Do not place your application dependencies here; they belong
10 | // in the individual module build.gradle files
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | jcenter()
17 | maven { url "https://jitpack.io" }
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/extendsdialoglib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/extendsdialoglib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.3"
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 |
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.3.1'
30 | testCompile 'junit:junit:4.12'
31 | }
32 |
--------------------------------------------------------------------------------
/extendsdialoglib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\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 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/androidTest/java/com/github/yanjiabin/extendsdialoglib/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.github.yanjiabin.extendsdialoglib;
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 Testing documentation
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.github.yanjiabin.extendsdialoglib.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/java/com/github/yanjiabin/extendsdialoglib/DialogViewHolder.java:
--------------------------------------------------------------------------------
1 | package com.github.yanjiabin.extendsdialoglib;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.Drawable;
5 | import android.util.SparseArray;
6 | import android.view.View;
7 | import android.view.View.OnClickListener;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | public class DialogViewHolder {
12 | private final SparseArray mViews;
13 | private View mDialogView;
14 |
15 | private DialogViewHolder(Context context, int layoutId) {
16 | this.mViews = new SparseArray();
17 | mDialogView = View.inflate(context, layoutId, null);
18 | }
19 |
20 | public static DialogViewHolder get(Context context, int layoutId) {
21 | return new DialogViewHolder(context, layoutId);
22 | }
23 |
24 | public View getConvertView() {
25 | return mDialogView;
26 |
27 | }
28 |
29 | /**
30 | * Set the string for TextView
31 | *
32 | * @param viewId
33 | * @param text
34 | * @return
35 | */
36 | public DialogViewHolder setText(int viewId, CharSequence text) {
37 | TextView view = getView(viewId);
38 | view.setText(text);
39 | return this;
40 | }
41 |
42 |
43 | /**
44 | * 设置给本地的图片资源给imageview
45 | * @param viewId
46 | * @param imageRes
47 | * @return
48 | */
49 | public DialogViewHolder setImageRes(int viewId, int imageRes) {
50 | ImageView image = getView(viewId);
51 | image.setImageResource(imageRes);
52 | return this;
53 | }
54 |
55 | /**
56 | *
57 | * @param viewId imageview 的id
58 | * @param drawable 要给imageview设置的drawable
59 | * @return
60 | */
61 | public DialogViewHolder setImageDrawable(int viewId, Drawable drawable) {
62 | ImageView image = getView(viewId);
63 | image.setImageDrawable(drawable);
64 | return this;
65 | }
66 |
67 | /**
68 | * set view visible
69 | *
70 | * @param viewId
71 | * @return true 表示的是要显示控件 如果传入的是false的话就要隐藏
72 | */
73 | public DialogViewHolder setViewViSibleOrNot(int viewId,boolean isShow) {
74 | TextView view = getView(viewId);
75 | view.setVisibility(isShow ? View.VISIBLE : View.INVISIBLE);
76 | return this;
77 | }
78 |
79 | /**
80 | * set view INVISIBLE
81 | * @param viewId
82 | * @return
83 | */
84 | public DialogViewHolder setViewInVisiable(int viewId) {
85 | TextView view = getView(viewId);
86 | view.setVisibility(View.INVISIBLE);
87 | return this;
88 | }
89 |
90 | /**
91 | * 设置点击
92 | */
93 | public DialogViewHolder setOnClick(int viewId, OnClickListener onClick) {
94 | View view = getView(viewId);
95 | view.setOnClickListener(onClick);
96 | return this;
97 | }
98 |
99 | /**
100 | * Through control the Id of the access to control, if not join views
101 | *
102 | * @param viewId
103 | * @return
104 | */
105 |
106 | public T getView(int viewId) {
107 | View view = mViews.get(viewId);
108 | if (view == null) {
109 | view = mDialogView.findViewById(viewId);
110 | mViews.put(viewId, view);
111 | }
112 | return (T) view;
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/java/com/github/yanjiabin/extendsdialoglib/ExtendsDialog.java:
--------------------------------------------------------------------------------
1 | package com.github.yanjiabin.extendsdialoglib;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.AlertDialog;
5 | import android.app.Dialog;
6 | import android.content.Context;
7 | import android.content.DialogInterface;
8 | import android.content.DialogInterface.OnCancelListener;
9 | import android.content.DialogInterface.OnDismissListener;
10 | import android.support.annotation.StyleRes;
11 | import android.view.Gravity;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.view.Window;
15 | import android.view.WindowManager;
16 |
17 |
18 | public abstract class ExtendsDialog {
19 | private Dialog mDialog;
20 | private Window mDialogWindow;
21 | private DialogViewHolder dilaogVh;
22 | private View mRootView;
23 |
24 |
25 | public ExtendsDialog(Context context, int layoutId) {
26 | dilaogVh = DialogViewHolder.get(context, layoutId);
27 | mRootView = dilaogVh.getConvertView();
28 | mDialog = new Dialog(context, R.style.dialog);
29 |
30 | mDialog.setContentView(mRootView);
31 | mDialogWindow = mDialog.getWindow();
32 | convert(dilaogVh);
33 | }
34 | /**B
35 | * 把弹出框view holder传出去
36 | */
37 | public abstract void convert(DialogViewHolder holder);
38 |
39 | public static AlertDialog.Builder creatNormalDialogBuilder(Context context, String title, String message) {
40 | return new AlertDialog.Builder(context)
41 | .setTitle(title)
42 | .setMessage(message);
43 | }
44 |
45 | /**
46 | * 显示dialog
47 | */
48 | public ExtendsDialog showDialog() {
49 | if (mDialog != null && !mDialog.isShowing()) {
50 | mDialog.show();
51 | }
52 | return this;
53 | }
54 |
55 | /**
56 | *
57 | * @param light 弹出时背景亮度 值为0.0~1.0 1.0表示全黑 0.0表示全白
58 | * @return
59 | */
60 | public ExtendsDialog backgroundLight(double light) {
61 | if (light < 0.0 || light > 1.0)
62 | return this;
63 | WindowManager.LayoutParams lp = mDialogWindow.getAttributes();
64 | lp.dimAmount = (float) light;
65 | mDialogWindow.setAttributes(lp);
66 | return this;
67 | }
68 |
69 | /**
70 | * 从底部一直弹到中间
71 | */
72 | @SuppressLint("NewApi")
73 | public ExtendsDialog fromBottomToMiddle() {
74 | mDialogWindow.setWindowAnimations(R.style.window_bottom_in_bottom_out);
75 | return this;
76 | }
77 |
78 | /**
79 | * 从底部弹出
80 | */
81 | public ExtendsDialog fromBottom() {
82 | fromBottomToMiddle();
83 | mDialogWindow.setGravity(Gravity.CENTER | Gravity.BOTTOM);
84 | return this;
85 | }
86 |
87 | /**
88 | * 从左边一直弹到中间退出也是到左边
89 | */
90 | public ExtendsDialog fromLeftToMiddle() {
91 | mDialogWindow.setWindowAnimations(R.style.window_left_in_left_out);
92 | mDialogWindow.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
93 | mDialogWindow.setGravity(Gravity.CENTER | Gravity.LEFT);
94 | return this;
95 | }
96 |
97 | /**
98 | * 从右边一直弹到中间退出也是到右边
99 | * @return
100 | */
101 | public ExtendsDialog fromRightToMiddle() {
102 | mDialogWindow.setWindowAnimations(R.style.window_right_in_right_out);
103 | mDialogWindow.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
104 | mDialogWindow.setGravity(Gravity.RIGHT);
105 | //
106 | return this;
107 | }
108 |
109 | /**
110 | * 从顶部弹出 从顶部弹出 保持在顶部
111 | * @return
112 | */
113 | public ExtendsDialog fromTop() {
114 | fromTopToMiddle();
115 | mDialogWindow.setGravity(Gravity.CENTER | Gravity.TOP);
116 | return this;
117 | }
118 |
119 | /**
120 | * 从顶部谈到中间 从顶部弹出 保持在中间
121 | * @return
122 | */
123 | public ExtendsDialog fromTopToMiddle() {
124 | mDialogWindow.setWindowAnimations(R.style.window_top_in_top_out);
125 | mDialogWindow.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
126 | return this;
127 | }
128 | /**
129 | *
130 | * @param style 显示一个Dialog自定义一个弹出方式 具体怎么写 可以模仿上面的
131 | * @return
132 | */
133 | public ExtendsDialog showDialog(@StyleRes int style) {
134 | mDialogWindow.setWindowAnimations(style);
135 | mDialog.show();
136 | return this;
137 | }
138 |
139 | /**
140 | *
141 | * @param isAnimation 如果为true 就显示默认的一个缩放动画
142 | * @return
143 | */
144 | public ExtendsDialog showDialog(boolean isAnimation) {
145 | mDialogWindow.setWindowAnimations(R.style.dialog_scale_animstyle);
146 | mDialog.show();
147 | return this;
148 | }
149 |
150 | /**
151 | * 全屏显示
152 | */
153 | public ExtendsDialog fullScreen() {
154 | WindowManager.LayoutParams wl = mDialogWindow.getAttributes();
155 | wl.height = ViewGroup.LayoutParams.MATCH_PARENT;
156 | wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
157 | mDialog.onWindowAttributesChanged(wl);
158 | return this;
159 | }
160 |
161 |
162 | public ExtendsDialog setOnKeyListener(DialogInterface.OnKeyListener onKeyListener){
163 | mDialog.setOnKeyListener(onKeyListener);
164 | return this;
165 | }
166 | /**
167 | * 全屏宽度
168 | */
169 | public ExtendsDialog fullWidth() {
170 | WindowManager.LayoutParams wl = mDialogWindow.getAttributes();
171 | wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
172 | mDialog.onWindowAttributesChanged(wl);
173 | return this;
174 | }
175 |
176 | /**
177 | * 全屏高度
178 | */
179 | public ExtendsDialog fullHeight() {
180 | WindowManager.LayoutParams wl = mDialogWindow.getAttributes();
181 | wl.height = ViewGroup.LayoutParams.MATCH_PARENT;
182 | mDialog.onWindowAttributesChanged(wl);
183 | return this;
184 | }
185 |
186 | /**
187 | *
188 | * @param width 自定义的宽度
189 | * @param height 自定义的高度
190 | * @return
191 | */
192 | public ExtendsDialog setWidthAndHeight(int width, int height) {
193 | WindowManager.LayoutParams wl = mDialogWindow.getAttributes();
194 | wl.width = width;
195 | wl.height = height;
196 | mDialog.onWindowAttributesChanged(wl);
197 | return this;
198 | }
199 |
200 | /**
201 | * cancel dialog
202 | */
203 | public void cancelDialog() {
204 | if (mDialog != null && mDialog.isShowing())
205 | dismiss();
206 | }
207 |
208 | /**
209 | * cancel dialog
210 | */
211 | public void dismiss() {
212 | if (mDialog != null && mDialog.isShowing()) {
213 | mDialog.dismiss();
214 | }
215 | }
216 | /**
217 | * 设置监听
218 | */
219 | public ExtendsDialog setDialogDismissListener(OnDismissListener listener) {
220 | mDialog.setOnDismissListener(listener);
221 | return this;
222 | }
223 |
224 | /**
225 | * 设置监听
226 | */
227 | public ExtendsDialog setOnCancelListener(OnCancelListener listener) {
228 | mDialog.setOnCancelListener(listener);
229 | return this;
230 | }
231 |
232 | /**
233 | * 设置是否能取消
234 | */
235 | public ExtendsDialog setCancelAble(boolean cancel) {
236 | mDialog.setCancelable(cancel);
237 | return this;
238 | }
239 |
240 |
241 |
242 | /**
243 | * 设置触摸其他地方是否能取消
244 | */
245 | public ExtendsDialog setCanceledOnTouchOutside(boolean cancel) {
246 | mDialog.setCanceledOnTouchOutside(cancel);
247 | return this;
248 | }
249 |
250 | }
251 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/dialog_in_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/dialog_in_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/dialog_in_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/dialog_in_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/dialog_out_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/dialog_out_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/dialog_out_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/dialog_out_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/scale_dialog_in_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
22 |
23 |
32 |
33 |
38 |
39 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/scale_dialog_out_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/slide_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/anim/slide_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/extendsdialoglib/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/extendsdialoglib/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/extendsdialoglib/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/extendsdialoglib/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/extendsdialoglib/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #00000000
7 |
8 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ExtendsDialogLib
3 |
4 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
16 |
29 |
30 |
34 |
35 |
36 |
37 |
38 |
42 |
43 |
47 |
48 |
52 |
56 |
57 |
61 |
62 |
66 |
67 |
--------------------------------------------------------------------------------
/extendsdialoglib/src/test/java/com/github/yanjiabin/extendsdialoglib/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.github.yanjiabin.extendsdialoglib;
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 Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yanjiabin/ExtendDialog/3734ed8025de74c7e971fc3e8d0fbfd9cc81064c/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jul 07 09:25:27 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
7 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
8 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 |
15 | set DIRNAME=%~dp0
16 | if "%DIRNAME%" == "" set DIRNAME=.
17 | set APP_BASE_NAME=%~n0
18 | set APP_HOME=%DIRNAME%
19 |
20 | @rem Find java.exe
21 | if defined JAVA_HOME goto findJavaFromJavaHome
22 |
23 | set JAVA_EXE=java.exe
24 | %JAVA_EXE% -version >NUL 2>&1
25 | if "%ERRORLEVEL%" == "0" goto init
26 |
27 | echo.
28 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
29 | echo.
30 | echo Please set the JAVA_HOME variable in your environment to match the
31 | echo location of your Java installation.
32 |
33 | goto fail
34 |
35 | :findJavaFromJavaHome
36 | set JAVA_HOME=%JAVA_HOME:"=%
37 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
38 |
39 | if exist "%JAVA_EXE%" goto init
40 |
41 | echo.
42 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
43 | echo.
44 | echo Please set the JAVA_HOME variable in your environment to match the
45 | echo location of your Java installation.
46 |
47 | goto fail
48 |
49 | :init
50 | @rem Get command-line arguments, handling Windowz variants
51 |
52 | if not "%OS%" == "Windows_NT" goto win9xME_args
53 | if "%@eval[2+2]" == "4" goto 4NT_args
54 |
55 | :win9xME_args
56 | @rem Slurp the command line arguments.
57 | set CMD_LINE_ARGS=
58 | set _SKIP=2
59 |
60 | :win9xME_args_slurp
61 | if "x%~1" == "x" goto execute
62 |
63 | set CMD_LINE_ARGS=%*
64 | goto execute
65 |
66 | :4NT_args
67 | @rem Get arguments from the 4NT Shell from JP Software
68 | set CMD_LINE_ARGS=%$
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 | @rem Execute Gradle
76 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
77 |
78 | :end
79 | @rem End local scope for the variables with windows NT shell
80 | if "%ERRORLEVEL%"=="0" goto mainEnd
81 |
82 | :fail
83 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
84 | rem the _cmd.exe /c_ return code!
85 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
86 | exit /b 1
87 |
88 | :mainEnd
89 | if "%OS%"=="Windows_NT" endlocal
90 |
91 | :omega
92 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':extendsdialoglib'
2 |
--------------------------------------------------------------------------------
/帮助文档.md:
--------------------------------------------------------------------------------
1 | # ExtendDialog
2 | 一款实用起来比较方便的dialog工具.
3 | # ExtendsDialog 使用方式
4 | ## 添加依赖
5 | 1.在project目录的build.gradle的allprojects节点添加
6 | ```java maven { url "https://jitpack.io" }```
7 | 如下:
8 | ```java
9 | allprojects {
10 | repositories {
11 | jcenter()
12 | maven { url "https://jitpack.io" }
13 | }
14 | }
15 | ```
16 | 2.在自己Modul的build.gradle中添加```compile 'com.github.yanjiabin:ExtendDialog:1.0''```
17 | 如下:
18 | ```java
19 | dependencies {
20 | compile 'com.github.yanjiabin:ExtendDialog:1.0'
21 | }
22 | ```
23 | ## 开始使用
24 | * 准备好自己的dialog布局文件 例如 ```R.layout.dialog```
25 | ```java
26 | ExtendsDialog mExtendsDialog = new ExtendsDialog(this, R.layout.dialog) {
27 | @Override
28 | public void convert(DialogViewHolder holder) {
29 | //holder有很多操作布局方法 自己点进去看源码
30 | holder.setText()
31 | }
32 | };
33 | mExtendsDialog.fromBottom().backgroundLight(0.2).fullWidth().showDialog();
34 | ```
35 | * ExtendsDialog的API:
36 | ```java
37 | showDialog() 显示dialog
38 | dismiss() dismiss dialog
39 | backgroundLight(double light) 弹出时背景亮度 值为0.0~1.0 1.0表示全黑 0.0表示全白
40 | fromBottomToMiddle() 从底部一直弹到中间
41 | fromBottom() 从底部弹出 显示在底部
42 | fromLeftToMiddle() 从左边一直弹到中间退出也是到左边
43 | fromRightToMiddle() 从右边一直弹到中间退出也是到右边
44 | fromTop() 从顶部弹出 从顶部弹出 保持在顶部
45 | fromTopToMiddle() 从顶部谈到中间 从顶部弹出 保持在中间
46 | showDialog( int style) 显示一个Dialog自定义一个弹出方式 具体怎么写 可以模仿上面的
47 | showDialog(boolean isAnimation) 如果为true 就显示默认的一个缩放动画
48 | fullScreen() 全屏显示
49 | fullWidth() 全屏宽度
50 | fullHeight() 全屏高度
51 | setWidthAndHeight(int width, int height) 自定义宽高
52 | setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) 当dialog弹出是 按键的点击事件会被dialog获取
53 | setDialogDismissListener(OnDismissListener listener) 设置dismiss监听
54 | setOnCancelListener(OnCancelListener listener) 设置取消监听
55 | setCancelAble(boolean cancel) 设置能否被取消
56 | setCanceledOnTouchOutside(boolean cancel) 设置点击其他地方能否被取消
57 | setViewVisibleOrNot(int id,boolean isShow) true表示要显示该空间false表示要隐藏该控件
58 | setImageRes(int viewId, int imageRes) 设置本地的图片资源给控件
59 | ```
60 |
--------------------------------------------------------------------------------