修改下载按钮文案显示逻辑,修改多版本显示顺序逻辑,更换引导图
This commit is contained in:
@ -166,31 +166,34 @@ public class DownloadItemUtils {
|
||||
TextView download_speed,
|
||||
TextView download_percentage,
|
||||
TextView downloadBtn,
|
||||
GameEntity entity,
|
||||
GameEntity gameEntity,
|
||||
boolean isShowPlatform) {
|
||||
|
||||
ArrayMap<String, DownloadEntity> entryMap = entity.getEntryMap();
|
||||
ArrayMap<String, DownloadEntity> entryMap = gameEntity.getEntryMap();
|
||||
|
||||
// 更新下载按钮状态
|
||||
int doneCount = 0; // 下载完成数量
|
||||
int pluginCount = 0; // 可插件化数量
|
||||
int updateCount = 0; // 可更新数量
|
||||
int installCount = 0; // 已安装数量
|
||||
int pluginCount = 0; // 可插件化数量
|
||||
if (entryMap != null && !entryMap.isEmpty()) {
|
||||
DownloadEntity downloadEntity;
|
||||
for (String key : entryMap.keySet()) {
|
||||
if (entryMap.get(key).getStatus().equals(DownloadStatus.done)) {
|
||||
downloadEntity = entryMap.get(key);
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
doneCount++;
|
||||
} else if (downloadEntity.isPluggable()) {
|
||||
pluginCount++;
|
||||
} else if (downloadEntity.isUpdate()) {
|
||||
updateCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ApkEntity apkEntity : entity.getApk()) {
|
||||
if (PackageManager.isCanUpdate(entity.getId(), apkEntity.getPackageName())) {
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
if (PackageManager.isCanUpdate(gameEntity.getId(), apkEntity.getPackageName())) {
|
||||
updateCount++;
|
||||
}
|
||||
}
|
||||
|
||||
for (ApkEntity apkEntity : entity.getApk()) {
|
||||
if (PackageManager.isInstalled(apkEntity.getPackageName())) {
|
||||
if (!PackageUtils.isSignature(context, apkEntity.getPackageName())) {
|
||||
pluginCount++;
|
||||
@ -204,15 +207,15 @@ public class DownloadItemUtils {
|
||||
if (doneCount != 0) {
|
||||
downloadBtn.setText("安装");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
} else if (pluginCount != 0) {
|
||||
downloadBtn.setText("插件化");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
|
||||
} else if (updateCount != 0) {
|
||||
downloadBtn.setText("更新");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
} else if (installCount != 0) {
|
||||
downloadBtn.setText("打开");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_launch_style);
|
||||
} else if (pluginCount != 0) {
|
||||
downloadBtn.setText("插件化");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
|
||||
} else {
|
||||
downloadBtn.setText("下载");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
@ -222,7 +225,7 @@ public class DownloadItemUtils {
|
||||
|
||||
DownloadEntity downloadEntity;
|
||||
|
||||
LinkedBlockingQueue<String> queue = DownloadManager.getInstance(context).getQueue(entity.getName());
|
||||
LinkedBlockingQueue<String> queue = DownloadManager.getInstance(context).getQueue(gameEntity.getName());
|
||||
if (queue != null && !queue.isEmpty()) {
|
||||
downloadEntity = entryMap.get(queue.peek());
|
||||
} else {
|
||||
@ -343,14 +346,10 @@ public class DownloadItemUtils {
|
||||
boolean isShowPlatform) {
|
||||
|
||||
// 控制是否显示下载按钮
|
||||
if (Config.isShow(context)) {
|
||||
downloadBtn.setVisibility(View.VISIBLE);
|
||||
if (!Config.isShow(context) || "光环助手".equals(entity.getName())) {
|
||||
downloadBtn.setVisibility(View.GONE);
|
||||
} else {
|
||||
downloadBtn.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if ("光环助手".equals(entity.getName())) {
|
||||
downloadBtn.setVisibility(View.GONE);
|
||||
downloadBtn.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (entity.getApk() == null || entity.getApk().isEmpty()) {
|
||||
@ -359,6 +358,7 @@ public class DownloadItemUtils {
|
||||
game_ll_info.setVisibility(View.GONE);
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_pause_style);
|
||||
downloadBtn.setText("暂无");
|
||||
downloadBtn.setClickable(false);
|
||||
} else if (entity.getApk().size() == 1) {
|
||||
updateNormalItem(context, textView, game_progressbar, game_ll_info, download_speed,
|
||||
download_percentage, downloadBtn, entity, isShowPlatform);
|
||||
|
||||
Reference in New Issue
Block a user