From c91d61e9f724aed3217197c3f347e5dd54e4e0d0 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 18 Dec 2014 22:05:16 +0100 Subject: fix #4540: no current position since last update Propagate onError as well as onNext to subscribers. --- main/src/cgeo/geocaching/playservices/LocationProvider.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'main') 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 subject = ReplaySubject.createWithSize(1); + private static final ReplaySubject 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() { - @Override - public void call(final GeoData geoData) { - subscriber.onNext(geoData); - } - })); + subscriber.add(subject.subscribe(Subscribers.from(subscriber))); } }); } -- cgit v1.1