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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
android:id="@+id/LinearLayout1"
|
android:id="@+id/LinearLayout1"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal">
|
||||||
android:layout_marginLeft="5dip"
|
|
||||||
android:layout_marginRight="5dip">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_marginLeft="14dip"
|
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginLeft="24dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_gravity="center_vertical" />
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="12dip"
|
|
||||||
android:layout_marginTop="11dip"
|
|
||||||
android:layout_marginBottom="11dip"
|
android:layout_marginBottom="11dip"
|
||||||
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/layer_poi"
|
android:text="@string/layer_poi"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"/>
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -37,17 +36,17 @@
|
||||||
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="wrap_content"
|
||||||
|
android:focusable="false"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:visibility="gone"
|
android:visibility="gone"/>
|
||||||
android:focusable="false" />
|
|
||||||
|
|
||||||
<!-- 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="wrap_content"
|
||||||
android:layout_marginRight="6dip"
|
android:layout_marginRight="24dp"
|
||||||
android:focusable="false" />
|
android:focusable="false"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -2261,4 +2261,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
||||||
<string name="recent_places">Recent places</string>
|
<string name="recent_places">Recent places</string>
|
||||||
<string name="favourites">Favourites</string>
|
<string name="favourites">Favourites</string>
|
||||||
<string name="saved_at_time">Successfully saved at: %1$s</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>
|
</resources>
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.app.Application;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.os.Build;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -53,9 +52,8 @@ public class GpxUiHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getColorValue(String clr, String value, boolean html) {
|
public static String getColorValue(String clr, String value, boolean html) {
|
||||||
if(!html) {
|
if (!html) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return "<font color=\"" + clr + "\">" + value + "</font>";
|
return "<font color=\"" + clr + "\">" + value + "</font>";
|
||||||
|
@ -67,7 +65,7 @@ public class GpxUiHelper {
|
||||||
|
|
||||||
public static String getDescription(OsmandApplication app, GPXTrackAnalysis analysis, boolean html) {
|
public static String getDescription(OsmandApplication app, GPXTrackAnalysis analysis, boolean html) {
|
||||||
StringBuilder description = new StringBuilder();
|
StringBuilder description = new StringBuilder();
|
||||||
String nl = html?"<br/>":"\n";
|
String nl = html ? "<br/>" : "\n";
|
||||||
String timeSpanClr = Algorithms.colorToString(app.getResources().getColor(R.color.gpx_time_span_color));
|
String timeSpanClr = Algorithms.colorToString(app.getResources().getColor(R.color.gpx_time_span_color));
|
||||||
String distanceClr = Algorithms.colorToString(app.getResources().getColor(R.color.gpx_distance_color));
|
String distanceClr = Algorithms.colorToString(app.getResources().getColor(R.color.gpx_distance_color));
|
||||||
String speedClr = Algorithms.colorToString(app.getResources().getColor(R.color.gpx_speed));
|
String speedClr = Algorithms.colorToString(app.getResources().getColor(R.color.gpx_speed));
|
||||||
|
@ -77,29 +75,29 @@ public class GpxUiHelper {
|
||||||
// 1. Total distance, Start time, End time
|
// 1. Total distance, Start time, End time
|
||||||
description.append(app.getString(R.string.gpx_info_distance, getColorValue(distanceClr,
|
description.append(app.getString(R.string.gpx_info_distance, getColorValue(distanceClr,
|
||||||
OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app), html),
|
OsmAndFormatter.getFormattedDistance(analysis.totalDistance, app), html),
|
||||||
getColorValue(distanceClr, analysis.points+"", html) ));
|
getColorValue(distanceClr, analysis.points + "", html)));
|
||||||
if(analysis.totalTracks > 1) {
|
if (analysis.totalTracks > 1) {
|
||||||
description.append(nl).append(app.getString(R.string.gpx_info_subtracks, getColorValue(speedClr, analysis.totalTracks+"", html)));
|
description.append(nl).append(app.getString(R.string.gpx_info_subtracks, getColorValue(speedClr, analysis.totalTracks + "", html)));
|
||||||
}
|
}
|
||||||
if(analysis.wptPoints > 0) {
|
if (analysis.wptPoints > 0) {
|
||||||
description.append(nl).append(app.getString(R.string.gpx_info_waypoints, getColorValue(speedClr, analysis.wptPoints+"", html)));
|
description.append(nl).append(app.getString(R.string.gpx_info_waypoints, getColorValue(speedClr, analysis.wptPoints + "", html)));
|
||||||
}
|
}
|
||||||
if(analysis.isTimeSpecified()) {
|
if (analysis.isTimeSpecified()) {
|
||||||
description.append(nl).append(app.getString(R.string.gpx_info_start_time, analysis.startTime));
|
description.append(nl).append(app.getString(R.string.gpx_info_start_time, analysis.startTime));
|
||||||
description.append(nl).append(app.getString(R.string.gpx_info_end_time, analysis.endTime));
|
description.append(nl).append(app.getString(R.string.gpx_info_end_time, analysis.endTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Time span
|
// 2. Time span
|
||||||
if(analysis.timeSpan > 0 && analysis.timeSpan / 1000 != analysis.timeMoving / 1000) {
|
if (analysis.timeSpan > 0 && analysis.timeSpan / 1000 != analysis.timeMoving / 1000) {
|
||||||
final String formatDuration = Algorithms.formatDuration((int) (analysis.timeSpan/1000)
|
final String formatDuration = Algorithms.formatDuration((int) (analysis.timeSpan / 1000)
|
||||||
);
|
);
|
||||||
description.append(nl).append(app.getString(R.string.gpx_timespan,
|
description.append(nl).append(app.getString(R.string.gpx_timespan,
|
||||||
getColorValue(timeSpanClr, formatDuration, html)));
|
getColorValue(timeSpanClr, formatDuration, html)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Time moving, if any
|
// 3. Time moving, if any
|
||||||
if(analysis.isTimeMoving()){
|
if (analysis.isTimeMoving()) {
|
||||||
final String formatDuration = Algorithms.formatDuration((int) (analysis.timeMoving/1000)
|
final String formatDuration = Algorithms.formatDuration((int) (analysis.timeMoving / 1000)
|
||||||
);
|
);
|
||||||
description.append(nl).append(app.getString(R.string.gpx_timemoving,
|
description.append(nl).append(app.getString(R.string.gpx_timemoving,
|
||||||
getColorValue(timeSpanClr, formatDuration, html)));
|
getColorValue(timeSpanClr, formatDuration, html)));
|
||||||
|
@ -115,32 +113,32 @@ public class GpxUiHelper {
|
||||||
String max = getColorValue(ascClr, OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app), html);
|
String max = getColorValue(ascClr, OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app), html);
|
||||||
String asc = getColorValue(ascClr, OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app), html);
|
String asc = getColorValue(ascClr, OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app), html);
|
||||||
String desc = getColorValue(descClr, OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app), html);
|
String desc = getColorValue(descClr, OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app), html);
|
||||||
description.append(app.getString(R.string.gpx_info_diff_altitude,min +" - " + max ));
|
description.append(app.getString(R.string.gpx_info_diff_altitude, min + " - " + max));
|
||||||
description.append(nl);
|
description.append(nl);
|
||||||
description.append(app.getString(R.string.gpx_info_asc_altitude,"\u2193 " + desc + " \u2191 " + asc + ""));
|
description.append(app.getString(R.string.gpx_info_asc_altitude, "\u2193 " + desc + " \u2191 " + asc + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(analysis.isSpeedSpecified()){
|
if (analysis.isSpeedSpecified()) {
|
||||||
String avg = getColorValue(speedClr, OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app), html);
|
String avg = getColorValue(speedClr, OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app), html);
|
||||||
String max = getColorValue(ascClr, OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app), html);
|
String max = getColorValue(ascClr, OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app), html);
|
||||||
description.append(nl).append(app.getString(R.string.gpx_info_average_speed,avg));
|
description.append(nl).append(app.getString(R.string.gpx_info_average_speed, avg));
|
||||||
description.append(nl).append(app.getString(R.string.gpx_info_maximum_speed,max));
|
description.append(nl).append(app.getString(R.string.gpx_info_maximum_speed, max));
|
||||||
}
|
}
|
||||||
return description.toString();
|
return description.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlertDialog selectGPXFile(List<String> selectedGpxList, final Activity activity,
|
public static AlertDialog selectGPXFile(List<String> selectedGpxList, final Activity activity,
|
||||||
final boolean showCurrentGpx, final boolean multipleChoice, final CallbackWithObject<GPXFile[]> callbackWithObject){
|
final boolean showCurrentGpx, final boolean multipleChoice, final CallbackWithObject<GPXFile[]> callbackWithObject) {
|
||||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||||
final List<String> allGpxList = getSortedGPXFilenames(dir, false);
|
final List<String> allGpxList = getSortedGPXFilenames(dir, false);
|
||||||
if(allGpxList.isEmpty()){
|
if (allGpxList.isEmpty()) {
|
||||||
AccessibleToast.makeText(activity, R.string.gpx_files_not_found, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, R.string.gpx_files_not_found, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!allGpxList.isEmpty() || showCurrentGpx){
|
if (!allGpxList.isEmpty() || showCurrentGpx) {
|
||||||
if(showCurrentGpx){
|
if (showCurrentGpx) {
|
||||||
allGpxList.add(0, activity.getString(R.string.show_current_gpx_title));
|
allGpxList.add(0, activity.getString(R.string.show_current_gpx_title));
|
||||||
}
|
}
|
||||||
final ContextMenuAdapter adapter = createGpxContextMenuAdapter(activity, allGpxList, selectedGpxList, multipleChoice,
|
final ContextMenuAdapter adapter = createGpxContextMenuAdapter(activity, allGpxList, selectedGpxList, multipleChoice,
|
||||||
|
@ -156,11 +154,11 @@ public class GpxUiHelper {
|
||||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||||
final List<String> list = getSortedGPXFilenames(dir, false);
|
final List<String> list = getSortedGPXFilenames(dir, false);
|
||||||
if(list.isEmpty()){
|
if (list.isEmpty()) {
|
||||||
AccessibleToast.makeText(activity, R.string.gpx_files_not_found, Toast.LENGTH_LONG).show();
|
AccessibleToast.makeText(activity, R.string.gpx_files_not_found, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
if(!list.isEmpty() || showCurrentGpx){
|
if (!list.isEmpty() || showCurrentGpx) {
|
||||||
if(showCurrentGpx){
|
if (showCurrentGpx) {
|
||||||
list.add(0, activity.getString(R.string.show_current_gpx_title));
|
list.add(0, activity.getString(R.string.show_current_gpx_title));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,8 +196,8 @@ public class GpxUiHelper {
|
||||||
|
|
||||||
protected static void updateSelection(List<String> selectedGpxList, boolean showCurrentTrack,
|
protected static void updateSelection(List<String> selectedGpxList, boolean showCurrentTrack,
|
||||||
final ContextMenuAdapter adapter, int i, String fileName) {
|
final ContextMenuAdapter adapter, int i, String fileName) {
|
||||||
if(i == 0 && showCurrentTrack) {
|
if (i == 0 && showCurrentTrack) {
|
||||||
if(selectedGpxList.contains("")) {
|
if (selectedGpxList.contains("")) {
|
||||||
adapter.setSelection(i, 1);
|
adapter.setSelection(i, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -232,15 +230,10 @@ public class GpxUiHelper {
|
||||||
final List<String> list, final ContextMenuAdapter adapter) {
|
final List<String> list, final ContextMenuAdapter adapter) {
|
||||||
final OsmandApplication app = (OsmandApplication) activity.getApplication();
|
final OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
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 int padding = (int) (12 * activity.getResources().getDisplayMetrics().density + 0.5f);
|
||||||
final boolean light = app.getSettings().isLightContent();
|
final boolean light = app.getSettings().isLightContent();
|
||||||
final int layout;
|
final int layout = R.layout.list_menu_item_native;
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
|
||||||
layout = R.layout.list_menu_item;
|
|
||||||
} else {
|
|
||||||
layout = R.layout.list_menu_item_native;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(activity, layout, R.id.title,
|
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(activity, layout, R.id.title,
|
||||||
adapter.getItemNames()) {
|
adapter.getItemNames()) {
|
||||||
|
@ -258,7 +251,7 @@ public class GpxUiHelper {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int nline = adapter.getItemName(position).indexOf('\n');
|
int nline = adapter.getItemName(position).indexOf('\n');
|
||||||
if(nline == -1) {
|
if (nline == -1) {
|
||||||
setDescripionInDialog(arrayAdapter, adapter, activity, dir, list.get(position), position);
|
setDescripionInDialog(arrayAdapter, adapter, activity, dir, list.get(position), position);
|
||||||
} else {
|
} else {
|
||||||
adapter.setItemName(position, adapter.getItemName(position).substring(0, nline));
|
adapter.setItemName(position, adapter.getItemName(position).substring(0, nline));
|
||||||
|
@ -267,7 +260,7 @@ public class GpxUiHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
if(showCurrentGpx && position == 0) {
|
if (showCurrentGpx && position == 0) {
|
||||||
icon.setVisibility(View.INVISIBLE);
|
icon.setVisibility(View.INVISIBLE);
|
||||||
} else {
|
} else {
|
||||||
icon.setVisibility(View.VISIBLE);
|
icon.setVisibility(View.VISIBLE);
|
||||||
|
@ -303,22 +296,23 @@ public class GpxUiHelper {
|
||||||
public void onClick(DialogInterface dialog, int position) {
|
public void onClick(DialogInterface dialog, int position) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
b.setAdapter(listAdapter, onClickListener);
|
builder.setAdapter(listAdapter, onClickListener);
|
||||||
if (multipleChoice) {
|
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
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
GPXFile currentGPX = null;
|
GPXFile currentGPX = null;
|
||||||
//clear all previously selected files before adding new one
|
//clear all previously selected files before adding new one
|
||||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
if(app != null && app.getSelectedGpxHelper() != null){
|
if (app != null && app.getSelectedGpxHelper() != null) {
|
||||||
app.getSelectedGpxHelper().clearAllGpxFileToShow();
|
app.getSelectedGpxHelper().clearAllGpxFileToShow();
|
||||||
}
|
}
|
||||||
if (showCurrentGpx && adapter.getSelection(0) > 0) {
|
if (showCurrentGpx && adapter.getSelection(0) > 0) {
|
||||||
currentGPX = app.getSavingTrackHelper().getCurrentGpx();
|
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++) {
|
for (int i = (showCurrentGpx ? 1 : 0); i < adapter.length(); i++) {
|
||||||
if (adapter.getSelection(i) > 0) {
|
if (adapter.getSelection(i) > 0) {
|
||||||
s.add(list.get(i));
|
s.add(list.get(i));
|
||||||
|
@ -328,10 +322,11 @@ public class GpxUiHelper {
|
||||||
loadGPXFileInDifferentThread(activity, callbackWithObject, dir, currentGPX,
|
loadGPXFileInDifferentThread(activity, callbackWithObject, dir, currentGPX,
|
||||||
s.toArray(new String[s.size()]));
|
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.setCanceledOnTouchOutside(true);
|
||||||
dlg.getListView().setOnItemClickListener(new OnItemClickListener() {
|
dlg.getListView().setOnItemClickListener(new OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -360,16 +355,16 @@ public class GpxUiHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getSortedGPXFilenamesByDate(File dir, boolean absolutePath) {
|
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);
|
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>() {
|
Collections.sort(list, new Comparator<String>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(String object1, String object2) {
|
public int compare(String object1, String object2) {
|
||||||
Long l1 = mp.get(object1);
|
Long l1 = mp.get(object1);
|
||||||
Long l2 = mp.get(object2);
|
Long l2 = mp.get(object2);
|
||||||
long lhs = l1 == null ? 0 : l1.longValue();
|
long lhs = l1 == null ? 0 : l1;
|
||||||
long rhs = l2 == null ? 0 : l2.longValue();
|
long rhs = l2 == null ? 0 : l2;
|
||||||
return lhs < rhs ? 1 : (lhs == rhs ? 0 : -1);
|
return lhs < rhs ? 1 : (lhs == rhs ? 0 : -1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -378,9 +373,9 @@ public class GpxUiHelper {
|
||||||
|
|
||||||
|
|
||||||
public static List<String> getSortedGPXFilenames(File dir, boolean absolutePath) {
|
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);
|
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>() {
|
Collections.sort(list, new Comparator<String>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(String object1, String object2) {
|
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.OsmEditingPlugin;
|
||||||
import net.osmand.plus.osmedit.OsmPoint;
|
import net.osmand.plus.osmedit.OsmPoint;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
|
|
||||||
public class DeletePoiDialogFragment extends DialogFragment {
|
public class DeletePoiDialogFragment extends DialogFragment {
|
||||||
private static final String KEY_AMENITY_NODE = "amenity_node";
|
private static final String KEY_AMENITY_NODE = "amenity_node";
|
||||||
|
|
||||||
|
@ -47,9 +45,8 @@ public class DeletePoiDialogFragment extends DialogFragment {
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AccessibleToast.makeText(activity, MessageFormat.format(
|
AccessibleToast.makeText(activity,
|
||||||
getString(R.string.poi_action_succeded_template),
|
getString(R.string.poi_deleted_localy),
|
||||||
getString(R.string.poi_action_delete)),
|
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
if (activity instanceof MapActivity) {
|
if (activity instanceof MapActivity) {
|
||||||
((MapActivity) activity).getMapView().refreshMap(true);
|
((MapActivity) activity).getMapView().refreshMap(true);
|
||||||
|
|
Loading…
Reference in a new issue