本文整理汇总了Java中pl.charmas.android.reactivelocation.ReactiveLocationProvider类的典型用法代码示例。如果您正苦于以下问题:Java ReactiveLocationProvider类的具体用法?Java ReactiveLocationProvider怎么用?Java ReactiveLocationProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReactiveLocationProvider类属于pl.charmas.android.reactivelocation包,在下文中一共展示了ReactiveLocationProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
ButterKnife.bind(this);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0, this)
.addApi(Places.GEO_DATA_API)
.build();
mDataManager = PickrApplication.get(this).getComponent().dataManager();
mSubscriptions = new CompositeSubscription();
mLocationProvider = new ReactiveLocationProvider(this);
mProgressDialog = DialogFactory.createProgressDialog(this, R.string.dialog_text_getting_location);
setupToolbar();
setupRecyclerView();
retrieveDeviceCurrentLocation();
}
示例2: requestUserUf
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override
public void requestUserUf(Double lat, Double lng, StringListener listener) {
ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(mContext);
locationProvider.getReverseGeocodeObservable(lat, lng, 1)
.retry(10)
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.onErrorReturn(throwable1 -> new ArrayList<>())
.subscribe(addresses -> {
if (addresses != null && !addresses.isEmpty()) {
String addressLine = addresses.get(0).getAddressLine(1);
if (addressLine.contains("-")) {
listener.onNext(getUfFromAddress(addressLine));
} else {
listener.onNext(addressLine);
}
}
});
}
示例3: requestUserUf
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override
public void requestUserUf(Double lat, Double lng, StringListener listener) {
ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(mContext);
locationProvider.getReverseGeocodeObservable(lat, lng, 1)
.retry(10)
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.onErrorReturn(throwable1 -> new ArrayList<>())
.subscribe(addresses -> {
if (addresses != null) {
String addressLine = addresses.get(0).getAddressLine(1);
if (addressLine.contains("-")) {
listener.onNext(getUfFromAddress(addressLine));
} else {
listener.onNext(addressLine);
}
}
});
}
示例4: setUp
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
stationsProvider = new FakeStationsProvider();
StationsListModule m = mock(StationsListModule.class);
myLocation = mock(Location.class);
mockPresenter = mock(StationsListPresenter.class);
when(m.providePresenter(any(BikesProvider.class),
any(SchedulersProvider.class),
any(ReactiveLocationProvider.class))).thenReturn(mockPresenter);
Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
TestApplication app
= (TestApplication) instrumentation.getTargetContext().getApplicationContext();
app.setStationListModule(m);
}
示例5: init
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override protected void init(@Nullable AttributeSet attrs) {
super.init(attrs);
final Context context = getContext();
unknownLocation = context.getString(R.string.gps_unknown_location);
statusView = new TextView(context);
final FrameLayout content = getContentView();
content.addView(statusView);
statusView.setText(R.string.gps_requesting_location);
final ReactiveLocationProvider provider = new ReactiveLocationProvider(context);
final LocationRequest locationRequest = LocationRequest.create()
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
.setFastestInterval(1000)
.setInterval(10000);
// get last known location, to display something quite fast
subscribe(provider, provider.getLastKnownLocation());
// then subscribe to get location updates
addressObservable = subscribe(provider, provider.getUpdatedLocation(locationRequest));
}
示例6: onCreate
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_places_result);
placeNameView = (TextView) findViewById(R.id.place_name_view);
placeLocationView = (TextView) findViewById(R.id.place_location_view);
placeAddressView = (TextView) findViewById(R.id.place_address_view);
reactiveLocationProvider = new ReactiveLocationProvider(this);
getPlaceIdFromIntent();
}
示例7: onCreate
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mocklocations);
locationProvider = new ReactiveLocationProvider(this);
mockLocationSubject = PublishSubject.create();
mockLocationObservable = mockLocationSubject.asObservable();
initViews();
}
示例8: onCreate
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
reactiveLocationProvider = new ReactiveLocationProvider(this);
setContentView(R.layout.activity_geofence);
initViews();
}
示例9: requestMyLocation
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override
public void requestMyLocation(OnLocationFound listener) {
ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(mContext);
locationProvider.getLastKnownLocation()
.retry(10)
.subscribe(listener::onLocationFound);
}
示例10: provideMainPresenter
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Provides
public MapPresenter provideMainPresenter(SchedulersProvider schedulersProvider,
BikesProvider bikesProvider,
ReactiveLocationProvider locationProvider,
RxPermissions permissions,
PrefsStorage storage){
return new MapPresenterImpl(schedulersProvider, bikesProvider,
locationProvider, permissions, storage);
}
示例11: MapPresenterImpl
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
public MapPresenterImpl(SchedulersProvider schedulersProvider,
BikesProvider bikesProvider,
ReactiveLocationProvider locationProvider,
RxPermissions permissions,
PrefsStorage storage) {
mSchedulersProvider = schedulersProvider;
mLocationProvider = locationProvider;
mBikesProvider = bikesProvider;
mPermissions = permissions;
mStations = new HashMap<>();
mStorage = storage;
}
示例12: register
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
@Override
public void register(DataSourceBuilder dataSourceBuilder, CallBack newCallBack) throws DataKitException {
super.register(dataSourceBuilder, newCallBack);
geoFenceData = new GeoFenceData(context);
String lastListFromDataKit = getLastListFromDataKit();
String recentListFromMemory = geoFenceData.getGeoFenceString();
if (lastListFromDataKit == null && recentListFromMemory == null) return;
if (recentListFromMemory == null) {
dataKitAPI.insert(dataSourceClient, new DataTypeString(DateTime.getDateTime(), ""));
return;
} else if (lastListFromDataKit == null)
dataKitAPI.insert(dataSourceClient, new DataTypeString(DateTime.getDateTime(), recentListFromMemory));
else if (!lastListFromDataKit.equalsIgnoreCase(recentListFromMemory))
dataKitAPI.insert(dataSourceClient, new DataTypeString(DateTime.getDateTime(), recentListFromMemory));
context.registerReceiver(br, new IntentFilter("android.location.PROVIDERS_CHANGED"));
context.registerReceiver(gbr, new IntentFilter("org.md2k.phonesensor.gbr"));
reactiveLocationProvider = new ReactiveLocationProvider(context);
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
lastKnownLocationSubscription = reactiveLocationProvider
.getLastKnownLocation()
.subscribe();
addGeofence();
saveData();
}
示例13: LocationPresenter
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
public LocationPresenter(View view, int priority) {
super(view);
listenCurrentUser();
request = LocationRequest.create()
.setPriority(priority)
.setInterval(3 * 1000);
locationProvider = new ReactiveLocationProvider(SigapApp.pluck().getApplicationContext());
listenLocationUpdate();
}
示例14: subscribe
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
private Observable<String> subscribe(final ReactiveLocationProvider provider, Observable<Location> locationObservable) {
return locationObservable
.flatMap(new LocationObservableFunc1(provider))
.map(new ListAddressFunc1())
.map(new StringAddressFunc1(unknownLocation))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
示例15: startSearchByLocation
import pl.charmas.android.reactivelocation.ReactiveLocationProvider; //导入依赖的package包/类
private void startSearchByLocation() {
ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(this);
locationProvider.getLastKnownLocation()
.subscribe(location -> findNearbyPlaces(location),
throwable -> Toast.makeText(GooglePlacesApiActivity.this,
"No location: " + throwable, Toast.LENGTH_SHORT).show());
}