Bugly bugs fix

This commit is contained in:
huangjian
2022-06-15 16:17:11 +08:00
parent 714eb551b1
commit e778f3fb40
5 changed files with 107 additions and 96 deletions

View File

@@ -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();

View File

@@ -96,10 +96,6 @@ public class HomeTabHomeFragment extends BaseFragment {
sortSeqRoom(finalList);
refreshRoomData(finalList, randomList);
} else {
if (!(throwable instanceof CancellationException)) {
toast("请求失败,请稍后再试!!" + throwable.getMessage());
}
}
});
}

View File

@@ -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());

View File

@@ -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))
;
// 无代理设置,防止被抓包

View File

@@ -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) {