Compare commits
10 Commits
47a8e7f473
...
c3ffb658c8
Author | SHA1 | Date | |
---|---|---|---|
|
c3ffb658c8 | ||
|
807827564b | ||
|
59712d0da9 | ||
|
60e82fa8e4 | ||
|
b37d278ae4 | ||
fc7f949f7a | |||
5f107fef25 | |||
|
05f1bc6e20 | ||
|
d167ae82b4 | ||
|
f9b0d33f6e |
@ -220,7 +220,8 @@ public class AppContext extends CommonAppContext {
|
||||
}
|
||||
CrashSaveBean.getInstance().setStartTime(System.currentTimeMillis());
|
||||
//注册全局异常捕获
|
||||
registerE性格rror();
|
||||
|
||||
registerError();
|
||||
registerFirebaseCrash();
|
||||
LogUtils.start(this);
|
||||
sInstance = this;
|
||||
|
@ -39,6 +39,7 @@ import io.rong.imkit.widget.adapter.ViewHolder;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.message.SightMessage;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
@ -55,6 +56,11 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
public void setSrcList(List<BaseUiConversation> srcList) {
|
||||
this.srcList = srcList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setOnRefreshListener(OnRecyclerListRefreshListener<List<BaseUiConversation>> onRefreshListener) {
|
||||
this.onRefreshListener = onRefreshListener;
|
||||
}
|
||||
@ -134,6 +140,13 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
} else if (holder.getView(R.id.rc_conversation_date) != null) {
|
||||
holder.getView(R.id.rc_conversation_date).setVisibility(View.GONE);
|
||||
}
|
||||
if("0".equals(conversation.mCore.getDraft())){
|
||||
holder.setImageDrawable(R.id.rc_conversation_live_online_icon,mContext.getResources().getDrawable(R.mipmap.msg_online));
|
||||
holder.setText(R.id.rc_conversation_live_online,WordUtil.isNewZh()?"在線":"Online");
|
||||
}else{
|
||||
holder.setImageDrawable(R.id.rc_conversation_live_online_icon,mContext.getResources().getDrawable(R.mipmap.msg_off));
|
||||
holder.setText(R.id.rc_conversation_live_online,WordUtil.isNewZh()?"離線":"Offline");
|
||||
}
|
||||
if (holder.getView(R.id.rc_conversation_live_status) == null || IMLoginManager.get(holder.getContext()).getAnchorB() != 1) {
|
||||
return;
|
||||
}
|
||||
@ -322,7 +335,12 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
BaseUiConversation conversation = mDataList.get(id);
|
||||
conversation.mCore.setSentTime(bean.getSentTime());
|
||||
conversation.mCore.setUnreadMessageCount(integer);
|
||||
if(bean.getContent() instanceof SightMessage){
|
||||
conversation.mConversationContent = new SpannableString(WordUtil.isNewZh()?"[小視頻]":"[Video]");
|
||||
}else{
|
||||
conversation.mConversationContent = new SpannableString(((TextMessage) bean.getContent()).getContent());
|
||||
}
|
||||
|
||||
mDataList.set(id, conversation);
|
||||
notifyItemChanged(id);
|
||||
}
|
||||
|
@ -0,0 +1,101 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import static com.yunbao.common.utils.StringUtil.isEmpty;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.MessageChatUserBean;
|
||||
import com.yunbao.common.bean.MsgRecommendBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ClipPathCircleImage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/22.
|
||||
*/
|
||||
|
||||
public class MsgRecommendAdapter extends RecyclerView.Adapter<MsgRecommendAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<MsgRecommendBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public MsgRecommendAdapter.onItemSayHi onItemSayHi;
|
||||
|
||||
public void setOnItemSayHi(onItemSayHi onItemSayHi) {
|
||||
this.onItemSayHi = onItemSayHi;
|
||||
}
|
||||
|
||||
public MsgRecommendAdapter(Context context, List<MsgRecommendBean> list) {
|
||||
mContext = context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mList = list;
|
||||
}
|
||||
|
||||
public void setDataCollection(List<MsgRecommendBean> data) {
|
||||
if (data == null) {
|
||||
data = new ArrayList();
|
||||
}
|
||||
this.mList = data;
|
||||
this.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.msg_main_recommend_item, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh holder, @SuppressLint("RecyclerView") int position) {
|
||||
if (isEmpty() || mList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ImgLoader.display(holder.itemView.getContext(), mList.get(position).getAvatar(), holder.mAvatar);
|
||||
holder.rc_conversation_title.setText(mList.get(position).getUser_nicename());
|
||||
holder.sayHi.setText(mList.get(position).isSayHi()? (WordUtil.isNewZh()?"已打招呼":"Said Hallo"):(WordUtil.isNewZh()?"打招呼":"Greet"));
|
||||
holder.sayHi.setBackground(mList.get(position).isSayHi()? mContext.getDrawable(R.drawable.bg_msg_recommended):mContext.getDrawable(R.drawable.bg_msg_recommend));
|
||||
holder.sayHi.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(onItemSayHi!=null){
|
||||
onItemSayHi.onSayHi(mList.get(position),position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
private ClipPathCircleImage mAvatar;
|
||||
private TextView rc_conversation_title;
|
||||
private TextView sayHi;
|
||||
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = itemView.findViewById(R.id.avatar);
|
||||
rc_conversation_title = itemView.findViewById(R.id.rc_conversation_title);
|
||||
sayHi = itemView.findViewById(R.id.sayHi);
|
||||
}
|
||||
}
|
||||
|
||||
public interface onItemSayHi{
|
||||
void onSayHi(MsgRecommendBean model,int position);
|
||||
}
|
||||
}
|
@ -54,6 +54,16 @@ public class HomeUserInfoBean extends BaseModel {
|
||||
|
||||
private String rong_online;
|
||||
|
||||
private String type;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getRong_online() {
|
||||
return rong_online;
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.yunbao.common.bean;
|
||||
/**
|
||||
* 消息列表用户在线状态
|
||||
*/
|
||||
public class MsgOnlineStatusBean {
|
||||
private String id;
|
||||
private String online;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
public void setOnline(String online) {
|
||||
this.online = online;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
/**
|
||||
* 消息-推荐消息
|
||||
*/
|
||||
public class MsgRecommendBean {
|
||||
private String id;
|
||||
private String avatar;
|
||||
private String user_login;
|
||||
private String user_nicename;
|
||||
private String langue;
|
||||
private String online;
|
||||
private boolean sayHi = false;
|
||||
|
||||
public boolean isSayHi() {
|
||||
return sayHi;
|
||||
}
|
||||
|
||||
public void setSayHi(boolean sayHi) {
|
||||
this.sayHi = sayHi;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getUser_login() {
|
||||
return user_login;
|
||||
}
|
||||
|
||||
public void setUser_login(String user_login) {
|
||||
this.user_login = user_login;
|
||||
}
|
||||
|
||||
public String getUser_nicename() {
|
||||
return user_nicename;
|
||||
}
|
||||
|
||||
public void setUser_nicename(String user_nicename) {
|
||||
this.user_nicename = user_nicename;
|
||||
}
|
||||
|
||||
public String getLangue() {
|
||||
return langue;
|
||||
}
|
||||
|
||||
public void setLangue(String langue) {
|
||||
this.langue = langue;
|
||||
}
|
||||
|
||||
public String getOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
public void setOnline(String online) {
|
||||
this.online = online;
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
public class LiveMsgWindowsCloseEvent {
|
||||
public LiveMsgWindowsCloseEvent() {
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
/**
|
||||
* 未读消息整合
|
||||
*/
|
||||
public class MessageIMLiveEvent extends BaseModel {
|
||||
private int number = 0;
|
||||
private int message = 0;
|
||||
|
||||
public int getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public MessageIMLiveEvent setMessage(int message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessageIMLiveEvent(int number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public MessageIMLiveEvent setNumber(int number) {
|
||||
this.number = number;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -1,33 +1,51 @@
|
||||
package com.yunbao.common.fragment;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.MainMessageChatListTimer;
|
||||
import com.yunbao.common.bean.MessageChatUserBean;
|
||||
import com.yunbao.common.bean.MsgOnlineStatusBean;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnRecyclerListRefreshListener;
|
||||
import com.yunbao.common.adapter.MainConversationListAdapter;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.InstructorRemarkManager;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
||||
import io.rong.imkit.conversationlist.model.SingleConversation;
|
||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
|
||||
public abstract class AbsMainMessageChatListFragment extends Fragment {
|
||||
private static final String TAG = "全部聊天";
|
||||
public RecyclerView recyclerView;
|
||||
public MainConversationListAdapter mAdapter;
|
||||
public SmartRefreshLayout refreshLayout;
|
||||
@ -118,6 +136,52 @@ public abstract class AbsMainMessageChatListFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
public void loadLiveOnlineStatus(List<BaseUiConversation> srcList, OnRecyclerListRefreshListener<List<BaseUiConversation>> onRefreshListener) {
|
||||
List<String> uids = new ArrayList<>();
|
||||
isNet = true;
|
||||
for (BaseUiConversation conversation : srcList) {
|
||||
map.put(conversation.mCore.getTargetId(), conversation);
|
||||
if (conversation.mCore.getConversationType() == Conversation.ConversationType.PRIVATE) {
|
||||
uids.add(conversation.mCore.getTargetId());
|
||||
}
|
||||
}
|
||||
CommonHttpUtil.getUserOnline(String.join(",", uids), new com.yunbao.common.http.HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info != null) {
|
||||
List<MsgOnlineStatusBean> listUserBean = JSON.parseArray(Arrays.toString(info), MsgOnlineStatusBean.class);
|
||||
for (int i = 0; i < srcList.size(); i++) {
|
||||
for (int j = 0; j < listUserBean.size(); j++) {
|
||||
if (!StringUtil.isEmpty(srcList.get(i).mCore.getTargetId()) &&
|
||||
srcList.get(i).mCore.getTargetId().equals(listUserBean.get(j).getId())) {
|
||||
srcList.get(i).mCore.setDraft(listUserBean.get(j).getOnline());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
onRefreshListener.onFinish(srcList);
|
||||
isNet = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static String toStringWithComma(String[] array) {
|
||||
if (array == null || array.length == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
sb.append(array[i]);
|
||||
if (i < array.length - 1) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void sendMessage(io.rong.imlib.model.Message bean) {
|
||||
int id1 = mAdapter.getMessageId(bean.getSenderUserId());
|
||||
|
@ -10,11 +10,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.MainConversationListAdapter;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
@ -119,7 +116,6 @@ public class MainMessageChatFragment extends ConversationListFragment {
|
||||
}
|
||||
list.addAll(data);
|
||||
getChatRecordList(list, search);
|
||||
L.eSw(new Gson().toJson(list));
|
||||
}
|
||||
|
||||
private void getChatRecordList(List<BaseUiConversation> list, String search) {
|
||||
|
@ -1,27 +1,44 @@
|
||||
package com.yunbao.common.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.MessageChatUserBean;
|
||||
import com.yunbao.common.event.MessageIMLiveEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnRecyclerListRefreshListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.InstructorRemarkManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
||||
import io.rong.imkit.conversationlist.model.SingleConversation;
|
||||
import io.rong.imkit.userinfo.RongUserInfoManager;
|
||||
import io.rong.imkit.widget.refresh.api.RefreshLayout;
|
||||
import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener;
|
||||
import io.rong.imkit.widget.refresh.listener.OnRefreshListener;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
|
||||
public class MainMessageChatListFragment extends AbsMainMessageChatListFragment {
|
||||
private static final String TAG = "MainMessageChatListFragment";
|
||||
@ -33,20 +50,20 @@ public class MainMessageChatListFragment extends AbsMainMessageChatListFragment
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
L.eSw("111111");
|
||||
return inflater.inflate(R.layout.fragment_main_message_chat_list, container, false);
|
||||
}
|
||||
|
||||
MainMessageChatFragment conversationListFragment;
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
Log.i(TAG, "onViewCreated: 准备创建融云");
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
conversationListFragment = new MainMessageChatFragment();
|
||||
setAdapter(conversationListFragment.getAdapter());
|
||||
FragmentManager manager = ((FragmentActivity) mContext).getSupportFragmentManager();
|
||||
FragmentManager manager = getChildFragmentManager();
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
transaction.replace(view.findViewById(R.id.container).getId(), conversationListFragment);
|
||||
transaction.replace(R.id.container, conversationListFragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
//自定义空数据背景View
|
||||
//conversationListFragment.setEmptyView(emptyView);
|
||||
@ -60,13 +77,98 @@ public class MainMessageChatListFragment extends AbsMainMessageChatListFragment
|
||||
public void onFinish(Map<String, Integer> stringIntegerMap) {
|
||||
conversationListFragment.getAdapter().setTimerMap(stringIntegerMap);
|
||||
updateList();
|
||||
loadLiveOnlineStatus(baseUiConversations, new OnRecyclerListRefreshListener<List<BaseUiConversation>>() {
|
||||
@Override
|
||||
public void onFinish(List<BaseUiConversation> baseUiConversations) {
|
||||
conversationListFragment.getAdapter().setSrcList(baseUiConversations);
|
||||
}
|
||||
});
|
||||
int count=0;
|
||||
for (int i = 0; i <baseUiConversations.size(); i++) {
|
||||
count = count+ baseUiConversations.get(i).getUnreadMessageCount();
|
||||
}
|
||||
Bus.get().post(new MessageIMLiveEvent(baseUiConversations.size()));
|
||||
|
||||
}
|
||||
});
|
||||
List<String> uids = new ArrayList<>();
|
||||
for (BaseUiConversation conversation : baseUiConversations) {
|
||||
map.put(conversation.mCore.getTargetId(), conversation);
|
||||
if (conversation.mCore.getConversationType() == Conversation.ConversationType.PRIVATE) {
|
||||
uids.add(conversation.mCore.getTargetId());
|
||||
}
|
||||
}
|
||||
getUserInfo(uids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getUserInfo(List<String> uidList) {
|
||||
String uids = String.join(",", uidList);
|
||||
LiveNetManager.get(getContext())
|
||||
.getOtherList(uids, new HttpCallback<List<MessageChatUserBean>>() {
|
||||
@Override
|
||||
public void onSuccess(List<MessageChatUserBean> data) {
|
||||
List<BaseUiConversation> list = new ArrayList<>();
|
||||
for (MessageChatUserBean datum : data) {
|
||||
Conversation conversation = new Conversation();
|
||||
BaseUiConversation baseUiConversation = new SingleConversation(getContext(), conversation);
|
||||
baseUiConversation.mCore.setTargetId(datum.getId());
|
||||
baseUiConversation.mCore.setSenderUserId(IMLoginManager.get(getContext()).getUserInfo().getId() + "");
|
||||
baseUiConversation.mCore.setSentStatus(Message.SentStatus.CANCELED);
|
||||
baseUiConversation.mCore.setSentTime(-1);
|
||||
baseUiConversation.mCore.setConversationType(Conversation.ConversationType.PRIVATE);
|
||||
baseUiConversation.mCore.setPortraitUrl(datum.getAvatar());
|
||||
String remark = InstructorRemarkManager.get(getContext()).getInstructorRemark().get(datum.getId());
|
||||
baseUiConversation.mCore.setConversationTitle(StringUtil.isEmpty(remark) ? datum.getUserNiceName() : remark);
|
||||
|
||||
list.add(baseUiConversation);
|
||||
|
||||
UserInfo userInfo = new UserInfo(baseUiConversation.mCore.getTargetId(),
|
||||
baseUiConversation.mCore.getConversationTitle(),
|
||||
Uri.parse(baseUiConversation.mCore.getPortraitUrl()));
|
||||
RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo);
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
List<BaseUiConversation> srcList = new ArrayList<>(mAdapter.getSrcList());
|
||||
srcList.addAll(list);
|
||||
Log.i(TAG, "onSuccess: 增加用户数:" + list.size() + "||总用户数:" + srcList.size());
|
||||
for (BaseUiConversation conversation : srcList) {
|
||||
Log.i(TAG, "onSuccess: 用户id:" + conversation.mCore.getTargetId() + "||用户名:" + conversation.mCore.getConversationTitle() + "||用户头像:" + conversation.mCore.getPortraitUrl());
|
||||
}
|
||||
int position = 0;
|
||||
try {
|
||||
position = ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
mAdapter.setDataCollection(srcList);
|
||||
//mAdapter.onFinish();
|
||||
recyclerView.scrollToPosition(position);
|
||||
}
|
||||
onRefreshFinished();
|
||||
onLoadMoreFinished();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
onLoadMoreFinished();
|
||||
onRefreshFinished();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
L.eSw("222222");
|
||||
Log.i(TAG, "onViewCreated: 准备创建融云");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onChatList() {
|
||||
if (conversationListFragment == null) {
|
||||
return;
|
||||
|
@ -1,51 +1,131 @@
|
||||
package com.yunbao.common.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.MainConversationListAdapter;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.adapter.MsgRecommendAdapter;
|
||||
import com.yunbao.common.bean.MsgRecommendBean;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.conversationlist.ConversationListAdapter;
|
||||
import io.rong.imkit.conversationlist.ConversationListFragment;
|
||||
import io.rong.imkit.conversationlist.model.BaseUiConversation;
|
||||
import io.rong.imkit.conversationlist.model.SingleConversation;
|
||||
import io.rong.imkit.event.Event;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.SearchConversationResult;
|
||||
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
|
||||
import io.rong.imkit.widget.refresh.api.RefreshLayout;
|
||||
import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener;
|
||||
import io.rong.imkit.widget.refresh.listener.OnRefreshListener;
|
||||
import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader;
|
||||
|
||||
public class MainMessageRecommendFragment extends ConversationListFragment {
|
||||
public class MainMessageRecommendFragment extends AbsMainMessageChatListFragment {
|
||||
SmartRefreshLayout mRefreshLayout;
|
||||
RecyclerView mList;
|
||||
Context mContext;
|
||||
MsgRecommendAdapter adapter;
|
||||
List<MsgRecommendBean> list = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.msg_main_recommend_list_fragment, container, false);
|
||||
}
|
||||
|
||||
public MainMessageRecommendFragment(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
initView(view);
|
||||
initRefreshView();
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initView(View view) {
|
||||
mRefreshLayout = view.findViewById(R.id.rc_refresh);
|
||||
mList = view.findViewById(R.id.rc_conversation_list);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this.getActivity());
|
||||
mList.setLayoutManager(layoutManager);
|
||||
mList.setItemViewCacheSize(0);
|
||||
}
|
||||
|
||||
protected void initRefreshView() {
|
||||
mRefreshLayout.setNestedScrollingEnabled(false);
|
||||
mRefreshLayout.setRefreshHeader(new RongRefreshHeader(getContext()));
|
||||
mRefreshLayout.setRefreshFooter(new RongRefreshHeader(getContext()));
|
||||
mRefreshLayout.setEnableLoadMore(false);
|
||||
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
initData();
|
||||
}
|
||||
});
|
||||
mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
|
||||
}
|
||||
});
|
||||
adapter = new MsgRecommendAdapter(mContext,list);
|
||||
mList.setAdapter(adapter);
|
||||
adapter.setOnItemSayHi(new MsgRecommendAdapter.onItemSayHi() {
|
||||
@Override
|
||||
public void onSayHi(MsgRecommendBean model,int position) {
|
||||
if (model.isSayHi()) {
|
||||
return;
|
||||
}
|
||||
CommonHttpUtil.sayHi(model.getId(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
list.get(position).setSayHi(true);
|
||||
adapter.notifyItemChanged(position);
|
||||
}
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
CommonHttpUtil.getMainMsgRecommend(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info != null) {
|
||||
list = JSON.parseArray(Arrays.toString(info), MsgRecommendBean.class);
|
||||
adapter.setDataCollection(list);
|
||||
mRefreshLayout.finishRefresh(true);
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChatList() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void search(String string) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateList() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -685,6 +685,45 @@ public class CommonHttpUtil {
|
||||
.params("dynamic_id", dynamic_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打招呼推荐列表
|
||||
*/
|
||||
public static void getMainMsgRecommend(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Pdluser.getRecommendUser", "Pdluser.getRecommendUser")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打招呼
|
||||
* @param toUid
|
||||
* @param callback
|
||||
*/
|
||||
public static void sayHi(String toUid,HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Pdluser.liveCall", "Pdluser.liveCall")
|
||||
.params("target_uid",toUid)
|
||||
.params("behavior_type","5")
|
||||
.execute(callback);
|
||||
}
|
||||
public static void sayHi(String toUid,String type,HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Pdluser.liveCall", "Pdluser.liveCall")
|
||||
.params("target_uid",toUid)
|
||||
.params("behavior_type",type)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
*获取聊天列表用户在线状态
|
||||
* @param toUid
|
||||
* @param callback
|
||||
*/
|
||||
public static void getUserOnline(String toUid,HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Pdluser.getUserOnline", "Pdluser.getUserOnline")
|
||||
.params("uids",toUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,49 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.MsgRecommendBean;
|
||||
import com.yunbao.common.bean.playerObject;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ClipPathCircleImage;
|
||||
|
||||
public class MsgCommemdViewHolder extends RecyclerView.ViewHolder {
|
||||
private ClipPathCircleImage mAvatar;
|
||||
private TextView rc_conversation_title;
|
||||
private TextView sayHi;
|
||||
|
||||
public MsgCommemdViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = itemView.findViewById(R.id.avatar);
|
||||
rc_conversation_title = itemView.findViewById(R.id.rc_conversation_title);
|
||||
sayHi = itemView.findViewById(R.id.sayHi);
|
||||
}
|
||||
|
||||
public void setData(MsgRecommendBean model, Context mContext,onItemSayHi onItemSayHi) {
|
||||
ImgLoader.display(itemView.getContext(), model.getAvatar(), mAvatar);
|
||||
rc_conversation_title.setText(model.getUser_nicename());
|
||||
sayHi.setText(model.isSayHi()? (WordUtil.isNewZh()?"已打招呼":"Said Hallo"):(WordUtil.isNewZh()?"打招呼":"Greet"));
|
||||
sayHi.setBackground(model.isSayHi()? mContext.getDrawable(R.drawable.bg_msg_recommended):mContext.getDrawable(R.drawable.bg_msg_recommend));
|
||||
sayHi.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(onItemSayHi!=null){
|
||||
onItemSayHi.onSayHi(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface onItemSayHi{
|
||||
void onSayHi(MsgRecommendBean model);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.AttachPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class MsgRecommendPopupView extends AttachPopupView {
|
||||
|
||||
ItemDelListener itemDelListener;
|
||||
|
||||
public MsgRecommendPopupView(@NonNull Context context, ItemDelListener itemDelListener) {
|
||||
super(context);
|
||||
this.itemDelListener = itemDelListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.view_msg_recommend;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
//特效设置
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.close), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dismiss();
|
||||
itemDelListener.onItemDel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface ItemDelListener {
|
||||
void onItemDel();
|
||||
}
|
||||
}
|
8
common/src/main/res/drawable/backgroud_user_home_msg.xml
Normal file
8
common/src/main/res/drawable/backgroud_user_home_msg.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<stroke
|
||||
android:width="1.2dp"
|
||||
android:color="#EB6FFF" />
|
||||
<corners android:radius="21dp" />
|
||||
</shape>
|
11
common/src/main/res/drawable/bg_msg_recommend.xml
Normal file
11
common/src/main/res/drawable/bg_msg_recommend.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:topLeftRadius="15dp"
|
||||
android:topRightRadius="15dp"
|
||||
android:bottomLeftRadius="15dp"
|
||||
android:bottomRightRadius="15dp" />
|
||||
<gradient
|
||||
android:endColor="#FF83C6"
|
||||
android:startColor="#EB6FFF" />
|
||||
</shape>
|
11
common/src/main/res/drawable/bg_msg_recommended.xml
Normal file
11
common/src/main/res/drawable/bg_msg_recommended.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:topLeftRadius="15dp"
|
||||
android:topRightRadius="15dp"
|
||||
android:bottomLeftRadius="15dp"
|
||||
android:bottomRightRadius="15dp" />
|
||||
<gradient
|
||||
android:endColor="#D8D8D8"
|
||||
android:startColor="#D8D8D8" />
|
||||
</shape>
|
@ -212,13 +212,19 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/followLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dp"
|
||||
android:minWidth="90dp"
|
||||
android:background="@drawable/bg_main_com_type"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp">
|
||||
|
||||
@ -240,6 +246,32 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/msgLayout"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="90dp"
|
||||
android:layout_height="35dp"
|
||||
android:background="@drawable/backgroud_user_home_msg"
|
||||
android:gravity="center"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp">
|
||||
|
||||
<com.flyjingfish.gradienttextviewlib.GradientTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/im_pri_chat"
|
||||
android:textStyle="bold"
|
||||
android:textSize="14dp"
|
||||
app:gradient_angle="45"
|
||||
android:layout_marginLeft="5dp"
|
||||
app:gradient_endColor="#FF83C6"
|
||||
app:gradient_startColor="#EB6FFF" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -529,11 +529,32 @@
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/live_tool_qa"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="23dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/icon_live_qa" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/dialog_live_function_qa"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/live_tool_call_me"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"
|
||||
android:layout_marginStart="23dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
@ -566,26 +587,7 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/live_tool_qa"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/icon_live_qa" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/dialog_live_function_qa"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
|
@ -16,36 +16,12 @@
|
||||
>
|
||||
|
||||
<com.yunbao.common.views.weight.ClipPathCircleImage
|
||||
android:id="@+id/rc_conversation_portrait"
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="54dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/beauty_jingbai" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rc_conversation_unread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_unread_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/rc_unread_count_bg_normal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_unread_count"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="15"
|
||||
android:textColor="@color/rc_white_color"
|
||||
android:textSize="@dimen/rc_font_auxiliary_size" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -57,7 +33,8 @@
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_title"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="120dp"
|
||||
@ -65,25 +42,21 @@
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/rc_text_main_color"
|
||||
android:textSize="@dimen/rc_font_secondary_size"
|
||||
tools:text="张三11111111111111111111111" />
|
||||
tools:text="" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="8sp"
|
||||
android:visibility="visible"
|
||||
tools:text="在线" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_status_icon"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="5dp"
|
||||
android:src="@color/green_81c160"
|
||||
android:layout_marginTop="25dp"
|
||||
android:visibility="visible" />
|
||||
android:id="@+id/sayHi"
|
||||
android:layout_width="51dp"
|
||||
android:layout_height="26dp"
|
||||
android:ellipsize="end"
|
||||
android:background="@drawable/bg_msg_recommend"
|
||||
android:maxWidth="120dp"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="11dp"
|
||||
tools:text="打招呼" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="bottom"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
@ -11,7 +10,7 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rc_conversation_list"
|
||||
|
@ -57,6 +57,7 @@
|
||||
android:id="@+id/rc_conversation_title_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginStart="@dimen/rc_margin_size_12"
|
||||
android:orientation="horizontal"
|
||||
app:autoTextEllipsize="@+id/rc_conversation_title"
|
||||
@ -74,14 +75,40 @@
|
||||
android:maxWidth="120dp"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/rc_text_main_color"
|
||||
android:textSize="@dimen/rc_font_secondary_size"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:textSize="13dp"
|
||||
tools:text="张三11111111111111111111111" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginEnd="@dimen/rc_margin_size_12"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_live_online"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textColor="#AAAAAA"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="8sp"
|
||||
android:text="在线"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="-3dp"
|
||||
android:id="@+id/rc_conversation_live_online_icon"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:textColor="#EC70FD"
|
||||
android:layout_marginTop="3dp"
|
||||
android:textSize="18sp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/msg_online"
|
||||
android:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_live_status"
|
||||
android:layout_width="wrap_content"
|
||||
@ -97,25 +124,9 @@
|
||||
android:textColor="#EC70FD"
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_title"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_title"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="看直播10min"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/rc_margin_size_12"
|
||||
android:layout_marginTop="@dimen/rc_margin_size_16"
|
||||
android:singleLine="true"
|
||||
android:textSize="8sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_title"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_live_status"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="在线" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@ -131,7 +142,7 @@
|
||||
android:maxLines="1"
|
||||
android:text="你好,朋友!11111111111111111111111111111111111111111"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="@dimen/rc_font_text_third_size"
|
||||
android:textSize="13dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
|
||||
|
14
common/src/main/res/layout/view_msg_recommend.xml
Normal file
14
common/src/main/res/layout/view_msg_recommend.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:background="@color/transparent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close"
|
||||
android:src="@mipmap/recommed_msg_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:scaleType="fitStart"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</FrameLayout>
|
BIN
common/src/main/res/mipmap-b+en+us/recommed_msg_bg.png
Normal file
BIN
common/src/main/res/mipmap-b+en+us/recommed_msg_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
BIN
common/src/main/res/mipmap-mdpi/msg_off.png
Normal file
BIN
common/src/main/res/mipmap-mdpi/msg_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 222 B |
BIN
common/src/main/res/mipmap-mdpi/msg_online.png
Normal file
BIN
common/src/main/res/mipmap-mdpi/msg_online.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 B |
BIN
common/src/main/res/mipmap-xxhdpi/recommed_msg_bg.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/recommed_msg_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
@ -4,8 +4,8 @@ ext {
|
||||
buildToolsVersion: "29.0.2",
|
||||
minSdkVersion : 23,
|
||||
targetSdkVersion : 34,
|
||||
versionCode : 536,
|
||||
versionName : "6.7.1",
|
||||
versionCode : 539,
|
||||
versionName : "6.7.2",
|
||||
namespace : "com.pandoralive.shayu"
|
||||
]
|
||||
manifestPlaceholders = [
|
||||
|
@ -21,6 +21,10 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.yunbao.common.event.LiveMsgWindowsCloseEvent;
|
||||
import com.yunbao.common.event.MessageIMEvent;
|
||||
import com.yunbao.common.event.MessageIMLiveEvent;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
@ -232,6 +236,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
}
|
||||
}
|
||||
if(fragment!=null){
|
||||
fragment.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -990,14 +997,29 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
new LiveUserAnchorMailBoxPopDialog(mContext).showDialog();
|
||||
}
|
||||
|
||||
LiveUserAnchorMsgPopDialog fragment;
|
||||
/**
|
||||
* 用户端打开聊天列表页面
|
||||
*/
|
||||
public void openLiveMsgWindow() {
|
||||
LiveUserAnchorMsgPopDialog fragment = new LiveUserAnchorMsgPopDialog();
|
||||
fragment = new LiveUserAnchorMsgPopDialog();
|
||||
fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "LiveUserAnchorMsgPopDialog");
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onMessageIMEvent(LiveMsgWindowsCloseEvent event) {
|
||||
if(fragment!=null){
|
||||
fragment.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onMessageIMEvent(MessageIMLiveEvent event) {
|
||||
if(fragment!=null){
|
||||
fragment.refreshMsgCount(event.getNumber());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发 弹幕 消息
|
||||
*/
|
||||
@ -1737,7 +1759,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
protected void release() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.SEND_DANMU);
|
||||
LoadDian9TuUtil.clearBitmap();
|
||||
if (mKeyBoardHeightUtil != null) {
|
||||
mKeyBoardHeightUtil.release();
|
||||
}
|
||||
@ -1786,6 +1807,11 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
Constants.isSend = "0";
|
||||
}
|
||||
|
||||
private void claerBitmap(){
|
||||
LoadDian9TuUtil.clearBitmap();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示个人资料弹窗
|
||||
*/
|
||||
@ -1843,6 +1869,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
release();
|
||||
claerBitmap();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.yunbao.common.dialog.DebugDialog;
|
||||
import com.yunbao.common.event.MessageIMEvent;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
@ -1860,7 +1861,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void showMsgRed(int num) {
|
||||
if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPoint == null) {
|
||||
/*if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPoint == null) {
|
||||
return;
|
||||
}
|
||||
if (num == -1) {
|
||||
@ -1869,7 +1870,21 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
} else if (num > 0) {
|
||||
manager.mLiveAudienceViewHolder.mRedPoint.setText(num + "");
|
||||
}
|
||||
manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.VISIBLE);*/
|
||||
}
|
||||
|
||||
//消息中心
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onMessageIMEvent(MessageIMEvent event) {
|
||||
if (manager == null || manager.mLiveAudienceViewHolder == null || manager.mLiveAudienceViewHolder.mRedPoint == null) {
|
||||
return;
|
||||
}
|
||||
if(event.getNumber()>0){
|
||||
manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
manager.mLiveAudienceViewHolder.mRedPoint.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setShowCrownRed(boolean isShow) {
|
||||
|
@ -883,6 +883,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
if(mLiveRoomViewHolder!=null){
|
||||
mLiveRoomViewHolder.initPrankProgress(2);
|
||||
mLiveRoomViewHolder.sendMsgPrank();
|
||||
|
||||
//初始化天梯数据
|
||||
mLiveRoomViewHolder.initRankPKInfo(mLiveUid,"");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -877,6 +877,9 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
if(mLiveRoomViewHolder!=null){
|
||||
mLiveRoomViewHolder.initPrankProgress(2);
|
||||
mLiveRoomViewHolder.sendMsgPrank();
|
||||
|
||||
//初始化天梯数据
|
||||
mLiveRoomViewHolder.initRankPKInfo(mLiveUid,"");
|
||||
}
|
||||
mLiveSwLinkMicPkPresenter.setmLiveRoomViewHolder(mLiveRoomViewHolder);
|
||||
}
|
||||
@ -997,6 +1000,7 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
}
|
||||
|
||||
if (mLivePushViewHolder != null) {
|
||||
mLivePushViewHolder.closeLive();
|
||||
mLivePushViewHolder.release();
|
||||
}
|
||||
if (mLiveLinkMicPresenter != null) {
|
||||
|
@ -25,6 +25,7 @@ import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.activity.LiveSwAnchorActivity;
|
||||
@ -129,7 +130,9 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
mAvatar = itemView.findViewById(R.id.item_avatar);
|
||||
mPkStatus = itemView.findViewById(R.id.item_pk);
|
||||
mFollow = itemView.findViewById(R.id.item_follow);
|
||||
mPkStatus.setOnClickListener(v -> {
|
||||
ViewClicksAntiShake.clicksAntiShake(mPkStatus, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
||||
if (bean.isPk()) {
|
||||
ToastUtil.show(mContext.getString(R.string.free_pk_user_pking));
|
||||
@ -229,8 +232,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
mFollow.setOnClickListener(v -> {
|
||||
RandomPkUserBean bean = (RandomPkUserBean) itemView.getTag();
|
||||
|
@ -1,12 +1,14 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -45,6 +47,8 @@ import java.util.List;
|
||||
public class LiveUserAnchorMsgPopDialog extends AbsDialogFragment {
|
||||
private ViewPager2 viewPager;
|
||||
private MagicIndicator mIndicator;
|
||||
private TextView titleCount;
|
||||
|
||||
private List<AbsMainMessageChatListFragment> fragmentList;
|
||||
|
||||
@Override
|
||||
@ -68,7 +72,7 @@ public class LiveUserAnchorMsgPopDialog extends AbsDialogFragment {
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = (int) (ScreenDimenUtil.getInstance().getScreenHeight()*0.6);
|
||||
params.height = (int) (ScreenDimenUtil.getInstance().getScreenHeight() * 0.6);
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
@ -78,10 +82,10 @@ public class LiveUserAnchorMsgPopDialog extends AbsDialogFragment {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mIndicator = (MagicIndicator) findViewById(R.id.indicator);
|
||||
viewPager = (ViewPager2) findViewById(R.id.viewPager);
|
||||
titleCount= (TextView) findViewById(R.id.titleCount);
|
||||
fragmentList = new ArrayList<>();
|
||||
fragmentList.add(new MainMessageChatListFragment(AppManager.getInstance().getLiveActivity()));
|
||||
viewPager.setAdapter(new FragmentStateAdapter((FragmentActivity) AppManager.getInstance().getLiveActivity()) {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return fragmentList.size();
|
||||
@ -98,6 +102,18 @@ public class LiveUserAnchorMsgPopDialog extends AbsDialogFragment {
|
||||
initIndicator();
|
||||
initData();
|
||||
}
|
||||
|
||||
public void refreshMsgCount(int num){
|
||||
if(titleCount!=null){
|
||||
titleCount.setText(getResources().getString(R.string.message_chat_msg_all_an_a)+"("+num+")");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
@ -105,6 +121,7 @@ public class LiveUserAnchorMsgPopDialog extends AbsDialogFragment {
|
||||
IMLoginManager.get(mContext).checkInstructor();
|
||||
MessageIMManager.get(mContext).getSystemMessages();
|
||||
}
|
||||
|
||||
private void initIndicator() {
|
||||
final String[] titles = new String[]{
|
||||
WordUtil.getNewString(R.string.message_chat_msg_all),
|
||||
@ -148,6 +165,8 @@ public class LiveUserAnchorMsgPopDialog extends AbsDialogFragment {
|
||||
return linePagerIndicator;
|
||||
}
|
||||
});
|
||||
LinePagerIndicator linePagerIndicator = new LinePagerIndicator(mContext);
|
||||
linePagerIndicator.setLineHeight(0);
|
||||
mIndicator.setNavigator(commonNavigator);
|
||||
ViewPageIndicatorUtils.bind(mIndicator, viewPager, new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@ -22,6 +23,7 @@ import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.event.MainHomeCommunityToChatEvent;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
@ -48,6 +50,7 @@ import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SVGAViewUtils;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
@ -129,6 +132,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
|
||||
GifImageView btn_live;
|
||||
SVGAImageView gift_svga;
|
||||
|
||||
String userType;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -347,6 +351,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
|
||||
isAnchor = obj.getInteger("is_anchor") == 1;
|
||||
mUserBean = JSON.toJavaObject(obj, UserBean.class);
|
||||
|
||||
userType = obj.getString("type");
|
||||
|
||||
mToName = obj.getString("user_nicename");
|
||||
mAvatarUrl = obj.getString("avatar");
|
||||
mAction = obj.getIntValue("action");
|
||||
@ -663,7 +669,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
@ -738,7 +744,37 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
|
||||
} else if (i == R.id.btn_setting) {
|
||||
if (TextUtils.equals(mLiveUid, "uid")) return;
|
||||
setting();
|
||||
} else if (i == R.id.btn_pri_msg) {
|
||||
//私聊
|
||||
if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C") && userType.equals("C")) {
|
||||
showMsgError();
|
||||
return;
|
||||
}
|
||||
if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("A") && userType.equals("A")) {
|
||||
showMsgError();
|
||||
return;
|
||||
}
|
||||
if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("A") && userType.equals("B")) {
|
||||
showMsgError();
|
||||
return;
|
||||
}
|
||||
if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("B") && userType.equals("A")) {
|
||||
showMsgError();
|
||||
return;
|
||||
}
|
||||
boolean isAnchor = CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C");
|
||||
CommonHttpUtil.sayHi(mToUid, isAnchor ? "6" : "7",new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
|
||||
}
|
||||
});
|
||||
EventBus.getDefault().post(new MainHomeCommunityToChatEvent().setTargetId(mToUid));
|
||||
}
|
||||
}
|
||||
|
||||
public void showMsgError() {
|
||||
ToastUtil.show(WordUtil.isNewZh()?"無法聊天,待開發":"Unable to chat, awaiting development");
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,8 @@ import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.AppManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||
|
||||
public abstract class AbsLinkMicPkPresenter {
|
||||
@ -115,7 +117,22 @@ public abstract class AbsLinkMicPkPresenter {
|
||||
}
|
||||
|
||||
protected void isPKTmp(UserBean u) {
|
||||
LiveHttpUtil.livePkCheckLive(IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo().getId()+"", "", "", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
if (obj.getString("ispk").equals("0")) {
|
||||
isPK(u);
|
||||
} else {
|
||||
ToastUtil.show(AppManager.getInstance().getMainActivity().getString(R.string.pking_over));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void onDRPkApplyTmp(UserBean u) {
|
||||
|
@ -767,7 +767,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
|
||||
@ -801,7 +800,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -829,7 +827,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
||||
@Override
|
||||
public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) {
|
||||
Log.e("tx", "aaa" + errorCode.toString());
|
||||
ToastUtil.show(errorCode.code + ":" + errorCode.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import android.widget.ViewFlipper;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
@ -374,6 +375,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
} else {
|
||||
findViewById(R.id.total_image_red_point).setVisibility(View.GONE);
|
||||
}
|
||||
getMsgCount();
|
||||
}
|
||||
|
||||
private void getMsgCount() {
|
||||
MessageIMManager.get(mContext).resetImUnReadMessageCount(mContext);
|
||||
}
|
||||
|
||||
public void onGuardRed() {
|
||||
@ -768,7 +774,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onMessageIMEvent(MessageIMEvent event) {
|
||||
//判断消息中心红点是否已经展示,如果已经展示并且未读消息大于0则不再执行之后的逻辑
|
||||
int number = event.getMessage();
|
||||
int number = event.getNumber();
|
||||
if (v_msg_redpoint.getVisibility() == View.VISIBLE && number > 0 || SpUtil.getInstance().getBooleanValue("private_chat_message_switch"))
|
||||
return;
|
||||
if (number > 0) {
|
||||
|
@ -184,6 +184,7 @@ public class LivePlaySwViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
|
||||
public void initSwEngine(String liveUid) {
|
||||
dr_pk_view.setVisibility(View.GONE);
|
||||
this.liveUid = liveUid;
|
||||
//初始化声网SDK
|
||||
swAuManager = SWAuManager.get();
|
||||
|
@ -666,6 +666,13 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
}
|
||||
}
|
||||
|
||||
public void closeLive(){
|
||||
if (swManager != null) {
|
||||
swManager.exitChannelAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface onDrPkJoinSuccessListener{
|
||||
void joinSuccess1();
|
||||
void joinSuccess2();
|
||||
|
@ -31,6 +31,7 @@ import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.lzf.easyfloat.permission.PermissionUtils;
|
||||
import com.lzf.easyfloat.utils.LifecycleUtils;
|
||||
import com.yunbao.common.event.LiveMsgWindowsCloseEvent;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
@ -814,6 +815,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time"));
|
||||
isShowPrank = false;
|
||||
}else{
|
||||
//初始化天梯赛数据(不在pk过程中)
|
||||
mLiveRoomViewHolder.initRankPKInfo(mLiveUid,"");
|
||||
}
|
||||
if (data.getEnterRoomInfo().getGuard() != null) {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
@ -1556,6 +1560,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
@Override
|
||||
public void onLiveEnd() {
|
||||
Bus.get().post(new LiveMsgWindowsCloseEvent());
|
||||
MicStatusManager.getInstance().clear();
|
||||
endPlay();
|
||||
if (!CommonAppConfig.LIVE_ROOM_SCROLL) {
|
||||
|
@ -14,38 +14,6 @@
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_pri_msg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:src="@mipmap/icon_user_home_msg" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:text="@string/pri_msg"
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_home_page"
|
||||
android:layout_width="0dp"
|
||||
@ -78,7 +46,32 @@
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_pri_msg"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:text="@string/im_pri_chat"
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_follow"
|
||||
android:layout_width="0dp"
|
||||
|
@ -3,18 +3,30 @@
|
||||
android:layout_width="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_live_user"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<net.lucode.hackware.magicindicator.MagicIndicator
|
||||
android:id="@+id/indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:visibility="visible" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleCount"
|
||||
android:text="全部聊天(0)"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:textColor="#000000"
|
||||
android:textStyle="bold"
|
||||
android:textSize="15dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:layout_marginTop="20dp"
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/green_81c160"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
@ -117,13 +117,15 @@
|
||||
<string name="live_fans_group_send_gift_tips">Fan group level Of Lv%s Can send this gift</string>
|
||||
<string name="live_rad_pack_join_fans_group_tip">Join the fan group can be opened [Join]</string>
|
||||
<string name="live_rad_pack_join_fans_group_click_tip">Join the fan group to open</string>
|
||||
<string name="message_chat_msg_all">全部聊天</string>
|
||||
<string name="message_chat_msg_system">系統匹配</string>
|
||||
<string name="message_chat_msg_user">對方主動</string>
|
||||
<string name="message_chat_msg_all">Chat All</string>
|
||||
<string name="message_chat_msg_all_an_a">Chat All</string>
|
||||
<string name="message_chat_msg_recommend">Suggest chat</string>
|
||||
<string name="message_chat_msg_system">System matching</string>
|
||||
<string name="message_chat_msg_user">User initiated</string>
|
||||
<string name="message_chat_msg_look_live">看直播%dmin</string>
|
||||
<string name="message_chat_msg_read_tip">[Read]</string>
|
||||
<string name="message_chat_msg_unread_tip">[Unread]</string>
|
||||
<string name="message_interactive_chat">發起聊天</string>
|
||||
<string name="message_interactive_chat">Initiate a chat</string>
|
||||
|
||||
<string name="prank_progress">Progress</string>
|
||||
<string name="turntable_prank">To do</string>
|
||||
|
@ -116,6 +116,8 @@
|
||||
<string name="live_rad_pack_join_fans_group_tip">加入粉絲團可開啟【加入】</string>
|
||||
<string name="live_rad_pack_join_fans_group_click_tip">加入粉絲團可開啟</string>
|
||||
<string name="message_chat_msg_all">全部聊天</string>
|
||||
<string name="message_chat_msg_all_an_a">全部聊天</string>
|
||||
<string name="message_chat_msg_recommend">推荐聊天</string>
|
||||
<string name="message_chat_msg_system">系統匹配</string>
|
||||
<string name="message_chat_msg_user">對方主動</string>
|
||||
<string name="message_chat_msg_look_live">看直播%dmin</string>
|
||||
|
@ -160,6 +160,7 @@ import io.reactivex.disposables.Disposable;
|
||||
import io.rong.imkit.RongIM;
|
||||
import io.rong.imkit.config.RongConfigCenter;
|
||||
import io.rong.imkit.notification.NotificationConfig;
|
||||
import io.rong.imkit.utils.RouteUtils;
|
||||
import io.rong.imlib.RongCoreClient;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
@ -1542,7 +1543,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMainHomeCommunityToChatEvent(MainHomeCommunityToChatEvent model) {
|
||||
ConversationIMListManager.get(mContext).jumpConversation(mContext, model.getTargetId());
|
||||
// ConversationIMListManager.get(mContext).jumpConversation(mContext, model.getTargetId());
|
||||
RouteUtils.routeToConversationActivity(mContext, Conversation.ConversationType.PRIVATE,model.getTargetId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -535,7 +535,8 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
IMCenter.getInstance().saveTextMessageDraft(Conversation.ConversationType.PRIVATE, targetId, content, null);
|
||||
}
|
||||
|
||||
//关闭对话框后,刷新未读数量
|
||||
MessageIMManager.get(mContext).resetImUnReadMessageCount(mContext);
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@ -560,4 +561,5 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
|
||||
hideUserCard();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -471,8 +471,9 @@ public class RegisterActivity extends AbsActivity {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
if (bean != null) {
|
||||
netHandler.post(getRandJoinAnchor);
|
||||
// EventBus.getDefault().post(new RegSuccessEvent());
|
||||
//netHandler.post(getRandJoinAnchor);
|
||||
jumpMain(false, null);
|
||||
EventBus.getDefault().post(new RegSuccessEvent());
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -488,6 +489,7 @@ public class RegisterActivity extends AbsActivity {
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor").params("uid", userInfo.getId()).params("token", userInfo.getToken()).execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(info!=null){
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(activity).setisNewUserOne(true);
|
||||
@ -504,6 +506,10 @@ public class RegisterActivity extends AbsActivity {
|
||||
} else {
|
||||
jumpMain(false, null);
|
||||
}
|
||||
}else{
|
||||
jumpMain(false, null);
|
||||
}
|
||||
|
||||
EventBus.getDefault().post(new RegSuccessEvent());
|
||||
}
|
||||
});
|
||||
|
@ -52,6 +52,7 @@ import com.yunbao.common.bean.NewLevelModel;
|
||||
import com.yunbao.common.bean.UserHomeImgBean;
|
||||
import com.yunbao.common.dialog.ImagePreviewDialog;
|
||||
import com.yunbao.common.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.common.event.MainHomeCommunityToChatEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
@ -167,6 +168,7 @@ public class UserHomeActivity extends AbsActivity {
|
||||
private TextView authorNum;
|
||||
private TextView levelNum;
|
||||
private View top_bg;
|
||||
private LinearLayout msgLayout;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -586,6 +588,38 @@ public class UserHomeActivity extends AbsActivity {
|
||||
communityRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
communityRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
|
||||
msgLayout = findViewById(R.id.msgLayout);
|
||||
msgLayout.setVisibility(uid.equals(CommonAppConfig.getInstance().getUid()) ? View.GONE : View.VISIBLE);
|
||||
msgLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//私聊
|
||||
if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C") && userInfo.getUserHomeTopInfo().getType().equals("C")) {
|
||||
showMsgError();
|
||||
return;
|
||||
}
|
||||
if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("A") && userInfo.getUserHomeTopInfo().getType().equals("A")) {
|
||||
showMsgError();
|
||||
return;
|
||||
}
|
||||
if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("A") && userInfo.getUserHomeTopInfo().getType().equals("B")) {
|
||||
showMsgError();
|
||||
return;
|
||||
}
|
||||
if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("B") && userInfo.getUserHomeTopInfo().getType().equals("A")) {
|
||||
showMsgError();
|
||||
return;
|
||||
}
|
||||
boolean isAnchor = CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C");
|
||||
CommonHttpUtil.sayHi(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()), isAnchor ? "6" : "7", new com.yunbao.common.http.HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
|
||||
}
|
||||
});
|
||||
EventBus.getDefault().post(new MainHomeCommunityToChatEvent().setTargetId(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id())));
|
||||
}
|
||||
});
|
||||
findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -628,7 +662,7 @@ public class UserHomeActivity extends AbsActivity {
|
||||
liveBean.setParams(gotoRoomKey);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
|
||||
if (StringUtil.isEmpty(liveUid)) {
|
||||
return;
|
||||
}
|
||||
@ -636,7 +670,7 @@ public class UserHomeActivity extends AbsActivity {
|
||||
if (AppManager.getInstance().getLiveActivity() != null) {
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
|
||||
} else {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk), isSw);
|
||||
}
|
||||
}
|
||||
|
||||
@ -815,6 +849,11 @@ public class UserHomeActivity extends AbsActivity {
|
||||
});
|
||||
}
|
||||
|
||||
public void showMsgError() {
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "無法聊天,待開發" : "Unable to chat, awaiting development");
|
||||
}
|
||||
|
||||
|
||||
private void selectImg() {
|
||||
String permission1 = Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||
String permission2 = Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
|
@ -289,7 +289,7 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
|
||||
@Override
|
||||
public void run() {
|
||||
Intent intent = new Intent(mContext, CommunitySendActivity.class);
|
||||
startActivity(intent);
|
||||
mContext.startActivity(intent);
|
||||
/*String mBeautySdkType = CommonAppConfig.getInstance().getBeautySdkType();
|
||||
if ("2".equals(mBeautySdkType)) {
|
||||
Constants.myIntoIndex = 2;
|
||||
|
@ -21,17 +21,20 @@ import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
import com.yunbao.common.event.LiveMsgWindowsCloseEvent;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.InstructorRemarkManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
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.bean.SearchUserBean;
|
||||
import com.yunbao.live.dialog.PDLIiveChatConversationFragment;
|
||||
import com.yunbao.live.event.LiveOpenSuccessEvent;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.activity.PDLiveConversationActivity;
|
||||
import com.yunbao.main.activity.PDLiveConversationListActivity;
|
||||
@ -231,6 +234,7 @@ public class ConversationIMListManager {
|
||||
context.runOnUiThread(() -> {
|
||||
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
|
||||
RouteUtils.routeToConversationActivity(context, type, userId, null);
|
||||
Bus.get().post(new LiveMsgWindowsCloseEvent());
|
||||
});
|
||||
}
|
||||
conversationIMListHandler.post(getUserBaseinfoRunnable);
|
||||
|
@ -1,13 +1,23 @@
|
||||
package com.yunbao.main.views;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.text.Layout;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.KeyEvent;
|
||||
@ -16,9 +26,13 @@ import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
@ -29,10 +43,14 @@ import com.binioter.guideview.Guide;
|
||||
import com.binioter.guideview.GuideBuilder;
|
||||
import com.facebook.appevents.AppEventsLogger;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.enums.PopupPosition;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.fragment.MainMessageRecommendFragment;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.MobclickAgent;
|
||||
import com.yunbao.common.bean.ImUserInfoModel;
|
||||
@ -48,11 +66,14 @@ import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SVGAViewUtils;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.ViewPageIndicatorUtils;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.AbsMainViewHolder;
|
||||
import com.yunbao.common.views.MsgRecommendPopupView;
|
||||
import com.yunbao.common.views.MsgSysDelPopupView;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.live.activity.SystemMessageActivity;
|
||||
import com.yunbao.live.bean.ImUserBean;
|
||||
@ -110,6 +131,18 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
private MagicIndicator mIndicator;
|
||||
private List<AbsMainMessageChatListFragment> fragmentList;
|
||||
|
||||
private ConstraintLayout tabLayout1, tabLayout2, tabLayout3;
|
||||
private TextView tab1, tab2, tab3;
|
||||
private View tab_line1, tab_line2, tab_line3;
|
||||
private ImageView tab_icon;
|
||||
|
||||
private List<ConstraintLayout> relativeLayouts = new ArrayList<>();
|
||||
private List<TextView> tabTexts = new ArrayList<>();
|
||||
private List<View> tabLine = new ArrayList<>();
|
||||
private LinearLayout tabLayouts;
|
||||
|
||||
private int userType = 0; // (0)普通用户 (1)主播A (2)主播B
|
||||
|
||||
public MainMessageViewHolder setHomeZdyPop(String homeZdyPop) {
|
||||
this.homeZdyPop = homeZdyPop;
|
||||
if (TextUtils.equals(homeZdyPop, "1")) {
|
||||
@ -156,6 +189,21 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
contacts = findViewById(R.id.news_icon_contacts);
|
||||
more = findViewById(R.id.news_icon_more);
|
||||
search = findViewById(R.id.search);
|
||||
tabLayouts = findViewById(R.id.tabLayouts);
|
||||
|
||||
tab_icon = findViewById(R.id.tab_icon);
|
||||
tabLayout1 = findViewById(R.id.tabLayout1);
|
||||
tabLayout2 = findViewById(R.id.tabLayout2);
|
||||
tabLayout3 = findViewById(R.id.tabLayout3);
|
||||
|
||||
tab1 = findViewById(R.id.tab1);
|
||||
tab2 = findViewById(R.id.tab2);
|
||||
tab3 = findViewById(R.id.tab3);
|
||||
|
||||
tab_line1 = findViewById(R.id.tab_line1);
|
||||
tab_line2 = findViewById(R.id.tab_line2);
|
||||
tab_line3 = findViewById(R.id.tab_line3);
|
||||
|
||||
contacts.setOnClickListener(view -> {
|
||||
//通讯录
|
||||
RouteUtil.forwardActivity(RouteUtil.PATH_ADDRESSBOOK);
|
||||
@ -168,6 +216,133 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
return i == KeyEvent.KEYCODE_ENTER || i == KeyEvent.KEYCODE_NUMPAD_ENTER;
|
||||
}
|
||||
});
|
||||
netHandler = new Handler();
|
||||
moreXPopup = new XPopup.Builder(mContext).atView(more);
|
||||
more.setOnClickListener(view -> {
|
||||
moreXPopup.asCustom(new MsgMoreDialog(mContext)).show();
|
||||
});
|
||||
}
|
||||
|
||||
private void initFragment() {
|
||||
final String[] titles;
|
||||
fragmentList = new ArrayList<>();
|
||||
ViewGroup.LayoutParams params = mIndicator.getLayoutParams();
|
||||
if (userType == 0) { //普通用户
|
||||
params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
mIndicator.setLayoutParams(params);
|
||||
titles = new String[]{WordUtil.getNewString(R.string.message_chat_msg_all_an_a)};
|
||||
fragmentList.add(new MainMessageChatListFragment(AppManager.getInstance().getMainActivity()));
|
||||
} else if (userType == 1) {//主播A
|
||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
mIndicator.setLayoutParams(params);
|
||||
titles = new String[]{WordUtil.getNewString(R.string.message_chat_msg_recommend), WordUtil.getNewString(R.string.message_chat_msg_all_an_a)};
|
||||
fragmentList.add(new MainMessageRecommendFragment(AppManager.getInstance().getMainActivity()));
|
||||
fragmentList.add(new MainMessageChatListFragment(AppManager.getInstance().getMainActivity()));
|
||||
} else { //主播B
|
||||
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
mIndicator.setLayoutParams(params);
|
||||
fragmentList.add(new MainMessageChatListFragment(AppManager.getInstance().getMainActivity()));
|
||||
fragmentList.add(new MainMessageChatListSystemFragment());
|
||||
fragmentList.add(new MainMessageChatListUserFragment());
|
||||
titles = new String[]{WordUtil.getNewString(R.string.message_chat_msg_all), WordUtil.getNewString(R.string.message_chat_msg_system), WordUtil.getNewString(R.string.message_chat_msg_user)};
|
||||
}
|
||||
initTabView();
|
||||
ToastUtil.showDebug("列表数量x" + fragmentList.size());
|
||||
viewPager.setAdapter(new FragmentStateAdapter((FragmentActivity) AppManager.getInstance().getMainActivity()) {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
Log.i(TAG, "viewpage 列表 getItemCount: " + fragmentList.size());
|
||||
return fragmentList.size();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int i) {
|
||||
Log.i(TAG, "createFragment: 创建fragment :" + i + " | " + fragmentList.get(i));
|
||||
return fragmentList.get(i);
|
||||
}
|
||||
});
|
||||
if(userType==1){
|
||||
viewPager.setCurrentItem(1);
|
||||
}else{
|
||||
viewPager.setCurrentItem(0);
|
||||
}
|
||||
viewPager.setUserInputEnabled(false);
|
||||
ConversationIMListManager.get(mContext).addUserInfoProvider();
|
||||
|
||||
CommonNavigator commonNavigator = new CommonNavigator(AppManager.getInstance().getMainActivity());
|
||||
commonNavigator.setAdjustMode(true);
|
||||
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return titles.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPagerTitleView getTitleView(Context context, final int index) {
|
||||
SimplePagerTitleView simplePagerTitleView = new ColorTransitionPagerTitleView(context);
|
||||
simplePagerTitleView.setNormalColor(Color.parseColor("#777777"));
|
||||
simplePagerTitleView.setSelectedColor(Color.parseColor("#333333"));
|
||||
if (titles.length == 2 && index == 0) {
|
||||
Drawable drawable = ContextCompat.getDrawable(context, R.mipmap.icon_msg_recommend);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); // 设置Drawable的边界
|
||||
SpannableString spannableString = new SpannableString(" " + titles[index] + " ");
|
||||
ImageSpan imageSpan = new ImageSpan(drawable, ImageSpan.ALIGN_BASELINE);
|
||||
spannableString.setSpan(imageSpan, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
spannableString.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View widget) {
|
||||
// 点击事件的处理逻辑
|
||||
/*XPopup.Builder builder = new XPopup.Builder(mContext).atView(simplePagerTitleView);
|
||||
builder.hasShadowBg(false).isLightStatusBar(false).popupPosition(PopupPosition.Top).asCustom(new MsgRecommendPopupView(mContext).show());*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
//super.updateDrawState(ds);
|
||||
//ds.setUnderlineText(false);
|
||||
}
|
||||
}, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
simplePagerTitleView.setText(spannableString);
|
||||
simplePagerTitleView.setMovementMethod(LinkMovementMethod.getInstance()); // 必须调用此方法
|
||||
} else {
|
||||
simplePagerTitleView.setText(titles[index]);
|
||||
}
|
||||
|
||||
simplePagerTitleView.setTextSize(15);
|
||||
simplePagerTitleView.getPaint().setFakeBoldText(true);
|
||||
simplePagerTitleView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (viewPager != null) {
|
||||
viewPager.setCurrentItem(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
return simplePagerTitleView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPagerIndicator getIndicator(Context context) {
|
||||
LinePagerIndicator linePagerIndicator = new LinePagerIndicator(context);
|
||||
linePagerIndicator.setMode(LinePagerIndicator.MODE_WRAP_CONTENT);
|
||||
linePagerIndicator.setXOffset(DpUtil.dp2px(5));
|
||||
linePagerIndicator.setRoundRadius(DpUtil.dp2px(2));
|
||||
linePagerIndicator.setColors(Color.parseColor("#EB6FFF"), Color.parseColor("#FF83C6"));
|
||||
return linePagerIndicator;
|
||||
}
|
||||
});
|
||||
mIndicator.setNavigator(commonNavigator);
|
||||
ViewPageIndicatorUtils.bind(mIndicator, viewPager, new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
search.setText("");
|
||||
selectTab(position);
|
||||
}
|
||||
});
|
||||
search.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
@ -189,96 +364,84 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
}
|
||||
}
|
||||
});
|
||||
netHandler = new Handler();
|
||||
moreXPopup = new XPopup.Builder(mContext).atView(more);
|
||||
more.setOnClickListener(view -> {
|
||||
moreXPopup.asCustom(new MsgMoreDialog(mContext)).show();
|
||||
});
|
||||
initFragment();
|
||||
initIndicator();
|
||||
}
|
||||
|
||||
private void initFragment() {
|
||||
fragmentList = new ArrayList<>();
|
||||
fragmentList.add(new MainMessageChatListFragment(AppManager.getInstance().getMainActivity()));
|
||||
fragmentList.add(new MainMessageChatListSystemFragment());
|
||||
fragmentList.add(new MainMessageChatListUserFragment());
|
||||
private void initTabView() {
|
||||
relativeLayouts = new ArrayList<>();
|
||||
tabTexts = new ArrayList<>();
|
||||
tabLine = new ArrayList<>();
|
||||
|
||||
ToastUtil.showDebug("列表数量x" + fragmentList.size());
|
||||
viewPager.setAdapter(new FragmentStateAdapter((FragmentActivity) AppManager.getInstance().getMainActivity()) {
|
||||
relativeLayouts.add(tabLayout1);
|
||||
relativeLayouts.add(tabLayout2);
|
||||
relativeLayouts.add(tabLayout3);
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
Log.i(TAG, "viewpage 列表 getItemCount: " + fragmentList.size());
|
||||
return fragmentList.size();
|
||||
}
|
||||
tabTexts.add(tab1);
|
||||
tabTexts.add(tab2);
|
||||
tabTexts.add(tab3);
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int i) {
|
||||
Log.i(TAG, "createFragment: 创建fragment :" + i + " | " + fragmentList.get(i));
|
||||
return fragmentList.get(i);
|
||||
}
|
||||
});
|
||||
viewPager.setCurrentItem(0);
|
||||
viewPager.setUserInputEnabled(false);
|
||||
ConversationIMListManager.get(mContext).addUserInfoProvider();
|
||||
}
|
||||
|
||||
private void initIndicator() {
|
||||
final String[] titles = new String[]{
|
||||
WordUtil.getNewString(R.string.message_chat_msg_all),
|
||||
WordUtil.getNewString(R.string.message_chat_msg_system),
|
||||
WordUtil.getNewString(R.string.message_chat_msg_user)
|
||||
};
|
||||
CommonNavigator commonNavigator = new CommonNavigator(AppManager.getInstance().getMainActivity());
|
||||
commonNavigator.setAdjustMode(true);
|
||||
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return titles.length;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IPagerTitleView getTitleView(Context context, final int index) {
|
||||
SimplePagerTitleView simplePagerTitleView = new ColorTransitionPagerTitleView(context);
|
||||
simplePagerTitleView.setNormalColor(Color.parseColor("#777777"));
|
||||
simplePagerTitleView.setSelectedColor(Color.parseColor("#333333"));
|
||||
simplePagerTitleView.setText(titles[index]);
|
||||
simplePagerTitleView.setTextSize(18);
|
||||
simplePagerTitleView.getPaint().setFakeBoldText(true);
|
||||
simplePagerTitleView.setOnClickListener(new View.OnClickListener() {
|
||||
tabLine.add(tab_line1);
|
||||
tabLine.add(tab_line2);
|
||||
tabLine.add(tab_line3);
|
||||
if (userType == 0) { //普通用户
|
||||
relativeLayouts.get(0).setVisibility(View.VISIBLE);
|
||||
tabTexts.get(0).setText(WordUtil.getNewString(R.string.message_chat_msg_all_an_a));
|
||||
ViewGroup.LayoutParams params = tabLayouts.getLayoutParams();
|
||||
params.width = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
tabLayouts.setLayoutParams(params);
|
||||
} else if (userType == 1) {//主播A
|
||||
tab_icon.setVisibility(View.VISIBLE);
|
||||
tab_icon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (viewPager != null) {
|
||||
viewPager.setCurrentItem(index);
|
||||
|
||||
/*XPopup.Builder builder = new XPopup.Builder(mContext).atView(v);
|
||||
builder.hasShadowBg(false).isLightStatusBar(false).popupPosition(PopupPosition.Top).asCustom(new MsgRecommendPopupView(mContext).show());*/
|
||||
XPopup.Builder builder = new XPopup.Builder(mContext).atView(v);
|
||||
builder.hasShadowBg(false).isDestroyOnDismiss(true).isLightStatusBar(false).popupPosition(PopupPosition.Bottom).asCustom(new MsgRecommendPopupView(mContext, new MsgRecommendPopupView.ItemDelListener() {
|
||||
@Override
|
||||
public void onItemDel() {
|
||||
}
|
||||
})).show();
|
||||
}
|
||||
});
|
||||
return simplePagerTitleView;
|
||||
relativeLayouts.get(0).setVisibility(View.VISIBLE);
|
||||
tabTexts.get(0).setText(WordUtil.getNewString(R.string.message_chat_msg_recommend));
|
||||
relativeLayouts.get(1).setVisibility(View.VISIBLE);
|
||||
tabTexts.get(1).setText(WordUtil.getNewString(R.string.message_chat_msg_all_an_a));
|
||||
} else { //主播B
|
||||
relativeLayouts.get(0).setVisibility(View.VISIBLE);
|
||||
tabTexts.get(0).setText(WordUtil.getNewString(R.string.message_chat_msg_all));
|
||||
relativeLayouts.get(1).setVisibility(View.VISIBLE);
|
||||
tabTexts.get(1).setText(WordUtil.getNewString(R.string.message_chat_msg_system));
|
||||
relativeLayouts.get(2).setVisibility(View.VISIBLE);
|
||||
tabTexts.get(2).setText(WordUtil.getNewString(R.string.message_chat_msg_user));
|
||||
}
|
||||
for (int i = 0; i < relativeLayouts.size(); i++) {
|
||||
int finalI = i;
|
||||
relativeLayouts.get(i).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
selectTab(finalI);
|
||||
viewPager.setCurrentItem(finalI);
|
||||
}
|
||||
});
|
||||
}
|
||||
if(userType==1){
|
||||
selectTab(1);
|
||||
}else{
|
||||
selectTab(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPagerIndicator getIndicator(Context context) {
|
||||
LinePagerIndicator linePagerIndicator = new LinePagerIndicator(context);
|
||||
linePagerIndicator.setMode(LinePagerIndicator.MODE_WRAP_CONTENT);
|
||||
linePagerIndicator.setXOffset(DpUtil.dp2px(5));
|
||||
linePagerIndicator.setRoundRadius(DpUtil.dp2px(2));
|
||||
linePagerIndicator.setColors(Color.parseColor("#EB6FFF"), Color.parseColor("#FF83C6"));
|
||||
return linePagerIndicator;
|
||||
public void selectTab(int position) {
|
||||
for (int i = 0; i < relativeLayouts.size(); i++) {
|
||||
if (position == i) {
|
||||
tabTexts.get(i).setTextColor(Color.parseColor("#333333"));
|
||||
tabLine.get(i).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
tabTexts.get(i).setTextColor(Color.parseColor("#777777"));
|
||||
tabLine.get(i).setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
mIndicator.setNavigator(commonNavigator);
|
||||
ViewPageIndicatorUtils.bind(mIndicator, viewPager, new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
search.setText("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -292,10 +455,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
MessageGuideView guideView = new MessageGuideView((Activity) mContext);
|
||||
//top_noback
|
||||
GuideBuilder builder = new GuideBuilder();
|
||||
builder.setTargetView(topLayout)
|
||||
.setAlpha(180)
|
||||
.setHighTargetCorner(20)
|
||||
.setHighTargetPadding(10);
|
||||
builder.setTargetView(topLayout).setAlpha(180).setHighTargetCorner(20).setHighTargetPadding(10);
|
||||
builder.setOverlayTarget(true);
|
||||
builder.setAutoDismiss(false);
|
||||
|
||||
@ -345,20 +505,24 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
Log.i(TAG, "initData: 初始化数据");
|
||||
//获取一下系统通知
|
||||
MessageIMManager.get(mContext).getSystemMessages();
|
||||
LiveNetManager.get(mContext)
|
||||
.getIsAnchor(new com.yunbao.common.http.base.HttpCallback<MessageChatIsAnchor>() {
|
||||
LiveNetManager.get(mContext).getIsAnchor(new com.yunbao.common.http.base.HttpCallback<MessageChatIsAnchor>() {
|
||||
@Override
|
||||
public void onSuccess(MessageChatIsAnchor data) {
|
||||
AppManager.runDebugCode(() -> {
|
||||
more.setVisibility(View.VISIBLE);
|
||||
});
|
||||
if (data.getIsAnchor() == 1) {
|
||||
if (data.getIsAnchor() == 1 && CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C")) {
|
||||
userType = 2;//主播B
|
||||
more.setVisibility(View.VISIBLE);
|
||||
viewPager.setUserInputEnabled(true);
|
||||
mIndicator.setVisibility(View.VISIBLE);
|
||||
//mIndicator.setVisibility(View.VISIBLE);
|
||||
} else if (CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C")) {
|
||||
userType = 1;//主播A
|
||||
} else {
|
||||
userType = 0;
|
||||
}
|
||||
IMLoginManager.get(mContext)
|
||||
.setAnchorB(data.getIsAnchor());
|
||||
IMLoginManager.get(mContext).setAnchorB(data.getIsAnchor());
|
||||
initFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -405,11 +569,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
MobclickAgent.onEvent(mContext, "information_official_notice", "官方通知");
|
||||
type = userBean.getType();
|
||||
netHandler.post(systemNumberRunnable);
|
||||
mContext.startActivity(new Intent(mContext, SystemMessageActivity.class)
|
||||
.putExtra("type", userBean.getType())
|
||||
.putExtra("uid", "")
|
||||
.putExtra("title", userBean.getTitle())
|
||||
.putExtra("headImg", ""));
|
||||
mContext.startActivity(new Intent(mContext, SystemMessageActivity.class).putExtra("type", userBean.getType()).putExtra("uid", "").putExtra("title", userBean.getTitle()).putExtra("headImg", ""));
|
||||
});
|
||||
break;
|
||||
//互動消息
|
||||
@ -432,11 +592,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
MobclickAgent.onEvent(mContext, "information_system_interactive", "互動消息");
|
||||
type = userBean.getType();
|
||||
netHandler.post(systemNumberRunnable);
|
||||
mContext.startActivity(new Intent(mContext, SystemMessageActivity.class)
|
||||
.putExtra("type", userBean.getType())
|
||||
.putExtra("uid", "")
|
||||
.putExtra("title", userBean.getTitle())
|
||||
.putExtra("headImg", ""));
|
||||
mContext.startActivity(new Intent(mContext, SystemMessageActivity.class).putExtra("type", userBean.getType()).putExtra("uid", "").putExtra("title", userBean.getTitle()).putExtra("headImg", ""));
|
||||
});
|
||||
break;
|
||||
//在線客服
|
||||
@ -464,11 +620,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
// WebViewActivity.forward(mContext, userBean.getLink());
|
||||
RouteUtil.forwardCustomerService(userBean.getLink());
|
||||
} else {
|
||||
mContext.startActivity(new Intent(mContext, SystemMessageActivity.class)
|
||||
.putExtra("type", userBean.getType())
|
||||
.putExtra("uid", "")
|
||||
.putExtra("title", userBean.getTitle())
|
||||
.putExtra("headImg", ""));
|
||||
mContext.startActivity(new Intent(mContext, SystemMessageActivity.class).putExtra("type", userBean.getType()).putExtra("uid", "").putExtra("title", userBean.getTitle()).putExtra("headImg", ""));
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -492,11 +644,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
MobclickAgent.onEvent(mContext, "information_system_notice", "系统消息");
|
||||
type = userBean.getType();
|
||||
netHandler.post(systemNumberRunnable);
|
||||
mContext.startActivity(new Intent(mContext, SystemMessageActivity.class)
|
||||
.putExtra("type", userBean.getType())
|
||||
.putExtra("uid", "")
|
||||
.putExtra("title", userBean.getTitle())
|
||||
.putExtra("headImg", ""));
|
||||
mContext.startActivity(new Intent(mContext, SystemMessageActivity.class).putExtra("type", userBean.getType()).putExtra("uid", "").putExtra("title", userBean.getTitle()).putExtra("headImg", ""));
|
||||
});
|
||||
break;
|
||||
}
|
||||
@ -675,8 +823,8 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal),isSw);
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal), isSw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -301,22 +301,196 @@
|
||||
android:id="@+id/indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="37dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tabLayouts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:id="@+id/tabLayout1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tab_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_toStartOf="@+id/tab_top1"
|
||||
android:src="@mipmap/icon_msg_recommend"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tab_top1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/tab_top1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tab1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="tab1"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/tab_line1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="3dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_below="@+id/tab_top1"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/bg_main_com_type"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tab1"
|
||||
app:layout_constraintStart_toStartOf="@+id/tab1"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tab1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:id="@+id/tabLayout2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/tab_top2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tab2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="tab1"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/tab_line2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:layout_height="3dp"
|
||||
android:layout_below="@+id/tab_top2"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/bg_main_com_type"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tab2"
|
||||
app:layout_constraintStart_toStartOf="@+id/tab2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tab2" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:id="@+id/tabLayout3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/tab_top3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tab3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="tab1"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/tab_line3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:layout_height="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_below="@+id/tab_top3"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/bg_main_com_type"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tab3"
|
||||
app:layout_constraintStart_toStartOf="@+id/tab3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tab3" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:overScrollMode="never"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/indicator" />
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
<!-- 此容器用于动态放置 fragment-->
|
||||
|
||||
|
||||
|
BIN
main/src/main/res/mipmap-xxhdpi/icon_msg_recommend.png
Normal file
BIN
main/src/main/res/mipmap-xxhdpi/icon_msg_recommend.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in New Issue
Block a user