Merge pull request #10812 from osmandapp/fix_10775

Fix_10775
This commit is contained in:
vshcherb 2021-02-09 14:39:32 +01:00 committed by GitHub
commit 6d09956f7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 90 additions and 100 deletions

View file

@ -136,10 +136,10 @@ import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener; import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener;
import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.datastorage.DataStorageFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment; import net.osmand.plus.settings.fragments.BaseSettingsFragment;
import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType; import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType;
import net.osmand.plus.settings.fragments.ConfigureProfileFragment; import net.osmand.plus.settings.fragments.ConfigureProfileFragment;
import net.osmand.plus.settings.datastorage.DataStorageFragment;
import net.osmand.plus.track.TrackAppearanceFragment; import net.osmand.plus.track.TrackAppearanceFragment;
import net.osmand.plus.track.TrackMenuFragment; import net.osmand.plus.track.TrackMenuFragment;
import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint; import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint;
@ -1664,6 +1664,12 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
getMapView().refreshMap(); getMapView().refreshMap();
} }
public void refreshMapComplete() {
getMyApplication().getResourceManager().getRenderer().clearCache();
updateMapSettings();
getMapView().refreshMap(true);
}
public View getLayout() { public View getLayout() {
return getWindow().getDecorView().findViewById(android.R.id.content); return getWindow().getDecorView().findViewById(android.R.id.content);
} }

View file

@ -96,6 +96,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInformationListener { public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInformationListener {
private static final org.apache.commons.logging.Log LOG = private static final org.apache.commons.logging.Log LOG =
PlatformUtil.getLog(DashboardOnMap.class); PlatformUtil.getLog(DashboardOnMap.class);
@ -777,7 +778,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
plugin.registerLayers(mapActivity); plugin.registerLayers(mapActivity);
} }
} }
SRTMPlugin.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} else if (visibleType == DashboardType.WIKIPEDIA) { } else if (visibleType == DashboardType.WIKIPEDIA) {
refreshContent(true); refreshContent(true);
} }

View file

@ -261,11 +261,6 @@ public class ConfigureMapMenu {
app.getAidlApi().registerLayerContextMenu(adapter, activity); app.getAidlApi().registerLayerContextMenu(adapter, activity);
} }
public static void refreshMapComplete(final MapActivity activity) {
activity.getMyApplication().getResourceManager().getRenderer().clearCache();
activity.updateMapSettings();
activity.getMapView().refreshMap(true);
}
private void createRenderingAttributeItems(List<RenderingRuleProperty> customRules, private void createRenderingAttributeItems(List<RenderingRuleProperty> customRules,
final ContextMenuAdapter adapter, final MapActivity activity, final ContextMenuAdapter adapter, final MapActivity activity,
@ -347,7 +342,7 @@ public class ConfigureMapMenu {
public void onClick(View v) { public void onClick(View v) {
int which = (int) v.getTag(); int which = (int) v.getTag();
view.getSettings().DAYNIGHT_MODE.set(DayNightMode.values()[which]); view.getSettings().DAYNIGHT_MODE.set(DayNightMode.values()[which]);
refreshMapComplete(activity); activity.refreshMapComplete();
activity.getDashboard().refreshContent(true); activity.getDashboard().refreshContent(true);
// adapter.getItem(pos).setDescription(s, getDayNightDescr(activity)); // adapter.getItem(pos).setDescription(s, getDayNightDescr(activity));
// ad.notifyDataSetInvalidated(); // ad.notifyDataSetInvalidated();
@ -466,7 +461,7 @@ public class ConfigureMapMenu {
public void onClick(View v) { public void onClick(View v) {
int which = (int) v.getTag(); int which = (int) v.getTag();
view.getSettings().TEXT_SCALE.set(txtValues[which]); view.getSettings().TEXT_SCALE.set(txtValues[which]);
refreshMapComplete(activity); activity.refreshMapComplete();
adapter.getItem(pos).setDescription(getScale(activity)); adapter.getItem(pos).setDescription(getScale(activity));
ad.notifyDataSetInvalidated(); ad.notifyDataSetInvalidated();
} }
@ -568,7 +563,7 @@ public class ConfigureMapMenu {
int index = dlg.getListView().getCheckedItemPosition(); int index = dlg.getListView().getCheckedItemPosition();
view.getSettings().MAP_PREFERRED_LOCALE.set( view.getSettings().MAP_PREFERRED_LOCALE.set(
txtIds[index]); txtIds[index]);
refreshMapComplete(activity); activity.refreshMapComplete();
String localeDescr = txtIds[index]; String localeDescr = txtIds[index];
localeDescr = localeDescr == null || localeDescr.isEmpty() ? activity localeDescr = localeDescr == null || localeDescr.isEmpty() ? activity
.getString(R.string.local_map_names) : localeDescr; .getString(R.string.local_map_names) : localeDescr;
@ -712,7 +707,7 @@ public class ConfigureMapMenu {
} }
adapter.getItem(pos).setColorRes(ContextMenuItem.INVALID_ID); adapter.getItem(pos).setColorRes(ContextMenuItem.INVALID_ID);
a.notifyDataSetInvalidated(); a.notifyDataSetInvalidated();
refreshMapComplete(activity); activity.refreshMapComplete();
activity.getMapLayers().updateLayers(activity.getMapView()); activity.getMapLayers().updateLayers(activity.getMapView());
} else { } else {
if (UI_CATEGORY_DETAILS.equals(category)) { if (UI_CATEGORY_DETAILS.equals(category)) {
@ -883,7 +878,7 @@ public class ConfigureMapMenu {
adapter.getItem(pos).setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID); adapter.getItem(pos).setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
} }
a.notifyDataSetInvalidated(); a.notifyDataSetInvalidated();
refreshMapComplete(activity); activity.refreshMapComplete();
activity.getMapLayers().updateLayers(activity.getMapView()); activity.getMapLayers().updateLayers(activity.getMapView());
} }
}); });
@ -1041,7 +1036,7 @@ public class ConfigureMapMenu {
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) { public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
pref.set(!pref.get()); pref.set(!pref.get());
refreshMapComplete(activity); activity.refreshMapComplete();
return false; return false;
} }
}) })
@ -1096,7 +1091,7 @@ public class ConfigureMapMenu {
} else { } else {
pref.set(p.getPossibleValues()[which - 1]); pref.set(p.getPossibleValues()[which - 1]);
} }
refreshMapComplete(activity); activity.refreshMapComplete();
String description = AndroidUtils.getRenderingStringPropertyValue(activity, pref.get()); String description = AndroidUtils.getRenderingStringPropertyValue(activity, pref.get());
adapter.getItem(pos).setDescription(description); adapter.getItem(pos).setDescription(description);
} }

View file

@ -228,9 +228,9 @@ public class DetailsBottomSheet extends BasePreferenceBottomSheet {
} }
Activity activity = getActivity(); Activity activity = getActivity();
if (activity instanceof MapActivity) { if (activity instanceof MapActivity) {
MapActivity a = (MapActivity) activity; MapActivity mapActivity = (MapActivity) activity;
ConfigureMapMenu.refreshMapComplete(a); mapActivity.refreshMapComplete();
a.getMapLayers().updateLayers(a.getMapView()); mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
} }
super.onDismiss(dialog); super.onDismiss(dialog);
} }

View file

@ -20,6 +20,7 @@ import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.OnMapSelectedCallback; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.OnMapSelectedCallback;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.RasterMapType; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.RasterMapType;
public class RasterMapMenu { public class RasterMapMenu {
private static final String TAG = "RasterMapMenu"; private static final String TAG = "RasterMapMenu";
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity, public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity,
@ -105,12 +106,12 @@ public class RasterMapMenu {
@Override @Override
public void run() { public void run() {
plugin.toggleUnderlayState(mapActivity, type, onMapSelectedCallback); plugin.toggleUnderlayState(mapActivity, type, onMapSelectedCallback);
refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
}); });
} else if (itemId == R.string.show_polygons) { } else if (itemId == R.string.show_polygons) {
hidePolygonsPref.set(!isChecked); hidePolygonsPref.set(!isChecked);
refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} else if (itemId == R.string.show_transparency_seekbar) { } else if (itemId == R.string.show_transparency_seekbar) {
if (isChecked) { if (isChecked) {
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(currentMapTypeSeekbarMode); settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(currentMapTypeSeekbarMode);
@ -180,10 +181,4 @@ public class RasterMapMenu {
LayerTransparencySeekbarMode seekbarMode = app.getSettings().LAYER_TRANSPARENCY_SEEKBAR_MODE.get(); LayerTransparencySeekbarMode seekbarMode = app.getSettings().LAYER_TRANSPARENCY_SEEKBAR_MODE.get();
return seekbarMode == LayerTransparencySeekbarMode.UNDEFINED || seekbarMode == currentMapTypeSeekbarMode; return seekbarMode == LayerTransparencySeekbarMode.UNDEFINED || seekbarMode == currentMapTypeSeekbarMode;
} }
public static void refreshMapComplete(final MapActivity activity) {
activity.getMyApplication().getResourceManager().getRenderer().clearCache();
activity.updateMapSettings();
activity.getMapView().refreshMap(true);
}
} }

View file

@ -140,7 +140,7 @@ public class SelectMapStyleBottomSheetDialogFragment extends MenuBottomSheetDial
OsmandMapTileView view = mapActivity.getMapView(); OsmandMapTileView view = mapActivity.getMapView();
view.getSettings().RENDERER.set(selectedStyle); view.getSettings().RENDERER.set(selectedStyle);
app.getRendererRegistry().setCurrentSelectedRender(loaded); app.getRendererRegistry().setCurrentSelectedRender(loaded);
ConfigureMapMenu.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
mapActivity.getDashboard().refreshContent(true); mapActivity.getDashboard().refreshContent(true);
} else { } else {
Toast.makeText(mapActivity, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show(); Toast.makeText(mapActivity, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show();

View file

@ -593,7 +593,7 @@ public class GpxUiHelper {
} }
} }
if (activity instanceof MapActivity) { if (activity instanceof MapActivity) {
ConfigureMapMenu.refreshMapComplete((MapActivity) activity); ((MapActivity) activity).refreshMapComplete();
} }
} }
GPXFile currentGPX = null; GPXFile currentGPX = null;

View file

@ -15,7 +15,6 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dialogs.ConfigureMapMenu;
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin; import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.quickaction.QuickActionType;
@ -92,7 +91,7 @@ public class MapStyleAction extends SwitchableAction<String> {
view.getSettings().RENDERER.set(params); view.getSettings().RENDERER.set(params);
app.getRendererRegistry().setCurrentSelectedRender(loaded); app.getRendererRegistry().setCurrentSelectedRender(loaded);
ConfigureMapMenu.refreshMapComplete(activity); activity.refreshMapComplete();
Toast.makeText(activity, activity.getString(R.string.quick_action_map_style_switch, Toast.makeText(activity, activity.getString(R.string.quick_action_map_style_switch,
getTranslatedItemName(activity, params)), Toast.LENGTH_SHORT).show(); getTranslatedItemName(activity, params)), Toast.LENGTH_SHORT).show();

View file

@ -15,20 +15,20 @@ import com.google.gson.reflect.TypeToken;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.quickaction.SwitchableAction; import net.osmand.plus.quickaction.SwitchableAction;
import net.osmand.plus.settings.backend.OsmandSettings;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> { public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
private final static String KEY_UNDERLAYS = "underlays"; private final static String KEY_UNDERLAYS = "underlays";
@ -141,14 +141,9 @@ public class MapUnderlayAction extends SwitchableAction<Pair<String, String>> {
settings.MAP_UNDERLAY.set(null); settings.MAP_UNDERLAY.set(null);
activity.getMapLayers().getMapControlsLayer().hideTransparencyBar(); activity.getMapLayers().getMapControlsLayer().hideTransparencyBar();
settings.MAP_UNDERLAY_PREVIOUS.set(null); settings.MAP_UNDERLAY_PREVIOUS.set(null);
} }
final CommonPreference<Boolean> hidePolygonsPref =
activity.getMyApplication().getSettings().getCustomRenderBooleanProperty("noPolygons");
hidePolygonsPref.set(hasUnderlay);
plugin.updateMapLayers(activity.getMapView(), settings.MAP_UNDERLAY, activity.getMapLayers()); plugin.updateMapLayers(activity.getMapView(), settings.MAP_UNDERLAY, activity.getMapLayers());
activity.refreshMapComplete();
Toast.makeText(activity, activity.getString(R.string.quick_action_map_underlay_switch, Toast.makeText(activity, activity.getString(R.string.quick_action_map_underlay_switch,
getTranslatedItemName(activity, params)), Toast.LENGTH_SHORT).show(); getTranslatedItemName(activity, params)), Toast.LENGTH_SHORT).show();
} }

View file

@ -29,17 +29,16 @@ import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.DialogListItemAdapter; import net.osmand.plus.DialogListItemAdapter;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
import net.osmand.plus.activities.DownloadTilesDialog; import net.osmand.plus.activities.DownloadTilesDialog;
import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers; import net.osmand.plus.activities.MapActivityLayers;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.RasterMapMenu; import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
import net.osmand.plus.quickaction.QuickActionType; import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.views.MapTileLayer; import net.osmand.plus.views.MapTileLayer;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -66,6 +65,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
private MapTileLayer overlayLayer; private MapTileLayer overlayLayer;
private MapTileLayer underlayLayer; private MapTileLayer underlayLayer;
private StateChangedListener<String> underlayListener;
private StateChangedListener<Integer> overlayLayerListener; private StateChangedListener<Integer> overlayLayerListener;
public OsmandRasterMapsPlugin(OsmandApplication app) { public OsmandRasterMapsPlugin(OsmandApplication app) {
@ -103,6 +103,19 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
return "feature_articles/online-maps-plugin.html"; return "feature_articles/online-maps-plugin.html";
} }
@Override
public boolean init(@NonNull final OsmandApplication app, Activity activity) {
final CommonPreference<Boolean> hidePolygonsPref = settings.getCustomRenderBooleanProperty("noPolygons");
underlayListener = new StateChangedListener<String>() {
@Override
public void stateChanged(String change) {
hidePolygonsPref.set(settings.MAP_UNDERLAY.get() != null);
}
};
settings.MAP_UNDERLAY.addListener(underlayListener);
return true;
}
@Override @Override
public void registerLayers(MapActivity activity) { public void registerLayers(MapActivity activity) {
createLayers(); createLayers();
@ -339,7 +352,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
RasterMapMenu.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
} }
} }

View file

@ -1,26 +1,11 @@
package net.osmand.plus.render; package net.osmand.plus.render;
import gnu.trove.iterator.TIntObjectIterator; import android.content.Context;
import gnu.trove.list.TLongList; import android.graphics.Bitmap;
import gnu.trove.list.array.TIntArrayList; import android.graphics.Bitmap.Config;
import gnu.trove.list.array.TLongArrayList; import android.os.Handler;
import gnu.trove.map.hash.TIntObjectHashMap; import android.os.Looper;
import gnu.trove.set.TLongSet; import android.widget.Toast;
import gnu.trove.set.hash.TLongHashSet;
import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.TreeSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.osmand.IProgress; import net.osmand.IProgress;
import net.osmand.NativeLibrary.NativeSearchResult; import net.osmand.NativeLibrary.NativeSearchResult;
@ -39,14 +24,14 @@ import net.osmand.data.QuadPointDouble;
import net.osmand.data.QuadRect; import net.osmand.data.QuadRect;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.map.MapTileDownloader; import net.osmand.map.MapTileDownloader;
import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.development.OsmandDevelopmentPlugin; import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.render.OsmandRenderer.RenderingContext; import net.osmand.plus.render.OsmandRenderer.RenderingContext;
import net.osmand.plus.settings.backend.CommonPreference;
import net.osmand.plus.settings.backend.OsmAndAppCustomization.OsmAndAppCustomizationListener;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.render.RenderingRuleProperty; import net.osmand.render.RenderingRuleProperty;
import net.osmand.render.RenderingRuleSearchRequest; import net.osmand.render.RenderingRuleSearchRequest;
@ -55,16 +40,31 @@ import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapAlgorithms; import net.osmand.util.MapAlgorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import net.osmand.util.TransliterationHelper; import net.osmand.util.TransliterationHelper;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import android.content.Context; import java.io.File;
import android.graphics.Bitmap; import java.io.IOException;
import android.graphics.Bitmap.Config; import java.text.MessageFormat;
import android.os.Handler; import java.util.ArrayList;
import android.os.Looper; import java.util.Arrays;
import android.widget.Toast; import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.list.TLongList;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.list.array.TLongArrayList;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.TLongSet;
import gnu.trove.set.hash.TLongHashSet;
public class MapRenderRepositories { public class MapRenderRepositories {
// It is needed to not draw object twice if user have map index that intersects by boundaries // It is needed to not draw object twice if user have map index that intersects by boundaries
@ -753,11 +753,6 @@ public class MapRenderRepositories {
now = System.currentTimeMillis(); now = System.currentTimeMillis();
Bitmap bmp; Bitmap bmp;
boolean transparent = false;
RenderingRuleProperty rr = storage.PROPS.get("noPolygons");
if (rr != null) {
transparent = renderingReq.getIntPropertyValue(rr) > 0;
}
// 1. generate image step by step // 1. generate image step by step
Bitmap reuse = prevBmp; Bitmap reuse = prevBmp;

View file

@ -52,8 +52,7 @@ public class ContourLinesAction extends QuickAction {
if (selected && !plugin.isActive() && !plugin.needsInstallation()) { if (selected && !plugin.isActive() && !plugin.needsInstallation()) {
OsmandPlugin.enablePlugin(activity, app, plugin, true); OsmandPlugin.enablePlugin(activity, app, plugin, true);
} }
activity.refreshMapComplete();
SRTMPlugin.refreshMapComplete(activity);
} }
} }
}); });

View file

@ -109,7 +109,7 @@ public class ContourLinesMenu {
@Override @Override
public void run() { public void run() {
mapActivity.getDashboard().refreshContent(true); mapActivity.getDashboard().refreshContent(true);
SRTMPlugin.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
}); });
} }
@ -123,7 +123,7 @@ public class ContourLinesMenu {
item.setDescription(plugin.getPrefDescription(app, contourLinesProp, pref)); item.setDescription(plugin.getPrefDescription(app, contourLinesProp, pref));
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
SRTMPlugin.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
}); });
} else if (itemId == colorSchemeStringId) { } else if (itemId == colorSchemeStringId) {
@ -135,7 +135,7 @@ public class ContourLinesMenu {
item.setDescription(plugin.getPrefDescription(app, colorSchemeProp, colorPref)); item.setDescription(plugin.getPrefDescription(app, colorSchemeProp, colorPref));
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
SRTMPlugin.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
}); });
} else if (itemId == R.string.srtm_plugin_name) { } else if (itemId == R.string.srtm_plugin_name) {
@ -150,7 +150,7 @@ public class ContourLinesMenu {
item.setDescription(plugin.getPrefDescription(app, contourWidthProp, widthPref)); item.setDescription(plugin.getPrefDescription(app, contourWidthProp, widthPref));
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
SRTMPlugin.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
}); });
} else if (contourDensityProp != null && itemId == contourDensityName.hashCode()) { } else if (contourDensityProp != null && itemId == contourDensityName.hashCode()) {
@ -162,7 +162,7 @@ public class ContourLinesMenu {
item.setDescription(plugin.getPrefDescription(app, contourDensityProp, densityPref)); item.setDescription(plugin.getPrefDescription(app, contourDensityProp, densityPref));
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
SRTMPlugin.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
}); });
} }

View file

@ -307,9 +307,8 @@ public class SRTMPlugin extends OsmandPlugin {
item.setSelected(selected); item.setSelected(selected);
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
} }
}); });
} else if (itemId == R.string.shared_string_terrain) { } else if (itemId == R.string.shared_string_terrain) {
@ -328,7 +327,7 @@ public class SRTMPlugin extends OsmandPlugin {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
updateLayers(mapView, mapActivity); updateLayers(mapView, mapActivity);
refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
} }
}); });
} }
@ -486,7 +485,7 @@ public class SRTMPlugin extends OsmandPlugin {
} else { } else {
pref.set(possibleValues[which - 1]); pref.set(possibleValues[which - 1]);
} }
refreshMapComplete(activity); activity.refreshMapComplete();
} }
} }
); );
@ -507,12 +506,6 @@ public class SRTMPlugin extends OsmandPlugin {
public void disable(OsmandApplication app) { public void disable(OsmandApplication app) {
} }
public static void refreshMapComplete(final MapActivity activity) {
activity.getMyApplication().getResourceManager().getRenderer().clearCache();
activity.updateMapSettings();
activity.getMapView().refreshMap(true);
}
private static boolean isNightMode(Activity activity, OsmandApplication app) { private static boolean isNightMode(Activity activity, OsmandApplication app) {
if (activity == null || app == null) { if (activity == null || app == null) {
return false; return false;

View file

@ -40,7 +40,7 @@ public class TerrainAction extends QuickAction {
OsmandPlugin.enablePlugin(activity, activity.getMyApplication(), plugin, true); OsmandPlugin.enablePlugin(activity, activity.getMyApplication(), plugin, true);
} }
plugin.updateLayers(activity.getMapView(), activity); plugin.updateLayers(activity.getMapView(), activity);
SRTMPlugin.refreshMapComplete(activity); activity.refreshMapComplete();
} }
}); });
} }

View file

@ -219,9 +219,8 @@ public class TransportLinesMenu {
return transportPrefs; return transportPrefs;
} }
private static void refreshMap(MapActivity mapActivity) { private static void refreshMap(MapActivity mapActivity) {
ConfigureMapMenu.refreshMapComplete(mapActivity); mapActivity.refreshMapComplete();
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView()); mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
} }