List of usage examples for android.os Bundle putDouble
public void putDouble(@Nullable String key, double value)
From source file:com.roque.rueda.cashflows.fragments.AddMovementFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Log.v(TAG, "In fragment save instance state"); // Store amount. outState.putDouble(AMOUNT_KEY, getInputAmount()); // Store selected account. outState.putInt(ACCOUNT_KEY, mAccountsSpinner.getSelectedItemPosition()); // Store date. outState.putLong(DATE_KEY, getInputDate()); // Store notes. outState.putString(NOTES_KEY, getInputNotes()); }
From source file:fr.cph.chicago.activity.BusBoundActivity.java
@Override public final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); ChicagoTracker.checkBusData(this); if (!this.isFinishing()) { setContentView(R.layout.activity_bus_bound); if (mBusRouteId == null && mBusRouteName == null && mBound == null) { mBusRouteId = getIntent().getExtras().getString("busRouteId"); mBusRouteName = getIntent().getExtras().getString("busRouteName"); mBound = getIntent().getExtras().getString("bound"); }/*from w w w. j av a 2 s. c om*/ mAdapter = new BusBoundAdapter(mBusRouteId); setListAdapter(mAdapter); getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { BusStop busStop = (BusStop) mAdapter.getItem(position); Intent intent = new Intent(ChicagoTracker.getAppContext(), BusActivity.class); Bundle extras = new Bundle(); extras.putInt("busStopId", busStop.getId()); extras.putString("busStopName", busStop.getName()); extras.putString("busRouteId", mBusRouteId); extras.putString("busRouteName", mBusRouteName); extras.putString("bound", mBound); extras.putDouble("latitude", busStop.getPosition().getLatitude()); extras.putDouble("longitude", busStop.getPosition().getLongitude()); intent.putExtras(extras); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); overridePendingTransition(R.anim.slide_in, R.anim.slide_out); } }); EditText filter = (EditText) findViewById(R.id.bus_filter); filter.addTextChangedListener(new TextWatcher() { List<BusStop> busStopsFiltered; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { busStopsFiltered = new ArrayList<BusStop>(); } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { for (BusStop busStop : mBusStops) { if (StringUtils.containsIgnoreCase(busStop.getName(), s)) { this.busStopsFiltered.add(busStop); } } } @Override public void afterTextChanged(Editable s) { mAdapter.update(busStopsFiltered); mAdapter.notifyDataSetChanged(); } }); getActionBar().setDisplayHomeAsUpEnabled(true); new BusBoundAsyncTask().execute(); // Preventing keyboard from moving background when showing up getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); } }
From source file:csci310.parkhere.ui.activities.ProviderActivity.java
@Override public void onReservationSelected(int resPosition, boolean ifNotPassed) { System.out.println("ProviderActivity onReservationSelected for: " + resPosition); if (clientController.providerReservations.size() == 0) { System.out.println("ProviderActivity: error - no providerReservations to select"); return;// w w w . ja va 2 s .co m } Reservation selectedRes = clientController.providerReservations.get(resPosition); if (selectedRes == null) { System.out.println("Selected parking spot is null"); return; } ProviderReservationDetailFragment resDetailfragment = new ProviderReservationDetailFragment(); Bundle args = new Bundle(); args.putDouble("LAT", selectedRes.getSpot().getLat()); args.putDouble("LONG", selectedRes.getSpot().getLon()); args.putString("ADDRESS", selectedRes.getSpot().getStreetAddr()); Time startTime = selectedRes.getReserveTimeInterval().startTime; Time endTime = selectedRes.getReserveTimeInterval().endTime; Time displayStartTime = new Time(startTime.year, startTime.month, startTime.dayOfMonth, startTime.hourOfDay, startTime.minute, startTime.second); Time displayEndTime = new Time(endTime.year, endTime.month, endTime.dayOfMonth, endTime.hourOfDay, endTime.minute, endTime.second); displayStartTime.month += 1; displayEndTime.month += 1; args.putString("START_TIME", displayStartTime.toString()); args.putString("END_TIME", displayEndTime.toString()); args.putLong("RENTER", selectedRes.getRenterID()); args.putLong("RES_ID", selectedRes.getReservationID()); // if(selectedRes.review==null && !ifNotPassed) { // args.putBoolean("IF_CANREVIEW", true); // } // else { // args.putBoolean("IF_CANREVIEW", false); // } // args.putBoolean("IF_CANCANCEL", ifNotPassed); // args.putBoolean("IF_ISPAID", selectedRes.isPaid()); resDetailfragment.setArguments(args); try { getSupportFragmentManager().beginTransaction().replace(R.id.fragContainer, resDetailfragment).commit(); } catch (Exception e) { System.out.println("ProviderActivity onReservationSelected exception"); } }
From source file:com.androzic.MainActivity.java
@Override public void onWaypointShow(Waypoint waypoint) { Location loc = application.getLocationAsLocation(); FragmentManager fm = getSupportFragmentManager(); WaypointInfo waypointInfo = (WaypointInfo) fm.findFragmentByTag("waypoint_info"); if (waypointInfo == null) waypointInfo = new WaypointInfo(); waypointInfo.setWaypoint(waypoint);//from w ww .ja v a 2 s . c om Bundle args = new Bundle(); args.putDouble("lat", loc.getLatitude()); args.putDouble("lon", loc.getLongitude()); waypointInfo.setArguments(args); waypointInfo.show(fm, "waypoint_info"); }
From source file:com.androzic.MainActivity.java
@Override public void onWaypointDetails(Waypoint waypoint) { Location loc = application.getLocationAsLocation(); FragmentManager fm = getSupportFragmentManager(); WaypointDetails waypointDetails = (WaypointDetails) fm.findFragmentByTag("waypoint_details"); if (waypointDetails == null) waypointDetails = new WaypointDetails(); waypointDetails.setWaypoint(waypoint); Bundle args = new Bundle(); args.putDouble("lat", loc.getLatitude()); args.putDouble("lon", loc.getLongitude()); waypointDetails.setArguments(args);/*from www. ja v a2s . c o m*/ addFragment(waypointDetails, "waypoint_details"); }
From source file:edu.umb.subway.DialogActivity.java
/** * Takes in Json data and parse it to usable information for this app purpose * * @param jsonObject/*from ww w .j av a 2s . c om*/ */ public void parseJSONObject(JSONObject jsonObject) { try { String direction = "", destination = ""; int color = 0; StopInformation si; FragmentManager fm = getSupportFragmentManager(); StationInfoFragment stationFrag; stopInformationList.clear(); JSONArray modeArray = jsonObject.getJSONArray("mode"); int count = 0; for (int modeCounter = 0; modeCounter < modeArray.length(); modeCounter++) { String mode = jsonObject.getJSONArray("mode").getJSONObject(modeCounter).getString("mode_name") .toString(); if (mode.equalsIgnoreCase("subway")) { JSONArray jsonRoute = jsonObject.getJSONArray("mode").getJSONObject(modeCounter) .getJSONArray("route"); for (int routeCounter = 0; routeCounter < jsonRoute.length(); routeCounter++) { color = getColor(jsonRoute.getJSONObject(routeCounter).getString("route_id").toLowerCase()); JSONArray jsonDirection = jsonRoute.getJSONObject(routeCounter).getJSONArray("direction"); for (int directionCounter = 0; directionCounter < jsonDirection .length(); directionCounter++) { JSONArray jsonTrip = jsonDirection.getJSONObject(directionCounter).getJSONArray("trip"); direction = jsonDirection.getJSONObject(directionCounter).getInt("direction_id") == 0 ? Properties.OUTBOUND : Properties.INBOUND; for (int tripCounter = 0; tripCounter < jsonTrip.length(); tripCounter++) { String addDestination = ""; if (jsonTrip.getJSONObject(tripCounter).getString("trip_headsign") .contains("Alewife") && jsonTrip.getJSONObject(tripCounter).getString("trip_name") .contains("from Braintree") && stationName.contains("JFK")) addDestination = "(Braintree)"; else if (jsonTrip.getJSONObject(tripCounter).getString("trip_headsign") .contains("Alewife") && jsonTrip.getJSONObject(tripCounter).getString("trip_name") .contains("from Ashmont") && stationName.contains("JFK")) addDestination = "(Ashmont)"; destination = jsonTrip.getJSONObject(tripCounter).getString("trip_headsign") + addDestination + direction; if (!StopInformation.checkDuplicateDestination(stopInformationList, destination)) { double curLat = 0, curLon = 0; try { JSONObject vehicleArray = jsonTrip.getJSONObject(tripCounter) .getJSONObject("vehicle"); curLat = jsonTrip.getJSONObject(tripCounter).getJSONObject("vehicle") .getDouble("vehicle_lat"); curLon = jsonTrip.getJSONObject(tripCounter).getJSONObject("vehicle") .getDouble("vehicle_lon"); } catch (Exception e) { //continue; } si = new StopInformation(stationId, stationName, destination, jsonTrip.getJSONObject(tripCounter).getInt("pre_away"), color, false, curLat != 0 ? distance(curLat, curLon, desLat, desLon) : 0, 2); stopInformationList.add(si); stationFrag = new StationInfoFragment(); Bundle bundle = new Bundle(); bundle.putString("station_id", si.getStationId()); bundle.putString("station_name", si.getStationName()); bundle.putString("destination", si.getDestination()); bundle.putInt("timeAway", si.getTimeAway()); bundle.putDouble("distanceAway", si.getDistanceAway()); bundle.putInt("remStop", si.getRemainingStop()); bundle.putInt("color", si.getColor()); bundle.putBoolean("favorite", si.isFavorite()); //set Fragmentclass Arguments stationFrag.setArguments(bundle); if (count == 0) fm.beginTransaction() .replace(R.id.station_fragment_one, stationFrag, "Station_one") .commit(); else if (count == 1) fm.beginTransaction() .replace(R.id.station_fragment_two, stationFrag, "Station_two") .commit(); else if (count == 2) fm.beginTransaction() .replace(R.id.station_fragment_three, stationFrag, "Station_three") .commit(); else if (count == 3) fm.beginTransaction() .replace(R.id.station_fragment_four, stationFrag, "Station_four") .commit(); else if (count == 4) fm.beginTransaction() .replace(R.id.station_fragment_five, stationFrag, "Station_five") .commit(); else if (count == 5) fm.beginTransaction() .replace(R.id.station_fragment_six, stationFrag, "Station_six") .commit(); else if (count == 6) fm.beginTransaction() .replace(R.id.station_fragment_seven, stationFrag, "Station_seven") .commit(); else if (count == 7) fm.beginTransaction() .replace(R.id.station_fragment_eight, stationFrag, "Station_eight") .commit(); count++; } } } } } stationInfoTextView.setVisibility(View.GONE); } if (stopInformationList.size() == 0) { stationInfoTextView.setText("One/No Subway schedule available. See alerts!"); stationInfoTextView.setVisibility(View.VISIBLE); } jsonString = jsonObject.getJSONArray("alert_headers").toString(); } catch (Exception e) { Log.v("Error JSON parse", e.getMessage()); } }
From source file:org.openpilot_nonag.androidgcs.fragments.Map.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Log.d(TAG, "*** onSaveInstanceState"); if (mMap != null) { CameraPosition camPos = mMap.getCameraPosition(); LatLng lla = camPos.target;/*from www. j a v a 2 s . c o m*/ outState.putDouble("org.openpilot.map_lat", lla.latitude); outState.putDouble("org.openpilot.map_lon", lla.longitude); outState.putDouble("org.openpilot.cam_zoom", camPos.zoom); } }
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:org.mozilla.mozstumbler.client.mapview.MapFragment.java
@Override public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putInt(ZOOM_KEY, mMap.getZoomLevel()); IGeoPoint center = mMap.getMapCenter(); bundle.putDouble(LON_KEY, center.getLongitude()); bundle.putDouble(LAT_KEY, center.getLatitude()); saveStateToPrefs();// w w w.j a va2 s. c o m }
From source file:tw.idv.palatis.danboorugallery.SettingsActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(KEY_CACHE_SIZE_CALCULATED, mCacheSizeCalculated); outState.putDouble(KEY_CACHE_SIZE, mCacheSize); outState.putDouble(KEY_CACHE_SIZE_MAX, mMaxCacheSize); outState.putDouble(KEY_MEM_CACHE_SIZE, mMemCacheSize); outState.putDouble(KEY_MEM_CACHE_SIZE_MAX, mMaxMemCacheSize); outState.putInt(KEY_POST_COUNT, mPostCount); }