|
@@ -89,6 +89,8 @@ public class PagerActivity extends BaseActivity implements Listener.PlayListener
|
|
private int mPageIndex = 0;
|
|
private int mPageIndex = 0;
|
|
private int mLoadOffset = 0;
|
|
private int mLoadOffset = 0;
|
|
|
|
|
|
|
|
+ private int isSyncMessage = 0;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected void onCreateBase() {
|
|
protected void onCreateBase() {
|
|
Log.d(TAG, "onCreateBase: ");
|
|
Log.d(TAG, "onCreateBase: ");
|
|
@@ -476,11 +478,19 @@ public class PagerActivity extends BaseActivity implements Listener.PlayListener
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onResume() {
|
|
protected void onResume() {
|
|
|
|
+ Log.d(TAG, "onResume: ");
|
|
super.onResume();
|
|
super.onResume();
|
|
|
|
|
|
//有权限后,才能读到分享文件的大小
|
|
//有权限后,才能读到分享文件的大小
|
|
checkShareMessage();
|
|
checkShareMessage();
|
|
|
|
|
|
|
|
+ //防止在语聊界面灭屏后,无法收到消息。重新拉取下。
|
|
|
|
+ Log.d(TAG, "onResume: " + isSyncMessage);
|
|
|
|
+ if (isSyncMessage == 1) {
|
|
|
|
+ syncNewMessageAll();
|
|
|
|
+ }
|
|
|
|
+ isSyncMessage = 1;
|
|
|
|
+
|
|
if (!Macros.DEBUG) {
|
|
if (!Macros.DEBUG) {
|
|
registerContentObserver();
|
|
registerContentObserver();
|
|
}
|
|
}
|
|
@@ -488,6 +498,7 @@ public class PagerActivity extends BaseActivity implements Listener.PlayListener
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onPause() {
|
|
protected void onPause() {
|
|
|
|
+ Log.d(TAG, "onPause: ");
|
|
super.onPause();
|
|
super.onPause();
|
|
|
|
|
|
//暂停正在播放的语音
|
|
//暂停正在播放的语音
|
|
@@ -1054,6 +1065,19 @@ public class PagerActivity extends BaseActivity implements Listener.PlayListener
|
|
}).start();
|
|
}).start();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void syncNewMessageAll() {
|
|
|
|
+ Log.d(TAG, "syncSinceMessage: ");
|
|
|
|
+ new Thread(()-> {
|
|
|
|
+ ArrayList<MessageBean> messageBeans = mDatabaseUtil.loadNewMessages(mChatType, mChatUserId);
|
|
|
|
+ if (messageBeans == null || messageBeans.size() <= 0)
|
|
|
|
+ return;
|
|
|
|
+ ArrayList<MessageBean> fifterList = DataManager.instance().fifterWithMessage(messageBeans);
|
|
|
|
+ if (fifterList == null || fifterList.size() <= 0)
|
|
|
|
+ return;
|
|
|
|
+ addMessage(fifterList);
|
|
|
|
+ }).start();
|
|
|
|
+ }
|
|
|
|
+
|
|
//监听-》再去数据库取新数据
|
|
//监听-》再去数据库取新数据
|
|
private MessageBean updateOldMessage(int primaryKey) {
|
|
private MessageBean updateOldMessage(int primaryKey) {
|
|
MessageBean dbBean = mDatabaseUtil.loadMessageFromPrimaryKey(mChatType, mChatUserId, primaryKey);
|
|
MessageBean dbBean = mDatabaseUtil.loadMessageFromPrimaryKey(mChatType, mChatUserId, primaryKey);
|