feat: 优化安装包体积(non-transitive-r) https://jira.shanqu.cc/browse/GHZSCY-6146

Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
This commit is contained in:
chenjuntao
2024-09-11 15:43:34 +08:00
parent 04331b8881
commit 45242baa8b
687 changed files with 3270 additions and 3529 deletions

View File

@ -91,13 +91,13 @@ public class DialogUtils {
context = checkDialogContext(context);
Dialog dialog = new Dialog(context);
View view = View.inflate(context, R.layout.set_wait_dialog, null);
TextView message = view.findViewById(R.id.set_wait_message);
View view = View.inflate(context, com.gh.gamecenter.common.R.layout.set_wait_dialog, null);
TextView message = view.findViewById(com.gh.gamecenter.common.R.id.set_wait_message);
message.setText(msg);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setBackgroundDrawableResource(R.drawable.background_shape_white_radius_8);
dialog.getWindow().setBackgroundDrawableResource(com.gh.gamecenter.common.R.drawable.background_shape_white_radius_8);
WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
layoutParams.width = DisplayUtils.dip2px(160);
dialog.getWindow().setAttributes(layoutParams);
@ -159,7 +159,7 @@ public class DialogUtils {
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_download_traffic, null);
View allowOnce = contentView.findViewById(R.id.allow_once);
@ -255,7 +255,7 @@ public class DialogUtils {
final ConfirmListener cmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_community, null);
View contentContainer = contentView.findViewById(R.id.content_container);
@ -314,7 +314,7 @@ public class DialogUtils {
EmptyCallback callback) {
final Context activityContext = checkDialogContext(context);
final Dialog dialog = new Dialog(activityContext, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(activityContext, com.lg.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(activityContext).inflate(R.layout.dialog_disallow_privacy_policy, null);
View backButton = contentView.findViewById(R.id.back_button);
@ -350,14 +350,14 @@ public class DialogUtils {
final ConfirmListener cmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_video_upload_draft, null);
TextView negativeTv = contentView.findViewById(R.id.negative);
TextView positiveTv = contentView.findViewById(R.id.positive);
TextView content = contentView.findViewById(R.id.content);
positiveTv.setBackground(DrawableView.getOvalDrawable(R.color.ui_background, 999));
negativeTv.setBackground(DrawableView.getOvalDrawable(R.color.primary_theme, 999));
positiveTv.setBackground(DrawableView.getOvalDrawable(com.gh.gamecenter.common.R.color.ui_background, 999));
negativeTv.setBackground(DrawableView.getOvalDrawable(com.gh.gamecenter.common.R.color.primary_theme, 999));
content.setText(Html.fromHtml(context.getString(R.string.video_upload_draft_dialog_content)));
negativeTv.setOnClickListener(view -> {
@ -407,7 +407,7 @@ public class DialogUtils {
context = checkDialogContext(context);
final TrackableDialog dialog = new TrackableDialog(context,
R.style.GhAlertDialog,
com.gh.gamecenter.common.R.style.GhAlertDialog,
trackableEntity.getEvent(),
trackableEntity.getKey(),
trackableEntity.getValue(),
@ -423,7 +423,7 @@ public class DialogUtils {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
} else {
contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
contentView = LayoutInflater.from(context).inflate(com.gh.gamecenter.common.R.layout.dialog_alert, null);
}
TextView contentTv = contentView.findViewById(R.id.dialog_content);
@ -478,7 +478,7 @@ public class DialogUtils {
public static Dialog showUsageStatsDialog(Context context, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_usage_stats, null);
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
@ -518,7 +518,7 @@ public class DialogUtils {
public static void showDownloadMutexDialog(Context context) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_downlaod_mutex, null);
TextView positive = contentView.findViewById(R.id.dialog_positive);
@ -558,7 +558,7 @@ public class DialogUtils {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
@ -625,7 +625,7 @@ public class DialogUtils {
public static void showLandPageAddressDialog(Context context, GameEntity gameEntity, @NonNull ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
@ -696,7 +696,7 @@ public class DialogUtils {
public static void showGameH5DownloadDialog(Context context, GameEntity gameEntity, RegionSetting.GameH5Download gameH5Download) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
@ -737,7 +737,7 @@ public class DialogUtils {
params = window.getAttributes();
params.width = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.9);
window.setAttributes(params);
window.setBackgroundDrawableResource(R.drawable.textview_white_up);
window.setBackgroundDrawableResource(com.gh.gamecenter.common.R.drawable.textview_white_up);
}
inflate.findViewById(R.id.imprint_close).setOnClickListener(v -> dialog.dismiss());
@ -767,7 +767,7 @@ public class DialogUtils {
// close line
View view = new View(context);
view.setBackgroundColor(context.getResources().getColor(R.color.text_5d5d5d));
view.setBackgroundColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_5d5d5d));
view.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(1)));
content.addView(view);
}
@ -775,7 +775,7 @@ public class DialogUtils {
public static void showKaifuRemindDialog(Context context, String content, String gameName) {
context = checkDialogContext(context);
final Dialog dialog = new TrackableDialog(context, R.style.GhAlertDialog, "开服说明弹窗", "弹窗", gameName, null, null, true);
final Dialog dialog = new TrackableDialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog, "开服说明弹窗", "弹窗", gameName, null, null, true);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_kaifu_remind, null);
@ -805,7 +805,7 @@ public class DialogUtils {
public static void showStopServerExplanationDialog(Context context, String content, String gameName) {
context = checkDialogContext(context);
final Dialog dialog = new TrackableDialog(context, R.style.GhAlertDialog, "评论说明弹窗", "弹窗", gameName, null, null, true);
final Dialog dialog = new TrackableDialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog, "评论说明弹窗", "弹窗", gameName, null, null, true);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_stop_service_explanation, null);
@ -850,7 +850,7 @@ public class DialogUtils {
final Dialog dialog = new TrackableDialog(
context,
R.style.GhAlertDialog,
com.gh.gamecenter.common.R.style.GhAlertDialog,
"礼仪考试",
"礼仪考试弹窗",
null, null, null,
@ -904,9 +904,9 @@ public class DialogUtils {
public static void showNoticeDialog(Context context, String title, String content, @NonNull ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_notice, null);
View contentView = LayoutInflater.from(context).inflate(com.gh.gamecenter.common.R.layout.dialog_notice, null);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
@ -931,7 +931,7 @@ public class DialogUtils {
public static void showViewBadgeDialog(Context context, Badge badge, ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_view_badge, null);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
@ -952,7 +952,7 @@ public class DialogUtils {
});
}
Animation animation = AnimationUtils.loadAnimation(context, R.anim.anim_badge_light_bg);
Animation animation = AnimationUtils.loadAnimation(context, com.gh.gamecenter.common.R.anim.anim_badge_light_bg);
badgeLightBg.startAnimation(animation);
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
@ -969,7 +969,7 @@ public class DialogUtils {
public static void showReceiveBadgeDialog(Context context, BadgeEntity badge, ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_receive_badge, null);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
@ -999,7 +999,7 @@ public class DialogUtils {
receiveTv.setText(R.string.apply_badge);
}
Animation animation = AnimationUtils.loadAnimation(context, R.anim.anim_badge_light_bg);
Animation animation = AnimationUtils.loadAnimation(context, com.gh.gamecenter.common.R.anim.anim_badge_light_bg);
badgeLightBg.startAnimation(animation);
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
@ -1016,7 +1016,7 @@ public class DialogUtils {
public static void showPassRegulationDialog(Context context, String icon) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_pass_regulation, null);
SimpleDraweeView userIcon = contentView.findViewById(R.id.dialog_icon);
@ -1035,7 +1035,7 @@ public class DialogUtils {
public static void showShortCutPermissionDialog(Context context) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_shortcut_permission, null);
@ -1060,7 +1060,7 @@ public class DialogUtils {
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_cancel_reservation, null);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
@ -1101,11 +1101,11 @@ public class DialogUtils {
public static void showSimulatorParseErrorDialog(Context context, String gameId, String gameName, ConfirmListener confirmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
DialogPackageParseErrorBinding binding = DialogPackageParseErrorBinding.inflate(LayoutInflater.from(context), null, false);
Context finalContext = context;
SpannableStringBuilder builder = new SpanBuilder("您也可以点击提交反馈跟我们联系").click(context, 6, 10, R.color.text_theme, true, new Function0<Unit>() {
SpannableStringBuilder builder = new SpanBuilder("您也可以点击提交反馈跟我们联系").click(context, 6, 10, com.gh.gamecenter.common.R.color.text_theme, true, new Function0<Unit>() {
@Override
public Unit invoke() {
SimpleGameEntity entity = new SimpleGameEntity(gameId, gameName, "", "");
@ -1145,7 +1145,7 @@ public class DialogUtils {
public static void showReportReasonDialog(Context context, ArrayList<String> items, String title, ReportReasonCallBack callBack) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
DialogReportReasonBinding binding = DialogReportReasonBinding.inflate(LayoutInflater.from(context));
if (!title.isEmpty()) {
@ -1164,7 +1164,7 @@ public class DialogUtils {
return null;
});
binding.reasonRv.setLayoutManager(new LinearLayoutManager(context));
binding.reasonRv.addItemDecoration(new VerticalItemDecoration(context, 1F, false, R.color.ui_background));
binding.reasonRv.addItemDecoration(new VerticalItemDecoration(context, 1F, false, com.gh.gamecenter.common.R.color.ui_background));
binding.reasonRv.setAdapter(reportReasonAdapter);
binding.negativeBtn.setOnClickListener(v -> {
@ -1186,7 +1186,7 @@ public class DialogUtils {
ExtensionsKt.setTextChangedListener(binding.otherReasonEt, (s, start, before, count) -> {
int tvCount = s.length();
if (tvCount >= 500) {
binding.tvCount.setTextColor(ContextCompat.getColor(finalContext, R.color.secondary_red));
binding.tvCount.setTextColor(ContextCompat.getColor(finalContext, com.gh.gamecenter.common.R.color.secondary_red));
}
binding.tvCount.setText(tvCount + "/500");
return null;
@ -1200,7 +1200,7 @@ public class DialogUtils {
public static Dialog showBindPhoneDialog(Context context, ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
DialogBindPhoneBinding binding = DialogBindPhoneBinding.inflate(LayoutInflater.from(context));
binding.positiveTv.setOnClickListener(v -> {
@ -1221,7 +1221,7 @@ public class DialogUtils {
public static void showReserveOrVoteSuccess2WechatBindDialog(Context context, Boolean isReserve, ConfirmListener confirmListener, CancelListener cancelListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
DialogWechatReserveSuccessBinding binding = DialogWechatReserveSuccessBinding.inflate(LayoutInflater.from(context));
binding.titleIv.setImageResource(isReserve ? R.drawable.bg_reserve_success : R.drawable.bg_vote_success);
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心收到通知。为了避免错过通知,建议您开启微信公众号提醒": "版本上线时,您将在消息中心收到通知。为了避免错过通知,亦建议您开启微信公众号提醒");
@ -1248,7 +1248,7 @@ public class DialogUtils {
public static void showReserveOrVoteSuccessDialog(Context context, Boolean isReserve) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
DialogAlertDefaultBinding binding = DialogAlertDefaultBinding.inflate(LayoutInflater.from(context));
binding.titleTv.setText(isReserve ? "游戏预约成功" : "版本投票成功");
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心和微信公众号收到通知,不会错过任何预约的游戏" : "版本上线时,您将在消息中心和微信公众号收到通知,不会错过任何投票的版本");
@ -1272,7 +1272,7 @@ public class DialogUtils {
public static void showRelievePhoneDialog(Context context) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.lg.common.R.style.DialogWindowTransparent);
DialogRelievePhoneBinding binding = DialogRelievePhoneBinding.inflate(LayoutInflater.from(context));
Context finalContext = context;