Merge branch 'master' into dev_room_chat

# Conflicts:
#	live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java
#	main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java
This commit is contained in:
zlzw 2022-09-05 17:54:51 +08:00
commit 64c37e6ff4
29 changed files with 971 additions and 150 deletions

View File

@ -10,6 +10,9 @@ public class VipModel extends BaseModel {
@SerializedName("type") @SerializedName("type")
private String type = ""; private String type = "";
@SerializedName("admin_id")
private String adminId;
public String getType() { public String getType() {
return type; return type;
} }
@ -18,4 +21,13 @@ public class VipModel extends BaseModel {
this.type = type; this.type = type;
return this; return this;
} }
public String getAdminId() {
return adminId;
}
public VipModel setAdminId(String adminId) {
this.adminId = adminId;
return this;
}
} }

View File

@ -14,6 +14,7 @@ import com.yunbao.common.bean.NobleTrumpetModel;
import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.SlideInBannerModel; import com.yunbao.common.bean.SlideInBannerModel;
import com.yunbao.common.bean.VipModel;
import java.util.List; import java.util.List;
@ -189,7 +190,6 @@ public interface PDLiveApi {
/** /**
* 获取推送关注的开关和关注列表 * 获取推送关注的开关和关注列表
*
*/ */
@GET("/api/public/?service=Tx.offlineMsgSwitchDetail") @GET("/api/public/?service=Tx.offlineMsgSwitchDetail")
Observable<ResponseModel<MsgSwitchDetailModel>> getMsgSwitchDetail(); Observable<ResponseModel<MsgSwitchDetailModel>> getMsgSwitchDetail();
@ -198,18 +198,31 @@ public interface PDLiveApi {
* 推送关注的开关设置 * 推送关注的开关设置
*/ */
@GET("/api/public/?service=Tx.setMsgMasterSwitch") @GET("/api/public/?service=Tx.setMsgMasterSwitch")
Observable<ResponseModel<BaseModel>> setMsgMasterSwitch(@Query("status") String status,@Query("type") String type); Observable<ResponseModel<BaseModel>> setMsgMasterSwitch(@Query("status") String status, @Query("type") String type);
/** /**
*开播推送设置开关 * 开播推送设置开关
*/ */
@GET("/api/public/?service=Tx.setBeginShowMsgSwitch") @GET("/api/public/?service=Tx.setBeginShowMsgSwitch")
Observable<ResponseModel<List<BaseModel>>> setBeginShowMsgSwitch(@Query("status") String status,@Query("isAll") String isAll,@Query("liveuid") String liveuid); Observable<ResponseModel<List<BaseModel>>> setBeginShowMsgSwitch(@Query("status") String status, @Query("isAll") String isAll, @Query("liveuid") String liveuid);
/** /**
* 小时榜接口 * 小时榜接口
*
* @param liveuid 直播间id * @param liveuid 直播间id
*/ */
@GET("/api/public/?service=Live.getHourChartRank") @GET("/api/public/?service=Live.getHourChartRank")
Observable<ResponseModel<List<HourRank>>> getHourChartRank(@Query("liveuid")String liveuid); Observable<ResponseModel<List<HourRank>>> getHourChartRank(@Query("liveuid") String liveuid);
/**
* 清除系统消息的未读数
*/
@GET("/api/public/?service=Message.setMessageReadAll")
Observable<ResponseModel<List<String>>> setMessageReadAll();
/**
* 获取当前用户指导员ID
*/
@GET("/api/public/?service=User.getUserInstructor")
Observable<ResponseModel<List<VipModel>>> getUserInstructor();
} }

View File

@ -7,6 +7,7 @@ import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.NobleTrumpetModel;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.http.API; import com.yunbao.common.http.API;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
@ -153,4 +154,39 @@ public class LiveNetManager {
callback.onError(throwable.getMessage()); callback.onError(throwable.getMessage());
}).isDisposed(); }).isDisposed();
} }
/**
* 清除系统消息的未读数
*/
public void setMessageReadAll(HttpCallback<String> callback) {
API.get().pdLiveApi(mContext).setMessageReadAll()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
if (callback != null)
callback.onSuccess(null);
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null)
callback.onError(throwable.getMessage());
}
}).isDisposed();
}
/**
* 获取当前用户指导员ID
*/
public void getUserInstructor(HttpCallback<List<VipModel>> callback) {
API.get().pdLiveApi(mContext).getUserInstructor()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
if (callback != null)
callback.onSuccess(listResponseModel.getData().getInfo());
}, throwable -> {
if (callback != null)
callback.onError(throwable.getMessage());
}).isDisposed();
}
} }

View File

@ -32,9 +32,9 @@ import static com.yunbao.common.CommonAppContext.isReady;
*/ */
public class RongcloudIMManager { public class RongcloudIMManager {
//融云开发者平台注册app唯一识别符 //融云开发者平台注册app唯一识别符
public static final String RONG_IM_KEY = "uwd1c0sxu1p71"; // public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
//测试环境 //测试环境
// public static final String RONG_IM_KEY = "pvxdm17jpd3hr"; public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
private static final String CLASSNAME = "RongcloudIMManager"; private static final String CLASSNAME = "RongcloudIMManager";

View File

@ -883,4 +883,6 @@
<string name="shield_gift_effect">屏蔽禮物特效</string> <string name="shield_gift_effect">屏蔽禮物特效</string>
<string name="shield_mount_effect">屏蔽座駕特效</string> <string name="shield_mount_effect">屏蔽座駕特效</string>
<string name="current_live_room">您已在當前直播間</string> <string name="current_live_room">您已在當前直播間</string>
<string name="clear_unread_messages">是否清空未讀消息</string>
</resources> </resources>

View File

@ -10,9 +10,9 @@ ext {
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -1,6 +1,5 @@
package com.yunbao.live.activity; package com.yunbao.live.activity;
import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
@ -26,14 +25,12 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.InstructorRemarkManager; import com.yunbao.common.manager.InstructorRemarkManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.adapter.SystemChatMessageAdapter; import com.yunbao.live.adapter.SystemChatMessageAdapter;
import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.bean.SearchUserBean;
import com.yunbao.live.http.ImHttpUtil; import com.yunbao.live.http.ImHttpUtil;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -46,11 +43,9 @@ import io.rong.imlib.model.UserInfo;
* 直播页面聊天列表 * 直播页面聊天列表
*/ */
public class PDLIiveChatActivity extends FragmentActivity { public class PDLIiveChatActivity extends FragmentActivity {
private MyConversationListFragment conversationListFragment; private ConversationListFragment conversationListFragment;
private FrameLayout container; private FrameLayout container;
private PDLIiveChatActivity mContext; private PDLIiveChatActivity mContext;
private boolean isGetSystemMsg=true;//是否展示系统消息默认为true
private boolean isDialogWindow=false;//是否为半屏展示默认为false
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -58,14 +53,6 @@ public class PDLIiveChatActivity extends FragmentActivity {
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_pd_chat); setContentView(R.layout.activity_pd_chat);
mContext = this; mContext = this;
Intent intent = getIntent();
if(intent!=null) {
isGetSystemMsg =intent.getBooleanExtra("systemMsg",true);
isDialogWindow =intent.getBooleanExtra("dialogWindow",false);
}else{
isGetSystemMsg=true;
isDialogWindow=false;
}
windowColor(); windowColor();
initView(); initView();
initData(); initData();
@ -89,6 +76,15 @@ public class PDLIiveChatActivity extends FragmentActivity {
getWindow().setAttributes(lp); getWindow().setAttributes(lp);
setFinishOnTouchOutside(true);//允许点击空白处关闭 setFinishOnTouchOutside(true);//允许点击空白处关闭
//展示会话列表
conversationListFragment = new ConversationListFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.container, conversationListFragment);
transaction.commit();
//自定义空数据背景View
conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg);
} }
/** /**
@ -103,25 +99,21 @@ public class PDLIiveChatActivity extends FragmentActivity {
*/ */
private void initData() { private void initData() {
IMLoginManager.get(mContext).checkInstructor(); IMLoginManager.get(mContext).checkInstructor();
//获取系统消息列表 // //获取系统消息列表
if(isGetSystemMsg) { // ImHttpUtil.getImUserInfo("", new HttpCallback() {
ImHttpUtil.getImUserInfo("", new HttpCallback() { // @Override
@Override // public void onSuccess(int code, String msg, String[] info) {
public void onSuccess(int code, String msg, String[] info) { // if (code == 0) {
if (code == 0) { // container.post(new Runnable() {
container.post(new Runnable() { // @Override
@Override // public void run() {
public void run() { // List<ImUserBean> listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
List<ImUserBean> listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class); // addSystemMessagesView(listUserBean);
addSystemMessagesView(listUserBean); // }
} // });
}); // }
} // }
} // });
});
}else{
addSystemMessagesView(new ArrayList<>());
}
//刷新列表内用户信息 //刷新列表内用户信息
addUserInfoProvider(); addUserInfoProvider();
@ -138,10 +130,7 @@ public class PDLIiveChatActivity extends FragmentActivity {
//倒序展示 //倒序展示
Collections.reverse(listUserBean); Collections.reverse(listUserBean);
//展示会话列表 //展示会话列表
conversationListFragment = new MyConversationListFragment(); conversationListFragment = new ConversationListFragment();
Bundle bundle=new Bundle();
bundle.putBoolean("dialogWindow",isDialogWindow);
conversationListFragment.setBundle(bundle);
FragmentManager manager = getSupportFragmentManager(); FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction(); FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.container, conversationListFragment); transaction.replace(R.id.container, conversationListFragment);

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="95dp" />
<solid android:color="@color/red" />
<stroke
android:width="1dp"
android:color="@color/white" />
<padding
android:bottom="5dp"
android:left="10dp"
android:right="10dp"
android:top="5dp" />
</shape>

View File

@ -1,24 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<TextView <androidx.cardview.widget.CardView
android:id="@+id/top_noback" android:id="@+id/top_card"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="18dp" app:cardBackgroundColor="@color/white"
android:text="@string/message" app:cardCornerRadius="8dp"
android:textColor="@color/black3" app:cardElevation="0dp">
android:textSize="24sp"
android:textStyle="bold" /> <TextView
android:id="@+id/top_noback"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:text="@string/message"
android:textColor="@color/black3"
android:textSize="24sp"
android:textStyle="bold" />
</androidx.cardview.widget.CardView>
<FrameLayout <FrameLayout
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="400dp" android:layout_height="400dp"
android:layout_below="@id/top_card"
android:layout_marginTop="-10dp"
android:background="@color/white" android:background="@color/white"
android:paddingTop="10dp" /> android:paddingTop="10dp" />
</LinearLayout> </RelativeLayout>

View File

@ -1,23 +1,147 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rc_conversation_item" android:id="@+id/rc_conversation_item"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/rc_conversation_item_height"> android:layout_height="123dp">
<androidx.constraintlayout.widget.ConstraintLayout <RelativeLayout
android:id="@+id/administrator_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:visibility="gone"
android:layout_marginTop="5dp"
android:layout_marginEnd="8dp">
<RelativeLayout
android:id="@+id/img_administrator_layout"
android:layout_width="54dp"
android:layout_height="54dp"
android:layout_marginStart="34dp"
android:layout_marginTop="39dp"
android:layout_marginEnd="15dp">
<com.yunbao.common.views.weight.ClipPathCircleImage
android:id="@+id/img_administrator"
android:layout_width="54dp"
android:layout_height="54dp"
android:scaleType="centerCrop"
android:src="@mipmap/beauty_jingbai" />
<ImageView
android:id="@+id/img_administrator_logo"
android:layout_width="match_parent"
android:layout_height="22dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-5dp"
android:src="@mipmap/img_news_instructor_tags_chinese"
android:visibility="visible" />
</RelativeLayout>
<LinearLayout
android:id="@+id/conversation_linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="41dp"
android:layout_toEndOf="@id/img_administrator_layout"
android:gravity="center_vertical">
<TextView
android:id="@+id/conversation_title"
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="张三"
android:textColor="#161616"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/conversation_linear"
android:layout_toEndOf="@id/img_administrator_layout"
android:layout_marginTop="7dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/rc_conversation_read_receipt"
android:layout_width="30dp"
android:layout_height="15dp"
android:layout_marginEnd="4dp"
android:visibility="gone" />
<TextView
android:id="@+id/rc_conversation_content"
style="@style/TextStyle.Alignment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="60dp"
android:layout_weight="1"
android:ellipsize="end"
android:singleLine="true"
android:text="你好,朋友!"
android:textColor="@color/rc_secondary_color"
android:textSize="14sp" />
<RelativeLayout
android:id="@+id/conversation_unread"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginEnd="26dp">
<ImageView
android:id="@+id/conversation_unread_bg"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true"
app:srcCompat="@drawable/rc_unread_count_bg_normal" />
<TextView
android:id="@+id/conversation_unread_count"
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="15"
android:textColor="@color/rc_white_color"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/conversation_date"
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="41dp"
android:layout_marginEnd="26dp"
android:text="3 月 22 日"
android:textColor="@color/rc_auxiliary_color"
android:textSize="@dimen/rc_font_nav_or_date_size" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rc_conversation_portrait_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<RelativeLayout <RelativeLayout
android:id="@+id/rc_conversation_portrait_rl" android:id="@+id/rc_conversation_portrait_rl"
android:layout_width="54dp" android:layout_width="54dp"
android:layout_height="54dp" android:layout_height="54dp"
android:layout_marginLeft="15dp" android:layout_marginStart="16dp"
android:layout_marginRight="15dp" android:layout_marginTop="39dp"
app:layout_constraintBottom_toBottomOf="parent" android:layout_marginEnd="15dp">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:id="@+id/rc_conversation_portrait" android:id="@+id/rc_conversation_portrait"
@ -34,17 +158,15 @@
android:visibility="gone" /> android:visibility="gone" />
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout
android:id="@+id/rc_conversation_linear" android:id="@+id/rc_conversation_linear"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dp" android:layout_marginStart="88dp"
android:layout_marginTop="@dimen/rc_margin_size_16" android:layout_marginTop="41dp"
android:layout_marginEnd="@dimen/rc_margin_size_12" android:layout_marginEnd="@dimen/rc_margin_size_12"
android:gravity="center_vertical" android:gravity="center_vertical">
app:layout_constraintEnd_toStartOf="@+id/rc_conversation_date"
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
app:layout_constraintTop_toTopOf="parent">
<TextView <TextView
android:id="@+id/rc_conversation_title" android:id="@+id/rc_conversation_title"
@ -54,7 +176,7 @@
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
android:text="张三" android:text="张三"
android:textColor="@color/rc_text_main_color" android:textColor="#161616"
android:textSize="16sp" /> android:textSize="16sp" />
@ -62,30 +184,18 @@
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dp" android:layout_below="@id/rc_conversation_linear"
android:gravity="center_vertical" android:layout_marginStart="88dp"
app:layout_constraintEnd_toEndOf="parent" android:gravity="center_vertical">
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
app:layout_constraintTop_toBottomOf="@+id/rc_conversation_linear">
<ImageView
android:id="@+id/rc_conversation_read_receipt"
android:layout_width="30dp"
android:layout_height="15dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:visibility="gone" />
<TextView <TextView
android:id="@+id/rc_conversation_content" android:id="@+id/conversation_content"
style="@style/TextStyle.Alignment" style="@style/TextStyle.Alignment"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginEnd="60dp" android:layout_marginEnd="60dp"
android:layout_weight="1" android:layout_weight="1"
@ -126,13 +236,12 @@
style="@style/TextStyle.Alignment" style="@style/TextStyle.Alignment"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/rc_margin_size_16" android:layout_marginTop="@dimen/rc_margin_size_16"
android:layout_marginEnd="@dimen/rc_margin_size_12" android:layout_marginEnd="@dimen/rc_margin_size_12"
android:text="3 月 22 日" android:text="3 月 22 日"
android:textColor="@color/rc_auxiliary_color" android:textColor="@color/rc_auxiliary_color"
android:textSize="@dimen/rc_font_nav_or_date_size" android:textSize="@dimen/rc_font_nav_or_date_size" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/rc_conversation_no_disturb" android:id="@+id/rc_conversation_no_disturb"
@ -142,6 +251,7 @@
android:layout_marginBottom="@dimen/rc_margin_size_12" android:layout_marginBottom="@dimen/rc_margin_size_12"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:srcCompat="@drawable/rc_no_disturb" /> app:srcCompat="@drawable/rc_no_disturb" />
@ -150,8 +260,9 @@
android:layout_height="0.5dp" android:layout_height="0.5dp"
android:layout_marginTop="71.5dp" android:layout_marginTop="71.5dp"
android:background="@color/rc_divider_color" android:background="@color/rc_divider_color"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/rc_conversation_linear" app:layout_constraintStart_toStartOf="@id/rc_conversation_linear"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -81,4 +81,6 @@ dependencies {
implementation 'com.google.android.gms:play-services-auth:15.0.0' implementation 'com.google.android.gms:play-services-auth:15.0.0'
//Google //Google
implementation files('libs/jcc-bate-0.7.3.jar') implementation files('libs/jcc-bate-0.7.3.jar')
//
implementation 'com.binioter:guideview:1.0.0'
} }

Binary file not shown.

View File

@ -577,6 +577,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
isfloatBannernet = false; isfloatBannernet = false;
} }
}); });
//获取指导员账号
ConversationIMListManager.get(this).getUserInstructor(this);
} }
/** /**

View File

@ -1,11 +1,17 @@
package com.yunbao.main.activity; package com.yunbao.main.activity;
import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -16,19 +22,31 @@ import androidx.recyclerview.widget.RecyclerView;
import com.adjust.sdk.Adjust; import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent; import com.adjust.sdk.AdjustEvent;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.binioter.guideview.Guide;
import com.binioter.guideview.GuideBuilder;
import com.facebook.appevents.AppEventsLogger; import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics; import com.google.firebase.analytics.FirebaseAnalytics;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.ImUserInfoModel; import com.yunbao.common.bean.ImUserInfoModel;
import com.yunbao.common.custom.TabButtonGroup; import com.yunbao.common.custom.TabButtonGroup;
import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.UpdateTablePointMe; import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.activity.SystemMessageActivity;
import com.yunbao.live.bean.ImUserBean; import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.http.ImHttpUtil; import com.yunbao.live.http.ImHttpUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -36,11 +54,13 @@ import com.yunbao.main.adapter.SystemMessageAdapter;
import com.yunbao.main.dialog.MainStartDialogFragment; import com.yunbao.main.dialog.MainStartDialogFragment;
import com.yunbao.main.event.PDLiveConversationListEvent; import com.yunbao.main.event.PDLiveConversationListEvent;
import com.yunbao.main.manager.imrongcloud.ConversationIMListManager; import com.yunbao.main.manager.imrongcloud.ConversationIMListManager;
import com.yunbao.main.views.MessageGuideView;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -52,7 +72,7 @@ import static com.yunbao.common.CommonAppContext.isReady;
/** /**
* pdlive消息中心 * pdlive消息中心
*/ */
public class PDLiveConversationListActivity extends AbsActivity { public class PDLiveConversationListActivity extends AbsActivity implements View.OnClickListener {
//菜单 //菜单
private TabButtonGroup mTabButtonGroup; private TabButtonGroup mTabButtonGroup;
public static String CLASSNAME = "PDLiveConversationListActivity", MESSAGENUMBER = "messageNumber", NUMBERME = "numberMe"; public static String CLASSNAME = "PDLiveConversationListActivity", MESSAGENUMBER = "messageNumber", NUMBERME = "numberMe";
@ -64,8 +84,16 @@ public class PDLiveConversationListActivity extends AbsActivity {
private View redpointMe; private View redpointMe;
private SystemMessageAdapter messageAdapter; private SystemMessageAdapter messageAdapter;
private ProcessResultUtil mProcessResultUtil; private ProcessResultUtil mProcessResultUtil;
private TextView textNewsNotice, textNewsInteraction, textNewsOnline;
private ImageView newsIconClearance;
private Handler netHandler = new Handler();
private String type = null;
private List<ImUserBean> listUserBean = new ArrayList<>();
private LinearLayout topLayout;
private ImageView imgNewsNotice, imgNewsInteraction, imgNewsOnline;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.activity_conversation_list; return R.layout.activity_conversation_list;
} }
@ -77,6 +105,56 @@ public class PDLiveConversationListActivity extends AbsActivity {
mContext = this; mContext = this;
initView(); initView();
initData(); initData();
}
//展示引导层
private void showGuideView() {
MessageGuideView guideView = new MessageGuideView(this);
//top_noback
GuideBuilder builder = new GuideBuilder();
builder.setTargetView(topLayout)
.setAlpha(180)
.setHighTargetCorner(20)
.setHighTargetPadding(10);
builder.setOverlayTarget(true);
builder.setAutoDismiss(false);
builder.addComponent(guideView);
Guide guide = builder.createGuide();
guide.show(this);
//引导界面设置
View container = guideView.getContainer();
SVGAImageView guidSvga = container.findViewById(R.id.guide_svga);
LinearLayout guideLayout = container.findViewById(R.id.guide_layout);
ImageView politicalInstructor = container.findViewById(R.id.political_instructor);
//设置界面宽度
ViewGroup.LayoutParams layoutParams = guideLayout.getLayoutParams();
layoutParams.width = DeviceUtils.getScreenWidth(mContext);
guideLayout.setLayoutParams(layoutParams);
//设置svga动图
new SVGAParser(mContext).decodeFromAssets("guide.svga", new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
guidSvga.setImageDrawable(drawable);
guidSvga.startAnimation();
}
@Override
public void onError() {
Log.e("errqs", "errl");
}
}, null);
//点击事件
ViewClicksAntiShake.clicksAntiShake(politicalInstructor, () -> {
String targetId = ConversationIMListManager.get(mContext).getTargetId();
if (!TextUtils.isEmpty(targetId)) {
ConversationIMListManager.get(mContext).jumpConversation(mContext, targetId);
guide.dismiss();
}
});
} }
/** /**
@ -88,7 +166,14 @@ public class PDLiveConversationListActivity extends AbsActivity {
container = findViewById(R.id.container); container = findViewById(R.id.container);
redPoint = findViewById(R.id.v_table_redpoint); redPoint = findViewById(R.id.v_table_redpoint);
redpointMe = findViewById(R.id.v_table_redpoint_me); redpointMe = findViewById(R.id.v_table_redpoint_me);
textNewsNotice = findViewById(R.id.text_news_notice);
textNewsInteraction = findViewById(R.id.text_news_interaction);
textNewsOnline = findViewById(R.id.text_news_online);
newsIconClearance = findViewById(R.id.news_icon_clearance);
topLayout = findViewById(R.id.top_layout);
imgNewsNotice = findViewById(R.id.img_news_notice);
imgNewsInteraction = findViewById(R.id.img_news_interaction);
imgNewsOnline = findViewById(R.id.img_news_online);
mTabButtonGroup.setCurPosition(2); mTabButtonGroup.setCurPosition(2);
findViewById(R.id.btn_start).setOnClickListener(v -> { findViewById(R.id.btn_start).setOnClickListener(v -> {
//防止重新加载多个 //防止重新加载多个
@ -104,39 +189,41 @@ public class PDLiveConversationListActivity extends AbsActivity {
startActivity(new Intent(mContext, MainActivity.class)); startActivity(new Intent(mContext, MainActivity.class));
} }
}); });
newsIconClearance.setOnClickListener(this);
container.post(new Runnable() {
@Override
public void run() {
showGuideView();
}
});
} }
private void showStartDialog() { private void showStartDialog() {
if (isReady == true) { if (isReady == true) {
MainStartDialogFragment dialogFragment = new MainStartDialogFragment(); MainStartDialogFragment dialogFragment = new MainStartDialogFragment();
dialogFragment.setMainStartChooseCallback(true,this); dialogFragment.setMainStartChooseCallback(true, this);
dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment"); dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment");
} else { } else {
ToastUtil.show("正在初始化,請稍等...."); ToastUtil.show("正在初始化,請稍等....");
} }
} }
/** /**
* 初始化数据 * 初始化数据
*/ */
private void initData() { private void initData() {
IMLoginManager.get(mContext).checkInstructor(); IMLoginManager.get(mContext).checkInstructor();
mProcessResultUtil = new ProcessResultUtil(this); mProcessResultUtil = new ProcessResultUtil(this);
//获取系统消息列表 netHandler.post(imUserInfoRunnable);
ImHttpUtil.getImUserInfo("", new HttpCallback() { //展示会话列表
@Override conversationListFragment = new ConversationListFragment();
public void onSuccess(int code, String msg, String[] info) { FragmentManager manager = getSupportFragmentManager();
if (code == 0) { FragmentTransaction transaction = manager.beginTransaction();
container.post(new Runnable() { transaction.replace(R.id.container, conversationListFragment);
@Override transaction.commit();
public void run() { //自定义空数据背景View
List<ImUserBean> listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class); conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg);
addSystemMessagesView(listUserBean);
}
});
}
}
});
//刷新列表内用户信息 //刷新列表内用户信息
ConversationIMListManager.get(mContext).addUserInfoProvider(); ConversationIMListManager.get(mContext).addUserInfoProvider();
//消息中心 //消息中心
@ -151,6 +238,147 @@ public class PDLiveConversationListActivity extends AbsActivity {
MessageIMManager.get(this).getSystemMessages(); MessageIMManager.get(this).getSystemMessages();
} }
/**
* 系統消息獲取
*/
private Runnable imUserInfoRunnable = new Runnable() {
@Override
public void run() {
//获取系统消息列表
ImHttpUtil.getImUserInfo("", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
runOnUiThread(() -> {
listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
for (ImUserBean userBean : listUserBean) {
switch (userBean.getType()) {
//官方通知
case "1":
if (TextUtils.isEmpty(userBean.getNum()) || TextUtils.equals("0", userBean.getNum())) {
textNewsNotice.setVisibility(View.GONE);
} else {
textNewsNotice.setVisibility(View.VISIBLE);
textNewsNotice.setText(userBean.getNum());
}
ImgLoader.display(mContext, userBean.getImage(), imgNewsNotice);
ViewClicksAntiShake.clicksAntiShake(imgNewsNotice, () -> {
type = userBean.getType();
netHandler.post(systemNumberRunnable);
startActivity(new Intent(mContext, SystemMessageActivity.class)
.putExtra("type", userBean.getType())
.putExtra("uid", "")
.putExtra("title", userBean.getTitle())
.putExtra("headImg", ""));
});
break;
//互動消息
case "2":
if (TextUtils.isEmpty(userBean.getNum()) || TextUtils.equals("0", userBean.getNum())) {
textNewsInteraction.setVisibility(View.GONE);
} else {
textNewsInteraction.setVisibility(View.VISIBLE);
textNewsInteraction.setText(userBean.getNum());
}
ImgLoader.display(mContext, userBean.getImage(), imgNewsInteraction);
ViewClicksAntiShake.clicksAntiShake(imgNewsInteraction, () -> {
type = userBean.getType();
netHandler.post(systemNumberRunnable);
startActivity(new Intent(mContext, SystemMessageActivity.class)
.putExtra("type", userBean.getType())
.putExtra("uid", "")
.putExtra("title", userBean.getTitle())
.putExtra("headImg", ""));
});
break;
//在線客服
case "3":
if (TextUtils.isEmpty(userBean.getNum()) || TextUtils.equals("0", userBean.getNum())) {
textNewsOnline.setVisibility(View.GONE);
} else {
textNewsOnline.setVisibility(View.VISIBLE);
textNewsOnline.setText(userBean.getNum());
}
ImgLoader.display(mContext, userBean.getImage(), imgNewsOnline);
ViewClicksAntiShake.clicksAntiShake(imgNewsOnline, () -> {
type = userBean.getType();
netHandler.post(systemNumberRunnable);
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
AdjustEvent adjustEvent1 = new AdjustEvent("ww5z2p");
Adjust.trackEvent(adjustEvent1);
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
WebViewActivity.forward(mContext, userBean.getLink());
} else {
startActivity(new Intent(mContext, SystemMessageActivity.class)
.putExtra("type", userBean.getType())
.putExtra("uid", "")
.putExtra("title", userBean.getTitle())
.putExtra("headImg", ""));
}
});
break;
}
}
});
}
}
});
}
};
//修改小紅點
private Runnable systemNumberRunnable = new Runnable() {
@Override
public void run() {
runOnUiThread(() -> {
int systemNumber = 0;
for (ImUserBean userBean : listUserBean) {
//未读消息数
String number = userBean.getNum();
switch (userBean.getType()) {
//官方通知
case "1":
if (TextUtils.equals(type, userBean.getType())) {
number = null;
textNewsNotice.setVisibility(View.GONE);
}
break;
//互動消息
case "2":
if (TextUtils.equals(type, userBean.getType())) {
number = null;
textNewsInteraction.setVisibility(View.GONE);
}
break;
//在線客服
case "3":
if (TextUtils.equals(type, userBean.getType())) {
number = null;
textNewsOnline.setVisibility(View.GONE);
}
break;
}
//未读消息不为空并且大于0
try {
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
systemNumber = Integer.parseInt(number) + systemNumber;
}
} catch (NumberFormatException e) {
systemNumber = systemNumber + 0;
}
}
type = null;
MessageIMManager.get(mContext).setSystemNumber(systemNumber);
});
}
};
/** /**
* 添加头部系统消息 * 添加头部系统消息
* *
@ -178,6 +406,46 @@ public class PDLiveConversationListActivity extends AbsActivity {
conversationListFragment.addHeaderView(rootView); conversationListFragment.addHeaderView(rootView);
} }
@Override
public void onClick(View v) {
ViewClicksAntiShake.clicksAntiShake(v, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
//清除全部消息
if (v.getId() == R.id.news_icon_clearance) {
DialogUitl.showSimpleDialog(mContext, null, getString(R.string.clear_unread_messages), false, new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
// ConversationIMListManager.get(mContext).getConversationListByPage(true);
LiveNetManager.get(mContext)
.setMessageReadAll(new com.yunbao.common.http.base.HttpCallback<String>() {
@Override
public void onSuccess(String data) {
textNewsNotice.setVisibility(View.GONE);
textNewsInteraction.setVisibility(View.GONE);
textNewsOnline.setVisibility(View.GONE);
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
// IMCenter.getInstance().clearMessagesUnreadStatus();
MessageIMManager.get(mContext).setSystemNumber(0);
EventBus.getDefault().post(new MessageIMEvent().setNumber(0));
}
@Override
public void onCancel() {
}
});
}
}
});
}
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
@ -249,9 +517,9 @@ public class PDLiveConversationListActivity extends AbsActivity {
public void onUpdateFieldEvent(UpdateTablePointMe updateTablePointMe) { public void onUpdateFieldEvent(UpdateTablePointMe updateTablePointMe) {
if (redpointMe == null) return; if (redpointMe == null) return;
if (updateTablePointMe.getPoint() == 0) { if (updateTablePointMe.getPoint() == 0) {
redpointMe.setVisibility(View.VISIBLE);
} else {
redpointMe.setVisibility(View.GONE); redpointMe.setVisibility(View.GONE);
} else {
redpointMe.setVisibility(View.VISIBLE);
} }
} }
@ -259,5 +527,62 @@ public class PDLiveConversationListActivity extends AbsActivity {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onImUserInfoModel(ImUserInfoModel model) { public void onImUserInfoModel(ImUserInfoModel model) {
messageAdapter.upDataMessage(model); messageAdapter.upDataMessage(model);
int systemNumber = 0;
for (ImUserBean userBean : listUserBean) {
//未读消息数
String number = userBean.getNum();
//未读消息不为空并且大于0
try {
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
systemNumber = Integer.parseInt(number) + systemNumber;
}
} catch (NumberFormatException e) {
systemNumber = systemNumber + 0;
}
}
switch (model.getType()) {
//官方通知
case "1":
if (textNewsNotice.getVisibility() == View.GONE) {
textNewsNotice.setVisibility(View.GONE);
textNewsNotice.setText("");
} else {
String number = textNewsNotice.getText().toString().trim();
int numberInt = Integer.parseInt(number) + 1;
textNewsNotice.setVisibility(View.VISIBLE);
textNewsNotice.setText(String.valueOf(numberInt));
}
break;
//互動消息
case "2":
if (textNewsInteraction.getVisibility() == View.GONE) {
textNewsInteraction.setVisibility(View.GONE);
textNewsInteraction.setText("");
} else {
String number = textNewsInteraction.getText().toString().trim();
int numberInt = Integer.parseInt(number) + 1;
textNewsInteraction.setVisibility(View.VISIBLE);
textNewsInteraction.setText(String.valueOf(numberInt));
}
break;
//在線客服
case "3":
if (textNewsOnline.getVisibility() == View.GONE) {
textNewsOnline.setVisibility(View.GONE);
textNewsOnline.setText("");
} else {
String number = textNewsOnline.getText().toString().trim();
int numberInt = Integer.parseInt(number) + 1;
textNewsOnline.setVisibility(View.VISIBLE);
textNewsOnline.setText(String.valueOf(numberInt));
}
break;
}
systemNumber = systemNumber + 1;
MessageIMManager.get(mContext).setSystemNumber(systemNumber);
} }
} }

View File

@ -688,7 +688,16 @@ public class MainHttpUtil {
HttpClient.getInstance().get("User.isInstructor", MainHttpConsts.ISINSTRUCTOR) HttpClient.getInstance().get("User.isInstructor", MainHttpConsts.ISINSTRUCTOR)
.execute(callback); .execute(callback);
} }
//
public static void setMessageReadAll(){
HttpClient.getInstance().get("User.getUserInstructor","")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
} }

View File

@ -13,11 +13,12 @@ import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils; import com.blankj.utilcode.util.GsonUtils;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.InstructorRemarkManager; import com.yunbao.common.manager.InstructorRemarkManager;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.activity.PDLIiveChatActivity; import com.yunbao.live.activity.PDLIiveChatActivity;
import com.yunbao.live.activity.PDLiveConversationActivity; import com.yunbao.live.activity.PDLiveConversationActivity;
import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.bean.SearchUserBean;
@ -27,6 +28,9 @@ import com.yunbao.main.utils.PDLiveCustomConversationProvider;
import com.yunbao.main.utils.PDLiveMessageProcessor; import com.yunbao.main.utils.PDLiveMessageProcessor;
import com.yunbao.main.utils.PDSightMessageItemProvider; import com.yunbao.main.utils.PDSightMessageItemProvider;
import java.util.List;
import io.rong.imkit.IMCenter;
import io.rong.imkit.RongIM; import io.rong.imkit.RongIM;
import io.rong.imkit.config.ConversationListBehaviorListener; import io.rong.imkit.config.ConversationListBehaviorListener;
import io.rong.imkit.config.RongConfigCenter; import io.rong.imkit.config.RongConfigCenter;
@ -35,9 +39,9 @@ import io.rong.imkit.conversation.messgelist.provider.SightMessageItemProvider;
import io.rong.imkit.conversationlist.model.BaseUiConversation; import io.rong.imkit.conversationlist.model.BaseUiConversation;
import io.rong.imkit.conversationlist.provider.PrivateConversationProvider; import io.rong.imkit.conversationlist.provider.PrivateConversationProvider;
import io.rong.imkit.userinfo.RongUserInfoManager; import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imkit.userinfo.UserDataProvider;
import io.rong.imkit.utils.RouteUtils; import io.rong.imkit.utils.RouteUtils;
import io.rong.imkit.widget.adapter.ProviderManager; import io.rong.imkit.widget.adapter.ProviderManager;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.UserInfo; import io.rong.imlib.model.UserInfo;
import io.rong.sight.SightExtensionModule; import io.rong.sight.SightExtensionModule;
@ -48,7 +52,8 @@ import io.rong.sight.SightExtensionModule;
public class ConversationIMListManager { public class ConversationIMListManager {
private static ConversationIMListManager manager; private static ConversationIMListManager manager;
private Context mContext; private Context mContext;
private Bundle bundle;//用户传输配置给会话界面 //指导员ID
private String targetId;
private ConversationIMListManager(Context context) { private ConversationIMListManager(Context context) {
mContext = context; mContext = context;
@ -150,6 +155,9 @@ public class ConversationIMListManager {
//使用空白字段存储自己服务器用户的所有的信息 //使用空白字段存储自己服务器用户的所有的信息
userInfo.setExtra(GsonUtils.toJson(userBean)); userInfo.setExtra(GsonUtils.toJson(userBean));
RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo); RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo);
if (TextUtils.equals(userBean.getIs_admin(), "1")) {
setConversationToTop(userInfo.getUserId());
}
} }
} }
@ -170,12 +178,12 @@ public class ConversationIMListManager {
private void addUserInfoProvider(String userId, Activity context) { private void addUserInfoProvider(String userId, Activity context) {
//获取用户信息 //获取用户信息
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(userId); UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(userId);
if (null != userInfo){ if (null != userInfo) {
context.runOnUiThread(() -> { context.runOnUiThread(() -> {
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE; Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
RouteUtils.routeToConversationActivity(context, type, userId, bundle); RouteUtils.routeToConversationActivity(context, type, userId, null);
}); });
}else { } else {
CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() { CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
@ -195,6 +203,10 @@ public class ConversationIMListManager {
userInfo.setExtra(GsonUtils.toJson(userBean)); userInfo.setExtra(GsonUtils.toJson(userBean));
RongUserInfoManager.getInstance().setUserInfoProvider(s -> { RongUserInfoManager.getInstance().setUserInfoProvider(s -> {
RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo); RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo);
if (TextUtils.equals(userBean.getIs_admin(), "1")) {
targetId = userId;
setConversationToTop(userInfo.getUserId());
}
return null; return null;
}, true); }, true);
@ -209,6 +221,14 @@ public class ConversationIMListManager {
} }
/**
* 消息置顶
*/
private void setConversationToTop(String targetId) {
IMCenter.getInstance().setConversationToTop(Conversation.ConversationType.PRIVATE, targetId, true, false, null
);
}
private ConversationListBehaviorListener listener = new ConversationListBehaviorListener() { private ConversationListBehaviorListener listener = new ConversationListBehaviorListener() {
@Override @Override
public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String targetId) { public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String targetId) {
@ -235,9 +255,17 @@ public class ConversationIMListManager {
*/ */
@Override @Override
public boolean onConversationLongClick(Context context, View view, BaseUiConversation baseUiConversation) { public boolean onConversationLongClick(Context context, View view, BaseUiConversation baseUiConversation) {
new ConversationPopuwWindow((Activity) context) //非指导员都可以点击
.setIsAdmin(baseUiConversation.mCore.getTargetId()) UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(baseUiConversation.mCore.getTargetId());
.show(view); if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
if (!TextUtils.equals(model.getIsAdmin(), "1")) {
new ConversationPopuwWindow((Activity) context)
.setIsAdmin(baseUiConversation.mCore.getTargetId())
.show(view);
}
}
return true; return true;
} }
@ -247,15 +275,77 @@ public class ConversationIMListManager {
*/ */
@Override @Override
public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) { public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) {
Object tag = view.getTag(); jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId());
if(tag!=null){
bundle= (Bundle) tag;
}else{
bundle=null;
}
ViewClicksAntiShake.clicksAntiShake(view, () -> jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId()));
return true; return true;
} }
}; };
private long timeStamp = 0;
/**
* 获取当前指导员ID
*/
public void getUserInstructor(Activity context) {
LiveNetManager.get(context)
.getUserInstructor(new com.yunbao.common.http.base.HttpCallback<List<VipModel>>() {
@Override
public void onSuccess(List<VipModel> data) {
if (data != null && data.size() > 0) {
targetId = data.get(0).getAdminId();
}
}
@Override
public void onError(String error) {
}
});
}
/**
* 获取新手指导员账号废弃过时
*/
@Deprecated
public void getConversationListByPage(boolean clearMessages) {
RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback<List<Conversation>>() {
@Override
public void onSuccess(List<Conversation> conversations) {
if (conversations != null && conversations.size() < 10) {
if (!clearMessages) {
for (Conversation conversation : conversations) {
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId());
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = GsonUtils.fromJson(userInfo.getExtra(), IMLoginModel.class);
if (TextUtils.equals(model.getIsAdmin(), "1")) {
targetId = userInfo.getUserId();
}
}
}
} else {
for (Conversation conversation : conversations) {
IMCenter.getInstance()
.clearMessagesUnreadStatus(
Conversation.ConversationType.PRIVATE,
conversation.getTargetId(), null);
}
}
} else {
Conversation conversation = conversations.get(9);
timeStamp = conversation.getSentTime();
}
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
}
}, timeStamp, 10, Conversation.ConversationType.PRIVATE);
}
public String getTargetId() {
return targetId;
}
} }

View File

@ -17,6 +17,7 @@ import io.rong.imkit.config.RongConfigCenter;
import io.rong.imkit.conversationlist.model.BaseUiConversation; import io.rong.imkit.conversationlist.model.BaseUiConversation;
import io.rong.imkit.conversationlist.provider.BaseConversationProvider; import io.rong.imkit.conversationlist.provider.BaseConversationProvider;
import io.rong.imkit.userinfo.RongUserInfoManager; import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imkit.utils.RongDateUtils;
import io.rong.imkit.widget.adapter.IViewProviderListener; import io.rong.imkit.widget.adapter.IViewProviderListener;
import io.rong.imkit.widget.adapter.ViewHolder; import io.rong.imkit.widget.adapter.ViewHolder;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
@ -24,6 +25,7 @@ import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message; import io.rong.imlib.model.Message;
import io.rong.imlib.model.UserInfo; import io.rong.imlib.model.UserInfo;
import io.rong.message.RecallNotificationMessage; import io.rong.message.RecallNotificationMessage;
import io.rong.message.TextMessage;
/** /**
* pdlive自定义会话模板 * pdlive自定义会话模板
@ -48,6 +50,36 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) { public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) {
//根据业务需要自定义处理 //根据业务需要自定义处理
super.bindViewHolder(holder, uiConversation, position, list, listener); super.bindViewHolder(holder, uiConversation, position, list, listener);
String targetId = uiConversation.mCore.getTargetId();
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
//指导员对话逻辑
if (model != null && TextUtils.equals(model.getIsAdmin(), "1")) {
holder.setBackgroundRes(R.id.administrator_layout, R.mipmap.img_news_instructor_bg);
holder.setBackgroundRes(R.id.rc_conversation_item, R.mipmap.white_bg);
holder.setVisible(R.id.rc_conversation_portrait_layout, false);
holder.setVisible(R.id.administrator_layout, true);
holder.setImageUri(R.id.img_administrator, userInfo.getPortraitUri());
holder.setText(R.id.conversation_title, userInfo.getName());
if (uiConversation.mCore.getLatestMessage() instanceof TextMessage) {
TextMessage message = (TextMessage) uiConversation.mCore.getLatestMessage();
holder.setText(R.id.rc_conversation_content, message.getContent());
}
if (uiConversation.mCore.getUnreadMessageCount() == 0) {
holder.setVisible(R.id.conversation_unread, false);
} else {
holder.setVisible(R.id.conversation_unread, true);
holder.setText(R.id.conversation_unread_count, String.valueOf(uiConversation.mCore.getUnreadMessageCount()));
}
holder.setText(R.id.conversation_date, RongDateUtils.getConversationListFormatDate(uiConversation.mCore.getSentTime(), holder.getContext()));
} else {
//非指导员按照原有视图展示
holder.setVisible(R.id.rc_conversation_portrait_layout, true);
holder.setVisible(R.id.administrator_layout, false);
}
}
ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_conversation_read_receipt); ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_conversation_read_receipt);
ImageView conversationUnread = holder.itemView.findViewById(com.yunbao.live.R.id.rc_conversation_unread_bg); ImageView conversationUnread = holder.itemView.findViewById(com.yunbao.live.R.id.rc_conversation_unread_bg);
ImageView imgNew = holder.itemView.findViewById(com.yunbao.live.R.id.img_new); ImageView imgNew = holder.itemView.findViewById(com.yunbao.live.R.id.img_new);
@ -55,8 +87,7 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
Glide.with(holder.getContext()).asDrawable().load(R.mipmap.rc_unread_count_bg_normal).into(conversationUnread); Glide.with(holder.getContext()).asDrawable().load(R.mipmap.rc_unread_count_bg_normal).into(conversationUnread);
} }
if (imgNew != null) { if (imgNew != null) {
String targetId = uiConversation.mCore.getTargetId();
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) { if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
if (model != null && TextUtils.equals(model.getIsAdmin(), "1")) if (model != null && TextUtils.equals(model.getIsAdmin(), "1"))

View File

@ -0,0 +1,54 @@
package com.yunbao.main.views;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import com.binioter.guideview.Component;
import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.main.R;
/**
* 消息中心引导层
*/
public class MessageGuideView implements Component {
private LinearLayout rootView;
private Activity mContext;
public MessageGuideView(Activity mContext) {
this.mContext = mContext;
}
public View getContainer() {
return rootView;
}
@Override
public View getView(LayoutInflater inflater) {
rootView = (LinearLayout) inflater.inflate(R.layout.view_message_guide, null);
return rootView;
}
@Override
public int getAnchor() {
return Component.ANCHOR_BOTTOM;
}
@Override
public int getFitPosition() {
return Component.FIT_END;
}
@Override
public int getXOffset() {
return 0;
}
@Override
public int getYOffset() {
return 0;
}
}

View File

@ -9,20 +9,120 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="20dp"> android:paddingTop="20dp">
<TextView <FrameLayout
android:id="@+id/top_noback" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:text="@string/message"
android:textColor="#ff161616"
android:textSize="24sp"
android:textStyle="bold" />
<!-- <androidx.recyclerview.widget.RecyclerView--> <TextView
<!-- android:id="@+id/system_message_list"--> android:id="@+id/top_noback"
<!-- android:layout_width="match_parent"--> android:layout_width="wrap_content"
<!-- android:layout_height="198dp" />--> android:layout_height="wrap_content"
android:layout_margin="18dp"
android:text="@string/message"
android:textColor="#ff161616"
android:textSize="24sp"
android:textStyle="bold" />
<ImageView
android:visibility="gone"
android:id="@+id/news_icon_clearance"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="end|bottom"
android:layout_marginEnd="16dp"
android:layout_marginBottom="18dp"
android:src="@mipmap/news_icon_clearance" />
</FrameLayout>
<LinearLayout
android:id="@+id/top_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="130dp"
android:layout_weight="1">
<ImageView
android:id="@+id/img_news_notice"
android:layout_width="120dp"
android:layout_height="130dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/img_news_notice" />
<TextView
android:id="@+id/text_news_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="9dp"
android:background="@drawable/background_system_message"
android:text="7"
android:textColor="@color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="130dp"
android:layout_weight="1">
<ImageView
android:id="@+id/img_news_interaction"
android:layout_width="120dp"
android:layout_height="130dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/img_news_interaction" />
<TextView
android:id="@+id/text_news_interaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="9dp"
android:background="@drawable/background_system_message"
android:text="7"
android:textColor="@color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="130dp"
android:layout_weight="1">
<ImageView
android:id="@+id/img_news_online"
android:layout_width="120dp"
android:layout_height="130dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/img_news_online" />
<TextView
android:id="@+id/text_news_online"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="9dp"
android:background="@drawable/background_system_message"
android:text="7"
android:textColor="@color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -132,10 +232,10 @@
android:id="@+id/v_table_redpoint" android:id="@+id/v_table_redpoint"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:background="@drawable/background_ff5075"
android:gravity="center"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="10dp" android:textSize="10dp"
android:gravity="center"
android:background="@drawable/background_ff5075"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/guide_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/political_instructor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@mipmap/img_bg" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/guide_svga"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB