This commit is contained in:
huangzhuanghua
2016-09-09 18:23:54 +08:00
parent 5316164f00
commit f858ba0b70
58 changed files with 1038 additions and 1874 deletions

View File

@ -53,11 +53,10 @@ import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameCollectionEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.eventbus.EBDownloadDelete;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBPlatformChanged;
import com.gh.gamecenter.eventbus.EBPutUrl;
import com.gh.gamecenter.eventbus.EBRedDot;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.manager.PackageManager;
@ -519,23 +518,27 @@ public class DownloadDialog {
}
//接收下载被删除消息
public void onEvent(EBDownloadDelete delete) {
String url = delete.getUrl();
Integer location = locationMap.get(url);
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));
if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1 && collectionAdapterMap.size() >= 1){
collectionAdapterMap.get(position - 1).notifyItemChanged(location % (row * column));
public void onEvent(EBDownloadStatus status) {
if ("delete".equals(status.getStatus())) {
String url = status.getUrl();
Integer location = locationMap.get(url);
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));
if (collectionAdapterMap != null && collectionAdapterMap.size() >= position - 1 && collectionAdapterMap.size() >= 1){
collectionAdapterMap.get(position - 1).notifyItemChanged(location % (row * column));
}
}
}
// 接收platform数据改变消息更新界面
public void onEvent(EBPlatformChanged platformChanged) {
DownloadManager.getInstance(context).removeObserver(dataWatcher);
init(new ArrayList<ApkEntity>(gameApk));
DownloadManager.getInstance(context).addObserver(dataWatcher);
public void onEvent(EBReuse reuse) {
if ("PlatformChanged".equals(reuse.getType())) {
DownloadManager.getInstance(context).removeObserver(dataWatcher);
init(new ArrayList<>(gameApk));
DownloadManager.getInstance(context).addObserver(dataWatcher);
}
}
private class PlatformAdapter extends PagerAdapter {
@ -1066,8 +1069,6 @@ public class DownloadDialog {
DownloadManager.getInstance(context).add(entry);
EventBus.getDefault().post(new EBRedDot(1));
DownloadManager.getInstance(context).putStatus(entry.getUrl(), "downloading");
GameUpdateEntity game = new GameUpdateEntity();
@ -1160,8 +1161,6 @@ public class DownloadDialog {
download_item_tv_status.setText("0.0%");
EventBus.getDefault().post(new EBRedDot(1));
DownloadManager.getInstance(context).putStatus(entry.getUrl(), "downloading");
} else {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();