Example usage for android.os Bundle putBoolean

List of usage examples for android.os Bundle putBoolean

Introduction

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

Prototype

public void putBoolean(@Nullable String key, boolean value) 

Source Link

Document

Inserts a Boolean value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.amalgam.app.SupportProgressDialogFragment.java

public static final SupportProgressDialogFragment newInstance(String title, String message,
        boolean indeterminate) {
    SupportProgressDialogFragment fragment = new SupportProgressDialogFragment();
    Bundle args = new Bundle();
    args.putString(ARGS_TITLE, title);//from www  .  ja va 2 s  .  c o  m
    args.putString(ARGS_MESSAGE, message);
    args.putBoolean(ARGS_INDETERMINATE, indeterminate);
    fragment.setArguments(args);
    return fragment;
}

From source file:ar.com.lapotoca.resiliencia.gallery.ui.ImageDetailFragment.java

/**
 * Factory method to generate a new instance of the fragment given an image number.
 *
 * @param image The image holder to load
 * @return A new instance of ImageDetailFragment with imageNum extras
 *//*from   w w w . ja va  2s .  c o m*/
public static ImageDetailFragment newInstance(ImageHolder image) {
    final ImageDetailFragment f = new ImageDetailFragment();

    final Bundle args = new Bundle();
    args.putString(IMAGE_DATA_EXTRA, image.getUrl());
    args.putBoolean(IMAGE_DATA_SOURCE, image.isLocal());
    f.setArguments(args);

    return f;
}

From source file:Main.java

public static void setSlotReservationFlags(Bundle extras, boolean reservePlayingQueueSlot,
        boolean reserveSkipToNextSlot, boolean reserveSkipToPrevSlot) {
    if (reservePlayingQueueSlot)
        extras.putBoolean(SLOT_RESERVATION_QUEUE, true);
    else/*  w  w  w .j ava2  s  .  c  om*/
        extras.remove(SLOT_RESERVATION_QUEUE);
    if (reserveSkipToPrevSlot)
        extras.putBoolean(SLOT_RESERVATION_SKIP_TO_PREV, true);
    else
        extras.remove(SLOT_RESERVATION_SKIP_TO_PREV);
    if (reserveSkipToNextSlot)
        extras.putBoolean(SLOT_RESERVATION_SKIP_TO_NEXT, true);
    else
        extras.remove(SLOT_RESERVATION_SKIP_TO_NEXT);
}

From source file:Main.java

public static void setSlotReservationFlags(Bundle extras, boolean reservePlayingQueueSlot,
        boolean reserveSkipToNextSlot, boolean reserveSkipToPrevSlot) {
    if (reservePlayingQueueSlot) {
        extras.putBoolean(SLOT_RESERVATION_QUEUE, true);
    } else {/*from   w w  w .  ja va2 s  .c om*/
        extras.remove(SLOT_RESERVATION_QUEUE);
    }
    if (reserveSkipToPrevSlot) {
        extras.putBoolean(SLOT_RESERVATION_SKIP_TO_PREV, true);
    } else {
        extras.remove(SLOT_RESERVATION_SKIP_TO_PREV);
    }
    if (reserveSkipToNextSlot) {
        extras.putBoolean(SLOT_RESERVATION_SKIP_TO_NEXT, true);
    } else {
        extras.remove(SLOT_RESERVATION_SKIP_TO_NEXT);
    }
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
public static Bundle persistableBundleToBundle(PersistableBundle persistableBundle) {
    Set<String> keySet = persistableBundle.keySet();
    Bundle bundle = new Bundle();
    for (String key : keySet) {
        Object value = persistableBundle.get(key);
        if (value instanceof Boolean) {
            bundle.putBoolean(key, (boolean) value);
        } else if (value instanceof Integer) {
            bundle.putInt(key, (int) value);
        } else if (value instanceof String) {
            bundle.putString(key, (String) value);
        } else if (value instanceof String[]) {
            bundle.putStringArray(key, (String[]) value);
        } else if (value instanceof PersistableBundle) {
            Bundle innerBundle = persistableBundleToBundle((PersistableBundle) value);
            bundle.putBundle(key, innerBundle);
        }/*from w  ww .ja va2  s. com*/
    }
    return bundle;
}

From source file:at.wada811.android.dialogfragments.sample.alertdialogfragment.AlertDialogFragmentExamplesFragment.java

public static AlertDialogFragmentExamplesFragment newInstance(boolean isInActivity) {
    AlertDialogFragmentExamplesFragment fragment = new AlertDialogFragmentExamplesFragment();
    Bundle args = new Bundle();
    args.putBoolean(Const.KEY_IS_IN_ACTIVITY, isInActivity);
    fragment.setArguments(args);/*  w w w.  j a va 2 s  . c  om*/
    return fragment;
}

From source file:au.gov.ga.worldwind.androidremote.client.ui.ItemModelFragment.java

public static ItemModelFragment newInstance(int itemModelStateId, boolean flatten) {
    ItemModelFragment f = new ItemModelFragment();
    Bundle arguments = new Bundle();
    arguments.putInt(ITEM_MODEL_STATE_ID_KEY, itemModelStateId);
    arguments.putBoolean(FLATTEN_KEY, flatten);
    f.setArguments(arguments);//from   w  w  w  .  j a  va2s. co m
    return f;
}

From source file:com.activiti.android.ui.fragments.form.picker.DatePickerFragment.java

public static DatePickerFragment newInstance(String dateId, String fragmentTag, boolean timePicker) {
    DatePickerFragment bf = newInstance(dateId, fragmentTag);
    Bundle b = bf.getArguments();
    b.putBoolean(ARGUMENT_TIME_PICKER, timePicker);
    bf.setArguments(b);//  w w  w  .  j  ava2 s. com
    return bf;
}

From source file:com.google.cast.samples.games.gamedebugger.PlayerTransitionDialogFragment.java

public static PlayerTransitionDialogFragment newInstance(String playerId, boolean isTransition) {
    PlayerTransitionDialogFragment instance = new PlayerTransitionDialogFragment();
    Bundle bundle = new Bundle();
    bundle.putString(KEY_PLAYER_ID, playerId);
    bundle.putBoolean(KEY_IS_TRANSITION, isTransition);
    instance.setArguments(bundle);//from  w  ww  . j  a v a  2 s. c  o  m
    return instance;
}

From source file:com.example.igorklimov.popularmoviesdemo.sync.SyncAdapter.java

public static void syncImmediately(Context context) {
    Log.d(LOG_TAG, "syncImmediately: ");
    ConnectivityManager systemService = (ConnectivityManager) context
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetworkInfo = systemService.getActiveNetworkInfo();
    if (activeNetworkInfo == null) {
        new NoInternet().show(((MainActivity) context).getSupportFragmentManager(), "1");
    }/*from   ww  w  .j  a v  a 2 s.c om*/
    Bundle bundle = new Bundle();
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    ContentResolver.requestSync(getSyncAccount(context), context.getString(R.string.content_authority), bundle);
}