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="不喜欢不喜欢不喜" />