/* * Customized activity finish. Ensures the notification is in sync and cancels * any scheduled reminders (as the user has interrupted the app. */ private void myFinish() { if (Log.DEBUG) Log.v("myFinish()"); if (inbox) { ManageNotification.clearAll(getApplicationContext()); } else { // Start a service that will update the notification in the status bar Intent i = new Intent(getApplicationContext(), SmsPopupUtilsService.class); i.setAction(SmsPopupUtilsService.ACTION_UPDATE_NOTIFICATION); // Convert current message to bundle i.putExtras(message.toBundle()); // We need to know if the user is replying - if so, the entire thread id should // be ignored when working out the message tally in the notification bar. // We can't rely on the system database as it may take a little while for the // reply intent to fire and load up the messaging up (after which the messages // will be marked read in the database). i.putExtra(SmsMmsMessage.EXTRAS_REPLYING, replying); // Start the service SmsPopupUtilsService.beginStartingService(SmsPopupActivity.this.getApplicationContext(), i); } // Cancel any reminder notifications ReminderReceiver.cancelReminder(getApplicationContext()); // Finish up the activity finish(); }
/** Delete the current message from the system database */ private void deleteMessage() { Intent i = new Intent(SmsPopupActivity.this.getApplicationContext(), SmsPopupUtilsService.class); i.setAction(SmsPopupUtilsService.ACTION_DELETE_MESSAGE); i.putExtras(message.toBundle()); SmsPopupUtilsService.beginStartingService(SmsPopupActivity.this.getApplicationContext(), i); myFinish(); }
/** Close the message window/popup, mark the message read if the user has this option on */ private void closeMessage() { if (messageViewed) { Intent i = new Intent(getApplicationContext(), SmsPopupUtilsService.class); /* * Switched back to mark messageId as read for >v1.0.6 (marking thread as read is slow * for really large threads) */ i.setAction(SmsPopupUtilsService.ACTION_MARK_MESSAGE_READ); // i.setAction(SmsPopupUtilsService.ACTION_MARK_THREAD_READ); i.putExtras(message.toBundle()); SmsPopupUtilsService.beginStartingService(getApplicationContext(), i); } // Finish up this activity myFinish(); }
/** Sends the actual quick reply message */ private void sendQuickReply(String quickReplyMessage) { hideSoftKeyboard(); if (quickReplyMessage != null) { if (quickReplyMessage.length() > 0) { Intent i = new Intent(SmsPopupActivity.this.getApplicationContext(), SmsPopupUtilsService.class); i.setAction(SmsPopupUtilsService.ACTION_QUICKREPLY); i.putExtras(quickReplySmsMessage.toBundle()); i.putExtra(SmsMmsMessage.EXTRAS_QUICKREPLY, quickReplyMessage); if (Log.DEBUG) Log.v("Sending message to " + quickReplySmsMessage.getContactName()); SmsPopupUtilsService.beginStartingService(SmsPopupActivity.this.getApplicationContext(), i); ManageNotification.clearAll(this); Toast.makeText(this, R.string.quickreply_sending_toast, Toast.LENGTH_LONG).show(); myFinish(); } else { Toast.makeText(this, R.string.quickreply_nomessage_toast, Toast.LENGTH_LONG).show(); } } }