完成更新推送功能优化0826补充及UI调整 https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/946
This commit is contained in:
@ -29,6 +29,7 @@ import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.SPUtils;
|
||||
import com.gh.common.util.SpeedUtils;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.MainActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.AppEntity;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
@ -85,7 +86,9 @@ public class UpdateManager {
|
||||
|
||||
private boolean isShowDownload;
|
||||
private boolean isChecking;
|
||||
private long lastUpdateFileSize = 0L;
|
||||
private long lastUpdateFileSize;
|
||||
|
||||
private String currentUpdateMd5;
|
||||
|
||||
private DataWatcher dataWatcher = new DataWatcher() {
|
||||
@Override
|
||||
@ -143,6 +146,13 @@ public class UpdateManager {
|
||||
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
|
||||
updateUpdateDialogView(true);
|
||||
}
|
||||
} else {
|
||||
if (mContext instanceof MainActivity
|
||||
&& AppManager.getInstance().getRecentActiveActivity() == mContext) {
|
||||
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
|
||||
showUpdateDialog(currentUpdateMd5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,11 +227,16 @@ public class UpdateManager {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
isChecking = false;
|
||||
currentUpdateMd5 = response;
|
||||
if (loadingDialog != null) {
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
if (response != null) {
|
||||
showUpdateDialog(response);
|
||||
if (appEntity.isForce() || isUpdateFileDownloaded(response)) {
|
||||
showUpdateDialog(response);
|
||||
} else {
|
||||
createUpdate(response, true);
|
||||
}
|
||||
if (handler != null) {
|
||||
Message message = new Message();
|
||||
message.what = 0;
|
||||
@ -278,7 +293,7 @@ public class UpdateManager {
|
||||
updateUpdateDialogView(true);
|
||||
}
|
||||
} else {
|
||||
updateUpdateDialogView(false);
|
||||
updateUpdateDialogView(isUpdateFileDownloaded(md5));
|
||||
}
|
||||
|
||||
TextView content = view.findViewById(R.id.desc);
|
||||
@ -303,7 +318,7 @@ public class UpdateManager {
|
||||
confirmTextView.setOnClickListener(v -> {
|
||||
if (!isUpdateFileDownloaded(md5)) {
|
||||
updateDialog.dismiss();
|
||||
} else if (isUpdateFileDownloaded(md5) && !appEntity.isForce()){
|
||||
} else if (isUpdateFileDownloaded(md5) && !appEntity.isForce()) {
|
||||
updateDialog.dismiss();
|
||||
}
|
||||
String path = FileUtils.getDownloadPath(mContext, "光环助手V" + appEntity.getVersion() + "_" + md5 + ".apk");
|
||||
|
||||
Reference in New Issue
Block a user