同步2.2修改
This commit is contained in:
@ -17,6 +17,7 @@ import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.FileUtils;
|
||||
import com.gh.common.util.GameUtils;
|
||||
import com.gh.common.util.NetworkUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.ShareUtils;
|
||||
@ -24,7 +25,6 @@ import com.gh.common.view.DownloadDialog;
|
||||
import com.gh.download.DataWatcher;
|
||||
import com.gh.download.DownloadEntity;
|
||||
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;
|
||||
@ -231,49 +231,12 @@ public abstract class BaseDetailActivity extends BaseActivity implements View.On
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int doneCount = 0; // 下载完成数量
|
||||
int pluginCount = 0; // 可插件化数量
|
||||
int updateCount = 0; // 可更新数量
|
||||
int installCount = 0; // 已安装数量
|
||||
DownloadEntity downloadEntity;
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
downloadEntity = DownloadManager.getInstance(this).get(apkEntity.getUrl());
|
||||
if (downloadEntity != null) {
|
||||
if (downloadEntity.getStatus().equals(DownloadStatus.done)) {
|
||||
doneCount++;
|
||||
} else if (downloadEntity.isPluggable()) {
|
||||
pluginCount++;
|
||||
} else if (downloadEntity.isUpdate()) {
|
||||
updateCount++;
|
||||
}
|
||||
}
|
||||
if (PackageManager.isCanUpdate(gameEntity.getId(), apkEntity.getPackageName())) {
|
||||
updateCount++;
|
||||
}
|
||||
if (PackageManager.isInstalled(apkEntity.getPackageName())) {
|
||||
if (!PackageUtils.isSignature(this, apkEntity.getPackageName())) {
|
||||
pluginCount++;
|
||||
} else {
|
||||
installCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String status;
|
||||
if (doneCount != 0) {
|
||||
status = "安装";
|
||||
detail_tv_download.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
} else if (pluginCount != 0) {
|
||||
status = "插件化";
|
||||
String status = GameUtils.getDownloadBtnText(this, gameEntity);
|
||||
if ("插件化".equals(status)) {
|
||||
detail_tv_download.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
|
||||
} else if (updateCount != 0) {
|
||||
status = "更新";
|
||||
detail_tv_download.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
} else if (installCount != 0) {
|
||||
status = "打开";
|
||||
} else if ("打开".equals(status)) {
|
||||
detail_tv_download.setBackgroundResource(R.drawable.game_item_btn_launch_style);
|
||||
} else {
|
||||
status = "下载";
|
||||
detail_tv_download.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user