Search in sources :

Example 1 with DetectedActivityToString

use of pl.charmas.android.reactivelocation.sample.utils.DetectedActivityToString 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)

Aggregations

DetectedActivityToString (pl.charmas.android.reactivelocation.sample.utils.DetectedActivityToString)1 DisplayTextOnViewAction (pl.charmas.android.reactivelocation.sample.utils.DisplayTextOnViewAction)1 LocationToStringFunc (pl.charmas.android.reactivelocation.sample.utils.LocationToStringFunc)1 ToMostProbableActivity (pl.charmas.android.reactivelocation.sample.utils.ToMostProbableActivity)1