Skip to content

Commit

Permalink
优化细节
Browse files Browse the repository at this point in the history
  • Loading branch information
jenly1314 committed Apr 26, 2021
1 parent 3ee62c3 commit e93a677
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
46 changes: 24 additions & 22 deletions app-dialog/src/main/java/com/king/app/dialog/AppDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
Expand Down Expand Up @@ -106,38 +107,39 @@ public String showDialogFragment(FragmentManager fragmentManager,DialogFragment
* @param config 弹框配置 {@link AppDialogConfig}
*/
public void showDialog(AppDialogConfig config){
showDialog(config.getContext(),config);
showDialog(config,true);
}


/**
* 显示弹框 请使用{@link #showDialog(AppDialogConfig)}
* @param context
* 显示弹框
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消(默认为true,false则拦截back键)
*/
public void showDialog(Context context,AppDialogConfig config){
showDialog(context,config,true);
public void showDialog(AppDialogConfig config,boolean isCancel){
showDialog(config.getContext(),config.buildAppDialogView(),config.getStyleId(),DEFAULT_WIDTH_RATIO,isCancel);
}

/**
* 显示弹框,请使用{@link #showDialog(AppDialogConfig, boolean)}
* 显示弹框
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消(默认为true,false则拦截back键)
*/
public void showDialog(Context context,AppDialogConfig config,boolean isCancel){
showDialog(context,config.buildAppDialogView(),isCancel);
public void showDialog(Context context,AppDialogConfig config){
showDialog(context,config,true);
}


/**
* 显示弹框
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消(默认为true,false则拦截back键)
*/
public void showDialog(AppDialogConfig config,boolean isCancel){
showDialog(config.getContext(),config.buildAppDialogView(),config.getStyleId(),DEFAULT_WIDTH_RATIO,isCancel);
public void showDialog(Context context,AppDialogConfig config,boolean isCancel){
showDialog(context,config.buildAppDialogView(),config.getStyleId(),DEFAULT_WIDTH_RATIO,isCancel);
}


/**
* 显示弹框
* @param context
Expand Down Expand Up @@ -225,31 +227,31 @@ public Dialog createDialog(AppDialogConfig config){
}

/**
* 创建弹框,请使用{@link #createDialog(AppDialogConfig)}
* @param context
* 创建弹框
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消(默认为true,false则拦截back键)
*/
public Dialog createDialog(Context context,AppDialogConfig config){
return createDialog(context,config,true);
public Dialog createDialog(AppDialogConfig config,boolean isCancel){
return createDialog(config.getContext(),config.buildAppDialogView(),config.getStyleId(),DEFAULT_WIDTH_RATIO,isCancel);
}

/**
* 创建弹框,请使用{@link #createDialog(AppDialogConfig, boolean)}
* 创建弹框
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消(默认为true,false则拦截back键)
*/
public Dialog createDialog(Context context,AppDialogConfig config,boolean isCancel){
return createDialog(context,config.buildAppDialogView(),isCancel);
public Dialog createDialog(Context context,AppDialogConfig config){
return createDialog(context,config,true);
}

/**
* 创建弹框
* @param context
* @param config 弹框配置 {@link AppDialogConfig}
* @param isCancel 是否可取消(默认为true,false则拦截back键)
*/
public Dialog createDialog(AppDialogConfig config,boolean isCancel){
return createDialog(config.getContext(),config.buildAppDialogView(),config.getStyleId(),DEFAULT_WIDTH_RATIO,isCancel);
public Dialog createDialog(Context context,AppDialogConfig config,boolean isCancel){
return createDialog(context,config.buildAppDialogView(),config.getStyleId(),DEFAULT_WIDTH_RATIO,isCancel);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/king/appupdater/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void onClick(View v) {
AppDialog.INSTANCE.dismissDialog();
}
});
AppDialog.INSTANCE.showDialog(getContext(),config);
AppDialog.INSTANCE.showDialog(config);
}

/**
Expand All @@ -195,7 +195,7 @@ public void onClick(View v) {
}
});
//强制升级,拦截返回
AppDialog.INSTANCE.showDialog(getContext(),config,false);
AppDialog.INSTANCE.showDialog(config,false);
}

/**
Expand Down

0 comments on commit e93a677

Please sign in to comment.