修复直播间push View通知UI问题

This commit is contained in:
Martin 2024-10-09 13:49:58 +08:00
parent 865bf58108
commit ee53edbe1c

View File

@ -958,9 +958,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private void setTrickyMsg() { private void setTrickyMsg() {
if (tricky_layout_name != null) { if (tricky_layout_name != null) {
tricky_layout_name.setVisibility(View.VISIBLE); tricky_layout_name.setVisibility(View.VISIBLE);
tricky_layout_name.post(new Runnable() {
@Override
public void run() {
ViewGroup.LayoutParams params1 = tricky_layout_name.getLayoutParams();
params1.width = mChatRecyclerView.getWidth()-DpUtil.dp2px(5);
tricky_layout_name.setLayoutParams(params1);
}
});
} }
sudNameHandler.removeCallbacks(trickyRunnable); sudNameHandler.removeCallbacks(trickyRunnable);
sudNameHandler.postDelayed(trickyRunnable, 10000); sudNameHandler.postDelayed(trickyRunnable, 10000);
} }
public void setSudName(String sudName, SudGameDateModel sudGameDateModel) { public void setSudName(String sudName, SudGameDateModel sudGameDateModel) {
@ -1000,15 +1009,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
sudNameHandler.removeCallbacks(sudNameRunnable); sudNameHandler.removeCallbacks(sudNameRunnable);
sudNameHandler.postDelayed(sudNameRunnable, 10000); sudNameHandler.postDelayed(sudNameRunnable, 10000);
// sud_layout_name.post(new Runnable() { sud_layout_name.post(new Runnable() {
// @Override @Override
// public void run() { public void run() {
// //TODO 这里报了类型错误 android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams //TODO 这里报了类型错误 android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams
//// ViewGroup.LayoutParams params1 = sud_layout_name.getLayoutParams(); ViewGroup.LayoutParams params1 = sud_layout_name.getLayoutParams();
//// params1.width = mChatRecyclerView.getWidth() - DpUtil.dp2px(85); params1.width = mChatRecyclerView.getWidth()-DpUtil.dp2px(5);
//// sud_layout_name.setLayoutParams(params1); sud_layout_name.setLayoutParams(params1);
// } }
// }); });
new Handler().postDelayed(new Runnable() { new Handler().postDelayed(new Runnable() {
@Override @Override
@ -1049,7 +1058,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void run() { public void run() {
LinearLayout.LayoutParams params1 = (LinearLayout.LayoutParams) notify_follow_layout.getLayoutParams(); LinearLayout.LayoutParams params1 = (LinearLayout.LayoutParams) notify_follow_layout.getLayoutParams();
params1.width = mChatRecyclerView.getWidth() - DpUtil.dp2px(72); params1.width = mChatRecyclerView.getWidth();
notify_follow_layout.setLayoutParams(params1); notify_follow_layout.setLayoutParams(params1);
} }
}); });
@ -1119,7 +1128,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void run() { public void run() {
LinearLayout.LayoutParams params1 = (LinearLayout.LayoutParams) new_task_gift_notify.getLayoutParams(); LinearLayout.LayoutParams params1 = (LinearLayout.LayoutParams) new_task_gift_notify.getLayoutParams();
params1.width = mChatRecyclerView.getWidth() - DpUtil.dp2px(72); params1.width = mChatRecyclerView.getWidth();
new_task_gift_notify.setLayoutParams(params1); new_task_gift_notify.setLayoutParams(params1);
} }
}); });
@ -1178,7 +1187,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void run() { public void run() {
LinearLayout.LayoutParams params1 = (LinearLayout.LayoutParams) new_task_gift_notify1.getLayoutParams(); LinearLayout.LayoutParams params1 = (LinearLayout.LayoutParams) new_task_gift_notify1.getLayoutParams();
params1.width = mChatRecyclerView.getWidth() - DpUtil.dp2px(72); params1.width = mChatRecyclerView.getWidth();
new_task_gift_notify1.setLayoutParams(params1); new_task_gift_notify1.setLayoutParams(params1);
} }
}); });
@ -1239,7 +1248,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override @Override
public void run() { public void run() {
LinearLayout.LayoutParams params1 = (LinearLayout.LayoutParams) new_task_send_gift_notify.getLayoutParams(); LinearLayout.LayoutParams params1 = (LinearLayout.LayoutParams) new_task_send_gift_notify.getLayoutParams();
params1.width = mChatRecyclerView.getWidth() - DpUtil.dp2px(72); params1.width = mChatRecyclerView.getWidth();
new_task_send_gift_notify.setLayoutParams(params1); new_task_send_gift_notify.setLayoutParams(params1);
} }
}); });
@ -1288,7 +1297,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void showH5Dialog() { public void showH5Dialog() {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("url", CommonAppConfig.HOST + "/h5/activity/pdlNewUes/index.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+"&app_from=PDL"); bundle.putString("url", CommonAppConfig.HOST + "/h5/activity/pdlNewUes/index.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&app_from=PDL");
LiveHDDialogFragment fragment = new LiveHDDialogFragment(); LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
@ -1969,7 +1978,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
params1.topMargin = DpUtil.dp2px(65); params1.topMargin = DpUtil.dp2px(65);
params1.bottomMargin = 0; params1.bottomMargin = 0;
mChatRecyclerView.setLayoutParams(params1); mChatRecyclerView.setLayoutParams(params1);
}else { } else {
params1.topMargin = DpUtil.dp2px(80); params1.topMargin = DpUtil.dp2px(80);
} }
mChatRecyclerView.setLayoutParams(params1); mChatRecyclerView.setLayoutParams(params1);
@ -2252,10 +2261,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
((LiveActivity) mContext).sendChatMessage(msg, null, null); ((LiveActivity) mContext).sendChatMessage(msg, null, null);
fastMsgRecyclerView.setVisibility(View.GONE); fastMsgRecyclerView.setVisibility(View.GONE);
RelativeLayout.LayoutParams params4 = (RelativeLayout.LayoutParams) live_bottom_layout.getLayoutParams(); RelativeLayout.LayoutParams params4 = (RelativeLayout.LayoutParams) live_bottom_layout.getLayoutParams();
if(isAnchorLive()){ if (isAnchorLive()) {
params1.bottomMargin = 0; params1.bottomMargin = 0;
params4.bottomMargin = 0; params4.bottomMargin = 0;
}else { } else {
params1.bottomMargin = DpUtil.dp2px(10); params1.bottomMargin = DpUtil.dp2px(10);
params4.bottomMargin = DpUtil.dp2px(10); params4.bottomMargin = DpUtil.dp2px(10);
} }
@ -2285,9 +2294,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}); });
// mBanner2.setVisibility(View.GONE); // mBanner2.setVisibility(View.GONE);
if (fastMsgRecyclerView.getVisibility() == View.GONE) { if (fastMsgRecyclerView.getVisibility() == View.GONE) {
if (isAnchorLive()){ if (isAnchorLive()) {
params1.bottomMargin =0; params1.bottomMargin = 0;
}else { } else {
params1.bottomMargin = DpUtil.dp2px(10); params1.bottomMargin = DpUtil.dp2px(10);
} }
mChatRecyclerView.setLayoutParams(params1); mChatRecyclerView.setLayoutParams(params1);
@ -3480,8 +3489,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* @param view 要添加到翻转动画器的视图 * @param view 要添加到翻转动画器的视图
*/ */
private void startNewPart2Flipper(View view) { private void startNewPart2Flipper(View view) {
if (view == null) if (view == null) return;
return;
if (newPart2Flipper.getVisibility() != View.VISIBLE) { if (newPart2Flipper.getVisibility() != View.VISIBLE) {
newPart2Flipper.setVisibility(View.VISIBLE); newPart2Flipper.setVisibility(View.VISIBLE);
} }
@ -3506,8 +3514,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* @param view 要从翻页器中移除的视图 * @param view 要从翻页器中移除的视图
*/ */
private void stopPart2Flipper(View view) { private void stopPart2Flipper(View view) {
if (view == null) if (view == null) return;
return;
// 获取翻页器中当前的子视图数量以判断是否满足停止翻页的条件 // 获取翻页器中当前的子视图数量以判断是否满足停止翻页的条件
newPart2Flipper.getChildCount(); newPart2Flipper.getChildCount();
@ -4068,13 +4075,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
int mScreenWdith = util.getScreenWdith(); int mScreenWdith = util.getScreenWdith();
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams(); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams();
if (isAnchorLive()) {//因为主播的比较短所以往上移动 if (isAnchorLive()) {//因为主播的比较短所以往上移动
// params.setMargins(0, 0, DpUtil.dp2px(R.dimen.live_top), 0); // params.setMargins(0, 0, DpUtil.dp2px(R.dimen.live_top), 0);
} }
params.height = mScreenWdith * 720 / PK_LINE_HEIGHT; params.height = mScreenWdith * 720 / PK_LINE_HEIGHT;
if(isAnchorLive()){ if (isAnchorLive()) {
//280来自view_live_play_sw.xml的pk_container高度 //280来自view_live_play_sw.xml的pk_container高度
//42来自view_live_room.xml的pk_red_layout的头像框高度 //42来自view_live_room.xml的pk_red_layout的头像框高度
params.height= DpUtil.dp2px(280-42); params.height = DpUtil.dp2px(280 - 42);
} }
//params.bottomMargin=(mScreenWdith * 720 / 960); //params.bottomMargin=(mScreenWdith * 720 / 960);
lt_pk_line.requestLayout(); lt_pk_line.requestLayout();
@ -5656,10 +5663,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (greetings.size() > 0) { if (greetings.size() > 0) {
params1.bottomMargin = DpUtil.dp2px(38); params1.bottomMargin = DpUtil.dp2px(38);
params2.bottomMargin = DpUtil.dp2px(38); params2.bottomMargin = DpUtil.dp2px(38);
} else if(isAnchorLive()){ } else if (isAnchorLive()) {
params1.bottomMargin = 0; params1.bottomMargin = 0;
params2.bottomMargin = 0; params2.bottomMargin = 0;
}else { } else {
params1.bottomMargin = DpUtil.dp2px(10); params1.bottomMargin = DpUtil.dp2px(10);
params2.bottomMargin = DpUtil.dp2px(10); params2.bottomMargin = DpUtil.dp2px(10);
} }