|
@@ -183,13 +183,14 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
private ServiceConnection serviceConnection;
|
|
|
private ObjectAnimator hideHeaderInfoAnim;
|
|
|
private ObjectAnimator showHeaderInfoAnim;
|
|
|
+ private boolean isOnResume = true;
|
|
|
private Handler mHandler = new Handler(Looper.myLooper()) {
|
|
|
@Override
|
|
|
public void handleMessage(@NonNull android.os.Message msg) {
|
|
|
if (msg.what == SEND_APP_BACKGROUND_MSG) {
|
|
|
//APP切换后台
|
|
|
//开启悬浮窗
|
|
|
- if (AppUtils.isApplicationInBackground(LiveRoomActivity.this)) {
|
|
|
+ if (!isOnResume && AppUtils.isApplicationInBackground(LiveRoomActivity.this)) {
|
|
|
startFloatWindowService();
|
|
|
}
|
|
|
return;
|
|
@@ -197,6 +198,10 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
if (msg.what == SEND_JUMP_OTHER_PAGE_MSG) {
|
|
|
//跳转其他页面时候
|
|
|
//开启悬浮窗
|
|
|
+ if (isOnResume) {
|
|
|
+ //如果页面onResume了,就不开启service
|
|
|
+ return;
|
|
|
+ }
|
|
|
startFloatWindowService();
|
|
|
return;
|
|
|
}
|
|
@@ -375,6 +380,9 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
} else {
|
|
|
//如果IM未连接,等待connectStatusListener回调
|
|
|
isNeedRefresh = true;
|
|
|
+ if (presenter != null) {
|
|
|
+ presenter.connectIM();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -473,6 +481,7 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
|| id == R.id.tv_video_course || id == R.id.tv_music_sheet) {
|
|
|
//约课 直播课 视频课 曲谱
|
|
|
startTeacherHomePage(id);
|
|
|
+ sendShowFloatWindowAction(SEND_JUMP_OTHER_PAGE_MSG);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -546,8 +555,31 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
@Override
|
|
|
protected void onResume() {
|
|
|
super.onResume();
|
|
|
+ Log.i("pq", "onResume");
|
|
|
+ checkImConnectStatus();
|
|
|
+ this.isOnResume = true;
|
|
|
+ unbindService();
|
|
|
+ //取消全部静音
|
|
|
+ muteAll(false);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查IM连接状态
|
|
|
+ */
|
|
|
+ private void checkImConnectStatus() {
|
|
|
+ RongIMClient.ConnectionStatusListener.ConnectionStatus currentConnectionStatus = RongIMClient.getInstance().getCurrentConnectionStatus();
|
|
|
+ if (currentConnectionStatus == RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
|
|
|
+ isNeedRefresh = false;
|
|
|
+ } else {
|
|
|
+ isNeedRefresh = true;
|
|
|
+ if (presenter != null) {
|
|
|
+ presenter.connectIM();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void showPageCloseOnMicTipDialog() {
|
|
|
if (mLiveRoomClosePageOnMicTipDialog == null) {
|
|
|
mLiveRoomClosePageOnMicTipDialog = new LiveRoomClosePageOnMicTipDialog(this);
|
|
@@ -1730,14 +1762,6 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- protected void onRestart() {
|
|
|
- super.onRestart();
|
|
|
- unbindService();
|
|
|
- //取消全部静音
|
|
|
- muteAll(false);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 销毁悬浮窗service
|
|
|
*/
|
|
@@ -1757,6 +1781,7 @@ public class LiveRoomActivity extends BaseMVPActivity<ActivityLiveroomLayoutBind
|
|
|
@Override
|
|
|
protected void onPause() {
|
|
|
super.onPause();
|
|
|
+ isOnResume = false;
|
|
|
sendShowFloatWindowAction(SEND_APP_BACKGROUND_MSG);
|
|
|
}
|
|
|
|