1.PK值格式化样式修改
2.按人数PK公屏增加胜利方战斗值展示
This commit is contained in:
@@ -83,7 +83,7 @@ public class RecordForPKAdapter extends BaseQuickAdapter<PKRecordInfo, BaseViewH
|
||||
PKTeamInfo teamBlue = findPKTeam(PKTeamInfo.TEAM_BLUE, item.getTeams());
|
||||
|
||||
if (teamRed != null) {
|
||||
tvRedTeamScore.setText(FormatUtils.formatToShortHalfUp(teamRed.getScore()));
|
||||
tvRedTeamScore.setText(FormatUtils.formatPKValue(teamRed.getScore()));
|
||||
for (int i = 0; i < redTeamMemberViews.size(); i++) {
|
||||
if (i < teamRed.getTeamMembers().size()) {
|
||||
PKTeamMember pkTeamMember = teamRed.getTeamMembers().get(i);
|
||||
@@ -96,7 +96,7 @@ public class RecordForPKAdapter extends BaseQuickAdapter<PKRecordInfo, BaseViewH
|
||||
}
|
||||
|
||||
if (teamBlue != null) {
|
||||
tvBlueTeamScore.setText(FormatUtils.formatToShortHalfUp(teamBlue.getScore()));
|
||||
tvBlueTeamScore.setText(FormatUtils.formatPKValue(teamBlue.getScore()));
|
||||
for (int i = 0; i < blueTeamMemberViews.size(); i++) {
|
||||
if (i < teamBlue.getTeamMembers().size()) {
|
||||
PKTeamMember pkTeamMember = teamBlue.getTeamMembers().get(i);
|
||||
|
@@ -3,9 +3,11 @@ package com.yizhuan.erban.avroom.dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
@@ -26,6 +28,7 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.room.pk.bean.PKTeamInfo;
|
||||
import com.yizhuan.xchat_android_core.room.pk.bean.PKTeamMember;
|
||||
import com.yizhuan.xchat_android_core.room.pk.bean.RoomPkData;
|
||||
import com.yizhuan.xchat_android_library.utils.FormatUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -142,7 +145,7 @@ public class PKResultDialog extends BaseDialog {
|
||||
llGuardianName.setVisibility(View.GONE);
|
||||
llGuardianValue.setVisibility(View.GONE);
|
||||
llResultTie.setVisibility(View.VISIBLE);
|
||||
tvTieScore.setText(roomPkData.getTeams().get(0).getScore() + "");
|
||||
tvTieScore.setText(FormatUtils.formatPKValue(roomPkData.getTeams().get(0).getScore()));
|
||||
refreshBgByStatus();
|
||||
} else {
|
||||
pkResult = PK_RESULT_VICTORY;
|
||||
@@ -268,11 +271,11 @@ public class PKResultDialog extends BaseDialog {
|
||||
showTeamMembers(teamInfo);
|
||||
showColorByTeam(teamInfo);
|
||||
|
||||
tvScore.setText(teamInfo.getScore() + "");
|
||||
tvScore.setText(FormatUtils.formatPKValue(teamInfo.getScore()));
|
||||
|
||||
if (teamInfo.getProtector() != null && teamInfo.getProtector().getUid() != 0) {
|
||||
tvGuardianName.setText(teamInfo.getProtector().getNick());
|
||||
tvGuardianValue.setText(teamInfo.getProtecScore() + "");
|
||||
tvGuardianValue.setText(FormatUtils.formatPKValue(teamInfo.getProtecScore()));
|
||||
} else {
|
||||
tvGuardianName.setText("无");
|
||||
tvGuardianValue.setText("0");
|
||||
|
@@ -284,8 +284,8 @@ public class PKScoreBoardDialog extends BaseDialog {
|
||||
}
|
||||
long totalScore = redTeam.getScore() + blueTeam.getScore();
|
||||
if (totalScore > 0) {
|
||||
tvRedTeamScore.setText(FormatUtils.formatToShortHalfUp(redTeam.getScore()));
|
||||
tvBlueTeamScore.setText(FormatUtils.formatToShortHalfUp(blueTeam.getScore()));
|
||||
tvRedTeamScore.setText(FormatUtils.formatPKValue(redTeam.getScore()));
|
||||
tvBlueTeamScore.setText(FormatUtils.formatPKValue(blueTeam.getScore()));
|
||||
int percent = (int) ((float) redTeam.getScore() / (float) totalScore * 100.0f);
|
||||
pbScore.setProgress(percent);
|
||||
} else {
|
||||
|
@@ -1287,9 +1287,9 @@ public class MessageView extends FrameLayout {
|
||||
case RoomPkData.PK_RESULT_DRAW:
|
||||
text.append("平局!\n", new ForegroundColorSpan(whiteColor));
|
||||
if (blueTeam != null && redTeam != null) {
|
||||
text.append(String.format(Locale.getDefault(), "PK值 %s : %s \n",
|
||||
FormatUtils.formatToShortHalfUp(blueTeam.getScore()),
|
||||
FormatUtils.formatToShortHalfUp(redTeam.getScore())),
|
||||
text.append(String.format(Locale.getDefault(), "PK值 %s : %s",
|
||||
FormatUtils.formatPKValue(blueTeam.getScore()),
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
|
||||
UserInfo redProtector = redTeam.getProtector();
|
||||
@@ -1298,15 +1298,15 @@ public class MessageView extends FrameLayout {
|
||||
|| blueProtector == null || blueProtector.getUid() == 0) {
|
||||
break;
|
||||
}
|
||||
text.append(String.format(Locale.getDefault(), "蓝队守护者:%s \n", blueProtector.getNick()),
|
||||
text.append(String.format(Locale.getDefault(), "\n蓝队守护者:%s \n", blueProtector.getNick()),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "蓝队守护值:%s \n",
|
||||
FormatUtils.formatToShortHalfUp(blueTeam.getProtecScore())),
|
||||
FormatUtils.formatPKValue(blueTeam.getProtecScore())),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "红队守护者:%s \n", redProtector.getNick()),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "红队守护值:%s \n",
|
||||
FormatUtils.formatToShortHalfUp(redTeam.getProtecScore())),
|
||||
.append(String.format(Locale.getDefault(), "红队守护值:%s",
|
||||
FormatUtils.formatPKValue(redTeam.getProtecScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
}
|
||||
break;
|
||||
@@ -1315,40 +1315,48 @@ public class MessageView extends FrameLayout {
|
||||
text.append("蓝队胜利!\n", new ForegroundColorSpan(whiteColor));
|
||||
if (blueTeam != null && redTeam != null) {
|
||||
text.append(String.format(Locale.getDefault(), "PK值 %s : %s \n",
|
||||
FormatUtils.formatToShortHalfUp(blueTeam.getScore()),
|
||||
FormatUtils.formatToShortHalfUp(redTeam.getScore())),
|
||||
FormatUtils.formatPKValue(blueTeam.getScore()),
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
|
||||
UserInfo blueProtector = blueTeam.getProtector();
|
||||
if (blueProtector == null) {
|
||||
break;
|
||||
}
|
||||
text.append(String.format(Locale.getDefault(), "胜利方战斗值:%s",
|
||||
FormatUtils.formatPKValue(blueTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
|
||||
} else {
|
||||
text.append(String.format(Locale.getDefault(), "胜方守护者:%s \n", blueProtector.getNick()),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "胜方守护值:%s \n",
|
||||
FormatUtils.formatToShortHalfUp(blueTeam.getProtecScore())),
|
||||
.append(String.format(Locale.getDefault(), "胜方守护值:%s",
|
||||
FormatUtils.formatPKValue(blueTeam.getProtecScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PKTeamInfo.TEAM_RED:
|
||||
text.append("红队胜利!\n", new ForegroundColorSpan(whiteColor));
|
||||
if (blueTeam != null && redTeam != null) {
|
||||
text.append(String.format(Locale.getDefault(), "PK值 %s : %s \n",
|
||||
FormatUtils.formatToShortHalfUp(redTeam.getScore()),
|
||||
FormatUtils.formatToShortHalfUp(blueTeam.getScore())),
|
||||
FormatUtils.formatPKValue(redTeam.getScore()),
|
||||
FormatUtils.formatPKValue(blueTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
|
||||
UserInfo redProtector = redTeam.getProtector();
|
||||
if (redProtector == null) {
|
||||
break;
|
||||
}
|
||||
text.append(String.format(Locale.getDefault(), "胜利方战斗值:%s",
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
} else {
|
||||
text.append(String.format(Locale.getDefault(), "红队守护者:%s \n", redProtector.getNick()),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "红队守护值:%s \n",
|
||||
FormatUtils.formatToShortHalfUp(redTeam.getProtecScore())),
|
||||
.append(String.format(Locale.getDefault(), "红队守护值:%s",
|
||||
FormatUtils.formatPKValue(redTeam.getProtecScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
textView.setText(text.build());
|
||||
|
@@ -144,11 +144,11 @@ public class PKBoardView extends RelativeLayout implements View.OnClickListener
|
||||
|
||||
PKTeamInfo blueTeamInfo = PkModel.get().findTeamByTeamId(PKTeamInfo.TEAM_BLUE);
|
||||
if (blueTeamInfo != null) {
|
||||
tvBlueTeamScore.setText(FormatUtils.formatToShortHalfUp(blueTeamInfo.getScore()));
|
||||
tvBlueTeamScore.setText(FormatUtils.formatPKValue(blueTeamInfo.getScore()));
|
||||
}
|
||||
PKTeamInfo redTeamInfo = PkModel.get().findTeamByTeamId(PKTeamInfo.TEAM_RED);
|
||||
if (redTeamInfo != null) {
|
||||
tvRedTeamScore.setText(FormatUtils.formatToShortHalfUp(redTeamInfo.getScore()));
|
||||
tvRedTeamScore.setText(FormatUtils.formatPKValue(redTeamInfo.getScore()));
|
||||
}
|
||||
} else {
|
||||
tvPkTimer.setText("未开始");
|
||||
@@ -178,8 +178,8 @@ public class PKBoardView extends RelativeLayout implements View.OnClickListener
|
||||
llPkScoreBoard.setOnClickListener(null);
|
||||
|
||||
if (PkModel.get().getCurPkInfo() != null && PkModel.get().getCurPkInfo().getPkStatus() == RoomPkData.PK_STATUS_BEFORE_PK) {
|
||||
tvBlueTeamScore.setText("0.00");
|
||||
tvRedTeamScore.setText("0.00");
|
||||
tvBlueTeamScore.setText(FormatUtils.formatPKValue(0));
|
||||
tvRedTeamScore.setText(FormatUtils.formatPKValue(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,11 +254,11 @@ public class PKBoardView extends RelativeLayout implements View.OnClickListener
|
||||
if (PkModel.get().getCurPkInfo().getPkStatus() == RoomPkData.PK_STATUS_IN_PK) {
|
||||
PKTeamInfo blueTeamInfo = PkModel.get().findTeamByTeamId(PKTeamInfo.TEAM_BLUE);
|
||||
if (blueTeamInfo != null) {
|
||||
tvBlueTeamScore.setText(FormatUtils.formatToShortHalfUp(blueTeamInfo.getScore()));
|
||||
tvBlueTeamScore.setText(FormatUtils.formatPKValue(blueTeamInfo.getScore()));
|
||||
}
|
||||
PKTeamInfo redTeamInfo = PkModel.get().findTeamByTeamId(PKTeamInfo.TEAM_RED);
|
||||
if (redTeamInfo != null) {
|
||||
tvRedTeamScore.setText(FormatUtils.formatToShortHalfUp(redTeamInfo.getScore()));
|
||||
tvRedTeamScore.setText(FormatUtils.formatPKValue(redTeamInfo.getScore()));
|
||||
}
|
||||
|
||||
if (redTeamInfo != null && blueTeamInfo != null) {
|
||||
@@ -276,12 +276,12 @@ public class PKBoardView extends RelativeLayout implements View.OnClickListener
|
||||
if (onActionListener != null) {
|
||||
onActionListener.onEndPK();
|
||||
}
|
||||
tvBlueTeamScore.setText("0.00");
|
||||
tvRedTeamScore.setText("0.00");
|
||||
tvBlueTeamScore.setText(FormatUtils.formatPKValue(0));
|
||||
tvRedTeamScore.setText(FormatUtils.formatPKValue(0));
|
||||
}
|
||||
if (PkModel.get().getCurPkInfo().getPkStatus() == RoomPkData.PK_STATUS_TERMINAL_PK_BEFORE_END) {
|
||||
tvBlueTeamScore.setText("0.00");
|
||||
tvRedTeamScore.setText("0.00");
|
||||
tvBlueTeamScore.setText(FormatUtils.formatPKValue(0));
|
||||
tvRedTeamScore.setText(FormatUtils.formatPKValue(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -47,7 +47,7 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:includeFontPadding="false"
|
||||
android:text="0.00"
|
||||
android:text="0"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintStart_toStartOf="@id/pb_score"
|
||||
@@ -61,7 +61,7 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:includeFontPadding="false"
|
||||
android:text="0.00"
|
||||
android:text="0"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintEnd_toEndOf="@id/pb_score"
|
||||
|
@@ -80,7 +80,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
android:text="0.00"
|
||||
android:text="0"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintEnd_toEndOf="@id/fl_left"
|
||||
@@ -164,7 +164,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="1"
|
||||
android:text="0.00"
|
||||
android:text="0"
|
||||
android:textColor="@color/color_FFFFFF"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintEnd_toEndOf="@id/fl_right"
|
||||
|
@@ -34,6 +34,7 @@ public class FormatUtils {
|
||||
/**
|
||||
* 把过长的金额类数字,转换成两位小数带万,亿,兆 缩写
|
||||
* 10000.00 -> 1.00万 丢掉两位小数后面的小数
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
@@ -44,15 +45,18 @@ public class FormatUtils {
|
||||
/**
|
||||
* 把过长的金额类数字,转换成两位小数带万,亿,兆 缩写
|
||||
* 10000.00 -> 1.00万 四舍五入两位小数后面的小数
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public static String formatToShortHalfUp(double num) {
|
||||
return formatToShort(num, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 把过长的金额类数字,转换成两位小数带万,亿,兆 缩写
|
||||
* 10000.00 -> 1.00万
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
@@ -85,6 +89,7 @@ public class FormatUtils {
|
||||
|
||||
/**
|
||||
* 将手机号码 显示成带隐私形式
|
||||
*
|
||||
* @param phoneNum
|
||||
* @param beginIndex 开始用* 号替换位置
|
||||
* @param endIndex 结束用* 号替换位置
|
||||
@@ -102,4 +107,10 @@ public class FormatUtils {
|
||||
return resSB.toString();
|
||||
}
|
||||
|
||||
//PK值相关格式化方式,统一方法,方便以后更改样式
|
||||
public static String formatPKValue(long value) {
|
||||
if (value >= 100000) return (value / 100) / 100f + "万";
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user