Search in sources :

Example 1 with DisplayTextOnViewAction

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());
}
Also used : ToMostProbableActivity(pl.charmas.android.reactivelocation.sample.utils.ToMostProbableActivity) LocationToStringFunc(pl.charmas.android.reactivelocation.sample.utils.LocationToStringFunc) DetectedActivityToString(pl.charmas.android.reactivelocation.sample.utils.DetectedActivityToString) DisplayTextOnViewAction(pl.charmas.android.reactivelocation.sample.utils.DisplayTextOnViewAction) DetectedActivityToString(pl.charmas.android.reactivelocation.sample.utils.DetectedActivityToString)

Example 2 with DisplayTextOnViewAction

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));
}
Also used : LocationRequest(com.google.android.gms.location.LocationRequest) LocationToStringFunc(pl.charmas.android.reactivelocation.sample.utils.LocationToStringFunc) DisplayTextOnViewAction(pl.charmas.android.reactivelocation.sample.utils.DisplayTextOnViewAction)

Aggregations

DisplayTextOnViewAction (pl.charmas.android.reactivelocation.sample.utils.DisplayTextOnViewAction)2 LocationToStringFunc (pl.charmas.android.reactivelocation.sample.utils.LocationToStringFunc)2 LocationRequest (com.google.android.gms.location.LocationRequest)1 DetectedActivityToString (pl.charmas.android.reactivelocation.sample.utils.DetectedActivityToString)1 ToMostProbableActivity (pl.charmas.android.reactivelocation.sample.utils.ToMostProbableActivity)1