|
@@ -6,6 +6,9 @@ import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
+import com.cooleshow.base.common.BaseApplication;
|
|
|
+import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.fragment.BaseFragment;
|
|
|
import com.cooleshow.base.utils.SizeUtils;
|
|
|
import com.cooleshow.base.utils.Utils;
|
|
@@ -26,7 +29,7 @@ import androidx.fragment.app.Fragment;
|
|
|
/**
|
|
|
* Author by pq, Date on 2023/6/28.
|
|
|
*/
|
|
|
-public class ChatFragment extends BaseFragment<TcFragmentChatLayoutBinding> {
|
|
|
+public class ChatFragment extends BaseFragment<TcFragmentChatLayoutBinding> implements View.OnClickListener {
|
|
|
public static final String[] titles = new String[]{"聊天", "群聊", "联系人",};
|
|
|
private ArrayList<Fragment> fragments = new ArrayList<>();
|
|
|
private View mViewUnred;
|
|
@@ -43,6 +46,12 @@ public class ChatFragment extends BaseFragment<TcFragmentChatLayoutBinding> {
|
|
|
Utils.setHeadView(mViewBinding.viewStatusBar, requireContext(), 0);
|
|
|
IMThemManager.getInstance().init(getContext());
|
|
|
IMCenter.getInstance().addUnReadMessageObserver(mUnReadMessageObserver);
|
|
|
+ if (BaseApplication.Companion.isTeacherClient()) {
|
|
|
+ mViewBinding.imCreateGroup.setVisibility(View.VISIBLE);
|
|
|
+ mViewBinding.imCreateGroup.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ mViewBinding.imCreateGroup.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void initListener() {
|
|
@@ -130,6 +139,15 @@ public class ChatFragment extends BaseFragment<TcFragmentChatLayoutBinding> {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (v.getId() == R.id.im_create_group) {
|
|
|
+ ARouter.getInstance().build(RouterPath.ChatCenter.CHAT_CREATE_GROUP)
|
|
|
+ .navigation();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void onDestroy() {
|
|
|
super.onDestroy();
|
|
|
IMCenter.getInstance().removeUnReadMessageObserver(mUnReadMessageObserver);
|