use of pl.charmas.android.reactivelocation.sample.utils.DisplayTextOnViewAction in project Android-ReactiveLocation by mcharmas.
the class MainActivity method onLocationPermissionGranted.
@Override
protected void onLocationPermissionGranted() {
lastKnownLocationSubscription = lastKnownLocationObservable.map(new LocationToStringFunc()).subscribe(new DisplayTextOnViewAction(lastKnownLocationView), new ErrorHandler());
updatableLocationSubscription = locationUpdatesObservable.map(new LocationToStringFunc()).map(new Func1<String, String>() {
int count = 0;
@Override
public String call(String s) {
return s + " " + count++;
}
}).subscribe(new DisplayTextOnViewAction(updatableLocationView), new ErrorHandler());
addressSubscription = addressObservable.subscribe(new DisplayTextOnViewAction(addressLocationView), new ErrorHandler());
activitySubscription = activityObservable.map(new ToMostProbableActivity()).map(new DetectedActivityToString()).subscribe(new DisplayTextOnViewAction(currentActivityView), new ErrorHandler());
}
use of pl.charmas.android.reactivelocation.sample.utils.DisplayTextOnViewAction in project Android-ReactiveLocation by mcharmas.
the class MockLocationsActivity method onLocationPermissionGranted.
@Override
protected void onLocationPermissionGranted() {
mockModeToggleButton.setChecked(true);
final LocationRequest locationRequest = LocationRequest.create().setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY).setInterval(2000);
updatedLocationSubscription = locationProvider.getUpdatedLocation(locationRequest).map(new LocationToStringFunc()).map(new Func1<String, String>() {
int count = 0;
@Override
public String call(String s) {
return s + " " + count++;
}
}).subscribe(new DisplayTextOnViewAction(updatedLocationView));
}
Aggregations