pl.charmas.android.reactivelocation.ReactiveLocationProvider Java Examples

The following examples show how to use pl.charmas.android.reactivelocation.ReactiveLocationProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EstablishmentInteractorImpl.java    From Saude-no-Mapa with MIT License 6 votes vote down vote up
@Override
public void requestUserUf(Double lat, Double lng, StringListener listener) {
    ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(mContext);
    locationProvider.getReverseGeocodeObservable(lat, lng, 1)
            .retry(10)
            .subscribeOn(Schedulers.computation())
            .observeOn(AndroidSchedulers.mainThread())
            .onErrorReturn(throwable1 -> new ArrayList<>())
            .subscribe(addresses -> {
                if (addresses != null && !addresses.isEmpty()) {
                    String addressLine = addresses.get(0).getAddressLine(1);
                    if (addressLine.contains("-")) {
                        listener.onNext(getUfFromAddress(addressLine));
                    } else {
                        listener.onNext(addressLine);
                    }
                }
            });
}
 
Example #2
Source File: EmergencyInteractorImpl.java    From Saude-no-Mapa with MIT License 6 votes vote down vote up
@Override
public void requestUserUf(Double lat, Double lng, StringListener listener) {
    ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(mContext);
    locationProvider.getReverseGeocodeObservable(lat, lng, 1)
            .retry(10)
            .subscribeOn(Schedulers.computation())
            .observeOn(AndroidSchedulers.mainThread())
            .onErrorReturn(throwable1 -> new ArrayList<>())
            .subscribe(addresses -> {
                if (addresses != null) {
                    String addressLine = addresses.get(0).getAddressLine(1);
                    if (addressLine.contains("-")) {
                        listener.onNext(getUfFromAddress(addressLine));
                    } else {
                        listener.onNext(addressLine);
                    }
                }
            });
}
 
Example #3
Source File: EstablishmentInteractorImpl.java    From Saude-no-Mapa with MIT License 5 votes vote down vote up
@Override
public void requestMyLocation(OnLocationFound listener) {
    ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(mContext);
    locationProvider.getLastKnownLocation()
            .retry(10)
            .subscribe(listener::onLocationFound);
}
 
Example #4
Source File: EmergencyInteractorImpl.java    From Saude-no-Mapa with MIT License 5 votes vote down vote up
@Override
public void requestMyLocation(OnLocationFound listener) {
    ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(mContext);
    locationProvider.getLastKnownLocation()
            .retry(10)
            .subscribe(listener::onLocationFound);
}
 
Example #5
Source File: RxLocationSettings.java    From android-rxlocationsettings with Apache License 2.0 4 votes vote down vote up
private RxLocationSettings(@NonNull FragmentActivity activity) {
  rxLocationProvider = new ReactiveLocationProvider(activity.getApplication());
  resolutionFragment = ResolutionFragment.from(activity.getSupportFragmentManager());
}
 
Example #6
Source File: RxLocation.java    From ratebeer with GNU General Public License v3.0 4 votes vote down vote up
public RxLocation(Context context) {
	provider = new ReactiveLocationProvider(context);
}