Keep poi show in sync with dialog selection
This commit is contained in:
parent
005b37b49e
commit
810c3cb040
1 changed files with 22 additions and 7 deletions
|
@ -15,6 +15,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
|
import net.osmand.plus.PoiFilter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
import net.osmand.plus.activities.SettingsActivity;
|
||||||
|
@ -103,11 +104,10 @@ public class ConfigureMapMenu {
|
||||||
@Override
|
@Override
|
||||||
public boolean onRowItemClick(ArrayAdapter<?> adapter, View view, int itemId, int pos) {
|
public boolean onRowItemClick(ArrayAdapter<?> adapter, View view, int itemId, int pos) {
|
||||||
if(itemId == R.string.layer_poi && cm.getSelection(pos) == 1) {
|
if(itemId == R.string.layer_poi && cm.getSelection(pos) == 1) {
|
||||||
ma.getMapLayers().selectPOIFilterLayer(ma.getMapView(), null);
|
selectPOILayer(ma.getMyApplication().getSettings());
|
||||||
return false;
|
return false;
|
||||||
} else if(itemId == R.string.layer_gpx_layer && cm.getSelection(pos) == 1) {
|
} else if(itemId == R.string.layer_gpx_layer && cm.getSelection(pos) == 1) {
|
||||||
ma.getMapLayers().showGPXFileLayer(getAlreadySelectedGpx(), ma.getMapView());
|
ma.getMapLayers().showGPXFileLayer(getAlreadySelectedGpx(), ma.getMapView());
|
||||||
// TODO: tick mark of "Show GPX" needs to be synced after return form sub-selection screen (user may or may not have selected files!)
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return super.onRowItemClick(adapter, view, itemId, pos);
|
return super.onRowItemClick(adapter, view, itemId, pos);
|
||||||
|
@ -116,12 +116,13 @@ public class ConfigureMapMenu {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(final ArrayAdapter<?> adapter, int itemId, final int pos, boolean isChecked) {
|
public boolean onContextMenuClick(final ArrayAdapter<?> adapter, int itemId, final int pos, boolean isChecked) {
|
||||||
OsmandSettings settings = ma.getMyApplication().getSettings();
|
final OsmandSettings settings = ma.getMyApplication().getSettings();
|
||||||
if (itemId == R.string.layer_poi) {
|
if (itemId == R.string.layer_poi) {
|
||||||
if (isChecked) {
|
|
||||||
ma.getMapLayers().selectPOIFilterLayer(ma.getMapView(), null);
|
|
||||||
}
|
|
||||||
settings.SHOW_POI_OVER_MAP.set(isChecked);
|
settings.SHOW_POI_OVER_MAP.set(isChecked);
|
||||||
|
if (isChecked) {
|
||||||
|
selectPOILayer(settings);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (itemId == R.string.layer_amenity_label) {
|
} else if (itemId == R.string.layer_amenity_label) {
|
||||||
settings.SHOW_POI_LABEL.set(isChecked);
|
settings.SHOW_POI_LABEL.set(isChecked);
|
||||||
} else if (itemId == R.string.layer_favorites) {
|
} else if (itemId == R.string.layer_favorites) {
|
||||||
|
@ -139,7 +140,6 @@ public class ConfigureMapMenu {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// TODO: tick mark of "Show GPX" needs to be synced after return form sub-selection screen (user may or may not have selected files!)
|
|
||||||
} else if (itemId == R.string.layer_transport_route) {
|
} else if (itemId == R.string.layer_transport_route) {
|
||||||
ma.getMapLayers().getTransportInfoLayer().setVisible(isChecked);
|
ma.getMapLayers().getTransportInfoLayer().setVisible(isChecked);
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,21 @@ public class ConfigureMapMenu {
|
||||||
ma.getMapView().refreshMap();
|
ma.getMapView().refreshMap();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void selectPOILayer(final OsmandSettings settings) {
|
||||||
|
final PoiFilter[] selected = new PoiFilter[1];
|
||||||
|
AlertDialog dlg = ma.getMapLayers().selectPOIFilterLayer(ma.getMapView(), selected);
|
||||||
|
dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
if(selected[0] == null) {
|
||||||
|
settings.SHOW_POI_OVER_MAP.set(selected[0] != null);
|
||||||
|
}
|
||||||
|
ma.getMapActions().refreshDrawer();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createLayersItems(ContextMenuAdapter adapter , MapActivity activity) {
|
private void createLayersItems(ContextMenuAdapter adapter , MapActivity activity) {
|
||||||
|
|
Loading…
Reference in a new issue