From 41f07f2e3d510978d9d83a8e003e4293fbfa47ce Mon Sep 17 00:00:00 2001
From: 18142669586 <1669783059@qq.com>
Date: Fri, 29 Jul 2022 15:58:18 +0800
Subject: [PATCH] 111
---
.../yunbao/common/manager/IMLoginManager.java | 48 ++++++++++++++-----
.../manager/imrongcloud/MessageIMManager.java | 2 +
config.gradle | 4 +-
.../live/activity/PDLIiveChatActivity.java | 2 +
.../live/dialog/LiveHDDialogFragment.java | 32 ++++++-------
.../yunbao/live/socket/SocketRyClient.java | 3 ++
.../live/views/LiveAudienceViewHolder.java | 16 +++++++
.../yunbao/live/views/LiveRoomViewHolder.java | 1 +
live/src/main/res/layout/dialog_live_hd.xml | 3 +-
.../main/res/layout/view_live_audience.xml | 1 -
.../PDLiveConversationListActivity.java | 2 +
.../views/MainHomeLiveWeekItemViewHolder.java | 9 ++--
main/src/main/res/values/rc_config.xml | 2 +-
13 files changed, 88 insertions(+), 37 deletions(-)
diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java
index d1b2a4325..2d56ba11b 100644
--- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java
+++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java
@@ -30,31 +30,34 @@ public class IMLoginManager extends BaseCacheManager {
//根据用户信息
- private Handler netHandler = new Handler();
+ private Handler netHandler = null;
private Context context;
private IMLoginManager(Context context) {
super(context);
this.context = context;
+
}
+
//新用戶是否送了禮物
- public boolean isNewUserGif(){
- return getBoolean(isNewUserGif,false);
+ public boolean isNewUserGif() {
+ return getBoolean(isNewUserGif, false);
}
+
//是否是新用戶還沒有送禮物
- public void setNewUserGif(boolean t){
- put(isNewUserGif,t);
+ public void setNewUserGif(boolean t) {
+ put(isNewUserGif, t);
}
// 是否新用户第一次進直播間
- public boolean isisNewUserOne(){
- return getBoolean(isNewUserOne,false);
- }
- //新用戶是否送了禮物
- public void setisNewUserOne(boolean t){
- put(isNewUserOne,t);
+ public boolean isisNewUserOne() {
+ return getBoolean(isNewUserOne, false);
}
+ //新用戶是否送了禮物
+ public void setisNewUserOne(boolean t) {
+ put(isNewUserOne, t);
+ }
/**
@@ -82,6 +85,16 @@ public class IMLoginManager extends BaseCacheManager {
return userInfo;
}
+ /**
+ * 判断是否已登录
+ *
+ * @param context
+ * @return
+ */
+ public static boolean isLogin(Context context) {
+ return null != get(context).getUserInfo();
+ }
+
/**
* 设置已登录的用户信息
*
@@ -89,6 +102,19 @@ public class IMLoginManager extends BaseCacheManager {
*/
public void setupLoginUser(@NonNull IMLoginModel model) {
this.userInfo = model;
+ if (netHandler == null) {
+ netHandler = new Handler();
+ }
+ netHandler.post(isInstructorRunnable);
+ }
+
+ /**
+ * 重新请求管理员身份信息
+ */
+ public void checkInstructor() {
+ if (netHandler == null) {
+ netHandler = new Handler();
+ }
netHandler.post(isInstructorRunnable);
}
diff --git a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java
index 8b5bcd2f4..37bae9b8b 100644
--- a/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java
+++ b/common/src/main/java/com/yunbao/common/manager/imrongcloud/MessageIMManager.java
@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
+import android.util.Log;
import android.view.View;
import com.alibaba.fastjson.JSON;
@@ -136,6 +137,7 @@ public class MessageIMManager {
if ((message.getConversationType() == Conversation.ConversationType.SYSTEM) && (message.getContent() instanceof TextMessage)) {
TextMessage content = (TextMessage) message.getContent();
String json = content.getContent();
+ Log.e("getSystemForRongcloud", json);
model = new Gson().fromJson(json, ImUserInfoModel.class);
}
if (message.getConversationType() == Conversation.ConversationType.SYSTEM && model != null && TextUtils.equals(model.getMethod(), "LivePK_UnreadCount")) {
diff --git a/config.gradle b/config.gradle
index a7df60c69..1cced9059 100644
--- a/config.gradle
+++ b/config.gradle
@@ -4,8 +4,8 @@ ext {
buildToolsVersion: "28.0.3",
minSdkVersion : 21,
targetSdkVersion : 30,
- versionCode : 200,
- versionName : "6.3.6"
+ versionCode : 201,
+ versionName : "6.3.7"
]
manifestPlaceholders = [
//正式
diff --git a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java
index bd41bb821..ef55e0036 100644
--- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java
@@ -23,6 +23,7 @@ import com.blankj.utilcode.util.GsonUtils;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
+import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.live.R;
import com.yunbao.live.adapter.SystemChatMessageAdapter;
@@ -89,6 +90,7 @@ public class PDLIiveChatActivity extends FragmentActivity {
* 初始化数据
*/
private void initData() {
+ IMLoginManager.get(mContext).checkInstructor();
//获取系统消息列表
ImHttpUtil.getImUserInfo("", new HttpCallback() {
@Override
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java
index d968c591f..fc47dba4a 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveHDDialogFragment.java
@@ -65,22 +65,22 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
window.setAttributes(params);
}
- @Override
- public void onStart() {
- super.onStart();
- Window window = getDialog().getWindow();
- window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
- WindowManager.LayoutParams windowParams = window.getAttributes();
- windowParams.dimAmount = 0.0f;
- windowParams.y = 100;
- window.setAttributes(windowParams);
- Dialog dialog = getDialog();
- if (dialog != null) {
- DisplayMetrics dm = new DisplayMetrics();
- getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
- dialog.getWindow().setLayout((int) (dm.widthPixels), (int) (dm.heightPixels * (showType == 0 ? 0.5 : 1)));
- }
- }
+// @Override
+// public void onStart() {
+// super.onStart();
+//// Window window = getDialog().getWindow();
+//// window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+//// WindowManager.LayoutParams windowParams = window.getAttributes();
+//// windowParams.dimAmount = 0.0f;
+//// windowParams.y = 100;
+//// window.setAttributes(windowParams);
+//// Dialog dialog = getDialog();
+//// if (dialog != null) {
+//// DisplayMetrics dm = new DisplayMetrics();
+//// getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
+//// dialog.getWindow().setLayout((int) (dm.widthPixels), (int) (dm.heightPixels * (showType == 0 ? 0.5 : 1)));
+//// }
+// }
@Override
public void onActivityCreated(Bundle savedInstanceState) {
diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java
index e6a373919..0c4c14d79 100644
--- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java
+++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java
@@ -130,6 +130,9 @@ public class SocketRyClient {
mListener.onSuperCloseLive();//超管关闭房间
return;
}
+ if(socketMsg.contains("LivePK_UnreadCount")){
+ return;
+ }
SocketReceiveBean received = JSON.parseObject(socketMsg, SocketReceiveBean.class);
Log.i("tag", "1" + "礼物");
diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java
index 4906f84e2..2ffe30f4b 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java
@@ -11,6 +11,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSONObject;
@@ -25,6 +26,7 @@ import com.yunbao.common.event.UpdateTablePoint;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
+import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
@@ -42,6 +44,8 @@ import org.greenrobot.eventbus.ThreadMode;
import java.net.MalformedURLException;
import java.net.URL;
+import static com.yunbao.live.views.LiveRoomViewHolder.mNameText;
+
/**
* Created by cxf on 2018/10/9.
* 观众直播间逻辑
@@ -83,6 +87,16 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
svga_new_user_gif.setVisibility(View.GONE);
svga_new_user_gif.stopAnimation();
svga_new_user_gif.clear();
+ }else if("name_true".equals(str)){
+ if(LiveRoomViewHolder.mName.getText().length()<=4){
+ RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(DpUtil.dp2px(116),DpUtil.dp2px(40));
+ layoutParams.setMargins(DpUtil.dp2px(80),DpUtil.dp2px(80),0,0);
+ svga_new_user_follow.setLayoutParams(layoutParams);
+ }else{
+ RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(DpUtil.dp2px(116),DpUtil.dp2px(40));
+ layoutParams.setMargins(DpUtil.dp2px(100),DpUtil.dp2px(80),0,0);
+ svga_new_user_follow.setLayoutParams(layoutParams);
+ }
}
}
@@ -152,6 +166,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
svga_new_user_gif = (SVGAImageView)findViewById(R.id.svga_new_user_gif);
svga_new_user_double = (SVGAImageView)findViewById(R.id.svga_new_user_double);
svga_new_user_follow = (SVGAImageView)findViewById(R.id.svga_new_user_follow);
+
+
svga_new_user_double.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
index 495a0c8e4..920c7f55a 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -975,6 +975,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (mName != null) {
mNameText = name;
mName.setText(name);
+ EventBus.getDefault().post("name_true");
}
}
diff --git a/live/src/main/res/layout/dialog_live_hd.xml b/live/src/main/res/layout/dialog_live_hd.xml
index 498b00292..96bc3c507 100644
--- a/live/src/main/res/layout/dialog_live_hd.xml
+++ b/live/src/main/res/layout/dialog_live_hd.xml
@@ -47,7 +47,6 @@
+ android:layout_height="wrap_content"/>
\ No newline at end of file
diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml
index ff176e023..5d1ab95c9 100644
--- a/live/src/main/res/layout/view_live_audience.xml
+++ b/live/src/main/res/layout/view_live_audience.xml
@@ -465,7 +465,6 @@
android:layout_width="116dp"
android:layout_height="40dp"
android:layout_marginTop="80dp"
- android:layout_marginLeft="100dp"
android:layout_gravity="center_vertical"
app:autoPlay="true" />
diff --git a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java
index 7d5295eb8..f93a7504b 100644
--- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java
@@ -20,6 +20,7 @@ import com.yunbao.common.custom.TabButtonGroup;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.http.HttpCallback;
+import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.ToastUtil;
@@ -114,6 +115,7 @@ public class PDLiveConversationListActivity extends AbsActivity {
* 初始化数据
*/
private void initData() {
+ IMLoginManager.get(mContext).checkInstructor();
mProcessResultUtil = new ProcessResultUtil(this);
//获取系统消息列表
ImHttpUtil.getImUserInfo("", new HttpCallback() {
diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java
index b03d43441..775ed214e 100644
--- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java
+++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java
@@ -84,10 +84,11 @@ public class MainHomeLiveWeekItemViewHolder extends RecyclerView.ViewHolder {
List mWeekList = bean.getmWeekList();
if (mWeekList != null && mWeekList.size() > 0) {
viewflipperBanner.removeAllViews();
+ weekList.clear();
+ weekList.addAll(mWeekList);
+ itemView.setTag(position);
}
- weekList.clear();
- weekList.addAll(mWeekList);
- itemView.setTag(position);
+
try {
upSvga();
//设置周榜边框动图
@@ -115,7 +116,7 @@ public class MainHomeLiveWeekItemViewHolder extends RecyclerView.ViewHolder {
@Override
public void onClick(View v) {
if (listener != null) {
- WeekListBean model = mWeekList.get(viewflipperBanner.getDisplayedChild());
+ WeekListBean model = weekList.get(viewflipperBanner.getDisplayedChild());
bean.setUid(model.getAnchor_id());
listener.onItemClick(bean, position);
}
diff --git a/main/src/main/res/values/rc_config.xml b/main/src/main/res/values/rc_config.xml
index 9efe0ce80..7268494b1 100644
--- a/main/src/main/res/values/rc_config.xml
+++ b/main/src/main/res/values/rc_config.xml
@@ -75,7 +75,7 @@
false
- true
+ false
true