Fix for GPX checkbox

This commit is contained in:
GaidamakUA 2015-11-09 17:49:31 +02:00
parent 126a951602
commit c2df8f5b29
3 changed files with 28 additions and 25 deletions

View file

@ -2,7 +2,8 @@
<LinearLayout <LinearLayout
android:id="@+id/LinearLayout1" android:id="@+id/LinearLayout1"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
@ -13,7 +14,8 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="24dp" android:layout_marginLeft="24dp"
android:gravity="center" android:gravity="center"
android:visibility="gone"/> android:visibility="gone"
tools:visibility="visible"/>
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
@ -27,26 +29,21 @@
android:text="@string/layer_poi" android:text="@string/layer_poi"
android:textSize="@dimen/default_list_text_size"/> android:textSize="@dimen/default_list_text_size"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical">
<ImageView <ImageView
android:id="@+id/icon_settings" android:id="@+id/icon_settings"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:focusable="false" android:focusable="false"
android:gravity="center_vertical" android:gravity="center_vertical"
android:visibility="gone"/> android:visibility="gone"
tools:visibility="visible"/>
<!-- android:button="@drawable/ic_btn_wocheckbox" --> <!-- android:button="@drawable/ic_btn_wocheckbox" -->
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/check_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginRight="24dp" android:layout_marginRight="24dp"
android:focusable="false"/> android:focusable="false"/>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -344,7 +344,7 @@ public class ContextMenuAdapter {
}); });
} }
if (convertView == null || (convertView.getTag() != lid)) { if (convertView == null || (convertView.getTag() != lid)) {
convertView = activity.getLayoutInflater().inflate(lid, null); convertView = activity.getLayoutInflater().inflate(lid, parent, false);
convertView.setTag(lid); convertView.setTag(lid);
} }
TextView tv = (TextView) convertView.findViewById(R.id.title); TextView tv = (TextView) convertView.findViewById(R.id.title);

View file

@ -9,6 +9,7 @@ import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Toast; import android.widget.Toast;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleToast; import net.osmand.access.AccessibleToast;
import net.osmand.core.android.MapRendererContext; import net.osmand.core.android.MapRendererContext;
import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter;
@ -36,6 +37,8 @@ import net.osmand.render.RenderingRuleStorageProperties;
import net.osmand.render.RenderingRulesStorage; import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -45,6 +48,7 @@ import java.util.List;
import gnu.trove.list.array.TIntArrayList; import gnu.trove.list.array.TIntArrayList;
public class ConfigureMapMenu { public class ConfigureMapMenu {
private static final Log LOG = PlatformUtil.getLog(ConfigureMapMenu.class);
public interface OnClickListener{ public interface OnClickListener{
public void onClick(boolean result); public void onClick(boolean result);
@ -126,10 +130,12 @@ public class ConfigureMapMenu {
ma.getMyApplication().getSelectedGpxHelper().clearAllGpxFileToShow(); ma.getMyApplication().getSelectedGpxHelper().clearAllGpxFileToShow();
} else { } else {
AlertDialog dialog = ma.getMapLayers().showGPXFileLayer(getAlreadySelectedGpx(), ma.getMapView()); AlertDialog dialog = ma.getMapLayers().showGPXFileLayer(getAlreadySelectedGpx(), ma.getMapView());
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override @Override
public void onCancel(DialogInterface dialogInterface) { public void onDismiss(DialogInterface dialog) {
cm.setSelection(pos, 0); boolean areAnyGpxTracksVisible =
ma.getMyApplication().getSelectedGpxHelper().isShowingAnyGpxFiles();
cm.setSelection(pos, areAnyGpxTracksVisible ? 1 : 0);
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
}); });