修复强制弹窗
This commit is contained in:
@ -667,44 +667,6 @@ public class DialogUtils {
|
||||
public static void showPermissionDialog(Context context, String title, CharSequence message
|
||||
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
|
||||
|
||||
// AlertDialog alertDialog = new AlertDialog.Builder(context, R.style.GhAlertDialog)
|
||||
// .setTitle(title)
|
||||
// .setMessage(message)
|
||||
// .setPositiveButton(positive, new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// if (cmListener != null) {
|
||||
// cmListener.onConfirm();
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// .setNegativeButton(negative, new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// if (clListener != null) {
|
||||
// clListener.onCancel();
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// .setCancelable(false)
|
||||
// .create();
|
||||
//
|
||||
// alertDialog.show();
|
||||
//
|
||||
// TextView mesage = (TextView) alertDialog.findViewById(android.R.id.message);
|
||||
// Button positiveBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE);
|
||||
// Button negativeBtn = alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE);
|
||||
//
|
||||
// positiveBtn.setTextSize(13);
|
||||
// positiveBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
|
||||
// negativeBtn.setTextSize(13);
|
||||
// negativeBtn.setTextColor(ContextCompat.getColor(context, R.color.hint));
|
||||
// if (mesage != null) {
|
||||
// mesage.setTextSize(13);
|
||||
// mesage.setTextColor(ContextCompat.getColor(context, R.color.title));
|
||||
// mesage.setLineSpacing(1.0f, 1.3f);
|
||||
// }
|
||||
|
||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
||||
|
||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
|
||||
@ -746,6 +708,51 @@ public class DialogUtils {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 只能在弹窗内取消
|
||||
*/
|
||||
public static void showForceDialog(Context context, String title, CharSequence message
|
||||
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
|
||||
|
||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
||||
|
||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
|
||||
TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
||||
TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
||||
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
|
||||
TextView positiveTv = contentView.findViewById(R.id.dialog_positive);
|
||||
|
||||
contentTv.setText(message);
|
||||
titleTv.setText(title);
|
||||
negativeTv.setText(negative);
|
||||
positiveTv.setText(positive);
|
||||
|
||||
negativeTv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (clListener != null) {
|
||||
clListener.onCancel();
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
positiveTv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (cmListener != null) {
|
||||
cmListener.onConfirm();
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(contentView);
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 特殊:验证手机号码
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user