|
@@ -10,17 +10,21 @@ import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
import com.common.im.adapter.MessagePagerAdapter;
|
|
import com.common.im.adapter.MessagePagerAdapter;
|
|
|
|
+import com.common.im.bean.GroupUserInfoBean;
|
|
import com.common.im.contract.MessageFragmentContract;
|
|
import com.common.im.contract.MessageFragmentContract;
|
|
|
|
+
|
|
|
|
+import io.rong.imkit.userinfo.model.GroupUserInfo;
|
|
import io.rong.imkit.utils.helper.ConversationFilterHelper;
|
|
import io.rong.imkit.utils.helper.ConversationFilterHelper;
|
|
|
|
+
|
|
import com.common.im.presenter.MessagePresenter;
|
|
import com.common.im.presenter.MessagePresenter;
|
|
import com.common.im.ui.contact.ContactListTabFragment;
|
|
import com.common.im.ui.contact.ContactListTabFragment;
|
|
|
|
+import io.rong.imkit.utils.GroupUtils;
|
|
import com.common.im_ui.R;
|
|
import com.common.im_ui.R;
|
|
import com.common.im_ui.databinding.FragmentMessageLayoutBinding;
|
|
import com.common.im_ui.databinding.FragmentMessageLayoutBinding;
|
|
import com.common.im.bean.RongIMGroupInfo;
|
|
import com.common.im.bean.RongIMGroupInfo;
|
|
import com.common.im.bean.RongIMUserInfo;
|
|
import com.common.im.bean.RongIMUserInfo;
|
|
import com.cooleshow.base.common.BaseApplication;
|
|
import com.cooleshow.base.common.BaseApplication;
|
|
import com.cooleshow.base.router.RouterPath;
|
|
import com.cooleshow.base.router.RouterPath;
|
|
-import com.cooleshow.base.utils.LogUtils;
|
|
|
|
import com.cooleshow.base.utils.Utils;
|
|
import com.cooleshow.base.utils.Utils;
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
import com.cooleshow.base.ui.fragment.BaseMVPFragment;
|
|
import com.cooleshow.usercenter.helper.UserHelper;
|
|
import com.cooleshow.usercenter.helper.UserHelper;
|
|
@@ -54,7 +58,7 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
Utils.setHeadView(mViewBinding.viewStatusBar, requireContext(), 0);
|
|
Utils.setHeadView(mViewBinding.viewStatusBar, requireContext(), 0);
|
|
if (!BaseApplication.Companion.isTeacherClient()) {
|
|
if (!BaseApplication.Companion.isTeacherClient()) {
|
|
mViewBinding.imCreateGroup.setVisibility(View.GONE);
|
|
mViewBinding.imCreateGroup.setVisibility(View.GONE);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
mViewBinding.imCreateGroup.setVisibility(View.VISIBLE);
|
|
mViewBinding.imCreateGroup.setVisibility(View.VISIBLE);
|
|
mViewBinding.imCreateGroup.setOnClickListener(this);
|
|
mViewBinding.imCreateGroup.setOnClickListener(this);
|
|
}
|
|
}
|
|
@@ -74,9 +78,9 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
tv_text.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_333333));
|
|
tv_text.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_333333));
|
|
tv_text.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
|
tv_text.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
|
}
|
|
}
|
|
- if(tab != null && tab.getPosition() == 1){
|
|
|
|
|
|
+ if (tab != null && tab.getPosition() == 1) {
|
|
ContactListTabFragment fragment = (ContactListTabFragment) fragments.get(tab.getPosition());
|
|
ContactListTabFragment fragment = (ContactListTabFragment) fragments.get(tab.getPosition());
|
|
- if(fragment!=null){
|
|
|
|
|
|
+ if (fragment != null) {
|
|
fragment.refreshContactList();
|
|
fragment.refreshContactList();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -96,18 +100,31 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
public void onTabReselected(TabLayout.Tab tab) {
|
|
public void onTabReselected(TabLayout.Tab tab) {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ RongIM.setGroupUserInfoProvider(new UserDataProvider.GroupUserInfoProvider() {
|
|
|
|
+ @Override
|
|
|
|
+ public GroupUserInfo getGroupUserInfo(String groupId, String userId) {
|
|
|
|
+ if (!TextUtils.isEmpty(groupId) && !TextUtils.isEmpty(userId)) {
|
|
|
|
+ if (presenter != null) {
|
|
|
|
+ presenter.queryGroupFriendDetail(groupId, userId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }, true);
|
|
|
|
+
|
|
|
|
+
|
|
RongIM.setUserInfoProvider(new UserDataProvider.UserInfoProvider() {
|
|
RongIM.setUserInfoProvider(new UserDataProvider.UserInfoProvider() {
|
|
@Override
|
|
@Override
|
|
public UserInfo getUserInfo(String userId) {
|
|
public UserInfo getUserInfo(String userId) {
|
|
if (!TextUtils.isEmpty(localUserid) && localUserid.equals(userId)) {
|
|
if (!TextUtils.isEmpty(localUserid) && localUserid.equals(userId)) {
|
|
RongIMUserInfo data = new RongIMUserInfo();
|
|
RongIMUserInfo data = new RongIMUserInfo();
|
|
- data.setFriendId(userId+"");
|
|
|
|
|
|
+ data.setFriendId(userId + "");
|
|
data.setFriendNickname(UserHelper.getUserName());
|
|
data.setFriendNickname(UserHelper.getUserName());
|
|
data.setFriendAvatar(UserHelper.getUserAvatar());
|
|
data.setFriendAvatar(UserHelper.getUserAvatar());
|
|
onQueryFriendDetail(data);
|
|
onQueryFriendDetail(data);
|
|
} else {
|
|
} else {
|
|
if (presenter != null) {
|
|
if (presenter != null) {
|
|
- presenter.queryFriendDetail(getContext(),userId);
|
|
|
|
|
|
+ presenter.queryFriendDetail(getContext(), userId);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -123,7 +140,7 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
if (presenter != null) {
|
|
if (presenter != null) {
|
|
- presenter.queryGroupDetail(getContext(),groupId);
|
|
|
|
|
|
+ presenter.queryGroupDetail(getContext(), groupId);
|
|
}
|
|
}
|
|
|
|
|
|
return null;
|
|
return null;
|
|
@@ -134,9 +151,11 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
conversationType, String targetId) {
|
|
conversationType, String targetId) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
public boolean onConversationPortraitLongClick(Context context, Conversation.ConversationType conversationType, String targetId) {
|
|
public boolean onConversationPortraitLongClick(Context context, Conversation.ConversationType conversationType, String targetId) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public boolean onConversationLongClick(Context context, View view, BaseUiConversation conversation) {
|
|
public boolean onConversationLongClick(Context context, View view, BaseUiConversation conversation) {
|
|
return false;
|
|
return false;
|
|
@@ -146,7 +165,7 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
public boolean onConversationClick(Context context, View view, BaseUiConversation conversation) {
|
|
public boolean onConversationClick(Context context, View view, BaseUiConversation conversation) {
|
|
if (null != presenter && TextUtils.isEmpty(conversation.mCore.getConversationTitle())) {
|
|
if (null != presenter && TextUtils.isEmpty(conversation.mCore.getConversationTitle())) {
|
|
if (conversation.mCore.getConversationType() == Conversation.ConversationType.GROUP) {
|
|
if (conversation.mCore.getConversationType() == Conversation.ConversationType.GROUP) {
|
|
- presenter.queryGroupDetail(getContext(),conversation.mCore.getTargetId());
|
|
|
|
|
|
+ presenter.queryGroupDetail(getContext(), conversation.mCore.getTargetId());
|
|
} else {
|
|
} else {
|
|
String userId = conversation.mCore.getTargetId();
|
|
String userId = conversation.mCore.getTargetId();
|
|
if (localUserid.equals(userId)) {
|
|
if (localUserid.equals(userId)) {
|
|
@@ -156,7 +175,7 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
data.setFriendAvatar(UserHelper.getUserAvatar());
|
|
data.setFriendAvatar(UserHelper.getUserAvatar());
|
|
onQueryFriendDetail(data);
|
|
onQueryFriendDetail(data);
|
|
} else {
|
|
} else {
|
|
- presenter.queryFriendDetail(getContext(),userId);
|
|
|
|
|
|
+ presenter.queryFriendDetail(getContext(), userId);
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -167,7 +186,7 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
|
|
|
|
ConversationListFragment conversationListFragment = new ConversationListFragment();
|
|
ConversationListFragment conversationListFragment = new ConversationListFragment();
|
|
// ContactPersonListFragment contactPersonListFragment = new ContactPersonListFragment();
|
|
// ContactPersonListFragment contactPersonListFragment = new ContactPersonListFragment();
|
|
- ContactListTabFragment contactListTabFragment=new ContactListTabFragment();
|
|
|
|
|
|
+ ContactListTabFragment contactListTabFragment = new ContactListTabFragment();
|
|
|
|
|
|
fragments.add(conversationListFragment);
|
|
fragments.add(conversationListFragment);
|
|
fragments.add(contactListTabFragment);
|
|
fragments.add(contactListTabFragment);
|
|
@@ -190,6 +209,14 @@ public class MessageFragment extends BaseMVPFragment<FragmentMessageLayoutBindin
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void onQueryGroupUserInfoSuccess(GroupUserInfoBean userInfoBean) {
|
|
|
|
+ if (userInfoBean != null) {
|
|
|
|
+ GroupUserInfo groupUserInfo = new GroupUserInfo(userInfoBean.groupId, userInfoBean.userId, userInfoBean.nickname, GroupUtils.getGroupUserInfoExtra(userInfoBean.isAdmin));
|
|
|
|
+ RongIM.getInstance().refreshGroupUserInfoCache(groupUserInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private TabLayout.Tab createTab(TabLayout.Tab tab, String text) {
|
|
private TabLayout.Tab createTab(TabLayout.Tab tab, String text) {
|
|
View view = LayoutInflater.from(getContext()).inflate(R.layout.view_message_tab_layout, null);
|
|
View view = LayoutInflater.from(getContext()).inflate(R.layout.view_message_tab_layout, null);
|
|
TextView tv_text = view.findViewById(R.id.tv_text);
|
|
TextView tv_text = view.findViewById(R.id.tv_text);
|