Merge remote-tracking branch 'origin/master'

This commit is contained in:
18401019693 2023-05-19 13:33:17 +08:00
commit 055d002a34
2 changed files with 36 additions and 28 deletions

View File

@ -76,8 +76,8 @@ public class LiveRoomVoteManager {
mCancel.setText(R.string.live_vote_close_no); mCancel.setText(R.string.live_vote_close_no);
mCancel.setOnClickListener(v -> { mCancel.setOnClickListener(v -> {
mTitle.setText(createVoteModel.getContent()); mTitle.setText(createVoteModel.getContent());
mSubmit.setText(createVoteModel.getAnswer1()); mSubmit.setText(getAnswerText(createVoteModel.getAnswer1()));
mCancel.setText(createVoteModel.getAnswer2()); mCancel.setText(getAnswerText(createVoteModel.getAnswer2()));
initClick(); initClick();
}); });
mSubmit.setOnClickListener(v -> endAnchorVote()); mSubmit.setOnClickListener(v -> endAnchorVote());
@ -92,6 +92,12 @@ public class LiveRoomVoteManager {
mSubmit.setOnClickListener(v -> updateVote(true)); mSubmit.setOnClickListener(v -> updateVote(true));
mCancel.setOnClickListener(v -> updateVote(false)); 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) { private void updateVote(boolean isSubmit) {
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
@ -136,8 +142,8 @@ public class LiveRoomVoteManager {
mCancel.setOnClickListener(null); mCancel.setOnClickListener(null);
mSubmit.setOnClickListener(null); mSubmit.setOnClickListener(null);
mSubmit.setText(createVoteModel.getAnswer1()); mSubmit.setText(getAnswerText(createVoteModel.getAnswer1()));
mCancel.setText(createVoteModel.getAnswer2()); mCancel.setText(getAnswerText(createVoteModel.getAnswer2()));
new Timer().schedule(new TimerTask() { new Timer().schedule(new TimerTask() {
int time = 6; int time = 6;
@ -169,8 +175,8 @@ public class LiveRoomVoteManager {
expansion(); expansion();
} }
mTitle.setText(createVoteModel.getContent()); mTitle.setText(createVoteModel.getContent());
mSubmit.setText(createVoteModel.getAnswer1()); mSubmit.setText(getAnswerText(createVoteModel.getAnswer1()));
mCancel.setText(createVoteModel.getAnswer2()); mCancel.setText(getAnswerText(createVoteModel.getAnswer2()));
mCancel.setOnClickListener(null); mCancel.setOnClickListener(null);
mSubmit.setOnClickListener(null); mSubmit.setOnClickListener(null);
if (mSubmit.getTag() == null || !mSubmit.getTag().equals(createVoteModel.getLiveUid())) { if (mSubmit.getTag() == null || !mSubmit.getTag().equals(createVoteModel.getLiveUid())) {

View File

@ -22,23 +22,23 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_weight="8" android:layout_marginTop="0dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
app:autoSizeTextType="uniform" android:layout_weight="8"
app:autoSizeMinTextSize="9sp" android:gravity="center"
app:autoSizeMaxTextSize="16sp"
app:autoSizeStepGranularity="1sp"
tools:text="各位粉絲團的親親親想聽什麽歌曲聽什麽都可以只要你想聽哈哈哈哈哈?"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
/> app:autoSizeMaxTextSize="16sp"
app:autoSizeMinTextSize="10sp"
app:autoSizeStepGranularity="1sp"
app:autoSizeTextType="uniform"
tools:text="各位粉絲團的親親親想聽什麽歌曲聽什麽都可以只要你想聽哈哈哈哈哈" />
<ProgressBar <ProgressBar
android:layout_weight="1"
android:id="@+id/vote_progress" android:id="@+id/vote_progress"
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1"
android:max="20" android:max="20"
android:progress="10" android:progress="10"
@ -46,9 +46,9 @@
android:rotationY="180" /> android:rotationY="180" />
<LinearLayout <LinearLayout
android:layout_weight="5"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="5"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
@ -57,16 +57,17 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" android:layout_weight="1"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="5sp"
app:autoSizeMaxTextSize="14sp"
app:autoSizeStepGranularity="1sp"
android:gravity="center" android:gravity="center"
android:minLines="2"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
tools:text="喜欢喜欢喜欢喜欢"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="14sp" /> android:textSize="14sp"
app:autoSizeMaxTextSize="14sp"
app:autoSizeMinTextSize="5sp"
app:autoSizeStepGranularity="1sp"
app:autoSizeTextType="uniform"
tools:text="喜欢喜欢喜欢喜欢" />
<View <View
android:layout_width="1dp" android:layout_width="1dp"
@ -80,15 +81,16 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="center"
app:autoSizeTextType="uniform" android:minLines="2"
app:autoSizeMinTextSize="5sp"
app:autoSizeMaxTextSize="14sp"
app:autoSizeStepGranularity="1sp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
tools:text="不喜欢不喜欢不喜"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="14sp" /> android:textSize="14sp"
app:autoSizeMaxTextSize="14sp"
app:autoSizeMinTextSize="5sp"
app:autoSizeStepGranularity="1sp"
app:autoSizeTextType="uniform"
tools:text="不喜欢不喜欢不喜" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>