Show GPX on map dialog fix
This commit is contained in:
parent
fa06bee75b
commit
7765383d85
4 changed files with 104 additions and 111 deletions
|
@ -1,32 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
android:id="@+id/LinearLayout1"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:layout_marginRight="5dip">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="14dip"
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_vertical" />
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dip"
|
||||
android:layout_marginTop="11dip"
|
||||
android:layout_marginBottom="11dip"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/layer_poi"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:layout_weight="1" />
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -37,16 +36,16 @@
|
|||
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:focusable="false" />
|
||||
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="6dip"
|
||||
android:layout_marginRight="24dp"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -2261,4 +2261,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="recent_places">Recent places</string>
|
||||
<string name="favourites">Favourites</string>
|
||||
<string name="saved_at_time">Successfully saved at: %1$s</string>
|
||||
<string name="poi_deleted_localy">POI will be deleted once you upload your changes</string>
|
||||
<string name="show_gpx">Show GPX</string>
|
||||
</resources>
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.app.Application;
|
|||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.os.Build;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
|
@ -53,7 +52,6 @@ public class GpxUiHelper {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public static String getColorValue(String clr, String value, boolean html) {
|
||||
if (!html) {
|
||||
return value;
|
||||
|
@ -232,15 +230,10 @@ public class GpxUiHelper {
|
|||
final List<String> list, final ContextMenuAdapter adapter) {
|
||||
final OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(activity);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
// final int padding = (int) (12 * activity.getResources().getDisplayMetrics().density + 0.5f);
|
||||
final boolean light = app.getSettings().isLightContent();
|
||||
final int layout;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
||||
layout = R.layout.list_menu_item;
|
||||
} else {
|
||||
layout = R.layout.list_menu_item_native;
|
||||
}
|
||||
final int layout = R.layout.list_menu_item_native;
|
||||
|
||||
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(activity, layout, R.id.title,
|
||||
adapter.getItemNames()) {
|
||||
|
@ -303,9 +296,10 @@ public class GpxUiHelper {
|
|||
public void onClick(DialogInterface dialog, int position) {
|
||||
}
|
||||
};
|
||||
b.setAdapter(listAdapter, onClickListener);
|
||||
builder.setAdapter(listAdapter, onClickListener);
|
||||
if (multipleChoice) {
|
||||
b.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||
builder.setTitle(R.string.show_gpx)
|
||||
.setPositiveButton(R.string.shared_string_ok, new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
@ -318,7 +312,7 @@ public class GpxUiHelper {
|
|||
if (showCurrentGpx && adapter.getSelection(0) > 0) {
|
||||
currentGPX = app.getSavingTrackHelper().getCurrentGpx();
|
||||
}
|
||||
List<String> s = new ArrayList<String>();
|
||||
List<String> s = new ArrayList<>();
|
||||
for (int i = (showCurrentGpx ? 1 : 0); i < adapter.length(); i++) {
|
||||
if (adapter.getSelection(i) > 0) {
|
||||
s.add(list.get(i));
|
||||
|
@ -328,10 +322,11 @@ public class GpxUiHelper {
|
|||
loadGPXFileInDifferentThread(activity, callbackWithObject, dir, currentGPX,
|
||||
s.toArray(new String[s.size()]));
|
||||
}
|
||||
});
|
||||
})
|
||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
}
|
||||
|
||||
final AlertDialog dlg = b.create();
|
||||
final AlertDialog dlg = builder.create();
|
||||
dlg.setCanceledOnTouchOutside(true);
|
||||
dlg.getListView().setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
|
@ -360,16 +355,16 @@ public class GpxUiHelper {
|
|||
}
|
||||
|
||||
public static List<String> getSortedGPXFilenamesByDate(File dir, boolean absolutePath) {
|
||||
final Map<String, Long> mp = new HashMap<String, Long>();
|
||||
final Map<String, Long> mp = new HashMap<>();
|
||||
readGpxDirectory(dir, mp, "", absolutePath);
|
||||
ArrayList<String> list = new ArrayList<String>(mp.keySet());
|
||||
ArrayList<String> list = new ArrayList<>(mp.keySet());
|
||||
Collections.sort(list, new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String object1, String object2) {
|
||||
Long l1 = mp.get(object1);
|
||||
Long l2 = mp.get(object2);
|
||||
long lhs = l1 == null ? 0 : l1.longValue();
|
||||
long rhs = l2 == null ? 0 : l2.longValue();
|
||||
long lhs = l1 == null ? 0 : l1;
|
||||
long rhs = l2 == null ? 0 : l2;
|
||||
return lhs < rhs ? 1 : (lhs == rhs ? 0 : -1);
|
||||
}
|
||||
});
|
||||
|
@ -378,9 +373,9 @@ public class GpxUiHelper {
|
|||
|
||||
|
||||
public static List<String> getSortedGPXFilenames(File dir, boolean absolutePath) {
|
||||
final Map<String, Long> mp = new HashMap<String, Long>();
|
||||
final Map<String, Long> mp = new HashMap<>();
|
||||
readGpxDirectory(dir, mp, "", absolutePath);
|
||||
ArrayList<String> list = new ArrayList<String>(mp.keySet());
|
||||
ArrayList<String> list = new ArrayList<>(mp.keySet());
|
||||
Collections.sort(list, new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String object1, String object2) {
|
||||
|
|
|
@ -20,8 +20,6 @@ import net.osmand.plus.osmedit.OpenstreetmapUtil;
|
|||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.plus.osmedit.OsmPoint;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public class DeletePoiDialogFragment extends DialogFragment {
|
||||
private static final String KEY_AMENITY_NODE = "amenity_node";
|
||||
|
||||
|
@ -47,9 +45,8 @@ public class DeletePoiDialogFragment extends DialogFragment {
|
|||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AccessibleToast.makeText(activity, MessageFormat.format(
|
||||
getString(R.string.poi_action_succeded_template),
|
||||
getString(R.string.poi_action_delete)),
|
||||
AccessibleToast.makeText(activity,
|
||||
getString(R.string.poi_deleted_localy),
|
||||
Toast.LENGTH_LONG).show();
|
||||
if (activity instanceof MapActivity) {
|
||||
((MapActivity) activity).getMapView().refreshMap(true);
|
||||
|
|
Loading…
Reference in a new issue