UPDATE聊天页面改版UI

This commit is contained in:
z583819556 2024-03-08 16:25:49 +08:00
parent e2e7ce8183
commit 5a866e5fc5
36 changed files with 787 additions and 65 deletions

View File

@ -44,6 +44,8 @@ import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.message.content.MessageChatTipsContent;
import com.yunbao.common.provider.MessageChatTipsItemProvider;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.GoogleUtils;
@ -189,11 +191,13 @@ public class AppContext extends CommonAppContext {
ArrayList<Class<? extends MessageContent>> myMessages = new ArrayList<>();
myMessages.add(RecommendLiveRoom.class);
myMessages.add(InstructorSendReward.class);
myMessages.add(MessageChatTipsContent.class);
RongIMClient.registerMessageType(myMessages);
// 注册自定义消息模板
RongConfigCenter.conversationConfig().addMessageProvider(new InstructorSendRewardProvider(getApplicationContext()));
RongConfigCenter.conversationConfig().addMessageProvider(new RecommendLiveRoomProvider(getApplicationContext()));
RongConfigCenter.conversationConfig().addMessageProvider(new MessageChatTipsItemProvider(getApplicationContext()));
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
@Override

View File

@ -488,7 +488,7 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode;
-keep class com.yunbao.live.activity.LiveTRTCAnchorActivity { <init>(); }
-keep class com.yunbao.live.activity.MedalQuestionWebViewActivity { <init>(); }
-keep class com.yunbao.live.activity.PDLIiveChatActivity { <init>(); }
-keep class com.yunbao.live.activity.PDLiveConversationActivity { <init>(); }
-keep class com.yunbao.main.activity.PDLiveConversationActivity { <init>(); }
-keep class com.yunbao.live.activity.RoomManageActivity { <init>(); }
-keep class com.yunbao.live.activity.RoomManageDetailActivity { <init>(); }
-keep class com.yunbao.live.activity.SudGameActivity { <init>(); }

View File

@ -0,0 +1,17 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel;
import io.rong.imkit.conversation.extension.InputMode;
public class PDChatInputModeEvent extends BaseModel {
InputMode inputMode;
public PDChatInputModeEvent(InputMode inputMode) {
this.inputMode = inputMode;
}
public InputMode getInputMode() {
return inputMode;
}
}

View File

@ -0,0 +1,18 @@
package com.yunbao.common.interfaces;
public abstract class OnSendMessageListener<T> {
public static final int STATUS_NOT_PRICE = 0;//金额不够
public static final int STATUS_ERROR = 1;//接口错误
public void onSuccess(String token, T bean) {
}
public void onError(int status, String msg) {
}
public void onError(int status, String msg, T bean){
onError(status, msg);
}
}

View File

@ -0,0 +1,149 @@
package com.yunbao.common.message.content;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.yunbao.common.interfaces.OnSendMessageListener;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import io.rong.common.ParcelUtils;
import io.rong.imkit.IMCenter;
import io.rong.imlib.MessageTag;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.imlib.model.MessageContent;
@MessageTag(value = "MessageChatTipsContent", flag = MessageTag.ISPERSISTED)
public class MessageChatTipsContent extends MessageContent implements Parcelable {
private String content;
public static <T> void sendMessage(Conversation.ConversationType type, String targetId, MessageChatTipsContent tipsContent, OnSendMessageListener<T> listener) {
IMCenter.getInstance().insertOutgoingMessage(type, targetId, Message.SentStatus.SENT, tipsContent, System.currentTimeMillis(), new RongIMClient.ResultCallback<Message>() {
@Override
public void onSuccess(Message message) {
if (listener != null) {
listener.onSuccess(null, null);
}
}
@Override
public void onError(RongIMClient.ErrorCode e) {
if (listener != null) {
listener.onError(e.code, e.msg);
}
}
});
}
private MessageChatTipsContent() {
}
public MessageChatTipsContent(byte[] data) {
if (data == null) {
return;
}
String jsonStr = null;
try {
jsonStr = new String(data, "UTF-8");
} catch (UnsupportedEncodingException e) {
}
if (jsonStr == null) {
return;
}
try {
JSONObject jsonObj = new JSONObject(jsonStr);
// 消息携带用户信息时, 自定义消息需添加下面代码
if (jsonObj.has("user")) {
setUserInfo(parseJsonToUserInfo(jsonObj.getJSONObject("user")));
}
// 用于群组聊天, 消息携带 @ 人信息时, 自定义消息需添加下面代码
if (jsonObj.has("mentionedInfo")) {
setMentionedInfo(parseJsonToMentionInfo(jsonObj.getJSONObject("mentionedInfo")));
}
// 将所有自定义变量从收到的 json 解析并赋值
if (jsonObj.has("content")) {
content = jsonObj.optString("content");
}
} catch (JSONException e) {
}
}
public MessageChatTipsContent setContent(String content) {
this.content = content;
return this;
}
public String getContent() {
return content;
}
protected MessageChatTipsContent(Parcel in) {
setExtra(ParcelUtils.readFromParcel(in));
setContent(ParcelUtils.readFromParcel(in));
}
// 快速构建消息对象方法
public static MessageChatTipsContent obtain(String content) {
MessageChatTipsContent msg = new MessageChatTipsContent();
msg.content = content;
return msg;
}
public static final Creator<MessageChatTipsContent> CREATOR = new Creator<MessageChatTipsContent>() {
@Override
public MessageChatTipsContent createFromParcel(Parcel in) {
return new MessageChatTipsContent(in);
}
@Override
public MessageChatTipsContent[] newArray(int size) {
return new MessageChatTipsContent[size];
}
};
@Override
public byte[] encode() {
JSONObject jsonObj = new JSONObject();
try {
// 消息携带用户信息时, 自定义消息需添加下面代码
if (getJSONUserInfo() != null) {
jsonObj.putOpt("user", getJSONUserInfo());
}
// 用于群组聊天, 消息携带 @ 人信息时, 自定义消息需添加下面代码
if (getJsonMentionInfo() != null) {
jsonObj.putOpt("mentionedInfo", getJsonMentionInfo());
}
// 将所有自定义消息的内容都序列化至 json 对象中
jsonObj.put("content", this.content);
} catch (JSONException e) {
}
try {
return jsonObj.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
}
return null;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
ParcelUtils.writeToParcel(dest, getExtra());
ParcelUtils.writeToParcel(dest, content);
}
}

View File

@ -0,0 +1,54 @@
package com.yunbao.common.provider;
import android.content.Context;
import android.text.Spannable;
import android.view.ViewGroup;
import com.yunbao.common.R;
import com.yunbao.common.message.content.MessageChatTipsContent;
import java.util.List;
import io.rong.imkit.conversation.messgelist.provider.BaseMessageItemProvider;
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.MessageContent;
public class MessageChatTipsItemProvider extends BaseMessageItemProvider<MessageChatTipsContent> {
private Context mContext;
public MessageChatTipsItemProvider(Context mContext) {
this.mContext = mContext;
mConfig.showPortrait = false;
mConfig.showSummaryWithName = false;
mConfig.showContentBubble = false;
mConfig.centerInHorizontal = true;
}
@Override
protected ViewHolder onCreateMessageContentViewHolder(ViewGroup parent, int viewType) {
return ViewHolder.createViewHolder(mContext, parent, R.layout.view_message_chat_tip);
}
@Override
protected void bindMessageContentViewHolder(ViewHolder holder, ViewHolder parentHolder, MessageChatTipsContent messageChatTipsContent, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
holder.setText(R.id.tips, messageChatTipsContent.getContent());
}
@Override
protected boolean onItemClick(ViewHolder holder, MessageChatTipsContent messageChatTipsContent, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
return false;
}
@Override
protected boolean isMessageViewType(MessageContent messageContent) {
return messageContent instanceof MessageChatTipsContent;
}
@Override
public Spannable getSummarySpannable(Context context, MessageChatTipsContent messageChatTipsContent) {
return null;
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="261dp" android:height="50dp">
<shape android:shape="rectangle">
<solid android:color="#99ededed" />
<corners android:topLeftRadius="8dp" android:topRightRadius="8dp" android:bottomLeftRadius="8dp" android:bottomRightRadius="8dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,24 @@
<?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:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_message_chat_tip"
android:maxWidth="261dp"
android:padding="5dp"
android:paddingStart="11dp"
android:paddingEnd="11dp"
tools:text="【安全提示】為保障您的權益,慶提高警惕,不要輕易添加或提供第三方聯繫方式"
android:textColor="#76777B"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

View File

@ -1450,4 +1450,5 @@ Limited ride And limited avatar frame</string>
<string name="community_back">Are you sure to return?</string>
<string name="back_community_sure">Sure</string>
<string name="activity_msg_chat_input_hint">Say something</string>
</resources>

View File

@ -1448,4 +1448,5 @@
<string name="community_back">是否確認返回?</string>
<string name="back_community_sure">確定</string>
<string name="activity_msg_chat_input_hint">說點什麼</string>
</resources>

View File

@ -1447,5 +1447,5 @@
<string name="community_back">是否確認返回?</string>
<string name="back_community_sure">確定</string>
<string name="activity_msg_chat_input_hint">說點什麼</string>
</resources>

View File

@ -1444,5 +1444,5 @@
<string name="community_back">是否確認返回?</string>
<string name="back_community_sure">確定</string>
<string name="activity_msg_chat_input_hint">說點什麼</string>
</resources>

View File

@ -1454,5 +1454,5 @@ Limited ride And limited avatar frame</string>
<string name="community_back">Are you sure to return?</string>
<string name="back_community_sure">Sure</string>
<string name="activity_msg_chat_input_hint">Say something</string>
</resources>

View File

@ -106,7 +106,7 @@
android:required="false" />
<activity
android:name=".activity.PDLiveConversationActivity"
android:name="com.yunbao.main.activity.PDLiveConversationActivity"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />

View File

@ -1,5 +1,6 @@
package com.yunbao.live.dialog;
import android.graphics.Color;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
@ -7,6 +8,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import com.yunbao.common.message.content.MessageChatTipsContent;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.event.InputPanelViewHolderEvent;
@ -17,6 +20,7 @@ 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;
import io.rong.imlib.model.MessageContent;
/**
* 会话页面更改已读未读
@ -30,12 +34,16 @@ public class PDLiveMessageListAdapter extends MessageListAdapter {
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
super.onBindViewHolder(holder, position);
Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection();
MessageContent content = mDataList.get(position).getMessage().getContent();
ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt);
TextView rcEdit = holder.getConvertView().findViewById(R.id.rc_edit);
if (rcEdit!=null){
rcEdit.setVisibility(View.GONE);
}
holder.getConvertView().setBackgroundColor(Color.parseColor("#00000000"));
holder.itemView.setBackgroundColor(Color.parseColor("#00000000"));
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
if (readReceiptNew!=null){
if (messageDirection==Message.MessageDirection.SEND){
readReceiptNew.setVisibility(View.VISIBLE);
@ -50,6 +58,9 @@ public class PDLiveMessageListAdapter extends MessageListAdapter {
if (readReceipt!=null){
readReceipt.setVisibility(View.GONE);
}
if(content instanceof MessageChatTipsContent){
readReceiptNew.setVisibility(View.GONE);
}
}
holder.getConvertView().setOnTouchListener(new View.OnTouchListener() {

View File

@ -1,18 +1,59 @@
package com.yunbao.live.views;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.Observer;
import com.yunbao.common.event.PDChatInputModeEvent;
import com.yunbao.live.dialog.PDLiveMessageListAdapter;
import org.greenrobot.eventbus.EventBus;
import io.rong.imkit.conversation.ConversationFragment;
import io.rong.imkit.conversation.MessageListAdapter;
import io.rong.imkit.conversation.extension.InputMode;
import io.rong.imkit.conversation.extension.RongExtensionViewModel;
/**
* 聊天详情页面
*/
public class PDLiveConversationFragment extends ConversationFragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.setBackgroundColor(Color.parseColor("#00000000"));
mRongExtensionViewModel.getInputModeLiveData().observe(getViewLifecycleOwner(), new Observer<InputMode>() {
@Override
public void onChanged(InputMode inputMode) {
}
});
mRongExtension.getInputPanel().getEditText().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventBus.getDefault().post(new PDChatInputModeEvent(InputMode.TextInput));
}
});
mRongExtension.getInputPanel().getEditText().setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
EventBus.getDefault().post(new PDChatInputModeEvent(InputMode.TextInput));
}
});
}
@Override
protected MessageListAdapter onResolveAdapter() {
return new PDLiveMessageListAdapter(this);
}
public RongExtensionViewModel getRongExtensionViewModel() {
return mRongExtensionViewModel;
}
}

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
<include layout="@layout/view_title" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/gray3" />
<!--套一层Layout不然控件就透明了-->
<LinearLayout
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="wrap_content">
<com.yunbao.live.views.InputPanelViewHolder
android:id="@+id/input_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>

View File

@ -3,8 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:visibility="visible">
<ImageView
android:id="@+id/input_panel_voice_toggle"
@ -20,7 +20,10 @@
<EditText
android:id="@+id/edit_btn"
style="@style/EditTextStyle.Alignment"
android:hint="@string/activity_msg_chat_input_hint"
android:layout_width="0dp"
android:drawableStart="@mipmap/ic_message_chat_input"
android:drawablePadding="5dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="6.5dp"
@ -40,8 +43,8 @@
android:layout_width="0dp"
android:layout_height="@dimen/rc_ext_input_panel_editbox_height"
android:layout_marginStart="8dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="6.5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="6.5dp"
android:background="@drawable/rc_ext_voice_idle_button"
android:gravity="center"
@ -59,12 +62,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6.5dp"
android:layout_marginBottom="6.5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="6.5dp"
android:src="@drawable/rc_ext_input_panel_emoji"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/input_panel_add_or_send" />
app:layout_constraintEnd_toStartOf="@+id/input_panel_add_or_send"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/input_panel_add_or_send"

View File

@ -1,18 +1,25 @@
package com.yunbao.live.activity;
package com.yunbao.main.activity;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
@ -24,16 +31,21 @@ import com.yunbao.common.activity.SelectImageActivity;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.ImageEntity;
import com.yunbao.common.bean.NoviceInstructorModel;
import com.yunbao.common.event.PDChatInputModeEvent;
import com.yunbao.common.interfaces.OnSendMessageListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.live.R;
import com.yunbao.common.message.content.MessageChatTipsContent;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.bean.SearchUserBean;
import com.yunbao.live.dialog.MenuPopuwWindow;
import com.yunbao.live.event.InputPanelViewHolderEvent;
import com.yunbao.live.utils.WindowSoftModeAdjustResizeExecutor;
import com.yunbao.live.views.InputPanelViewHolder;
import com.yunbao.live.views.PDLiveConversationFragment;
import com.yunbao.main.R;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -42,6 +54,7 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import io.rong.imkit.IMCenter;
import io.rong.imkit.conversation.extension.InputMode;
import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
@ -62,6 +75,8 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
private final int SELECT_IMAGE_REQUEST = 0x0001;
private ArrayList<ImageEntity> mSelectImages = new ArrayList<>();
private String targetId = "";
private View card;
private View mContainer;
@Override
@ -82,6 +97,68 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
MessageIMManager.get(this).addConversationClickListener();
}
private void hideUserCard() {
if (card.getTag() != null) return;
card.setTag("fold");
Animation animation;
animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_chat_fold_card_hide);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
card.setVisibility(View.GONE);
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mContainer.getLayoutParams();
params.topToTop = ConstraintLayout.LayoutParams.PARENT_ID;
params.topMargin = DpUtil.dp2px(75);
mContainer.setLayoutParams(params);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
card.startAnimation(animation);
}
private void showUserCard() {
if (card.getTag() == null) return;
card.setTag(null);
Animation animation;
animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_chat_fold_card_show);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
card.setVisibility(View.VISIBLE);
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mContainer.getLayoutParams();
params.topToBottom = R.id.include4;
params.topMargin = DpUtil.dp2px(-30);
params.topToTop = ConstraintLayout.LayoutParams.UNSET;
mContainer.setLayoutParams(params);
}
@Override
public void onAnimationEnd(Animation animation) {
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mContainer.getLayoutParams();
params.topToBottom = R.id.include4;
params.topMargin = DpUtil.dp2px(-30);
params.topToTop = ConstraintLayout.LayoutParams.UNSET;
mContainer.setLayoutParams(params);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
card.startAnimation(animation);
}
/**
* 数据的设置
@ -137,13 +214,27 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
imBack = findViewById(R.id.btn_back);
imgMore.setOnClickListener(this);
imBack.setOnClickListener(this);
card = findViewById(R.id.userCard);
card.setBackgroundColor(Color.parseColor("#00000000"));
mContainer = findViewById(R.id.container);
inputPanel.addMediaMessageCallback(new InputPanelViewHolder.MediaMessageCallback() {
@Override
public void choosePic(int intoIndex) {
jumpPic(intoIndex);
}
});
findViewById(R.id.btn_fold).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (card.getTag() == null) {
hideUserCard();
} else {
showUserCard();
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
@ -165,11 +256,11 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
//intoIndex 1=调用相机,2=照片选取,3=视频选取
public void jumpPic(int intoIndex) {
String permission1=Manifest.permission.READ_EXTERNAL_STORAGE;
String permission2= Manifest.permission.WRITE_EXTERNAL_STORAGE;
String permission1 = Manifest.permission.READ_EXTERNAL_STORAGE;
String permission2 = Manifest.permission.WRITE_EXTERNAL_STORAGE;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
permission1=Manifest.permission.READ_MEDIA_IMAGES;
permission2=Manifest.permission.READ_MEDIA_VIDEO;
permission1 = Manifest.permission.READ_MEDIA_IMAGES;
permission2 = Manifest.permission.READ_MEDIA_VIDEO;
}
//选择图片
@ -256,9 +347,15 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
//消息中心
@Subscribe(threadMode = ThreadMode.MAIN)
public void onInputPanelViewHolderEvent(InputPanelViewHolderEvent event) {
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
// ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
inputPanel.hidePluginList();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onInputPanelViewChangeEvent(PDChatInputModeEvent event) {
if (event.getInputMode() != InputMode.NormalMode) {
hideUserCard();
}
}
}

View File

@ -7,7 +7,6 @@ import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@ -19,7 +18,6 @@ import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.interfaces.OnSelectListener;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.http.CommonHttpUtil;
@ -31,11 +29,10 @@ import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.PDLIiveChatActivity;
import com.yunbao.live.activity.PDLiveConversationActivity;
import com.yunbao.main.activity.PDLiveConversationActivity;
import com.yunbao.live.bean.SearchUserBean;
import com.yunbao.live.dialog.PDLIiveChatConversationFragment;
import com.yunbao.main.activity.PDLiveConversationListActivity;
import com.yunbao.main.dialog.ConversationPopuwWindow;
import com.yunbao.main.dialog.MsgChatClickDialog;
import com.yunbao.main.utils.PDLiveCustomConversationProvider;
import com.yunbao.main.utils.PDLiveMessageProcessor;
@ -61,6 +58,8 @@ import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.UserInfo;
import io.rong.sight.SightExtensionModule;
import com.yunbao.main.R;
import com.yunbao.main.views.MessageChatExtensionConfig;
/**
* 会话列表管理
*/
@ -90,6 +89,8 @@ public class ConversationIMListManager {
//会话列表监听事件
RongIM.setConversationListBehaviorListener(listener);
//注册聊天页面扩展面板
RongExtensionManager.getInstance().setExtensionConfig(new MessageChatExtensionConfig());
}
/**

View File

@ -0,0 +1,28 @@
package com.yunbao.main.views;
import java.util.List;
import java.util.ListIterator;
import io.rong.imkit.conversation.extension.DefaultExtensionConfig;
import io.rong.imkit.conversation.extension.component.plugin.FilePlugin;
import io.rong.imkit.conversation.extension.component.plugin.IPluginModule;
import io.rong.imlib.model.Conversation;
public class MessageChatExtensionConfig extends DefaultExtensionConfig {
@Override
public List<IPluginModule> getPluginModules(Conversation.ConversationType conversationType, String targetId) {
List<IPluginModule> pluginModules = super.getPluginModules(conversationType,targetId);
ListIterator<IPluginModule> iterator = pluginModules.listIterator();
// 删除扩展项
while (iterator.hasNext()) {
IPluginModule integer = iterator.next();
// 以删除 FilePlugin 为例
if (integer instanceof FilePlugin) {
iterator.remove();
}
}
return pluginModules;
}
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fromYDelta="0"
android:toYDelta="-100%"
/>
<alpha
android:duration="300"
android:fromAlpha="1.0"
android:toAlpha="0.0"
/>
</set>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fromYDelta="-100%"
android:toYDelta="0"
/>
<alpha
android:duration="300"
android:fromAlpha="0.0"
android:toAlpha="1.0"
/>
</set>

View File

@ -0,0 +1,61 @@
<?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"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/bg_msg_chat"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
android:id="@+id/include4"
layout="@layout/view_msg_chat_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="-30dp"
android:layout_weight="1"
app:layout_constraintBottom_toTopOf="@+id/linearLayout4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/include4" />
<View
android:id="@+id/view2"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/gray3"
app:layout_constraintBottom_toTopOf="@+id/linearLayout4" />
<!--套一层Layout不然控件就透明了-->
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<com.yunbao.live.views.InputPanelViewHolder
android:id="@+id/input_panel"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -11,7 +11,7 @@
android:id="@+id/rc_refresh"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/rc_extension"
app:layout_constraintBottom_toTopOf="@id/inputPanel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -81,16 +81,24 @@
app:layout_constraintTop_toTopOf="parent"
tools:text="100条@消息" />
<io.rong.imkit.conversation.extension.RongExtension
android:id="@+id/rc_extension"
android:layout_width="0dp"
app:RCStyle="CE"
android:layout_height="wrap_content"
android:visibility="gone"
<LinearLayout
android:id="@+id/inputPanel"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rc_refresh" />
app:layout_constraintTop_toBottomOf="@id/rc_refresh"
android:layout_width="0dp"
android:layout_height="wrap_content">
<io.rong.imkit.conversation.extension.RongExtension
android:id="@+id/rc_extension"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
app:RCStyle="SCE"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/rc_notification_container"

View File

@ -0,0 +1,199 @@
<?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:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:layout_marginTop="20dp"
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:paddingTop="24dp"
android:layout_height="52dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/titleView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textColor="@color/textColor"
android:textSize="18sp"
android:textStyle="bold"
tools:text="123" />
<ImageView
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:onClick="backClick"
android:scaleType="center"
android:src="@mipmap/ic_back" />
<ImageView
android:id="@+id/btn_fold"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="331dp"
android:layout_toEndOf="@+id/titleView"
android:onClick="backClick"
android:scaleType="center"
android:src="@mipmap/ic_fold" />
<ImageView
android:id="@+id/img_more"
android:layout_width="40dp"
android:scaleType="center"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:padding="9dp"
android:src="@mipmap/btn_more_black"
android:visibility="visible" />
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/userCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-30dp"
app:layout_constraintTop_toBottomOf="@+id/relativeLayout">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/bg_msg_chat_title" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout6"
android:layout_width="94dp"
android:layout_height="94dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="40dp"
android:background="@mipmap/bg_msg_chat_title_avater"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.yunbao.common.views.weight.ClipPathCircleImage
android:id="@+id/rc_conversation_portrait"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="centerCrop"
android:src="@mipmap/beauty_jingbai"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginTop="70dp"
android:text="TextView"
android:textColor="#333333"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/user_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="在线"
android:textColor="#AAAAAA"
android:textSize="8sp"
app:layout_constraintBottom_toBottomOf="@+id/userName"
app:layout_constraintStart_toEndOf="@+id/userName"
app:layout_constraintTop_toTopOf="@+id/userName" />
<TextView
android:id="@+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="TextView"
android:textColor="#777777"
android:textSize="11sp"
app:layout_constraintStart_toStartOf="@+id/userName"
app:layout_constraintTop_toBottomOf="@+id/userName" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="4dp"
app:layout_constraintBottom_toBottomOf="@+id/info"
app:layout_constraintStart_toEndOf="@+id/info"
app:layout_constraintTop_toTopOf="@+id/info"
app:srcCompat="@mipmap/bg_msg_chat_title_gift" />
<TextView
android:id="@+id/sign"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="个性签名给性签名个性签名给性签名个性签名给性签名"
android:textColor="#333333"
android:textSize="13sp"
app:layout_constraintEnd_toStartOf="@+id/constraintLayout6"
app:layout_constraintStart_toStartOf="@+id/info"
app:layout_constraintTop_toBottomOf="@+id/info" />
<Button
android:id="@+id/follow"
android:layout_width="69dp"
android:layout_height="38dp"
android:background="@drawable/bg_msg_address_book_user_btn_fan"
android:drawableLeft="@mipmap/bg_msg_chat_title_follow"
android:gravity="center"
android:maxLines="1"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:text="@string/activity_msg_addressbook_tab_follow2"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="13sp"
app:autoSizeMaxTextSize="13sp"
app:autoSizeMinTextSize="3sp"
app:autoSizeStepGranularity="1sp"
app:autoSizeTextType="uniform"
app:layout_constraintEnd_toEndOf="@+id/constraintLayout6"
app:layout_constraintStart_toStartOf="@+id/constraintLayout6"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout6" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/avatar_list"
android:layout_width="0dp"
android:layout_height="75dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/imageView"
app:layout_constraintStart_toStartOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/tag_list"
android:layout_width="0dp"
android:layout_height="25dp"
app:layout_constraintBottom_toTopOf="@+id/avatar_list"
app:layout_constraintEnd_toEndOf="@+id/avatar_list"
app:layout_constraintStart_toStartOf="@+id/avatar_list" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -32,6 +32,7 @@
<string name="activity_msg_addressbook_layout_title">通讯录</string>
<string name="activity_msg_addressbook_search_hint">搜索昵稱</string>
<string name="activity_msg_addressbook_tab_follow">已關注</string>
<string name="activity_msg_addressbook_tab_follow2">關注</string>
<string name="activity_msg_addressbook_tab_fan">粉絲</string>
<string name="activity_msg_addressbook_tab_fan2">回關</string>
<string name="activity_msg_addressbook_tab_mutual">互相關注</string>

View File

@ -32,6 +32,7 @@
<string name="activity_msg_addressbook_layout_title">Address Book</string>
<string name="activity_msg_addressbook_search_hint">Search</string>
<string name="activity_msg_addressbook_tab_follow">Following</string>
<string name="activity_msg_addressbook_tab_follow2">Follow</string>
<string name="activity_msg_addressbook_tab_fan">Fan</string>
<string name="activity_msg_addressbook_tab_fan2">Return</string>
<string name="activity_msg_addressbook_tab_mutual">Mutual</string>