List of usage examples for android.os Bundle getFloat
@Override public float getFloat(String key)
From source file:com.nextgis.ngm_clink_monitoring.dialogs.DistanceExceededDialog.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true);/* w w w. j a v a 2 s . c o m*/ if (null != savedInstanceState) { mObjectLayerName = savedInstanceState.getString(FoclConstants.OBJECT_LAYER_NAME); mDistance = savedInstanceState.getFloat(FoclConstants.DISTANCE); } GISApplication app = (GISApplication) getActivity().getApplication(); mGpsEventSource = app.getGpsEventSource(); if (null != mGpsEventSource) { mGpsEventSource.addListener(this); } FragmentManager fm = getActivity().getSupportFragmentManager(); CreateObjectFragment createObjectFragment = (CreateObjectFragment) fm .findFragmentByTag(FoclConstants.FRAGMENT_CREATE_OBJECT); if (null != createObjectFragment) { mOnRepeatClickedListener = createObjectFragment; mOnNewPointClickedListener = createObjectFragment; } }
From source file:uk.co.jarofgreen.cityoutdoors.UI.BrowseMapActivity.java
/** * This is where we can add markers or lines, add listeners or move the camera. * <p>// www . j a v a 2 s. c o m * This should only be called once and when we are sure that {@link #mMap} is not null. */ private void setUpMap() { // first, do we start at a certain point or do we start at the default bounds? boolean zoomed = false; Bundle extras = getIntent().getExtras(); if (extras != null) { Float lat = extras.getFloat("lat"); Float lng = extras.getFloat("lng"); Log.d("LOADMAP", Float.toString(lat)); Log.d("LOADMAP", Float.toString(lng)); if (lat != 0.0 && lng != 0.0) { map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 18)); zoomed = true; } } if (!zoomed) { // We can't call newLatLngBounds at this point, the map isn't sized and app crashes. // So first we set the map to our hard coded range so it's at least sensible. map.moveCamera( CameraUpdateFactory.newLatLngZoom(new LatLng(STARTING_LAT, STARTING_LNG), STARTING_ZOOM)); // now set up a handler to zoom to correct place a second later. This feels like a bad hack. Handler handler = new Handler(); final Runnable r = new Runnable() { public void run() { SharedPreferences settings = PreferenceManager .getDefaultSharedPreferences(BrowseMapActivity.this); float startingBoundsMaxLat = settings.getFloat("startingBoundsMaxLat", 0); float startingBoundsMinLat = settings.getFloat("startingBoundsMinLat", 0); float startingBoundsMaxLng = settings.getFloat("startingBoundsMaxLng", 0); float startingBoundsMinLng = settings.getFloat("startingBoundsMinLng", 0); if (!(startingBoundsMaxLat == 0 && startingBoundsMinLat == 0 && startingBoundsMaxLng == 0 && startingBoundsMinLng == 0)) { LatLng southwest = new LatLng(startingBoundsMinLat, startingBoundsMinLng); LatLng northeast = new LatLng(startingBoundsMaxLat, startingBoundsMaxLng); try { map.moveCamera(CameraUpdateFactory .newLatLngBounds(new LatLngBounds(southwest, northeast), 10)); } catch (Exception e) { // this feels like a bad hack, so if it crashes just ignore it. We will still be zoomed to sensible bounds. } } } }; handler.postDelayed(r, 250); } // icons Storage s = ((OurApplication) getApplication()).getStorage(); for (Collection collection : s.getCollections()) { // normal icon BitmapDescriptor icon = null; if (collection.getIconURL() != null) { if (collection.getIconURL().contains("park")) { icon = BitmapDescriptorFactory.fromResource(R.drawable.marker_park); } else if (collection.getIconURL().contains("tree")) { icon = BitmapDescriptorFactory.fromResource(R.drawable.marker_tree); } else if (collection.getIconURL().contains("monument")) { icon = BitmapDescriptorFactory.fromResource(R.drawable.marker_monument); } else if (collection.getIconURL().contains("wc")) { icon = BitmapDescriptorFactory.fromResource(R.drawable.marker_wc); } else if (collection.getIconURL().contains("play")) { icon = BitmapDescriptorFactory.fromResource(R.drawable.marker_playground); } } if (icon != null) { collectionIcons.put(collection.getId(), icon); } // question icon BitmapDescriptor questionIcon = null; if (collection.getQuestionIconURL() != null) { if (collection.getQuestionIconURL().contains("park")) { questionIcon = BitmapDescriptorFactory.fromResource(R.drawable.marker_park_question); } else if (collection.getQuestionIconURL().contains("tree")) { questionIcon = BitmapDescriptorFactory.fromResource(R.drawable.marker_tree_question); } else if (collection.getQuestionIconURL().contains("monument")) { questionIcon = BitmapDescriptorFactory.fromResource(R.drawable.marker_monument_question); } else if (collection.getQuestionIconURL().contains("play")) { questionIcon = BitmapDescriptorFactory.fromResource(R.drawable.marker_playground_question); } } if (questionIcon != null) { collectionQuestionIcons.put(collection.getId(), questionIcon); } else if (icon != null) { // if we don't have a question icon but we have a normal icon, just reuse that. collectionQuestionIcons.put(collection.getId(), icon); } } // markers map.setOnCameraChangeListener(new OnCameraChangeListener() { public void onCameraChange(CameraPosition position) { LatLngBounds bounds = BrowseMapActivity.this.map.getProjection().getVisibleRegion().latLngBounds; new MarkerTask(bounds.northeast.latitude, bounds.southwest.latitude, bounds.southwest.longitude, bounds.northeast.longitude).execute(true); } }); map.setOnInfoWindowClickListener(this); }
From source file:eu.geopaparazzi.library.core.dialogs.StrokeDashDialogFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle arguments = getArguments(); if (arguments != null) { mInitialDash = arguments.getFloatArray(PREFS_KEY_STROKEDASH); if (mInitialDash != null) { mCurrentDash = mInitialDash; }/* ww w . j av a 2 s .c om*/ mDashShift = arguments.getFloat(PREFS_KEY_STROKEDASHSHIFT); } }
From source file:com.example.hllut.app.Deprecated.MainActivity.java
/** * Parse the data received from the intent. Assign the total CO2 output to a * local variable and fill a local HashMap with the food categories and their CO2 output. *//*from www . j a v a 2s . c o m*/ private void parse(Bundle data) { String[] foodTypes = data.keySet().toArray(new String[data.size()]); for (String s : foodTypes) { if (s.matches("Total")) { total = data.getFloat(s); } else { float cO2 = data.getFloat(s); food.put(s, cO2); } } System.out.println(food); }
From source file:com.nextgis.mobile.InputPointActivity.java
@Override protected void onRestoreInstanceState(Bundle outState) { super.onRestoreInstanceState(outState); m_sCat = outState.getString("cat"); m_sSubCat = outState.getString("subcat"); m_fAzimuth = outState.getFloat("az"); m_fDist = outState.getFloat("dist"); m_sNote = outState.getString("note"); image_lst = outState.getStringArrayList("photos"); double[] adfAz = outState.getDoubleArray("photos_az"); for (int i = 0; i < adfAz.length; i++) { image_rotation.add(adfAz[i]);//from w w w .jav a 2 s. c om } }
From source file:com.openlocationcode.android.main.MainActivity.java
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); Log.i(TAG, "Restoring state"); if (savedInstanceState != null) { double mapCameraPositionLatitude = savedInstanceState.getDouble(MAP_CAMERA_POSITION_LATITUDE); double mapCameraPositionLongitude = savedInstanceState.getDouble(MAP_CAMERA_POSITION_LONGITUDE); float mapCameraPositionZoom = savedInstanceState.getFloat(MAP_CAMERA_POSITION_ZOOM); mMainPresenter.setMapCameraPosition(mapCameraPositionLatitude, mapCameraPositionLongitude, mapCameraPositionZoom);//from w w w.j ava 2 s. c om } }
From source file:com.meg7.emailer.ui.fragment.ProgressFragment.java
private void updateProgress() { float progressPercentage; int sentCount; int failedCount; Bundle args = getArguments(); if (args == null || !args.containsKey(ARGS_PROGRESS_PERCENTAGE) || !args.containsKey(ARGS_SENT_COUNT) || !args.containsKey(ARGS_FAILED_COUNT)) { progressPercentage = ProgressPreferenceUtils.getProgressPercentage(getActivity()); sentCount = ProgressPreferenceUtils.getSentCount(getActivity()); failedCount = ProgressPreferenceUtils.getFailedCount(getActivity()); } else {/*ww w . jav a 2s . co m*/ progressPercentage = args.getFloat(ARGS_PROGRESS_PERCENTAGE); sentCount = args.getInt(ARGS_SENT_COUNT); failedCount = args.getInt(ARGS_FAILED_COUNT); } // Update views. Activity activity = getActivity(); if (activity == null) { return; } mProgressPercentageTxt.setText(String.format("%.2f", progressPercentage) + "%"); mSentCountTxt.setText(String.valueOf(sentCount)); mFailedCountTxt.setText(String.valueOf(failedCount)); }
From source file:com.bydavy.card.receipts.fragments.ReceiptEditFragment.java
private void fromSavedStateToData(Bundle savedState) { mValidReceipt = savedState.getBoolean(STATE_VALID_RECEIPT); if (mValidReceipt) { mShop = savedState.getString(STATE_SHOP); mDate.setTimeInMillis(savedState.getLong(STATE_DATE)); mNote = savedState.getString(STATE_NOTE); mTotal = savedState.getFloat(STATE_TOTAL); }//w w w. jav a2s.com }
From source file:com.nextgis.mobile.map.MapBase.java
/** * Process message received by handler/* ww w. j av a 2s.co m*/ * * @param bundle A message payload */ protected void processMessage(Bundle bundle) { switch (bundle.getInt(BUNDLE_TYPE_KEY)) { case MSGTYPE_DRAWING_DONE: onLayerDrawFinished(bundle.getFloat(BUNDLE_DONE_KEY)); break; default: break; } }
From source file:com.aimfire.gallery.service.PhotoProcessor.java
@Override protected void onHandleIntent(Intent intent) { Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); /*//from ww w.j av a 2 s. c o m * Obtain the FirebaseAnalytics instance. */ mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); Bundle extras = intent.getExtras(); if (extras == null) { if (BuildConfig.DEBUG) Log.e(TAG, "onHandleIntent: error, wrong parameter"); return; } String filename1 = extras.getString("lname"); String filename2 = extras.getString("rname"); String creatorName = extras.getString("creator"); String creatorPhotoUrl = extras.getString("photo"); float scale = extras.getFloat(MainConsts.EXTRA_SCALE); int facing = extras.getInt(MainConsts.EXTRA_FACING); boolean isFrontCamera = (facing == Camera.CameraInfo.CAMERA_FACING_FRONT) ? true : false; String[] stereoPath = MediaScanner.getImgPairPaths(filename1, filename2); if (stereoPath == null) { /* * something seriously wrong here - can't find matching image */ if (BuildConfig.DEBUG) Log.e(TAG, "onHandleEvent: cannot locate stereo image pair"); reportError(MediaScanner.getProcessedSbsPath(filename1)); return; } if (BuildConfig.DEBUG) Log.d(TAG, "onHandleIntent:stereoPath[0]=" + stereoPath[0] + ",stereoPath[1]=" + stereoPath[1] + ",stereoPath[2]=" + stereoPath[2] + ",stereoPath[3]=" + stereoPath[3] + ",stereoPath[4]=" + stereoPath[4]); /* * now do auto alignment and store images as full width sbs jpgs. * original left/right images will be removed unless save flag * is set to true (for debugging) */ boolean[] success = new boolean[] { false, false }; try { success = p.getInstance().b(stereoPath[0], stereoPath[1], stereoPath[2], scale, isFrontCamera); } catch (RuntimeException e) { e.printStackTrace(); } if (!success[0]) { reportError(stereoPath[2]); } else { saveThumbnail(stereoPath[2], MainConsts.MEDIA_3D_THUMB_PATH + (new File(stereoPath[2])).getName()); MediaScanner.insertExifInfo(stereoPath[2], "name=" + creatorName + "photourl=" + creatorPhotoUrl); reportResult(stereoPath[2], success[1]); } File leftFrom = new File(stereoPath[0]); File rightFrom = new File(stereoPath[1]); if (!BuildConfig.DEBUG) { leftFrom.delete(); rightFrom.delete(); } else { File leftTo = new File(stereoPath[3]); File rightTo = new File(stereoPath[4]); leftFrom.renameTo(leftTo); rightFrom.renameTo(rightTo); } }