Search in sources :

Example 1 with PleaseLoadPoiTypes

use of io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes in project osm-contributor by jawg.

the class MapFragmentPresenter method loadPoi.

private void loadPoi(boolean refreshData, boolean forceRefresh) {
    if (poiTypes == null) {
        Timber.v("PleaseLoadPoiTypes");
        eventBus.post(new PleaseLoadPoiTypes());
    }
    LatLngBounds viewLatLngBounds = mapFragment.getViewLatLngBounds();
    if (viewLatLngBounds != null) {
        if (mapFragment.getZoomLevel() > BuildConfig.ZOOM_MARKER_MIN) {
            if (shouldReload(viewLatLngBounds) || refreshData || forceRefresh) {
                previousZoom = mapFragment.getZoomLevel();
                triggerReloadPoiLatLngBounds = LatLngBoundsUtils.enlarge(viewLatLngBounds, 1.2);
                LatLngBounds latLngToLoad = LatLngBoundsUtils.enlarge(viewLatLngBounds, 1.2);
                getPoisAndNotes.unsubscribe();
                Timber.e("Unsubscribe current loading");
                if (getPoisSubscriber != null) {
                    getPoisSubscriber.unsubscribe();
                }
                getPoisSubscriber = new GetPoisSubscriber();
                getPoisAndNotes.init(Box.convertFromLatLngBounds(latLngToLoad), refreshData).execute(getPoisSubscriber);
                mapFragment.displayZoomTooLargeError(false);
            }
        } else {
            forceRefreshPoi = true;
            cleanAllZoomTooLarge();
        }
    }
}
Also used : LatLngBounds(com.mapbox.mapboxsdk.geometry.LatLngBounds) PleaseLoadPoiTypes(io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes)

Example 2 with PleaseLoadPoiTypes

use of io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes in project osm-contributor by jawg.

the class LoadProfileActivity method onDatabaseResetFinishedEvent.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onDatabaseResetFinishedEvent(DatabaseResetFinishedEvent event) {
    eventBus.post(new PleaseLoadPoiTypes());
    databaseReseted = true;
    checkFinishActivity();
}
Also used : PleaseLoadPoiTypes(io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 3 with PleaseLoadPoiTypes

use of io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes in project osm-contributor by jawg.

the class TypeListActivity method onBackPressed.

@Override
public void onBackPressed() {
    if (!presenter.onBackPressed()) {
        eventBus.post(new PleaseLoadPoiTypes());
        super.onBackPressed();
    }
}
Also used : PleaseLoadPoiTypes(io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes)

Example 4 with PleaseLoadPoiTypes

use of io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes in project osm-contributor by jawg.

the class MapActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    eventBus.register(this);
    if (!sharedPreferences.getBoolean(getString(R.string.shared_prefs_preset_default), false) || !BuildConfig.FLAVOR.equals("store")) {
        navigationView.getMenu().findItem(R.id.edit_way).setVisible(false);
        navigationView.getMenu().findItem(R.id.manage_poi_types).setVisible(false);
        eventBus.post(new PleaseLoadPoiTypes());
    } else {
        navigationView.getMenu().findItem(R.id.edit_way).setVisible(true);
        navigationView.getMenu().findItem(R.id.manage_poi_types).setVisible(sharedPreferences.getBoolean(getString(R.string.shared_prefs_expert_mode), false));
    }
}
Also used : PleaseLoadPoiTypes(io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes)

Aggregations

PleaseLoadPoiTypes (io.jawg.osmcontributor.model.events.PleaseLoadPoiTypes)4 LatLngBounds (com.mapbox.mapboxsdk.geometry.LatLngBounds)1 Subscribe (org.greenrobot.eventbus.Subscribe)1