From c2df8f5b2913b4c78a481ef616b266d28f89c534 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Mon, 9 Nov 2015 17:49:31 +0200 Subject: [PATCH] Fix for GPX checkbox --- OsmAnd/res/layout/list_menu_item_native.xml | 39 +++++++++---------- .../net/osmand/plus/ContextMenuAdapter.java | 2 +- .../osmand/plus/dialogs/ConfigureMapMenu.java | 12 ++++-- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/OsmAnd/res/layout/list_menu_item_native.xml b/OsmAnd/res/layout/list_menu_item_native.xml index c4ab4f4296..8d01a725d5 100644 --- a/OsmAnd/res/layout/list_menu_item_native.xml +++ b/OsmAnd/res/layout/list_menu_item_native.xml @@ -2,7 +2,8 @@ @@ -13,7 +14,8 @@ android:layout_gravity="center_vertical" android:layout_marginLeft="24dp" android:gravity="center" - android:visibility="gone"/> + android:visibility="gone" + tools:visibility="visible"/> - + android:layout_height="match_parent" + android:focusable="false" + android:gravity="center_vertical" + android:visibility="gone" + tools:visibility="visible"/> - - - - - + + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index dd23b8c655..921b14d672 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -344,7 +344,7 @@ public class ContextMenuAdapter { }); } if (convertView == null || (convertView.getTag() != lid)) { - convertView = activity.getLayoutInflater().inflate(lid, null); + convertView = activity.getLayoutInflater().inflate(lid, parent, false); convertView.setTag(lid); } TextView tv = (TextView) convertView.findViewById(R.id.title); diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 6cbd274288..658571dba5 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -9,6 +9,7 @@ import android.view.View; import android.widget.ArrayAdapter; import android.widget.Toast; +import net.osmand.PlatformUtil; import net.osmand.access.AccessibleToast; import net.osmand.core.android.MapRendererContext; import net.osmand.plus.ContextMenuAdapter; @@ -36,6 +37,8 @@ import net.osmand.render.RenderingRuleStorageProperties; import net.osmand.render.RenderingRulesStorage; import net.osmand.util.Algorithms; +import org.apache.commons.logging.Log; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -45,6 +48,7 @@ import java.util.List; import gnu.trove.list.array.TIntArrayList; public class ConfigureMapMenu { + private static final Log LOG = PlatformUtil.getLog(ConfigureMapMenu.class); public interface OnClickListener{ public void onClick(boolean result); @@ -126,10 +130,12 @@ public class ConfigureMapMenu { ma.getMyApplication().getSelectedGpxHelper().clearAllGpxFileToShow(); } else { AlertDialog dialog = ma.getMapLayers().showGPXFileLayer(getAlreadySelectedGpx(), ma.getMapView()); - dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override - public void onCancel(DialogInterface dialogInterface) { - cm.setSelection(pos, 0); + public void onDismiss(DialogInterface dialog) { + boolean areAnyGpxTracksVisible = + ma.getMyApplication().getSelectedGpxHelper().isShowingAnyGpxFiles(); + cm.setSelection(pos, areAnyGpxTracksVisible ? 1 : 0); adapter.notifyDataSetChanged(); } });