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:chrisrenke.drawerarrowdrawable.ContentFragment.java

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

    Bundle args = getArguments();

    if (args != null) {
        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);
    }//w  ww. ja va 2s  . c  om
}

From source file:androidavanzato.wearablenotifications.NotificationIntentReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(ACTION_EXAMPLE)) {
        if (mEnableMessages) {
            String message = intent.getStringExtra(NotificationUtil.EXTRA_MESSAGE);
            Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
            CharSequence replyMessage = null;
            if (remoteInputResults != null) {
                replyMessage = remoteInputResults.getCharSequence(NotificationUtil.EXTRA_REPLY);
            }/*from ww  w .j a  va  2 s  .  c  o  m*/
            if (replyMessage != null) {
                message = message + ": \"" + replyMessage + "\"";
            }
            Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
        }
    } else if (intent.getAction().equals(ACTION_ENABLE_MESSAGES)) {
        mEnableMessages = true;
    } else if (intent.getAction().equals(ACTION_DISABLE_MESSAGES)) {
        mEnableMessages = false;
    }
}

From source file:org.voidsink.anewjkuapp.base.BaseFragment.java

@Override
public void setArguments(Bundle args) {
    super.setArguments(args);

    if (args != null && args.containsKey(Consts.ARG_FRAGMENT_TITLE)) {
        mTitle = args.getCharSequence(Consts.ARG_FRAGMENT_TITLE);
    }//from   w  ww  . ja  v  a2  s.  c o m
}

From source file:com.vsmartcard.acardemulator.MainActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    textViewVPCDStatus.setText(savedInstanceState.getCharSequence(SAVED_STATUS));
}

From source file:com.android.messaging.datamodel.NoConfirmationSmsSendService.java

private String getText(final Intent intent, final String textType) {
    final String message = intent.getStringExtra(textType);
    if (message == null) {
        final Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
        if (remoteInput != null) {
            final CharSequence extra = remoteInput.getCharSequence(textType);
            if (extra != null) {
                return extra.toString();
            }// w  w  w . ja  v a 2 s .co m
        }
    }
    return message;
}

From source file:com.rafaelsf80.d4w.hotels.ContentFragment.java

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

    Bundle args = getArguments();

    if (args != null) {

        TextView title = (TextView) view.findViewById(R.id.description);
        title.setText(args.getCharSequence(KEY_DESCRIPTION));

        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 total = args.getInt(KEY_TOTAL);
        TextView totalView = (TextView) view.findViewById(R.id.total);
        totalView.setText("Total: #" + Integer.toString(total));
        totalView.setTextColor(indicatorColor);

        int available = args.getInt(KEY_AVAILABLE);
        TextView availableView = (TextView) view.findViewById(R.id.available);
        availableView.setText("Disponibles: #" + Integer.toString(available));
        availableView.setTextColor(indicatorColor);

        String rooms = args.getCharSequence(KEY_ROOMS).toString();
        TextView roomsView = (TextView) view.findViewById(R.id.rooms);
        roomsView.setText("Habitaciones: " + rooms);
        roomsView.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  w  w  w.j a va  2  s .c o  m*/
}

From source file:de.vanita5.twittnuker.fragment.support.DataExportImportTypeSelectorDialogFragment.java

private CharSequence getTitle() {
    final Bundle args = getArguments();
    if (args == null)
        return null;
    return args.getCharSequence(EXTRA_TITLE);
}

From source file:org.hopestarter.wallet.util.BitmapFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final Bitmap bitmap = (Bitmap) args.getParcelable(KEY_BITMAP);
    final CharSequence label = args.getCharSequence(KEY_LABEL);
    final CharSequence address = args.getCharSequence(KEY_ADDRESS);

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.bitmap_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image);
    imageView.setImageBitmap(bitmap);/*from w w w.j a  v a2 s. com*/

    final View labelButtonView = dialog.findViewById(R.id.bitmap_dialog_label_button);
    final TextView labelView = (TextView) dialog.findViewById(R.id.bitmap_dialog_label);
    if (getResources().getBoolean(R.bool.show_bitmap_dialog_label) && label != null) {
        labelView.setText(Html.fromHtml(Formats.maybeRemoveOuterHtmlParagraph(label)));
        labelButtonView.setVisibility(View.VISIBLE);

        if (address != null) {
            labelButtonView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(final View v) {
                    final Intent intent = new Intent(Intent.ACTION_SEND);
                    intent.setType("text/plain");
                    intent.putExtra(Intent.EXTRA_TEXT, address);
                    startActivity(Intent.createChooser(intent, getString(R.string.bitmap_fragment_share)));
                }
            });
        } else {
            labelButtonView.setEnabled(false);
        }
    } else {
        labelButtonView.setVisibility(View.GONE);
    }

    final View dialogView = dialog.findViewById(R.id.bitmap_dialog_group);
    dialogView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}

From source file:com.example.android.wearable.wear.wearnotifications.handlers.BigPictureSocialIntentService.java

private CharSequence getMessage(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_COMMENT);
    }//  www.j  ava2  s  .co  m
    return null;
}

From source file:siarhei.luskanau.gps.tracker.free.ui.progress.ProgressDialogFragment.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);
    }/* w  ww. j av  a 2  s .c o m*/
    if (savedInstanceState != null && savedInstanceState.containsKey(MESSAGE_ARG)) {
        message = savedInstanceState.getCharSequence(MESSAGE_ARG);
    } else if (getArguments().containsKey(MESSAGE_ARG)) {
        message = getArguments().getCharSequence(MESSAGE_ARG);
    }
    if (savedInstanceState != null && savedInstanceState.containsKey(REFRESH_ACTION_ARG)) {
        refreshAction = savedInstanceState.getString(REFRESH_ACTION_ARG);
    } else if (getArguments().containsKey(REFRESH_ACTION_ARG)) {
        refreshAction = getArguments().getString(REFRESH_ACTION_ARG);
    }
    progressDialog = new ProgressDialog(getActivity());
    progressDialog.setTitle(title);
    progressDialog.setIcon(0);
    progressDialog.setMessage(message);
    progressDialog.setIndeterminate(true);
    progressDialog.setProgress(0);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK) {
                // ProgressBinder.getInstance().cancelTask((ProgressDialogActivity) getActivity());
                return true;
            }
            return false;
        }
    });
    return progressDialog;
}