Beispiel #1
0
 private List<String> checkAssets(IProgress progress) {
   String fv = Version.getFullVersion(context);
   if (!fv.equalsIgnoreCase(context.getSettings().PREVIOUS_INSTALLED_VERSION.get())) {
     File applicationDataDir = context.getAppPath(null);
     applicationDataDir.mkdirs();
     if (applicationDataDir.canWrite()) {
       try {
         progress.startTask(context.getString(R.string.installing_new_resources), -1);
         AssetManager assetManager = context.getAssets();
         boolean isFirstInstall =
             context.getSettings().PREVIOUS_INSTALLED_VERSION.get().equals("");
         unpackBundledAssets(assetManager, applicationDataDir, progress, isFirstInstall);
         context.getSettings().PREVIOUS_INSTALLED_VERSION.set(fv);
         copyRegionsBoundaries();
         copyPoiTypes();
         for (String internalStyle :
             context.getRendererRegistry().getInternalRenderers().keySet()) {
           File fl = context.getRendererRegistry().getFileForInternalStyle(internalStyle);
           if (fl.exists()) {
             context.getRendererRegistry().copyFileForInternalStyle(internalStyle);
           }
         }
       } catch (SQLiteException e) {
         log.error(e.getMessage(), e);
       } catch (IOException e) {
         log.error(e.getMessage(), e);
       } catch (XmlPullParserException e) {
         log.error(e.getMessage(), e);
       }
     }
   }
   return Collections.emptyList();
 }
  public void updateApplicationModeSettings() {
    // update vector renderer
    RendererRegistry registry = app.getRendererRegistry();
    RenderingRulesStorage newRenderer = registry.getRenderer(settings.RENDERER.get());
    if (newRenderer == null) {
      newRenderer = registry.defaultRender();
    }
    if (registry.getCurrentSelectedRenderer() != newRenderer) {
      registry.setCurrentSelectedRender(newRenderer);
      app.getResourceManager().getRenderer().clearCache();
    }
    mapViewTrackingUtilities.updateSettings();
    app.getRoutingHelper().setAppMode(settings.getApplicationMode());
    if (mapLayers.getMapInfoLayer() != null) {
      mapLayers.getMapInfoLayer().recreateControls();
    }
    mapLayers.updateLayers(mapView);
    app.getDaynightHelper()
        .startSensorIfNeeded(
            new StateChangedListener<Boolean>() {

              @Override
              public void stateChanged(Boolean change) {
                getMapView().refreshMap(true);
              }
            });
    getMapView().refreshMap(true);
  }