This commit is contained in:
chenjuntao
2018-10-28 14:14:56 +08:00
parent 74c9cfc5b6
commit 26bc1299ff
5 changed files with 45 additions and 15 deletions

View File

@ -354,14 +354,15 @@ public class DialogUtils {
}
public static void checkDownload(Context context, String size, CheckDownloadCallBack callBack) {
if (NetworkUtils.isWifiConnected(context) || filter4GorSize(context, size)) {
if (!NetworkUtils.isNetworkConnected(context)) {
showNoConnectionDownloadDialog(context, null,
() -> callBack.onResponse(true));
} else if (NetworkUtils.isWifiConnected(context) || filter4GorSize(context, size)) {
callBack.onResponse(false);
} else {
showDownloadDialog(context, () -> {
callBack.onResponse(false);
}, () -> {
callBack.onResponse(true);
});
showDownloadDialog(context,
() -> callBack.onResponse(false),
() -> callBack.onResponse(true));
}
}
@ -394,6 +395,9 @@ public class DialogUtils {
}
}
public static void showNoConnectionDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener) {
showWarningDialog(context, "下载提示", "网络异常,请检查手机网络状态", "连上WiFi后自动下载", "关闭", listener, cancelListener);
}
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener) {
showWarningDialog(context, "下载提示", "当前正在使用移动网络,立即下载会消耗手机流量", "连上WiFi后自动下载", "立即下载", listener, cancelListener);