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.miz.mizuu.fragments.RelatedMoviesFragment.java

public static RelatedMoviesFragment newInstance(String tmdbId, boolean setBackground, String json,
        String baseUrl) {//from   w w w .j  a  va2 s  .  com
    RelatedMoviesFragment pageFragment = new RelatedMoviesFragment();
    Bundle bundle = new Bundle();
    bundle.putString("tmdbId", tmdbId);
    bundle.putBoolean("setBackground", setBackground);
    bundle.putString("json", json);
    bundle.putString("baseUrl", baseUrl);
    pageFragment.setArguments(bundle);
    return pageFragment;
}

From source file:com.facebook.share.internal.NativeDialogParameters.java

private static Bundle createBaseParameters(ShareContent content, boolean dataErrorsFatal) {
    Bundle params = new Bundle();

    Utility.putUri(params, ShareConstants.CONTENT_URL, content.getContentUrl());
    Utility.putNonEmptyString(params, ShareConstants.PLACE_ID, content.getPlaceId());
    Utility.putNonEmptyString(params, ShareConstants.REF, content.getRef());

    params.putBoolean(ShareConstants.DATA_FAILURES_FATAL, dataErrorsFatal);

    List<String> peopleIds = content.getPeopleIds();
    if (!Utility.isNullOrEmpty(peopleIds)) {
        params.putStringArrayList(ShareConstants.PEOPLE_IDS, new ArrayList<String>(peopleIds));
    }//from ww w  .  jav  a  2 s . c  o  m

    return params;
}

From source file:com.facebook.share.internal.LegacyNativeDialogParameters.java

private static Bundle createBaseParameters(ShareContent content, boolean dataErrorsFatal) {
    Bundle params = new Bundle();

    Utility.putUri(params, ShareConstants.LEGACY_LINK, content.getContentUrl());
    Utility.putNonEmptyString(params, ShareConstants.LEGACY_PLACE_TAG, content.getPlaceId());
    Utility.putNonEmptyString(params, ShareConstants.LEGACY_REF, content.getRef());

    params.putBoolean(ShareConstants.LEGACY_DATA_FAILURES_FATAL, dataErrorsFatal);

    List<String> peopleIds = content.getPeopleIds();
    if (!Utility.isNullOrEmpty(peopleIds)) {
        params.putStringArrayList(ShareConstants.LEGACY_FRIEND_TAGS, new ArrayList<>(peopleIds));
    }//from  w  ww.  jav  a  2s  . c om

    return params;
}

From source file:dk.kk.ibikecphlib.util.HttpUtils.java

public static Message JSONtoMessage(JsonNode result) {
    Message ret = new Message();
    Bundle data = new Bundle();
    if (result != null) {
        if (result.has("success"))
            data.putBoolean("success", result.get("success").asBoolean());
        if (result.has("info"))
            data.putString("info", result.get("info").asText());
        if (result.has("has_password"))
            data.putBoolean("has_password", result.get("has_password").asBoolean());
        if (result.has("invalid_token")) {
            if (result.get("invalid_token").asBoolean()) {
                data.putBoolean("invalid_token", result.get("invalid_token").asBoolean());
                IBikeApplication.logoutWrongToken();
            }//w  w w .jav  a2  s.c  o  m
        }
        /*if (result.has("errors"))
        data.putString("errors", result.get("errors").get(0).asText());*/
    }
    if (result != null && result.has("data")) {
        JsonNode dataNode = result.get("data");
        if (dataNode != null) {
            if (dataNode.has("id"))
                data.putInt("id", dataNode.get("id").asInt());
            if (dataNode.has("auth_token"))
                data.putString("auth_token", dataNode.get("auth_token").asText());
            if (dataNode.has("signature"))
                data.putString("signature", dataNode.get("signature").asText());
            if (dataNode.has("provider"))
                data.putString("provider", dataNode.get("provider").asText());
            /*if (dataNode.has("errors"))
                data.putString("errors", dataNode.get("errors").get(0).asText());*/
        }
    }

    ret.setData(data);
    return ret;
}

From source file:co.carlosjimenez.android.currencyalerts.app.sync.ForexSyncAdapter.java

/**
 * Helper method to have the sync adapter sync immediately
 *
 * @param context The context used to access the account service
 */// www  .  ja  v a2  s.co  m
public static void syncImmediately(Context context) {
    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);
}

From source file:com.hybris.mobile.app.commerce.fragment.AddressDialogFragment.java

public static AddressDialogFragment newInstance(boolean nestedFragment, TextWatcher textWatcher) {
    AddressDialogFragment addressDialogFragment = new AddressDialogFragment();
    Bundle args = new Bundle();
    args.putBoolean(NESTED_FRAGMENT, nestedFragment);
    addressDialogFragment.setArguments(args);
    addressDialogFragment.mTextWatcher = textWatcher;
    return addressDialogFragment;
}

From source file:com.nextgis.mobile.map.LocalGeoJsonLayer.java

protected static void create(final MapBase map, String layerName, List<Feature> features, int layerType)
        throws JSONException, IOException {

    GeoEnvelope extents = new GeoEnvelope();
    for (Feature feature : features) {
        //update bbox
        extents.merge(feature.getGeometry().getEnvelope());
    }/*from  ww  w .  j a  v a  2s  .  c  o  m*/

    Feature feature = features.get(0);
    int geometryType = feature.getGeometry().getType();
    List<Field> fields = feature.getFields();

    //create layer description file
    JSONObject oJSONRoot = new JSONObject();
    oJSONRoot.put(JSON_NAME_KEY, layerName);
    oJSONRoot.put(JSON_VISIBILITY_KEY, true);
    oJSONRoot.put(JSON_TYPE_KEY, layerType);
    oJSONRoot.put(JSON_MAXLEVEL_KEY, 50);
    oJSONRoot.put(JSON_MINLEVEL_KEY, 0);

    //add geometry type
    oJSONRoot.put(JSON_GEOMETRY_TYPE_KEY, geometryType);

    //add bbox
    JSONObject oJSONBBox = extents.toJSON();
    oJSONRoot.put(JSON_BBOX_KEY, oJSONBBox);

    //add fields description
    JSONArray oJSONFields = new JSONArray();
    for (Field field : fields) {
        oJSONFields.put(field.toJSON());
    }
    oJSONRoot.put(JSON_FIELDS_KEY, oJSONFields);

    // store layer description to file
    File outputPath = map.cretateLayerStorage();
    File file = new File(outputPath, LAYER_CONFIG);
    FileUtil.createDir(outputPath);
    FileUtil.writeToFile(file, oJSONRoot.toString());

    //store GeoJson to file
    store(features, outputPath);

    if (map.getMapEventsHandler() != null) {
        Bundle bundle = new Bundle();
        bundle.putBoolean(BUNDLE_HASERROR_KEY, false);
        bundle.putString(BUNDLE_MSG_KEY, map.getContext().getString(R.string.message_layer_added));
        bundle.putInt(BUNDLE_TYPE_KEY, MSGTYPE_LAYER_ADDED);
        bundle.putSerializable(BUNDLE_PATH_KEY, outputPath);

        Message msg = new Message();
        msg.setData(bundle);
        map.getMapEventsHandler().sendMessage(msg);
    }
}

From source file:au.com.wallaceit.reddinator.TabCommentsFragment.java

static TabCommentsFragment init(boolean load) {
    TabCommentsFragment commentsTab = new TabCommentsFragment();
    Bundle args = new Bundle();
    args.putBoolean("load", load);
    commentsTab.setArguments(args);// ww w  .j  a v  a  2s. c  om
    return commentsTab;
}

From source file:com.hybris.mobile.app.commerce.CommerceApplicationBase.java

/**
 * Request a sync of the catalog sync adapter
 *
 * @param bundle/*from  w  w w  .ja  v a 2  s  . c  om*/
 */
public static void requestCatalogSyncAdapter(Bundle bundle) {
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    ContentResolver.requestSync(
            new Account(mInstance.getString(R.string.account_name), mInstance.getString(R.string.account_type)),
            mInstance.getString(R.string.provider_authority), bundle);
}

From source file:Main.java

public static Intent mapToIntent(Context context, Class<?> clazz, Map<String, Object> map) {
    Intent intent = new Intent(context, clazz);
    Bundle bundle = new Bundle();
    if (map != null && map.size() > 0) {
        for (String key : map.keySet()) {
            if (map.get(key) instanceof String) {
                bundle.putString(key, (String) map.get(key));
            } else if (map.get(key) instanceof Integer) {
                bundle.putInt(key, (Integer) map.get(key));
            } else if (map.get(key) instanceof Boolean) {
                bundle.putBoolean(key, (Boolean) map.get(key));
            } else if (map.get(key) instanceof Double) {
                bundle.putDouble(key, (Double) map.get(key));
            } else if (map.get(key) instanceof Long) {
                bundle.putLong(key, (Long) map.get(key));
            } else if (map.get(key) instanceof Float) {
                bundle.putFloat(key, (Float) map.get(key));
            } else if (map.get(key) instanceof Double) {
                bundle.putDouble(key, (Double) map.get(key));
            } else if (map.get(key) instanceof Serializable) {
                bundle.putSerializable(key, (Serializable) map.get(key));
            } else if (map.get(key) instanceof Parcelable) {
                bundle.putParcelable(key, (Parcelable) map.get(key));
            }/*from  w ww  .  jav  a 2  s  . com*/
        }
    }
    return intent.putExtras(bundle);
}