使下载完成通知在点击安装后消失 https://gitlab.ghzs.com/pm/halo-app-issues/issues/726

This commit is contained in:
chenjuntao
2020-01-04 17:55:25 +08:00
parent d79b3f10e8
commit 74f64d9782
9 changed files with 34 additions and 14 deletions

View File

@ -247,6 +247,7 @@ public class MainActivity extends BaseActivity {
DownloadManager.getInstance(MainActivity.this).cancel(downloadEntity.getUrl());
} else {
if (PackageUtils.isCanLaunchSetup(getApplicationContext(), downloadEntity.getPath())) {
downloadEntity.getMeta().put(Constants.MARK_ALREADY_TRIGGERED_INSTALLATION, "YES");
startActivity(PackageUtils.getInstallIntent(MainActivity.this, downloadEntity.getPath()));
} else {
// 弹出卸载提示框
@ -620,12 +621,12 @@ public class MainActivity extends BaseActivity {
} else {
msg = "" + downloadEntity.getName() + "》已下载完但还未安装,是否立即安装?";
}
final String path = downloadEntity.getPath();
DownloadEntity finalDownloadEntity = downloadEntity;
DialogUtils.showWarningDialog(this,
"提示", msg,
"直接退出",
"立即安装",
() -> handler.postDelayed(() -> PackageUtils.launchSetup(MainActivity.this, path), 200),
() -> handler.postDelayed(() -> PackageUtils.launchSetup(MainActivity.this, finalDownloadEntity), 200),
this::finish);
return true;
}