私聊页增加跟随进房入口
This commit is contained in:
@@ -9,10 +9,11 @@ import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
@@ -30,10 +31,12 @@ import com.netease.nimlib.sdk.msg.MsgServiceObserve;
|
||||
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.CustomNotification;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.common.widget.CustomImageSpan;
|
||||
import com.yizhuan.erban.ui.im.audio.ShakeHeartDialogFragment;
|
||||
import com.yizhuan.erban.ui.im.fragment.MessageFragment;
|
||||
import com.yizhuan.erban.ui.widget.higuide.TuTuGuideHelper;
|
||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.tutu.mentoring_relationship.dialog.BuildMentoringRelationshipSuccessDialog;
|
||||
import com.yizhuan.xchat_android_core.audio.event.VoiceShakeHeartEvent;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
@@ -46,11 +49,12 @@ import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
import com.yizhuan.xchat_android_core.praise.PraiseModel;
|
||||
import com.yizhuan.xchat_android_core.praise.event.IsLikedEvent;
|
||||
import com.yizhuan.xchat_android_core.praise.event.PraiseEvent;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserDetailInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.StringExtensionKt;
|
||||
import com.yizhuan.xchat_android_core.utils.SystemUidUtil;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
@@ -71,18 +75,57 @@ import io.reactivex.functions.Consumer;
|
||||
*/
|
||||
public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
|
||||
private static final String TAG = "NimP2PMessageActivity";
|
||||
public static final String IS_BY_MATCH = "isByMatch";
|
||||
|
||||
private static final String TAG = "NimP2PMessageActivity";
|
||||
OnlineStateChangeObserver onlineStateChangeObserver = new OnlineStateChangeObserver() {
|
||||
@Override
|
||||
public void onlineStateChange(Set<String> accounts) {
|
||||
// 更新 toolbar
|
||||
if (accounts.contains(sessionId)) {
|
||||
// 按照交互来展示
|
||||
displayOnlineState();
|
||||
}
|
||||
}
|
||||
};
|
||||
private boolean isResume = false;
|
||||
/**
|
||||
* 命令消息接收观察者
|
||||
*/
|
||||
Observer<CustomNotification> commandObserver = new Observer<CustomNotification>() {
|
||||
@Override
|
||||
public void onEvent(CustomNotification message) {
|
||||
if (!sessionId.equals(message.getSessionId()) || message.getSessionType() != SessionTypeEnum.P2P) {
|
||||
return;
|
||||
}
|
||||
showCommandMessage(message);
|
||||
}
|
||||
};
|
||||
private TextView ivAddBlackList;
|
||||
|
||||
private View tipsLayout;
|
||||
private ImageView closeIcon;
|
||||
private ImageView ivAttention;
|
||||
private ViewStub vsGuideView;
|
||||
private boolean isFromVoiceMatch;
|
||||
ContactChangedObserver friendDataChangedObserver = new ContactChangedObserver() {
|
||||
@Override
|
||||
public void onAddedOrUpdatedFriends(List<String> accounts) {
|
||||
displayAntiFraudTips();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeletedFriends(List<String> accounts) {
|
||||
displayAntiFraudTips();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddUserToBlackList(List<String> account) {
|
||||
displayAntiFraudTips();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoveUserFromBlackList(List<String> account) {
|
||||
displayAntiFraudTips();
|
||||
}
|
||||
};
|
||||
private ImageView ivAttention;
|
||||
private UserInfoObserver uinfoObserver;
|
||||
|
||||
public static void start(Context context, String contactId) {
|
||||
startReal(context, contactId, new Intent());
|
||||
@@ -99,41 +142,12 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void startByMatch(Context context, String contactId) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(IS_BY_MATCH, true);
|
||||
startReal(context, contactId, intent);
|
||||
|
||||
}
|
||||
|
||||
public static void start(Context context, String contactId, String gameId) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("gameId", gameId);
|
||||
startReal(context, contactId, intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 撩一下
|
||||
*/
|
||||
public static void startWithAccost(Context context, String contactId) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extras.EXTRA_ACCOST, true);
|
||||
|
||||
startWithChatterBox(context, contactId, intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 话匣子
|
||||
*/
|
||||
public static void startWithChatterBox(Context context, String contactId, Intent intent) {
|
||||
if (intent == null)
|
||||
intent = new Intent();
|
||||
|
||||
intent.putExtra(Extras.EXTRA_CHATTER_BOX, true);
|
||||
startReal(context, contactId, intent);
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_HOME_PAGE_PRIVATE, "首页-私聊");
|
||||
}
|
||||
|
||||
public static void startReal(Context context, String contactId, Intent intent) {
|
||||
if (intent == null)
|
||||
intent = new Intent();
|
||||
@@ -158,25 +172,8 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
registerOnlineStateChangeListener(true);
|
||||
EventBus.getDefault().register(this);
|
||||
displayAntiFraudTips();
|
||||
|
||||
vsGuideView = findViewById(R.id.vs_guide);
|
||||
if (getIntent() != null) {
|
||||
isFromVoiceMatch = getIntent().getBooleanExtra("isFromVoiceMatch", false);
|
||||
}
|
||||
if (isFromVoiceMatch) {
|
||||
// showGuide();
|
||||
}
|
||||
}
|
||||
|
||||
private void showGuide() {
|
||||
if (TuTuGuideHelper.isNeedHiGuide(TuTuGuideHelper.KEY_GUIDE_VOICE_MATCH_SAY_HI)) {
|
||||
TuTuGuideHelper.setNoNeedHiGuide(TuTuGuideHelper.KEY_GUIDE_VOICE_MATCH_SAY_HI);
|
||||
View guideView = vsGuideView.inflate();
|
||||
guideView.setOnClickListener(view -> guideView.setVisibility(View.GONE));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void displayAntiFraudTips() {
|
||||
tipsLayout = findViewById(R.id.rl_tips);
|
||||
closeIcon = findViewById(R.id.iv_close_tips);
|
||||
@@ -198,7 +195,7 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
}
|
||||
|
||||
private void addBlackList() {
|
||||
if (SystemUidUtil.isSystemUid(sessionId)) return;
|
||||
if (SystemUidUtil.isSystemUid(sessionId)) return;
|
||||
ivAddBlackList = findViewById(R.id.iv_add_black_list);
|
||||
ivAddBlackList.setVisibility(View.VISIBLE);
|
||||
ivAddBlackList.setOnClickListener((view) -> {
|
||||
@@ -209,7 +206,6 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
@@ -281,6 +277,42 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
boolean contains = blackListAccount.contains(sessionId);
|
||||
tvAddBlackTip.setVisibility(contains ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
if (!SystemUidUtil.isSystemUid(sessionId)) {
|
||||
View clUserDetails = findViewById(R.id.cl_user_details);
|
||||
UserModel.get().getUserInfoDetail(Long.parseLong(sessionId))
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new BeanObserver<UserDetailInfo>() {
|
||||
@Override
|
||||
public void onErrorMsg(String error) {
|
||||
clUserDetails.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onSuccess(@NonNull UserDetailInfo info) {
|
||||
UserDetailInfo.DataBean userInfo = info.getData();
|
||||
if (userInfo == null || userInfo.getRoomUid() <= 0) {
|
||||
clUserDetails.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
clUserDetails.setVisibility(View.VISIBLE);
|
||||
ImageView ivAvatar = findViewById(R.id.iv_avatar);
|
||||
TextView tvNick = findViewById(R.id.tv_nick);
|
||||
TextView tvContent = findViewById(R.id.tv_content);
|
||||
tvNick.setText(userInfo.getNick());
|
||||
ImageLoadUtils.loadAvatar(userInfo.getAvatar(), ivAvatar);
|
||||
tvContent.setText(StringExtensionKt.subAndReplaceDot(userInfo.getRoomTitle(), 5) + "热聊中");
|
||||
ivAvatar.setOnClickListener(v -> UserInfoActivity.Companion.start(context, userInfo.getUid()));
|
||||
clUserDetails.setOnClickListener(v -> AVRoomActivity.startForFromType(
|
||||
context,
|
||||
userInfo.getRoomUid(),
|
||||
AVRoomActivity.FROM_TYPE_USER,
|
||||
userInfo.getNick(),
|
||||
String.valueOf(userInfo.getUid())));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void registerObservers(boolean register) {
|
||||
@@ -293,41 +325,6 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
NimUIKit.getContactChangedObservable().registerObserver(friendDataChangedObserver, register);
|
||||
}
|
||||
|
||||
ContactChangedObserver friendDataChangedObserver = new ContactChangedObserver() {
|
||||
@Override
|
||||
public void onAddedOrUpdatedFriends(List<String> accounts) {
|
||||
displayAntiFraudTips();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeletedFriends(List<String> accounts) {
|
||||
displayAntiFraudTips();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddUserToBlackList(List<String> account) {
|
||||
displayAntiFraudTips();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoveUserFromBlackList(List<String> account) {
|
||||
displayAntiFraudTips();
|
||||
}
|
||||
};
|
||||
|
||||
private UserInfoObserver uinfoObserver;
|
||||
|
||||
OnlineStateChangeObserver onlineStateChangeObserver = new OnlineStateChangeObserver() {
|
||||
@Override
|
||||
public void onlineStateChange(Set<String> accounts) {
|
||||
// 更新 toolbar
|
||||
if (accounts.contains(sessionId)) {
|
||||
// 按照交互来展示
|
||||
displayOnlineState();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void registerOnlineStateChangeListener(boolean register) {
|
||||
if (!NimUIKitImpl.enableOnlineState()) {
|
||||
return;
|
||||
@@ -363,19 +360,6 @@ public class NimP2PMessageActivity extends NewBaseMessageActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令消息接收观察者
|
||||
*/
|
||||
Observer<CustomNotification> commandObserver = new Observer<CustomNotification>() {
|
||||
@Override
|
||||
public void onEvent(CustomNotification message) {
|
||||
if (!sessionId.equals(message.getSessionId()) || message.getSessionType() != SessionTypeEnum.P2P) {
|
||||
return;
|
||||
}
|
||||
showCommandMessage(message);
|
||||
}
|
||||
};
|
||||
|
||||
protected void showCommandMessage(CustomNotification message) {
|
||||
if (!isResume) {
|
||||
return;
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_p2p_top_userinfo.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_p2p_top_userinfo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
app/src/main/res/drawable-xhdpi/bg_p2p_top_userinfo_btn.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_p2p_top_userinfo_btn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@@ -3,11 +3,10 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/bg_normal_1c1b22"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_normal_1c1b22">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/message_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@@ -48,8 +47,8 @@
|
||||
android:maxWidth="214dp"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:textAppearance="@style/Toolbar.TitleText"
|
||||
android:textColor="@color/text_title_white"
|
||||
android:visibility="gone"
|
||||
tools:text="孙行者123"
|
||||
tools:visibility="visible" />
|
||||
@@ -82,15 +81,16 @@
|
||||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_gravity="right"
|
||||
android:textSize="@dimen/dp_13"
|
||||
android:text="举报"
|
||||
android:textColor="@color/text_normal_c6c6e9"
|
||||
android:gravity="center"
|
||||
android:src="@drawable/icon_add_black_list"
|
||||
android:text="举报"
|
||||
android:textColor="@color/text_normal_c6c6e9"
|
||||
android:textSize="@dimen/dp_13"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -125,13 +125,75 @@
|
||||
android:src="@mipmap/common_ic_close_red" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_user_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/bg_p2p_top_userinfo"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/tv_content"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_avatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="这就是大哥呀呀" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="14dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_nick"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_nick"
|
||||
tools:text="正在“可惜不是你…”热聊中" />
|
||||
|
||||
<com.yizhuan.xchat_android_library.widget.DrawableCenterTextView
|
||||
android:id="@+id/tv_go_room"
|
||||
android:layout_width="82dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/bg_p2p_top_userinfo_btn"
|
||||
android:drawableStart="@drawable/ic_living_1"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center"
|
||||
android:text="跟随进房"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/message_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/vs_guide"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout="@layout/vs_p2p_message_voice_match_say_hi_guide"
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
@@ -57,10 +57,12 @@ public class UserDetailInfo implements Serializable {
|
||||
|
||||
private int uid;
|
||||
private String nick;
|
||||
private String avatar;
|
||||
private int erbanNo;
|
||||
private int fansNum;
|
||||
private long birth;
|
||||
private long roomUid;
|
||||
private String roomTitle;
|
||||
private UserLevelVoBean userLevelVo;
|
||||
private List<UserGiftWallBean> userGiftWall;
|
||||
private List<WorldDynamicBean> dynamicInfo;
|
||||
@@ -76,6 +78,22 @@ public class UserDetailInfo implements Serializable {
|
||||
this.roomUid = roomUid;
|
||||
}
|
||||
|
||||
public String getRoomTitle() {
|
||||
return roomTitle;
|
||||
}
|
||||
|
||||
public void setRoomTitle(String roomTitle) {
|
||||
this.roomTitle = roomTitle;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getNameplatePic() {
|
||||
return nameplatePic;
|
||||
}
|
||||
|
Reference in New Issue
Block a user