Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-10-10 13:44:41 +08:00
commit 89c29fa442
5 changed files with 91 additions and 17 deletions

View File

@ -901,4 +901,12 @@ Limited ride And limited avatar frame</string>
<string name="emperor">皇帝</string> <string name="emperor">皇帝</string>
<string name="better_emperor">超皇</string> <string name="better_emperor">超皇</string>
<string name="login_wait">Please wait...</string> <string name="login_wait">Please wait...</string>
<string name="slide_settings">滑動設置</string>
<string name="up_slide_settings">上下滑動切換直播間</string>
<string name="live_say_something_a">\@用户昵称\t\t你好啊</string>
<string name="oline_list">在线列表</string>
<string name="search_want">搜索想要@的人</string>
<string name="online_audience">在線觀眾</string>
<string name="audience">觀眾</string>
<string name="cannot_yourself">無法@自己</string>
</resources> </resources>

View File

@ -912,14 +912,15 @@
<string name="order_query">订单查询中</string> <string name="order_query">订单查询中</string>
<string name="order_query_success">订单无异常</string> <string name="order_query_success">订单无异常</string>
<string name="login_invalid">登錄失效,請重新登錄</string> <string name="login_invalid">登錄失效,請重新登錄</string>
<string name="login_wait">請稍後</string>
<string name="slide_settings">滑動設置</string> <string name="slide_settings">滑動設置</string>
<string name="up_slide_settings">上下滑動切換直播間</string> <string name="up_slide_settings">上下滑動切換直播間</string>
<string name="login_wait">請稍後</string>
<string name="live_say_something_a">\@用户昵称\t\t你好啊</string> <string name="live_say_something_a">\@用户昵称\t\t你好啊</string>
<string name="oline_list">在线列表</string> <string name="oline_list">在线列表</string>
<string name="search_want">搜索想要@的人</string> <string name="search_want">搜索想要@的人</string>
<string name="online_audience">在線觀眾</string> <string name="online_audience">在線觀眾</string>
<string name="audience">觀眾</string> <string name="audience">觀眾</string>
<string name="cannot_yourself">無法@自己</string>
</resources> </resources>

View File

@ -61,6 +61,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
private IMLoginModel model; private IMLoginModel model;
private int mPosition;
public LiveChatAdapter(Context context) { public LiveChatAdapter(Context context) {
mContext = context; mContext = context;
mList = new ArrayList<>(); mList = new ArrayList<>();
@ -168,6 +170,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
} }
void setData(final LiveChatBean bean, int position) { void setData(final LiveChatBean bean, int position) {
itemView.setTag(bean); itemView.setTag(bean);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(0, 0, DpUtil.dp2px(80), 12); params.setMargins(0, 0, DpUtil.dp2px(80), 12);
@ -388,6 +391,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
if (bean.getAtUserID().contains(String.valueOf(model.getId()))) { if (bean.getAtUserID().contains(String.valueOf(model.getId()))) {
Bus.get().post(new LiveAudienceEvent() Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.AT_MESSAGE)); .setType(LiveAudienceEvent.LiveAudienceType.AT_MESSAGE));
mPosition = size + 1;
} }
} }
@ -419,6 +423,11 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
mRecyclerView.smoothScrollToPosition(getItemCount()); mRecyclerView.smoothScrollToPosition(getItemCount());
} }
} }
public void scrollToAt(){
if (mList.size() > 0) {
mRecyclerView.smoothScrollToPosition(mPosition);
}
}
public void clear() { public void clear() {
if (mList != null) { if (mList != null) {

View File

@ -679,6 +679,20 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
ViewClicksAntiShake.clicksAntiShake(newMessage, () -> { ViewClicksAntiShake.clicksAntiShake(newMessage, () -> {
chatScrollToBottom(); chatScrollToBottom();
newMessage.setVisibility(View.GONE); newMessage.setVisibility(View.GONE);
if (atMessage.getVisibility() == View.VISIBLE) {
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) atMessage.getLayoutParams();
if (fastMsgRecyclerView.getVisibility() == View.VISIBLE) {
params1.bottomMargin = DpUtil.dp2px(38);
} else {
params1.bottomMargin = DpUtil.dp2px(8);
}
atMessage.setLayoutParams(params1);
}
});
ViewClicksAntiShake.clicksAntiShake(atMessage, () -> {
mLiveChatAdapter.scrollToAt();
atMessage.setVisibility(View.GONE);
}); });
dr_pk_end_gif = (GifImageView) findViewById(R.id.dr_pk_end_gif); dr_pk_end_gif = (GifImageView) findViewById(R.id.dr_pk_end_gif);
msg = (LinearLayout) findViewById(R.id.room_msg); msg = (LinearLayout) findViewById(R.id.room_msg);
@ -972,6 +986,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
fastMsgRecyclerView.setVisibility(View.GONE); fastMsgRecyclerView.setVisibility(View.GONE);
params1.bottomMargin = 0; params1.bottomMargin = 0;
mChatRecyclerView.setLayoutParams(params1); mChatRecyclerView.setLayoutParams(params1);
RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) newMessage.getLayoutParams();
RelativeLayout.LayoutParams params3 = (RelativeLayout.LayoutParams) atMessage.getLayoutParams();
if (newMessage.getVisibility() == View.VISIBLE) {
params2.bottomMargin = DpUtil.dp2px(8);
if (atMessage.getVisibility() == View.VISIBLE) {
params3.bottomMargin = DpUtil.dp2px(38);
atMessage.setLayoutParams(params3);
}
newMessage.setLayoutParams(params2);
} else {
if (atMessage.getVisibility() == View.VISIBLE) {
params3.bottomMargin = DpUtil.dp2px(8);
atMessage.setLayoutParams(params3);
}
}
}); });
// mBanner2.setVisibility(View.GONE); // mBanner2.setVisibility(View.GONE);
if (fastMsgRecyclerView.getVisibility() == View.GONE) { if (fastMsgRecyclerView.getVisibility() == View.GONE) {
@ -3082,6 +3111,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) newMessage.getLayoutParams(); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) newMessage.getLayoutParams();
RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) atMessage.getLayoutParams();
if (atMessage.getVisibility() == View.VISIBLE) {
if (fastMsgRecyclerView.getVisibility() == View.VISIBLE) {
params2.bottomMargin = DpUtil.dp2px(68);
} else {
params1.bottomMargin = DpUtil.dp2px(38);
}
atMessage.setLayoutParams(params2);
}
if (fastMsgRecyclerView.getVisibility() == View.VISIBLE) { if (fastMsgRecyclerView.getVisibility() == View.VISIBLE) {
params1.bottomMargin = DpUtil.dp2px(38); params1.bottomMargin = DpUtil.dp2px(38);
} else { } else {
@ -3094,12 +3134,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
public void showAtMessage() { public void showAtMessage() {
new Handler().postDelayed(() -> {
Locale locale = mContext.getResources().getConfiguration().locale; Locale locale = mContext.getResources().getConfiguration().locale;
String language = locale.getLanguage(); String language = locale.getLanguage();
ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.emphasis_cn : R.mipmap.emphasis_en, atMessage); ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.emphasis_cn : R.mipmap.emphasis_en, atMessage);
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) atMessage.getLayoutParams(); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) atMessage.getLayoutParams();
if (newMessage.getVisibility() == View.VISIBLE) { if (newMessage.getVisibility() == View.VISIBLE) {
params1.bottomMargin = DpUtil.dp2px(58); if (fastMsgRecyclerView.getVisibility() == View.VISIBLE) {
params1.bottomMargin = DpUtil.dp2px(68);
} else {
params1.bottomMargin = DpUtil.dp2px(38);
}
} else { } else {
if (fastMsgRecyclerView.getVisibility() == View.VISIBLE) { if (fastMsgRecyclerView.getVisibility() == View.VISIBLE) {
params1.bottomMargin = DpUtil.dp2px(38); params1.bottomMargin = DpUtil.dp2px(38);
@ -3110,5 +3155,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
atMessage.setLayoutParams(params1); atMessage.setLayoutParams(params1);
atMessage.setVisibility(View.VISIBLE); atMessage.setVisibility(View.VISIBLE);
}, 100);
} }
} }

View File

@ -11,12 +11,15 @@ import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.GsonUtils; import com.blankj.utilcode.util.GsonUtils;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.OlineModel; import com.yunbao.common.bean.OlineModel;
import com.yunbao.common.bean.OlineUserlistModel; import com.yunbao.common.bean.OlineUserlistModel;
import com.yunbao.common.event.LiveInputEvent; import com.yunbao.common.event.LiveInputEvent;
import com.yunbao.common.event.OlineEvent; import com.yunbao.common.event.OlineEvent;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordsTypeUtil; import com.yunbao.common.utils.WordsTypeUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.adapter.OlineListAdapter; import com.yunbao.live.adapter.OlineListAdapter;
@ -194,7 +197,13 @@ public class OlineListActivity extends AbsActivity {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onOlineEvent(OlineEvent event) { public void onOlineEvent(OlineEvent event) {
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
if (TextUtils.equals(String.valueOf(model.getId()), event.getModel().getId())) {
ToastUtil.show(R.string.cannot_yourself);
} else {
Bus.get().post(new LiveInputEvent().setModel(event.getModel())); Bus.get().post(new LiveInputEvent().setModel(event.getModel()));
finish(); finish();
} }
}
} }