mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-19 12:28:53 +01:00
Dismiss QK Reply when marked read from lock screen
This commit is contained in:
@@ -19,8 +19,6 @@ public class MarkReadReceiver extends BroadcastReceiver {
|
|||||||
readIntent.putExtra("thread_id", threadId);
|
readIntent.putExtra("thread_id", threadId);
|
||||||
context.startService(readIntent);
|
context.startService(readIntent);
|
||||||
|
|
||||||
if (QKReplyActivity.sIsShowing && threadId == QKReplyActivity.sThreadId) {
|
QKReplyActivity.dismiss(threadId);
|
||||||
QKReplyActivity.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ public class PushbulletService extends MessagingExtension {
|
|||||||
message.setType(com.moez.QKSMS.mmssms.Message.TYPE_SMSMMS);
|
message.setType(com.moez.QKSMS.mmssms.Message.TYPE_SMSMMS);
|
||||||
sendTransaction.sendNewMessage(message, conversation.getThreadId());
|
sendTransaction.sendNewMessage(message, conversation.getThreadId());
|
||||||
|
|
||||||
if (QKReplyActivity.sIsShowing && conversation.getThreadId() == QKReplyActivity.sThreadId) {
|
QKReplyActivity.dismiss(conversation.getThreadId());
|
||||||
QKReplyActivity.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
NotificationManager.update(getApplicationContext());
|
NotificationManager.update(getApplicationContext());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import com.moez.QKSMS.ui.dialog.DefaultSmsHelper;
|
|||||||
import com.moez.QKSMS.ui.dialog.QKDialog;
|
import com.moez.QKSMS.ui.dialog.QKDialog;
|
||||||
import com.moez.QKSMS.ui.dialog.mms.MMSSetupFragment;
|
import com.moez.QKSMS.ui.dialog.mms.MMSSetupFragment;
|
||||||
import com.moez.QKSMS.ui.messagelist.MessageListFragment;
|
import com.moez.QKSMS.ui.messagelist.MessageListFragment;
|
||||||
|
import com.moez.QKSMS.ui.popup.QKReplyActivity;
|
||||||
import com.moez.QKSMS.ui.search.SearchFragment;
|
import com.moez.QKSMS.ui.search.SearchFragment;
|
||||||
import com.moez.QKSMS.ui.settings.SettingsFragment;
|
import com.moez.QKSMS.ui.settings.SettingsFragment;
|
||||||
import com.moez.QKSMS.ui.view.slidingmenu.SlidingMenu;
|
import com.moez.QKSMS.ui.view.slidingmenu.SlidingMenu;
|
||||||
@@ -417,6 +418,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
|
|||||||
|
|
||||||
if (mContent != null && mContent instanceof MessageListFragment) {
|
if (mContent != null && mContent instanceof MessageListFragment) {
|
||||||
sThreadShowing = ((MessageListFragment) mContent).getThreadId();
|
sThreadShowing = ((MessageListFragment) mContent).getThreadId();
|
||||||
|
QKReplyActivity.dismiss(sThreadShowing);
|
||||||
} else {
|
} else {
|
||||||
sThreadShowing = 0;
|
sThreadShowing = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class QKReplyActivity extends QKPopupActivity implements DialogInterface.
|
|||||||
public static final String EXTRA_SHOW_KEYBOARD = "open_keyboard";
|
public static final String EXTRA_SHOW_KEYBOARD = "open_keyboard";
|
||||||
|
|
||||||
public static boolean sIsShowing = false;
|
public static boolean sIsShowing = false;
|
||||||
public static long sThreadId;
|
private static long sThreadId;
|
||||||
|
|
||||||
private Conversation mConversation;
|
private Conversation mConversation;
|
||||||
private ConversationLegacy mConversationLegacy;
|
private ConversationLegacy mConversationLegacy;
|
||||||
@@ -69,8 +69,9 @@ public class QKReplyActivity extends QKPopupActivity implements DialogInterface.
|
|||||||
|
|
||||||
Bundle extras = getIntent().getExtras();
|
Bundle extras = getIntent().getExtras();
|
||||||
|
|
||||||
mConversation = Conversation.get(this, extras.getLong(EXTRA_THREAD_ID), false);
|
sThreadId = extras.getLong(EXTRA_THREAD_ID);
|
||||||
mConversationLegacy = new ConversationLegacy(this, extras.getLong(EXTRA_THREAD_ID));
|
mConversation = Conversation.get(this, sThreadId, false);
|
||||||
|
mConversationLegacy = new ConversationLegacy(this, sThreadId);
|
||||||
|
|
||||||
// Set up the compose view.
|
// Set up the compose view.
|
||||||
mComposeView = (ComposeView) findViewById(R.id.compose_view);
|
mComposeView = (ComposeView) findViewById(R.id.compose_view);
|
||||||
@@ -165,7 +166,6 @@ public class QKReplyActivity extends QKPopupActivity implements DialogInterface.
|
|||||||
mComposeView.saveDraft();
|
mComposeView.saveDraft();
|
||||||
|
|
||||||
sIsShowing = false;
|
sIsShowing = false;
|
||||||
sThreadId = 0;
|
|
||||||
|
|
||||||
// When the home button is pressed, this ensures that the QK Reply is shut down
|
// When the home button is pressed, this ensures that the QK Reply is shut down
|
||||||
// Don't shut it down if it pauses and the screen is off though
|
// Don't shut it down if it pauses and the screen is off though
|
||||||
@@ -289,8 +289,23 @@ public class QKReplyActivity extends QKPopupActivity implements DialogInterface.
|
|||||||
mCursor = null;
|
mCursor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void close() {
|
/**
|
||||||
System.exit(0);
|
* Other areas of the app can tell the QK Reply window to close itself if necessary
|
||||||
|
*
|
||||||
|
* 1. MainActivity. When it's resumed, we don't want any QK Reply windows to open, which may have
|
||||||
|
* happened while the screen was off.
|
||||||
|
*
|
||||||
|
* 2. PushbulletService. If a message is replied to via PB, close the window
|
||||||
|
*
|
||||||
|
* 3. MarkReadReceiver. A QK Reply window may have opened while the screen was off, so if it's marked
|
||||||
|
* as read from the lock screen via notification, the QK Reply window should be dismissed
|
||||||
|
*/
|
||||||
|
public static void dismiss(long threadId) {
|
||||||
|
if (sThreadId == threadId) {
|
||||||
|
sIsShowing = false;
|
||||||
|
sThreadId = 0;
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user