同步2.2修改
This commit is contained in:
@ -21,7 +21,6 @@ import com.gh.download.DownloadManager;
|
||||
import com.gh.download.DownloadStatus;
|
||||
import com.gh.gamecenter.DownloadManagerActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.manager.PackageManager;
|
||||
|
||||
@ -166,58 +165,9 @@ public class DownloadItemUtils {
|
||||
GameEntity gameEntity,
|
||||
boolean isShowPlatform) {
|
||||
|
||||
GameUtils.setDownloadBtnStatus(context, gameEntity, downloadBtn);
|
||||
|
||||
ArrayMap<String, DownloadEntity> entryMap = gameEntity.getEntryMap();
|
||||
|
||||
// 更新下载按钮状态
|
||||
int doneCount = 0; // 下载完成数量
|
||||
int pluginCount = 0; // 可插件化数量
|
||||
int updateCount = 0; // 可更新数量
|
||||
int installCount = 0; // 已安装数量
|
||||
if (entryMap != null && !entryMap.isEmpty()) {
|
||||
DownloadEntity downloadEntity;
|
||||
for (String key : entryMap.keySet()) {
|
||||
downloadEntity = entryMap.get(key);
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
doneCount++;
|
||||
} else if (downloadEntity.isPluggable()) {
|
||||
pluginCount++;
|
||||
} else if (downloadEntity.isUpdate()) {
|
||||
updateCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
if (PackageManager.isCanUpdate(gameEntity.getId(), apkEntity.getPackageName())) {
|
||||
updateCount++;
|
||||
}
|
||||
if (PackageManager.isInstalled(apkEntity.getPackageName())) {
|
||||
if (!PackageUtils.isSignature(context, apkEntity.getPackageName())) {
|
||||
pluginCount++;
|
||||
} else {
|
||||
installCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
downloadBtn.setTextColor(Color.WHITE);
|
||||
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 {
|
||||
downloadBtn.setText("下载");
|
||||
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
}
|
||||
|
||||
if (entryMap != null && !entryMap.isEmpty()) {
|
||||
|
||||
DownloadEntity downloadEntity;
|
||||
|
||||
Reference in New Issue
Block a user