DataWatcher修改

This commit is contained in:
huangzhuanghua
2016-09-08 09:11:22 +08:00
parent 9180089787
commit e2591a54d6
26 changed files with 366 additions and 457 deletions

View File

@ -100,24 +100,22 @@ public class DownloadDialog {
private DataWatcher dataWatcher = new DataWatcher() {
@Override
public void onDataChanged(HashMap<String, DownloadEntry> downloadingEntries) {
for (Map.Entry<String, DownloadEntry> entry : downloadingEntries.entrySet()) {
if (entry.getValue().getName().equals(gameName)
&& !"delete".equals(DownloadManager.getInstance(context).getStatus(entry.getValue().getUrl()))) {
entryMap.put(entry.getValue().getUrl(), entry.getValue());
public void onDataChanged(DownloadEntry downloadEntry) {
if (downloadEntry.getName().equals(gameName)
&& !"delete".equals(DownloadManager.getInstance(context).getStatus(downloadEntry.getUrl()))) {
entryMap.put(downloadEntry.getUrl(), downloadEntry);
Integer location = locationMap.get(entry.getValue().getUrl());
if (location != null) {
int position = (int) Math.ceil((location + 1) / (double) (row * column));
Integer location = locationMap.get(downloadEntry.getUrl());
if (location != null) {
int position = (int) Math.ceil((location + 1) / (double) (row * column));
if (position - 1 < adapterMap.size()) {
adapterMap.get(position - 1).notifyItemChanged(location % (row * column));
}
if (position - 1 < adapterMap.size()) {
adapterMap.get(position - 1).notifyItemChanged(location % (row * column));
}
if (collectionAdapterMap != null && position - 1 < collectionAdapterMap.size()){
if ( collectionAdapterMap.size() >= position - 1 && collectionAdapterMap.size() >= 1){
collectionAdapterMap.get(position - 1).notifyItemChanged(location % (row * column));
}
if (collectionAdapterMap != null && position - 1 < collectionAdapterMap.size()){
if ( collectionAdapterMap.size() >= position - 1 && collectionAdapterMap.size() >= 1){
collectionAdapterMap.get(position - 1).notifyItemChanged(location % (row * column));
}
}
}