This commit is contained in:
xmd5a 2015-04-12 21:47:51 +03:00
commit e747b81f2a
2 changed files with 12 additions and 7 deletions

View file

@ -21,6 +21,9 @@ import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.activities.TransportRouteHelper; import net.osmand.plus.activities.TransportRouteHelper;
import net.osmand.plus.poi.PoiLegacyFilter; import net.osmand.plus.poi.PoiLegacyFilter;
import net.osmand.plus.views.OsmandMapTileView; 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; import net.osmand.render.RenderingRuleProperty;
import net.osmand.render.RenderingRuleStorageProperties; import net.osmand.render.RenderingRuleStorageProperties;
import net.osmand.render.RenderingRulesStorage; import net.osmand.render.RenderingRulesStorage;
@ -244,7 +247,8 @@ public class ConfigureMapMenu {
adapter.item(R.string.map_magnifier).listen(new OnContextMenuClick() { adapter.item(R.string.map_magnifier).listen(new OnContextMenuClick() {
@Override @Override
public boolean onLongClick(View notUseCouldBeNull) { public boolean onContextMenuClick(final ArrayAdapter<?> ad, int itemId, final int pos, boolean isChecked) {
final OsmandMapTileView view = activity.getMapView();
final OsmandSettings.OsmandPreference<Float> mapDensity = view.getSettings().MAP_DENSITY; final OsmandSettings.OsmandPreference<Float> mapDensity = view.getSettings().MAP_DENSITY;
final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
int p = (int) (mapDensity.get() * 100); int p = (int) (mapDensity.get() * 100);
@ -255,15 +259,14 @@ public class ConfigureMapMenu {
final boolean end = k == tlist.size(); final boolean end = k == tlist.size();
if (i == -1) { if (i == -1) {
if ((end || p < tlist.get(k))) { if ((end || p < tlist.get(k))) {
values.add(p + "%"); values.add(p + " %");
i = k; i = k;
} else if (p == tlist.get(k)) { } else if (p == tlist.get(k)) {
i = k; i = k;
} }
} }
if (k < tlist.size()) { if (k < tlist.size()) {
values.add(tlist.get(k) + "%"); values.add(tlist.get(k) + " %");
} }
} }
if (values.size() != tlist.size()) { if (values.size() != tlist.size()) {
@ -282,13 +285,15 @@ public class ConfigureMapMenu {
if (mapContext != null) { if (mapContext != null) {
mapContext.updateMapSettings(); mapContext.updateMapSettings();
} }
adapter.setItemDescription(pos, String.format("%.0f", 100f * activity.getMyApplication().getSettings().MAP_DENSITY.get()) + " %");
ad.notifyDataSetInvalidated();
dialog.dismiss(); dialog.dismiss();
} }
}); });
bld.show(); bld.show();
return true; return true;
} }
}).description(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() { adapter.item(R.string.text_size).listen(new OnContextMenuClick() {
@Override @Override

View file

@ -778,7 +778,7 @@ public class MapControlsLayer extends OsmandMapLayer {
final boolean end = k == tlist.size(); final boolean end = k == tlist.size();
if (i == -1) { if (i == -1) {
if ((end || p < tlist.get(k))) { if ((end || p < tlist.get(k))) {
values.add(p + "%"); values.add(p + " %");
i = k; i = k;
} else if (p == tlist.get(k)) { } else if (p == tlist.get(k)) {
i = k; i = k;
@ -786,7 +786,7 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
if (k < tlist.size()) { if (k < tlist.size()) {
values.add(tlist.get(k) + "%"); values.add(tlist.get(k) + " %");
} }
} }
if (values.size() != tlist.size()) { if (values.size() != tlist.size()) {