修复手机开播Pk界面问题,直播间聊天滚动至底部优化

This commit is contained in:
18401019693 2022-12-01 13:34:25 +08:00
parent 0b1393615c
commit 80a1508dfc
4 changed files with 33 additions and 7 deletions

View File

@ -108,6 +108,7 @@
</LinearLayout>
<LinearLayout
android:visibility="gone"
android:id="@+id/system_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -4,7 +4,7 @@ ext {
buildToolsVersion: "28.0.3",
minSdkVersion : 21,
targetSdkVersion : 31,
versionCode : 308,
versionCode : 310,
versionName : "6.4.5"
]
manifestPlaceholders = [
@ -25,7 +25,7 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false
isGooglePlay : true,
isGooglePlay : false,
//
isUploadLog : true
]

View File

@ -320,9 +320,9 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
} else if (bean.getType() == -2) {//自动消息点击发言
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
mTextView.setText(R.string.automatic_chat);
bean.setHeart(position);
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
mTextView.setText(R.string.automatic_chat);
bean.setHeart(position);
} else if (bean.getType() == MSG_HOUR_RANK_CHANGE) {
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
mTextView.setText(bean.getContent());
@ -381,7 +381,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
mList.add(bean);
if (isSlideToBottom(mRecyclerView)) {
mRecyclerView.smoothScrollToPosition(getItemCount() - 1);
scrollToBottom(mRecyclerView);
} else {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));
@ -396,6 +396,19 @@ 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();
final int lastItemPosition = getItemCount() - 1;
recyclerView.post(new Runnable() {
@Override
public void run() {
layoutManager.scrollToPositionWithOffset(lastItemPosition, Integer.MIN_VALUE);
}
});
}
/**
* 判断是否滚到底部
*

View File

@ -185,6 +185,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private View loading;
private int landscape;
public PortraitLiveManager setQuitF(boolean quitF) {
isQuitF = quitF;
return this;
@ -341,7 +343,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
.enterRoomNew(mLiveBean.getStream(), mLiveBean.getUid(), mLiveBean.getCity(), new com.yunbao.common.http.base.HttpCallback<EnterRoomNewModel>() {
@Override
public void onSuccess(EnterRoomNewModel data) {
mLivePlayViewHolder.setLiveBeanLandscape(data.getLiveInfo().getLandscape());
landscape = data.getLiveInfo().getLandscape();
mLivePlayViewHolder.setLiveBeanLandscape(landscape);
//是否热度卡加成
liveHandler.postDelayed(() -> mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard()), 700);
@ -1228,6 +1231,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}, 4000);//3秒后执行Runnable中的run方法
}
if (mLivePlayViewHolder!=null){
mLivePlayViewHolder.setLiveBeanLandscape(1);
}
}
@Override
@ -1239,6 +1245,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.resetViewGone();
}
}
if (mLiveRoomViewHolder != null) {
mLivePlayViewHolder.setLiveBeanLandscape(landscape);
}
}
@Override
@ -1262,6 +1271,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo();
}
if (mLiveRoomViewHolder != null) {
mLivePlayViewHolder.setLiveBeanLandscape(landscape);
}
}
@Override