Search in sources :

Example 1 with OfflineRegionCreatedEvent

use of io.jawg.osmcontributor.offline.events.OfflineRegionCreatedEvent in project osm-contributor by jawg.

the class OfflineRegionDownloadService method downloadOfflineRegion.

public void downloadOfflineRegion(LatLngBounds latLngBounds, final String regionName) {
    final OfflineTilePyramidRegionDefinition definition = new OfflineTilePyramidRegionDefinition(BuildConfig.MAP_STYLE_URL, latLngBounds, MIN_ZOOM, MAX_ZOOM, this.getResources().getDisplayMetrics().density);
    // Build the notification
    buildNotification(regionName);
    offlineRegionManager.createOfflineRegion(definition, regionName, new OfflineRegionManager.OnOfflineRegionCreatedListener() {

        @Override
        public void onOfflineRegionCreated(OfflineRegion offlineRegion, String regionName) {
            // Monitor the download progress using setObserver
            offlineRegion.setObserver(getOfflineRegionObserver(regionName));
            startDownloadOfflineRegion(offlineRegion);
            eventBus.post(new OfflineRegionCreatedEvent());
        }
    });
}
Also used : OfflineRegion(com.mapbox.mapboxsdk.offline.OfflineRegion) OfflineTilePyramidRegionDefinition(com.mapbox.mapboxsdk.offline.OfflineTilePyramidRegionDefinition) OfflineRegionCreatedEvent(io.jawg.osmcontributor.offline.events.OfflineRegionCreatedEvent) OfflineRegionManager(io.jawg.osmcontributor.offline.OfflineRegionManager)

Aggregations

OfflineRegion (com.mapbox.mapboxsdk.offline.OfflineRegion)1 OfflineTilePyramidRegionDefinition (com.mapbox.mapboxsdk.offline.OfflineTilePyramidRegionDefinition)1 OfflineRegionManager (io.jawg.osmcontributor.offline.OfflineRegionManager)1 OfflineRegionCreatedEvent (io.jawg.osmcontributor.offline.events.OfflineRegionCreatedEvent)1