public static class BaseRx.LocationRx extends BaseRx<Location>
BaseRx
class to provide Location
support. For example, in Activity:
import akha.yakhont.callback.annotation.CallbacksInherited; import akha.yakhont.location.LocationCallbacks; import akha.yakhont.technology.rx.BaseRx.LocationRx; import akha.yakhont.technology.rx.BaseRx.SubscriberRx; import android.location.Location; @CallbacksInherited(LocationCallbacks.class) public class MyActivity extends Activity { private LocationCallbacks mLocationCallbacks; private LocationRx mRx; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... mLocationCallbacks = LocationCallbacks.getLocationCallbacks(this); boolean useRxJava2 = true; mRx = new LocationRx(useRxJava2, this).subscribe(new SubscriberRx<Location>() { @Override public void onNext(final Location location) { // your code here } }); // avoids terminating the application // by calls to the Rx uncaught exception handler // actually it's the final application only // that should set (or not) such kind of handlers: // it's not advised for intermediate libraries // to change the global handlers behavior mRx.setErrorHandlerJustLog(); mLocationCallbacks.register(mRx); } @Override protected void onDestroy() { mRx.cleanup(); mLocationCallbacks.unregister(mRx); super.onDestroy(); } }
LocationCallbacks
BaseRx.CallbackRx<D>, BaseRx.CommonRx<D>, BaseRx.LoaderRx<R,E,D>, BaseRx.LocationRx, BaseRx.SubscriberRx<D>
Constructor and Description |
---|
BaseRx.LocationRx()
Initialises a newly created
LocationRx object. |
BaseRx.LocationRx(BaseRx.CommonRx<Location> commonRx)
Initialises a newly created
LocationRx object. |
BaseRx.LocationRx(BaseRx.CommonRx<Location> commonRx,
Activity activity)
Initialises a newly created
LocationRx object. |
BaseRx.LocationRx(boolean isRx2,
Activity activity)
Initialises a newly created
LocationRx object. |
Modifier and Type | Method and Description |
---|---|
Location |
getResult()
Please refer to the base method description.
|
BaseRx.LocationRx |
subscribe(BaseRx.SubscriberRx<Location> subscriber)
Please refer to the base method description.
|
cleanup, getRx, hasObservers, isNullable, isSingle, onError, onError, onResult, setErrorHandlerEmpty, setErrorHandlerJustLog, unsubscribe
public BaseRx.LocationRx()
LocationRx
object.
Note: experimental.
public BaseRx.LocationRx(boolean isRx2, Activity activity)
LocationRx
object.public BaseRx.LocationRx(BaseRx.CommonRx<Location> commonRx)
LocationRx
object.
Note: experimental.
commonRx
- The BaseRx.CommonRx
to usepublic BaseRx.LocationRx(BaseRx.CommonRx<Location> commonRx, Activity activity)
LocationRx
object.commonRx
- The BaseRx.CommonRx
to useactivity
- The Activitypublic BaseRx.LocationRx subscribe(BaseRx.SubscriberRx<Location> subscriber)
subscribe
in class BaseRx<Location>
subscriber
- The subscriber
BaseRx
object to allow for chaining of calls to methods
Copyright © 2015-2017 akha, a.k.a. Alexander Kharitonov
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.