|
@@ -32,6 +32,7 @@ import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
import com.cooleshow.base.utils.helper.UpdateAppHelper;
|
|
|
import com.cooleshow.base.utils.helper.WebStartHelper;
|
|
|
import com.cooleshow.base.widgets.TabAnimationView;
|
|
|
+import com.cooleshow.chatmodule.contract.IUnReadMessageObserver;
|
|
|
import com.cooleshow.chatmodule.manager.IMCenter;
|
|
|
import com.cooleshow.chatmodule.ui.ChatFragment;
|
|
|
import com.cooleshow.teacher.App;
|
|
@@ -81,7 +82,7 @@ import static com.cooleshow.base.constanst.Constants.MAIN_PAGE_SELECT_POTION_KEY
|
|
|
* Author by pq, Date on 2022/4/20.
|
|
|
*/
|
|
|
@Route(path = RouterPath.APPCenter.PATH_HOME)
|
|
|
-public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPresenter> implements MainContract.MainView, UnReadMessageManager.IUnReadMessageObserver {
|
|
|
+public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPresenter> implements MainContract.MainView{
|
|
|
private ArrayList<Fragment> mFragments = new ArrayList<>();
|
|
|
private NewHomeFragment mHomeFragment;
|
|
|
private MineFragment mMineFragment;
|
|
@@ -93,6 +94,13 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
|
|
|
private String floatViewEventUrl = "";
|
|
|
private MessageFragment mMessageFragment;
|
|
|
|
|
|
+ private IUnReadMessageObserver mUnReadMessageObserver =new IUnReadMessageObserver(){
|
|
|
+ @Override
|
|
|
+ public void onTotalUnreadMessageCountChanged(long totalUnreadCount) {
|
|
|
+ onCountChanged(totalUnreadCount);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* 打开首页并选中指定tab
|
|
|
*
|
|
@@ -228,7 +236,7 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
|
|
|
public void initData() {
|
|
|
super.initData();
|
|
|
requestPermission();
|
|
|
- IMManager.getInstance().addOnUnReadMessageListener(this);
|
|
|
+ IMCenter.getInstance().addUnReadMessageObserver(mUnReadMessageObserver);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -463,8 +471,7 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
|
|
|
return new MainPresenter();
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void onCountChanged(int count) {
|
|
|
+ public void onCountChanged(long count) {
|
|
|
if (count > 0) {
|
|
|
tvMsgCount.setVisibility(View.VISIBLE);
|
|
|
if (count <= 99) {
|
|
@@ -523,6 +530,6 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
|
|
|
public void onDestroy() {
|
|
|
super.onDestroy();
|
|
|
EventBus.getDefault().unregister(this);
|
|
|
- IMManager.getInstance().removeOnUnReadMessageListener(this);
|
|
|
+ IMCenter.getInstance().removeUnReadMessageObserver(mUnReadMessageObserver);
|
|
|
}
|
|
|
}
|