Bugly bugs fix
This commit is contained in:
@@ -355,7 +355,10 @@ public class MessageView extends FrameLayout {
|
||||
tvAtTip.setVisibility(GONE);
|
||||
tvAtTip.setOnClickListener(v -> {
|
||||
if (!atMessages.isEmpty()) {
|
||||
messageListView.smoothScrollToPosition(chatRoomMessages.indexOf(atMessages.remove(0)));
|
||||
int scrollIndex = chatRoomMessages.indexOf(atMessages.remove(0));
|
||||
if (scrollIndex != -1 && scrollIndex < mMessageAdapter.getItemCount()) {
|
||||
messageListView.smoothScrollToPosition(scrollIndex);
|
||||
}
|
||||
}
|
||||
needAutoScroll = false;
|
||||
checkShowAtTip();
|
||||
@@ -1103,15 +1106,15 @@ public class MessageView extends FrameLayout {
|
||||
case CustomAttachment.CUSTOM_MSG_SUB_DATING_PUBLISH_LIKE:
|
||||
if (notifyInfo.getHasSelectUser()) {
|
||||
text.append(notifyInfo.getNickname(), new ForegroundColorSpan(roomTipNickColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(String.valueOf(notifyInfo.getUid())).subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(String.valueOf(notifyInfo.getUid())).subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.append(" 的心动对象是 ", new ForegroundColorSpan(whiteColor))
|
||||
.append(notifyInfo.getTargetNickname(), new ForegroundColorSpan(roomTipNickColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@@ -1125,15 +1128,15 @@ public class MessageView extends FrameLayout {
|
||||
});
|
||||
} else {
|
||||
text.append(notifyInfo.getNickname(), new ForegroundColorSpan(roomTipNickColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(String.valueOf(notifyInfo.getUid())).subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(String.valueOf(notifyInfo.getUid())).subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.append(" 未选择心动对象", new ForegroundColorSpan(whiteColor));
|
||||
}
|
||||
break;
|
||||
@@ -1367,15 +1370,15 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
isHaveInTeam = true;
|
||||
text.append(value.getNick(), new ForegroundColorSpan(roomTipColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(value.getUid()).subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(value.getUid()).subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.append("进入");
|
||||
if (value.getGroupType() == PKTeamInfo.TEAM_RED) {
|
||||
text.append("红队", new ForegroundColorSpan(tvContent.getResources().getColor(R.color.color_FB3D74)))
|
||||
@@ -1400,7 +1403,7 @@ public class MessageView extends FrameLayout {
|
||||
RoomPkData roomPkData = attachment.getRoomPkData();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(String.format(Locale.getDefault(), "管理员发起房间PK,本次PK时间为 %s 秒,获得",
|
||||
roomPkData.getDuration()),
|
||||
roomPkData.getDuration()),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
switch (roomPkData.getVoteMode()) {
|
||||
case RoomPkData.VOTE_MODE_GIFT:
|
||||
@@ -1427,7 +1430,7 @@ public class MessageView extends FrameLayout {
|
||||
RoomPkData roomPkData = attachment.getRoomPkData();
|
||||
SpannableBuilder text = new SpannableBuilder(textView)
|
||||
.append(String.format(Locale.getDefault(),
|
||||
"PK开始啦!本次PK时间 %s 秒,快给喜欢的选手投票吧!", roomPkData.getDuration()),
|
||||
"PK开始啦!本次PK时间 %s 秒,快给喜欢的选手投票吧!", roomPkData.getDuration()),
|
||||
new ForegroundColorSpan(greyColor));
|
||||
textView.setText(text.build());
|
||||
}
|
||||
@@ -1436,7 +1439,7 @@ public class MessageView extends FrameLayout {
|
||||
RoomPkData roomPkData = attachment.getRoomPkData();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(String.format(Locale.getDefault(), "管理员重新开始房间PK,本次PK时间为 %s 秒,获得",
|
||||
roomPkData.getDuration()),
|
||||
roomPkData.getDuration()),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
switch (roomPkData.getVoteMode()) {
|
||||
case RoomPkData.VOTE_MODE_GIFT:
|
||||
@@ -1470,8 +1473,8 @@ public class MessageView extends FrameLayout {
|
||||
text.append("平局!\n", new ForegroundColorSpan(whiteColor));
|
||||
if (blueTeam != null && redTeam != null) {
|
||||
text.append(String.format(Locale.getDefault(), "PK值 %s : %s",
|
||||
FormatUtils.formatPKValue(blueTeam.getScore()),
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
FormatUtils.formatPKValue(blueTeam.getScore()),
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
|
||||
UserInfo redProtector = redTeam.getProtector();
|
||||
@@ -1481,14 +1484,14 @@ public class MessageView extends FrameLayout {
|
||||
break;
|
||||
}
|
||||
text.append(String.format(Locale.getDefault(), "\n蓝队守护者:%s \n", blueProtector.getNick()),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "蓝队守护值:%s \n",
|
||||
FormatUtils.formatPKValue(blueTeam.getProtecScore())),
|
||||
FormatUtils.formatPKValue(blueTeam.getProtecScore())),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "红队守护者:%s \n", redProtector.getNick()),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "红队守护值:%s",
|
||||
FormatUtils.formatPKValue(redTeam.getProtecScore())),
|
||||
FormatUtils.formatPKValue(redTeam.getProtecScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
}
|
||||
break;
|
||||
@@ -1497,21 +1500,21 @@ public class MessageView extends FrameLayout {
|
||||
text.append("蓝队胜利!\n", new ForegroundColorSpan(whiteColor));
|
||||
if (blueTeam != null && redTeam != null) {
|
||||
text.append(String.format(Locale.getDefault(), "PK值 %s : %s \n",
|
||||
FormatUtils.formatPKValue(blueTeam.getScore()),
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
FormatUtils.formatPKValue(blueTeam.getScore()),
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
|
||||
UserInfo blueProtector = blueTeam.getProtector();
|
||||
if (blueProtector == null) {
|
||||
text.append(String.format(Locale.getDefault(), "胜利方战斗值:%s",
|
||||
FormatUtils.formatPKValue(blueTeam.getScore())),
|
||||
FormatUtils.formatPKValue(blueTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
|
||||
} else {
|
||||
text.append(String.format(Locale.getDefault(), "胜方守护者:%s \n", blueProtector.getNick()),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "胜方守护值:%s",
|
||||
FormatUtils.formatPKValue(blueTeam.getProtecScore())),
|
||||
FormatUtils.formatPKValue(blueTeam.getProtecScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
}
|
||||
}
|
||||
@@ -1521,20 +1524,20 @@ public class MessageView extends FrameLayout {
|
||||
text.append("红队胜利!\n", new ForegroundColorSpan(whiteColor));
|
||||
if (blueTeam != null && redTeam != null) {
|
||||
text.append(String.format(Locale.getDefault(), "PK值 %s : %s \n",
|
||||
FormatUtils.formatPKValue(redTeam.getScore()),
|
||||
FormatUtils.formatPKValue(blueTeam.getScore())),
|
||||
FormatUtils.formatPKValue(redTeam.getScore()),
|
||||
FormatUtils.formatPKValue(blueTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
|
||||
UserInfo redProtector = redTeam.getProtector();
|
||||
if (redProtector == null) {
|
||||
text.append(String.format(Locale.getDefault(), "胜利方战斗值:%s",
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
FormatUtils.formatPKValue(redTeam.getScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
} else {
|
||||
text.append(String.format(Locale.getDefault(), "红队守护者:%s \n", redProtector.getNick()),
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
new ForegroundColorSpan(whiteColor))
|
||||
.append(String.format(Locale.getDefault(), "红队守护值:%s",
|
||||
FormatUtils.formatPKValue(redTeam.getProtecScore())),
|
||||
FormatUtils.formatPKValue(redTeam.getProtecScore())),
|
||||
new ForegroundColorSpan(whiteColor));
|
||||
}
|
||||
|
||||
@@ -1897,11 +1900,11 @@ public class MessageView extends FrameLayout {
|
||||
String vipIcon = NobleUtil.getResource(UserInfo.VIP_ICON, chatRoomMessage);
|
||||
builder.append(vipIcon, expLevelHeight)
|
||||
.append(isOfficial ? ResourcesCompat.getDrawable(getResources(),
|
||||
R.mipmap.ic_user_official_13dp, null) : null,
|
||||
R.mipmap.ic_user_official_13dp, null) : null,
|
||||
badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(AvRoomDataManager.get().isSuperAdmin(chatRoomMessage.getFromAccount()) ? ResourcesCompat.getDrawable(getResources(),
|
||||
R.drawable.ic_room_super_admin, null) : null,
|
||||
R.drawable.ic_room_super_admin, null) : null,
|
||||
SizeUtils.dp2px(tvContent.getContext(), 23), expLevelHeight);
|
||||
|
||||
// 官方主播认证
|
||||
@@ -2195,13 +2198,13 @@ public class MessageView extends FrameLayout {
|
||||
for (GiftReceiver targetUser : attachment.getGiftMultiReceiverInfo().getTargetUsers()) {
|
||||
text.append(targetUser.getNick(), new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(targetUser.getUid() + "").subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(targetUser.getUid() + "").subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.append(",");
|
||||
}
|
||||
Editable msg = text.builder;
|
||||
@@ -2275,13 +2278,13 @@ public class MessageView extends FrameLayout {
|
||||
for (MagicReceiver targetUser : magicMultiReceiverInfo.getTargetUsers()) {
|
||||
text.append(targetUser.getNick(), new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(targetUser.getUid() + "").subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(targetUser.getUid() + "").subscribe(clickConsumer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.append(",");
|
||||
}
|
||||
Editable msg = text.builder;
|
||||
@@ -2478,14 +2481,14 @@ public class MessageView extends FrameLayout {
|
||||
mMessageAdapter.notifyItemChanged(position);
|
||||
long targetUid = JavaUtil.str2long(chatRoomMessage.getFromAccount());
|
||||
Single.zip(AvRoomModel.get().getWelcomeConfig(targetUid),
|
||||
UserModel.get().getUserInfo(targetUid), (roomWelcomeConfig, info) -> {
|
||||
WelcomeInfo welcomeInfo = new WelcomeInfo();
|
||||
welcomeInfo.setContent(roomWelcomeConfig.getMsg());
|
||||
welcomeInfo.setTargetUid(targetUid);
|
||||
welcomeInfo.setTargetNick(info.getNick());
|
||||
welcomeInfo.setFans(roomWelcomeConfig.isFans());
|
||||
return welcomeInfo;
|
||||
})
|
||||
UserModel.get().getUserInfo(targetUid), (roomWelcomeConfig, info) -> {
|
||||
WelcomeInfo welcomeInfo = new WelcomeInfo();
|
||||
welcomeInfo.setContent(roomWelcomeConfig.getMsg());
|
||||
welcomeInfo.setTargetUid(targetUid);
|
||||
welcomeInfo.setTargetNick(info.getNick());
|
||||
welcomeInfo.setFans(roomWelcomeConfig.isFans());
|
||||
return welcomeInfo;
|
||||
})
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap((Function<WelcomeInfo, SingleSource<ChatRoomMessage>>) welcomeInfo -> {
|
||||
WelcomeAttachment attachment = new WelcomeAttachment();
|
||||
@@ -2642,14 +2645,14 @@ public class MessageView extends FrameLayout {
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
addCommonTag(chatRoomMessage, text, tvContent);
|
||||
text.append(extension == null ? "我" : RegexUtil.getPrintableString(extension.getSenderNick()),
|
||||
new ForegroundColorSpan(greyColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
Single.just(String.valueOf(chatRoomMessage.getFromAccount()))
|
||||
.doOnSuccess(clickConsumer).subscribe();
|
||||
}
|
||||
})
|
||||
new ForegroundColorSpan(greyColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
Single.just(String.valueOf(chatRoomMessage.getFromAccount()))
|
||||
.doOnSuccess(clickConsumer).subscribe();
|
||||
}
|
||||
})
|
||||
.append(":" + welcomeInfo.getLastConent(), new ForegroundColorSpan(whiteColor))
|
||||
.append(welcomeInfo.getTargetNick(), new ForegroundColorSpan(roomTipNickColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
@@ -96,10 +96,6 @@ public class HomeTabHomeFragment extends BaseFragment {
|
||||
sortSeqRoom(finalList);
|
||||
refreshRoomData(finalList, randomList);
|
||||
|
||||
} else {
|
||||
if (!(throwable instanceof CancellationException)) {
|
||||
toast("请求失败,请稍后再试!!" + throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ import com.yizhuan.xchat_android_core.home.bean.MainTabInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.MainTabType;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -32,6 +33,7 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
|
||||
private MainRedPointTab meTab;
|
||||
private int mLastPosition = -1;
|
||||
private OnTabClickListener mOnTabClickListener;
|
||||
@Nullable
|
||||
private List<MainTabInfo> mainTabInfoList;
|
||||
private int defaultTabType;
|
||||
|
||||
@@ -104,6 +106,7 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (ListUtils.isListEmpty(mainTabInfoList)) return;
|
||||
switch (v.getId()) {
|
||||
case R.id.main_home_tab:
|
||||
select(mainTabInfoList.get(0).getTabType());
|
||||
|
@@ -78,7 +78,7 @@ public final class RxNetManager {
|
||||
.connectTimeout(connectTimeout > 0 ? connectTimeout : DEFAULT_CONNECT_TIME_OUT, TimeUnit.MILLISECONDS)
|
||||
.addNetworkInterceptor(mCacheManager.getHttpCacheInterceptor())
|
||||
.cache(cache != null ? cache : mCacheManager.getCache())
|
||||
.connectionPool(new ConnectionPool(10, 2, TimeUnit.SECONDS))
|
||||
.connectionPool(new ConnectionPool(10, 5, TimeUnit.MINUTES))
|
||||
|
||||
;
|
||||
// 无代理设置,防止被抓包
|
||||
|
@@ -3,8 +3,7 @@ package com.yizhuan.xchat_android_library.utils.codec;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.MappedByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.io.InputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
@@ -26,22 +25,32 @@ public class MD5Utils {
|
||||
if (file == null || !file.exists()) {
|
||||
return null;
|
||||
}
|
||||
String md5 = null;
|
||||
FileInputStream in = new FileInputStream(file);
|
||||
FileChannel ch = in.getChannel();
|
||||
MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, 0,
|
||||
file.length());
|
||||
InputStream fis = new FileInputStream(file);
|
||||
byte[] buffer = new byte[2048];
|
||||
int numRead = 0;
|
||||
MessageDigest md5;
|
||||
try {
|
||||
|
||||
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
|
||||
messagedigest.update(byteBuffer);
|
||||
md5 = bufferToHex(messagedigest.digest());
|
||||
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
md5 = MessageDigest.getInstance("MD5");
|
||||
while ((numRead = fis.read(buffer)) > 0) {
|
||||
md5.update(buffer, 0, numRead);
|
||||
}
|
||||
fis.close();
|
||||
return md5ToString(md5.digest());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return md5;
|
||||
}
|
||||
|
||||
public static String md5ToString(byte[] md5Bytes) {
|
||||
StringBuilder hexValue = new StringBuilder();
|
||||
for (byte md5Byte : md5Bytes) {
|
||||
int val = ((int) md5Byte) & 0xff;
|
||||
if (val < 16) {
|
||||
hexValue.append("0");
|
||||
}
|
||||
hexValue.append(Integer.toHexString(val));
|
||||
}
|
||||
return hexValue.toString();
|
||||
}
|
||||
|
||||
public static String getMD5String(String s) {
|
||||
@@ -58,7 +67,7 @@ public class MD5Utils {
|
||||
String md5 = null;
|
||||
try {
|
||||
|
||||
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
|
||||
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
|
||||
messagedigest.update(bytes);
|
||||
md5 = bufferToHex(messagedigest.digest());
|
||||
|
||||
|
Reference in New Issue
Block a user