From 181ff4274c3cdc86bd1880cdda5e7179bf391fc9 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 19 Apr 2023 10:54:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E5=8F=B7=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialog/LiveFontSizeSettingDialog.java | 125 ++++++++++++ .../common/event/CustomDrawerPopupEvent.java | 10 + .../common/views/CustomDrawerPopupView.java | 6 + .../common/views/MoreMenuPopupView.java | 4 +- .../main/res/layout/dialog_live_font_size.xml | 180 ++++++++++++++++++ common/src/main/res/layout/view_more_menu.xml | 8 +- .../main/res/mipmap-mdpi/icon_live_font.png | Bin 0 -> 1357 bytes common/src/main/res/values-zh-rHK/strings.xml | 6 + common/src/main/res/values-zh-rTW/strings.xml | 6 + common/src/main/res/values-zh/strings.xml | 6 + common/src/main/res/values/strings.xml | 6 + config.gradle | 4 +- .../live/activity/LiveAudienceActivity.java | 7 + .../yunbao/live/adapter/LiveChatAdapter.java | 19 +- .../yunbao/live/event/LiveAudienceEvent.java | 4 +- .../live/views/LivePlayRyViewHolder.java | 18 ++ .../yunbao/live/views/LiveRoomViewHolder.java | 4 + 17 files changed, 403 insertions(+), 10 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/dialog/LiveFontSizeSettingDialog.java create mode 100644 common/src/main/res/layout/dialog_live_font_size.xml create mode 100644 common/src/main/res/mipmap-mdpi/icon_live_font.png diff --git a/common/src/main/java/com/yunbao/common/dialog/LiveFontSizeSettingDialog.java b/common/src/main/java/com/yunbao/common/dialog/LiveFontSizeSettingDialog.java new file mode 100644 index 000000000..5cc4318ff --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/LiveFontSizeSettingDialog.java @@ -0,0 +1,125 @@ +package com.yunbao.common.dialog; + +import android.content.Context; +import android.view.View; +import android.widget.ImageView; +import android.widget.PopupMenu; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.XPopup; +import com.yunbao.common.R; +import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import org.greenrobot.eventbus.EventBus; + +public class LiveFontSizeSettingDialog extends AbsDialogPopupWindow { + public static final int FONT_LOW = -1; + public static final int FONT_DEF = 0; + public static final int FONT_HIGH = 1; + private int type = FONT_DEF; + private OnItemClickListener onItemClickListener; + + private RelativeLayout lineSd, lineHd, lineFhd; + private ImageView iconSd, iconHd, iconFhd; + private TextView titleSDText, titleHDText, titleFHDText; + private View submit; + + + public LiveFontSizeSettingDialog(@NonNull Context context, int type) { + super(context); + if (type == 10) { + this.type = FONT_LOW; + } else if (type == 16) { + this.type = FONT_HIGH; + } else { + this.type = FONT_DEF; + } + } + + public LiveFontSizeSettingDialog(@NonNull Context context) { + super(context); + } + + public LiveFontSizeSettingDialog setOnItemClickListener(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + return this; + } + + @Override + public void buildDialog(XPopup.Builder builder) { + + } + + @Override + public int bindLayoutId() { + return R.layout.dialog_live_font_size; + } + + @Override + protected void onCreate() { + super.onCreate(); + lineSd = findViewById(R.id.line_sd); + lineHd = findViewById(R.id.line_hd); + lineFhd = findViewById(R.id.line_fhd); + submit = findViewById(R.id.submit); + iconSd = findViewById(R.id.icon_sd); + iconHd = findViewById(R.id.icon_hd); + iconFhd = findViewById(R.id.icon_fhd); + titleSDText = findViewById(R.id.sd_text); + titleHDText = findViewById(R.id.hd_text); + titleFHDText = findViewById(R.id.fhd_text); + ViewClicksAntiShake.clicksAntiShake(lineSd, () -> { + type = FONT_LOW; + updateUi(); + }); + ViewClicksAntiShake.clicksAntiShake(lineHd, () -> { + type = FONT_DEF; + updateUi(); + }); + ViewClicksAntiShake.clicksAntiShake(lineFhd, () -> { + type = FONT_HIGH; + updateUi(); + }); + ViewClicksAntiShake.clicksAntiShake(submit, () -> { + int fontSize = 13; + if (type == FONT_LOW) { + fontSize = 10; + } else if (type == FONT_HIGH) { + fontSize = 16; + } + onItemClickListener.onItemClick(fontSize, 0); + dismiss(); + }); + updateUi(); + } + + private void updateUi() { + if (type == FONT_DEF) { + iconSd.setVisibility(GONE); + iconFhd.setVisibility(GONE); + iconHd.setVisibility(VISIBLE); + updateUiTextSize(13); + } else if (type == FONT_LOW) { + iconHd.setVisibility(GONE); + iconFhd.setVisibility(GONE); + iconSd.setVisibility(VISIBLE); + updateUiTextSize(10); + } else { + iconSd.setVisibility(GONE); + iconHd.setVisibility(GONE); + iconFhd.setVisibility(VISIBLE); + updateUiTextSize(16); + } + } + + private void updateUiTextSize(int font) { + titleSDText.setTextSize(font); + titleHDText.setTextSize(font); + titleFHDText.setTextSize(font); + } +} diff --git a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java index c9279d3e6..436161b05 100644 --- a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java +++ b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java @@ -27,6 +27,7 @@ public class CustomDrawerPopupEvent extends BaseModel { private boolean smallWindow = false; //畫質選擇 private boolean qualitySelection = false; + private boolean fontSize = false; public boolean isSmallWindow() { return smallWindow; @@ -135,4 +136,13 @@ public class CustomDrawerPopupEvent extends BaseModel { this.effects = effects; return this; } + + public boolean isFontSize() { + return fontSize; + } + + public CustomDrawerPopupEvent setFontSize(boolean fontSize) { + this.fontSize = fontSize; + return this; + } } diff --git a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java index 2b793f583..232ea3a6c 100644 --- a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java +++ b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java @@ -219,6 +219,8 @@ public class CustomDrawerPopupView extends DrawerPopupView { void reportLayout(); void share(); + + void changeFontSize(); } @Subscribe(threadMode = ThreadMode.MAIN) @@ -261,6 +263,10 @@ public class CustomDrawerPopupView extends DrawerPopupView { dismiss(); callBack.changeVideo(); } + if(event.isFontSize()){ + dismiss(); + callBack.changeFontSize(); + } } if (event.isRefresh()) { diff --git a/common/src/main/java/com/yunbao/common/views/MoreMenuPopupView.java b/common/src/main/java/com/yunbao/common/views/MoreMenuPopupView.java index 5b7244ee9..1fb3f0c1e 100644 --- a/common/src/main/java/com/yunbao/common/views/MoreMenuPopupView.java +++ b/common/src/main/java/com/yunbao/common/views/MoreMenuPopupView.java @@ -22,13 +22,13 @@ public class MoreMenuPopupView extends AttachPopupView { @Override protected void onCreate() { - //特效设置 + //字体设置 ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.effects_settings_layout), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { dismiss(); Bus.get().post(new CustomDrawerPopupEvent() - .setDisMiss(true).setEffects(true)); + .setDisMiss(true).setFontSize(true)); } }); //系统通知 diff --git a/common/src/main/res/layout/dialog_live_font_size.xml b/common/src/main/res/layout/dialog_live_font_size.xml new file mode 100644 index 000000000..ffc853ab7 --- /dev/null +++ b/common/src/main/res/layout/dialog_live_font_size.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_more_menu.xml b/common/src/main/res/layout/view_more_menu.xml index 505522dce..dd2de4138 100644 --- a/common/src/main/res/layout/view_more_menu.xml +++ b/common/src/main/res/layout/view_more_menu.xml @@ -1,7 +1,7 @@ + > + android:src="@mipmap/icon_live_font" /> diff --git a/common/src/main/res/mipmap-mdpi/icon_live_font.png b/common/src/main/res/mipmap-mdpi/icon_live_font.png new file mode 100644 index 0000000000000000000000000000000000000000..8d7f4ce658781d1a52825964e051df161b366ab5 G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mN4_aD2hI)I&c|3t@XW#_>N8C2csx@ql|yncGMXXxzi=0 zkE;$^#ZMZO%-k4v5ewCJ6>wYWGa活動中心 基礎工具 特效設置 + 字號設置 屏蔽禮物特效 屏蔽座駕特效 您已在當前直播間 @@ -1119,4 +1120,9 @@ 添加禮物、貴族、守護心願 热度加成 最多只能设置10条 + + 默认 + + 選擇字號大小 + 確認 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 956b12d6c..549ece467 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -912,6 +912,7 @@ 活動中心 基礎工具 特效設置 + 字號設置 屏蔽禮物特效 屏蔽座駕特效 您已在當前直播間 @@ -1119,4 +1120,9 @@ 添加禮物、貴族、守護心願 热度加成 最多只能设置10条 + + 默认 + + 選擇字號大小 + 確認 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 956b12d6c..549ece467 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -912,6 +912,7 @@ 活動中心 基礎工具 特效設置 + 字號設置 屏蔽禮物特效 屏蔽座駕特效 您已在當前直播間 @@ -1119,4 +1120,9 @@ 添加禮物、貴族、守護心願 热度加成 最多只能设置10条 + + 默认 + + 選擇字號大小 + 確認 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 2af8b7a70..c67090979 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -872,6 +872,7 @@ Limited ride And limited avatar frame Activity Basic tools Effect settings + Font settings Shield gift effect Shield car effect You are in the current live room @@ -1125,5 +1126,10 @@ Limited ride And limited avatar frame Where is the host doing badly~\nBrother, are you sure you want to unfollow? follow Heat Add + LOW + DEFAULT + HIGH + Select font size + confirm diff --git a/config.gradle b/config.gradle index 82f2a343d..367862767 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式、 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", //测试 -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 04f310dbd..c37363c58 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -932,6 +932,13 @@ public class LiveAudienceActivity extends LiveActivity { .setBean(mLiveBean) .setType(LiveAudienceEvent.LiveAudienceType.LIVE_SHARE)); } + + @Override + public void changeFontSize() { + Bus.get().post(new LiveAudienceEvent() + .setBean(mLiveBean) + .setType(LiveAudienceEvent.LiveAudienceType.FONT_SIZE)); + } }); new XPopup.Builder(mContext) .hasShadowBg(false) diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 4a4651220..3022cd9c5 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -46,6 +46,7 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.SpUtil; import com.yunbao.common.views.weight.ClipPathCircleImage; import com.yunbao.live.R; import com.yunbao.live.activity.LiveAudienceActivity; @@ -81,6 +82,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { private int mPosition; private boolean isBottom = false; + private int fountSize=13; public LiveChatAdapter(Context context) { mContext = context; @@ -98,6 +100,13 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } } }; + if(SpUtil.getInstance().isExists("pd_live_room_fount_size")){ + try { + fountSize=Integer.parseInt(SpUtil.getStringValue("pd_live_room_fount_size")); + }catch (Exception ignored){ + + } + } } public void setOnItemClickListener(OnItemClickListener onItemClickListener) { @@ -163,6 +172,12 @@ public class LiveChatAdapter extends RecyclerView.Adapter { }); } + public void switchFount(int fount) { + fountSize=fount; + SpUtil.setStringValue("pd_live_room_fount_size",fountSize+""); + notifyDataSetChanged(); + } + class RedPackVh extends RecyclerView.ViewHolder { LinearLayout mBg; @@ -176,6 +191,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { void setData(LiveChatBean bean) { mTextView.setText(bean.getContent()); + mTextView.setTextSize(fountSize); } } @@ -219,7 +235,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } void setData(final LiveChatBean bean, int position) { - + mTextView.setTextSize(fountSize); + automatic_chat.setTextSize(fountSize); itemView.setTag(bean); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(0, 0, DpUtil.dp2px(80), 0); diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 89d8dbbd3..bf09ae1e1 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -339,7 +339,9 @@ public class LiveAudienceEvent extends BaseModel { LIVE_PK_END(60, "PK结束"), XYD_COMPLETE(62, "心愿单完成"), WISH_LIST_PROGRESS(61, "心愿单进度"), - CLOSE_LIVE_ROOM(62, "关闭直播间"); + CLOSE_LIVE_ROOM(62, "关闭直播间"), + FONT_SIZE(63, "侧边字号设置"), + LIVE_FONT_SIZE(64, "字号设置"); private int type; private String name; diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 6399477ad..b373e2152 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -37,9 +37,11 @@ import com.lzf.easyfloat.EasyFloat; import com.lzy.okserver.OkDownload; import com.yunbao.common.Constants; import com.yunbao.common.bean.EnterRoomNewModel; +import com.yunbao.common.dialog.LiveFontSizeSettingDialog; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; @@ -47,6 +49,7 @@ import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.L; import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.ScreenDimenUtil; +import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -882,6 +885,21 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { }) .asCustom(liveClarityCustomPopup) .show(); + } else if (event.getType() == LiveAudienceEvent.LiveAudienceType.FONT_SIZE) { + int fount=0; + try { + fount=Integer.parseInt(SpUtil.getStringValue("pd_live_room_fount_size")); + }catch (Exception ignored){ + + } + new LiveFontSizeSettingDialog(mContext,fount).setOnItemClickListener(new OnItemClickListener() { + @Override + public void onItemClick(Integer bean, int position) { + EventBus.getDefault().post(new LiveAudienceEvent() + .setNums(bean) + .setType(LiveAudienceEvent.LiveAudienceType.LIVE_FONT_SIZE)); + } + }).showDialog(); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 0ce17e7bf..368e7a9d3 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -4261,6 +4261,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis case LIVE_PK_END: showAnchorSayAndCallAnchor(); break; + case LIVE_FONT_SIZE: + int fount = event.getNums(); + mLiveChatAdapter.switchFount(fount); + break; }