下载管理相关优化
This commit is contained in:
@ -32,6 +32,7 @@ import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PageSwitchDataHelper;
|
||||
import com.gh.common.util.SPUtils;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.download.DownloadedGameIdAndPackageNameDao;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
@ -88,6 +89,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
private ArrayMap<String, DownloadEntity> downloadingMap;
|
||||
|
||||
private DownloadDao mDownloadDao;
|
||||
private DownloadedGameIdAndPackageNameDao mDownloadedGameIdAndPackageNameDao;
|
||||
|
||||
private Set<String> mUpdateMarks;
|
||||
|
||||
@ -132,6 +134,8 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
public void onTaskDone(DownloadEntity entity) {
|
||||
downloadingMap.remove(entity.getUrl());
|
||||
|
||||
mDownloadedGameIdAndPackageNameDao.add(entity.getGameId() + entity.getPackageName());
|
||||
|
||||
if (downloadingMap.isEmpty()) {
|
||||
DownloadWorkManager.cancelWorker();
|
||||
}
|
||||
@ -145,6 +149,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
private DownloadManager(Context context) {
|
||||
mContext = context.getApplicationContext();
|
||||
mDownloadDao = DownloadDao.getInstance(mContext);
|
||||
mDownloadedGameIdAndPackageNameDao = new DownloadedGameIdAndPackageNameDao();
|
||||
|
||||
mUpdateMarks = SPUtils.getStringSet(UPDATE_IS_READ_MARK);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user