This commit is contained in:
kehaoyuan
2020-04-17 16:38:06 +08:00
parent f5f5909fde
commit 3e94cd9d8c
13 changed files with 116 additions and 81 deletions

View File

@ -5,6 +5,8 @@ import android.graphics.Color;
import android.text.TextUtils;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.gh.common.constant.Config;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
@ -19,8 +21,6 @@ import com.lightgame.download.DownloadStatus;
import java.util.List;
import androidx.core.content.ContextCompat;
public class GameUtils {
@ -53,9 +53,12 @@ public class GameUtils {
String status = getDownloadBtnText(context, gameEntity, pluginLocation);
downloadBtn.setTextColor(Color.WHITE);
downloadBtn.setText(status);
if ("插件化".equals(status)) {
if (context.getString(R.string.pluggable).equals(status)) {
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
} else if ("打开".equals(status) || "启动".equals(status)) {
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 {
@ -121,7 +124,7 @@ public class GameUtils {
if (gameEntity.getApk().size() == 1) {
return context.getString(R.string.launch);
} else {
return context.getString(R.string.open);
return context.getString(R.string.expand);
}
} else if (gameEntity.getVersionNumber().contains("无版号")) {
return context.getString(R.string.attempt);
@ -152,6 +155,7 @@ public class GameUtils {
gameUpdateEntity.setPlugin(apkEntity.getPlugin());
gameUpdateEntity.setDownload(gameEntity.getDownload());
gameUpdateEntity.setIndexPlugin(gameEntity.getIndexPlugin());
gameUpdateEntity.setPluginDesc(gameEntity.getPluginDesc());
return gameUpdateEntity;
}