修复直播间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);
} }
}); });
@ -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();