当前位置: 首页>>代码示例>>Java>>正文


Java ReactiveLocationProvider类代码示例

本文整理汇总了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();
}
 
开发者ID:sathishmscict,项目名称:Pickr,代码行数:21,代码来源:SearchActivity.java

示例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);
                    }
                }
            });
}
 
开发者ID:matbrandao,项目名称:Saude-no-Mapa,代码行数:20,代码来源:EstablishmentInteractorImpl.java

示例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);
                    }
                }
            });
}
 
开发者ID:matbrandao,项目名称:Saude-no-Mapa,代码行数:20,代码来源:EmergencyInteractorImpl.java

示例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);

}
 
开发者ID:fedepaol,项目名称:BikeSharing,代码行数:18,代码来源:StationsListTest.java

示例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));
}
 
开发者ID:amartinz,项目名称:DeviceControl,代码行数:25,代码来源:GpsView.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:PlacesResultActivity.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:MockLocationsActivity.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:GeofenceActivity.java

示例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);
}
 
开发者ID:matbrandao,项目名称:Saude-no-Mapa,代码行数:8,代码来源:EstablishmentInteractorImpl.java

示例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);
}
 
开发者ID:fedepaol,项目名称:BikeSharing,代码行数:10,代码来源:MapModule.java

示例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;
}
 
开发者ID:fedepaol,项目名称:BikeSharing,代码行数:13,代码来源:MapPresenterImpl.java

示例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();
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-PhoneSensor,代码行数:35,代码来源:GeoFence.java

示例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();
}
 
开发者ID:zetbaitsu,项目名称:Sigap,代码行数:10,代码来源:LocationPresenter.java

示例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());
}
 
开发者ID:amartinz,项目名称:DeviceControl,代码行数:9,代码来源:GpsView.java

示例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());
}
 
开发者ID:asm-products,项目名称:nomad-android,代码行数:8,代码来源:GooglePlacesApiActivity.java


注:本文中的pl.charmas.android.reactivelocation.ReactiveLocationProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。