Android 6.0及以上 权限适配
This commit is contained in:
@ -400,8 +400,8 @@ public class DialogUtils {
|
||||
}, null);
|
||||
}
|
||||
|
||||
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener){
|
||||
showWarningDialog(context, "下载提示", "您当前使用的网络为2G/3G/4G,开始下载将会消耗移动流量,确定下载?", "取消", "确定", listener, cancelListener);
|
||||
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener) {
|
||||
showWarningDialog(context, "下载提示", "您当前使用的网络为2G/3G/4G,开始下载将会消耗移动流量,确定下载?", "取消", "确定", listener, cancelListener);
|
||||
}
|
||||
|
||||
public static void showDownloadDialog(Context context, ConfirmListener listener) {
|
||||
@ -501,6 +501,7 @@ public class DialogUtils {
|
||||
|
||||
/**
|
||||
* 取消按钮灰色
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param message
|
||||
@ -543,6 +544,59 @@ public class DialogUtils {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限弹窗
|
||||
* @param context
|
||||
* @param title
|
||||
* @param message
|
||||
* @param positive
|
||||
* @param negative
|
||||
* @param cmListener
|
||||
* @param clListener
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 特殊:验证手机号码
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user