xiu改直播间聊天列表滚动问题,修改热度加成列表等级问题
This commit is contained in:
parent
36248eaeef
commit
eadcaf826b
@ -129,7 +129,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
super.onScrolled(recyclerView, dx, dy);
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
if (isBottom && dy >= 0) return;
|
if (isBottom && dy >= 0) return;
|
||||||
// Log.i(TAG, "onScrolled: " + dy);
|
Log.i(TAG, "onScrolled: " + dy);
|
||||||
mRecyclerViewScrolledDy = dy;
|
mRecyclerViewScrolledDy = dy;
|
||||||
isBottom = false;
|
isBottom = false;
|
||||||
}
|
}
|
||||||
@ -140,6 +140,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
if (newState == 0 && isSlideToBottom(recyclerView)) {
|
if (newState == 0 && isSlideToBottom(recyclerView)) {
|
||||||
// Log.i(TAG, "onScrollStateChanged: 到底部了");
|
// Log.i(TAG, "onScrollStateChanged: 到底部了");
|
||||||
mRecyclerViewScrolledDy = 0;
|
mRecyclerViewScrolledDy = 0;
|
||||||
|
scrollToBottom();
|
||||||
isBottom = true;
|
isBottom = true;
|
||||||
} else if (newState == 0) {
|
} else if (newState == 0) {
|
||||||
// Log.i(TAG, "onScrollStateChanged: 不是底部");
|
// Log.i(TAG, "onScrollStateChanged: 不是底部");
|
||||||
@ -394,7 +395,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
public void insertItem(LiveChatBean bean) {
|
public synchronized void insertItem(LiveChatBean bean) {
|
||||||
if (bean == null) {
|
if (bean == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -411,9 +412,9 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
} else {
|
} else {
|
||||||
notifyItemInserted(getItemCount());
|
notifyItemInserted(getItemCount());
|
||||||
}
|
}
|
||||||
size = mList.size();
|
// size = mList.size();
|
||||||
if (isBottom || mRecyclerViewScrolledDy == 0) {
|
if (isBottom || mRecyclerViewScrolledDy == 0) {
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
} else {
|
} else {
|
||||||
Bus.get().post(new LiveAudienceEvent()
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
.setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));
|
.setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));
|
||||||
@ -428,6 +429,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void scrollToBottom(final RecyclerView recyclerView) {
|
private void scrollToBottom(final RecyclerView recyclerView) {
|
||||||
// scroll to last item to get the view of last item
|
// scroll to last item to get the view of last item
|
||||||
final LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
final LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||||
|
@ -3,6 +3,7 @@ package com.yunbao.live.dialog;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
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.bean.HotBean;
|
||||||
import com.yunbao.live.custom.TopGradual;
|
import com.yunbao.live.custom.TopGradual;
|
||||||
import com.yunbao.live.http.LiveHttpUtil;
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
|
import com.yunbao.live.utils.LiveTextRender;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -205,7 +207,17 @@ public class LiveGiveHotDialogFragment extends AbsDialogFragment {
|
|||||||
viewHolder.sex.setImageResource(CommonIconUtil.getSexIcon(mDatas.get(position).getSex()));
|
viewHolder.sex.setImageResource(CommonIconUtil.getSexIcon(mDatas.get(position).getSex()));
|
||||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(mDatas.get(position).getLevel());
|
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(mDatas.get(position).getLevel());
|
||||||
if (levelBean != null) {
|
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);
|
String hotStr = mDatas.get(position).getHot_score().substring(0, mDatas.get(position).getHot_score().length() - 3);
|
||||||
viewHolder.tv_hot_number.setText(hotStr + "k");
|
viewHolder.tv_hot_number.setText(hotStr + "k");
|
||||||
|
@ -877,10 +877,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
mChatRecyclerView.setLayoutParams(params1);
|
mChatRecyclerView.setLayoutParams(params1);
|
||||||
|
|
||||||
mChatRecyclerView.setHasFixedSize(true);
|
mChatRecyclerView.setHasFixedSize(true);
|
||||||
LinearLayoutManager layoutManager = new LiveChatRecyclerViewLayoutManager(mContext);
|
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
|
||||||
layoutManager.setOrientation(RecyclerView.VERTICAL);
|
layoutManager.setOrientation(RecyclerView.VERTICAL);
|
||||||
// layoutManager.setReverseLayout(false);
|
// layoutManager.setReverseLayout(true);
|
||||||
// layoutManager.setStackFromEnd(true);
|
layoutManager.setStackFromEnd(true);
|
||||||
mChatRecyclerView.setLayoutManager(layoutManager);
|
mChatRecyclerView.setLayoutManager(layoutManager);
|
||||||
mChatRecyclerView.addItemDecoration(new TopGradual());
|
mChatRecyclerView.addItemDecoration(new TopGradual());
|
||||||
mChatRecyclerView.setItemViewCacheSize(10);
|
mChatRecyclerView.setItemViewCacheSize(10);
|
||||||
|
Loading…
Reference in New Issue
Block a user