11111
This commit is contained in:
parent
0cd6ab5e9d
commit
cbf43a3aa3
@ -150,8 +150,7 @@ public class AppContext extends CommonAppContext {
|
||||
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener();
|
||||
//初始化融云
|
||||
RongcloudIMManager.initRongIM(this);
|
||||
//添加融云连接状态监听
|
||||
RongcloudIMManager.setIMStatusListener();
|
||||
|
||||
|
||||
|
||||
//监听im消息
|
||||
|
@ -13,6 +13,8 @@ import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -99,11 +101,15 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
* 退出登录
|
||||
*/
|
||||
public void logout() {
|
||||
//添加融云连接状态监听
|
||||
RongcloudIMManager.removeIMStatusListener();
|
||||
//删除用户登录信息
|
||||
deleteByKey(KEY_USER_INFO);
|
||||
//用户对象置空
|
||||
userInfo = null;
|
||||
manager = null;
|
||||
RongcloudIMManager.logoutIM();
|
||||
MessageIMManager.get(context).logout();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -38,6 +39,9 @@ public class InstructorRemarkManager extends BaseCacheManager {
|
||||
instructorRemarkMap = JSON.parseObject(getString(KEY_INSTRUCTOR_REMARK), new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
}
|
||||
if (instructorRemarkMap == null) {
|
||||
instructorRemarkMap = new HashMap<>();
|
||||
}
|
||||
return instructorRemarkMap;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,15 @@ public class MessageIMManager {
|
||||
number = 0;
|
||||
}
|
||||
|
||||
public void logout() {
|
||||
number = 0;
|
||||
imNumber = 0;
|
||||
systemNumber = 0;
|
||||
//发送通知
|
||||
unreadMessagesHandler.post(essagesRunnable);
|
||||
manager = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单利
|
||||
*/
|
||||
@ -85,6 +94,8 @@ public class MessageIMManager {
|
||||
try {
|
||||
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
|
||||
systemNumber = Integer.parseInt(number);
|
||||
}else {
|
||||
systemNumber = 0;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
systemNumber = 0;
|
||||
@ -125,6 +136,8 @@ public class MessageIMManager {
|
||||
try {
|
||||
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
|
||||
systemNumber = Integer.parseInt(number);
|
||||
}else {
|
||||
systemNumber = 0;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
systemNumber = 0;
|
||||
@ -148,7 +161,7 @@ public class MessageIMManager {
|
||||
//整合未读消息数目并且发送出去
|
||||
private final Runnable essagesRunnable = () -> {
|
||||
number = imNumber + systemNumber;
|
||||
EventBus.getDefault().postSticky(new MessageIMEvent().setNumber(number));
|
||||
EventBus.getDefault().post(new MessageIMEvent().setNumber(number));
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -10,13 +10,19 @@ import androidx.annotation.NonNull;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import io.rong.imkit.GlideKitImageEngine;
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.RongIM;
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
import io.rong.imlib.RongCoreClient;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
@ -107,7 +113,8 @@ public class RongcloudIMManager {
|
||||
public void onSuccess(String s) {
|
||||
//连接成功,如果 onDatabaseOpened() 时没有页面跳转,也可在此时进行跳转。
|
||||
Log.e(CLASSNAME, "onSuccess:" + s);
|
||||
|
||||
//添加融云连接状态监听
|
||||
RongcloudIMManager.setIMStatusListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -145,6 +152,10 @@ public class RongcloudIMManager {
|
||||
RongIM.setConnectionStatusListener(connectionStatusListener);
|
||||
}
|
||||
|
||||
public static void removeIMStatusListener() {
|
||||
RongIM.setConnectionStatusListener(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听 IM 连接状态,可根据连接状态进行不同业务处理
|
||||
*/
|
||||
@ -159,6 +170,7 @@ public class RongcloudIMManager {
|
||||
break;
|
||||
//用户账号在其它设备登录,此设备被踢下线
|
||||
case KICKED_OFFLINE_BY_OTHER_CLIENT:
|
||||
// EventBus.getDefault().post(new BaseModel());
|
||||
break;
|
||||
//连接暂时挂起(多是由于网络问题导致),SDK 会在合适时机进行自动重连
|
||||
case SUSPEND:
|
||||
|
@ -1 +1 @@
|
||||
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlinOptions {
allWarningsAsErrors = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
mavenCentral()
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//common
implementation project(path: ':common')
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
//工具
api rootProject.ext.dependencies["blank-utilcode"]
implementation 'com.eightbitlab:blurview:1.6.6'
implementation files('libs/beautysdk-202202241203.aar')
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.getkeepsafe.relinker:relinker:1.4.4"
}
|
||||
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlinOptions {
allWarningsAsErrors = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
mavenCentral()
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//common
implementation project(path: ':common')
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
//工具
api rootProject.ext.dependencies["blank-utilcode"]
implementation 'com.eightbitlab:blurview:1.6.6'
implementation files('libs/beautysdk-202202241203.aar')
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.getkeepsafe.relinker:relinker:1.4.4"
}
|
@ -82,7 +82,7 @@
|
||||
<activity
|
||||
android:name=".activity.PDLiveConversationActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize">
|
||||
android:windowSoftInputMode="adjustResize|stateHidden">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.PDLIiveChatActivity"
|
||||
|
@ -27,6 +27,7 @@ import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.SearchUserBean;
|
||||
import com.yunbao.live.dialog.MenuPopuwWindow;
|
||||
import com.yunbao.live.views.InputPanelViewHolder;
|
||||
import com.yunbao.live.views.PDLiveConversationFragment;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -42,7 +43,7 @@ import io.rong.imlib.model.UserInfo;
|
||||
* 聊天会话界面
|
||||
*/
|
||||
public class PDLiveConversationActivity extends AbsActivity implements View.OnClickListener {
|
||||
private ConversationFragment conversationFragment;
|
||||
private PDLiveConversationFragment conversationFragment;
|
||||
private PDLiveConversationActivity mContext;
|
||||
private InputPanelViewHolder inputPanel;
|
||||
private TextView titleView;
|
||||
@ -83,7 +84,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
if (!TextUtils.isEmpty(userInfo.getExtra())) {
|
||||
SearchUserBean userBean = GsonUtils.fromJson(userInfo.getExtra(), SearchUserBean.class);
|
||||
//新手指导员
|
||||
if (TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) {
|
||||
if (!TextUtils.isEmpty(userBean.getIs_admin()) && TextUtils.equals(userBean.getIs_admin(), "1")) {
|
||||
isAdmin = true;
|
||||
imgMore.setVisibility(View.GONE);
|
||||
} else {//非指导员
|
||||
@ -100,7 +101,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
*/
|
||||
private void initView() {
|
||||
// 添加会话界面
|
||||
conversationFragment = new ConversationFragment();
|
||||
conversationFragment = new PDLiveConversationFragment();
|
||||
FragmentManager manager = getSupportFragmentManager();
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
transaction.replace(R.id.container, conversationFragment);
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import io.rong.imkit.conversation.MessageListAdapter;
|
||||
import io.rong.imkit.model.UiMessage;
|
||||
import io.rong.imkit.widget.adapter.IViewProviderListener;
|
||||
import io.rong.imkit.widget.adapter.ViewHolder;
|
||||
import io.rong.imlib.model.Message;
|
||||
|
||||
/**
|
||||
* 会话页面更改已读未读
|
||||
*/
|
||||
public class PDLiveMessageListAdapter extends MessageListAdapter {
|
||||
public PDLiveMessageListAdapter(IViewProviderListener<UiMessage> listener) {
|
||||
super(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
super.onBindViewHolder(holder, position);
|
||||
Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection();
|
||||
Message.SentStatus sentStatus = mDataList.get(position).getMessage().getSentStatus();
|
||||
ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt);
|
||||
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
||||
if (readReceipt.getVisibility() == View.VISIBLE) {
|
||||
readReceipt.setVisibility(View.GONE);
|
||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read);
|
||||
} else {
|
||||
if (messageDirection.equals(Message.MessageDirection.SEND)&&sentStatus.equals(Message.SentStatus.SENT))
|
||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread);
|
||||
}
|
||||
}
|
||||
}
|
@ -78,10 +78,22 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
inputPanelView.findViewById(R.id.lt_photo_button).setOnClickListener(this);
|
||||
inputPanelView.findViewById(R.id.lt_choospic_button).setOnClickListener(this);
|
||||
inputPanelView.findViewById(R.id.lt_video_button).setOnClickListener(this);
|
||||
|
||||
|
||||
editBtn.setOnFocusChangeListener(focusChangeListener);
|
||||
}
|
||||
|
||||
//输入框焦点监听事件
|
||||
View.OnFocusChangeListener focusChangeListener = new OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
//失去焦点
|
||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(editBtn, InputMethodManager.SHOW_FORCED);
|
||||
imm.hideSoftInputFromWindow(editBtn.getWindowToken(), 0); //强制隐藏键盘
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
@ -188,7 +200,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
|
||||
}
|
||||
|
||||
public void afterTextChanged(Editable s) {
|
||||
editBtn.clearFocus();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import com.yunbao.live.dialog.PDLiveMessageListAdapter;
|
||||
|
||||
import io.rong.imkit.conversation.ConversationFragment;
|
||||
import io.rong.imkit.conversation.MessageListAdapter;
|
||||
|
||||
/**
|
||||
* 聊天详情页面
|
||||
*/
|
||||
public class PDLiveConversationFragment extends ConversationFragment {
|
||||
@Override
|
||||
protected MessageListAdapter onResolveAdapter() {
|
||||
return new PDLiveMessageListAdapter(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -11,18 +11,18 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rc_conversation_portrait_rl"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="@dimen/rc_margin_size_12"
|
||||
android:layout_marginTop="@dimen/rc_margin_size_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_portrait"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="54dp"
|
||||
android:layout_width="@dimen/rc_conversation_portrait_size"
|
||||
android:layout_height="@dimen/rc_conversation_portrait_size"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
|
||||
@ -35,8 +35,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_unread_bg"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
app:srcCompat="@drawable/rc_unread_count_bg_normal" />
|
||||
|
||||
@ -69,23 +69,36 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rc_conversation_title">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_read_receipt_new"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_content"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="你好,朋友!"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="@dimen/rc_font_text_third_size"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rc_conversation_title" />
|
||||
android:textSize="@dimen/rc_font_text_third_size" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_date"
|
159
live/src/main/res/layout/rc_message_item.xml
Normal file
159
live/src/main/res/layout/rc_message_item.xml
Normal file
@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rc_cl_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/rc_margin_size_10"
|
||||
android:paddingBottom="@dimen/rc_margin_size_10">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_time"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="12dp"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="@dimen/rc_font_describe_size"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="7月29日 12:30" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_selected"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/rc_margin_size_8"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/rc_selector_selected"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/ll_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_left_portrait"
|
||||
android:layout_width="@dimen/rc_message_portrait_size"
|
||||
android:layout_height="@dimen/rc_message_portrait_size"
|
||||
android:layout_marginStart="@dimen/rc_margin_size_4"
|
||||
android:src="@color/rc_secondary_color"
|
||||
app:layout_constraintStart_toEndOf="@id/rc_selected"
|
||||
app:layout_constraintTop_toTopOf="@id/ll_content"
|
||||
app:layout_goneMarginStart="@dimen/rc_margin_size_12" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_right_portrait"
|
||||
android:layout_width="@dimen/rc_message_portrait_size"
|
||||
android:layout_height="@dimen/rc_message_portrait_size"
|
||||
android:layout_marginEnd="@dimen/rc_margin_size_12"
|
||||
android:src="@color/rc_secondary_color"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/ll_content"
|
||||
app:layout_goneMarginTop="@dimen/rc_margin_size_20" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/rc_margin_size_8"
|
||||
android:layout_marginEnd="@dimen/rc_margin_size_8"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toStartOf="@id/rc_right_portrait"
|
||||
app:layout_constraintStart_toEndOf="@id/rc_left_portrait"
|
||||
app:layout_constraintTop_toBottomOf="@id/rc_time">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_title"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="@dimen/rc_font_text_third_size" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rc_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/rc_progress"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="11dp"
|
||||
android:indeterminateDrawable="@drawable/rc_progress_sending_style"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_warning"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:src="@drawable/rc_ic_warning"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_read_receipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:src="@drawable/rc_read_receipt"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_read_receipt_new"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginEnd="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_read_receipt_request"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginTop="13dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:drawableStart="@drawable/rc_read_receipt_request_button"
|
||||
android:textColor="@color/rc_read_receipt_status"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_read_receipt_status"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="@string/rc_read_receipt_status"
|
||||
android:textColor="@color/rc_read_receipt_status"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/rc_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/rc_v_edit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
live/src/main/res/mipmap-xxxhdpi/icon_message_read.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/icon_message_read.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
live/src/main/res/mipmap-xxxhdpi/icon_message_unread.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/icon_message_unread.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
@ -41,6 +41,7 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.adapter.ViewPagerAdapter;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.ChatRemarksBean;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.LiveSvgGiftBean;
|
||||
@ -1032,7 +1033,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
}
|
||||
|
||||
//消息中心
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageIMEvent(MessageIMEvent event) {
|
||||
messageNumber = event.getNumber();
|
||||
if (event.getNumber() > 0) {
|
||||
@ -1054,4 +1055,16 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
v_table_redpoint_me.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户被踢下线
|
||||
*
|
||||
* @param model
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void userSignOut(BaseModel model) {
|
||||
// IMLoginManager.get(mContext).logout();
|
||||
// CommonAppConfig.getInstance().clearLoginInfo();
|
||||
// LoginActivity.forward();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -13,6 +14,7 @@ import io.rong.imkit.utils.RouteUtils;
|
||||
import io.rong.imkit.widget.adapter.IViewProviderListener;
|
||||
import io.rong.imkit.widget.adapter.ViewHolder;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
|
||||
/**
|
||||
@ -23,7 +25,6 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
|
||||
public boolean isItemViewType(BaseUiConversation item) {
|
||||
//根据业务需要,判断 item 是该模板需要处理的会话时,返回 true, 否则返回 false
|
||||
//此处以自定义私聊会话模板为例
|
||||
Log.e("PDLiveCustomConversat","-+++++++++++++++++++++++++++++++++");
|
||||
return item.mCore.getConversationType().equals(Conversation.ConversationType.PRIVATE);
|
||||
}
|
||||
|
||||
@ -31,20 +32,23 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
//根据业务需要,自定义处理
|
||||
Log.e("PDLiveCustomConversat","------------------------------------------"+viewType);
|
||||
// View view = LayoutInflater.from(parent.getContext()).inflate(layout.rc_conversationlist_item, parent, false);
|
||||
return super.onCreateViewHolder(parent, viewType);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) {
|
||||
for (BaseUiConversation conversation:list){
|
||||
// UserInfo userInfo = conversation.mCore.getLatestMessage().getUserInfo();
|
||||
//// Log.e("PDLiveCustomConversat","getName****************************"+userInfo.getName());
|
||||
// Log.e("PDLiveCustomConversat","getPortraitUri****************************"+userInfo.getPortraitUri().toString());
|
||||
}
|
||||
|
||||
//根据业务需要,自定义处理
|
||||
Log.e("PDLiveCustomConversat","****************************");
|
||||
super.bindViewHolder(holder, uiConversation, position, list, listener);
|
||||
if ( list.size()>0){
|
||||
Message.ReceivedStatus receivedStatus = list.get(position).mCore.getReceivedStatus();
|
||||
ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_read_receipt_new);
|
||||
if (receivedStatus.isRead()) {
|
||||
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_message_read);
|
||||
}else {
|
||||
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_message_unread);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user