Example usage for android.os Bundle getCharSequence

List of usage examples for android.os Bundle getCharSequence

Introduction

In this page you can find the example usage for android.os Bundle getCharSequence.

Prototype

@Override
@Nullable
public CharSequence getCharSequence(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.b44t.messenger.AutoMessageReplyReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ApplicationLoader.postInitApplication();
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput == null) {
        return;//from   w  ww .  j a v  a  2  s  . c  o m
    }
    CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY);
    if (text == null || text.length() == 0) {
        return;
    }
    long dialog_id = intent.getLongExtra("dialog_id", 0);
    int max_id = intent.getIntExtra("max_id", 0);
    if (dialog_id == 0 || max_id == 0) {
        return;
    }
    SendMessagesHelper.getInstance().sendMessageText(text.toString(), dialog_id, null);
    MrMailbox.markseenChat((int) dialog_id);
    NotificationsController.getInstance().removeSeenMessages();
}

From source file:com.ofalvai.bpinfo.ui.alertlist.NoticeFragment.java

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        if (savedInstanceState.getCharSequence(KEY_NOTICE_TEXT) != null) {
            mNoticeText = savedInstanceState.getCharSequence(KEY_NOTICE_TEXT, "").toString();
        }/*from   w  ww  .j ava2  s .  c  o  m*/
    }
}

From source file:com.liferay.alerts.receiver.WearableVoteReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    long alertId = intent.getLongExtra(EXTRA_ALERT_ID, 0);

    PollsQuestion question = (PollsQuestion) intent.getSerializableExtra(EXTRA_QUESTION);

    int questionId = question.getQuestionId();

    Bundle input = RemoteInput.getResultsFromIntent(intent);
    String description = input.getCharSequence(EXTRA_CHOICE).toString();

    List<PollsChoice> choices = question.getChoices();
    int choiceId = getChoiceId(choices, description);

    VoteCallback callback = new VoteCallback(context, alertId, questionId);
    callback.vote(choiceId);/*ww  w. java  2  s . c o m*/
}

From source file:org.thoughtcrime.securesms.notifications.AndroidAutoReplyReceiver.java

private CharSequence getMessageText(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(VOICE_REPLY_KEY);
    }// w w  w.j a v a 2  s  . c  om
    return null;
}

From source file:it.gulch.linuxday.android.fragments.MessageDialogFragment.java

@NonNull
@Override//  w  w w.  j a  v a2 s .  c o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle args = getArguments();
    int titleResId = args.getInt("titleResId", -1);
    CharSequence title = (titleResId != -1) ? getText(titleResId) : args.getCharSequence("title");
    int messageResId = args.getInt("messageResId", -1);
    CharSequence message = (messageResId != -1) ? getText(messageResId) : args.getCharSequence("message");

    return new AlertDialog.Builder(getActivity()).setTitle(title).setMessage(message)
            .setPositiveButton(android.R.string.ok, null).create();
}

From source file:com.android.mms.quickmessage.QuickMessageWear.java

private void parseIntent(Intent i) {
    if (i == null) {
        return;//from ww  w . j  av  a2s  . co m
    }
    //parse the remote input into a message that can be sent
    Bundle remoteInput = RemoteInput.getResultsFromIntent(i);
    CharSequence message = remoteInput.getCharSequence(EXTRA_VOICE_REPLY);
    String sender = i.getStringExtra(SMS_SENDER);
    String contactName = i.getStringExtra(SMS_CONATCT);
    long tId = i.getLongExtra(SMS_THEAD_ID, -1);
    //Only send if we have a valid thread id
    if (tId != -1) {
        String[] dest = new String[] { sender };

        SmsMessageSender smsMessageSender = new SmsMessageSender(getBaseContext(), dest, message.toString(),
                tId, SubscriptionManager.getDefaultSmsSubId());
        try {
            smsMessageSender.sendMessage(tId);
            Toast.makeText(mContext, getString(R.string.qm_wear_sending_message, contactName),
                    Toast.LENGTH_LONG).show();
        } catch (MmsException e) {
            Log.e(TAG, "Mms Exception thrown as follows: " + e);
            Toast.makeText(mContext, getString(R.string.qm_wear_messaged_failed, contactName),
                    Toast.LENGTH_LONG).show();
        }
    } else {
        Toast.makeText(mContext, getString(R.string.qm_wear_messaged_failed, contactName), Toast.LENGTH_LONG)
                .show();
    }
    //gotta mark as read even if it doesn't send since we read
    // the message and tried to respond to it
    Conversation con = Conversation.get(mContext, tId, true);
    if (con != null) {
        con.markAsRead(true);
        if (DEBUG)
            Log.d(TAG, "markAllMessagesRead(): Marked message " + tId + " as read");
    }
    finish();
}

From source file:org.rm3l.ddwrt.tiles.admin.nvram.EditNVRAMKeyValueDialogFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Bundle arguments = getArguments();
    this.mKey = arguments.getCharSequence(KEY);
    this.mValue = arguments.getCharSequence(VALUE);
    this.mPosition = arguments.getInt(POSITION);
}

From source file:com.jameswolfeoliver.pigeon.Services.MessageReplyService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Bundle results = RemoteInput.getResultsFromIntent(intent);
    String message = results != null ? results.getCharSequence(MESSAGE_TEXT_KEY).toString() : null;
    Conversation conversation = (intent.getExtras() != null)
            ? (Conversation) intent.getSerializableExtra(CONVERSATION_KEY)
            : null;/*  ww  w . j  av  a2  s  . c o  m*/
    if (conversation == null || message == null) {
        Toast.makeText(PigeonApplication.getAppContext(), "An error occurred", Toast.LENGTH_SHORT).show();
        return super.onStartCommand(intent, flags, startId);
    }

    sendTextMessage(conversation, message);
    return super.onStartCommand(intent, flags, startId);
}

From source file:siarhei.luskanau.gps.tracker.free.ui.progress.AlertDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (savedInstanceState != null && savedInstanceState.containsKey(TITLE_ARG)) {
        title = savedInstanceState.getCharSequence(TITLE_ARG);
    } else if (getArguments().containsKey(TITLE_ARG)) {
        title = getArguments().getCharSequence(TITLE_ARG);
    }//from  www .j  a v  a  2  s. com
    if (savedInstanceState != null && savedInstanceState.containsKey(MESSAGE_ARG)) {
        message = savedInstanceState.getCharSequence(MESSAGE_ARG);
    } else if (getArguments().containsKey(MESSAGE_ARG)) {
        message = getArguments().getCharSequence(MESSAGE_ARG);
    }
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(title);
    builder.setMessage(message);
    builder.setPositiveButton(android.R.string.ok, null);
    builder.setCancelable(true);
    alertDialog = builder.create();
    return alertDialog;
}

From source file:com.amlcurran.messages.telephony.SmsManagerOutputPort.java

private CharSequence getMessageText(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_VOICE_REPLY);
    }// w w  w.j av  a 2 s.c  om
    return null;
}