List of usage examples for android.os Bundle getFloat
@Override public float getFloat(String key, float defaultValue)
From source file:Main.java
public static float interceptFloatParam(Bundle savedInstanceState, Intent intent, String paramName) { float ret = 0; if (savedInstanceState != null) { ret = savedInstanceState.getFloat(paramName, 0); } else {/*from ww w.java 2 s .co m*/ if (intent != null) { Bundle incomming = intent.getExtras(); if (incomming != null) { ret = incomming.getFloat(paramName, 0); } } } return ret; }
From source file:com.spoiledmilk.ibikecph.navigation.DirectionCellFragment.java
private void init() { Bundle args = getArguments(); if (args != null) { String wayName = args.getString("wayName"); float lengthInMeters = args.getFloat("lengthInMeters", 0); LOG.d("wayname inside fragment = " + wayName); if (wayName != null && specialWaynamePattern.matcher(wayName).matches()) textWayname.setText(IbikeApplication.getString(wayName)); else// ww w . j a v a 2 s. c om textWayname.setText(wayName); textWayname.setTypeface(IbikeApplication.getBoldFont()); textDistance.setText(Util.formatDistance(lengthInMeters)); textDistance.setTypeface(IbikeApplication.getBoldFont()); int imageResource = args.getInt("directionImageResource", -1); imgDirectionIcon.setImageResource(imageResource); imgDirectionIcon.invalidate(); if (args.getBoolean("isFirst", false)) imgLeftArrow.setVisibility(View.GONE); else imgLeftArrow.setVisibility(View.VISIBLE); // arrows are invinsible in maximized view by default if (args.getBoolean("isLast", false)) imgRightArrow.setVisibility(View.GONE); else imgRightArrow.setVisibility(View.VISIBLE); } }
From source file:com.chrynan.guitartuner.PitchFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); note = (Note) args.getSerializable("note"); x = args.getFloat("x", -1); y = args.getFloat("y", -1); }
From source file:com.android.screenspeak.eventprocessor.ProcessorEventQueue.java
/** * Provides feedback for the specified utterance. * * @param queueMode The queueMode of the Utterance. * @param utterance The utterance to provide feedback for. *//*from w ww.j ava 2s.c o m*/ private void provideFeedbackForUtterance(int queueMode, Utterance utterance) { final Bundle metadata = utterance.getMetadata(); final float earconRate = metadata.getFloat(Utterance.KEY_METADATA_EARCON_RATE, 1.0f); final float earconVolume = metadata.getFloat(Utterance.KEY_METADATA_EARCON_VOLUME, 1.0f); final Bundle nonSpeechMetadata = new Bundle(); nonSpeechMetadata.putFloat(Utterance.KEY_METADATA_EARCON_RATE, earconRate); nonSpeechMetadata.putFloat(Utterance.KEY_METADATA_EARCON_VOLUME, earconVolume); // Retrieve and play all spoken text. final CharSequence textToSpeak = StringBuilderUtils.getAggregateText(utterance.getSpoken()); final int flags = metadata.getInt(Utterance.KEY_METADATA_SPEECH_FLAGS, 0); final Bundle speechMetadata = metadata.getBundle(Utterance.KEY_METADATA_SPEECH_PARAMS); final int utteranceGroup = utterance.getMetadata().getInt(Utterance.KEY_UTTERANCE_GROUP, SpeechController.UTTERANCE_GROUP_DEFAULT); mSpeechController.speak(textToSpeak, utterance.getAuditory(), utterance.getHaptic(), queueMode, flags, utteranceGroup, speechMetadata, nonSpeechMetadata); }
From source file:nz.ac.auckland.lablet.script.components.ScriptComponentPotentialEnergy1View.java
@Override public boolean fromBundle(Bundle bundle) { mass = bundle.getFloat("mass", 1.f); height = bundle.getFloat("height", 0.f); energy = bundle.getFloat("energy"); pbjValue = bundle.getFloat("pbjValue"); return super.fromBundle(bundle); }
From source file:com.android.talkback.eventprocessor.ProcessorEventQueue.java
/** * Provides feedback for the specified utterance. * * @param queueMode The queueMode of the Utterance. * @param utterance The utterance to provide feedback for. *//*from w w w .j ava 2 s .c o m*/ private void provideFeedbackForUtterance(int queueMode, Utterance utterance) { final Bundle metadata = utterance.getMetadata(); final float earconRate = metadata.getFloat(Utterance.KEY_METADATA_EARCON_RATE, 1.0f); final float earconVolume = metadata.getFloat(Utterance.KEY_METADATA_EARCON_VOLUME, 1.0f); final Bundle nonSpeechMetadata = new Bundle(); nonSpeechMetadata.putFloat(Utterance.KEY_METADATA_EARCON_RATE, earconRate); nonSpeechMetadata.putFloat(Utterance.KEY_METADATA_EARCON_VOLUME, earconVolume); // Perform cleanup of spoken text for each separate part of the utterance, e.g. we do not // want to combine repeated characters if they span different parts, and we still want to // expand single-character symbols if a certain part is a single character. final SpannableStringBuilder textToSpeak = new SpannableStringBuilder(); for (CharSequence text : utterance.getSpoken()) { if (!TextUtils.isEmpty(text)) { CharSequence processedText = SpeechCleanupUtils.collapseRepeatedCharactersAndCleanUp(mContext, text); StringBuilderUtils.appendWithSeparator(textToSpeak, processedText); } } // Get speech settings from utterance. final int flags = metadata.getInt(Utterance.KEY_METADATA_SPEECH_FLAGS, 0); final Bundle speechMetadata = metadata.getBundle(Utterance.KEY_METADATA_SPEECH_PARAMS); final int utteranceGroup = utterance.getMetadata().getInt(Utterance.KEY_UTTERANCE_GROUP, SpeechController.UTTERANCE_GROUP_DEFAULT); mSpeechController.speak(textToSpeak, utterance.getAuditory(), utterance.getHaptic(), queueMode, flags, utteranceGroup, speechMetadata, nonSpeechMetadata); }
From source file:can.yrt.onebusaway.map.StopsRequest.java
@Override public void setState(Bundle args) { if (args != null) { Location center = null;/*from ww w . jav a 2s .c om*/ float mapZoom = args.getFloat(MapParams.ZOOM, MapParams.DEFAULT_ZOOM); double lat = args.getDouble(MapParams.CENTER_LAT); double lon = args.getDouble(MapParams.CENTER_LON); if (lat != 0.0 && lon != 0.0) { center = LocationHelp.makeLocation(lat, lon); } mFragment.getMapView().setZoom((float) mapZoom); if (center != null) { mFragment.getMapView().setMapCenter(center); onLocation(); } else { mFragment.setMyLocation(); } } else { mFragment.setMyLocation(); } }
From source file:com.joulespersecond.seattlebusbot.map.StopsRequest.java
@Override public void setState(Bundle args) { if (args != null) { Location center = null;/*from ww w . ja va 2 s . c o m*/ float mapZoom = args.getFloat(MapParams.ZOOM, MapParams.DEFAULT_ZOOM); double lat = args.getDouble(MapParams.CENTER_LAT); double lon = args.getDouble(MapParams.CENTER_LON); if (lat != 0.0 && lon != 0.0) { center = LocationHelp.makeLocation(lat, lon); } mFragment.getMapView().setZoom(mapZoom); if (center != null) { mFragment.getMapView().setMapCenter(center); onLocation(); } else { mFragment.setMyLocation(); } } else { mFragment.setMyLocation(); } }
From source file:org.onebusaway.android.map.StopsRequest.java
@Override public void setState(Bundle args) { if (args != null) { Location center = null;/*from www. j av a2 s . c o m*/ float mapZoom = args.getFloat(MapParams.ZOOM, MapParams.DEFAULT_ZOOM); double lat = args.getDouble(MapParams.CENTER_LAT); double lon = args.getDouble(MapParams.CENTER_LON); if (lat != 0.0 && lon != 0.0) { center = LocationUtils.makeLocation(lat, lon); } mCallback.getMapView().setZoom(mapZoom); if (center != null) { mCallback.getMapView().setMapCenter(center, false, false); onLocation(); } else { mCallback.setMyLocation(false, false); } } else { mCallback.setMyLocation(false, false); } }
From source file:au.id.tedp.mapdroid.Picker.java
private MapLocation getInitialLocation(Bundle savedState) { double newLat, newLong; int newZoom;//from w w w . java2s.co m // Default location: Germany, from a high zoom level. // OpenStreetMap is big in Germany. newLat = 52.5; newLong = 13.4; newZoom = 2; SharedPreferences settings = getPreferences(MODE_PRIVATE); if (savedState != null) { newLat = savedState.getFloat(SAVED_LATITUDE_KEY, (float) newLat); newLong = savedState.getFloat(SAVED_LONGITUDE_KEY, (float) newLong); newZoom = savedState.getInt(SAVED_ZOOM_KEY, newZoom); } else if (settings != null) { newLat = settings.getFloat(SAVED_LATITUDE_KEY, (float) newLat); newLong = settings.getFloat(SAVED_LONGITUDE_KEY, (float) newLong); newZoom = settings.getInt(SAVED_ZOOM_KEY, newZoom); } MapLocation l = new MapLocation(new Location("default"), newZoom); l.setLatitude(newLat); l.setLongitude(newLong); return l; }