DataWatcher修改
This commit is contained in:
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user