src/main/java/de/blau/android/dialogs/Layers.java
/**
     * Add a StyleableLayer from a file Uri
     * 
     * @param activity the calling Activity
     * @param prefs current Preferences
     * @param map current Map
     * @param type the layer type
     * @param fileUri the file uri
     */
Add a StyleableLayer from a file Uri


Add a StyleableLayer from a file Uri
private void addStyleableLayerFromUri(@NonNull final FragmentActivity activity, @NonNull final Preferences prefs, @NonNull final Map map,
            @NonNull LayerType type, @NonNull Uri fileUri) {
        final String uriString = fileUri.toString();
        de.blau.android.layer.StyleableLayer layer = (de.blau.android.layer.StyleableLayer) map.getLayer(type, uriString);
        if (layer == null) {
            Log.d(DEBUG_TAG, "addStyleableLayerFromUri " + uriString);
            de.blau.android.layer.Util.addLayer(activity, type, uriString);
            map.setUpLayers(activity);
            layer = (de.blau.android.layer.StyleableLayer) map.getLayer(type, uriString);
        }
        if (layer != null) { 
            layer.resetStyling();
            LayerStyle.showDialog(activity, layer.getIndex());
            SelectFile.savePref(prefs, R.string.config_osmPreferredDir_key, fileUri);
            layer.invalidate();
            tl.removeAllViews();
            addRows(activity);
        }
    }
private void addStyleableLayerFromUri ( @ NonNull final FragmentActivity activity , @ NonNull final Preferences prefs , @ NonNull final Map map , @ NonNull LayerType type , @ NonNull Uri fileUri ) { final String uriString = fileUri . toString ( ) ; de . blau . android . layer . StyleableLayer layer = ( de . blau . android . layer . StyleableLayer ) map . getLayer ( type , uriString ) ; if ( layer == null ) { Log . d ( DEBUG_TAG , "addStyleableLayerFromUri " + uriString ) ; de . blau . android . layer . Util . addLayer ( activity , type , uriString ) ; map . setUpLayers ( activity ) ; layer = ( de . blau . android . layer . StyleableLayer ) map . getLayer ( type , uriString ) ; } if ( layer != null ) { layer . resetStyling ( ) ; LayerStyle . showDialog ( activity , layer . getIndex ( ) ) ; SelectFile . savePref ( prefs , R . string . config_osmPreferredDir_key , fileUri ) ; layer . invalidate ( ) ; tl . removeAllViews ( ) ; addRows ( activity ) ; } }
Add a StyleableLayer from a file Uri
Add a StyleableLayer from a file Uri
// if null setUpLayers will have toasted