From 433c4528e989a317914a2686a105b4883a0e54ec Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 12 Apr 2015 18:05:27 +0200 Subject: [PATCH 1/8] fix some errors --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 8ae4df55e1..590bcc540f 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -244,7 +244,8 @@ public class ConfigureMapMenu { adapter.item(R.string.map_magnifier).listen(new OnContextMenuClick() { @Override - public boolean onLongClick(View notUseCouldBeNull) { + public boolean onContextMenuClick(View notUseCouldBeNull) { + final OsmandMapTileView view = activity.getMapView(); final OsmandSettings.OsmandPreference mapDensity = view.getSettings().MAP_DENSITY; final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); int p = (int) (mapDensity.get() * 100); @@ -260,7 +261,6 @@ public class ConfigureMapMenu { } else if (p == tlist.get(k)) { i = k; } - } if (k < tlist.size()) { values.add(tlist.get(k) + "%"); From 94ab99301b8c1a3f0dc49f526f4155b366d9d5f4 Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 12 Apr 2015 18:17:19 +0200 Subject: [PATCH 2/8] define adapter --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 590bcc540f..73944012e6 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -244,7 +244,7 @@ public class ConfigureMapMenu { adapter.item(R.string.map_magnifier).listen(new OnContextMenuClick() { @Override - public boolean onContextMenuClick(View notUseCouldBeNull) { + public boolean onContextMenuClick(final ArrayAdapter ad, int itemId, final int pos, boolean isChecked) { final OsmandMapTileView view = activity.getMapView(); final OsmandSettings.OsmandPreference mapDensity = view.getSettings().MAP_DENSITY; final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); From 045e9f894b19e3cf0e895f56e9cf3b711ee1aa54 Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 12 Apr 2015 18:28:12 +0200 Subject: [PATCH 3/8] import TIntArrayList --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 73944012e6..bf6278c113 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -21,6 +21,7 @@ import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.activities.TransportRouteHelper; import net.osmand.plus.poi.PoiLegacyFilter; import net.osmand.plus.views.OsmandMapTileView; +import gnu.trove.list.array.TIntArrayList; import net.osmand.render.RenderingRuleProperty; import net.osmand.render.RenderingRuleStorageProperties; import net.osmand.render.RenderingRulesStorage; @@ -282,6 +283,8 @@ public class ConfigureMapMenu { if (mapContext != null) { mapContext.updateMapSettings(); } + adapter.setItemDescription(pos, activity.getMyApplication().getSettings().MAP_DENSITY.get()); + ad.notifyDataSetInvalidated() dialog.dismiss(); } }); From 2a939eaf10e7378d372d6658c2a84914cb4b9c14 Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 12 Apr 2015 18:30:53 +0200 Subject: [PATCH 4/8] import MapRendererContext --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index bf6278c113..5a0f9c0694 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -22,6 +22,7 @@ import net.osmand.plus.activities.TransportRouteHelper; import net.osmand.plus.poi.PoiLegacyFilter; import net.osmand.plus.views.OsmandMapTileView; import gnu.trove.list.array.TIntArrayList; +import net.osmand.core.android.MapRendererContext; import net.osmand.render.RenderingRuleProperty; import net.osmand.render.RenderingRuleStorageProperties; import net.osmand.render.RenderingRulesStorage; From 80b4b6e59d12a8e95522c36a11ee2d9ecc27cbf9 Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 12 Apr 2015 18:35:21 +0200 Subject: [PATCH 5/8] convert float --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 5a0f9c0694..45a06cda74 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -292,7 +292,7 @@ public class ConfigureMapMenu { bld.show(); return true; } - }).description(activity.getMyApplication().getSettings().MAP_DENSITY.get()).layout(R.layout.drawer_list_doubleitem).reg(); + }).description(String.format("%.2f", activity.getMyApplication().getSettings().MAP_DENSITY.get())).layout(R.layout.drawer_list_doubleitem).reg(); adapter.item(R.string.text_size).listen(new OnContextMenuClick() { @Override From 0cbf5149d021c20bbc6fde8d126a643c352a0fcd Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 12 Apr 2015 18:38:34 +0200 Subject: [PATCH 6/8] add missing ; --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 45a06cda74..0c21fd4e1d 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -285,7 +285,7 @@ public class ConfigureMapMenu { mapContext.updateMapSettings(); } adapter.setItemDescription(pos, activity.getMyApplication().getSettings().MAP_DENSITY.get()); - ad.notifyDataSetInvalidated() + ad.notifyDataSetInvalidated(); dialog.dismiss(); } }); From 2e0ccc0a27a82c63318c8c46a21e90ba93468687 Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 12 Apr 2015 18:46:32 +0200 Subject: [PATCH 7/8] import NativeCoreContext --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 0c21fd4e1d..ac6e9dc277 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -21,6 +21,7 @@ import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.activities.TransportRouteHelper; import net.osmand.plus.poi.PoiLegacyFilter; import net.osmand.plus.views.OsmandMapTileView; +import net.osmand.plus.views.corenative.NativeCoreContext; import gnu.trove.list.array.TIntArrayList; import net.osmand.core.android.MapRendererContext; import net.osmand.render.RenderingRuleProperty; @@ -284,7 +285,7 @@ public class ConfigureMapMenu { if (mapContext != null) { mapContext.updateMapSettings(); } - adapter.setItemDescription(pos, activity.getMyApplication().getSettings().MAP_DENSITY.get()); + adapter.setItemDescription(pos, String.format("%.2f", activity.getMyApplication().getSettings().MAP_DENSITY.get())); ad.notifyDataSetInvalidated(); dialog.dismiss(); } From 255e573c6ce6d668614b485bacd13d9ea0884b5c Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 12 Apr 2015 19:08:10 +0200 Subject: [PATCH 8/8] align display values --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 8 ++++---- OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index ac6e9dc277..7ccae13b3e 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -259,14 +259,14 @@ public class ConfigureMapMenu { final boolean end = k == tlist.size(); if (i == -1) { if ((end || p < tlist.get(k))) { - values.add(p + "%"); + values.add(p + " %"); i = k; } else if (p == tlist.get(k)) { i = k; } } if (k < tlist.size()) { - values.add(tlist.get(k) + "%"); + values.add(tlist.get(k) + " %"); } } if (values.size() != tlist.size()) { @@ -285,7 +285,7 @@ public class ConfigureMapMenu { if (mapContext != null) { mapContext.updateMapSettings(); } - adapter.setItemDescription(pos, String.format("%.2f", activity.getMyApplication().getSettings().MAP_DENSITY.get())); + adapter.setItemDescription(pos, String.format("%.0f", 100f * activity.getMyApplication().getSettings().MAP_DENSITY.get()) + " %"); ad.notifyDataSetInvalidated(); dialog.dismiss(); } @@ -293,7 +293,7 @@ public class ConfigureMapMenu { bld.show(); return true; } - }).description(String.format("%.2f", activity.getMyApplication().getSettings().MAP_DENSITY.get())).layout(R.layout.drawer_list_doubleitem).reg(); + }).description(String.format("%.0f", 100f * activity.getMyApplication().getSettings().MAP_DENSITY.get()) + " %").layout(R.layout.drawer_list_doubleitem).reg(); adapter.item(R.string.text_size).listen(new OnContextMenuClick() { @Override diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index 22a301f700..26adc497c2 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -778,7 +778,7 @@ public class MapControlsLayer extends OsmandMapLayer { final boolean end = k == tlist.size(); if (i == -1) { if ((end || p < tlist.get(k))) { - values.add(p + "%"); + values.add(p + " %"); i = k; } else if (p == tlist.get(k)) { i = k; @@ -786,7 +786,7 @@ public class MapControlsLayer extends OsmandMapLayer { } if (k < tlist.size()) { - values.add(tlist.get(k) + "%"); + values.add(tlist.get(k) + " %"); } } if (values.size() != tlist.size()) {