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
android:id="@+id/LinearLayout1"
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:orientation="horizontal">
@ -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"/>
<TextView
android:id="@+id/title"
@ -27,26 +29,21 @@
android:text="@string/layer_poi"
android:textSize="@dimen/default_list_text_size"/>
<LinearLayout
<ImageView
android:id="@+id/icon_settings"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical">
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center_vertical"
android:visibility="gone"
tools:visibility="visible"/>
<ImageView
android:id="@+id/icon_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:gravity="center_vertical"
android:visibility="gone"/>
<!-- android:button="@drawable/ic_btn_wocheckbox" -->
<CheckBox
android:id="@+id/check_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="24dp"
android:focusable="false"/>
</LinearLayout>
<!-- android:button="@drawable/ic_btn_wocheckbox" -->
<CheckBox
android:id="@+id/check_item"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="24dp"
android:focusable="false"/>
</LinearLayout>

View file

@ -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);

View file

@ -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();
}
});