Fix #5891
This commit is contained in:
parent
0b335eae2f
commit
40a8d0e8ab
6 changed files with 16 additions and 53 deletions
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.City.CityType;
|
||||
|
@ -52,6 +53,10 @@ public class OsmAndFormatter {
|
|||
return hours + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (sec < 10 ? "0" + sec : sec);
|
||||
}
|
||||
|
||||
public static String getFormattedDate(Context context, long milliseconds) {
|
||||
return DateUtils.formatDateTime(context, milliseconds, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL);
|
||||
}
|
||||
|
||||
public static double calculateRoundedDist(double distInMeters, OsmandApplication ctx) {
|
||||
OsmandSettings settings = ctx.getSettings();
|
||||
MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
||||
|
|
|
@ -16,9 +16,6 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.views.DirectionDrawable;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class MapMarkerDialogHelper {
|
||||
|
||||
|
@ -101,14 +98,7 @@ public class MapMarkerDialogHelper {
|
|||
|
||||
descText.setVisibility(View.GONE);
|
||||
|
||||
Date date = new Date(marker.creationDate);
|
||||
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
|
||||
if (month.length() > 1) {
|
||||
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
|
||||
}
|
||||
month = month.replaceAll("\\.", "");
|
||||
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
|
||||
String desc = month + " " + day;
|
||||
String desc = OsmAndFormatter.getFormattedDate(app, marker.creationDate);
|
||||
String markerGroupName = marker.groupName;
|
||||
if (markerGroupName != null) {
|
||||
if (markerGroupName.equals("")) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
|
@ -18,14 +19,10 @@ import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemViewHolder>
|
||||
implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter {
|
||||
|
@ -136,14 +133,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
descr = mapActivity.getString(R.string.shared_string_favorites);
|
||||
}
|
||||
} else {
|
||||
Date date = new Date(marker.creationDate);
|
||||
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
|
||||
if (month.length() > 1) {
|
||||
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
|
||||
}
|
||||
month = month.replaceAll("\\.", "");
|
||||
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
|
||||
descr = month + " " + day;
|
||||
descr = OsmAndFormatter.getFormattedDate(mapActivity, marker.creationDate);
|
||||
}
|
||||
if (marker.wptPt != null && !Algorithms.isEmpty(marker.wptPt.category)) {
|
||||
descr = marker.wptPt.category + ", " + descr;
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.osmand.plus.GPXUtilities.GPXFile;
|
|||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper;
|
||||
import net.osmand.plus.MapMarkersHelper.GroupHeader;
|
||||
|
@ -27,7 +28,6 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.mapmarkers.SelectWptCategoriesBottomSheetDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.article.WikivoyageArticleDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.data.TravelArticle;
|
||||
|
@ -38,7 +38,6 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -318,19 +317,13 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
if (markerInHistory || createdEarly) {
|
||||
itemViewHolder.point.setVisibility(View.VISIBLE);
|
||||
itemViewHolder.description.setVisibility(View.VISIBLE);
|
||||
Date date;
|
||||
long date;
|
||||
if (markerInHistory) {
|
||||
date = new Date(marker.visitedDate);
|
||||
date = marker.visitedDate;
|
||||
} else {
|
||||
date = new Date(marker.creationDate);
|
||||
date = marker.creationDate;
|
||||
}
|
||||
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
|
||||
if (month.length() > 1) {
|
||||
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
|
||||
}
|
||||
month = month.replaceAll("\\.", "");
|
||||
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
|
||||
itemViewHolder.description.setText(app.getString(R.string.passed, month + " " + day));
|
||||
itemViewHolder.description.setText(app.getString(R.string.passed, OsmAndFormatter.getFormattedDate(app, date)));
|
||||
} else {
|
||||
itemViewHolder.point.setVisibility(View.GONE);
|
||||
itemViewHolder.description.setVisibility(View.GONE);
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -122,14 +123,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
|
||||
itemViewHolder.title.setText(marker.getName(app));
|
||||
|
||||
Date date = new Date(marker.visitedDate);
|
||||
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
|
||||
if (month.length() > 1) {
|
||||
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
|
||||
}
|
||||
month = month.replaceAll("\\.", "");
|
||||
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
|
||||
String desc = app.getString(R.string.passed, month + " " + day);
|
||||
String desc = app.getString(R.string.passed, OsmAndFormatter.getFormattedDate(app, marker.visitedDate));
|
||||
String markerGroupName = marker.groupName;
|
||||
if (markerGroupName != null) {
|
||||
if (markerGroupName.equals("")) {
|
||||
|
|
|
@ -24,12 +24,9 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemViewHolder>
|
||||
|
@ -203,13 +200,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
|
|||
descr = mapActivity.getString(R.string.shared_string_favorites);
|
||||
}
|
||||
} else {
|
||||
Date date = new Date(marker.creationDate);
|
||||
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
|
||||
if (month.length() > 1) {
|
||||
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
|
||||
}
|
||||
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
|
||||
descr = month + " " + day;
|
||||
descr = OsmAndFormatter.getFormattedDate(app, marker.creationDate);
|
||||
}
|
||||
holder.description.setText(descr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue