修改下载按钮样式

This commit is contained in:
kehaoyuan@ghzhushou.com
2020-04-20 18:38:12 +08:00
parent 1c118b06c9
commit 2038b16dce
18 changed files with 86 additions and 63 deletions

View File

@ -57,15 +57,12 @@ public class GameUtils {
downloadBtn.setTextColor(Color.WHITE);
downloadBtn.setText(status);
if (context.getString(R.string.pluggable).equals(status)) {
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
downloadBtn.setBackgroundResource(R.drawable.download_button_pluggable_style);
String pluginDesc = gameEntity.getPluginDesc();
if (pluginDesc.length() > 3) pluginDesc = pluginDesc.substring(0, 3);
downloadBtn.setText((pluginDesc + ""));
} else if (context.getString(R.string.launch).equals(status) || context.getString(R.string.expand).equals(status)) {
downloadBtn.setBackgroundResource(R.drawable.detail_download_open_style);
downloadBtn.setTextColor(ContextCompat.getColor(context, R.color.theme_font));
} else {
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
downloadBtn.setBackgroundResource(R.drawable.download_button_normal_style);
}
}
@ -73,6 +70,10 @@ public class GameUtils {
* 获取下载按钮文案
*/
public static String getDownloadBtnText(Context context, GameEntity gameEntity, PluginLocation pluginLocation) {
if (gameEntity.getApk().size() > 1) {
return context.getString(R.string.expand);
}
int doneCount = 0; // 下载完成数量
int pluginCount = 0; // 可插件化数量
int updateCount = 0; // 可更新数量
@ -124,11 +125,7 @@ public class GameUtils {
} else if (updateCount != 0) {
return context.getString(R.string.update);
} else if (installCount != 0) {
if (gameEntity.getApk().size() == 1) {
return context.getString(R.string.launch);
} else {
return context.getString(R.string.expand);
}
return context.getString(R.string.launch);
} else if (gameEntity.getVersionNumber().contains("无版号")) {
return context.getString(R.string.attempt);
} else {