feat:完善公聊厅UI
feat:公聊厅列表增加数量限制
This commit is contained in:
@@ -38,6 +38,7 @@ import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.app.ui.widget.DividerItemDecoration;
|
||||
import com.chwl.app.ui.widget.MyItemAnimator;
|
||||
import com.chwl.app.ui.widget.RecyclerViewNoViewpagerScroll;
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder;
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.chwl.app.utils.RegexUtil;
|
||||
import com.chwl.core.DemoCache;
|
||||
@@ -45,7 +46,6 @@ import com.chwl.core.XConstants;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.bean.attachmsg.RoomQueueMsgAttachment;
|
||||
import com.chwl.core.decoration.car.bean.CarInfo;
|
||||
import com.chwl.core.helper.ImHelperUtils;
|
||||
import com.chwl.core.home.event.FollowRoomEvent;
|
||||
import com.chwl.core.home.model.CollectionRoomModel;
|
||||
import com.chwl.core.im.custom.bean.AuctionAttachment;
|
||||
@@ -56,19 +56,14 @@ import com.chwl.core.im.custom.bean.RoomBoxPrizeAttachment;
|
||||
import com.chwl.core.im.custom.bean.RoomFollowOwnerAttachment2;
|
||||
import com.chwl.core.im.custom.bean.RoomTipAttachment;
|
||||
import com.chwl.core.im.custom.bean.TarotAttachment;
|
||||
import com.chwl.core.im.custom.bean.WelcomeAttachment;
|
||||
import com.chwl.core.level.UserLevelResourceType;
|
||||
import com.chwl.core.manager.AvRoomDataManager;
|
||||
import com.chwl.core.manager.IMNetEaseManager;
|
||||
import com.chwl.core.monsterhunting.bean.MonsterDataBean;
|
||||
import com.chwl.core.monsterhunting.bean.MonsterHuntingResult;
|
||||
import com.chwl.core.noble.NobleUtil;
|
||||
import com.chwl.core.praise.PraiseModel;
|
||||
import com.chwl.core.room.bean.RoomInfo;
|
||||
import com.chwl.core.room.bean.WelcomeInfo;
|
||||
import com.chwl.core.room.model.AvRoomModel;
|
||||
import com.chwl.core.room.pk.attachment.RoomPkAttachment;
|
||||
import com.chwl.core.user.UserModel;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.core.utils.ExtensionUtil;
|
||||
import com.chwl.library.common.util.Utils;
|
||||
@@ -79,7 +74,6 @@ import com.chwl.library.utils.SingleToastUtil;
|
||||
import com.chwl.library.utils.SizeUtils;
|
||||
import com.example.lib_utils.UiUtils;
|
||||
import com.netease.nim.uikit.business.uinfo.UserInfoHelper;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessageExtension;
|
||||
@@ -99,12 +93,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import com.chwl.app.avroom.widget.MessageView.SpannableBuilder;
|
||||
|
||||
/**
|
||||
* 直播間消息界面
|
||||
@@ -569,7 +558,7 @@ public class PublicChatMessageView extends FrameLayout {
|
||||
*/
|
||||
private void setMsgText(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
addCommonTag(chatRoomMessage, text, tvContent);
|
||||
String nickName = extension == null ? ResUtil.getString(R.string.avroom_widget_messageview_0116) : RegexUtil.getPrintableString(extension.getSenderNick());
|
||||
text.append(nickName, new ForegroundColorSpan(greyColor))
|
||||
@@ -607,7 +596,7 @@ public class PublicChatMessageView extends FrameLayout {
|
||||
tvContent.setText(text.build());
|
||||
}
|
||||
|
||||
private void addCommonTag(ChatRoomMessage chatRoomMessage, @NonNull SpannableBuilder builder, TextView tvContent) {
|
||||
private void addCommonTag(ChatRoomMessage chatRoomMessage, @NonNull TextSpannableBuilder builder, TextView tvContent) {
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
String userLevel = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, chatRoomMessage);
|
||||
boolean isOfficial = NobleUtil.getIsOfficial(UserInfo.IS_OFFICIAL, chatRoomMessage);
|
||||
@@ -652,7 +641,7 @@ public class PublicChatMessageView extends FrameLayout {
|
||||
String senderNick = chatRoomMessage.getChatRoomMessageExtension().getSenderNick();
|
||||
senderNick = senderNick == null ? "" : senderNick;
|
||||
AuctionAttachment auctionAttachment = (AuctionAttachment) attachment;
|
||||
SpannableBuilder builder = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(tvContent);
|
||||
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_AUCTION_START) {
|
||||
builder.append(ResUtil.getString(R.string.avroom_widget_messageview_0117), new ForegroundColorSpan(roomTipNickColor));
|
||||
} else if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_AUCTION_FINISH) {
|
||||
@@ -698,7 +687,7 @@ public class PublicChatMessageView extends FrameLayout {
|
||||
String carName = NobleUtil.getCarName(CarInfo.CAR_NAME, chatRoomMessage);
|
||||
carName = TextUtils.isEmpty(carName) ? "" : "\"" + carName + "\"";
|
||||
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
addCommonTag(chatRoomMessage, text, tvContent);
|
||||
text.append(senderNick, new ForegroundColorSpan(roomTipColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.text.style.AbsoluteSizeSpan;
|
||||
import android.view.View;
|
||||
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder;
|
||||
import com.coorchice.library.SuperTextView;
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
||||
import com.chwl.app.R;
|
||||
@@ -34,7 +35,7 @@ public class RecommendCardListAdapter extends CommonAdapter<RecommendCard, BaseV
|
||||
protected void convert(BaseViewHolder holder, RecommendCard item) {
|
||||
holder.setText(R.id.tv_time_title, item.getCardName());
|
||||
|
||||
MessageView.SpannableBuilder builder = new MessageView.SpannableBuilder(null);
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(null);
|
||||
builder.append("X", new AbsoluteSizeSpan(ScreenUtil.sp2px(12)))
|
||||
.append(String.valueOf(item.getCount()));
|
||||
holder.setText(R.id.tv_card_count, builder.build());
|
||||
|
@@ -60,6 +60,7 @@ import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.chwl.app.photo.BigPhotoActivity;
|
||||
import com.chwl.app.photo.PagerOption;
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder;
|
||||
import com.chwl.app.utils.ObjectTypeHelper;
|
||||
import com.chwl.core.im.custom.bean.TemplateMessageAttachment;
|
||||
import com.chwl.core.monsterhunting.bean.MonsterDataBean;
|
||||
@@ -599,191 +600,7 @@ public class MessageView extends FrameLayout {
|
||||
void onShowRoomIntroduction();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class SpannableBuilder {
|
||||
private SpannableStringBuilder builder;
|
||||
private TextView textView;
|
||||
|
||||
public SpannableBuilder(TextView textView) {
|
||||
builder = new SpannableStringBuilder();
|
||||
this.textView = textView;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text 文字
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public SpannableBuilder append(CharSequence text) {
|
||||
if (TextUtils.isEmpty(text)) return this;
|
||||
builder.append(text);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon url
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public SpannableBuilder appendImg(String drawable) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @param drawable -icon url
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public SpannableBuilder appendImg(String drawable, Object what) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon url
|
||||
* @param width 寬
|
||||
* @param height 高
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public SpannableBuilder append(String drawable, int width, int height) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable, width, height);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SpannableBuilder append(String drawable, int width, int height, Object what) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable, width, height);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本和背景分離的情況
|
||||
*/
|
||||
public SpannableBuilder appendBgAndContent(String drawable, String content) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable, content);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon
|
||||
* @param width 寬
|
||||
* @param height 高
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public SpannableBuilder append(Drawable drawable, int width, int height) {
|
||||
if (drawable == null) return this;
|
||||
drawable.setBounds(0, 0, width, height);
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomImageSpan(drawable), start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param imgUrl -icon url
|
||||
* @param height 高
|
||||
* @return -返回一個spannableStringBuilder,自適應寬度
|
||||
*/
|
||||
public SpannableBuilder append(String imgUrl, int height) {
|
||||
if (TextUtils.isEmpty(imgUrl)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomAutoWidthImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, imgUrl, height)
|
||||
, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SpannableBuilder append(String imgUrl, int height, Object what) {
|
||||
if (TextUtils.isEmpty(imgUrl)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomAutoWidthImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, imgUrl, height)
|
||||
, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon
|
||||
* @param width 寬
|
||||
* @param height 高
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public SpannableBuilder append(Drawable drawable, int width, int height, Object... whats) {
|
||||
if (drawable == null) return this;
|
||||
try {
|
||||
drawable.setBounds(0, 0, width, height);
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomImageSpan(drawable), start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
if (whats != null) {
|
||||
for (int i = 0; i < whats.length; i++) {
|
||||
builder.setSpan(whats[0], start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text -文字
|
||||
* @param what -span類型
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public SpannableBuilder append(CharSequence text, Object what) {
|
||||
if (TextUtils.isEmpty(text)) return this;
|
||||
int start = builder.length();
|
||||
builder.append(text);
|
||||
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持多個spannable 對同一段文字修改
|
||||
*
|
||||
* @param text
|
||||
* @param what
|
||||
* @return
|
||||
*/
|
||||
public SpannableBuilder append(CharSequence text, Object... what) {
|
||||
if (TextUtils.isEmpty(text)) return this;
|
||||
int start = builder.length();
|
||||
builder.append(text);
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
Object o = what[i];
|
||||
if (o == null) {
|
||||
continue;
|
||||
}
|
||||
builder.setSpan(what[i], start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public SpannableStringBuilder build() {
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageViewHolder> implements OnClickListener {
|
||||
|
||||
@@ -1213,7 +1030,7 @@ public class MessageView extends FrameLayout {
|
||||
FairyMsgAttachment attachment = (FairyMsgAttachment) chatRoomMessage.getAttachment();
|
||||
FairyMsgInfoBean fairyMsgInfo = attachment.getFairyMsgInfo();
|
||||
if (fairyMsgInfo == null) return;
|
||||
SpannableBuilder builder = null;
|
||||
TextSpannableBuilder builder = null;
|
||||
switch (attachment.getSecond()) {
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L1:
|
||||
case CUSTOM_MSG_SUB_DRAW_GIFT_L2:
|
||||
@@ -1255,8 +1072,8 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
}
|
||||
|
||||
private SpannableBuilder builderConvertMsg(TextView textView, @NonNull FairyMsgInfoBean fairyMsgInfo, String type) {
|
||||
return new SpannableBuilder(textView)
|
||||
private TextSpannableBuilder builderConvertMsg(TextView textView, @NonNull FairyMsgInfoBean fairyMsgInfo, String type) {
|
||||
return new TextSpannableBuilder(textView)
|
||||
.append("厲害了!", new ForegroundColorSpan(whiteColor))
|
||||
.append(StringExtensionKt.subAndReplaceDot(fairyMsgInfo.getNick(), 7), new OriginalDrawStatusClickSpan(roomTipNickColor, false) {
|
||||
|
||||
@@ -1269,8 +1086,8 @@ public class MessageView extends FrameLayout {
|
||||
.append(fairyMsgInfo.getRewardShowValue() + "鉆" + fairyMsgInfo.getRewardName(), new ForegroundColorSpan(roomTipColor));
|
||||
}
|
||||
|
||||
private SpannableBuilder builderDrawMsg(TextView textView, @NonNull FairyMsgInfoBean fairyMsgInfo, String desc) {
|
||||
SpannableBuilder builder = new SpannableBuilder(textView)
|
||||
private TextSpannableBuilder builderDrawMsg(TextView textView, @NonNull FairyMsgInfoBean fairyMsgInfo, String desc) {
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(textView)
|
||||
.append(desc, new ForegroundColorSpan(whiteColor))
|
||||
.append(StringExtensionKt.subAndReplaceDot(fairyMsgInfo.getNick(), 7), new OriginalDrawStatusClickSpan(roomTipNickColor, false) {
|
||||
|
||||
@@ -1293,7 +1110,7 @@ public class MessageView extends FrameLayout {
|
||||
GiftCompoundAttachment giftCompoundAttachment = (GiftCompoundAttachment) chatRoomMessage.getAttachment();
|
||||
if (giftCompoundAttachment.getSecond() == CUSTOM_MSG_SUB_GIFT_COMPOUND) {
|
||||
GiftCompoundMsgBean msgInfo = giftCompoundAttachment.getMsgBean();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
text.append(
|
||||
msgInfo.getNick(),
|
||||
new ForegroundColorSpan(roomTipNickColor),
|
||||
@@ -1324,7 +1141,7 @@ public class MessageView extends FrameLayout {
|
||||
FansTeamMsgAttachment fansTeamMsgAttachment = (FansTeamMsgAttachment) chatRoomMessage.getAttachment();
|
||||
if (fansTeamMsgAttachment.getSecond() == CUSTOM_MSG_SUB_FANS_TEAM_JOIN) {
|
||||
FansTeamMsgInfo msgInfo = fansTeamMsgAttachment.getFansTeamMsgInfo();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
text.append(ResUtil.getString(R.string.avroom_widget_messageview_04), new ForegroundColorSpan(whiteColor))
|
||||
.append(msgInfo.getNickname(), new ForegroundColorSpan(roomTipNickColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@@ -1352,7 +1169,7 @@ public class MessageView extends FrameLayout {
|
||||
if (chatRoomMessage.getAttachment() instanceof VipMessageAttachment) {
|
||||
VipMessageAttachment datingAttachment = (VipMessageAttachment) chatRoomMessage.getAttachment();
|
||||
VipMessageInfo notifyInfo = datingAttachment.getVipMessageInfo();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
int second = datingAttachment.getSecond();
|
||||
switch (second) {
|
||||
case CustomAttachment.CUSTOM_MSG_VIP_ROOM_OPEN:
|
||||
@@ -1401,7 +1218,7 @@ public class MessageView extends FrameLayout {
|
||||
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY) {
|
||||
LuckyBagNoticeInfo noticeInfo = attachment.getLuckyBagNoticeInfo();
|
||||
String nickName = RegexUtil.getPrintableString(noticeInfo.getNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_011), new ForegroundColorSpan(textColor))
|
||||
.append(nickName, new ForegroundColorSpan(roomTipNickColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_012), new ForegroundColorSpan(textColor))
|
||||
@@ -1418,7 +1235,7 @@ public class MessageView extends FrameLayout {
|
||||
if (chatRoomMessage.getAttachment() instanceof DatingAttachment) {
|
||||
DatingAttachment datingAttachment = (DatingAttachment) chatRoomMessage.getAttachment();
|
||||
DatingNotifyInfo notifyInfo = datingAttachment.getDatingNotifyInfo();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
switch (second) {
|
||||
case CustomAttachment.CUSTOM_MSG_SUB_DATING_SELECT:
|
||||
text.append(ResUtil.getString(R.string.avroom_widget_messageview_015), new ForegroundColorSpan(whiteColor))
|
||||
@@ -1512,7 +1329,7 @@ public class MessageView extends FrameLayout {
|
||||
TarotAttachment attachment = (TarotAttachment) chatRoomMessage.getAttachment();
|
||||
TarotMsgBean tarotMsgBean = attachment.getTarotMsgBean();
|
||||
String nickName = RegexUtil.getPrintableString(tarotMsgBean.getNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
switch (attachment.getSecond()) {
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT_SUCCESS:
|
||||
text.append(ResUtil.getString(R.string.avroom_widget_messageview_026), new ForegroundColorSpan(textColor))
|
||||
@@ -1547,7 +1364,7 @@ public class MessageView extends FrameLayout {
|
||||
JoinMiniWorldNoticeAttachment joinMiniWorldNoticeAttachment = (JoinMiniWorldNoticeAttachment) chatRoomMessage.getAttachment();
|
||||
String nick = TextUtils.isEmpty(joinMiniWorldNoticeAttachment.getNick()) ? "" : joinMiniWorldNoticeAttachment.getNick();
|
||||
String worldName = TextUtils.isEmpty(joinMiniWorldNoticeAttachment.getWorldName()) ? "" : joinMiniWorldNoticeAttachment.getWorldName();
|
||||
SpannableBuilder append = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder append = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_028))
|
||||
.append(" " + nick + " ", new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
@@ -1576,7 +1393,7 @@ public class MessageView extends FrameLayout {
|
||||
RedEnvelopeRoomMsg roomMsg = attachment.getRedEnvelopeRoomMsg();
|
||||
String openNickname = RegexUtil.getPrintableString(roomMsg.getOpenRedEnvelopeUserNick());
|
||||
String sendNickname = RegexUtil.getPrintableString(roomMsg.getRedEnvelopeMasterNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(openNickname, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -1656,7 +1473,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
|
||||
boolean follow = roomFollowOwnerAttachment.isFollow();
|
||||
SpannableBuilder append = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder append = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_036))
|
||||
.append(" " + nick + " ", new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
@@ -1691,7 +1508,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
tvContent.setTextColor(Color.WHITE);
|
||||
RoomFollowOwnerAttachment2 roomFollowOwnerAttachment = (RoomFollowOwnerAttachment2) chatRoomMessage.getAttachment();
|
||||
SpannableBuilder append = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder append = new TextSpannableBuilder(tvContent)
|
||||
.append(mContext.getResources().getDrawable(R.drawable.bg_follow), ScreenUtil.dip2px(190), ScreenUtil.dip2px(40));
|
||||
tvContent.setText(append.build());
|
||||
}
|
||||
@@ -1699,7 +1516,7 @@ public class MessageView extends FrameLayout {
|
||||
private void invitePK(RoomPkAttachment attachment, TextView tvContent) {
|
||||
Map<String, RoomPKInvitedUpMicMember> micMemberMap = attachment.getRoomPKInvitedUpMicMemberMap();
|
||||
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_041));
|
||||
boolean isHaveInTeam = false;
|
||||
Iterator<Map.Entry<String, RoomPKInvitedUpMicMember>> iterator = micMemberMap.entrySet().iterator();
|
||||
@@ -1743,7 +1560,7 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
private void openRoomPKModeMsg(RoomPkAttachment attachment, TextView tvContent) {
|
||||
RoomPkData roomPkData = attachment.getRoomPkData();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(String.format(Locale.getDefault(), ResUtil.getString(R.string.avroom_widget_messageview_046),
|
||||
roomPkData.getDuration()),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
@@ -1761,7 +1578,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
|
||||
private void stopRoomPkModeMsg(TextView tvContent) {
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_050), new ForegroundColorSpan(whiteColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_051), new ForegroundColorSpan(greyColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_052), new ForegroundColorSpan(whiteColor));
|
||||
@@ -1770,7 +1587,7 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
private void startRoomPk(RoomPkAttachment attachment, TextView textView) {
|
||||
RoomPkData roomPkData = attachment.getRoomPkData();
|
||||
SpannableBuilder text = new SpannableBuilder(textView)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(textView)
|
||||
.append(String.format(Locale.getDefault(),
|
||||
ResUtil.getString(R.string.avroom_widget_messageview_053), roomPkData.getDuration()),
|
||||
new ForegroundColorSpan(greyColor));
|
||||
@@ -1779,7 +1596,7 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
private void restartRoomPKModeMsg(RoomPkAttachment attachment, TextView tvContent) {
|
||||
RoomPkData roomPkData = attachment.getRoomPkData();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(String.format(Locale.getDefault(), ResUtil.getString(R.string.avroom_widget_messageview_054),
|
||||
roomPkData.getDuration()),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
@@ -1798,7 +1615,7 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
private void roomPkResult(RoomPkAttachment attachment, TextView textView) {
|
||||
RoomPkData roomPkData = attachment.getRoomPkData();
|
||||
SpannableBuilder text = new SpannableBuilder(textView)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(textView)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_058), new ForegroundColorSpan(whiteColor));
|
||||
Map<String, PKTeamInfo> teamMap = new HashMap<>();
|
||||
PKTeamInfo blueTeam = null;
|
||||
@@ -1890,7 +1707,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
|
||||
private void startQueuingMicModeMsg(TextView tvContent) {
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_075), new ForegroundColorSpan(whiteColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_076), new ForegroundColorSpan(greyColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_077), new ForegroundColorSpan(whiteColor));
|
||||
@@ -1898,7 +1715,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
|
||||
private void stopQueuingMicModeMsg(TextView tvContent) {
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_078), new ForegroundColorSpan(whiteColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_079), new ForegroundColorSpan(greyColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_080), new ForegroundColorSpan(whiteColor));
|
||||
@@ -1908,7 +1725,7 @@ public class MessageView extends FrameLayout {
|
||||
private void switchToFreeMicMsg(TextView tvContent, ChatRoomMessage chatRoomMessage) {
|
||||
QueuingMicAttachment attachment = (QueuingMicAttachment) chatRoomMessage.getAttachment();
|
||||
QueuingMicInfo queuingMicInfo = attachment.getQueuingMicInfo();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_081), new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), ResUtil.getString(R.string.avroom_widget_messageview_082),
|
||||
JavaUtil.str2int(queuingMicInfo.getMicPos()) + 1), new ForegroundColorSpan(greyColor))
|
||||
@@ -1919,7 +1736,7 @@ public class MessageView extends FrameLayout {
|
||||
private void switchToLockMicMsg(TextView tvContent, ChatRoomMessage chatRoomMessage) {
|
||||
QueuingMicAttachment attachment = (QueuingMicAttachment) chatRoomMessage.getAttachment();
|
||||
QueuingMicInfo queuingMicInfo = attachment.getQueuingMicInfo();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_084), new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), ResUtil.getString(R.string.avroom_widget_messageview_085),
|
||||
JavaUtil.str2int(queuingMicInfo.getMicPos()) + 1), new ForegroundColorSpan(greyColor))
|
||||
@@ -1929,7 +1746,7 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
private void setDragonBarRunawayMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(extension == null ? ResUtil.getString(R.string.avroom_widget_messageview_087) : RegexUtil.getPrintableString(extension.getSenderNick()), new ForegroundColorSpan(Color.WHITE),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -1948,7 +1765,7 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
private void setDragonBarCancelMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(extension == null ? ResUtil.getString(R.string.avroom_widget_messageview_089) : RegexUtil.getPrintableString(extension.getSenderNick()), new ForegroundColorSpan(Color.WHITE),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -1978,7 +1795,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
msg = msg.substring(0, msg.length() - 1);
|
||||
// 內容
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(extension == null ? ResUtil.getString(R.string.avroom_widget_messageview_091) : RegexUtil.getPrintableString(extension.getSenderNick()), new ForegroundColorSpan(Color.WHITE),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -2000,7 +1817,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setBoxMeMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
RoomBoxPrizeAttachment attachment = (RoomBoxPrizeAttachment) chatRoomMessage.getAttachment();
|
||||
// 內容
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append("厲害了 ", new ForegroundColorSpan(greyColor))
|
||||
.append(attachment.getNick() + " ", new ForegroundColorSpan(roomTipColor))
|
||||
.append("通過歡樂砸蛋" + "獲得 ", new ForegroundColorSpan(greyColor))
|
||||
@@ -2018,7 +1835,7 @@ public class MessageView extends FrameLayout {
|
||||
RoomLuckySeaAttachment attachment = (RoomLuckySeaAttachment) chatRoomMessage.getAttachment();
|
||||
RoomLuckySeaMsgBean bean = attachment.getRoomLuckySeaMsgInfo();
|
||||
// 內容
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.congratulation), new ForegroundColorSpan(greyColor))
|
||||
.append(bean.getNick(), new ForegroundColorSpan(roomTipNickColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@@ -2057,7 +1874,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setRadishMeMsg(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
RoomBoxPrizeAttachment attachment = (RoomBoxPrizeAttachment) chatRoomMessage.getAttachment();
|
||||
// 內容
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_097), new ForegroundColorSpan(greyColor))
|
||||
.append(attachment.getNick() + " ", new ForegroundColorSpan(roomTipColor))
|
||||
.append(attachment.getBoxTypeStr() + ResUtil.getString(R.string.avroom_widget_messageview_098), new ForegroundColorSpan(greyColor))
|
||||
@@ -2069,21 +1886,21 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
|
||||
private void setUpdateAudioMsg(TextView tvContent) {
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_099), new ForegroundColorSpan(roomTipColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0100), new ForegroundColorSpan(greyColor));
|
||||
tvContent.setText(text.build());
|
||||
}
|
||||
|
||||
private void setUpdateGiftEffectMsg(TextView tvContent) {
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0101), new ForegroundColorSpan(roomTipColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0102), new ForegroundColorSpan(greyColor));
|
||||
tvContent.setText(text.build());
|
||||
}
|
||||
|
||||
private void setUpdateScreenMsg(TextView tvContent, String contentText) {
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0103), new ForegroundColorSpan(roomTipColor))
|
||||
.append(contentText, new ForegroundColorSpan(greyColor));
|
||||
tvContent.setText(text.build());
|
||||
@@ -2092,7 +1909,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setUpdateRoomPureModeMsg(TextView tvContent, IMMessage message) {
|
||||
RoomNoticeAttachment attachment = (RoomNoticeAttachment) message.getAttachment();
|
||||
RoomMessageViewNoticeInfo messageViewNoticeInfo = attachment.getRoomMessageViewNoticeInfo();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0104), new ForegroundColorSpan(roomTipColor))
|
||||
.append(messageViewNoticeInfo.getTips(), new ForegroundColorSpan(greyColor));
|
||||
tvContent.setText(text.build());
|
||||
@@ -2101,7 +1918,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setCleanScreenMsg(TextView tvContent, IMMessage message) {
|
||||
CleanScreenAttachment attachment = (CleanScreenAttachment) message.getAttachment();
|
||||
// 內容
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(attachment.getRoleType() == 1 ? ResUtil.getString(R.string.avroom_widget_messageview_0105) : ResUtil.getString(R.string.avroom_widget_messageview_0106), new ForegroundColorSpan(Color.WHITE))
|
||||
.append("(" + attachment.getNick() + ") ", new ForegroundColorSpan(roomTipColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@@ -2120,7 +1937,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
|
||||
private void setMonsterNotifyMessage(TextView tvContent, String notifyMessage) {
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(notifyMessage, new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.color_34D08B)));
|
||||
tvContent.setText(text.build());
|
||||
}
|
||||
@@ -2134,7 +1951,7 @@ public class MessageView extends FrameLayout {
|
||||
*/
|
||||
private void setInviteUpMicMsg(TextView tvContent, RoomQueueMsgAttachment attachment) {
|
||||
String targetNick = RegexUtil.getPrintableString(attachment.targetNick);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0108), new ForegroundColorSpan(greyColor))
|
||||
.append(targetNick, new ForegroundColorSpan(roomTipColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0109), new ForegroundColorSpan(greyColor));
|
||||
@@ -2144,7 +1961,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setKickMsg(TextView tvContent, RoomQueueMsgAttachment attachment) {
|
||||
String nick = RegexUtil.getPrintableString(attachment.handleNick);
|
||||
String targetNick = RegexUtil.getPrintableString(attachment.targetNick);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(targetNick, new ForegroundColorSpan(roomTipColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2173,7 +1990,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setKickRoomMsg(TextView tvContent, RoomQueueMsgAttachment attachment) {
|
||||
String nick = RegexUtil.getPrintableString(attachment.handleNick);
|
||||
String targetNick = RegexUtil.getPrintableString(attachment.targetNick);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(targetNick, new ForegroundColorSpan(roomTipColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2202,7 +2019,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setAddBlackMsg(TextView tvContent, RoomQueueMsgAttachment attachment) {
|
||||
String nick = RegexUtil.getPrintableString(attachment.handleNick);
|
||||
String targetNick = RegexUtil.getPrintableString(attachment.targetNick);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(targetNick, new ForegroundColorSpan(roomTipColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2251,7 +2068,7 @@ public class MessageView extends FrameLayout {
|
||||
*/
|
||||
private void setMsgText(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
addCommonTag(chatRoomMessage, text, tvContent);
|
||||
String nickName = extension == null ? ResUtil.getString(R.string.avroom_widget_messageview_0116) : RegexUtil.getPrintableString(extension.getSenderNick());
|
||||
text.append(nickName, new ForegroundColorSpan(greyColor))
|
||||
@@ -2289,7 +2106,7 @@ public class MessageView extends FrameLayout {
|
||||
tvContent.setText(text.build());
|
||||
}
|
||||
|
||||
private void addCommonTag(ChatRoomMessage chatRoomMessage, @NonNull SpannableBuilder builder, TextView tvContent) {
|
||||
private void addCommonTag(ChatRoomMessage chatRoomMessage, @NonNull TextSpannableBuilder builder, TextView tvContent) {
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
String userLevel = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, chatRoomMessage);
|
||||
boolean isOfficial = NobleUtil.getIsOfficial(UserInfo.IS_OFFICIAL, chatRoomMessage);
|
||||
@@ -2334,7 +2151,7 @@ public class MessageView extends FrameLayout {
|
||||
String senderNick = chatRoomMessage.getChatRoomMessageExtension().getSenderNick();
|
||||
senderNick = senderNick == null ? "" : senderNick;
|
||||
AuctionAttachment auctionAttachment = (AuctionAttachment) attachment;
|
||||
SpannableBuilder builder = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(tvContent);
|
||||
if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_AUCTION_START) {
|
||||
builder.append(ResUtil.getString(R.string.avroom_widget_messageview_0117), new ForegroundColorSpan(roomTipNickColor));
|
||||
} else if (attachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_AUCTION_FINISH) {
|
||||
@@ -2362,7 +2179,7 @@ public class MessageView extends FrameLayout {
|
||||
*/
|
||||
private void setMsgRoomTip(TextView tvContent, RoomTipAttachment roomTipAttachment, ChatRoomMessage chatRoomMessage) {
|
||||
if (TextUtils.isEmpty(roomTipAttachment.getNick())) roomTipAttachment.setNick("");
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(RegexUtil.getPrintableString(roomTipAttachment.getNick()), new ForegroundColorSpan(roomTipColor))
|
||||
.append(roomTipAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_ROOM_TIP_SHARE_ROOM ?
|
||||
@@ -2378,7 +2195,7 @@ public class MessageView extends FrameLayout {
|
||||
*/
|
||||
private void setFollowRoomTip(TextView tvContent, RoomTipAttachment roomTipAttachment, ChatRoomMessage chatRoomMessage) {
|
||||
if (TextUtils.isEmpty(roomTipAttachment.getNick())) roomTipAttachment.setNick("");
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(RegexUtil.getPrintableString(roomTipAttachment.getNick()), new ForegroundColorSpan(roomTipColor))
|
||||
.append(ResUtil.getString(R.string.avroom_widget_messageview_0125), new ForegroundColorSpan(greyColor));
|
||||
@@ -2395,7 +2212,7 @@ public class MessageView extends FrameLayout {
|
||||
* @param chatRoomMessage -
|
||||
*/
|
||||
private void setMsgFace(TextView tvContent, FaceAttachment faceAttachment, ChatRoomMessage chatRoomMessage) {
|
||||
SpannableBuilder builder = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(tvContent);
|
||||
List<FaceReceiveInfo> faceReceiveInfos = faceAttachment.getFaceReceiveInfos();
|
||||
FaceReceiveInfo faceReceiveInfo;
|
||||
FaceInfo faceInfo;
|
||||
@@ -2437,7 +2254,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setMsgMultiGift(TextView tvContent, MultiGiftAttachment giftAttachment, ChatRoomMessage chatRoomMessage) {
|
||||
GiftInfo giftInfo = giftAttachment.getMultiGiftReceiveInfo().getGift();
|
||||
String nick = RegexUtil.getPrintableString(giftAttachment.getMultiGiftReceiveInfo().getNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -2473,7 +2290,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
String nick = RegexUtil.getPrintableString(giftAttachment.getMultiLuckyGiftReceiveInfo().getNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -2528,7 +2345,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
String nick = RegexUtil.getPrintableString(giftAttachment.getMultiLuckyGiftReceiveInfo().getNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -2577,7 +2394,7 @@ public class MessageView extends FrameLayout {
|
||||
private void setMsgBatchGift(TextView tvContent, GiftBatchAttachment attachment, ChatRoomMessage chatRoomMessage) {
|
||||
GiftInfo giftInfo = attachment.getGiftMultiReceiverInfo().getGift();
|
||||
String nick = RegexUtil.getPrintableString(attachment.getGiftMultiReceiverInfo().getNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -2624,7 +2441,7 @@ public class MessageView extends FrameLayout {
|
||||
MagicInfo magicInfo = MagicModel.get().getMagicInfo(multiMagicReceivedInfo.getMagicId());
|
||||
String nick = RegexUtil.getPrintableString(multiMagicReceivedInfo.getNick());
|
||||
boolean showEffect = multiMagicReceivedInfo.isNeedShowExplode();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
@@ -2658,7 +2475,7 @@ public class MessageView extends FrameLayout {
|
||||
MagicInfo magicInfo = MagicModel.get().getMagicInfo(magicMultiReceiverInfo.getMagicId());
|
||||
String nick = RegexUtil.getPrintableString(magicMultiReceiverInfo.getNick());
|
||||
boolean showEffect = magicMultiReceiverInfo.isNeedShowExplode();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
@@ -2710,7 +2527,7 @@ public class MessageView extends FrameLayout {
|
||||
boolean showEffect = magicReceivedInfo.isNeedShowExplodeEffect();
|
||||
String nick = RegexUtil.getPrintableString(magicReceivedInfo.getNick());
|
||||
String targetNick = RegexUtil.getPrintableString(magicReceivedInfo.getTargetNick());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -2753,7 +2570,7 @@ public class MessageView extends FrameLayout {
|
||||
String nick = RegexUtil.getPrintableString(giftReceiveInfo.getNick());
|
||||
String targetNick = RegexUtil.getPrintableString(giftReceiveInfo.getTargetNick());
|
||||
String num = "X" + giftReceiveInfo.getGiftNum();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@@ -2808,7 +2625,7 @@ public class MessageView extends FrameLayout {
|
||||
String carName = NobleUtil.getCarName(CarInfo.CAR_NAME, chatRoomMessage);
|
||||
carName = TextUtils.isEmpty(carName) ? "" : "\"" + carName + "\"";
|
||||
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
addCommonTag(chatRoomMessage, text, tvContent);
|
||||
text.append(senderNick, new ForegroundColorSpan(roomTipColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@@ -2905,8 +2722,8 @@ public class MessageView extends FrameLayout {
|
||||
tvContent.setMovementMethod(new LinkMovementMethod());
|
||||
}
|
||||
|
||||
private SpannableBuilder getNotificationBuilder(TextView tvContent, String senderNick, String desc, String tagNick, String carName) {
|
||||
return new SpannableBuilder(tvContent)
|
||||
private TextSpannableBuilder getNotificationBuilder(TextView tvContent, String senderNick, String desc, String tagNick, String carName) {
|
||||
return new TextSpannableBuilder(tvContent)
|
||||
.append(senderNick, new ForegroundColorSpan(roomTipColor))
|
||||
.append(desc, new ForegroundColorSpan(textColor))
|
||||
.append(tagNick, new ForegroundColorSpan(roomTipColor))
|
||||
@@ -2935,7 +2752,7 @@ public class MessageView extends FrameLayout {
|
||||
// 系統通知icon
|
||||
Drawable icNotification = mContext.getResources().getDrawable(R.drawable.ic_system_notification);
|
||||
int width = (int) (icNotification.getIntrinsicWidth() / (icNotification.getIntrinsicHeight() + 0.F) * sysIconHeight);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append(icNotification, width, sysIconHeight)
|
||||
.append(" 恭喜 ", new ForegroundColorSpan(greyColor))
|
||||
.append(senderNick, new ForegroundColorSpan(roomTipColor))
|
||||
@@ -2957,7 +2774,7 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
CarveUpGoldAttachment attachment = (CarveUpGoldAttachment) chatRoomMessage.getAttachment();
|
||||
// 內容
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent)
|
||||
.append("【簽到瓜分百萬】哇塞,恭喜 ", new ForegroundColorSpan(greyColor))
|
||||
.append(attachment.getNick() + " ", new ForegroundColorSpan(roomTipColor))
|
||||
.append("簽到獲得 ", new ForegroundColorSpan(greyColor))
|
||||
@@ -2983,7 +2800,7 @@ public class MessageView extends FrameLayout {
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
// 內容
|
||||
String fromAccount = chatRoomMessage.getFromAccount();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
addCommonTag(chatRoomMessage, text, tvContent);
|
||||
text.append(extension == null ? "我" : RegexUtil.getPrintableString(extension.getSenderNick()),
|
||||
new ForegroundColorSpan(greyColor),
|
||||
|
@@ -35,18 +35,16 @@ import com.chwl.app.ui.utils.isDestroyed
|
||||
import com.chwl.app.ui.utils.load
|
||||
import com.chwl.app.ui.utils.loadAnim
|
||||
import com.chwl.app.ui.widget.SimpleAnimListener
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder
|
||||
import com.chwl.app.ui.widget.drawgift.DrawGiftPlayHelper
|
||||
import com.chwl.app.utils.SpannableBuilder
|
||||
import com.chwl.core.XConstants
|
||||
import com.chwl.core.auth.AuthModel
|
||||
import com.chwl.core.decoration.car.bean.CarInfo
|
||||
import com.chwl.core.im.custom.bean.*
|
||||
import com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY
|
||||
import com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA
|
||||
import com.chwl.core.manager.AvRoomDataManager
|
||||
import com.chwl.core.manager.IMNetEaseManager
|
||||
import com.chwl.core.manager.RoomEvent
|
||||
import com.chwl.core.monsterhunting.SimpleAnimationListener
|
||||
import com.chwl.core.room.bean.DatingNotifyInfo
|
||||
import com.chwl.core.super_admin.util.SuperAdminUtil
|
||||
import com.chwl.core.user.UserModel
|
||||
@@ -54,7 +52,6 @@ import com.chwl.core.user.bean.UserInfo
|
||||
import com.chwl.core.utils.extension.subAndReplaceDot
|
||||
import com.chwl.library.utils.ListUtils
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import com.chwl.library.utils.StringUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableEmitter
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
@@ -720,7 +717,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
val textView = LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.layout_member_in_notify, null) as SuperTextView
|
||||
// 內容
|
||||
val text = MessageView.SpannableBuilder(textView)
|
||||
val text = TextSpannableBuilder(textView)
|
||||
.append(targetNicks[0], ForegroundColorSpan(Color.WHITE))
|
||||
var enterText = ResUtil.getString(R.string.avroom_widget_roomeffectview_018)
|
||||
if (fromType == AVRoomActivity.FROM_TYPE_RECOMMEND) {
|
||||
@@ -1219,7 +1216,7 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
val msgBean = (chatRoomMessage.attachment as RoomRankAttachment).msgBean
|
||||
val rootView = LayoutInflater.from(mContext).inflate(R.layout.layout_room_rank_notify, null)
|
||||
val textView = rootView.findViewById<TextView>(R.id.tv_content)
|
||||
val text = MessageView.SpannableBuilder(textView)
|
||||
val text = TextSpannableBuilder(textView)
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_025),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
|
@@ -39,6 +39,7 @@ import com.chwl.app.ui.utils.load
|
||||
import com.chwl.app.ui.utils.loadAnim
|
||||
import com.chwl.app.ui.webview.CommonWebViewActivity
|
||||
import com.chwl.app.ui.widget.SimpleAnimListener
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder
|
||||
import com.chwl.app.ui.widget.drawgift.DrawGiftPlayHelper
|
||||
import com.chwl.app.ui.widget.magicindicator.buildins.UIUtil
|
||||
import com.chwl.app.utils.MsgBuilder
|
||||
@@ -1416,7 +1417,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
val textView = LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.layout_member_in_notify, null) as SuperTextView
|
||||
// 內容
|
||||
val text = MessageView.SpannableBuilder(textView)
|
||||
val text = TextSpannableBuilder(textView)
|
||||
.append(targetNicks[0], ForegroundColorSpan(Color.WHITE))
|
||||
var enterText = ResUtil.getString(R.string.avroom_widget_roomeffectview_018)
|
||||
if (fromType == AVRoomActivity.FROM_TYPE_RECOMMEND) {
|
||||
@@ -1936,7 +1937,7 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
val msgBean = (chatRoomMessage.attachment as RoomRankAttachment).msgBean
|
||||
val rootView = LayoutInflater.from(mContext).inflate(R.layout.layout_room_rank_notify, null)
|
||||
val textView = rootView.findViewById<TextView>(R.id.tv_content)
|
||||
val text = MessageView.SpannableBuilder(textView)
|
||||
val text = TextSpannableBuilder(textView)
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_025),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
|
@@ -8,6 +8,7 @@ import android.text.style.ForegroundColorSpan
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import com.chwl.app.common.widget.OriginalDrawStatusClickSpan
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder
|
||||
import com.chwl.app.utils.CommonJumpHelper
|
||||
import com.chwl.app.utils.SpannableBuilder
|
||||
import com.chwl.core.home.bean.BannerInfo
|
||||
@@ -65,7 +66,7 @@ class TemplateMessageAdapter(val listener: Listener?) {
|
||||
return
|
||||
}
|
||||
val nodeList = attachment.getNodeList()
|
||||
val textBuilder = MessageView.SpannableBuilder(textView)
|
||||
val textBuilder = TextSpannableBuilder(textView)
|
||||
nodeList.forEach {
|
||||
if (it is TemplateNode.NormalNode) {
|
||||
val textColor = parseColor(it.textColor)
|
||||
|
@@ -19,6 +19,7 @@ import com.chwl.app.ui.im.avtivity.NimP2PMessageActivity;
|
||||
import com.chwl.app.ui.im.friend.FriendFragmentCpDelegate;
|
||||
import com.chwl.app.ui.search.presenter.SearchPresenter;
|
||||
import com.chwl.app.ui.search.view.ISearchView;
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder;
|
||||
import com.chwl.core.bean.RoomHistoryInfo;
|
||||
import com.chwl.core.module_hall.hall.HallModel;
|
||||
import com.chwl.core.room.bean.SearchRoomInfo;
|
||||
@@ -139,7 +140,7 @@ public class SearchDetailFragment extends BaseMvpFragment<ISearchView, SearchPre
|
||||
nick = "";
|
||||
}
|
||||
long targetUid = JavaUtil.str2long(targetId);
|
||||
MessageView.SpannableBuilder text = new MessageView.SpannableBuilder(null);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(null);
|
||||
text.append(ResUtil.getString(R.string.ui_search_searchdetailfragment_01))
|
||||
.append(nick, new ForegroundColorSpan(getResources().getColor(R.color.color_9168FA)))
|
||||
.append(ResUtil.getString(R.string.ui_search_searchdetailfragment_02))
|
||||
|
@@ -12,6 +12,7 @@ import android.widget.ImageView;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.util.Consumer;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
@@ -550,6 +551,10 @@ public class ImageLoadUtils {
|
||||
}
|
||||
|
||||
public static void loadNinePatchBg(View view, String bgUrl) {
|
||||
loadNinePatchBg(view, bgUrl,null);
|
||||
}
|
||||
|
||||
public static void loadNinePatchBg(View view, String bgUrl, Consumer<Boolean> callback) {
|
||||
GlideApp.with(view)
|
||||
.asBitmap()
|
||||
.load(bgUrl)
|
||||
@@ -559,25 +564,28 @@ public class ImageLoadUtils {
|
||||
try {
|
||||
NinePatchDrawable drawable = NinePatchBitmapFactory.createNinePatchDrawable(view.getResources(), resource);
|
||||
view.setBackground(drawable);
|
||||
if (callback != null) {
|
||||
callback.accept(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.accept(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
LogUtils.d("onLoadFailed");
|
||||
if (callback != null) {
|
||||
callback.accept(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,196 @@
|
||||
package com.chwl.app.ui.widget;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chwl.app.common.widget.CustomAutoWidthImageSpan;
|
||||
import com.chwl.app.common.widget.CustomImageSpan;
|
||||
|
||||
public class TextSpannableBuilder {
|
||||
public SpannableStringBuilder builder;
|
||||
private TextView textView;
|
||||
|
||||
public TextSpannableBuilder(TextView textView) {
|
||||
builder = new SpannableStringBuilder();
|
||||
this.textView = textView;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text 文字
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public TextSpannableBuilder append(CharSequence text) {
|
||||
if (TextUtils.isEmpty(text)) return this;
|
||||
builder.append(text);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon url
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public TextSpannableBuilder appendImg(String drawable) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @param drawable -icon url
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public TextSpannableBuilder appendImg(String drawable, Object what) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon url
|
||||
* @param width 寬
|
||||
* @param height 高
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public TextSpannableBuilder append(String drawable, int width, int height) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable, width, height);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextSpannableBuilder append(String drawable, int width, int height, Object what) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable, width, height);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本和背景分離的情況
|
||||
*/
|
||||
public TextSpannableBuilder appendBgAndContent(String drawable, String content) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable, content);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon
|
||||
* @param width 寬
|
||||
* @param height 高
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public TextSpannableBuilder append(Drawable drawable, int width, int height) {
|
||||
if (drawable == null) return this;
|
||||
drawable.setBounds(0, 0, width, height);
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomImageSpan(drawable), start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param imgUrl -icon url
|
||||
* @param height 高
|
||||
* @return -返回一個spannableStringBuilder,自適應寬度
|
||||
*/
|
||||
public TextSpannableBuilder append(String imgUrl, int height) {
|
||||
if (TextUtils.isEmpty(imgUrl)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomAutoWidthImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, imgUrl, height)
|
||||
, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextSpannableBuilder append(String imgUrl, int height, Object what) {
|
||||
if (TextUtils.isEmpty(imgUrl)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomAutoWidthImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, imgUrl, height)
|
||||
, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon
|
||||
* @param width 寬
|
||||
* @param height 高
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public TextSpannableBuilder append(Drawable drawable, int width, int height, Object... whats) {
|
||||
if (drawable == null) return this;
|
||||
try {
|
||||
drawable.setBounds(0, 0, width, height);
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomImageSpan(drawable), start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
if (whats != null) {
|
||||
for (int i = 0; i < whats.length; i++) {
|
||||
builder.setSpan(whats[0], start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text -文字
|
||||
* @param what -span類型
|
||||
* @return -返回一個spannableStringBuilder
|
||||
*/
|
||||
public TextSpannableBuilder append(CharSequence text, Object what) {
|
||||
if (TextUtils.isEmpty(text)) return this;
|
||||
int start = builder.length();
|
||||
builder.append(text);
|
||||
builder.setSpan(what, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持多個spannable 對同一段文字修改
|
||||
*
|
||||
* @param text
|
||||
* @param what
|
||||
* @return
|
||||
*/
|
||||
public TextSpannableBuilder append(CharSequence text, Object... what) {
|
||||
if (TextUtils.isEmpty(text)) return this;
|
||||
int start = builder.length();
|
||||
builder.append(text);
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
Object o = what[i];
|
||||
if (o == null) {
|
||||
continue;
|
||||
}
|
||||
builder.setSpan(what[i], start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public SpannableStringBuilder build() {
|
||||
return builder;
|
||||
}
|
||||
}
|
5
app/src/main/res/drawable/shape_f5f5f5_16dp.xml
Normal file
5
app/src/main/res/drawable/shape_f5f5f5_16dp.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="16dp" />
|
||||
<solid android:color="@color/color_f5f5f5" />
|
||||
</shape>
|
@@ -727,4 +727,5 @@
|
||||
|
||||
<color name="color_10ECD6">#10ECD6</color>
|
||||
<color name="color_4D415E">#4D415E</color>
|
||||
<color name="color_DE3446">#DE3446</color>
|
||||
</resources>
|
||||
|
@@ -12,6 +12,7 @@ import com.chwl.app.avroom.widget.MessageView;
|
||||
import com.chwl.app.base.BaseMvpPresenter;
|
||||
import com.chwl.app.module_hall.HallDataManager;
|
||||
import com.chwl.app.module_hall.hall.view.IModuleHallView;
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder;
|
||||
import com.chwl.core.auth.AuthModel;
|
||||
import com.chwl.core.module_hall.hall.HallModel;
|
||||
import com.chwl.core.module_hall.hall.bean.AuthInfo;
|
||||
@@ -117,7 +118,7 @@ public class ModuleHallPresenter extends BaseMvpPresenter<IModuleHallView> {
|
||||
}
|
||||
|
||||
public CharSequence getExitTips(Context context) {
|
||||
MessageView.SpannableBuilder builder = new MessageView.SpannableBuilder(null);
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(null);
|
||||
builder.append(ResUtil.getString(R.string.hall_presenter_modulehallpresenter_01))
|
||||
.append(ResUtil.getString(R.string.hall_presenter_modulehallpresenter_02), new ForegroundColorSpan(
|
||||
ContextCompat.getColor(context, R.color.appColor)))
|
||||
|
@@ -9,6 +9,7 @@ import android.view.View;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder;
|
||||
import com.netease.nim.uikit.business.ait.AitContactType;
|
||||
import com.netease.nim.uikit.business.ait.selector.AitContactSelectorActivity;
|
||||
import com.chwl.app.R;
|
||||
@@ -252,7 +253,7 @@ public class HTeamMemberListActivity extends BaseViewBindingActivity<ActivityHte
|
||||
});
|
||||
return;
|
||||
}
|
||||
MessageView.SpannableBuilder builder = new MessageView.SpannableBuilder(null);
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(null);
|
||||
builder.append(ResUtil.getString(R.string.team_activity_hteammemberlistactivity_05))
|
||||
.append(item.getNick(), new ForegroundColorSpan(
|
||||
getResources().getColor(R.color.appColor)))
|
||||
@@ -289,7 +290,7 @@ public class HTeamMemberListActivity extends BaseViewBindingActivity<ActivityHte
|
||||
* 管理员处理
|
||||
*/
|
||||
private void managerOp(HTeamMember item) {
|
||||
MessageView.SpannableBuilder builder = new MessageView.SpannableBuilder(null);
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(null);
|
||||
if (item.isAdmin()) {
|
||||
builder.append(ResUtil.getString(R.string.team_activity_hteammemberlistactivity_07))
|
||||
.append(item.getNick(), new ForegroundColorSpan(
|
||||
@@ -346,7 +347,7 @@ public class HTeamMemberListActivity extends BaseViewBindingActivity<ActivityHte
|
||||
* 删除群成员
|
||||
*/
|
||||
private void removeMemberOp(HTeamMember item) {
|
||||
MessageView.SpannableBuilder builder = new MessageView.SpannableBuilder(null);
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(null);
|
||||
builder.append(ResUtil.getString(R.string.team_activity_hteammemberlistactivity_011))
|
||||
.append(item.getNick(), new ForegroundColorSpan(getResources().getColor(R.color.appColor)))
|
||||
.append(ResUtil.getString(R.string.team_activity_hteammemberlistactivity_012));
|
||||
|
@@ -46,7 +46,7 @@ public class ChatRoomMessageAdapter extends BaseMultiItemFetchLoadAdapter<ChatRo
|
||||
int viewType = 0;
|
||||
for (Class<? extends ChatRoomMessageViewHolderBase> holder : holders) {
|
||||
viewType++;
|
||||
addItemType(viewType, R.layout.nim_message_item, holder);
|
||||
addItemType(viewType, R.layout.nim_chat_room_message_item, holder);
|
||||
holder2ViewType.put(holder, viewType);
|
||||
}
|
||||
|
||||
|
@@ -11,10 +11,18 @@ import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.util.Consumer;
|
||||
|
||||
import com.chwl.app.public_chat.core.ChatRoomMessageAdapter;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtils;
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder;
|
||||
import com.chwl.core.level.UserLevelResourceType;
|
||||
import com.chwl.core.noble.NobleUtil;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.example.lib_utils.UiUtils;
|
||||
import com.netease.nim.uikit.R;
|
||||
import com.netease.nim.uikit.api.model.team.AvatarClickListener;
|
||||
import com.netease.nim.uikit.business.team.helper.TeamHelper;
|
||||
import com.netease.nim.uikit.common.ui.imageview.HeadImageView;
|
||||
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
|
||||
import com.netease.nim.uikit.common.ui.recyclerview.holder.NIMBaseViewHolder;
|
||||
@@ -27,8 +35,6 @@ import com.netease.nimlib.sdk.msg.MsgService;
|
||||
import com.netease.nimlib.sdk.msg.attachment.FileAttachment;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgDirectionEnum;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgStatusEnum;
|
||||
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
|
||||
/**
|
||||
* 会话窗口消息列表项的ViewHolder基类,负责每个消息项的外层框架,包括头像,昵称,发送/接收进度条,重发按钮等。<br>
|
||||
@@ -43,7 +49,7 @@ public abstract class ChatRoomMessageViewHolderBase extends RecyclerViewHolder<B
|
||||
protected BaseMultiItemFetchLoadAdapter adapter;
|
||||
|
||||
// data
|
||||
protected IMMessage message;
|
||||
protected ChatRoomMessage message;
|
||||
|
||||
// view
|
||||
protected View alertButton;
|
||||
@@ -58,6 +64,7 @@ public abstract class ChatRoomMessageViewHolderBase extends RecyclerViewHolder<B
|
||||
protected View.OnLongClickListener longClickListener;
|
||||
private HeadImageView avatarLeft;
|
||||
private HeadImageView avatarRight;
|
||||
private int expLevelHeight = UiUtils.INSTANCE.dip2px(18f);
|
||||
|
||||
public ChatRoomMessageViewHolderBase(BaseMultiItemFetchLoadAdapter adapter) {
|
||||
super(adapter);
|
||||
@@ -90,12 +97,12 @@ public abstract class ChatRoomMessageViewHolderBase extends RecyclerViewHolder<B
|
||||
|
||||
// 当是接收到的消息时,内容区域背景的drawable id
|
||||
protected int leftBackground() {
|
||||
return NimUIKitImpl.getOptions().messageLeftBackground;
|
||||
return R.drawable.bg_nim_water_drop_other_chatroom;
|
||||
}
|
||||
|
||||
// 当是发送出去的消息时,内容区域背景的drawable id
|
||||
protected int rightBackground() {
|
||||
return NimUIKitImpl.getOptions().messageRightBackground;
|
||||
return R.drawable.bg_nim_water_drop_self_chatroom;
|
||||
}
|
||||
|
||||
// 返回该消息是不是居中显示
|
||||
@@ -124,7 +131,7 @@ public abstract class ChatRoomMessageViewHolderBase extends RecyclerViewHolder<B
|
||||
}
|
||||
|
||||
protected boolean shouldDisplayNick() {
|
||||
return message.getSessionType() == SessionTypeEnum.Team && isReceivedMessage() && !isMiddleItem();
|
||||
return isReceivedMessage() && !isMiddleItem();
|
||||
}
|
||||
|
||||
|
||||
@@ -204,6 +211,7 @@ public abstract class ChatRoomMessageViewHolderBase extends RecyclerViewHolder<B
|
||||
setReadReceipt();
|
||||
|
||||
bindContentView();
|
||||
loadBubble();
|
||||
}
|
||||
|
||||
public void refreshCurrentItem() {
|
||||
@@ -260,7 +268,12 @@ public abstract class ChatRoomMessageViewHolderBase extends RecyclerViewHolder<B
|
||||
show.setVisibility(View.GONE);
|
||||
} else {
|
||||
show.setVisibility(View.VISIBLE);
|
||||
show.loadBuddyAvatar(message);
|
||||
String avatar = NobleUtil.getLevel(UserInfo.AVATAR, message);
|
||||
if (avatar.length() != 0) {
|
||||
show.loadAvatar(avatar);
|
||||
} else {
|
||||
show.loadBuddyAvatar(message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -349,15 +362,27 @@ public abstract class ChatRoomMessageViewHolderBase extends RecyclerViewHolder<B
|
||||
return;
|
||||
}
|
||||
nameTextView.setVisibility(View.VISIBLE);
|
||||
nameTextView.setText(getNameText());
|
||||
TextSpannableBuilder builder = new TextSpannableBuilder(nameTextView);
|
||||
String nickName = getNameText();
|
||||
builder.append(nickName);
|
||||
addCommonTag(message, builder, nameTextView);
|
||||
nameTextView.setText(builder.build());
|
||||
}
|
||||
|
||||
private void addCommonTag(ChatRoomMessage chatRoomMessage, @NonNull TextSpannableBuilder builder, TextView tvContent) {
|
||||
String userLevel = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, chatRoomMessage);
|
||||
String charmLevel = NobleUtil.getLevel(UserLevelResourceType.CHARM_URL, chatRoomMessage);
|
||||
//等級
|
||||
builder.append(userLevel, expLevelHeight);
|
||||
builder.append(charmLevel, expLevelHeight);
|
||||
}
|
||||
|
||||
protected String getNameText() {
|
||||
if (message.getSessionType() == SessionTypeEnum.Team) {
|
||||
return TeamHelper.getTeamMemberDisplayName(message.getSessionId(), message.getFromAccount());
|
||||
String name = NobleUtil.getNamePlate(UserInfo.NICK, message);
|
||||
if (name.length() > 6) {
|
||||
return name.substring(0, 6) + "..";
|
||||
}
|
||||
return "";
|
||||
return name;
|
||||
}
|
||||
|
||||
private void setContent() {
|
||||
@@ -379,18 +404,35 @@ public abstract class ChatRoomMessageViewHolderBase extends RecyclerViewHolder<B
|
||||
} else {
|
||||
if (isReceivedMessage()) {
|
||||
setGravity(bodyContainer, Gravity.START);
|
||||
contentContainer.setBackgroundResource(leftBackground());
|
||||
// contentContainer.setAlpha(0);
|
||||
// contentContainer.animate().alpha(1f).setDuration(2000).start();
|
||||
} else {
|
||||
setGravity(bodyContainer, Gravity.END);
|
||||
contentContainer.setBackgroundResource(rightBackground());
|
||||
// contentContainer.setAlpha(0);
|
||||
// contentContainer.animate().alpha(1f).setDuration(2000).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBubble(){
|
||||
if (!isShowBubble() || isMiddleItem()) {
|
||||
return;
|
||||
}
|
||||
onLoadBubble();
|
||||
}
|
||||
|
||||
protected void onLoadBubble() {
|
||||
if (isReceivedMessage()) {
|
||||
contentContainer.setBackgroundResource(leftBackground());
|
||||
} else {
|
||||
contentContainer.setBackgroundResource(rightBackground());
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadCustomBubble(Consumer<Boolean> callback) {
|
||||
String androidBubbleUrl = NobleUtil.getResource(UserInfo.BUBBLE_URL_ANDROID, message);
|
||||
if (TextUtils.isEmpty(androidBubbleUrl)) return;
|
||||
int padding = UiUtils.INSTANCE.dip2px(12);
|
||||
contentContainer.setPadding(padding, padding, padding, padding);
|
||||
ImageLoadUtils.loadNinePatchBg(contentContainer, androidBubbleUrl, callback);
|
||||
}
|
||||
|
||||
private void setReadReceipt() {
|
||||
if (shouldDisplayReceipt() && !TextUtils.isEmpty(getMsgAdapter().getUuid()) && message.getUuid().equals(getMsgAdapter().getUuid())) {
|
||||
readReceiptTextView.setVisibility(View.VISIBLE);
|
||||
|
@@ -1,14 +1,45 @@
|
||||
package com.chwl.app.public_chat.core.viewholder
|
||||
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import com.chwl.app.R
|
||||
import com.chwl.core.im.custom.bean.HeadlineChangedAttachment
|
||||
import com.example.lib_utils.ktx.getColorById
|
||||
import com.example.lib_utils.spannable.SpannableTextBuilder
|
||||
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter
|
||||
|
||||
class ChatRoomMessageViewHolderHeadline(adapter: BaseMultiItemFetchLoadAdapter<*, *>) :
|
||||
ChatRoomMessageViewHolderNotification(adapter) {
|
||||
ChatRoomMessageViewHolderBase(adapter) {
|
||||
|
||||
private var textView: TextView? = null
|
||||
|
||||
override fun bindContentView() {
|
||||
val nick = (message.attachment as? HeadlineChangedAttachment)?.headlineData?.nick ?: ""
|
||||
notificationTextView.text = context.getString(R.string.headline_message_format, nick)
|
||||
val data = (message.attachment as? HeadlineChangedAttachment)?.headlineData
|
||||
val nick = data?.nick ?: ""
|
||||
textView?.let {
|
||||
SpannableTextBuilder(it).appendText(
|
||||
context.getString(
|
||||
R.string.headline_message_format,
|
||||
nick
|
||||
)
|
||||
).setTextStyle(nick, textColor = context.getColorById(R.color.color_DE3446)).apply()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getContentResId(): Int {
|
||||
return R.layout.public_chat_message_item_headline
|
||||
}
|
||||
|
||||
override fun shouldDisplayNick(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun inflateContentView() {
|
||||
textView =
|
||||
view.findViewById<View>(R.id.tv_content) as TextView
|
||||
}
|
||||
|
||||
override fun isMiddleItem(): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
@@ -27,4 +27,10 @@ public class ChatRoomMessageViewHolderPicture extends ChatRoomMessageViewHolderT
|
||||
protected String thumbFromSourceFile(String path) {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoadBubble() {
|
||||
super.onLoadBubble();
|
||||
loadCustomBubble(null);
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,10 @@
|
||||
package com.chwl.app.public_chat.core.viewholder;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.chwl.app.public_chat.core.viewholder.ChatRoomMessageViewHolderBase;
|
||||
import com.netease.nim.uikit.R;
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
import com.netease.nim.uikit.business.session.emoji.MoonUtil;
|
||||
@@ -36,12 +33,30 @@ public class ChatRoomMessageViewHolderText extends ChatRoomMessageViewHolderBase
|
||||
|
||||
@Override
|
||||
protected void bindContentView() {
|
||||
bodyTextView.setTextColor(ContextCompat.getColor(context,R.color.color_C6C6E9));
|
||||
loadTextColor();
|
||||
bodyTextView.setOnClickListener(v -> onItemClick());
|
||||
MoonUtil.identifyFaceExpression(NimUIKit.getContext(), bodyTextView, getDisplayText(), ImageSpan.ALIGN_BOTTOM);
|
||||
bodyTextView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
bodyTextView.setOnLongClickListener(longClickListener);
|
||||
bodyTextView.setLinkTextColor(Color.parseColor("#C6C6E9"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoadBubble() {
|
||||
super.onLoadBubble();
|
||||
loadCustomBubble(aBoolean -> {
|
||||
if (aBoolean) {
|
||||
bodyTextView.setTextColor(ContextCompat.getColor(context, R.color.color_333333));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadTextColor() {
|
||||
int textColor = ContextCompat.getColor(context, R.color.color_333333);
|
||||
if (isReceivedMessage()) {
|
||||
textColor = ContextCompat.getColor(context, R.color.color_white);
|
||||
}
|
||||
bodyTextView.setTextColor(textColor);
|
||||
bodyTextView.setLinkTextColor(textColor);
|
||||
}
|
||||
|
||||
protected String getDisplayText() {
|
||||
|
@@ -9,7 +9,6 @@ import com.chwl.app.base.BaseBindingActivity
|
||||
import com.chwl.app.databinding.PublicChatMessageActivityBinding
|
||||
import com.chwl.app.public_chat.ui.message.headline.HeadlineSendDialog
|
||||
import com.chwl.core.initial.InitialModel
|
||||
import com.chwl.core.user.UserModel
|
||||
import com.chwl.library.annatation.ActLayoutRes
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import com.chwl.library.utils.SingleToastUtil
|
||||
@@ -57,6 +56,9 @@ class PublicChatRoomMessageActivity : BaseBindingActivity<PublicChatMessageActiv
|
||||
}
|
||||
|
||||
private fun initEvent() {
|
||||
mBinding?.layoutHeadline?.singleClick {
|
||||
HeadlineSendDialog().show(supportFragmentManager, "HEADLINE_SEND")
|
||||
}
|
||||
mBinding?.ivHeadline?.singleClick {
|
||||
HeadlineSendDialog().show(supportFragmentManager, "HEADLINE_SEND")
|
||||
}
|
||||
@@ -64,13 +66,16 @@ class PublicChatRoomMessageActivity : BaseBindingActivity<PublicChatMessageActiv
|
||||
|
||||
private fun initObserve() {
|
||||
viewModel.headlineLiveData.observe(this) {
|
||||
logD("headlineLiveData:${it}")
|
||||
val content = it?.content
|
||||
mBinding.tvHeadline.text = content
|
||||
mBinding.tvHeadlineContent.text = content ?: ""
|
||||
if (content.isNullOrEmpty()) {
|
||||
mBinding.tvHeadline.isVisible = false
|
||||
mBinding.layoutHeadline.setBackgroundResource(R.drawable.public_chat_bg_headline_empty)
|
||||
mBinding.tvHeadlineContent.isVisible = false
|
||||
mBinding.groupHeadlineEmpty.isVisible = true
|
||||
} else {
|
||||
mBinding.tvHeadline.isVisible = true
|
||||
mBinding.layoutHeadline.setBackgroundResource(R.drawable.public_chat_bg_headline)
|
||||
mBinding.tvHeadlineContent.isVisible = true
|
||||
mBinding.groupHeadlineEmpty.isVisible = false
|
||||
}
|
||||
}
|
||||
viewModel.getCurrentHeadline()
|
||||
|
@@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -12,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.public_chat.core.ChatRoomMessageAdapter;
|
||||
import com.chwl.core.im.custom.bean.HeadlineChangedAttachment;
|
||||
import com.chwl.core.module_hall.im.HallAttachment;
|
||||
import com.chwl.core.module_hall.im.HallImMsgInfo;
|
||||
import com.chwl.library.utils.ResUtil;
|
||||
@@ -87,6 +89,8 @@ public class PublicChatRoomMessageListPanel {
|
||||
private VoiceTrans voiceTrans;
|
||||
private MessageLoader messageLoader;
|
||||
|
||||
private int maxMessageCount = 1000;
|
||||
|
||||
private OnItemClickListener listener = new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(IRecyclerView adapter, View view, int position) {
|
||||
@@ -256,12 +260,13 @@ public class PublicChatRoomMessageListPanel {
|
||||
}
|
||||
|
||||
public void onIncomingMessage(List<ChatRoomMessage> messages) {
|
||||
Log.d("MAAAX", "onIncomingMessage messages.size:" + messages.size());
|
||||
boolean needScrollToBottom = isLastMessageVisible();
|
||||
boolean needRefresh = false;
|
||||
List<ChatRoomMessage> addedListItems = new ArrayList<>(messages.size());
|
||||
for (ChatRoomMessage message : messages) {
|
||||
|
||||
if (isMyMessage(message)) {
|
||||
if (isMyMessage(message) && !filterMessage(message)) {
|
||||
items.add(message);
|
||||
addedListItems.add(message);
|
||||
needRefresh = true;
|
||||
@@ -269,6 +274,11 @@ public class PublicChatRoomMessageListPanel {
|
||||
}
|
||||
if (needRefresh) {
|
||||
sortMessages(items);
|
||||
if (items.size() > maxMessageCount) {
|
||||
for (int i = 0; i < maxMessageCount / 2; i++) {
|
||||
items.remove(0);
|
||||
}
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -357,6 +367,18 @@ public class PublicChatRoomMessageListPanel {
|
||||
&& message.getSessionId().equals(container.account);
|
||||
}
|
||||
|
||||
public boolean filterMessage(ChatRoomMessage message) {
|
||||
if (message.getMsgType() == MsgTypeEnum.notification) {
|
||||
return true;
|
||||
}
|
||||
if (message.getAttachment() instanceof HeadlineChangedAttachment) {
|
||||
if (((HeadlineChangedAttachment) message.getAttachment()).getHeadlineData() == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新单条消息
|
||||
*/
|
||||
@@ -487,7 +509,9 @@ public class PublicChatRoomMessageListPanel {
|
||||
|
||||
private class MessageLoader implements BaseFetchLoadAdapter.RequestLoadMoreListener, BaseFetchLoadAdapter.RequestFetchMoreListener {
|
||||
|
||||
private int loadMsgCount = getLoadMsgCount();
|
||||
private int loadMsgCount = 100;
|
||||
|
||||
private int historyMaxCount = 200;
|
||||
|
||||
private ChatRoomMessage anchor;
|
||||
|
||||
@@ -526,10 +550,6 @@ public class PublicChatRoomMessageListPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private int getLoadMsgCount() {
|
||||
return 50;
|
||||
}
|
||||
|
||||
/**
|
||||
* 私聊聊天信息数(发起私聊限制需要用到)
|
||||
*
|
||||
@@ -568,8 +588,7 @@ public class PublicChatRoomMessageListPanel {
|
||||
total.addAll(0, messages);
|
||||
adapter.updateShowTimeItem(total, true, firstLoad); // 更新要显示时间的消息
|
||||
updateReceipt(total); // 更新已读回执标签
|
||||
|
||||
if (noMoreMessage) {
|
||||
if (noMoreMessage || total.size() >= historyMaxCount) {
|
||||
adapter.fetchMoreEnd(messages, true);
|
||||
} else {
|
||||
adapter.fetchMoreComplete(messages);
|
||||
@@ -582,7 +601,6 @@ public class PublicChatRoomMessageListPanel {
|
||||
}
|
||||
|
||||
firstLoad = false;
|
||||
loadMsgCount = NimUIKitImpl.getOptions().messageCountLoadOnce;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -6,6 +6,7 @@ import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.base.BaseDialog
|
||||
import com.chwl.app.common.widget.dialog.DialogManager
|
||||
import com.chwl.app.databinding.HeadlineSendDialogBinding
|
||||
import com.chwl.app.public_chat.ui.message.PublicChatRoomViewModel
|
||||
import com.chwl.app.ui.pay.ChargeActivity
|
||||
@@ -24,7 +25,9 @@ class HeadlineSendDialog : BaseDialog<HeadlineSendDialogBinding>() {
|
||||
override var width = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
override var gravity = Gravity.BOTTOM
|
||||
private var dialogManager: DialogManager? = null
|
||||
override fun init() {
|
||||
dialogManager = DialogManager(context)
|
||||
lifecycleScope.launch(Dispatchers.Main) {
|
||||
viewModel.sendHeadlineFlow.collect {
|
||||
if (it.isSuccess) {
|
||||
@@ -39,10 +42,14 @@ class HeadlineSendDialog : BaseDialog<HeadlineSendDialogBinding>() {
|
||||
}
|
||||
}
|
||||
}
|
||||
viewModel.loadingLiveData.observe(this) {
|
||||
if (it) dialogManager?.showProgressDialog(context)
|
||||
else dialogManager?.dismissDialog()
|
||||
}
|
||||
viewModel.headlinePayMoneyLiveData.observe(this) {
|
||||
binding.tvBuy.text = getString(R.string.headline_buy_format, it?.toString() ?: "-")
|
||||
}
|
||||
binding.tvBuy.singleClick {
|
||||
binding.layoutBuy.singleClick {
|
||||
val message = getInputContent()
|
||||
if (message.isEmpty()) {
|
||||
SingleToastUtil.showToast(R.string.team_view_createteammessageactivity_05)
|
||||
@@ -92,4 +99,9 @@ class HeadlineSendDialog : BaseDialog<HeadlineSendDialogBinding>() {
|
||||
)
|
||||
tipDialog.show()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
dialogManager?.dismissDialog()
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
Binary file not shown.
After Width: | Height: | Size: 79 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
@@ -2,24 +2,50 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_white_top_18dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:background="@drawable/shape_white_10dp_round"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_19"
|
||||
android:background="@drawable/shape_f5f5f5_16dp"
|
||||
android:hint="@string/headline_input_hint"
|
||||
android:maxLength="100"
|
||||
android:paddingHorizontal="@dimen/dp_5"
|
||||
android:paddingVertical="@dimen/dp_11"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="@dimen/dp_13"
|
||||
app:layout_constraintDimensionRatio="344:132"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_buy"
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_buy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_518eff_20dp_round"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="上头条"
|
||||
android:layout_height="@dimen/dp_39"
|
||||
android:layout_marginTop="@dimen/dp_26"
|
||||
android:layout_marginBottom="@dimen/dp_27"
|
||||
android:background="@drawable/base_shape_theme_20dp"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/dp_200"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_content" />
|
||||
app:layout_constraintTop_toBottomOf="@id/et_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_18"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:src="@drawable/ic_diamond" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_buy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white_easy_photos"
|
||||
android:textSize="@dimen/dp_16" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
@@ -11,26 +12,97 @@
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_headline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="@drawable/public_chat_bg_headline_empty"
|
||||
app:layout_constraintDimensionRatio="375:99"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_headlien_text_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.504" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_headline_empty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_3"
|
||||
android:src="@drawable/public_chat_ic_headline_empty_add"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_headline_empty"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/line_headlien_text_top" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_headline_empty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/want_headline"
|
||||
android:textColor="#F9DB3B"
|
||||
android:textSize="@dimen/dp_11"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_headline_empty"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_headline_empty"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_headline_empty" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_headline_content_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.121" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/line_headline_content_top"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.106" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_headline_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFADF"
|
||||
android:textSize="@dimen/dp_16"
|
||||
android:visibility="gone"
|
||||
app:autoSizeMaxTextSize="@dimen/dp_16"
|
||||
app:autoSizeMinTextSize="@dimen/dp_6"
|
||||
app:autoSizeStepGranularity="1px"
|
||||
app:autoSizeTextType="uniform"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/line_headline_content_start"
|
||||
app:layout_constraintTop_toTopOf="@id/line_headline_content_top"
|
||||
app:layout_constraintWidth_percent="0.816"
|
||||
tools:text="Content"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_headline_empty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="iv_headline_empty,tv_headline_empty" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_bar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_headline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:background="@drawable/shape_99727272_7dp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintTop_toTopOf="@id/fragment_message" />
|
||||
app:layout_constraintTop_toBottomOf="@id/layout_headline" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_headline"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:src="@drawable/default_cover"
|
||||
android:layout_width="@dimen/dp_75"
|
||||
android:layout_height="@dimen/dp_75"
|
||||
android:src="@drawable/public_chat_ic_want_headline"
|
||||
app:layout_constraintBottom_toBottomOf="@id/fragment_message"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/fragment_message" />
|
||||
|
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="7dip"
|
||||
android:layout_marginEnd="7dip"
|
||||
android:gravity="center"
|
||||
android:paddingStart="7dip"
|
||||
android:paddingEnd="7dip"
|
||||
android:textColor="@color/color_black_333333"
|
||||
android:textSize="9sp" />
|
||||
|
||||
</merge>
|
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="public_chat_room">公聊廳</string>
|
||||
<string name="want_headline">我要上頭條~</string>
|
||||
<string name="public_chat_not_found">獲取公聊廳信息失敗</string>
|
||||
<string name="headline_buy_format">%s 上頭條</string>
|
||||
<string name="headline_message_format">尊貴的%s,上頭條了</string>
|
||||
<string name="public_chat_room">غرفة الدردشة العامة</string>
|
||||
<string name="want_headline">اريد تصدر العناوين </string>
|
||||
<string name="public_chat_not_found">فشل في الحصول على معلومات غرفة الدردشة العامة</string>
|
||||
<string name="headline_buy_format">تصدر العناوين %s</string>
|
||||
<string name="headline_message_format">~عزيزي%s، هيا تصدر العناوين </string>
|
||||
<string name="insufficient_balance_recharge_tips">رصيد العملات الذهبية غير كافي ،هل تريد إعادة الشحن علي الفور؟</string>
|
||||
<string name="headline_input_hint">الرجاء إدخال المحتوي الذي تريد أن تتصدر عناوينهّ~ (يقتصر على 100 كلمة)</string>
|
||||
</resources>
|
@@ -2,9 +2,10 @@
|
||||
<resources>
|
||||
|
||||
<string name="public_chat_room">公聊廳</string>
|
||||
<string name="want_headline">我要上頭條~</string>
|
||||
<string name="want_headline">我要上頭條</string>
|
||||
<string name="public_chat_not_found">獲取公聊廳信息失敗</string>
|
||||
<string name="headline_buy_format">%s 上頭條</string>
|
||||
<string name="headline_message_format">尊貴的%s,上頭條了</string>
|
||||
<string name="headline_buy_format">%s上頭條</string>
|
||||
<string name="headline_message_format">尊貴的%s,上頭條啦~</string>
|
||||
<string name="insufficient_balance_recharge_tips">金幣餘額不足,是否立即儲值?</string>
|
||||
<string name="headline_input_hint">請輸入想上頭條的內容呀~(僅限100字)</string>
|
||||
</resources>
|
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="public_chat_room">公聊廳</string>
|
||||
<string name="want_headline">我要上頭條~</string>
|
||||
<string name="public_chat_not_found">獲取公聊廳信息失敗</string>
|
||||
<string name="headline_buy_format">%s 上頭條</string>
|
||||
<string name="headline_message_format">尊貴的%s,上頭條了</string>
|
||||
<string name="public_chat_room">Chatting</string>
|
||||
<string name="want_headline">Broadcast</string>
|
||||
<string name="public_chat_not_found">Failed to obtain chatting information</string>
|
||||
<string name="headline_buy_format">%s Broadcast</string>
|
||||
<string name="headline_message_format">Honorable %s sent a broadcast~</string>
|
||||
<string name="insufficient_balance_recharge_tips">The coin is insufficient,Would you like to recharge?</string>
|
||||
<string name="headline_input_hint">Please enter the content you want to broadcast~(100 characters)</string>
|
||||
</resources>
|
@@ -6,6 +6,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.avroom.widget.MessageView;
|
||||
import com.chwl.app.ui.widget.TextSpannableBuilder;
|
||||
import com.chwl.core.im.custom.bean.CustomAttachment;
|
||||
import com.chwl.core.manager.AvRoomDataManager;
|
||||
import com.chwl.core.super_admin.attachment.SuperAdminOpAttachment;
|
||||
@@ -29,7 +30,7 @@ public class SaAttachmentToMsgUtil {
|
||||
return null;
|
||||
}
|
||||
String opName = null;
|
||||
MessageView.SpannableBuilder text = new MessageView.SpannableBuilder(tvContent);
|
||||
TextSpannableBuilder text = new TextSpannableBuilder(tvContent);
|
||||
text.append(AvRoomDataManager.get().isSuperAdmin(info.getHandleUid()) ? "" : ResUtil.getString(R.string.sadmin_utils_saattachmenttomsgutil_01), new ForegroundColorSpan(greyColor));
|
||||
switch (opAttachment.getSecond()) {
|
||||
case CustomAttachment.CUSTOM_MSG_SUB_TYPE_SUPER_ADMIN_KICK_DOWN_MIC:
|
||||
|
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient android:startColor="#70E9FF" android:centerColor="#AE87FF" android:endColor="#FF5CE1"/>
|
||||
<corners android:radius="20dp" />
|
||||
</shape>
|
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<padding
|
||||
android:left="15dp"
|
||||
android:top="12dp"
|
||||
android:right="12dp"
|
||||
android:bottom="15dp" />
|
||||
|
||||
<corners android:bottomLeftRadius="12dp"
|
||||
android:bottomRightRadius="12dp"
|
||||
android:topLeftRadius="12dp"
|
||||
android:topRightRadius="2dp"/>
|
||||
|
||||
<solid android:color="#52CAD3"/>
|
||||
|
||||
</shape>
|
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<padding
|
||||
android:left="12dp"
|
||||
android:top="12dp"
|
||||
android:right="15dp"
|
||||
android:bottom="15dp" />
|
||||
|
||||
<corners android:topRightRadius="12dp"
|
||||
android:topLeftRadius="2dp"
|
||||
android:bottomRightRadius="12dp"
|
||||
android:bottomLeftRadius="12dp"/>
|
||||
|
||||
<solid android:color="#F2F3FB"/>
|
||||
|
||||
</shape>
|
18
nim_uikit/res/drawable/bg_nim_water_drop_other_chatroom.xml
Normal file
18
nim_uikit/res/drawable/bg_nim_water_drop_other_chatroom.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<padding
|
||||
android:left="12dp"
|
||||
android:top="12dp"
|
||||
android:right="15dp"
|
||||
android:bottom="15dp" />
|
||||
|
||||
<corners android:bottomLeftRadius="12dp"
|
||||
android:bottomRightRadius="12dp"
|
||||
android:topLeftRadius="2dp"
|
||||
android:topRightRadius="12dp"/>
|
||||
|
||||
<solid android:color="#52CAD3"/>
|
||||
|
||||
</shape>
|
18
nim_uikit/res/drawable/bg_nim_water_drop_self_chatroom.xml
Normal file
18
nim_uikit/res/drawable/bg_nim_water_drop_self_chatroom.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<padding
|
||||
android:left="12dp"
|
||||
android:top="12dp"
|
||||
android:right="15dp"
|
||||
android:bottom="15dp" />
|
||||
|
||||
<corners android:topRightRadius="2dp"
|
||||
android:topLeftRadius="12dp"
|
||||
android:bottomRightRadius="12dp"
|
||||
android:bottomLeftRadius="12dp"/>
|
||||
|
||||
<solid android:color="#F2F3FB"/>
|
||||
|
||||
</shape>
|
120
nim_uikit/res/layout/nim_chat_room_message_item.xml
Normal file
120
nim_uikit/res/layout/nim_chat_room_message_item.xml
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingEnd="15dp">
|
||||
<TextView
|
||||
android:id="@+id/message_item_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="@dimen/bubble_time_layout_margin_bottom"
|
||||
android:layout_marginTop="@dimen/bubble_time_layout_margin_top"
|
||||
android:paddingStart="7dip"
|
||||
android:paddingEnd="7dip"
|
||||
android:textColor="#666666"
|
||||
android:textSize="11sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.netease.nim.uikit.common.ui.imageview.HeadImageView
|
||||
android:id="@+id/message_item_portrait_left"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@id/message_item_time"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.netease.nim.uikit.common.ui.imageview.HeadImageView
|
||||
android:id="@+id/message_item_portrait_right"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_below="@id/message_item_time"
|
||||
android:layout_marginStart="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/message_item_name_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/message_item_time"
|
||||
android:layout_toStartOf="@id/message_item_portrait_right"
|
||||
android:layout_toEndOf="@id/message_item_portrait_left"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/message_item_name_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:layout_marginBottom="10dp"
|
||||
android:id="@+id/message_item_nickname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxWidth="200dip"
|
||||
android:singleLine="true"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/message_item_name_layout"
|
||||
android:layout_toStartOf="@id/message_item_portrait_right"
|
||||
android:layout_toEndOf="@id/message_item_portrait_left">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/message_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/message_item_progress"
|
||||
android:layout_width="20dip"
|
||||
android:layout_height="20dip"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateDrawable="@drawable/nim_progress_small_white"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/message_item_alert"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:src="@drawable/nim_ic_failed"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include layout="@layout/nim_read_recipt_layout" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/message_item_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
@@ -3,6 +3,7 @@ package com.netease.nim.uikit.api.model.chatroom;
|
||||
import com.netease.nim.uikit.api.model.SimpleCallback;
|
||||
import com.netease.nimlib.sdk.chatroom.constant.MemberQueryType;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@@ -58,7 +58,7 @@ public class TimeUtil {
|
||||
}
|
||||
|
||||
public static String getNowDatetime() {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
|
||||
return (formatter.format(new Date()));
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class TimeUtil {
|
||||
public static String getNowDateTime(String format) {
|
||||
Date date = new Date();
|
||||
|
||||
SimpleDateFormat df = new SimpleDateFormat(format, Locale.getDefault());
|
||||
SimpleDateFormat df = new SimpleDateFormat(format, Locale.ENGLISH);
|
||||
return df.format(date);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class TimeUtil {
|
||||
TimeZone timezone = TimeZone.getTimeZone("Asia/Shanghai");
|
||||
|
||||
Date date = new Date(currentTimeMillis());
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.getDefault());
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
|
||||
formatter.setTimeZone(timezone);
|
||||
|
||||
GregorianCalendar gregorianCalendar = new GregorianCalendar();
|
||||
@@ -99,7 +99,7 @@ public class TimeUtil {
|
||||
TimeZone timezone = TimeZone.getTimeZone("Asia/Shanghai");
|
||||
|
||||
Date date = new Date(currentTimeMillis());
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.getDefault());
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
|
||||
formatter.setTimeZone(timezone);
|
||||
|
||||
return formatter.format(date);
|
||||
@@ -107,7 +107,7 @@ public class TimeUtil {
|
||||
|
||||
public static String getDateTimeString(long milliseconds, String format) {
|
||||
Date date = new Date(milliseconds);
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.getDefault());
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
|
||||
return formatter.format(date);
|
||||
}
|
||||
|
||||
@@ -118,10 +118,10 @@ public class TimeUtil {
|
||||
Date date = new Date(milliseconds);
|
||||
Date firstDateThisYear = new Date(today.getYear(), 0, 0);
|
||||
if (!date.before(firstDateThisYear)) {
|
||||
SimpleDateFormat dateformatter = new SimpleDateFormat("MM-dd", Locale.getDefault());
|
||||
SimpleDateFormat dateformatter = new SimpleDateFormat("MM-dd", Locale.ENGLISH);
|
||||
showDataString = dateformatter.format(date);
|
||||
} else {
|
||||
SimpleDateFormat dateformatter = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
||||
SimpleDateFormat dateformatter = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
|
||||
showDataString = dateformatter.format(date);
|
||||
}
|
||||
return showDataString;
|
||||
@@ -151,11 +151,11 @@ public class TimeUtil {
|
||||
} else if (isSameWeekDates(currentTime, today)) {
|
||||
dataString = getWeekOfDate(currentTime);
|
||||
} else {
|
||||
SimpleDateFormat dateformatter = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
||||
SimpleDateFormat dateformatter = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
|
||||
dataString = dateformatter.format(currentTime);
|
||||
}
|
||||
|
||||
SimpleDateFormat timeformatter24 = new SimpleDateFormat("HH:mm", Locale.getDefault());
|
||||
SimpleDateFormat timeformatter24 = new SimpleDateFormat("HH:mm", Locale.ENGLISH);
|
||||
timeStringBy24 = timeformatter24.format(currentTime);
|
||||
|
||||
if (abbreviate) {
|
||||
@@ -178,8 +178,8 @@ public class TimeUtil {
|
||||
public static String getTodayTimeBucket(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
SimpleDateFormat timeformatter0to11 = new SimpleDateFormat("KK:mm", Locale.getDefault());
|
||||
SimpleDateFormat timeformatter1to12 = new SimpleDateFormat("hh:mm", Locale.getDefault());
|
||||
SimpleDateFormat timeformatter0to11 = new SimpleDateFormat("KK:mm", Locale.ENGLISH);
|
||||
SimpleDateFormat timeformatter1to12 = new SimpleDateFormat("hh:mm", Locale.ENGLISH);
|
||||
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
if (hour >= 0 && hour < 5) {
|
||||
return ResUtil.getString(R.string.util_sys_timeutil_06) + timeformatter0to11.format(date);
|
||||
|
Reference in New Issue
Block a user