文件整理、修改
This commit is contained in:
@ -56,18 +56,17 @@ public class DownloadItemUtils {
|
||||
}
|
||||
|
||||
// 更新下载进度条
|
||||
public static void processDate(GameEntity detailedEntity,
|
||||
public static void processDate(Context context,
|
||||
GameEntity detailedEntity,
|
||||
DownloadEntry downloadEntry,
|
||||
ArrayMap<String, LinkedBlockingQueue<String>> platformMap,
|
||||
Handler handler,
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder> adapter,
|
||||
int index,
|
||||
ArrayMap<String, String> statusMap) {
|
||||
|
||||
LinkedBlockingQueue<String> queue = platformMap.get(downloadEntry.getName());
|
||||
LinkedBlockingQueue<String> queue = DownloadManager.getInstance(context).getQueue(downloadEntry.getName());
|
||||
if (queue == null) {
|
||||
queue = new LinkedBlockingQueue<>();
|
||||
platformMap.put(downloadEntry.getName(), queue);
|
||||
DownloadManager.getInstance(context).putQueue(downloadEntry.getName(), queue);
|
||||
}
|
||||
|
||||
String platform = downloadEntry.getMeta().get("platform");
|
||||
@ -93,7 +92,7 @@ public class DownloadItemUtils {
|
||||
Message msg = Message.obtain();
|
||||
msg.obj = downloadEntry.getName();
|
||||
msg.what = Constants.DOWNLOAD_ROLL;
|
||||
handler.sendMessageDelayed(msg, 3000);
|
||||
DownloadManager.getInstance(context).sendMessageDelayed(msg, 3000);
|
||||
}
|
||||
}
|
||||
if (platform.equals(queue.peek())) {
|
||||
@ -170,7 +169,6 @@ public class DownloadItemUtils {
|
||||
TextView download_percentage,
|
||||
TextView downloadBtn,
|
||||
GameEntity entity,
|
||||
ArrayMap<String, LinkedBlockingQueue<String>> platformMap,
|
||||
ArrayMap<String, String> statusMap,
|
||||
boolean isShowPlatform) {
|
||||
|
||||
@ -228,7 +226,7 @@ public class DownloadItemUtils {
|
||||
|
||||
DownloadEntry downloadEntry;
|
||||
|
||||
LinkedBlockingQueue<String> queue = platformMap.get(entity.getName());
|
||||
LinkedBlockingQueue<String> queue = DownloadManager.getInstance(context).getQueue(entity.getName());
|
||||
if (queue != null && !queue.isEmpty()) {
|
||||
downloadEntry = entryMap.get(queue.peek());
|
||||
} else {
|
||||
@ -342,7 +340,6 @@ public class DownloadItemUtils {
|
||||
TextView download_percentage,
|
||||
TextView downloadBtn,
|
||||
GameEntity entity,
|
||||
ArrayMap<String, LinkedBlockingQueue<String>> platformMap,
|
||||
ArrayMap<String, String> statusMap,
|
||||
boolean isShowPlatform) {
|
||||
|
||||
@ -363,7 +360,7 @@ public class DownloadItemUtils {
|
||||
download_percentage, downloadBtn, entity, statusMap, isShowPlatform);
|
||||
} else {
|
||||
updatePluginItem(context, textView, game_progressbar, game_ll_info, download_speed,
|
||||
download_percentage, downloadBtn, entity, platformMap, statusMap, isShowPlatform);
|
||||
download_percentage, downloadBtn, entity, statusMap, isShowPlatform);
|
||||
}
|
||||
|
||||
}
|
||||
@ -376,10 +373,9 @@ public class DownloadItemUtils {
|
||||
TextView download_percentage,
|
||||
TextView downloadBtn,
|
||||
GameEntity entity,
|
||||
ArrayMap<String, LinkedBlockingQueue<String>> platformMap,
|
||||
ArrayMap<String, String> statusMap) {
|
||||
updateItem(context, textView, game_progressbar, game_ll_info, download_speed,
|
||||
download_percentage, downloadBtn, entity, platformMap, statusMap, true);
|
||||
download_percentage, downloadBtn, entity, statusMap, true);
|
||||
}
|
||||
|
||||
public static void setNormalOnClickListener(final Context context,
|
||||
@ -483,28 +479,9 @@ public class DownloadItemUtils {
|
||||
int position,
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder> adapter,
|
||||
ArrayMap<String, String> statusMap,
|
||||
ArrayMap<String, LinkedBlockingQueue<String>> platformMap,
|
||||
String entrance,
|
||||
DismissEntity dismissEntity,
|
||||
String location) {
|
||||
setOnClickListener(context, downloadBtn, download_speed, download_percentage,
|
||||
entity, position, adapter, statusMap, platformMap, entrance, true,
|
||||
dismissEntity, location);
|
||||
}
|
||||
|
||||
public static void setOnClickListener(Context context,
|
||||
TextView downloadBtn,
|
||||
TextView download_speed,
|
||||
TextView download_percentage,
|
||||
GameEntity entity,
|
||||
int position,
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder> adapter,
|
||||
ArrayMap<String, String> statusMap,
|
||||
ArrayMap<String, LinkedBlockingQueue<String>> platformMap,
|
||||
String entrance,
|
||||
boolean isShowPlatform,
|
||||
DismissEntity dismissEntity,
|
||||
String location) {
|
||||
|
||||
if (entity.getApk().size() == 1) {
|
||||
setNormalOnClickListener(context, downloadBtn, entity, position, adapter, statusMap, entrance);
|
||||
|
||||
Reference in New Issue
Block a user