This commit is contained in:
kehaoyuan
2018-10-09 17:48:16 +08:00
parent a24482d9b3
commit 65a4de0e33
11 changed files with 59 additions and 88 deletions

View File

@ -47,13 +47,13 @@ public class GameUtils {
/**
* 设置下载按钮状态
*/
public static void setDownloadBtnStatus(Context context, GameEntity gameEntity, TextView downloadBtn) {
String status = getDownloadBtnText(context, gameEntity);
public static void setDownloadBtnStatus(Context context, GameEntity gameEntity, TextView downloadBtn, PluginLocation pluginLocation) {
String status = getDownloadBtnText(context, gameEntity, pluginLocation);
downloadBtn.setTextColor(Color.WHITE);
downloadBtn.setText(status);
if ("插件化".equals(status)) {
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
} else if ("打开".equals(status)) {
} else if ("打开".equals(status) || "启动".equals(status)) {
downloadBtn.setBackgroundResource(R.drawable.detail_downloading_normal_style);
downloadBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
} else {
@ -64,7 +64,7 @@ public class GameUtils {
/**
* 获取下载按钮文案
*/
public static String getDownloadBtnText(Context context, GameEntity gameEntity) {
public static String getDownloadBtnText(Context context, GameEntity gameEntity, PluginLocation pluginLocation) {
int doneCount = 0; // 下载完成数量
int pluginCount = 0; // 可插件化数量
int updateCount = 0; // 可更新数量
@ -99,7 +99,7 @@ public class GameUtils {
if (gameEntity.getTag() != null && gameEntity.getTag().size() != 0
&& !TextUtils.isEmpty(apkEntity.getGhVersion())
&& !PackageUtils.isSignature(context, apkEntity.getPackageName())
&& apkEntity.isShowPlugin(PluginLocation.only_game)) {
&& apkEntity.isShowPlugin(pluginLocation)) {
pluginCount++;
} else if (gh_id == null || gh_id.equals(gameEntity.getId())) {
installCount++;
@ -113,7 +113,11 @@ public class GameUtils {
} else if (updateCount != 0) {
return "更新";
} else if (installCount != 0) {
return "打开";
if (gameEntity.getApk().size() == 1) {
return "启动";
} else {
return "打开";
}
} else {
return "下载";
}