aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-12-18 22:05:16 +0100
committerSamuel Tardieu <sam@rfc1149.net>2014-12-18 22:08:56 +0100
commitc91d61e9f724aed3217197c3f347e5dd54e4e0d0 (patch)
treef36758369b91fa4265e29ecb3a9808c6443db21a /main
parentbbd191f0ba23f8969de821f9f551703c247d7036 (diff)
downloadcgeo-c91d61e9f724aed3217197c3f347e5dd54e4e0d0.zip
cgeo-c91d61e9f724aed3217197c3f347e5dd54e4e0d0.tar.gz
cgeo-c91d61e9f724aed3217197c3f347e5dd54e4e0d0.tar.bz2
fix #4540: no current position since last update
Propagate onError as well as onNext to subscribers.
Diffstat (limited to 'main')
-rw-r--r--main/src/cgeo/geocaching/playservices/LocationProvider.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/playservices/LocationProvider.java b/main/src/cgeo/geocaching/playservices/LocationProvider.java
index 0450152..8e42729 100644
--- a/main/src/cgeo/geocaching/playservices/LocationProvider.java
+++ b/main/src/cgeo/geocaching/playservices/LocationProvider.java
@@ -16,8 +16,8 @@ import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.functions.Action0;
-import rx.functions.Action1;
import rx.functions.Func1;
+import rx.observers.Subscribers;
import rx.subjects.ReplaySubject;
import rx.subscriptions.Subscriptions;
@@ -37,7 +37,7 @@ public class LocationProvider implements ConnectionCallbacks, OnConnectionFailed
private static final AtomicInteger mostPreciseCount = new AtomicInteger(0);
private static final AtomicInteger lowPowerCount = new AtomicInteger(0);
private static LocationProvider instance = null;
- private static ReplaySubject<GeoData> subject = ReplaySubject.createWithSize(1);
+ private static final ReplaySubject<GeoData> subject = ReplaySubject.createWithSize(1);
private final LocationClient locationClient;
private static synchronized LocationProvider getInstance(final Context context) {
@@ -83,12 +83,7 @@ public class LocationProvider implements ConnectionCallbacks, OnConnectionFailed
}, 2500, TimeUnit.MILLISECONDS);
}
}));
- subscriber.add(subject.subscribe(new Action1<GeoData>() {
- @Override
- public void call(final GeoData geoData) {
- subscriber.onNext(geoData);
- }
- }));
+ subscriber.add(subject.subscribe(Subscribers.from(subscriber)));
}
});
}