Skip to content

Commit

Permalink
添加下载失败重启逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
yjfnypeu committed Aug 6, 2018
1 parent 460658c commit ecab794
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,26 @@ public void onDownloadError(Throwable t) {
private void createRestartDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(ActivityManager.get().topActivity())
.setCancelable(!update.isForced())
.setMessage("下载apk失败。是否重新下载?")
.setTitle("下载apk失败")
.setMessage("是否重新下载?")
.setNeutralButton(update.isForced() ? "退出" : "取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (update.isForced()) {
System.exit(0);
Process.killProcess(Process.myPid());
} else {
dialog.dismiss();
}
}
})
.setNegativeButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
restartDownload();
}
});

if (!update.isForced()) {
builder.setNeutralButton("退出", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
System.exit(0);
Process.killProcess(Process.myPid());
}
});
}

builder.show();
}
}

0 comments on commit ecab794

Please sign in to comment.