├── .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 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 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 |