* AppDialogConfig添加构造参数,简化自定义扩展用法

pull/27/head
Jenly 4 years ago
parent d3a759374c
commit dbfbac55de
  1. 119
      app-dialog/src/main/java/com/king/app/dialog/AppDialog.java
  2. 243
      app-dialog/src/main/java/com/king/app/dialog/AppDialogConfig.java
  3. 255
      app-dialog/src/main/java/com/king/app/dialog/BaseDialogConfig.java
  4. 35
      app-dialog/src/main/java/com/king/app/dialog/fragment/AppDialogFragment.java
  5. 5
      app-dialog/src/main/java/com/king/app/dialog/fragment/BaseDialogFragment.java
  6. BIN
      app/release/app-release.apk
  7. 1
      app/release/output.json
  8. 12
      app/src/main/java/com/king/appupdater/MainActivity.java

@ -3,13 +3,10 @@ package com.king.app.dialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import com.king.app.dialog.fragment.AppDialogFragment;
@ -34,53 +31,26 @@ public enum AppDialog {
//-------------------------------------------
/**
* 通过{@link AppDialogConfig} 创建一个视图
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @return
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public View createAppDialogView(@NonNull Context context,@NonNull AppDialogConfig config){
View view = config.getView(context);
TextView tvDialogTitle = view.findViewById(config.getTitleId());
setText(tvDialogTitle,config.getTitle());
tvDialogTitle.setVisibility(config.isHideTitle() ? View.GONE : View.VISIBLE);
TextView tvDialogContent = view.findViewById(config.getContentId());
setText(tvDialogContent,config.getContent());
Button btnDialogCancel = view.findViewById(config.getCancelId());
setText(btnDialogCancel,config.getCancel());
btnDialogCancel.setOnClickListener(config.getOnClickCancel() != null ? config.getOnClickCancel() : mOnClickDismissDialog);
btnDialogCancel.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
//不强制要求要有中间的线
View line = view.findViewById(config.getLineId());
if(line != null){
line.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
}
Button btnDialogOK = view.findViewById(config.getOkId());
setText(btnDialogOK,config.getOk());
btnDialogOK.setOnClickListener(config.getOnClickOk() != null ? config.getOnClickOk() : mOnClickDismissDialog);
return view;
return config.buildAppDialogView();
}
//-------------------------------------------
private View.OnClickListener mOnClickDismissDialog = new View.OnClickListener() {
View.OnClickListener mOnClickDismissDialog = new View.OnClickListener() {
@Override
public void onClick(View v) {
dismissDialog();
}
};
private void setText(TextView tv,CharSequence text){
if(!TextUtils.isEmpty(text)){
tv.setText(text);
}
}
//-------------------------------------------
public void dismissDialogFragment(FragmentManager fragmentManager){
@ -147,23 +117,45 @@ public enum AppDialog {
/**
* 显示弹框
* @param config 弹框配置 {@link AppDialogConfig}
*/
public void showDialog(AppDialogConfig config){
showDialog(config,true);
}
/**
* 显示弹框 请使用{@link #showDialog(AppDialogConfig)}
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public void showDialog(Context context,AppDialogConfig config){
showDialog(context,config,true);
showDialog(config,true);
}
/**
* 显示弹框
* 显示弹框请使用{@link #showDialog(AppDialogConfig, boolean)}
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消默认为truefalse则拦截back键
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public void showDialog(Context context,AppDialogConfig config,boolean isCancel){
showDialog(context,createAppDialogView(context,config),R.style.app_dialog,DEFAULT_WIDTH_RATIO,isCancel);
showDialog(config,isCancel);
}
/**
* 显示弹框
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消默认为truefalse则拦截back键
*/
public void showDialog(AppDialogConfig config,boolean isCancel){
showDialog(config.getContext(),config.buildAppDialogView(),config.getStyleId(),DEFAULT_WIDTH_RATIO,isCancel);
}
/**
* 显示弹框
* @param context
@ -208,24 +200,24 @@ public enum AppDialog {
* 显示弹框
* @param context
* @param contentView 弹框内容视图
* @param resId Dialog样式
* @param styleId Dialog样式
* @param widthRatio 宽度比例根据屏幕宽度计算得来
*/
public void showDialog(Context context, View contentView, @StyleRes int resId, float widthRatio){
showDialog(context,contentView,resId,widthRatio,true);
public void showDialog(Context context, View contentView, @StyleRes int styleId, float widthRatio){
showDialog(context,contentView,styleId,widthRatio,true);
}
/**
* 显示弹框
* @param context
* @param contentView 弹框内容视图
* @param resId Dialog样式
* @param styleId Dialog样式
* @param widthRatio 宽度比例根据屏幕宽度计算得来
* @param isCancel 是否可取消默认为truefalse则拦截back键
*/
public void showDialog(Context context, View contentView, @StyleRes int resId, float widthRatio,final boolean isCancel){
public void showDialog(Context context, View contentView, @StyleRes int styleId, float widthRatio,final boolean isCancel){
dismissDialog();
mDialog = createDialog(context,contentView,resId,widthRatio,isCancel);
mDialog = createDialog(context,contentView,styleId,widthRatio,isCancel);
mDialog.show();
}
@ -244,21 +236,42 @@ public enum AppDialog {
/**
* 创建弹框
* @param config 弹框配置 {@link AppDialogConfig}
*/
public Dialog createDialog(AppDialogConfig config){
return createDialog(config,true);
}
/**
* 创建弹框请使用{@link #createDialog(AppDialogConfig)}
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public Dialog createDialog(Context context,AppDialogConfig config){
return createDialog(context,config,true);
return createDialog(config,true);
}
/**
* 创建弹框
* 创建弹框请使用{@link #createDialog(AppDialogConfig, boolean)}
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消默认为truefalse则拦截back键
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public Dialog createDialog(Context context,AppDialogConfig config,boolean isCancel){
return createDialog(context,createAppDialogView(context,config),R.style.app_dialog,DEFAULT_WIDTH_RATIO,isCancel);
return createDialog(config,isCancel);
}
/**
* 创建弹框
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消默认为truefalse则拦截back键
*/
public Dialog createDialog(AppDialogConfig config,boolean isCancel){
return createDialog(config.getContext(),config.buildAppDialogView(),config.getStyleId(),DEFAULT_WIDTH_RATIO,isCancel);
}
/**
@ -305,23 +318,23 @@ public enum AppDialog {
* 创建弹框
* @param context
* @param contentView 弹框内容视图
* @param resId Dialog样式
* @param styleId Dialog样式
* @param widthRatio 宽度比例根据屏幕宽度计算得来
*/
public Dialog createDialog(Context context, View contentView, @StyleRes int resId, float widthRatio){
return createDialog(context,contentView,resId,widthRatio,true);
public Dialog createDialog(Context context, View contentView, @StyleRes int styleId, float widthRatio){
return createDialog(context,contentView,styleId,widthRatio,true);
}
/**
* 创建弹框
* @param context
* @param contentView 弹框内容视图
* @param resId Dialog样式
* @param styleId Dialog样式
* @param widthRatio 宽度比例根据屏幕宽度计算得来
* @param isCancel 是否可取消默认为truefalse则拦截back键
*/
public Dialog createDialog(Context context, View contentView, @StyleRes int resId, float widthRatio,final boolean isCancel){
Dialog dialog = new Dialog(context,resId);
public Dialog createDialog(Context context, View contentView, @StyleRes int styleId, float widthRatio,final boolean isCancel){
Dialog dialog = new Dialog(context,styleId);
dialog.setContentView(contentView);
dialog.setCanceledOnTouchOutside(false);
dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {

@ -1,221 +1,118 @@
package com.king.app.dialog;
import android.content.Context;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.IdRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
/**
* @author Jenly <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/
public class AppDialogConfig {
/**
* 布局ID
*/
private @LayoutRes int layoutId = R.layout.app_dialog;
/**
* 标题视图ID
*/
private @IdRes int titleId = R.id.tvDialogTitle;
/**
* 内容视图ID
*/
private @IdRes int contentId = R.id.tvDialogContent;
/**
* 取消视图ID左边按钮
*/
private @IdRes int cancelId = R.id.btnDialogCancel;
/**
* 确定视图ID右边按钮
*/
private @IdRes int okId = R.id.btnDialogOK;
/**
* 按钮中间分割线ID
*/
private @IdRes int lineId = R.id.line;
/**
* 标题文本
*/
private CharSequence title;
/**
* 内容文本
*/
private CharSequence content;
/**
* 取消按钮文本
*/
private CharSequence cancel;
/**
* 确定按钮文本
*/
private CharSequence ok;
/**
* 是否隐藏取消按钮如果隐藏取消则底部只显示一个按钮
*/
private boolean isHideCancel;
/**
* 是否隐藏标题
*/
private boolean isHideTitle;
public class AppDialogConfig extends BaseDialogConfig{
private View.OnClickListener onClickCancel;
private Context context;
private View.OnClickListener onClickOk;
private SparseArray<View> views;
private View view;
public @LayoutRes int getLayoutId() {
return layoutId;
}
public AppDialogConfig setLayoutId(@LayoutRes int layoutId) {
this.layoutId = layoutId;
return this;
}
public int getTitleId() {
return titleId;
}
public AppDialogConfig setTitleId(@IdRes int titleId) {
this.titleId = titleId;
return this;
}
public @IdRes int getContentId() {
return contentId;
}
public AppDialogConfig setContentId(@IdRes int contentId) {
this.contentId = contentId;
return this;
}
public @IdRes int getCancelId() {
return cancelId;
}
public AppDialogConfig setCancelId(@IdRes int cancelId) {
this.cancelId = cancelId;
return this;
}
public @IdRes int getOkId() {
return okId;
public AppDialogConfig(@NonNull Context context){
this(context,R.layout.app_dialog);
}
public AppDialogConfig setOkId(@IdRes int okId) {
this.okId = okId;
return this;
public AppDialogConfig(@NonNull Context context,@LayoutRes int layoutId){
super(layoutId);
this.context = context;
views = new SparseArray<>();
}
public @IdRes int getLineId() {
return lineId;
public Context getContext(){
return context;
}
public AppDialogConfig setLineId(@IdRes int lineId) {
this.lineId = lineId;
return this;
}
public CharSequence getTitle() {
return title;
}
public AppDialogConfig setTitle(CharSequence title) {
this.title = title;
return this;
}
public AppDialogConfig setTitle(@NonNull Context context,@StringRes int resId) {
this.title = context.getString(resId);
return this;
}
public CharSequence getContent() {
return content;
}
public AppDialogConfig setContent(CharSequence content) {
this.content = content;
return this;
}
public CharSequence getCancel() {
return cancel;
}
public AppDialogConfig setCancel(CharSequence cancel) {
this.cancel = cancel;
return this;
/**
* use {@link #getDialogView()}
* @param context
* @return
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public View getView(@NonNull Context context){
return getDialogView();
}
public AppDialogConfig setCancel(@NonNull Context context,@StringRes int resId) {
this.cancel = context.getString(resId);
return this;
public View getDialogView(){
if(view == null){
view = LayoutInflater.from(context).inflate(getLayoutId(),null);
}
return view;
}
public CharSequence getOk() {
return ok;
private <T extends View> T findView(@IdRes int id){
return (T)getDialogView().findViewById(id);
}
public AppDialogConfig setOk(CharSequence ok) {
this.ok = ok;
return this;
}
public <T extends View> T getView(@IdRes int id){
View v = views.get(id);
if(v == null){
v = findView(id);
views.put(id,v);
}
public AppDialogConfig setOk(@NonNull Context context,@StringRes int resId) {
this.ok = context.getString(resId);
return this;
return (T)v;
}
public boolean isHideCancel() {
return isHideCancel;
}
public AppDialogConfig setHideCancel(boolean hideCancel) {
isHideCancel = hideCancel;
return this;
}
/**
* 通过{@link AppDialogConfig} 创建一个视图
* @return
*/
View buildAppDialogView(){
TextView tvDialogTitle = getView(titleId);
if(tvDialogTitle != null){
setText(tvDialogTitle,title);
tvDialogTitle.setVisibility(isHideTitle ? View.GONE : View.VISIBLE);
}
public boolean isHideTitle(){
return isHideTitle;
}
TextView tvDialogContent = getView(contentId);
if(tvDialogContent != null){
setText(tvDialogContent,content);
}
public AppDialogConfig setHideTitle(boolean hideTitle){
isHideTitle = hideTitle;
return this;
}
Button btnDialogCancel = getView(cancelId);
if(btnDialogCancel != null){
setText(btnDialogCancel,cancel);
btnDialogCancel.setOnClickListener(onClickCancel != null ? onClickCancel : AppDialog.INSTANCE.mOnClickDismissDialog);
btnDialogCancel.setVisibility(isHideCancel ? View.GONE : View.VISIBLE);
}
public View.OnClickListener getOnClickCancel() {
return onClickCancel;
}
View line = getView(lineId);
if(line != null){
line.setVisibility(isHideCancel ? View.GONE : View.VISIBLE);
}
public AppDialogConfig setOnClickCancel(View.OnClickListener onClickCancel) {
this.onClickCancel = onClickCancel;
return this;
}
Button btnDialogOK = getView(okId);
if(btnDialogOK != null){
setText(btnDialogOK,ok);
btnDialogOK.setOnClickListener(onClickOk != null ? onClickOk : AppDialog.INSTANCE.mOnClickDismissDialog);
public View.OnClickListener getOnClickOk() {
return onClickOk;
}
}
public AppDialogConfig setOnClickOk(View.OnClickListener onClickOk) {
this.onClickOk = onClickOk;
return this;
return view;
}
public View getView(@NonNull Context context){
if(view == null){
view = LayoutInflater.from(context).inflate(layoutId,null);
private void setText(TextView tv, CharSequence text){
if(text != null){
tv.setText(text);
}
return view;
}
}

@ -0,0 +1,255 @@
package com.king.app.dialog;
import android.content.Context;
import android.view.View;
import androidx.annotation.IdRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;
/**
* @author <a href="mailto:jenly1314@gmail.com">Jenly</a>
*/
public class BaseDialogConfig {
/**
* 布局ID
*/
@LayoutRes
int layoutId;
/**
* 标题视图ID
*/
@IdRes
int titleId = R.id.tvDialogTitle;
/**
* 内容视图ID
*/
@IdRes int contentId = R.id.tvDialogContent;
/**
* 取消视图ID左边按钮
*/
@IdRes int cancelId = R.id.btnDialogCancel;
/**
* 确定视图ID右边按钮
*/
@IdRes int okId = R.id.btnDialogOK;
/**
* 按钮中间分割线ID
*/
@IdRes int lineId = R.id.line;
/**
* 样式ID
*/
@StyleRes
int styleId = R.style.app_dialog;
/**
* 标题文本
*/
CharSequence title;
/**
* 内容文本
*/
CharSequence content;
/**
* 取消按钮文本
*/
CharSequence cancel;
/**
* 确定按钮文本
*/
CharSequence ok;
/**
* 是否隐藏取消按钮如果隐藏取消则底部只显示一个按钮
*/
boolean isHideCancel;
/**
* 是否隐藏标题
*/
boolean isHideTitle;
View.OnClickListener onClickCancel;
View.OnClickListener onClickOk;
public BaseDialogConfig(){
this(R.layout.app_dialog);
}
public BaseDialogConfig(@LayoutRes int layoutId){
this.layoutId = layoutId;
}
public @LayoutRes int getLayoutId() {
return layoutId;
}
/**
* @param layoutId
* @return
* @deprecated 即将废弃下一个版本可能会移除此方法
*/
@Deprecated
public BaseDialogConfig setLayoutId(@IdRes int layoutId) {
this.layoutId = layoutId;
return this;
}
public int getTitleId() {
return titleId;
}
public BaseDialogConfig setTitleId(@IdRes int titleId) {
this.titleId = titleId;
return this;
}
public int getStyleId() {
return styleId;
}
public BaseDialogConfig setStyleId(@IdRes int styleId) {
this.styleId = styleId;
return this;
}
public @IdRes int getContentId() {
return contentId;
}
public BaseDialogConfig setContentId(@IdRes int contentId) {
this.contentId = contentId;
return this;
}
public @IdRes int getCancelId() {
return cancelId;
}
public BaseDialogConfig setCancelId(@IdRes int cancelId) {
this.cancelId = cancelId;
return this;
}
public @IdRes int getOkId() {
return okId;
}
public BaseDialogConfig setOkId(@IdRes int okId) {
this.okId = okId;
return this;
}
public @IdRes int getLineId() {
return lineId;
}
public BaseDialogConfig setLineId(@IdRes int lineId) {
this.lineId = lineId;
return this;
}
public CharSequence getTitle() {
return title;
}
public BaseDialogConfig setTitle(CharSequence title) {
this.title = title;
return this;
}
public BaseDialogConfig setTitle(@NonNull Context context, @StringRes int resId) {
this.title = context.getString(resId);
return this;
}
public CharSequence getContent() {
return content;
}
public BaseDialogConfig setContent(CharSequence content) {
this.content = content;
return this;
}
public CharSequence getCancel() {
return cancel;
}
public BaseDialogConfig setCancel(CharSequence cancel) {
this.cancel = cancel;
return this;
}
public BaseDialogConfig setCancel(@NonNull Context context, @StringRes int resId) {
this.cancel = context.getString(resId);
return this;
}
public CharSequence getOk() {
return ok;
}
public BaseDialogConfig setOk(CharSequence ok) {
this.ok = ok;
return this;
}
public BaseDialogConfig setOk(@NonNull Context context, @StringRes int resId) {
this.ok = context.getString(resId);
return this;
}
public boolean isHideCancel() {
return isHideCancel;
}
public BaseDialogConfig setHideCancel(boolean hideCancel) {
isHideCancel = hideCancel;
return this;
}
public boolean isHideTitle(){
return isHideTitle;
}
public BaseDialogConfig setHideTitle(boolean hideTitle){
isHideTitle = hideTitle;
return this;
}
public View.OnClickListener getOnClickCancel() {
return onClickCancel;
}
/**
* 设置取消按钮点击监听不设置默认点击关闭弹框
* @param onClickCancel
* @return
*/
public BaseDialogConfig setOnClickCancel(View.OnClickListener onClickCancel) {
this.onClickCancel = onClickCancel;
return this;
}
public View.OnClickListener getOnClickOk() {
return onClickOk;
}
/**
* 设置确定按钮点击监听不设置默认点击关闭弹框
* @param onClickOk
* @return
*/
public BaseDialogConfig setOnClickOk(View.OnClickListener onClickOk) {
this.onClickOk = onClickOk;
return this;
}
}

@ -5,7 +5,7 @@ import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.king.app.dialog.AppDialogConfig;
import com.king.app.dialog.BaseDialogConfig;
import com.king.app.dialog.R;
/**
@ -13,9 +13,9 @@ import com.king.app.dialog.R;
*/
public class AppDialogFragment extends BaseDialogFragment {
private AppDialogConfig config;
private BaseDialogConfig config;
public static AppDialogFragment newInstance(AppDialogConfig config) {
public static AppDialogFragment newInstance(BaseDialogConfig config) {
Bundle args = new Bundle();
AppDialogFragment fragment = new AppDialogFragment();
@ -33,29 +33,36 @@ public class AppDialogFragment extends BaseDialogFragment {
}
public void init(View rootView){
if(config!=null){
if(config != null){
TextView tvDialogTitle = rootView.findViewById(config.getTitleId());
setText(tvDialogTitle,config.getTitle());
tvDialogTitle.setVisibility(config.isHideTitle() ? View.GONE : View.VISIBLE);
if(tvDialogTitle != null){
setText(tvDialogTitle,config.getTitle());
tvDialogTitle.setVisibility(config.isHideTitle() ? View.GONE : View.VISIBLE);
}
TextView tvDialogContent = rootView.findViewById(config.getContentId());
setText(tvDialogContent,config.getContent());
if(tvDialogContent != null){
setText(tvDialogContent,config.getContent());
}
Button btnDialogCancel = rootView.findViewById(config.getCancelId());
setText(btnDialogCancel,config.getCancel());
btnDialogCancel.setOnClickListener(config.getOnClickCancel() != null ? config.getOnClickCancel() : getOnClickDismiss());
btnDialogCancel.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
if(btnDialogCancel != null){
setText(btnDialogCancel,config.getCancel());
btnDialogCancel.setOnClickListener(config.getOnClickCancel() != null ? config.getOnClickCancel() : getOnClickDismiss());
btnDialogCancel.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
}
//不强制要求要有中间的线
View line = rootView.findViewById(config.getLineId());
if(line != null){
line.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
}
Button btnDialogOK = rootView.findViewById(config.getOkId());
setText(btnDialogOK,config.getOk());
btnDialogOK.setOnClickListener(config.getOnClickOk() != null ? config.getOnClickOk() : getOnClickDismiss());
if(btnDialogOK != null){
setText(btnDialogOK,config.getOk());
btnDialogOK.setOnClickListener(config.getOnClickOk() != null ? config.getOnClickOk() : getOnClickDismiss());
}
}
}
}
}

@ -5,7 +5,6 @@ import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -59,7 +58,7 @@ public abstract class BaseDialogFragment extends DialogFragment {
}
protected void setText(TextView tv, CharSequence text){
if(!TextUtils.isEmpty(text)){
if(text != null){
tv.setText(text);
}
}
@ -79,4 +78,4 @@ public abstract class BaseDialogFragment extends DialogFragment {
public abstract void init(View rootView);
}
}

Binary file not shown.

@ -1 +0,0 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":16,"versionName":"1.0.9-androidx","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

@ -33,7 +33,8 @@ public class MainActivity extends AppCompatActivity {
private final Object mLock = new Object();
//下载出现Failed to connect to raw.githubusercontent.com时,可以换个下载链接测试,github的raw.githubusercontent.com目前不太稳定。
private String mUrl = "https://raw.githubusercontent.com/jenly1314/AppUpdater/master/app/release/app-release.apk";
// private String mUrl = "https://raw.githubusercontent.com/jenly1314/AppUpdater/master/app/release/app-release.apk";
private String mUrl = "https://gitlab.com/jenly1314/AppUpdater/-/raw/master/app/release/app-release.apk";
private ProgressBar progressBar;
@ -159,7 +160,7 @@ public class MainActivity extends AppCompatActivity {
* 简单弹框升级
*/
private void clickBtn4(){
AppDialogConfig config = new AppDialogConfig();
AppDialogConfig config = new AppDialogConfig(getContext());
config.setTitle("简单弹框升级")
.setOk("升级")
.setContent("1、新增某某功能、\n2、修改某某问题、\n3、优化某某BUG、")
@ -178,9 +179,8 @@ public class MainActivity extends AppCompatActivity {
* 简单自定义弹框升级
*/
private void clickBtn5(){
AppDialogConfig config = new AppDialogConfig();
config.setLayoutId(R.layout.dialog)
.setOk("升级")
AppDialogConfig config = new AppDialogConfig(getContext(),R.layout.dialog);
config.setOk("升级")
.setHideCancel(true)
.setTitle("简单自定义弹框升级")
.setContent("1、新增某某功能、\n2、修改某某问题、\n3、优化某某BUG、")
@ -241,7 +241,7 @@ public class MainActivity extends AppCompatActivity {
* 简单DialogFragment升级
*/
private void clickBtn7(){
AppDialogConfig config = new AppDialogConfig();
AppDialogConfig config = new AppDialogConfig(getContext());
config.setTitle("简单DialogFragment升级")
.setOk("升级")
.setContent("1、新增某某功能、\n2、修改某某问题、\n3、优化某某BUG、")

Loading…
Cancel
Save