Example usage for android.os Bundle putSerializable

List of usage examples for android.os Bundle putSerializable

Introduction

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

Prototype

@Override
public void putSerializable(@Nullable String key, @Nullable Serializable value) 

Source Link

Document

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

Usage

From source file:com.facebook.LegacyTokenHelper.java

public static void putSource(Bundle bundle, AccessTokenSource value) {
    Validate.notNull(bundle, "bundle");
    bundle.putSerializable(TOKEN_SOURCE_KEY, value);
}

From source file:com.grayfox.android.app.fragment.RecommendedRouteFragment.java

public static RecommendedRouteFragment newInstance(Location currentLocation, Poi seed) {
    RecommendedRouteFragment fragment = new RecommendedRouteFragment();
    Bundle args = new Bundle();
    args.putParcelable(CURRENT_LOCATION_ARG, currentLocation);
    args.putSerializable(SEED_ARG, seed);
    fragment.setArguments(args);// www .  ja v  a  2 s  . co  m
    return fragment;
}

From source file:com.docd.purefm.ui.dialogs.FilePropertiesDialog.java

public static FilePropertiesDialog newInstance(final @NonNull GenericFile f) {
    final Bundle extras = new Bundle();
    extras.putSerializable(Extras.EXTRA_FILE, f);

    final FilePropertiesDialog fpd = new FilePropertiesDialog();
    fpd.setArguments(extras);/*from w  ww.j  a v  a  2 s  .  c o  m*/
    return fpd;
}

From source file:com.app.blockydemo.ui.fragment.FormulaEditorFragment.java

public static void showFragment(View view, Brick brick, Formula formula) {

    FragmentActivity activity = null;//from w  ww .ja  v a  2s .co  m
    activity = (FragmentActivity) view.getContext();

    FormulaEditorFragment formulaEditorFragment = (FormulaEditorFragment) activity.getSupportFragmentManager()
            .findFragmentByTag(FORMULA_EDITOR_FRAGMENT_TAG);

    FragmentManager fragmentManager = activity.getSupportFragmentManager();
    FragmentTransaction fragTransaction = fragmentManager.beginTransaction();

    if (formulaEditorFragment == null) {
        formulaEditorFragment = new FormulaEditorFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable(BRICK_BUNDLE_ARGUMENT, brick);
        bundle.putSerializable(FORMULA_BUNDLE_ARGUMENT, formula);
        formulaEditorFragment.setArguments(bundle);

        fragTransaction.add(R.id.script_fragment_container, formulaEditorFragment, FORMULA_EDITOR_FRAGMENT_TAG);
        fragTransaction.hide(fragmentManager.findFragmentByTag(ScriptFragment.TAG));
        fragTransaction.show(formulaEditorFragment);
        BottomBar.hideBottomBar(activity);
    } else if (formulaEditorFragment.isHidden()) {
        formulaEditorFragment.updateBrickViewAndFormula(brick, formula);
        fragTransaction.hide(fragmentManager.findFragmentByTag(ScriptFragment.TAG));
        fragTransaction.show(formulaEditorFragment);
        BottomBar.hideBottomBar(activity);
    } else {
        formulaEditorFragment.setInputFormula(formula, SET_FORMULA_ON_SWITCH_EDIT_TEXT);
    }
    fragTransaction.commit();
}

From source file:com.gh4a.fragment.PullRequestFragment.java

public static PullRequestFragment newInstance(PullRequest pr, Issue issue) {
    PullRequestFragment f = new PullRequestFragment();

    Bundle args = new Bundle();
    args.putSerializable("PULL", pr);
    args.putSerializable("ISSUE", issue);
    f.setArguments(args);/*from  ww w  . ja  va 2 s. c o  m*/

    return f;
}

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  w  w w .java2  s  .  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:com.seregil13.literarytracker.lightnovel.LightNovelEditFragment.java

/**
 * Creates a new instance of the fragment in edit mode with all the pertinent data passed in as
 * parameters.//from  w  ww  . j av a 2  s .  c o  m
 *
 * @return An instance of LightNovelEditFragment.
 */
public static LightNovelEditFragment newEditInstance(int id, String title, String author, String description,
        String completed, String translatorSite, ArrayList<String> genres) {
    LightNovelEditFragment fragment = new LightNovelEditFragment();
    Bundle arguments = new Bundle();
    arguments.putInt(JsonKeys.ID.toString(), id);
    arguments.putString(JsonKeys.TITLE.toString(), title);
    arguments.putString(JsonKeys.AUTHOR.toString(), author);
    arguments.putString(JsonKeys.DESCRIPTION.toString(), description);
    arguments.putString(JsonKeys.COMPLETED.toString(), completed);
    arguments.putString(JsonKeys.TRANSLATOR_SITE.toString(), translatorSite);
    arguments.putStringArrayList(JsonKeys.GENRES.toString(), genres);
    arguments.putSerializable(CREATE_OR_EDIT_KEY, Mode.EDIT);

    fragment.setArguments(arguments);
    return fragment;
}

From source file:com.mov.android.camera2video.Camera2VideoFragment.java

public static Camera2VideoFragment newInstance(boolean isFront, int duration_ms) {
    Camera2VideoFragment fragment = new Camera2VideoFragment();
    Bundle bundle = new Bundle();

    bundle.putSerializable(ISFRONT_KEY, isFront);
    bundle.putSerializable(DURATION_KEY, duration_ms);
    fragment.setArguments(bundle);/*  w  ww . ja v a2s  . c  o m*/

    return fragment;
}

From source file:com.gmail.charleszq.picorner.ui.ImageDetailFragment.java

/**
 * Factory method to generate a new instance of the fragment given an image
 * number.//w ww  .j av  a2 s.c o m
 * 
 * @param imageUrl
 *            The image url to load
 * @return A new instance of ImageDetailFragment with imageNum extras
 */
public static ImageDetailFragment newInstance(String imageUrl, IPhotosProvider dp, int pos,
        boolean offlineEnabled) {
    final ImageDetailFragment f = new ImageDetailFragment();

    final Bundle args = new Bundle();
    args.putString(IMAGE_DATA_EXTRA, imageUrl);
    args.putInt(MEDIA_OBJ_POS, pos);
    args.putSerializable(ImageDetailActivity.DP_KEY, dp);
    args.putBoolean(ImageDetailActivity.OFFLINE_COMMAND_KEY, offlineEnabled);
    f.setArguments(args);

    return f;
}

From source file:com.groksolutions.grok.mobile.instance.InstanceDetailActivity.java

@Override
protected Fragment createTabFragment(Tab tab) {
    InstanceDetailPageFragment fragment = new InstanceDetailPageFragment();
    AggregationType type = (AggregationType) tab.getTag();
    InstanceAnomalyChartData data = new InstanceAnomalyChartData(getInstanceId(), type);
    fragment.setRowData(data);/*w  w w .  j a  v a  2s . com*/
    Bundle args = new Bundle();
    args.putSerializable("AggregationType", type);
    fragment.setArguments(args);
    return fragment;
}