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.example.usuario.interactivemenu.fragment.ContentFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    Bundle args = getArguments();

    if (args != null) {
        if (args.getCharSequence(KEY_TITLE).equals("Principales")) {
            Toast.makeText(view.getContext(), "Principales", Toast.LENGTH_SHORT).show();
        }//from w  w w . j a va2s. co  m

        TextView title = (TextView) view.findViewById(R.id.item_title);
        title.setText("Title: " + args.getCharSequence(KEY_TITLE));

        int indicatorColor = args.getInt(KEY_INDICATOR_COLOR);
        TextView indicatorColorView = (TextView) view.findViewById(R.id.item_indicator_color);
        indicatorColorView.setText("Indicator: #" + Integer.toHexString(indicatorColor));
        indicatorColorView.setTextColor(indicatorColor);

        int dividerColor = args.getInt(KEY_DIVIDER_COLOR);
        TextView dividerColorView = (TextView) view.findViewById(R.id.item_divider_color);
        dividerColorView.setText("Divider: #" + Integer.toHexString(dividerColor));
        dividerColorView.setTextColor(dividerColor);
    }
}

From source file:conversandroid.cookingnotifications.SecondActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.second_activity);

    Intent intent = getIntent();//  ww w  .ja  v  a  2s . co m
    TextView textView = (TextView) findViewById(R.id.textView);

    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null)
        textView.setText(remoteInput.getCharSequence(MainActivity.EXTRA_VOICE_REPLY));
}

From source file:com.groksolutions.grok.mobile.dialog.AutoDismissDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final CharSequence message = args.getCharSequence("message");
    final CharSequence title = args.getCharSequence("title");
    final long timeout = args.getLong("timeout", 0);

    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(title).setMessage(message).setNegativeButton(android.R.string.ok, new OnClickListener() {
        @Override//  w  ww . j  a  va2  s. c o  m
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    final AlertDialog dialog = builder.create();
    if (timeout > 0) {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                dialog.dismiss();
            }
        }, timeout);
    }
    return dialog;
}

From source file:com.commonsware.android.remoteinput.RemoteInputReceiver.java

@Override
public void onReceive(Context ctxt, Intent i) {
    Bundle input = RemoteInput.getResultsFromIntent(i);

    if (input != null) {
        CharSequence speech = input.getCharSequence(EXTRA_INPUT);

        if (speech != null) {
            Log.d(getClass().getSimpleName(), speech.toString());
        } else {/*from w w w.j  a  v a2 s . co  m*/
            Log.e(getClass().getSimpleName(), "No voice response speech");
        }
    } else {
        Log.e(getClass().getSimpleName(), "No voice response Bundle");
    }

    NotificationCompat.Builder builder = buildNotificationBase(ctxt);

    NotificationManagerCompat.from(ctxt).notify(RemoteInputReceiver.NOTIFY_ID, builder.build());
}

From source file:com.abcvoipsip.ui.dialpad.DialerAutocompleteDetailsFragment.java

private void proposeRestoreFromBundle(Bundle b) {
    if (b != null && b.containsKey(EXTRA_FILTER_CONSTRAINT)) {
        filter(b.getCharSequence(EXTRA_FILTER_CONSTRAINT));
    }//from  w ww.j a v  a 2  s. c om
}

From source file:com.example.android.messagingservice.MessageReplyReceiver.java

/**
 * Get the message text from the intent.
 * Note that you should call {@code RemoteInput#getResultsFromIntent(intent)} to process
 * the RemoteInput./*from  w  w  w.j  a va2 s .c o  m*/
 */
private CharSequence getMessageText(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(MessagingService.EXTRA_REMOTE_REPLY);
    }
    return null;
}

From source file:mobi.espier.lgc.LgcApp.java

public void saveNotification(Bundle data) {
    CharSequence packageName = data.getCharSequence(KEY_PACKAGE_NAME);
    if (!TextUtils.equals(packageName, "com.tencent.mm")) {
        return;/*from   w  w  w. j  a v  a2 s.  c om*/
    }

    Notification notification = (Notification) data.getParcelable(KEY_NOTIFICATION);
    long time = data.getLong(KEY_NOTIFICATION_TIME);
    if (TextUtils.isEmpty(notification.tickerText)) {
        return;
    }
    // add code for save notification to db
    String title = notification.tickerText.toString();
    int index = title.indexOf(':');

    if (index > 0) {
        String name = title.substring(0, index).trim();
        int type = LgcProvider.DataColumns.TYPE_TEXT;
        String content = null;
        if (index < title.length()) {
            content = title.substring(index + 1).trim();
        }

        if (TextUtils.equals(content, "[]")) {
            type = LgcProvider.DataColumns.TYPE_IMAGE;
        } else if (TextUtils.equals(content, "[]")) {
            type = LgcProvider.DataColumns.TYPE_VOICE;
        }
        LgcDataUtil.saveNotification(this, name.trim(), content, type, time);
        LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(LgcUtils.ACTION_DATA_CHANGE));
    }
}

From source file:com.android.tripgenie.auto.MessageReplyReceiver.java

/**
 * Get the message text from the intent.
 * Note that you should call {@code RemoteInput#getResultsFromIntent(intent)} to process
 * the RemoteInput./*from   w w  w.j ava  2s.  c o m*/
 */
private CharSequence getMessageText(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(MessagingService.EXTRA_VOICE_REPLY);
    }
    return null;
}

From source file:com.cnlms.wear.ReplyActivity.java

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

    setContentView(R.layout.activity_reply);

    if (null != getIntent()) {
        Bundle remoteInput = RemoteInput.getResultsFromIntent(getIntent());

        if (null != remoteInput) {
            Toast.makeText(this, remoteInput.getCharSequence(NotificationHelper.EXTRA_VOICE_REPLY),
                    Toast.LENGTH_SHORT).show();
        }/*from ww  w  .  ja v  a  2 s .  c om*/
    }

}

From source file:com.goftagram.telegram.messenger.AutoMessageReplyReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput == null) {
        return;// w w w.j  a va 2 s  .  com
    }
    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().sendMessage(text.toString(), dialog_id, null, null, true, false);
    MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, true, false);
}