diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 7cff740ac..cce3d4c7d 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -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,9 +412,9 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } else { notifyItemInserted(getItemCount()); } - size = mList.size(); +// size = mList.size(); if (isBottom || mRecyclerViewScrolledDy == 0) { - scrollToBottom(); + scrollToBottom(); } else { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER)); @@ -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(); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java index b82f1e3c8..691a1c4d4 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java @@ -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"); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 875f055ae..86c03492a 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -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);