DownloadEntry修改为DownloadEntity
This commit is contained in:
@ -43,7 +43,7 @@ import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.download.DataWatcher;
|
||||
import com.gh.download.DownloadEntry;
|
||||
import com.gh.download.DownloadEntity;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.DownloadStatus;
|
||||
import com.gh.gamecenter.DownloadManagerActivity;
|
||||
@ -99,12 +99,12 @@ public class DownloadDialog {
|
||||
|
||||
private DataWatcher dataWatcher = new DataWatcher() {
|
||||
@Override
|
||||
public void onDataChanged(DownloadEntry downloadEntry) {
|
||||
if (downloadEntry.getName().equals(gameName)
|
||||
&& !"delete".equals(DownloadManager.getInstance(context).getStatus(downloadEntry.getUrl()))) {
|
||||
entryMap.put(downloadEntry.getUrl(), downloadEntry);
|
||||
public void onDataChanged(DownloadEntity downloadEntity) {
|
||||
if (downloadEntity.getName().equals(gameName)
|
||||
&& !"delete".equals(DownloadManager.getInstance(context).getStatus(downloadEntity.getUrl()))) {
|
||||
entryMap.put(downloadEntity.getUrl(), downloadEntity);
|
||||
|
||||
Integer location = locationMap.get(downloadEntry.getUrl());
|
||||
Integer location = locationMap.get(downloadEntity.getUrl());
|
||||
if (location != null) {
|
||||
int position = (int) Math.ceil((location + 1) / (double) (row * column));
|
||||
|
||||
@ -125,7 +125,7 @@ public class DownloadDialog {
|
||||
private PopupWindow popupWindow;
|
||||
|
||||
private ArrayMap<String, Integer> locationMap;
|
||||
private ArrayMap<String, DownloadEntry> entryMap;
|
||||
private ArrayMap<String, DownloadEntity> entryMap;
|
||||
private SparseArray<RecyclerViewAdapter> adapterMap;
|
||||
private SparseArray<RecyclerViewAdapter> collectionAdapterMap;//存储合集的adapter
|
||||
private ArrayMap<String, String> urlMap;
|
||||
@ -187,15 +187,15 @@ public class DownloadDialog {
|
||||
gameType = "plugin";
|
||||
}
|
||||
|
||||
entryMap = new ArrayMap<String, DownloadEntry>();
|
||||
List<DownloadEntry> entries = DownloadManager.getInstance(context).getAll();
|
||||
entryMap = new ArrayMap<>();
|
||||
List<DownloadEntity> entries = DownloadManager.getInstance(context).getAll();
|
||||
for (int i = 0, size = entries.size(); i < size; i++) {
|
||||
if (entries.get(i).getName().equals(gameName)) {
|
||||
entryMap.put(entries.get(i).getUrl(), entries.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
gameApk = sortApk(new ArrayList<ApkEntity>(game.getApk()));
|
||||
gameApk = sortApk(new ArrayList<>(game.getApk()));
|
||||
|
||||
if (game.getCollection() != null){
|
||||
mergeApkCollection(game);
|
||||
@ -208,12 +208,12 @@ public class DownloadDialog {
|
||||
textView.setText(gameName);
|
||||
|
||||
int count = gameApk.size();
|
||||
int vpHeight = 0;
|
||||
if (count <= 3){
|
||||
int vpHeight;
|
||||
if (count <= 3) {
|
||||
vpHeight = 80;
|
||||
}else if (count <= 6){
|
||||
} else if (count <= 6) {
|
||||
vpHeight = 140;
|
||||
}else {
|
||||
} else {
|
||||
vpHeight = 200;
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ public class DownloadDialog {
|
||||
|
||||
isLoadPlatform = false;
|
||||
|
||||
init(new ArrayList<ApkEntity>(gameApk));
|
||||
init(new ArrayList<>(gameApk));
|
||||
|
||||
viewPager.addOnPageChangeListener(new OnPageChangeListener() {
|
||||
@Override
|
||||
@ -395,9 +395,9 @@ public class DownloadDialog {
|
||||
}
|
||||
}
|
||||
|
||||
locationMap = new ArrayMap<String, Integer>();
|
||||
adapterMap = new SparseArray<RecyclerViewAdapter>();
|
||||
urlMap = new ArrayMap<String, String>();
|
||||
locationMap = new ArrayMap<>();
|
||||
adapterMap = new SparseArray<>();
|
||||
urlMap = new ArrayMap<>();
|
||||
|
||||
for (int i = 0, size = apkList.size(); i < size; i++) {
|
||||
locationMap.put(apkList.get(i).getUrl(), i);
|
||||
@ -433,13 +433,13 @@ public class DownloadDialog {
|
||||
}
|
||||
|
||||
private ArrayList<ApkEntity> sortApk(List<ApkEntity> apkList) {
|
||||
DownloadEntry downloadEntry;
|
||||
List<ApkEntity> doneList = new ArrayList<ApkEntity>();
|
||||
List<ApkEntity> updateList = new ArrayList<ApkEntity>();
|
||||
List<ApkEntity> installedList = new ArrayList<ApkEntity>();
|
||||
List<ApkEntity> pluginList = new ArrayList<ApkEntity>();
|
||||
List<ApkEntity> downloadList = new ArrayList<ApkEntity>();
|
||||
List<ApkEntity> noPicList = new ArrayList<ApkEntity>();
|
||||
DownloadEntity downloadEntity;
|
||||
List<ApkEntity> doneList = new ArrayList<>();
|
||||
List<ApkEntity> updateList = new ArrayList<>();
|
||||
List<ApkEntity> installedList = new ArrayList<>();
|
||||
List<ApkEntity> pluginList = new ArrayList<>();
|
||||
List<ApkEntity> downloadList = new ArrayList<>();
|
||||
List<ApkEntity> noPicList = new ArrayList<>();
|
||||
|
||||
PackageManager packageManager = new PackageManager(context);
|
||||
for (int i = 0, size = apkList.size(); i < size; i++) {
|
||||
@ -459,9 +459,9 @@ public class DownloadDialog {
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
downloadEntry = entryMap.get(apkList.get(i).getUrl());
|
||||
if (downloadEntry != null) {
|
||||
if (downloadEntry.getStatus().equals(DownloadStatus.done)) {
|
||||
downloadEntity = entryMap.get(apkList.get(i).getUrl());
|
||||
if (downloadEntity != null) {
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
doneList.add(apkList.remove(i));
|
||||
} else {
|
||||
downloadList.add(apkList.remove(i));
|
||||
@ -484,7 +484,7 @@ public class DownloadDialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<ApkEntity> list = new ArrayList<ApkEntity>();
|
||||
ArrayList<ApkEntity> list = new ArrayList<>();
|
||||
list.addAll(doneList);
|
||||
list.addAll(updateList);
|
||||
list.addAll(installedList);
|
||||
@ -629,7 +629,7 @@ public class DownloadDialog {
|
||||
DialogUtils.showPluginDialog(context, new DialogUtils.ConfiremListener() {
|
||||
@Override
|
||||
public void onConfirem() {
|
||||
Map<String, Object> kv6 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv6 = new HashMap<>();
|
||||
kv6.put("操作", "点击插件化安装完成");
|
||||
DataUtils.onEvent(context, "插件化", gameName, kv6);
|
||||
|
||||
@ -715,7 +715,7 @@ public class DownloadDialog {
|
||||
//打开下载管理界面
|
||||
context.startActivity(new Intent(context, DownloadManagerActivity.class));
|
||||
} else if ("启动".equals(status)) {
|
||||
Map<String, Object> kv = new HashMap<String, Object>();
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("版本", apkEntity.getPlatform());
|
||||
DataUtils.onEvent(context, "游戏启动", gameName, kv);
|
||||
|
||||
@ -780,10 +780,10 @@ public class DownloadDialog {
|
||||
layerDrawable.setId(0, android.R.id.background);
|
||||
layerDrawable.setId(1, android.R.id.progress);
|
||||
viewHolder.download_item_progressbar.setProgressDrawable(layerDrawable);
|
||||
DownloadEntry downloadEntry = DownloadManager.getInstance(
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance(
|
||||
context).get(apkEntity.getUrl());
|
||||
PackageManager mPackageManager = new PackageManager(context);
|
||||
if (downloadEntry == null) {
|
||||
if (downloadEntity == null) {
|
||||
viewHolder.download_item_progressbar.setProgress(1000);
|
||||
viewHolder.download_item_tv_status.setText("启动");
|
||||
if (!"normal".equals(gameType)
|
||||
@ -793,15 +793,15 @@ public class DownloadDialog {
|
||||
viewHolder.download_item_tv_status.setText("更新");
|
||||
}
|
||||
} else {
|
||||
viewHolder.download_item_progressbar.setProgress((int) (downloadEntry.getPercent() * 10));
|
||||
if (downloadEntry.getMeta().get("isPlugin") != null) {
|
||||
if (downloadEntry.getStatus().equals(DownloadStatus.done)) {
|
||||
viewHolder.download_item_progressbar.setProgress((int) (downloadEntity.getPercent() * 10));
|
||||
if (downloadEntity.isPluggable()) {
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
viewHolder.download_item_tv_status.setText("安装插件");
|
||||
} else {
|
||||
viewHolder.download_item_tv_status.setText("插件化下载中");
|
||||
}
|
||||
} else if (downloadEntry.getMeta().get("isUpdate") != null) {
|
||||
if (downloadEntry.getStatus().equals(DownloadStatus.done)) {
|
||||
} else if (downloadEntity.isUpdate()) {
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
viewHolder.download_item_tv_status.setText("安装更新");
|
||||
} else {
|
||||
viewHolder.download_item_tv_status.setText("更新下载中");
|
||||
@ -809,8 +809,8 @@ public class DownloadDialog {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DownloadEntry downloadEntry = entryMap.get(apkEntity.getUrl());
|
||||
if (downloadEntry != null) {
|
||||
DownloadEntity downloadEntity = entryMap.get(apkEntity.getUrl());
|
||||
if (downloadEntity != null) {
|
||||
viewHolder.download_item_iv_pic.setVisibility(View.GONE);
|
||||
viewHolder.download_item_tv_hint.setVisibility(View.GONE);
|
||||
viewHolder.download_item_progressbar.setVisibility(View.VISIBLE);
|
||||
@ -839,9 +839,9 @@ public class DownloadDialog {
|
||||
layerDrawable.setId(0, android.R.id.background);
|
||||
layerDrawable.setId(1, android.R.id.progress);
|
||||
viewHolder.download_item_progressbar.setProgressDrawable(layerDrawable);
|
||||
viewHolder.download_item_progressbar.setProgress((int) (downloadEntry.getPercent() * 10));
|
||||
viewHolder.download_item_progressbar.setProgress((int) (downloadEntity.getPercent() * 10));
|
||||
|
||||
DownloadStatus status = downloadEntry.getStatus();
|
||||
DownloadStatus status = downloadEntity.getStatus();
|
||||
if (status.equals(DownloadStatus.pause)
|
||||
|| status.equals(DownloadStatus.timeout)
|
||||
|| status.equals(DownloadStatus.neterror)
|
||||
@ -850,7 +850,7 @@ public class DownloadDialog {
|
||||
viewHolder.download_item_tv_status.setText("下载中");
|
||||
} else if (status.equals(DownloadStatus.done)) {
|
||||
EventBus.getDefault().post(new EBPutUrl(PackageUtils.getPackageNameByPath(
|
||||
context, downloadEntry.getPath()), downloadEntry.getUrl()));
|
||||
context, downloadEntity.getPath()), downloadEntity.getUrl()));
|
||||
viewHolder.download_item_tv_status.setText("安装");
|
||||
} else if (status.equals(DownloadStatus.cancel)
|
||||
|| status.equals(DownloadStatus.hijack)) {
|
||||
@ -936,12 +936,12 @@ public class DownloadDialog {
|
||||
|
||||
//安装游戏
|
||||
private void install(ApkEntity apkEntity, int position) {
|
||||
DownloadEntry downloadEntry = DownloadManager.getInstance(
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance(
|
||||
context).get(apkEntity.getUrl());
|
||||
if (downloadEntry != null && downloadEntry.getMeta().get("isPlugin") != null) {
|
||||
Map<String, Object> kv6 = new HashMap<String, Object>();
|
||||
if (downloadEntity != null && downloadEntity.isPluggable()) {
|
||||
Map<String, Object> kv6 = new HashMap<>();
|
||||
kv6.put("操作", "点击安装完成");
|
||||
DataUtils.onEvent(context, "插件化", downloadEntry.getName(), kv6);
|
||||
DataUtils.onEvent(context, "插件化", downloadEntity.getName(), kv6);
|
||||
}
|
||||
|
||||
final String path = entryMap.get(apkEntity.getUrl()).getPath();
|
||||
@ -969,73 +969,71 @@ public class DownloadDialog {
|
||||
|
||||
//下载可更新游戏
|
||||
private void update(ApkEntity apkEntity) {
|
||||
Map<String, Object> kv = new HashMap<String, Object>();
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
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,
|
||||
DownloadEntity downloadEntity = new DownloadEntity();
|
||||
downloadEntity.setUrl(apkEntity.getUrl());
|
||||
downloadEntity.setName(gameName);
|
||||
downloadEntity.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);
|
||||
downloadEntity.setETag(apkEntity.getEtag());
|
||||
downloadEntity.setIcon(gameIcon);
|
||||
downloadEntity.setPlatform(apkEntity.getPlatform());
|
||||
downloadEntity.setUpdate(true);
|
||||
DownloadManager.getInstance(context).add(downloadEntity);
|
||||
}
|
||||
|
||||
//下载插件化游戏
|
||||
private void plugin(ApkEntity apkEntity) {
|
||||
String msg = FileUtils.isCanDownload(apkEntity.getSize());
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
Map<String, Object> kv = new HashMap<String, Object>();
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("版本", apkEntity.getPlatform());
|
||||
kv.put("状态", "下载开始");
|
||||
DataUtils.onEvent(context, "游戏下载", gameName, kv);
|
||||
|
||||
Map<String, Object> kv2 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv2 = new HashMap<>();
|
||||
kv2.put("版本", apkEntity.getPlatform());
|
||||
kv2.put("状态", "下载开始");
|
||||
kv2.put("位置", entrance + "-开始");
|
||||
DataUtils.onEvent(context, "游戏下载位置", gameName, kv2);
|
||||
|
||||
Map<String, Object> kv3 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv3 = new HashMap<>();
|
||||
kv3.put(entrance, "下载数");
|
||||
kv3.put(entrance, "下载开始");
|
||||
DataUtils.onEvent(context, "应用数据", gameName, kv3);
|
||||
|
||||
if ("主页-最新插件".equals(entrance)) {
|
||||
Map<String, Object> kv4 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv4 = new HashMap<>();
|
||||
kv4.put(gameName, "下载数");
|
||||
DataUtils.onEvent(context, "主页数据", "最新插件", kv4);
|
||||
} else if ("主页-热门卡牌".equals(entrance)) {
|
||||
Map<String, Object> kv4 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv4 = new HashMap<>();
|
||||
kv4.put(gameName, "下载数");
|
||||
DataUtils.onEvent(context, "主页数据", "热门卡牌", kv4);
|
||||
} else if ("主页-新测卡牌".equals(entrance)) {
|
||||
Map<String, Object> kv4 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv4 = new HashMap<>();
|
||||
kv4.put(gameName, "下载数");
|
||||
DataUtils.onEvent(context, "主页数据", "新测卡牌", kv4);
|
||||
}
|
||||
|
||||
if (entrance.contains("游戏详情")) {
|
||||
Map<String, Object> kv5 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv5 = new HashMap<>();
|
||||
kv5.put("下载", "下载开始");
|
||||
kv5.put("下载", apkEntity.getPlatform());
|
||||
DataUtils.onEvent(context, "插件数据", gameName, kv5);
|
||||
}
|
||||
|
||||
Map<String, Object> kv6 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv6 = new HashMap<>();
|
||||
kv6.put("下载", "下载开始");
|
||||
kv6.put("版本", apkEntity.getPlatform());
|
||||
DataUtils.onEvent(context, "插件化", gameName, kv6);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("game", gameName);
|
||||
map.put("method", "插件化");
|
||||
map.put("platform", PlatformUtils.getInstance(context)
|
||||
@ -1047,29 +1045,23 @@ public class DownloadDialog {
|
||||
map.put("createdOn", System.currentTimeMillis() / 1000);
|
||||
DataCollectionManager.onEvent(context, "download", map);
|
||||
|
||||
DownloadEntry entry = new DownloadEntry();
|
||||
DownloadEntity downloadEntity = new DownloadEntity();
|
||||
downloadEntity.setUrl(apkEntity.getUrl());
|
||||
downloadEntity.setName(gameName);
|
||||
downloadEntity.setPath(FileUtils.getDownloadPath(context, MD5Utils.getContentMD5(
|
||||
gameName + "_" + System.currentTimeMillis()) + ".apk"));
|
||||
downloadEntity.setETag(apkEntity.getEtag());
|
||||
downloadEntity.setIcon(gameIcon);
|
||||
downloadEntity.setPlatform(apkEntity.getPlatform());
|
||||
downloadEntity.setPluggable(true);
|
||||
downloadEntity.setPackageName(apkEntity.getPackageName());
|
||||
downloadEntity.setGameId(gameId);
|
||||
downloadEntity.setEntrance(entrance);
|
||||
downloadEntity.setLocation(mlocation);
|
||||
|
||||
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("gameId", gameId);
|
||||
meta.put("entrance", entrance);
|
||||
meta.put("location", mlocation);
|
||||
meta.put("isPlugin", "true");
|
||||
meta.put("package_name", apkEntity.getPackageName());
|
||||
meta.put("size", apkEntity.getSize());
|
||||
meta.put("version", apkEntity.getVersion());
|
||||
meta.put("gh_version", apkEntity.getGhVersion());
|
||||
entry.setMeta(meta);
|
||||
DownloadManager.getInstance(context).add(downloadEntity);
|
||||
|
||||
DownloadManager.getInstance(context).add(entry);
|
||||
|
||||
DownloadManager.getInstance(context).putStatus(entry.getUrl(), "downloading");
|
||||
DownloadManager.getInstance(context).putStatus(downloadEntity.getUrl(), "downloading");
|
||||
|
||||
GameUpdateEntity game = new GameUpdateEntity();
|
||||
game.setId(gameId);
|
||||
@ -1081,7 +1073,7 @@ public class DownloadDialog {
|
||||
game.setGhVersion(apkEntity.getGhVersion());
|
||||
game.setUrl(apkEntity.getUrl());
|
||||
game.setPlatform(apkEntity.getPlatform());
|
||||
game.setPlugin(true);
|
||||
game.setPluggable(true);
|
||||
|
||||
PackageManager.addUpdate(game);
|
||||
} else {
|
||||
@ -1093,44 +1085,44 @@ public class DownloadDialog {
|
||||
public void addDownloadEntry(ApkEntity apkEntity, TextView download_item_tv_status) {
|
||||
String msg = FileUtils.isCanDownload(apkEntity.getSize());
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
Map<String, Object> kv = new HashMap<String, Object>();
|
||||
Map<String, Object> kv = new HashMap<>();
|
||||
kv.put("版本", apkEntity.getPlatform());
|
||||
kv.put("状态", "下载开始");
|
||||
DataUtils.onEvent(context, "游戏下载", gameName, kv);
|
||||
|
||||
Map<String, Object> kv2 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv2 = new HashMap<>();
|
||||
kv2.put("版本", apkEntity.getPlatform());
|
||||
kv2.put("状态", "下载开始");
|
||||
kv2.put("位置", entrance + "-开始");
|
||||
DataUtils.onEvent(context, "游戏下载位置", gameName, kv2);
|
||||
|
||||
Map<String, Object> kv3 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv3 = new HashMap<>();
|
||||
kv3.put(entrance, "下载数");
|
||||
kv3.put(entrance, "下载开始");
|
||||
DataUtils.onEvent(context, "应用数据", gameName, kv3);
|
||||
|
||||
if ("主页-最新插件".equals(entrance)) {
|
||||
Map<String, Object> kv4 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv4 = new HashMap<>();
|
||||
kv4.put(gameName, "下载数");
|
||||
DataUtils.onEvent(context, "主页数据", "最新插件", kv4);
|
||||
} else if ("主页-热门卡牌".equals(entrance)) {
|
||||
Map<String, Object> kv4 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv4 = new HashMap<>();
|
||||
kv4.put(gameName, "下载数");
|
||||
DataUtils.onEvent(context, "主页数据", "热门卡牌", kv4);
|
||||
} else if ("主页-新测卡牌".equals(entrance)) {
|
||||
Map<String, Object> kv4 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv4 = new HashMap<>();
|
||||
kv4.put(gameName, "下载数");
|
||||
DataUtils.onEvent(context, "主页数据", "新测卡牌", kv4);
|
||||
}
|
||||
|
||||
if (entrance.contains("游戏详情")) {
|
||||
Map<String, Object> kv5 = new HashMap<String, Object>();
|
||||
Map<String, Object> kv5 = new HashMap<>();
|
||||
kv5.put("下载", "下载量");
|
||||
kv5.put("下载", apkEntity.getPlatform());
|
||||
DataUtils.onEvent(context, "插件数据", gameName, kv5);
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("game", gameName);
|
||||
map.put("method", "正常");
|
||||
map.put("platform", PlatformUtils.getInstance(context)
|
||||
@ -1142,26 +1134,25 @@ public class DownloadDialog {
|
||||
map.put("createdOn", System.currentTimeMillis() / 1000);
|
||||
DataCollectionManager.onEvent(context, "download", map);
|
||||
|
||||
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("gameId", gameId);
|
||||
DownloadEntity downloadEntity = new DownloadEntity();
|
||||
downloadEntity.setUrl(apkEntity.getUrl());
|
||||
downloadEntity.setName(gameName);
|
||||
downloadEntity.setPath(FileUtils.getDownloadPath(context, MD5Utils.getContentMD5(
|
||||
gameName + "_" + System.currentTimeMillis()) + ".apk"));
|
||||
downloadEntity.setETag(apkEntity.getEtag());
|
||||
downloadEntity.setIcon(gameIcon);
|
||||
downloadEntity.setPlatform(apkEntity.getPlatform());
|
||||
downloadEntity.setGameId(gameId);
|
||||
HashMap<String, String> meta = new HashMap<>();
|
||||
meta.put("entrance", entrance);
|
||||
meta.put("location", mlocation);
|
||||
entry.setMeta(meta);
|
||||
downloadEntity.setMeta(meta);
|
||||
|
||||
DownloadManager.getInstance(context).add(entry);
|
||||
DownloadManager.getInstance(context).add(downloadEntity);
|
||||
|
||||
download_item_tv_status.setText("0.0%");
|
||||
|
||||
DownloadManager.getInstance(context).putStatus(entry.getUrl(), "downloading");
|
||||
DownloadManager.getInstance(context).putStatus(downloadEntity.getUrl(), "downloading");
|
||||
} else {
|
||||
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user