修改多版本下载时,使用移动网络的提示方式
This commit is contained in:
@ -692,7 +692,16 @@ public class DownloadDialog {
|
||||
clickCollectionPosition = viewHolder.getPosition();
|
||||
} else if (viewHolder.download_item_tv_status.getVisibility() == View.GONE) {
|
||||
//下载游戏
|
||||
addDownloadEntry(apkEntity, viewHolder.download_item_tv_status);
|
||||
if (NetworkUtils.isWifiConnected(context)) {
|
||||
addDownloadEntry(apkEntity, viewHolder.download_item_tv_status);
|
||||
} else {
|
||||
DialogUtils.showDownloadDialog(context, new DialogUtils.ConfiremListener() {
|
||||
@Override
|
||||
public void onConfirem() {
|
||||
addDownloadEntry(apkEntity, viewHolder.download_item_tv_status);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
String status = viewHolder.download_item_tv_status.getText().toString();
|
||||
Utils.log("status = " + status);
|
||||
@ -711,30 +720,29 @@ public class DownloadDialog {
|
||||
} else if ("安装".equals(status) || "安装更新".equals(status)) {
|
||||
install(apkEntity, viewHolder.getPosition());
|
||||
} else if ("插件化".equals(status)) {
|
||||
// 下载插件版游戏
|
||||
plugin(apkEntity);
|
||||
if (NetworkUtils.isWifiConnected(context)) {
|
||||
plugin(apkEntity);
|
||||
} else {
|
||||
DialogUtils.showDownloadDialog(context, new DialogUtils.ConfiremListener() {
|
||||
@Override
|
||||
public void onConfirem() {
|
||||
plugin(apkEntity);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if ("安装插件".equals(status)) {
|
||||
showPluginDialog(apkEntity, RecyclerViewAdapter.this, viewHolder.getPosition());
|
||||
} else if ("更新".equals(status)) {
|
||||
//下载可更新游戏
|
||||
Map<String, Object> kv = new HashMap<String, Object>();
|
||||
kv.put("版本", apkEntity.getPlatform());
|
||||
kv.put("状态", "下载开始");
|
||||
DataUtils.onEvent(context, "游戏更新", gameName, kv);
|
||||
|
||||
DownloadEntry entry = new DownloadEntry();
|
||||
entry.setUrl(apkEntity.getUrl());
|
||||
entry.setName(gameName);
|
||||
entry.setPath(FileUtils.getDownloadPath(context,
|
||||
MD5Utils.getContentMD5(
|
||||
gameName + "_" + System.currentTimeMillis()) + ".apk"));
|
||||
HashMap<String, String> meta = new HashMap<String, String>();
|
||||
meta.put("ETag", apkEntity.getEtag());
|
||||
meta.put("icon", gameIcon);
|
||||
meta.put("platform", apkEntity.getPlatform());
|
||||
meta.put("isUpdate", "true");
|
||||
entry.setMeta(meta);
|
||||
DownloadManager.getInstance(context).add(entry);
|
||||
if (NetworkUtils.isWifiConnected(context)) {
|
||||
update(apkEntity);
|
||||
} else {
|
||||
DialogUtils.showDownloadDialog(context, new DialogUtils.ConfiremListener() {
|
||||
@Override
|
||||
public void onConfirem() {
|
||||
update(apkEntity);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -956,6 +964,28 @@ public class DownloadDialog {
|
||||
}
|
||||
}
|
||||
|
||||
//下载可更新游戏
|
||||
private void update(ApkEntity apkEntity) {
|
||||
Map<String, Object> kv = new HashMap<String, Object>();
|
||||
kv.put("版本", apkEntity.getPlatform());
|
||||
kv.put("状态", "下载开始");
|
||||
DataUtils.onEvent(context, "游戏更新", gameName, kv);
|
||||
|
||||
DownloadEntry entry = new DownloadEntry();
|
||||
entry.setUrl(apkEntity.getUrl());
|
||||
entry.setName(gameName);
|
||||
entry.setPath(FileUtils.getDownloadPath(context,
|
||||
MD5Utils.getContentMD5(
|
||||
gameName + "_" + System.currentTimeMillis()) + ".apk"));
|
||||
HashMap<String, String> meta = new HashMap<String, String>();
|
||||
meta.put("ETag", apkEntity.getEtag());
|
||||
meta.put("icon", gameIcon);
|
||||
meta.put("platform", apkEntity.getPlatform());
|
||||
meta.put("isUpdate", "true");
|
||||
entry.setMeta(meta);
|
||||
DownloadManager.getInstance(context).add(entry);
|
||||
}
|
||||
|
||||
//下载插件化游戏
|
||||
private void plugin(ApkEntity apkEntity) {
|
||||
String msg = FileUtils.isCanDownload(apkEntity.getSize());
|
||||
|
||||
Reference in New Issue
Block a user