public void onClick (final @Nonnull View view) { locationFinder.start(); } };
/******************************************************************************************************************* * * When the activity is paused, the {@link LocationFinder} is stopped (e.g. to turn the GPS off). * ******************************************************************************************************************/ @Override protected void onPause() { super.onPause(); locationFinder.removePropertyChangeListener(locationFinderListener); locationFinder.stop(); }
public void onClick (final @Nonnull View view) { locationFinder.findAddress(); } };
final Range range = locationFinder.getRange(); etCoordinate.setText(locationPreferences.format(range)); btRecomputePlace.setEnabled(true); final Address address = (Address)locationFinder.getAddress(); final State state = locationFinder.getState(); final String providerName = locationFinder.getProviderName(); buffer.append((providerName != null) ? providerName : "no provider"); switch (locationFinder.getProviderStatus())
/******************************************************************************************************************* * * When the activity is resumed, the {@link LocationFinder} is eventually reactivated; the UI is updated for some * things in the UI that might have been changed after new settings in the preferences. * ******************************************************************************************************************/ @Override protected void onResume() { super.onResume(); // here, so you can detect the locale change map.clear(); map.put(State.COMPUTING_RANGE, getMessage(_, "computingRange")); map.put(State.SEARCHING_FOR_ADDRESS, getMessage(_, "placeSearchInProgress")); map.put(State.IDLE, ""); final boolean geoCodingEnabled = locationFinder.isAddressSearchEnabled(); findViewById(R.id.tvGeocodingDisabled).setVisibility(AndroidUtilities.visibility(!geoCodingEnabled)); btRecomputePlace.setVisibility(AndroidUtilities.visibility(geoCodingEnabled)); // btRecomputePlace.setEnabled(locationFinder.isAddressSearchEnabled()); locationFinder.addPropertyChangeListener(locationFinderListener); // locationFinder.start(); // pre-started by ObservationsActivity updateDisplay(); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ public void cancelNewObservation() { ThreadAssertions.assertThread(UI); log.info("cancelNewObservation()"); locationFinder.stop(); // we pre-started it view.notifyNewObservationCancelled(notification().withText(_, "addedNewObservationCancelled")); }
/******************************************************************************************************************* * * Adds the picked location to the {@link Observation} being built in the {@link ObservationClipboard}. * ******************************************************************************************************************/ private void commitLocation() { final List<Object> capabilities = new ArrayList<Object>(); capabilities.add(new DefaultDisplayable(etPlace.getText().toString(), "SimpleLocation")); try { capabilities.add(locationFinder.getRange()); } catch (NotFoundException e) { } final Location location = new SimpleLocation(capabilities.toArray()); // FIXME: use observationSet.findOrCreate() final ObservationClipboard observationClipboard = Locator.find(ObservationClipboard.class); final Observation.Builder builder = observationClipboard.getBuilder(); observationClipboard.setBuilder(builder.at(location)); controlFlow.toNextStep(); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ public void startNewObservationSequence() { ThreadAssertions.assertThread(UI); log.info("startNewObservationSequence()"); observationClipboard.clear(); final Builder builder = observationClipboard.getBuilder(); observationClipboard.setBuilder(builder.at(Calendar.getInstance().getTime())); locationFinder.start(); // search needs time, and we pre-start it }