Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terrain menu category also for v1 engine #17725

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ public void createAdapterItem(@NonNull ContextMenuAdapter adapter,
public void registerLayerContextMenuActions(@NonNull ContextMenuAdapter menuAdapter,
@NonNull MapActivity mapActivity,
@NonNull List<RenderingRuleProperty> customRules) {
if (!app.useOpenGlRenderer()) {
createAdapterItem(menuAdapter, mapActivity, customRules);
}
return;
}

private boolean hasDepthMaps() {
Expand Down
40 changes: 20 additions & 20 deletions OsmAnd/src/net/osmand/plus/plugins/srtm/SRTMPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private void removeTerrainLayer(@NonNull OsmandMapTileView mapView) {
protected void registerConfigureMapCategoryActions(@NonNull ContextMenuAdapter adapter,
@NonNull MapActivity mapActivity,
@NonNull List<RenderingRuleProperty> customRules) {
if (isEnabled() && app.useOpenGlRenderer()) {
if (isEnabled()) {
adapter.addItem(new ContextMenuItem(TERRAIN_CATEGORY_ID)
.setCategory(true)
.setTitle(app.getString(R.string.shared_string_terrain))
Expand All @@ -398,7 +398,9 @@ protected void registerConfigureMapCategoryActions(@NonNull ContextMenuAdapter a
addTerrainDescriptionItem(adapter, mapActivity);
} else {
createContextMenuItems(adapter, mapActivity);
add3DReliefItem(adapter, mapActivity);
if (app.useOpenGlRenderer()) {
add3DReliefItem(adapter, mapActivity);
}
}
NauticalMapsPlugin nauticalPlugin = PluginsHelper.getPlugin(NauticalMapsPlugin.class);
if (nauticalPlugin != null) {
Expand All @@ -409,28 +411,26 @@ protected void registerConfigureMapCategoryActions(@NonNull ContextMenuAdapter a

private void addTerrainDescriptionItem(@NonNull ContextMenuAdapter adapter,
@NonNull MapActivity activity) {
adapter.addItem(new ContextMenuItem(TERRAIN_DESCRIPTION_ID)
.setLayout(R.layout.list_item_terrain_description)
.setTitleId(TERRAIN_DESCRIPTION_ID.hashCode(), null)
.setClickable(false)
.setListener((uiAdapter, view, item, isChecked) -> {
ChoosePlanFragment.showInstance(activity, OsmAndFeature.TERRAIN);
return true;
}));
if (app.useOpenGlRenderer()) {
adapter.addItem(new ContextMenuItem(TERRAIN_DESCRIPTION_ID)
.setLayout(R.layout.list_item_terrain_description)
.setTitleId(TERRAIN_DESCRIPTION_ID.hashCode(), null)
.setClickable(false)
.setListener((uiAdapter, view, item, isChecked) -> {
ChoosePlanFragment.showInstance(activity, OsmAndFeature.TERRAIN);
return true;
}));
} else {
PurchasingUtils.createPromoItem(adapter, activity, OsmAndFeature.TERRAIN,
TERRAIN_ID,
R.string.shared_string_terrain,
R.string.contour_lines_hillshade_slope);
}
}

@Override
protected void registerLayerContextMenuActions(@NonNull ContextMenuAdapter adapter, @NonNull MapActivity mapActivity, @NonNull List<RenderingRuleProperty> customRules) {
if (isEnabled() && !app.useOpenGlRenderer()) {
if (isLocked()) {
PurchasingUtils.createPromoItem(adapter, mapActivity, OsmAndFeature.TERRAIN,
TERRAIN_ID,
R.string.shared_string_terrain,
R.string.contour_lines_hillshade_slope);
} else {
createContextMenuItems(adapter, mapActivity);
}
}
return;
}

private void createContextMenuItems(@NonNull ContextMenuAdapter adapter, @NonNull MapActivity mapActivity) {
Expand Down