统一gameMap、statusMap
This commit is contained in:
@ -101,7 +101,7 @@ public class DownloadDialog {
|
||||
public void onDataChanged(HashMap<String, DownloadEntry> downloadingEntries) {
|
||||
for (Map.Entry<String, DownloadEntry> entry : downloadingEntries.entrySet()) {
|
||||
if (entry.getValue().getName().equals(gameName)
|
||||
&& !"delete".equals(statusMap.get(entry.getValue().getUrl()))) {
|
||||
&& !"delete".equals(DownloadManager.getInstance(context).getStatus(entry.getValue().getUrl()))) {
|
||||
entryMap.put(entry.getValue().getUrl(), entry.getValue());
|
||||
|
||||
Integer location = locationMap.get(entry.getValue().getUrl());
|
||||
@ -137,7 +137,6 @@ public class DownloadDialog {
|
||||
private String gameType;
|
||||
private String entrance;
|
||||
private String mlocation;
|
||||
private ArrayMap<String, String> statusMap;
|
||||
private TextView download_speed;
|
||||
private TextView download_percentage;
|
||||
private LinearLayout linearLayout;
|
||||
@ -153,22 +152,12 @@ public class DownloadDialog {
|
||||
GameEntity game,
|
||||
String entrance,
|
||||
String location) {
|
||||
ArrayMap<String, String> mStatusMap = new ArrayMap<String, String>();
|
||||
showPopupWindow(view, game, entrance, mStatusMap, location);
|
||||
}
|
||||
|
||||
public void showPopupWindow(View view,
|
||||
GameEntity game,
|
||||
String entrance,
|
||||
ArrayMap<String, String> sMap,
|
||||
String location) {
|
||||
showPopupWindow(view, game, entrance, sMap, null, null, location);
|
||||
showPopupWindow(view, game, entrance, null, null, location);
|
||||
}
|
||||
|
||||
public void showPopupWindow(View view,
|
||||
GameEntity game,
|
||||
String eStr,
|
||||
ArrayMap<String, String> sMap,
|
||||
TextView dSpeed,
|
||||
TextView dPercentage,
|
||||
String lstr) {
|
||||
@ -179,7 +168,6 @@ public class DownloadDialog {
|
||||
|
||||
mlocation = lstr;
|
||||
entrance = eStr;
|
||||
statusMap = sMap;
|
||||
download_speed = dSpeed;
|
||||
download_percentage = dPercentage;
|
||||
|
||||
@ -526,7 +514,7 @@ public class DownloadDialog {
|
||||
public void onEvent(EBDownloadDelete delete) {
|
||||
String url = delete.getUrl();
|
||||
Integer location = locationMap.get(url);
|
||||
statusMap.put(url, "delete");
|
||||
DownloadManager.getInstance(context).putStatus(url, "delete");
|
||||
entryMap.remove(url);
|
||||
int position = (int) Math.ceil((location + 1) / (double) (row * column));
|
||||
adapterMap.get(position - 1).notifyItemChanged(location % (row * column));
|
||||
@ -1042,7 +1030,7 @@ public class DownloadDialog {
|
||||
|
||||
EventBus.getDefault().post(new EBRedDot(1));
|
||||
|
||||
statusMap.put(entry.getUrl(), "downloading");
|
||||
DownloadManager.getInstance(context).putStatus(entry.getUrl(), "downloading");
|
||||
|
||||
GameUpdateEntity game = new GameUpdateEntity();
|
||||
game.setId(gameId);
|
||||
@ -1136,7 +1124,7 @@ public class DownloadDialog {
|
||||
|
||||
EventBus.getDefault().post(new EBRedDot(1));
|
||||
|
||||
statusMap.put(entry.getUrl(), "downloading");
|
||||
DownloadManager.getInstance(context).putStatus(entry.getUrl(), "downloading");
|
||||
} else {
|
||||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user