修改下载按钮文案显示逻辑,修改多版本显示顺序逻辑,更换引导图
This commit is contained in:
@ -276,49 +276,45 @@ public class DownloadDialog implements OnCollectionCallBackListener {
|
||||
}
|
||||
|
||||
private ArrayList<ApkEntity> sortApk(List<ApkEntity> apkList) {
|
||||
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<>();
|
||||
List<ApkEntity> pluginDoneList = new ArrayList<>(); // 安装插件
|
||||
List<ApkEntity> pluginDownloadList = new ArrayList<>(); // 插件化下载中
|
||||
List<ApkEntity> pluginList = new ArrayList<>(); // 插件化
|
||||
List<ApkEntity> updateDoneList = new ArrayList<>(); // 安装更新
|
||||
List<ApkEntity> updateDownloadList = new ArrayList<>(); // 更新下载中
|
||||
List<ApkEntity> updateList = new ArrayList<>(); // 更新
|
||||
List<ApkEntity> doneList = new ArrayList<>(); // 安装
|
||||
List<ApkEntity> downloadList = new ArrayList<>(); // 下载中
|
||||
List<ApkEntity> installList = new ArrayList<>(); // 启动
|
||||
List<ApkEntity> noPicList = new ArrayList<>(); // 默认(无图片)
|
||||
|
||||
DownloadEntity downloadEntity;
|
||||
String packageName;
|
||||
Object gh_id;
|
||||
for (int i = 0, size = apkList.size(); i < size; i++) {
|
||||
String packageName = apkList.get(i).getPackageName();
|
||||
Object gh_id = PackageUtils.getMetaData(context, packageName, "gh_id");
|
||||
if (PackageManager.isInstalled(packageName)
|
||||
&& (gh_id == null || gh_id.equals(gameEntity.getId()))) {
|
||||
if (PackageManager.isCanUpdate(gameEntity.getId(), packageName)) {
|
||||
updateList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
} else if (!PackageUtils.isSignature(context, packageName)) {
|
||||
pluginList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
} else {
|
||||
installedList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
downloadEntity = DownloadManager.getInstance(context).get(apkList.get(i).getUrl());
|
||||
if (downloadEntity != null) {
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
doneList.add(apkList.remove(i));
|
||||
downloadEntity = DownloadManager.getInstance(context).get(apkList.get(i).getUrl());
|
||||
packageName = apkList.get(i).getPackageName();
|
||||
gh_id = PackageUtils.getMetaData(context, packageName, "gh_id");
|
||||
if (downloadEntity == null) {
|
||||
if (PackageManager.isInstalled(packageName)
|
||||
&& (gh_id == null || gh_id.equals(gameEntity.getId()))) {
|
||||
if (PackageManager.isCanUpdate(gameEntity.getId(), packageName)) {
|
||||
updateList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
} else if (!PackageUtils.isSignature(context, packageName)) {
|
||||
pluginList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
} else {
|
||||
downloadList.add(apkList.remove(i));
|
||||
installList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
}
|
||||
size--;
|
||||
i--;
|
||||
} else {
|
||||
String platform = apkList.get(i).getPlatform();
|
||||
int id = PlatformUtils.getInstance(context).getPlatformPic(
|
||||
platform);
|
||||
int id = PlatformUtils.getInstance(context).getPlatformPic(platform);
|
||||
if (id == 0) {
|
||||
String path = PlatformUtils.getInstance(context)
|
||||
.getPlatformPicPath(platform);
|
||||
String path = PlatformUtils.getInstance(context).getPlatformPicPath(platform);
|
||||
if (path == null) {
|
||||
noPicList.add(apkList.remove(i));
|
||||
size--;
|
||||
@ -326,14 +322,48 @@ public class DownloadDialog implements OnCollectionCallBackListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
if (downloadEntity.isPluggable()) {
|
||||
pluginDoneList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
} else if (downloadEntity.isUpdate()) {
|
||||
updateDoneList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
} else {
|
||||
doneList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
if (downloadEntity.isPluggable()) {
|
||||
pluginDownloadList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
} else if (downloadEntity.isUpdate()) {
|
||||
updateDownloadList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
} else {
|
||||
downloadList.add(apkList.remove(i));
|
||||
size--;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<ApkEntity> list = new ArrayList<>();
|
||||
list.addAll(doneList);
|
||||
list.addAll(updateList);
|
||||
list.addAll(installedList);
|
||||
list.addAll(pluginDoneList);
|
||||
list.addAll(pluginDownloadList);
|
||||
list.addAll(pluginList);
|
||||
list.addAll(updateDoneList);
|
||||
list.addAll(updateDownloadList);
|
||||
list.addAll(updateList);
|
||||
list.addAll(doneList);
|
||||
list.addAll(downloadList);
|
||||
list.addAll(installList);
|
||||
list.addAll(apkList);
|
||||
list.addAll(noPicList);
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user