新增字号设置

This commit is contained in:
zlzw 2023-04-19 10:54:22 +08:00
parent 369f3f2cae
commit 181ff4274c
17 changed files with 403 additions and 10 deletions

View File

@ -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<Integer> 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<Integer> 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);
}
}

View File

@ -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;
}
}

View File

@ -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()) {

View File

@ -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));
}
});
//系统通知

View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="249dp"
android:background="@drawable/bg_live_tota"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/dialog_live_fount_title"
app:layout_constraintEnd_toEndOf="parent"
android:textColor="#F6F7FB"
android:textSize="17sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dialog_fount_submit"
android:textColor="#FFC621"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginRight="10dp"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical">
<RelativeLayout
android:id="@+id/line_fhd"
android:layout_width="0dp"
android:layout_height="137dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_definition"
android:orientation="vertical">
<ImageView
android:id="@+id/icon_fhd"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentEnd="true"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:visibility="gone"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:src="@mipmap/icon_selected" />
<ImageView
android:id="@+id/fhd"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:visibility="gone"
android:src="@mipmap/icon_sd" />
<TextView
android:id="@+id/fhd_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/fhd"
android:layout_centerInParent="true"
android:layout_marginTop="4dp"
android:text="@string/live_room_chat_fount_size_high"
android:textColor="#F6F7FB"
android:textSize="16sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/line_hd"
android:layout_width="0dp"
android:layout_height="137dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_definition"
android:orientation="vertical">
<ImageView
android:id="@+id/icon_hd"
android:layout_width="14dp"
android:layout_height="14dp"
android:visibility="gone"
android:layout_alignParentEnd="true"
android:layout_margin="10dp"
android:src="@mipmap/icon_selected" />
<ImageView
android:id="@+id/hd"
android:layout_width="32dp"
android:layout_height="32dp"
android:visibility="gone"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:src="@mipmap/icon_hd" />
<TextView
android:id="@+id/hd_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/hd"
android:layout_centerInParent="true"
android:layout_marginTop="4dp"
android:text="@string/live_room_chat_fount_size_def"
android:textColor="#F6F7FB"
android:textSize="16sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/line_sd"
android:layout_width="0dp"
android:layout_height="137dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:background="@drawable/bg_btn_definition"
android:orientation="vertical">
<ImageView
android:id="@+id/icon_sd"
android:layout_width="14dp"
android:visibility="gone"
android:layout_height="14dp"
android:layout_alignParentEnd="true"
android:layout_margin="10dp"
android:src="@mipmap/icon_selected" />
<ImageView
android:id="@+id/sd"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:visibility="gone"
android:src="@mipmap/icon_fhd" />
<TextView
android:id="@+id/sd_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/sd"
android:layout_centerInParent="true"
android:layout_marginTop="4dp"
android:text="@string/live_room_chat_fount_size_low"
android:textColor="#F6F7FB"
android:textSize="16sp" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:visibility="gone"
android:text="@string/clarity_hint"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="170dp"
android:layout_width="220dp"
android:layout_height="62dp"
app:cardBackgroundColor="#0F0B14"
app:cardCornerRadius="4dp"
@ -19,18 +19,18 @@
android:layout_marginStart="10dp"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
>
<ImageView
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@mipmap/live_more_icon_special_new" />
android:src="@mipmap/icon_live_font" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/effects_settings"
android:text="@string/live_chat_font_settings"
android:textColor="#FF9A9A9A"
android:textSize="10sp" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -912,6 +912,7 @@
<string name="activity_center">活動中心</string>
<string name="basic_tools">基礎工具</string>
<string name="effects_settings">特效設置</string>
<string name="live_chat_font_settings">字號設置</string>
<string name="shield_gift_effect">屏蔽禮物特效</string>
<string name="shield_mount_effect">屏蔽座駕特效</string>
<string name="current_live_room">您已在當前直播間</string>
@ -1119,4 +1120,9 @@
<string name="add_gift2">添加禮物、貴族、守護心願</string>
<string name="heat_add">热度加成</string>
<string name="must_hint">最多只能设置10条</string>
<string name="live_room_chat_fount_size_low"></string>
<string name="live_room_chat_fount_size_def">默认</string>
<string name="live_room_chat_fount_size_high"></string>
<string name="dialog_live_fount_title">選擇字號大小</string>
<string name="dialog_fount_submit">確認</string>
</resources>

View File

@ -912,6 +912,7 @@
<string name="activity_center">活動中心</string>
<string name="basic_tools">基礎工具</string>
<string name="effects_settings">特效設置</string>
<string name="live_chat_font_settings">字號設置</string>
<string name="shield_gift_effect">屏蔽禮物特效</string>
<string name="shield_mount_effect">屏蔽座駕特效</string>
<string name="current_live_room">您已在當前直播間</string>
@ -1119,4 +1120,9 @@
<string name="add_gift2">添加禮物、貴族、守護心願</string>
<string name="heat_add">热度加成</string>
<string name="must_hint">最多只能设置10条</string>
<string name="live_room_chat_fount_size_low"></string>
<string name="live_room_chat_fount_size_def">默认</string>
<string name="live_room_chat_fount_size_high"></string>
<string name="dialog_live_fount_title">選擇字號大小</string>
<string name="dialog_fount_submit">確認</string>
</resources>

View File

@ -912,6 +912,7 @@
<string name="activity_center">活動中心</string>
<string name="basic_tools">基礎工具</string>
<string name="effects_settings">特效設置</string>
<string name="live_chat_font_settings">字號設置</string>
<string name="shield_gift_effect">屏蔽禮物特效</string>
<string name="shield_mount_effect">屏蔽座駕特效</string>
<string name="current_live_room">您已在當前直播間</string>
@ -1119,4 +1120,9 @@
<string name="add_gift2">添加禮物、貴族、守護心願</string>
<string name="heat_add">热度加成</string>
<string name="must_hint">最多只能设置10条</string>
<string name="live_room_chat_fount_size_low"></string>
<string name="live_room_chat_fount_size_def">默认</string>
<string name="live_room_chat_fount_size_high"></string>
<string name="dialog_live_fount_title">選擇字號大小</string>
<string name="dialog_fount_submit">確認</string>
</resources>

View File

@ -872,6 +872,7 @@ Limited ride And limited avatar frame</string>
<string name="activity_center">Activity</string>
<string name="basic_tools">Basic tools</string>
<string name="effects_settings">Effect settings</string>
<string name="live_chat_font_settings">Font settings</string>
<string name="shield_gift_effect">Shield gift effect</string>
<string name="shield_mount_effect">Shield car effect</string>
<string name="current_live_room">You are in the current live room</string>
@ -1125,5 +1126,10 @@ Limited ride And limited avatar frame</string>
<string name="unfollow"> Where is the host doing badly~\nBrother, are you sure you want to unfollow?</string>
<string name="unfollow_confrim">follow</string>
<string name="heat_add">Heat Add</string>
<string name="live_room_chat_fount_size_low">LOW</string>
<string name="live_room_chat_fount_size_def">DEFAULT</string>
<string name="live_room_chat_fount_size_high">HIGH</string>
<string name="dialog_live_fount_title">Select font size</string>
<string name="dialog_fount_submit">confirm</string>
</resources>

View File

@ -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",

View File

@ -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)

View File

@ -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<LiveChatBean> 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);

View File

@ -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;

View File

@ -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<Integer>() {
@Override
public void onItemClick(Integer bean, int position) {
EventBus.getDefault().post(new LiveAudienceEvent()
.setNums(bean)
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_FONT_SIZE));
}
}).showDialog();
}
}

View File

@ -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;
}