List of usage examples for android.os Bundle putFloat
@Override public void putFloat(@Nullable String key, float value)
From source file:com.app.uafeed.fragment.EntryFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putParcelable(STATE_BASE_URI, mBaseUri); outState.putLongArray(STATE_ENTRIES_IDS, mEntriesIds); outState.putLong(STATE_INITIAL_ENTRY_ID, mInitialEntryId); outState.putInt(STATE_CURRENT_PAGER_POS, mCurrentPagerPos); outState.putFloat(STATE_SCROLL_PERCENTAGE, mEntryPagerAdapter.getScrollPercentage()); super.onSaveInstanceState(outState); }
From source file:com.mirasense.scanditsdk.plugin.ScanditSDK.java
private void setOptionsOnBundle(JSONObject options, Bundle bundle) { @SuppressWarnings("unchecked") Iterator<String> iter = (Iterator<String>) options.keys(); while (iter.hasNext()) { String key = iter.next(); Object obj = options.opt(key); if (obj != null) { if (obj instanceof Float) { bundle.putFloat(key.toLowerCase(), (Float) obj); } else if (obj instanceof Double) { bundle.putDouble(key.toLowerCase(), (Double) obj); } else if (obj instanceof Integer) { bundle.putInt(key.toLowerCase(), (Integer) obj); } else if (obj instanceof Boolean) { bundle.putBoolean(key.toLowerCase(), (Boolean) obj); } else if (obj instanceof String) { bundle.putString(key.toLowerCase(), (String) obj); }/* w w w . j a v a 2s .co m*/ } } }
From source file:org.navitproject.navit.Navit.java
void setDestination(float latitude, float longitude, String address) { Toast.makeText(getApplicationContext(), getString(R.string.address_search_set_destination) + "\n" + address, Toast.LENGTH_LONG).show(); //TRANS Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal()); Bundle b = new Bundle(); b.putFloat("lat", latitude); b.putFloat("lon", longitude); b.putString("q", address); msg.setData(b);//from w w w . j av a 2s . c o m msg.sendToTarget(); }
From source file:com.glanznig.beepme.view.ExportActivity.java
@Override public void onSaveInstanceState(Bundle savedState) { savedState.putBoolean("rawExport", rawExport); savedState.putBoolean("photoExport", photoExport); savedState.putInt("postActionItem", postActions.getSelectedItemPosition() + 1); savedState.putInt("densityItem", downscalePhotos.getSelectedItemPosition() + 1); savedState.putDouble("photoAvgSize", photoAvgSize); savedState.putFloat("photoAvgDensity", photoAvgDensity); }
From source file:com.bydavy.card.receipts.fragments.ReceiptEditFragment.java
@Override public void onSaveInstanceState(Bundle outState) { if (getState() == StateFragmentListener.STATE_COMPLETED) { outState.putBoolean(STATE_SAVED_DATA, true); outState.putBoolean(STATE_VALID_RECEIPT, mValidReceipt); if (mValidReceipt) { // TODO Save and restore only edited fields (others must come // from db) outState.putString(STATE_SHOP, mViewShop.getText().toString()); outState.putLong(STATE_DATE, mDate.getTimeInMillis()); outState.putString(STATE_NOTE, STATE_NOTE); try { outState.putFloat(STATE_TOTAL, Float.valueOf(mViewTotal.getText().toString())); } catch (final NumberFormatException e) { /* Nothing */ }//w w w . jav a 2s . c o m } } super.onSaveInstanceState(outState); }
From source file:com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.java
private void updateMediaSessionPlaybackState() { PlaybackStateCompat.Builder builder = new PlaybackStateCompat.Builder(); if (player == null) { builder.setActions(buildPlaybackActions()).setState(PlaybackStateCompat.STATE_NONE, 0, 0, 0); mediaSession.setPlaybackState(builder.build()); return;/*from w w w. ja v a 2s. co m*/ } Map<String, CustomActionProvider> currentActions = new HashMap<>(); for (CustomActionProvider customActionProvider : customActionProviders) { PlaybackStateCompat.CustomAction customAction = customActionProvider.getCustomAction(); if (customAction != null) { currentActions.put(customAction.getAction(), customActionProvider); builder.addCustomAction(customAction); } } customActionMap = Collections.unmodifiableMap(currentActions); int sessionPlaybackState = playbackException != null ? PlaybackStateCompat.STATE_ERROR : mapPlaybackState(player.getPlaybackState(), player.getPlayWhenReady()); if (playbackException != null) { if (errorMessageProvider != null) { Pair<Integer, String> message = errorMessageProvider.getErrorMessage(playbackException); builder.setErrorMessage(message.first, message.second); } if (player.getPlaybackState() != Player.STATE_IDLE) { playbackException = null; } } long activeQueueItemId = queueNavigator != null ? queueNavigator.getActiveQueueItemId(player) : MediaSessionCompat.QueueItem.UNKNOWN_ID; Bundle extras = new Bundle(); extras.putFloat(EXTRAS_PITCH, player.getPlaybackParameters().pitch); builder.setActions(buildPlaybackActions()).setActiveQueueItemId(activeQueueItemId) .setBufferedPosition(player.getBufferedPosition()) .setState(sessionPlaybackState, player.getCurrentPosition(), player.getPlaybackParameters().speed, SystemClock.elapsedRealtime()) .setExtras(extras); mediaSession.setPlaybackState(builder.build()); }
From source file:com.example.orangeweather.JSONWeatherParser.java
public static Bundle getWeather(JSONObject jObj) throws JSONException { Bundle bundle = new Bundle(); JSONObject coordObj = getObject("coord", jObj); bundle.putString(CityTags.CITY_NAME, getString("name", jObj)); bundle.putInt(CityTags.CITY_ID, getInt("id", jObj)); bundle.putInt(WeatherTags.WEATHER_DT, getInt("dt", jObj)); bundle.putString(CityTags.CITY_COORD, getDMSCoordinates(getFloat("lat", coordObj), getFloat("lon", coordObj))); JSONObject sysObj = getObject("sys", jObj); bundle.putString(CityTags.CITY_SYS_COUNTRY, getString("country", sysObj)); if (sysObj.has("sunrise")) { bundle.putInt(WeatherTags.WEATHER_SYS_SUNRISE, getInt("sunrise", sysObj)); }/*from w w w . j a v a 2s.c om*/ if (sysObj.has("sunset")) { bundle.putInt(WeatherTags.WEATHER_SYS_SUNSET, getInt("sunset", sysObj)); } JSONArray jArr = jObj.getJSONArray("weather"); JSONObject JSONWeather = jArr.getJSONObject(0); bundle.putString(WeatherTags.WEATHER_CONDITION_DESC, getString("description", JSONWeather)); bundle.putString(WeatherTags.WEATHER_CONDITION_MAIN, getString("main", JSONWeather)); JSONObject mainObj = getObject("main", jObj); bundle.putInt(WeatherTags.WEATHER_MAIN_HUMIDITY, getInt("humidity", mainObj)); bundle.putInt(WeatherTags.WEATHER_MAIN_PRESSURE, getInt("pressure", mainObj)); bundle.putString(WeatherTags.WEATHER_MAIN_TEMP_MAX, getTemperatureString(getFloat("temp_max", mainObj))); bundle.putString(WeatherTags.WEATHER_MAIN_TEMP_MIN, getTemperatureString(getFloat("temp_min", mainObj))); bundle.putString(WeatherTags.WEATHER_MAIN_TEMP, getTemperatureString(getFloat("temp", mainObj))); JSONObject wObj = getObject("wind", jObj); bundle.putFloat(WeatherTags.WEATHER_WIND_SPEED, getFloat("speed", wObj)); bundle.putInt(WeatherTags.WEATHER_WIND_DEG, getInt("deg", wObj)); if (wObj.has("var_beg")) { bundle.putInt(WeatherTags.WEATHER_WIND_VAR_BEG, getInt("var_beg", wObj)); } if (wObj.has("var_end")) { bundle.putInt(WeatherTags.WEATHER_WIND_VAR_END, getInt("var_end", wObj)); } JSONObject cObj = getObject("clouds", jObj); bundle.putInt(WeatherTags.WEATHER_CLOUDS_ALL, getInt("all", cObj)); return bundle; }
From source file:com.spoiledmilk.ibikecph.controls.InstructionsPagerAdapter.java
@Override public Fragment getItem(int position) { DirectionCellFragment dcf = new DirectionCellFragment(); Bundle args = new Bundle(); SMTurnInstruction turn = mapFragment.route.getTurnInstructions().get(position); String wayname = ""; if (turn.drivingDirection == SMTurnInstruction.TurnDirection.ReachingDestination) { wayname = IbikeApplication.getString("direction_100"); } else if (turn.drivingDirection == SMTurnInstruction.TurnDirection.ReachedYourDestination) { wayname = IbikeApplication.getString("direction_15"); } else if (turn.drivingDirection == SMTurnInstruction.TurnDirection.Station) { wayname = turn.wayName;//from ww w .j a v a2 s . c o m } else { if (specialWaynamePattern.matcher(turn.wayName).matches()) { wayname = IbikeApplication.getString(turn.wayName); } else { wayname = turn.wayName; } } wayname = turn.getPrefix() + wayname; args.putString("wayName", wayname); args.putFloat("lengthInMeters", turn.lengthInMeters); args.putInt("directionImageResource", getImageResource(turn)); if (position == 0) { args.putBoolean("isFirst", true); } if (position == mapFragment.route.getTurnInstructions().size() - 1) { args.putBoolean("isLast", true); } dcf.setArguments(args); return dcf; }
From source file:de.j4velin.mapsmeasure.Map.java
@Override protected void onSaveInstanceState(final Bundle outState) { outState.putSerializable("trace", trace); outState.putBoolean("metric", metric); if (mMap != null) { // might be null if there is an issue with Google // Play Services outState.putDouble("position-lon", mMap.getCameraPosition().target.longitude); outState.putDouble("position-lat", mMap.getCameraPosition().target.latitude); outState.putFloat("position-zoom", mMap.getCameraPosition().zoom); }//from w w w.j ava 2 s. com super.onSaveInstanceState(outState); }
From source file:org.onebusaway.android.report.ui.InfrastructureIssueActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putFloat(MapParams.ZOOM, mMapFragment.getMapView().getZoomLevelAsFloat()); ObaStop obaStop = mIssueLocationHelper.getObaStop(); if (obaStop != null) { String stopId = obaStop.getId(); getIntent().putExtra(MapParams.STOP_ID, stopId); outState.putString(MapParams.STOP_ID, stopId); outState.putString(MapParams.STOP_NAME, obaStop.getName()); outState.putString(MapParams.STOP_CODE, obaStop.getStopCode()); outState.putBoolean(SHOW_STOP_MARKER, true); }// w w w . j av a 2s . co m outState.putDouble(MapParams.CENTER_LAT, mIssueLocationHelper.getIssueLocation().getLatitude()); outState.putDouble(MapParams.CENTER_LON, mIssueLocationHelper.getIssueLocation().getLongitude()); SpinnerItem spinnerItem = (SpinnerItem) mServicesSpinner.getSelectedItem(); if (spinnerItem != null && (!spinnerItem.isHint() && !spinnerItem.isSection() || (spinnerItem.isHint() && mServicesSpinnerFrameLayout.getVisibility() == View.VISIBLE))) { Service service = ((ServiceSpinnerItem) spinnerItem).getService(); outState.putString(RESTORED_SERVICE, service.getService_name()); outState.putBoolean(SHOW_CATEGORIES, true); } if (isInfoVisible()) { String infoText = ((TextView) mInfoHeader.findViewById(R.id.ri_info_text)).getText().toString(); outState.putString(SHOW_INFO, infoText); } outState.putBoolean(ARRIVAL_LIST, mShowArrivalListFragment); outState.putBoolean(HEURISTIC_MATCH, mIsAllTransitHeuristicMatch); outState.putString(AGENCY_NAME, mAgencyName); outState.putString(SELECTED_SERVICE_TYPE, mTransitServiceIssueTypeWithoutStop); outState.putString(ACTION_BAR_TITLE, getTitle().toString()); }