forked from upstream-mirrors/quik
Fix Notification pops up when in conversation
This commit is contained in:
@@ -157,7 +157,7 @@ public class NotificationManager {
|
|||||||
|
|
||||||
// If this message is in the foreground, mark it as read
|
// If this message is in the foreground, mark it as read
|
||||||
Message message = new Message(context, lastMessage.mMsgId);
|
Message message = new Message(context, lastMessage.mMsgId);
|
||||||
if (message.getThreadId() == MainActivity.sThreadShowing) {
|
if (MessageListActivity.isInForeground && message.getThreadId() == MessageListActivity.getThreadId()) {
|
||||||
message.markRead();
|
message.markRead();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ public class NotificationManager {
|
|||||||
// If the message is visible (i.e. it is currently showing in the Main Activity),
|
// If the message is visible (i.e. it is currently showing in the Main Activity),
|
||||||
// don't show a notification; just mark it as read and return.
|
// don't show a notification; just mark it as read and return.
|
||||||
Message message = new Message(context, lastMessage.mMsgId);
|
Message message = new Message(context, lastMessage.mMsgId);
|
||||||
if (message.getThreadId() == MainActivity.sThreadShowing) {
|
if (MessageListActivity.isInForeground && message.getThreadId() == MessageListActivity.getThreadId()) {
|
||||||
message.markRead();
|
message.markRead();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,15 @@ public class MessageListActivity extends QKSwipeBackActivity {
|
|||||||
public static final String ARG_HIGHLIGHT = "highlight";
|
public static final String ARG_HIGHLIGHT = "highlight";
|
||||||
public static final String ARG_SHOW_IMMEDIATE = "showImmediate";
|
public static final String ARG_SHOW_IMMEDIATE = "showImmediate";
|
||||||
|
|
||||||
private long mThreadId;
|
private static long mThreadId;
|
||||||
private long mRowId;
|
private long mRowId;
|
||||||
private String mHighlight;
|
private String mHighlight;
|
||||||
private boolean mShowImmediate;
|
private boolean mShowImmediate;
|
||||||
|
|
||||||
private long mWaitingForThreadId = -1;
|
private long mWaitingForThreadId = -1;
|
||||||
|
|
||||||
|
public static boolean isInForeground;
|
||||||
|
|
||||||
public static void launch(QKActivity context, long threadId, long rowId, String pattern, boolean showImmediate) {
|
public static void launch(QKActivity context, long threadId, long rowId, String pattern, boolean showImmediate) {
|
||||||
Intent intent = new Intent(context, MessageListActivity.class);
|
Intent intent = new Intent(context, MessageListActivity.class);
|
||||||
intent.putExtra(ARG_THREAD_ID, threadId);
|
intent.putExtra(ARG_THREAD_ID, threadId);
|
||||||
@@ -54,6 +56,18 @@ public class MessageListActivity extends QKSwipeBackActivity {
|
|||||||
onNewIntent(getIntent());
|
onNewIntent(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
isInForeground = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
isInForeground = false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
@@ -148,4 +162,8 @@ public class MessageListActivity extends QKSwipeBackActivity {
|
|||||||
inflater.inflate(R.menu.message_list, menu);
|
inflater.inflate(R.menu.message_list, menu);
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long getThreadId() {
|
||||||
|
return mThreadId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user