From 435dc1c4fb894475c02ee26cf488373b0f3f77d9 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 19 May 2023 10:36:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8A=95=E7=A5=A8UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/utils/LiveRoomVoteManager.java | 18 +++++--- .../main/res/layout/sim_live_room_vote.xml | 46 ++++++++++--------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java b/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java index dbc5dfc72..9579086a8 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveRoomVoteManager.java @@ -76,8 +76,8 @@ public class LiveRoomVoteManager { mCancel.setText(R.string.live_vote_close_no); mCancel.setOnClickListener(v -> { mTitle.setText(createVoteModel.getContent()); - mSubmit.setText(createVoteModel.getAnswer1()); - mCancel.setText(createVoteModel.getAnswer2()); + mSubmit.setText(getAnswerText(createVoteModel.getAnswer1())); + mCancel.setText(getAnswerText(createVoteModel.getAnswer2())); initClick(); }); mSubmit.setOnClickListener(v -> endAnchorVote()); @@ -92,6 +92,12 @@ public class LiveRoomVoteManager { mSubmit.setOnClickListener(v -> updateVote(true)); mCancel.setOnClickListener(v -> updateVote(false)); } + private String getAnswerText(String answer){ + if(answer.length()>4){ + return answer.substring(0,4)+"\n"+answer.substring(4); + } + return answer; + } private void updateVote(boolean isSubmit) { LiveNetManager.get(mContext) @@ -136,8 +142,8 @@ public class LiveRoomVoteManager { mCancel.setOnClickListener(null); mSubmit.setOnClickListener(null); - mSubmit.setText(createVoteModel.getAnswer1()); - mCancel.setText(createVoteModel.getAnswer2()); + mSubmit.setText(getAnswerText(createVoteModel.getAnswer1())); + mCancel.setText(getAnswerText(createVoteModel.getAnswer2())); new Timer().schedule(new TimerTask() { int time = 6; @@ -169,8 +175,8 @@ public class LiveRoomVoteManager { expansion(); } mTitle.setText(createVoteModel.getContent()); - mSubmit.setText(createVoteModel.getAnswer1()); - mCancel.setText(createVoteModel.getAnswer2()); + mSubmit.setText(getAnswerText(createVoteModel.getAnswer1())); + mCancel.setText(getAnswerText(createVoteModel.getAnswer2())); mCancel.setOnClickListener(null); mSubmit.setOnClickListener(null); if (mSubmit.getTag() == null || !mSubmit.getTag().equals(createVoteModel.getLiveUid())) { diff --git a/live/src/main/res/layout/sim_live_room_vote.xml b/live/src/main/res/layout/sim_live_room_vote.xml index 1ff258852..7bc824137 100644 --- a/live/src/main/res/layout/sim_live_room_vote.xml +++ b/live/src/main/res/layout/sim_live_room_vote.xml @@ -22,23 +22,23 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginStart="10dp" - android:layout_weight="8" - android:layout_marginTop="5dp" + android:layout_marginTop="0dp" android:layout_marginEnd="10dp" - app:autoSizeTextType="uniform" - app:autoSizeMinTextSize="9sp" - app:autoSizeMaxTextSize="16sp" - app:autoSizeStepGranularity="1sp" - tools:text="各位粉絲團的親親親想聽什麽歌曲聽什麽都可以只要你想聽哈哈哈哈哈?" + android:layout_weight="8" + android:gravity="center" android:textColor="#FFFFFF" - /> + app:autoSizeMaxTextSize="16sp" + app:autoSizeMinTextSize="10sp" + app:autoSizeStepGranularity="1sp" + app:autoSizeTextType="uniform" + tools:text="各位粉絲團的親親親想聽什麽歌曲聽什麽都可以只要你想聽哈哈哈哈哈" /> + android:textSize="14sp" + app:autoSizeMaxTextSize="14sp" + app:autoSizeMinTextSize="5sp" + app:autoSizeStepGranularity="1sp" + app:autoSizeTextType="uniform" + tools:text="喜欢喜欢喜欢喜欢" /> + android:textSize="14sp" + app:autoSizeMaxTextSize="14sp" + app:autoSizeMinTextSize="5sp" + app:autoSizeStepGranularity="1sp" + app:autoSizeTextType="uniform" + tools:text="不喜欢不喜欢不喜" />