修改Queue的TAG为static fianl 对象(cancelQueue中判断的条件为TAG为统一对象才可取消)
This commit is contained in:
@ -2,7 +2,6 @@ package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.os.Message;
|
||||
import android.support.v4.util.ArrayMap;
|
||||
@ -265,13 +264,6 @@ public class DownloadItemUtils {
|
||||
String platform = PlatformUtils.getInstance(context)
|
||||
.getPlatformName(downloadEntity.getPlatform());
|
||||
|
||||
int[] btn_colors = new int[] { Color.WHITE
|
||||
, context.getResources().getColor(R.color.theme) };
|
||||
int[][] states = new int[2][];
|
||||
states[0] = new int[] { android.R.attr.state_pressed };
|
||||
states[1] = new int[] {};
|
||||
ColorStateList btn_sl = new ColorStateList(states, btn_colors);
|
||||
|
||||
DownloadStatus status = downloadEntity.getStatus();
|
||||
if (status.equals(DownloadStatus.downloading)) {
|
||||
if (!"pause".equals(DownloadManager.getInstance(context).getStatus(downloadEntity.getUrl()))) {
|
||||
@ -290,7 +282,7 @@ public class DownloadItemUtils {
|
||||
if (isNormal) {
|
||||
downloadBtn.setText("下载中");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
downloadBtn.setTextColor(btn_sl);
|
||||
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
}
|
||||
} else if (status.equals(DownloadStatus.waiting)) {
|
||||
game_progressbar.setProgress((int) (downloadEntity.getPercent() * 10));
|
||||
@ -304,7 +296,7 @@ public class DownloadItemUtils {
|
||||
if (isNormal) {
|
||||
downloadBtn.setText("下载中");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
downloadBtn.setTextColor(btn_sl);
|
||||
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
}
|
||||
} else if (status.equals(DownloadStatus.pause)
|
||||
|| status.equals(DownloadStatus.timeout)
|
||||
@ -320,7 +312,7 @@ public class DownloadItemUtils {
|
||||
if (isNormal) {
|
||||
downloadBtn.setText("下载中");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
downloadBtn.setTextColor(btn_sl);
|
||||
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
}
|
||||
} else if (status.equals(DownloadStatus.done)) {
|
||||
game_progressbar.setProgress(1000);
|
||||
@ -550,16 +542,9 @@ public class DownloadItemUtils {
|
||||
addDownloadEntry(context, entity, 0, entrance);
|
||||
Toast.makeText(context, entity.getName() + "已加入下载队列", Toast.LENGTH_SHORT).show();
|
||||
|
||||
int[] btn_colors = new int[] { Color.WHITE
|
||||
, context.getResources().getColor(R.color.theme) };
|
||||
int[][] states = new int[2][];
|
||||
states[0] = new int[] { android.R.attr.state_pressed };
|
||||
states[1] = new int[] {};
|
||||
ColorStateList btn_sl = new ColorStateList(states, btn_colors);
|
||||
|
||||
downloadBtn.setText("下载中");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
downloadBtn.setTextColor(btn_sl);
|
||||
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
|
||||
DownloadManager.getInstance(context).putStatus(entity.getApk().get(0).getUrl(), "downloading");
|
||||
} else {
|
||||
@ -619,16 +604,9 @@ public class DownloadItemUtils {
|
||||
addDownloadEntry(context, entity, 0, entrance);
|
||||
Toast.makeText(context, entity.getName() + "已加入下载队列", Toast.LENGTH_SHORT).show();
|
||||
|
||||
int[] btn_colors = new int[] { Color.WHITE
|
||||
, context.getResources().getColor(R.color.theme) };
|
||||
int[][] states = new int[2][];
|
||||
states[0] = new int[] { android.R.attr.state_pressed };
|
||||
states[1] = new int[] {};
|
||||
ColorStateList btn_sl = new ColorStateList(states, btn_colors);
|
||||
|
||||
downloadBtn.setText("下载中");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
|
||||
downloadBtn.setTextColor(btn_sl);
|
||||
downloadBtn.setTextColor(context.getResources().getColorStateList(R.color.text_downloading_style));
|
||||
|
||||
DownloadManager.getInstance(context).putStatus(entity.getApk().get(0).getUrl(), "downloading");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user