Example usage for android.os Bundle putFloat

List of usage examples for android.os Bundle putFloat

Introduction

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

Prototype

@Override
public void putFloat(@Nullable String key, float value) 

Source Link

Document

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

Usage

From source file:com.nextgis.ngm_clink_monitoring.dialogs.DistanceExceededDialog.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    if (null != mObjectLayerName) {
        outState.putString(FoclConstants.OBJECT_LAYER_NAME, mObjectLayerName);
    }//from   ww w.jav a2  s. co  m

    if (null != mDistance) {
        outState.putFloat(FoclConstants.DISTANCE, mDistance);
    }
}

From source file:au.id.tedp.mapdroid.Picker.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    OSMMapView map = (OSMMapView) findViewById(R.id.mapView);
    if (map == null)
        return;//from   w  w w. ja va 2  s.c om

    outState.putFloat(SAVED_LATITUDE_KEY, map.getLatitude());
    outState.putFloat(SAVED_LONGITUDE_KEY, map.getLongitude());
}

From source file:com.bydavy.card.receipts.fragments.ReceiptAddFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putString(STATE_SHOP, mViewShop.getText().toString());
    outState.putLong(STATE_DATE, mCalendar.getTimeInMillis());
    outState.putString(STATE_NOTE, STATE_NOTE);
    try {/*from   ww  w  .j a  v  a 2s. co m*/
        outState.putFloat(STATE_TOTAL, Float.valueOf(mViewTotal.getText().toString()));
    } catch (final NumberFormatException e) {
        /* Nothing */
    }
    super.onSaveInstanceState(outState);
}

From source file:com.idean.atthack.api.Param.java

/**
 * Put value into bundle using the appropriate type for the value
 *//*from  www .  jav  a  2s .co  m*/
public void putBundleAsTypedVal(Bundle bundle, String val) {
    if (TextUtils.isEmpty(val)) {
        return;
    }
    try {
        switch (type) {
        case BOOLEAN:
            bundle.putBoolean(name(), Boolean.parseBoolean(val));
            break;
        case FLOAT:
            bundle.putFloat(name(), Float.parseFloat(val));
            break;
        case INTEGER:
            bundle.putFloat(name(), Integer.parseInt(val));
            break;
        case STRING:
            bundle.putString(name(), val);
            break;
        default:
            throw new UnsupportedOperationException();
        }
    } catch (Exception e) {
        Log.w(TAG, "Unable to put value into bundle " + this + ", val: " + val);
    }
}

From source file:nuclei.media.MediaInterface.java

public void setSpeed(float speed) {
    Bundle args = new Bundle();
    args.putFloat(MediaService.EXTRA_SPEED, speed);
    mMediaControls.getTransportControls().sendCustomAction(MediaService.ACTION_SET_SPEED, args);
}

From source file:com.google.android.apps.authenticator.dataexport.Exporter.java

private Bundle getPreferencesBundle(SharedPreferences preferences) {
    Map<String, ?> preferencesMap = preferences.getAll();
    if (preferencesMap == null) {
        preferencesMap = Collections.emptyMap();
    }//from  w  w w  .ja  v a  2 s .  com
    Bundle result = new Bundle();
    for (String key : preferencesMap.keySet()) {
        Object value = preferencesMap.get(key);
        if (value instanceof Boolean) {
            result.putBoolean(key, (Boolean) value);
        } else if (value instanceof Float) {
            result.putFloat(key, (Float) value);
        } else if (value instanceof Integer) {
            result.putInt(key, (Integer) value);
        } else if (value instanceof Long) {
            result.putLong(key, (Long) value);
        } else if (value instanceof String) {
            result.putString(key, (String) value);
        } else {
            // Can only be Set<String> at the moment (API Level 11+), which we don't use anyway.
            // Ignore this type of preference, since losing preferences on export is not lethal
        }
    }
    return result;
}

From source file:nl.atcomputing.spacetravelagency.fragments.PlaceOrderFragment.java

/**
 * NOTE: setting a fragment retain instance to true will prevent
 * the system from passing the outState bundle in onActivityCreated
 *///from  w ww  . j a  v  a2  s . c o m
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    GoogleMap map = getMap();
    if (map != null) {
        outState.putFloat(BUNDLE_KEY_ZOOM, map.getCameraPosition().zoom);
        outState.putDouble(BUNDLE_KEY_POSITION_LAT, map.getCameraPosition().target.latitude);
        outState.putDouble(BUNDLE_KEY_POSITION_LNG, map.getCameraPosition().target.longitude);
    }

}

From source file:org.deviceconnect.android.deviceplugin.host.activity.TouchProfileActivity.java

/**
 * Send event data./*from www .  j  a  va2 s .  c o  m*/
 *
 * @param state MotionEvent state.
 * @param event MotionEvent.
 * @param events Event request list.
 */
private void sendEventData(final String state, final MotionEvent event, final List<Event> events) {
    List<Event> touchEvents = EventManager.INSTANCE.getEventList(mServiceId, TouchProfile.PROFILE_NAME, null,
            ATTRIBUTE_ON_TOUCH_CHANGE);
    Bundle touchdata = new Bundle();
    List<Bundle> touchlist = new ArrayList<Bundle>();
    Bundle touches = new Bundle();
    for (int n = 0; n < event.getPointerCount(); n++) {
        int pointerId = event.getPointerId(n);
        touchdata.putInt(TouchProfile.PARAM_ID, pointerId);
        touchdata.putFloat(TouchProfile.PARAM_X, event.getX(n));
        touchdata.putFloat(TouchProfile.PARAM_Y, event.getY(n));
        touchlist.add((Bundle) touchdata.clone());
    }
    touches.putParcelableArray(TouchProfile.PARAM_TOUCHES, touchlist.toArray(new Bundle[touchlist.size()]));
    for (int i = 0; i < events.size(); i++) {
        Event eventdata = events.get(i);
        String attr = eventdata.getAttribute();
        Intent intent = EventManager.createEventMessage(eventdata);
        intent.putExtra(TouchProfile.PARAM_TOUCH, touches);
        intent.setAction(HostTouchProfile.ACTION_TOUCH);
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
        mApp.setTouchCache(attr, touches);
    }
    for (int i = 0; i < touchEvents.size(); i++) {
        Event eventdata = touchEvents.get(i);
        String attr = eventdata.getAttribute();
        touches.putString("state", state);
        Intent intent = EventManager.createEventMessage(eventdata);
        intent.putExtra(TouchProfile.PARAM_TOUCH, touches);
        intent.setAction(HostTouchProfile.ACTION_TOUCH);
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
        mApp.setTouchCache(attr, touches);
    }

}

From source file:com.ruesga.rview.fragments.FileDiffViewerFragment.java

public static FileDiffViewerFragment newInstance(String revisionId, String file, String comment, int base,
        int revision, int mode, boolean wrap, float textSizeFactor, boolean showBlameA, boolean showBlameB,
        boolean highlightTabs, boolean highlightTrailingWhitespaces, boolean highlightIntralineDiffs,
        int scrollToPosition, String skipLinesHistory) {
    FileDiffViewerFragment fragment = new FileDiffViewerFragment();
    Bundle arguments = new Bundle();
    arguments.putString(Constants.EXTRA_REVISION_ID, revisionId);
    arguments.putString(Constants.EXTRA_FILE, file);
    if (comment != null) {
        arguments.putString(Constants.EXTRA_COMMENT, comment);
    }//from   w  w  w .  j a v  a  2s.com
    arguments.putInt(Constants.EXTRA_BASE, base);
    arguments.putInt(Constants.EXTRA_REVISION, revision);
    arguments.putInt("mode", mode);
    arguments.putBoolean("wrap", wrap);
    arguments.putFloat("textSizeFactor", textSizeFactor);
    arguments.putBoolean("highlight_tabs", highlightTabs);
    arguments.putBoolean("highlight_trailing_whitespaces", highlightTrailingWhitespaces);
    arguments.putBoolean("highlight_intraline_diffs", highlightIntralineDiffs);
    arguments.putInt("scrollToPosition", scrollToPosition);
    arguments.putString("skipLinesHistory", skipLinesHistory);
    arguments.putBoolean("show_blame_a", showBlameA);
    arguments.putBoolean("show_blame_b", showBlameB);
    fragment.setArguments(arguments);
    return fragment;
}

From source file:com.hackvg.android.views.activities.MoviesActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {

    super.onSaveInstanceState(outState);

    if (mMoviesAdapter != null) {

        outState.putSerializable(BUNDLE_MOVIES_WRAPPER, new MoviesWrapper(mMoviesAdapter.getMovieList()));

        outState.putFloat(BUNDLE_BACK_TRANSLATION, mBackgroundTranslation);
    }//  www . j  a  v a2s.  c  o  m
}