|
@@ -13,7 +13,14 @@ import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
+import com.cooleshow.base.constanst.LoginStatusConstants;
|
|
|
+import com.cooleshow.base.event.LoginStatusEvent;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
+import com.cooleshow.base.utils.LogUtils;
|
|
|
+
|
|
|
+import org.greenrobot.eventbus.EventBus;
|
|
|
+import org.greenrobot.eventbus.Subscribe;
|
|
|
+import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
import androidx.annotation.LayoutRes;
|
|
|
import androidx.annotation.NonNull;
|
|
@@ -77,6 +84,7 @@ public class ConversationListFragment extends Fragment implements BaseAdapter.On
|
|
|
@Override
|
|
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
+ EventBus.getDefault().register(this);
|
|
|
}
|
|
|
|
|
|
@Nullable
|
|
@@ -365,4 +373,20 @@ public class ConversationListFragment extends Fragment implements BaseAdapter.On
|
|
|
mAdapter.setEmptyView(emptyId);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
+ public void loadEventBus(LoginStatusEvent event) {
|
|
|
+ if (event != null && event.eventCode == LoginStatusConstants.LOGIN_OUT) {
|
|
|
+ LogUtils.i("pq", "im receive:logout");
|
|
|
+ if (mConversationListViewModel != null) {
|
|
|
+ mConversationListViewModel.clearCurrentConversationList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDestroy() {
|
|
|
+ super.onDestroy();
|
|
|
+ EventBus.getDefault().unregister(this);
|
|
|
+ }
|
|
|
}
|