私聊页面添加直播飞机票
This commit is contained in:
parent
ff6fb98a8e
commit
cb50c00a06
@ -29,7 +29,11 @@ import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.manager.imrongcloud.InstructorSendReward;
|
||||
import com.yunbao.common.manager.imrongcloud.InstructorSendRewardProvider;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
||||
import com.yunbao.live.views.RecommendLiveRoomProvider;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
@ -40,12 +44,13 @@ import com.yunbao.main.activity.MsgSettActivity;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.MessageContent;
|
||||
import io.rong.message.TextMessage;
|
||||
import io.rong.push.RongPushClient;
|
||||
import io.rong.push.pushconfig.PushConfig;
|
||||
|
||||
import static com.yunbao.live.socket.SocketClient.mSocketHandler;
|
||||
|
||||
@ -166,6 +171,14 @@ public class AppContext extends CommonAppContext {
|
||||
|
||||
//初始化融云
|
||||
RongcloudIMManager.initRongIM(this);
|
||||
ArrayList<Class<? extends MessageContent>> myMessages = new ArrayList<>();
|
||||
myMessages.add(RecommendLiveRoom.class);
|
||||
myMessages.add(InstructorSendReward.class);
|
||||
|
||||
RongIMClient.registerMessageType(myMessages);
|
||||
// 注册自定义消息模板
|
||||
RongConfigCenter.conversationConfig().addMessageProvider(new InstructorSendRewardProvider());
|
||||
RongConfigCenter.conversationConfig().addMessageProvider(new RecommendLiveRoomProvider(getApplicationContext()));
|
||||
|
||||
RongcloudIMManager.addRongcloudIMOnReceiveMessageListener(new RongIMClient.OnReceiveMessageWrapperListener() {
|
||||
@Override
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RecommendLiveRoomModel extends BaseModel {
|
||||
|
||||
/**
|
||||
* liveuid : 97714
|
||||
* user_nicename : rongyun004
|
||||
* avatar : https://downs.yaoulive.com/20220329113227_c661f791c5fc878c2ef357ee022f9fbc?imageView2/2/w/600/h/600
|
||||
* title :
|
||||
*/
|
||||
|
||||
@SerializedName("liveuid")
|
||||
private String liveuid;
|
||||
@SerializedName("user_nicename")
|
||||
private String userNicename;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("title")
|
||||
private String title;
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public RecommendLiveRoomModel setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserNicename() {
|
||||
return userNicename;
|
||||
}
|
||||
|
||||
public RecommendLiveRoomModel setUserNicename(String userNicename) {
|
||||
this.userNicename = userNicename;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public RecommendLiveRoomModel setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public RecommendLiveRoomModel setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.yunbao.common.manager.imrongcloud;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Parcel;
|
||||
|
||||
import io.rong.imlib.MessageTag;
|
||||
import io.rong.imlib.model.MessageContent;
|
||||
|
||||
@SuppressLint("ParcelCreator")
|
||||
@MessageTag(value = "InstructorSendReward", flag = MessageTag.ISCOUNTED)
|
||||
public class InstructorSendReward extends MessageContent {
|
||||
public InstructorSendReward(byte[] data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encode() {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.yunbao.common.manager.imrongcloud;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Spannable;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
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 InstructorSendRewardProvider extends BaseMessageItemProvider<InstructorSendReward> {
|
||||
/**
|
||||
* 创建 ViewHolder
|
||||
*
|
||||
* @param viewGroup 父 ViewGroup
|
||||
* @param viewType 视图类型
|
||||
* @return ViewHolder
|
||||
*/
|
||||
@Override
|
||||
protected ViewHolder onCreateMessageContentViewHolder(ViewGroup viewGroup, int viewType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置消息视图里各 view 的值
|
||||
*
|
||||
* @param holder ViewHolder
|
||||
* @param parentHolder 父布局的 ViewHolder
|
||||
* @param instructorSendReward 此展示模板对应的消息
|
||||
* @param uiMessage {@link UiMessage}
|
||||
* @param position 消息位置
|
||||
* @param list 列表
|
||||
* @param listener ViewModel 的点击事件监听器。如果某个子 view 的点击事件需要 ViewModel 处理,可通过此监听器回调。
|
||||
*/
|
||||
@Override
|
||||
protected void bindMessageContentViewHolder(ViewHolder holder, ViewHolder parentHolder, InstructorSendReward instructorSendReward, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param holder ViewHolder
|
||||
* @param instructorSendReward 自定义消息
|
||||
* @param uiMessage {@link UiMessage}
|
||||
* @param position 位置
|
||||
* @param list 列表数据
|
||||
* @param listener ViewModel 的点击事件监听器。如果某个子 view 的点击事件需要 ViewModel 处理,可通过此监听器回调。
|
||||
* @return 点击事件是否被消费
|
||||
*/
|
||||
@Override
|
||||
protected boolean onItemClick(ViewHolder holder, InstructorSendReward instructorSendReward, UiMessage uiMessage, int position, List<UiMessage> list, IViewProviderListener<UiMessage> listener) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据消息内容,判断是否为本模板需要展示的消息类型
|
||||
*
|
||||
* @param messageContent 消息内容
|
||||
* @return 本模板是否处理。
|
||||
*/
|
||||
@Override
|
||||
protected boolean isMessageViewType(MessageContent messageContent) {
|
||||
return messageContent instanceof InstructorSendReward;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在会话列表页某条会话最后一条消息为该类型消息时,会话里需要展示的内容。
|
||||
* 比如: 图片消息在会话里需要展示为"图片",那返回对应的字符串资源即可。
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param instructorSendReward 消息内容
|
||||
* @return 会话里需要展示的字符串资源
|
||||
*/
|
||||
@Override
|
||||
public Spannable getSummarySpannable(Context context, InstructorSendReward instructorSendReward) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package com.yunbao.common.manager.imrongcloud;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import io.rong.common.ParcelUtils;
|
||||
import io.rong.imlib.MessageTag;
|
||||
import io.rong.imlib.model.MessageContent;
|
||||
|
||||
@MessageTag(value = "RecommendLiveRoom", flag = MessageTag.ISCOUNTED)
|
||||
public class RecommendLiveRoom extends MessageContent implements Parcelable {
|
||||
// 自定义消息变量,可以有多个
|
||||
private String content;
|
||||
|
||||
public RecommendLiveRoom setContent(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public RecommendLiveRoom(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) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本地消息对象序列化为消息数据。
|
||||
*
|
||||
* @return 消息数据。
|
||||
*/
|
||||
@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(Parcel dest, int flags) {
|
||||
ParcelUtils.writeToParcel(dest, getExtra());
|
||||
ParcelUtils.writeToParcel(dest, content);
|
||||
}
|
||||
public static final Creator<RecommendLiveRoom> CREATOR = new Creator<RecommendLiveRoom>() {
|
||||
@Override
|
||||
public RecommendLiveRoom createFromParcel(Parcel source) {
|
||||
return new RecommendLiveRoom(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecommendLiveRoom[] newArray(int size) {
|
||||
return new RecommendLiveRoom[size];
|
||||
}
|
||||
};
|
||||
public RecommendLiveRoom(Parcel in) {
|
||||
setExtra(ParcelUtils.readFromParcel(in));
|
||||
setContent(ParcelUtils.readFromParcel(in));
|
||||
}
|
||||
}
|
@ -16,6 +16,8 @@ import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.rong.imkit.GlideKitImageEngine;
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.RongIM;
|
||||
@ -23,6 +25,7 @@ import io.rong.imkit.config.RongConfigCenter;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.MessageContent;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.isReady;
|
||||
|
||||
@ -46,8 +49,11 @@ public class RongcloudIMManager {
|
||||
public static void initRongIM(Application application) {
|
||||
//第三个参数代表是否开启推送
|
||||
RongIM.init(application, RONG_IM_KEY, true);
|
||||
|
||||
|
||||
Log.e(CLASSNAME, "initRongIM:");
|
||||
initPhotoGlide();
|
||||
|
||||
}
|
||||
|
||||
private static RongIMClient.OnReceiveMessageWrapperListener mListener;
|
||||
|
52
common/src/main/res/layout/view_recommend_live_room.xml
Normal file
52
common/src/main/res/layout/view_recommend_live_room.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="166.67dp"
|
||||
android:layout_height="166.67dp"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="7.68dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/live_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@mipmap/bg_main_item_bottom" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="21.33dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:src="@mipmap/tab_recommend" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/host_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="12.67dp"
|
||||
android:layout_marginBottom="13.33dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="7.33dp"
|
||||
android:layout_marginBottom="10.67dp"
|
||||
android:src="@mipmap/btn_golive" />
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
BIN
common/src/main/res/mipmap-xxhdpi/btn_golive.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/btn_golive.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/tab_recommend.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/tab_recommend.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -870,4 +870,5 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="shield_gift_effect">Shield gift effect</string>
|
||||
<string name="shield_mount_effect">Shield car effect</string>
|
||||
<string name="current_live_room">You are in the current live room</string>
|
||||
<string name="live_room_air_ticket">has recommended an anchor to you!</string>
|
||||
</resources>
|
||||
|
@ -884,6 +884,7 @@
|
||||
<string name="shield_mount_effect">屏蔽座駕特效</string>
|
||||
<string name="current_live_room">您已在當前直播間</string>
|
||||
<string name="clear_unread_messages">是否清空未讀消息</string>
|
||||
<string name="live_room_air_ticket">向您推薦了一名主播!</string>
|
||||
<string name="popular_tickets">人氣票</string>
|
||||
<string name="system_notice">系統通知</string>
|
||||
<string name="online_service">在線客服</string>
|
||||
|
@ -51,6 +51,7 @@ import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ProcessResultUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.VerticalViewPager;
|
||||
import com.yunbao.live.R;
|
||||
@ -67,6 +68,7 @@ import com.yunbao.live.dialog.SidebarLiveAudience;
|
||||
import com.yunbao.live.event.LinkMicTxAccEvent;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.live.event.RecommendLiveRoomEvent;
|
||||
import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
@ -848,6 +850,8 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canBackPressed() {
|
||||
return super.canBackPressed();
|
||||
|
@ -25,13 +25,22 @@ import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.InstructorRemarkManager;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.SystemChatMessageAdapter;
|
||||
import com.yunbao.live.bean.ImUserBean;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.bean.SearchUserBean;
|
||||
import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.live.event.RecommendLiveRoomEvent;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -56,6 +65,7 @@ public class PDLIiveChatActivity extends FragmentActivity {
|
||||
windowColor();
|
||||
initView();
|
||||
initData();
|
||||
Bus.getOn(this);
|
||||
}
|
||||
|
||||
|
||||
@ -181,4 +191,32 @@ public class PDLIiveChatActivity extends FragmentActivity {
|
||||
}, true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Bus.getOff(this);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRecommendLiveRoomEvent(RecommendLiveRoomEvent event) {
|
||||
LiveHttpUtil.getLiveInfo(event.getLiveuid(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
|
||||
if (liveBean1 == null) {
|
||||
return;
|
||||
}
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
|
||||
finish();
|
||||
});
|
||||
mCheckLivePresenter.checkLive(liveBean);
|
||||
} else {
|
||||
RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.yunbao.live.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -27,6 +28,17 @@ public class ImUserBean extends BaseModel {
|
||||
String is_admin;
|
||||
String isDelet;
|
||||
String _method_ = "";//融雲消息類型
|
||||
@SerializedName("new_image")
|
||||
private String newImage;
|
||||
|
||||
public String getNewImage() {
|
||||
return newImage;
|
||||
}
|
||||
|
||||
public ImUserBean setNewImage(String newImage) {
|
||||
this.newImage = newImage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
|
@ -0,0 +1,222 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
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.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.SearchUserBean;
|
||||
import com.yunbao.live.views.InputPanelViewHolder;
|
||||
import com.yunbao.live.views.PDLiveConversationFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
|
||||
/**
|
||||
* 半屏聊天框
|
||||
*/
|
||||
public class PDLIiveChatConversationFragment extends AbsDialogFragment implements View.OnClickListener {
|
||||
private PDLiveConversationFragment conversationFragment;
|
||||
private InputPanelViewHolder inputPanel;
|
||||
private TextView titleView;
|
||||
private ImageView imgMore, imBack;
|
||||
private String targetId = "";
|
||||
private final int PERMISSION_REQUEST_CODE = 0;
|
||||
private final int SELECT_VIDEO_REQUEST = 0x0002;
|
||||
private final int SELECT_IMAGE_REQUEST = 0x0001;
|
||||
private ArrayList<ImageEntity> mSelectImages = new ArrayList<>();
|
||||
private boolean isAdmin = false;
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_chat_conversation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
private void initView() {
|
||||
// 添加会话界面
|
||||
targetId = getArguments().getString("targetId");
|
||||
conversationFragment = new PDLiveConversationFragment();
|
||||
conversationFragment.initConversation(targetId, Conversation.ConversationType.PRIVATE, null);
|
||||
FragmentManager manager = getChildFragmentManager();
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
transaction.replace(R.id.container, conversationFragment);
|
||||
transaction.commit();
|
||||
inputPanel = (InputPanelViewHolder) findViewById(R.id.input_panel);
|
||||
titleView = (TextView) findViewById(R.id.titleView);
|
||||
imgMore = (ImageView) findViewById(R.id.img_more);
|
||||
imBack = (ImageView) findViewById(R.id.btn_back);
|
||||
|
||||
imgMore.setOnClickListener(this);
|
||||
imBack.setOnClickListener(this);
|
||||
|
||||
inputPanel.addMediaMessageCallback(new InputPanelViewHolder.MediaMessageCallback() {
|
||||
@Override
|
||||
public void choosePic(int intoIndex) {
|
||||
jumpPic(intoIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据的设置
|
||||
*/
|
||||
private void initData() {
|
||||
NoviceInstructorModel model = NoviceInstructorManager.get(getActivity()).getNoviceInstructor();
|
||||
if (model != null && !TextUtils.isEmpty(model.getMsgZdySendText())) {
|
||||
inputPanel.setPresetInformation(model.getMsgZdySendText());
|
||||
}
|
||||
//绑定聊天用户id
|
||||
inputPanel.setTargetId(targetId);
|
||||
//获取用户信息
|
||||
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
|
||||
if (null != userInfo) {
|
||||
titleView.setText(userInfo.getName());
|
||||
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")) {
|
||||
isAdmin = true;
|
||||
imgMore.setVisibility(View.GONE);
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("exlgn3");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
CommonHttpUtil.setAdvertisingChannels("exlgn3", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
FirebaseAnalytics.getInstance(mContext).logEvent("FS_director_read", null);
|
||||
AppEventsLogger.newLogger(mContext).logEvent("FB_director_read");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} else {//非指导员
|
||||
isAdmin = false;
|
||||
imgMore.setVisibility(View.VISIBLE);
|
||||
}
|
||||
inputPanel.setAdmin(isAdmin);
|
||||
Log.e("PDLiveConversation", userInfo.getExtra());
|
||||
}
|
||||
} else {
|
||||
titleView.setText("系統消息");
|
||||
inputPanel.setVisibility(View.GONE);
|
||||
}
|
||||
getDraft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
//菜单
|
||||
if (id == R.id.img_more) {
|
||||
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
|
||||
new MenuPopuwWindow(getActivity()).setIsAdmin(model.getIsAdmin(), targetId).show(imgMore);
|
||||
} else if (id == R.id.btn_back) {//返回
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
//intoIndex 1=调用相机,2=照片选取,3=视频选取
|
||||
public void jumpPic(int intoIndex) {
|
||||
//选择图片
|
||||
int isPermission1 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
int isPermission2 = ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
if (isPermission1 == PackageManager.PERMISSION_GRANTED && isPermission2 == PackageManager.PERMISSION_GRANTED) {
|
||||
startActivity(intoIndex);
|
||||
} else {
|
||||
//申请权限
|
||||
ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
private void startActivity(int intoIndex) {
|
||||
mSelectImages.clear();
|
||||
Intent intent = new Intent(mContext, SelectImageActivity.class);
|
||||
intent.putParcelableArrayListExtra("selected_images", mSelectImages);
|
||||
intent.putExtra("intoIndex", intoIndex);
|
||||
if (intoIndex == 3) {
|
||||
startActivityForResult(intent, SELECT_VIDEO_REQUEST);
|
||||
} else {
|
||||
startActivityForResult(intent, SELECT_IMAGE_REQUEST);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取草稿箱信息系
|
||||
*/
|
||||
private void getDraft() {
|
||||
RongIMClient.getInstance().getTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, new RongIMClient.ResultCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
if (!TextUtils.isEmpty(inputPanel.getPresetInformation()))
|
||||
inputPanel.setPresetInformation(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
private int liveType;
|
||||
private int liveTypeVal;
|
||||
|
||||
|
||||
public int getLiveType() {
|
||||
return liveType;
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.yunbao.live.event;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
/**
|
||||
* 聊天界面跳转直播间
|
||||
*/
|
||||
public class RecommendLiveRoomEvent extends BaseModel {
|
||||
@SerializedName("liveuid")
|
||||
private String liveuid;
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public RecommendLiveRoomEvent setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.RecommendLiveRoomModel;
|
||||
import com.yunbao.common.manager.imrongcloud.RecommendLiveRoom;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.live.event.RecommendLiveRoomEvent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
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 RecommendLiveRoomProvider extends BaseMessageItemProvider<RecommendLiveRoom> {
|
||||
private Context mContext;
|
||||
|
||||
public RecommendLiveRoomProvider(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewHolder onCreateMessageContentViewHolder(ViewGroup viewGroup, int i) {
|
||||
|
||||
return ViewHolder.createViewHolder(mContext, viewGroup, R.layout.view_recommend_live_room);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindMessageContentViewHolder(ViewHolder viewHolder, ViewHolder viewHolder1, RecommendLiveRoom recommendLiveRoom, UiMessage uiMessage, int i, List<UiMessage> list, IViewProviderListener<UiMessage> iViewProviderListener) {
|
||||
if (uiMessage.getMessage().getContent() instanceof RecommendLiveRoom) {
|
||||
|
||||
RecommendLiveRoom liveRoom = (RecommendLiveRoom) uiMessage.getMessage().getContent();
|
||||
RecommendLiveRoomModel model = new Gson().fromJson(liveRoom.getContent(), RecommendLiveRoomModel.class);
|
||||
viewHolder.setImageUri(R.id.live_bg, Uri.parse(model.getAvatar()));
|
||||
viewHolder.setText(R.id.host_name, model.getUserNicename());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onItemClick(ViewHolder viewHolder, RecommendLiveRoom recommendLiveRoom, UiMessage uiMessage, int i, List<UiMessage> list, IViewProviderListener<UiMessage> iViewProviderListener) {
|
||||
if (uiMessage.getMessage().getContent() instanceof RecommendLiveRoom) {
|
||||
RecommendLiveRoom liveRoom = (RecommendLiveRoom) uiMessage.getMessage().getContent();
|
||||
RecommendLiveRoomModel model = new Gson().fromJson(liveRoom.getContent(), RecommendLiveRoomModel.class);
|
||||
Bus.get().post(new RecommendLiveRoomEvent().setLiveuid(model.getLiveuid()));
|
||||
EventBus.getDefault().post(new RecommendLiveRoomEvent().setLiveuid(model.getLiveuid()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isMessageViewType(MessageContent messageContent) {
|
||||
return messageContent instanceof RecommendLiveRoom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spannable getSummarySpannable(Context context, RecommendLiveRoom recommendLiveRoom) {
|
||||
String politicalInstructor = "";
|
||||
if (recommendLiveRoom != null && !TextUtils.isEmpty(recommendLiveRoom.getContent())) {
|
||||
RecommendLiveRoomModel model = new Gson().fromJson(recommendLiveRoom.getContent(), RecommendLiveRoomModel.class);
|
||||
}
|
||||
return new SpannableString(politicalInstructor + mContext.getString(R.string.live_room_air_ticket));
|
||||
}
|
||||
}
|
45
live/src/main/res/layout/fragment_chat_conversation.xml
Normal file
45
live/src/main/res/layout/fragment_chat_conversation.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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_height="match_parent">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/top_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<include layout="@layout/view_title" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/top_card"
|
||||
android:layout_marginTop="-10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="350dp"
|
||||
|
||||
android:background="@color/white"
|
||||
android:paddingTop="10dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/gray3" />
|
||||
|
||||
<com.yunbao.live.views.InputPanelViewHolder
|
||||
android:id="@+id/input_panel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -10,9 +10,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="8dp">
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/img_administrator_layout"
|
||||
@ -65,8 +65,8 @@
|
||||
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:layout_toEndOf="@id/img_administrator_layout"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
@ -78,7 +78,7 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_content"
|
||||
android:id="@+id/conversation_content"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@ -192,7 +192,7 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/conversation_content"
|
||||
android:id="@+id/rc_conversation_content"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@ -237,7 +237,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="@dimen/rc_margin_size_16"
|
||||
android:layout_marginTop="41dp"
|
||||
android:layout_marginEnd="@dimen/rc_margin_size_12"
|
||||
android:text="3 月 22 日"
|
||||
android:textColor="@color/rc_auxiliary_color"
|
||||
@ -249,9 +249,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/rc_margin_size_12"
|
||||
android:layout_marginBottom="@dimen/rc_margin_size_12"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/rc_no_disturb" />
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="6.5dp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="#161616"
|
||||
android:background="@drawable/rc_ext_panel_editbox_background"
|
||||
android:maxLines="4" />
|
||||
|
||||
|
@ -23,24 +23,16 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.android.billingclient.api.BillingResult;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.PurchaseHistoryRecord;
|
||||
import com.android.billingclient.api.PurchaseHistoryResponseListener;
|
||||
import com.android.billingclient.api.SkuDetails;
|
||||
import com.facebook.appevents.AppEventsConstants;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
@ -53,7 +45,6 @@ import com.tencent.imsdk.v2.V2TIMSDKConfig;
|
||||
import com.tencent.imsdk.v2.V2TIMSDKListener;
|
||||
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
@ -140,17 +131,12 @@ import io.reactivex.disposables.Disposable;
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
import io.rong.imkit.notification.NotificationConfig;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import kotlin.Unit;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.isReady;
|
||||
import static com.yunbao.common.CommonAppContext.logger;
|
||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||
import static com.yunbao.live.activity.SystemMessageActivity.type;
|
||||
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.push.PushManager;
|
||||
import io.rong.push.PushType;
|
||||
import kotlin.*;
|
||||
import kotlin.Unit;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.isReady;
|
||||
|
||||
@Route(path = RouteUtil.PATH_MAIN)
|
||||
public class MainActivity extends AbsActivity implements MainAppBarLayoutListener {
|
||||
@ -242,9 +228,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
|
||||
@Override
|
||||
public boolean onRecheck(@NonNull String skuType, @NonNull Purchase purchase, boolean isSelf) {
|
||||
Log.e(TAG,purchase.getSku()+"s"+purchase.getOrderId()+"sds"+purchase.getPurchaseToken());
|
||||
Log.e(TAG, purchase.getSku() + "s" + purchase.getOrderId() + "sds" + purchase.getPurchaseToken());
|
||||
//谷歌掉单处理
|
||||
CommonHttpUtil.Google_sec_pay(purchase.getPurchaseToken(),purchase.getOrderId(),purchase.getSku(),new HttpCallback() {
|
||||
CommonHttpUtil.Google_sec_pay(purchase.getPurchaseToken(), purchase.getOrderId(), purchase.getSku(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
|
||||
@ -341,7 +327,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
RCRTCConfig.Builder config = RCRTCConfig.Builder.create();
|
||||
RCRTCEngine.getInstance().init(MainActivity.this, config.build());
|
||||
//推送跳直播间
|
||||
if(getIntent().getStringExtra("liveid")!=null){
|
||||
if (getIntent().getStringExtra("liveid") != null) {
|
||||
LiveHttpUtil.getLiveInfo(getIntent().getStringExtra("liveid") + "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
@ -365,13 +351,13 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
}
|
||||
}
|
||||
});
|
||||
}else if(getIntent().getStringExtra("type")!=null&&getIntent().getStringExtra("type").equals("2")){
|
||||
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("2")) {
|
||||
//跳转消息列表
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(PDLiveConversationListActivity.MESSAGENUMBER, messageNumber);
|
||||
bundle.putInt(PDLiveConversationListActivity.NUMBERME, numberMe);
|
||||
ConversationIMListManager.get(this).jumpConversationList(bundle);
|
||||
}else if(getIntent().getStringExtra("type")!=null&&getIntent().getStringExtra("type").equals("8")){
|
||||
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("8")) {
|
||||
WebViewActivity.forward(mContext, getIntent().getStringExtra("activityUrl"), true);
|
||||
}
|
||||
FirebaseMessaging.getInstance().getToken()
|
||||
|
@ -44,11 +44,17 @@ 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.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.activity.SystemMessageActivity;
|
||||
import com.yunbao.live.bean.ImUserBean;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.event.RecommendLiveRoomEvent;
|
||||
import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.adapter.SystemMessageAdapter;
|
||||
import com.yunbao.main.dialog.MainStartDialogFragment;
|
||||
@ -193,7 +199,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
||||
container.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showGuideView();
|
||||
// showGuideView();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -261,7 +267,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
||||
textNewsNotice.setVisibility(View.VISIBLE);
|
||||
textNewsNotice.setText(userBean.getNum());
|
||||
}
|
||||
ImgLoader.display(mContext, userBean.getImage(), imgNewsNotice);
|
||||
ImgLoader.display(mContext, userBean.getNewImage(), imgNewsNotice);
|
||||
ViewClicksAntiShake.clicksAntiShake(imgNewsNotice, () -> {
|
||||
type = userBean.getType();
|
||||
netHandler.post(systemNumberRunnable);
|
||||
@ -280,7 +286,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
||||
textNewsInteraction.setVisibility(View.VISIBLE);
|
||||
textNewsInteraction.setText(userBean.getNum());
|
||||
}
|
||||
ImgLoader.display(mContext, userBean.getImage(), imgNewsInteraction);
|
||||
ImgLoader.display(mContext, userBean.getNewImage(), imgNewsInteraction);
|
||||
ViewClicksAntiShake.clicksAntiShake(imgNewsInteraction, () -> {
|
||||
type = userBean.getType();
|
||||
netHandler.post(systemNumberRunnable);
|
||||
@ -299,7 +305,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
||||
textNewsOnline.setVisibility(View.VISIBLE);
|
||||
textNewsOnline.setText(userBean.getNum());
|
||||
}
|
||||
ImgLoader.display(mContext, userBean.getImage(), imgNewsOnline);
|
||||
ImgLoader.display(mContext, userBean.getNewImage(), imgNewsOnline);
|
||||
ViewClicksAntiShake.clicksAntiShake(imgNewsOnline, () -> {
|
||||
type = userBean.getType();
|
||||
netHandler.post(systemNumberRunnable);
|
||||
@ -585,4 +591,24 @@ public class PDLiveConversationListActivity extends AbsActivity implements View.
|
||||
MessageIMManager.get(mContext).setSystemNumber(systemNumber);
|
||||
|
||||
}
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRecommendLiveRoomEvent(RecommendLiveRoomEvent event) {
|
||||
LiveHttpUtil.getLiveInfo(event.getLiveuid(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
|
||||
if (liveBean1 == null) {
|
||||
return;
|
||||
}
|
||||
LiveAudienceActivity.forward(mContext, liveBean1, liveType, liveTypeVal, "", 0, liveSdk);
|
||||
});
|
||||
mCheckLivePresenter.checkLive(liveBean);
|
||||
} else {
|
||||
RouteUtil.forwardUserHome(mContext, event.getLiveuid(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,14 @@ import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.activity.PDLIiveChatActivity;
|
||||
import com.yunbao.live.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.utils.PDLiveCustomConversationProvider;
|
||||
import com.yunbao.main.utils.PDLiveMessageProcessor;
|
||||
import com.yunbao.main.utils.PDSightMessageItemProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
@ -43,6 +45,7 @@ import io.rong.imkit.utils.RouteUtils;
|
||||
import io.rong.imkit.widget.adapter.ProviderManager;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.MessageContent;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
import io.rong.sight.SightExtensionModule;
|
||||
|
||||
@ -71,6 +74,7 @@ public class ConversationIMListManager {
|
||||
RongExtensionManager.getInstance().registerExtensionModule(new SightExtensionModule());
|
||||
//自定义小视频消息模板
|
||||
RongConfigCenter.conversationConfig().replaceMessageProvider(SightMessageItemProvider.class, new PDSightMessageItemProvider());
|
||||
|
||||
//会话列表监听事件
|
||||
RongIM.setConversationListBehaviorListener(listener);
|
||||
}
|
||||
@ -275,7 +279,16 @@ public class ConversationIMListManager {
|
||||
*/
|
||||
@Override
|
||||
public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) {
|
||||
if (context instanceof PDLIiveChatActivity) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("targetId", baseUiConversation.mCore.getTargetId());
|
||||
PDLIiveChatActivity activity = (PDLIiveChatActivity) context;
|
||||
PDLIiveChatConversationFragment fragment = new PDLIiveChatConversationFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(activity.getSupportFragmentManager(), "PDLIiveChatConversationFragment");
|
||||
} else {
|
||||
jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
|
||||
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());
|
||||
holder.setText(R.id.conversation_content, message.getContent());
|
||||
}
|
||||
if (uiConversation.mCore.getUnreadMessageCount() == 0) {
|
||||
holder.setVisible(R.id.conversation_unread, false);
|
||||
|
Loading…
Reference in New Issue
Block a user