Merge remote-tracking branch 'origin/2.0' into 2.0

# Conflicts:
#	app/src/main/java/com/gh/gamecenter/GameDetailActivity.java
#	app/src/main/java/com/gh/gamecenter/NewsDetailActivity.java
#	app/src/main/res/layout/gamedetail_item_top.xml
This commit is contained in:
khy
2016-09-14 17:56:32 +08:00
114 changed files with 3438 additions and 5020 deletions

View File

@ -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;
@ -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;
@ -100,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));
@ -126,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;
@ -194,15 +193,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);
@ -215,12 +214,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;
}
@ -235,7 +234,7 @@ public class DownloadDialog {
isLoadPlatform = false;
init(new ArrayList<ApkEntity>(gameApk));
init(new ArrayList<>(gameApk));
viewPager.addOnPageChangeListener(new OnPageChangeListener() {
@Override
@ -406,9 +405,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);
@ -444,13 +443,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++) {
@ -470,9 +469,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));
@ -495,7 +494,7 @@ public class DownloadDialog {
}
}
}
ArrayList<ApkEntity> list = new ArrayList<ApkEntity>();
ArrayList<ApkEntity> list = new ArrayList<>();
list.addAll(doneList);
list.addAll(updateList);
list.addAll(installedList);
@ -529,23 +528,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 {
@ -639,7 +642,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);
@ -728,7 +731,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);
@ -793,10 +796,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)
@ -806,15 +809,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("更新下载中");
@ -822,8 +825,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);
@ -852,9 +855,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)
@ -863,7 +866,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)) {
@ -955,12 +958,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();
@ -988,73 +991,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)
@ -1066,31 +1067,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);
EventBus.getDefault().post(new EBRedDot(1));
DownloadManager.getInstance(context).putStatus(entry.getUrl(), "downloading");
DownloadManager.getInstance(context).putStatus(downloadEntity.getUrl(), "downloading");
GameUpdateEntity game = new GameUpdateEntity();
game.setId(gameId);
@ -1102,7 +1095,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 {
@ -1114,44 +1107,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)
@ -1163,28 +1156,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%");
EventBus.getDefault().post(new EBRedDot(1));
DownloadManager.getInstance(context).putStatus(entry.getUrl(), "downloading");
DownloadManager.getInstance(context).putStatus(downloadEntity.getUrl(), "downloading");
} else {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}