Beispiel #1
0
 @Override
 protected void onStart() {
   super.onStart();
   // Only mark screen if the screen is on. onStart() is still called if the app is in the
   // foreground and the screen is off
   // TODO this solution doesn't work if the activity is in the foreground but the lockscreen is on
   if (isScreenOn()) {
     SmsHelper.markSmsSeen(this);
     SmsHelper.markMmsSeen(this);
     NotificationManager.update(this);
   }
 }
Beispiel #2
0
  @Override
  protected void onResume() {
    super.onResume();

    if (!mSlidingMenu.isMenuShowing()) {
      mContent.onContentOpened();
    }

    if (mContent != null && mContent instanceof MessageListFragment) {
      sThreadShowing = ((MessageListFragment) mContent).getThreadId();
      QKReplyActivity.dismiss(sThreadShowing);
    } else {
      sThreadShowing = 0;
    }

    NotificationManager.initQuickCompose(this, false, false);
  }
Beispiel #3
0
  public void sendSms() {
    String body = mReplyText.getText().toString();

    final Drawable attachment;
    if (mAttachment.hasAttachment()) {
      attachment = mAttachment.getDrawable();
    } else {
      attachment = null;
    }
    clearAttachment();

    String[] recipients = null;
    if (mConversation != null) {
      recipients = mConversation.getRecipients().getNumbers();
      for (int i = 0; i < recipients.length; i++) {
        recipients[i] = PhoneNumberUtils.stripSeparators(recipients[i]);
      }
    } else if (mRecipientProvider != null) {
      recipients = mRecipientProvider.getRecipientAddresses();
    }

    // If we have some recipients, send the message!
    if (recipients != null && recipients.length > 0) {
      mReplyText.setText("");

      AnalyticsManager.getInstance()
          .sendEvent(
              AnalyticsManager.CATEGORY_MESSAGES, AnalyticsManager.ACTION_SEND_MESSAGE, mLabel);

      Transaction sendTransaction = new Transaction(mContext, SmsHelper.getSendSettings(mContext));

      com.moez.QKSMS.mmssms.Message message = new com.moez.QKSMS.mmssms.Message(body, recipients);
      message.setType(com.moez.QKSMS.mmssms.Message.TYPE_SMSMMS);
      if (attachment != null) {
        message.setImage(ImageUtils.drawableToBitmap(attachment));
      }

      // Notify the listener about the new text message
      if (mOnSendListener != null) {
        mOnSendListener.onSend(recipients, message.getSubject());
      }

      long threadId = mConversation != null ? mConversation.getThreadId() : 0;
      if (!message.toString().equals("")) {
        sendTransaction.sendNewMessage(message, threadId);
      }
      NotificationManager.update(mContext);

      if (mConversationLegacy != null) {
        mConversationLegacy.markRead();
      }

      // Reset the image button state
      updateButtonState();

      // Otherwise, show a toast to the user to prompt them to add recipients.
    } else {
      Toast.makeText(mContext, mRes.getString(R.string.error_no_recipients), Toast.LENGTH_SHORT)
          .show();
    }
  }