slope/hillshade fixes

This commit is contained in:
veliymolfar 2020-04-10 12:54:57 +03:00
parent 887fca9825
commit 9655500ea9
5 changed files with 11 additions and 4 deletions

View file

@ -4,7 +4,7 @@
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:radius="4dp" />
<stroke android:width="1dp" android:color="?attr/secondary_icon_color" />
<stroke android:width="1dp" android:color="?attr/stroked_buttons_and_links_outline" />
</shape>
</item>
</selector>

View file

@ -34,6 +34,7 @@
<attr name="ctx_menu_divider" format="reference" />
<attr name="bottom_menu_view_bg" format="reference" />
<attr name="left_menu_view_bg" format="reference" />
<attr name="stroked_buttons_and_links_outline" format="color" />
<attr name="dashboard_divider" format="reference" />
<attr name="dashboard_button" format="reference" />

View file

@ -277,6 +277,7 @@
<item name="colorBackgroundFloating">@color/list_background_color_light</item>
<item name="android:colorBackgroundFloating">@color/list_background_color_light</item>
<item name="preferenceTheme">@style/OsmandPreferenceTheme</item>
<item name="stroked_buttons_and_links_outline">@color/stroked_buttons_and_links_outline_light</item>
</style>
<style name="OverflowMenuButton" parent="@style/Widget.AppCompat.ActionButton.Overflow">
@ -542,6 +543,7 @@
<item name="colorBackgroundFloating">@color/list_background_color_dark</item>
<item name="android:colorBackgroundFloating">@color/list_background_color_dark</item>
<item name="preferenceTheme">@style/OsmandPreferenceTheme</item>
<item name="stroked_buttons_and_links_outline">@color/stroked_buttons_and_links_outline_dark</item>
</style>
<style name="FreeVersionBanner" parent="OsmandDarkTheme">

View file

@ -352,9 +352,13 @@ public class SRTMPlugin extends OsmandPlugin {
.setListener(listener).createItem());
}
boolean terrainEnabled = settings.TERRAIN.get();
TerrainMode terrainMode = settings.TERRAIN_MODE.get();
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setId(TERRAIN)
.setTitleId(R.string.shared_string_terrain, mapActivity)
.setDescription(app.getString(terrainMode == TerrainMode.HILLSHADE
? R.string.shared_string_hillshade
: R.string.shared_string_slope))
.setSelected(terrainEnabled)
.setColor(terrainEnabled ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
.setIcon(R.drawable.ic_action_hillshade_dark)

View file

@ -225,8 +225,8 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
public void onStopTrackingTouch(@NonNull Slider slider) {
switch (slider.getId()) {
case R.id.transparency_slider:
double d = (100 - slider.getValue()) * 2.55;
srtmPlugin.setTerrainTransparency((int) d, srtmPlugin.getTerrainMode());
double d = slider.getValue() * 2.55;
srtmPlugin.setTerrainTransparency((int) Math.ceil(d), srtmPlugin.getTerrainMode());
break;
case R.id.zoom_slider:
List<Float> values = slider.getValues();
@ -260,7 +260,7 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
private void updateUiMode() {
TerrainMode mode = srtmPlugin.getTerrainMode();
if (terrainEnabled) {
int transparencyValue = (int) (100 - srtmPlugin.getTerrainTransparency() / 2.55);
int transparencyValue = (int) (srtmPlugin.getTerrainTransparency() / 2.55);
String transparency = transparencyValue + "%";
int minZoom = Math.max(srtmPlugin.getTerrainMinZoom(), TERRAIN_MIN_ZOOM);
int maxZoom = Math.min(srtmPlugin.getTerrainMaxZoom(), TERRAIN_MAX_ZOOM);