Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
098e9bf6ba
@ -129,7 +129,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
if (isBottom && dy >= 0) return;
|
||||
// Log.i(TAG, "onScrolled: " + dy);
|
||||
Log.i(TAG, "onScrolled: " + dy);
|
||||
mRecyclerViewScrolledDy = dy;
|
||||
isBottom = false;
|
||||
}
|
||||
@ -140,6 +140,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
if (newState == 0 && isSlideToBottom(recyclerView)) {
|
||||
// Log.i(TAG, "onScrollStateChanged: 到底部了");
|
||||
mRecyclerViewScrolledDy = 0;
|
||||
scrollToBottom();
|
||||
isBottom = true;
|
||||
} else if (newState == 0) {
|
||||
// Log.i(TAG, "onScrollStateChanged: 不是底部");
|
||||
@ -394,7 +395,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void insertItem(LiveChatBean bean) {
|
||||
public synchronized void insertItem(LiveChatBean bean) {
|
||||
if (bean == null) {
|
||||
return;
|
||||
}
|
||||
@ -411,7 +412,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
} else {
|
||||
notifyItemInserted(getItemCount());
|
||||
}
|
||||
size = mList.size();
|
||||
// size = mList.size();
|
||||
if (isBottom || mRecyclerViewScrolledDy == 0) {
|
||||
scrollToBottom();
|
||||
} else {
|
||||
@ -428,6 +429,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void scrollToBottom(final RecyclerView recyclerView) {
|
||||
// scroll to last item to get the view of last item
|
||||
final LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
|
@ -3,6 +3,7 @@ package com.yunbao.live.dialog;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@ -37,6 +38,7 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.bean.HotBean;
|
||||
import com.yunbao.live.custom.TopGradual;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.utils.LiveTextRender;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@ -205,7 +207,17 @@ public class LiveGiveHotDialogFragment extends AbsDialogFragment {
|
||||
viewHolder.sex.setImageResource(CommonIconUtil.getSexIcon(mDatas.get(position).getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(mDatas.get(position).getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), viewHolder.level);
|
||||
new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
ImgLoader.display2(mContext, drawable, viewHolder.level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
String hotStr = mDatas.get(position).getHot_score().substring(0, mDatas.get(position).getHot_score().length() - 3);
|
||||
viewHolder.tv_hot_number.setText(hotStr + "k");
|
||||
|
@ -877,10 +877,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mChatRecyclerView.setLayoutParams(params1);
|
||||
|
||||
mChatRecyclerView.setHasFixedSize(true);
|
||||
LinearLayoutManager layoutManager = new LiveChatRecyclerViewLayoutManager(mContext);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
|
||||
layoutManager.setOrientation(RecyclerView.VERTICAL);
|
||||
// layoutManager.setReverseLayout(false);
|
||||
// layoutManager.setStackFromEnd(true);
|
||||
// layoutManager.setReverseLayout(true);
|
||||
layoutManager.setStackFromEnd(true);
|
||||
mChatRecyclerView.setLayoutManager(layoutManager);
|
||||
mChatRecyclerView.addItemDecoration(new TopGradual());
|
||||
mChatRecyclerView.setItemViewCacheSize(10);
|
||||
|
Loading…
Reference in New Issue
Block a user