1、对下载器任务的状态变化修改

2、对下载器内部的handler的消息屏蔽,pause的修改,剩余download roll未改动。
This commit is contained in:
CsHeng
2017-07-02 09:49:21 +08:00
parent 7a6354e781
commit 714a64975f
13 changed files with 236 additions and 176 deletions

View File

@ -65,7 +65,12 @@ public class DownloadItemUtils {
} else {
if (!queue.contains(platform)) {
queue.offer(platform);
if (AppDebugConfig.IS_DEBUG) {
AppDebugConfig.logMethodWithParams(DownloadItemUtils.class, queue.size(), gameEntity.getBrief(), downloadEntity.getPlatform(), index);
}
// 有两个平台同时下载的时候启用
if (queue.size() == 2) {
//TODO fuck this
Message msg = Message.obtain();
msg.obj = downloadEntity.getName();
msg.what = DownloadConfig.DOWNLOAD_ROLL;
@ -220,8 +225,7 @@ public class DownloadItemUtils {
holder.gameProgressbar.setVisibility(View.VISIBLE);
holder.gameInfo.setVisibility(View.VISIBLE);
String platform = PlatformUtils.getInstance(context)
.getPlatformName(downloadEntity.getPlatform());
String platform = PlatformUtils.getInstance(context).getPlatformName(downloadEntity.getPlatform());
DownloadStatus status = downloadEntity.getStatus();
if (status.equals(DownloadStatus.downloading)) {
@ -399,7 +403,7 @@ public class DownloadItemUtils {
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
downloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
DownloadManager.getInstance(context).putStatus(gameEntity.getApk().get(0).getUrl(), "downloading");
// DownloadManager.getInstance(context).putStatus(gameEntity.getApk().get(0).getUrl(), "downloading");
} else {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
@ -419,7 +423,7 @@ public class DownloadItemUtils {
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
downloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
DownloadManager.getInstance(context).putStatus(gameEntity.getApk().get(0).getUrl(), "downloading");
// DownloadManager.getInstance(context).putStatus(gameEntity.getApk().get(0).getUrl(), "downloading");
} else {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}