|
@@ -12,6 +12,7 @@ import io.rong.imlib.model.UserInfo;
|
|
|
* Author by pq, Date on 2022/6/20.
|
|
|
*/
|
|
|
public class LiveMemberHelper {
|
|
|
+ public static final int MAX_COUNT_UNIT =10000;
|
|
|
public static String getMessageName(MessageContent messageContent) {
|
|
|
String name = "";
|
|
|
UserInfo userInfo = messageContent.getUserInfo();
|
|
@@ -36,8 +37,9 @@ public class LiveMemberHelper {
|
|
|
|
|
|
public static String getMemberCountText(int memberCount) {
|
|
|
try {
|
|
|
- if (memberCount >= 10000) {
|
|
|
- return "1万+";
|
|
|
+ if (memberCount >= MAX_COUNT_UNIT) {
|
|
|
+ int result = memberCount / MAX_COUNT_UNIT;
|
|
|
+ return result + "万+";
|
|
|
}
|
|
|
return String.valueOf(memberCount);
|
|
|
} catch (Exception e) {
|
|
@@ -49,8 +51,9 @@ public class LiveMemberHelper {
|
|
|
public static String getMemberCountText(String memberCount) {
|
|
|
try {
|
|
|
int count = Integer.parseInt(memberCount);
|
|
|
- if (count >= 10000) {
|
|
|
- return "1万+";
|
|
|
+ if (count >= MAX_COUNT_UNIT) {
|
|
|
+ int result = count / MAX_COUNT_UNIT;
|
|
|
+ return result + "万+";
|
|
|
}
|
|
|
return memberCount;
|
|
|
} catch (Exception e) {
|
|
@@ -61,10 +64,19 @@ public class LiveMemberHelper {
|
|
|
|
|
|
/**
|
|
|
* 获取点赞数
|
|
|
+ *
|
|
|
* @param count
|
|
|
* @return
|
|
|
*/
|
|
|
public static String getStarsCountText(int count) {
|
|
|
- return count >= 10000 ? "1万+" : String.valueOf(count);
|
|
|
+ try {
|
|
|
+ if (count >= MAX_COUNT_UNIT) {
|
|
|
+ int result = count / MAX_COUNT_UNIT;
|
|
|
+ return result + "万+";
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return String.valueOf(count);
|
|
|
}
|
|
|
}
|