直播间聊天列表动态改变高度

This commit is contained in:
18401019693
2022-08-30 14:50:21 +08:00
parent 81cafdf995
commit 7155ed9884
2 changed files with 56 additions and 40 deletions

View File

@@ -867,8 +867,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//点击的消息发送出去
((LiveActivity) mContext).sendChatMessage(msg);
fastMsgRecyclerView.setVisibility(View.GONE);
params1.bottomMargin = 0;
mChatRecyclerView.setLayoutParams(params1);
});
// fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator());
// fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator());
}
private void showBanner2() {
@@ -1067,24 +1071,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
wishListFlipper.startFlipping();
});
}
/**
* 初始化小时榜
*/
protected void initHourRankList(){
ViewFlipper flipper= (ViewFlipper) findViewById(R.id.hour_rank_list);
LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(DpUtil.dp2px(44),DpUtil.dp2px(16));
protected void initHourRankList() {
ViewFlipper flipper = (ViewFlipper) findViewById(R.id.hour_rank_list);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16));
API.get().pdLiveApi(mContext).getHourChartRank(mLiveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
List<HourRank> info = listResponseModel.getData().getInfo();
if(!info.isEmpty()){
View hotView=LayoutInflater.from(mContext).inflate(R.layout.view_wish_list,null);
View hourView=LayoutInflater.from(mContext).inflate(R.layout.view_wish_list,null);
if (!info.isEmpty()) {
View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
ImageView hotPic = hotView.findViewById(R.id.wish_pic);
ImageView hourPic = hourView.findViewById(R.id.wish_pic);
mHotText =hotView.findViewById(R.id.wish_index);
mHourRank=hourView.findViewById(R.id.wish_index);
mHotText = hotView.findViewById(R.id.wish_index);
mHourRank = hourView.findViewById(R.id.wish_index);
setHourRankData(info.get(0).getRank());
hotPic.setImageResource(R.drawable.live_tags_hot);
@@ -1095,17 +1100,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
flipper.addView(hourView);
flipper.setOnClickListener(view -> {
Bundle bundle=new Bundle();
String path=info.get(0).getUrl();
if(!path.startsWith("/")){
path="/"+path;
Bundle bundle = new Bundle();
String path = info.get(0).getUrl();
if (!path.startsWith("/")) {
path = "/" + path;
}
String url=CommonAppConfig.HOST+path;
String url = CommonAppConfig.HOST + path;
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
System.out.println("url = " + url);
bundle.putString("url", url);
// bundle.putInt("height", DpUtil.dp2px(500));
// bundle.putInt("height", DpUtil.dp2px(500));
bundle.putInt("show_type", 0);
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
liveHDDialogFragment.setArguments(bundle);
@@ -1119,27 +1124,29 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
/**
* 星光值转带k的字符
*
* @param val 值
* @retur 字符串
*/
private String starlightValToString(long val){
if(val>1000) {
double tmp =(double)val / 1000;
private String starlightValToString(long val) {
if (val > 1000) {
double tmp = (double) val / 1000;
return tmp + "k";
}else{
return val+"";
} else {
return val + "";
}
}
/**
* 设置小时榜
*
* @param rank 小时榜
*/
public void setHourRankData(long rank){
if(mHourRank!=null) {
if(rank==0){
public void setHourRankData(long rank) {
if (mHourRank != null) {
if (rank == 0) {
mHourRank.setText(R.string.no_rank_data);
}else {
} else {
mHourRank.setText(formatBigNum.formatBigNum(rank + ""));
}
}
@@ -1147,14 +1154,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
/**
* 设置热度值
*
* @param hot 热度值
*/
public void setHotData(String hot){
if(mHotText!=null) {
public void setHotData(String hot) {
if (mHotText != null) {
mHotText.setText(hot);
}
}
/**
* 更新心愿单进度
*
@@ -1604,7 +1613,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} else if (i == R.id.ft_hot_add) {
((LiveActivity) mContext).openHotListWindow(1);
} else if (i == R.id.user_guard) {
// ((LiveActivity) mContext).openUserMoreListWindow(2, true);
// ((LiveActivity) mContext).openUserMoreListWindow(2, true);
((LiveActivity) mContext).openNewGuardListWindow();
}
@@ -2296,7 +2305,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
public void setFastMessage(List<String> greetings) {
fastMsgRecyclerView.setVisibility(View.VISIBLE);
fastMessageRecyclerViewAdapter.setMessage(greetings);
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
mChatRecyclerView.getLayoutParams();
params1.bottomMargin = 100;
mChatRecyclerView.setLayoutParams(params1);
}
private static class LiveRoomHandler extends Handler {