feat: 优化安装包体积(non-transitive-r) https://jira.shanqu.cc/browse/GHZSCY-6146
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
This commit is contained in:
@ -194,7 +194,7 @@ public class DetailDownloadUtils {
|
||||
|
||||
if (showAsVGame) {
|
||||
// 显示为畅玩游戏
|
||||
if (context.getString(R.string.launch).equals(rawBtnText)) {
|
||||
if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
||||
} else {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
|
||||
@ -203,13 +203,13 @@ public class DetailDownloadUtils {
|
||||
String decoratedBtnText;
|
||||
// 双下载按钮时,显示特殊样式
|
||||
if (showDualDownloadButton
|
||||
&& (context.getString(R.string.launch).equals(rawBtnText) || context.getString(R.string.install).equals(rawBtnText) || context.getString(R.string.smooth).equals(rawBtnText) || context.getString(R.string.update).equals(rawBtnText))) {
|
||||
if (context.getString(R.string.smooth).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(R.string.download_v);
|
||||
} else if (context.getString(R.string.update).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(R.string.update_v);
|
||||
&& (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.smooth).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText))) {
|
||||
if (context.getString(com.gh.gamecenter.feature.R.string.smooth).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.download_v);
|
||||
} else if (context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.update_v);
|
||||
} else {
|
||||
decoratedBtnText = context.getString(R.string.launch_v);
|
||||
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.launch_v);
|
||||
}
|
||||
|
||||
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
|
||||
@ -221,8 +221,8 @@ public class DetailDownloadUtils {
|
||||
decoratedBtnText = rawBtnText + (containsAddWord? "" : downloadAddWord) + getWrappedDownloadSizeText(viewHolder);
|
||||
|
||||
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
|
||||
if (context.getString(R.string.launch).equals(rawBtnText)
|
||||
|| context.getString(R.string.install).equals(rawBtnText)) {
|
||||
if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)
|
||||
|| context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
|
||||
overlayTv.setVisibility(View.VISIBLE);
|
||||
overlayTv.setText("启动(畅玩)");
|
||||
} else {
|
||||
@ -246,11 +246,11 @@ public class DetailDownloadUtils {
|
||||
}
|
||||
} else {
|
||||
// 非畅玩,显示为普通游戏
|
||||
if (context.getString(R.string.pluggable).equals(rawBtnText)) {
|
||||
if (context.getString(com.gh.gamecenter.feature.R.string.pluggable).equals(rawBtnText)) {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.PLUGIN);
|
||||
} else if (context.getString(R.string.launch).equals(rawBtnText)) {
|
||||
} else if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
||||
} else if (context.getString(R.string.install).equals(rawBtnText)) {
|
||||
} else if (context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
|
||||
} else {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
|
||||
@ -278,14 +278,14 @@ public class DetailDownloadUtils {
|
||||
if (viewHolder.isNewsDetail()) {
|
||||
decoratedBtnText = rawBtnText;
|
||||
localBtnText = rawBtnText;
|
||||
} else if (context.getString(R.string.pluggable).equals(rawBtnText)) {
|
||||
} else if (context.getString(com.gh.gamecenter.feature.R.string.pluggable).equals(rawBtnText)) {
|
||||
decoratedBtnText = "升级" + (!containsAddWord ? "" : "至" + downloadAddWord) + getWrappedDownloadSizeText(viewHolder);
|
||||
localBtnText = "升级" + (!containsAddWord ? "" : "至" + downloadAddWord);
|
||||
} else if (context.getString(R.string.launch).equals(rawBtnText)) {
|
||||
} else if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
|
||||
decoratedBtnText = rawBtnText + (!containsAddWord ? "" : "-" + downloadAddWord);
|
||||
localBtnText = context.getString(R.string.launch_local);
|
||||
} else if (context.getString(R.string.attempt).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(R.string.attempt);
|
||||
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.launch_local);
|
||||
} else if (context.getString(com.gh.gamecenter.feature.R.string.attempt).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.attempt);
|
||||
localBtnText = rawBtnText;
|
||||
if (showDualDownloadButton
|
||||
&& viewHolder.getLocalDownloadContainer() != null
|
||||
@ -294,12 +294,12 @@ public class DetailDownloadUtils {
|
||||
} else if (viewHolder.getOverlayTv() != null) {
|
||||
useAlternativeTextStyle = true;
|
||||
}
|
||||
} else if (context.getString(R.string.install).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(R.string.install);
|
||||
localBtnText = context.getString(R.string.install_local);
|
||||
} else if (context.getString(R.string.update).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(R.string.update);
|
||||
localBtnText = context.getString(R.string.update_local);
|
||||
} else if (context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.install);
|
||||
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.install_local);
|
||||
} else if (context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText)) {
|
||||
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.update);
|
||||
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.update_local);
|
||||
if (showDualDownloadButton
|
||||
&& viewHolder.getLocalDownloadContainer() != null
|
||||
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
|
||||
@ -311,7 +311,7 @@ public class DetailDownloadUtils {
|
||||
} else {
|
||||
decoratedBtnText = rawBtnText;
|
||||
}
|
||||
localBtnText = context.getString(R.string.download_local);
|
||||
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.download_local);
|
||||
if (showDualDownloadButton
|
||||
&& viewHolder.getLocalDownloadContainer() != null
|
||||
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
|
||||
@ -346,9 +346,9 @@ public class DetailDownloadUtils {
|
||||
}
|
||||
|
||||
if (overlayTv != null && overlayTv.getVisibility() == View.VISIBLE) {
|
||||
downloadButton.setTag(R.string.download, overlayTv.getText());
|
||||
downloadButton.setTag(com.gh.gamecenter.feature.R.string.download, overlayTv.getText());
|
||||
} else {
|
||||
downloadButton.setTag(R.string.download, downloadButton.getText());
|
||||
downloadButton.setTag(com.gh.gamecenter.feature.R.string.download, downloadButton.getText());
|
||||
}
|
||||
|
||||
if (downloadEntity == null) return;
|
||||
@ -488,7 +488,7 @@ public class DetailDownloadUtils {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
|
||||
break;
|
||||
case waiting:
|
||||
downloadButton.setText(R.string.waiting);
|
||||
downloadButton.setText(com.gh.gamecenter.feature.R.string.waiting);
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
|
||||
break;
|
||||
case overflow:
|
||||
@ -498,12 +498,12 @@ public class DetailDownloadUtils {
|
||||
case diskisfull:
|
||||
case diskioerror:
|
||||
case pause:
|
||||
String pausedText = viewHolder.getContext().getString(R.string.paused);
|
||||
String pausedText = viewHolder.getContext().getString(com.gh.gamecenter.feature.R.string.paused);
|
||||
downloadButton.setText(getValidProgress(downloadEntity) + "% " + pausedText);
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
|
||||
break;
|
||||
case done:
|
||||
String updateText = viewHolder.getContext().getString(R.string.update);
|
||||
String updateText = viewHolder.getContext().getString(com.gh.gamecenter.feature.R.string.update);
|
||||
if (!status.contains(updateText)) {
|
||||
if (VHelper.isInstalled(downloadEntity.getPackageName())) {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
||||
@ -544,7 +544,7 @@ public class DetailDownloadUtils {
|
||||
case diskisfull:
|
||||
case diskioerror:
|
||||
case overflow:
|
||||
String pausedText = context.getString(R.string.paused);
|
||||
String pausedText = context.getString(com.gh.gamecenter.feature.R.string.paused);
|
||||
String downloadingText = SpeedUtils.getSpeed(downloadEntity.getSpeed());
|
||||
String resumeText = getValidProgress(downloadEntity) + "% " + pausedText;
|
||||
downloadButton.setText((downloadEntity.getStatus() == DownloadStatus.downloading || downloadEntity.getStatus() == DownloadStatus.redirected) ? downloadingText : resumeText);
|
||||
@ -555,7 +555,7 @@ public class DetailDownloadUtils {
|
||||
}
|
||||
break;
|
||||
case waiting:
|
||||
downloadButton.setText(R.string.waiting);
|
||||
downloadButton.setText(com.gh.gamecenter.feature.R.string.waiting);
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
|
||||
break;
|
||||
case done:
|
||||
@ -563,21 +563,21 @@ public class DetailDownloadUtils {
|
||||
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(context, gameEntity.getSimulator().getApk().getPackageName());
|
||||
boolean isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(context);
|
||||
if (isInstalled || isInstalledNewSimulator) {
|
||||
downloadButton.setText(R.string.launch);
|
||||
downloadButton.setText(com.gh.gamecenter.feature.R.string.launch);
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
||||
} else {
|
||||
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
|
||||
downloadButton.setText(R.string.browser_install_install);
|
||||
downloadButton.setText(com.gh.gamecenter.feature.R.string.browser_install_install);
|
||||
} else {
|
||||
downloadButton.setText(R.string.install);
|
||||
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
|
||||
}
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
|
||||
}
|
||||
} else {
|
||||
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
|
||||
downloadButton.setText(R.string.browser_install_install);
|
||||
downloadButton.setText(com.gh.gamecenter.feature.R.string.browser_install_install);
|
||||
} else {
|
||||
downloadButton.setText(R.string.install);
|
||||
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,7 +617,7 @@ public class DetailDownloadUtils {
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_UNZIPPING);
|
||||
return true;
|
||||
} else if (XapkUnzipStatus.FAILURE.name().equals(xapkStatus)) {
|
||||
downloadButton.setText(R.string.install);
|
||||
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
|
||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_FAILURE);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user