Display marker date in groups
This commit is contained in:
parent
b7ee350791
commit
bcc8192cf6
1 changed files with 23 additions and 0 deletions
|
@ -212,10 +212,33 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||||
|
|
||||||
itemViewHolder.title.setText(marker.getName(app));
|
itemViewHolder.title.setText(marker.getName(app));
|
||||||
|
|
||||||
|
boolean noGroup = marker.groupName == null;
|
||||||
|
boolean early = false;
|
||||||
|
if (noGroup) {
|
||||||
|
Calendar currentDateCalendar = Calendar.getInstance();
|
||||||
|
currentDateCalendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
|
int currentDay = currentDateCalendar.get(Calendar.DAY_OF_YEAR);
|
||||||
|
int currentYear = currentDateCalendar.get(Calendar.YEAR);
|
||||||
|
Calendar markerCalendar = Calendar.getInstance();
|
||||||
|
markerCalendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
|
int markerDay = markerCalendar.get(Calendar.DAY_OF_YEAR);
|
||||||
|
int markerYear = markerCalendar.get(Calendar.YEAR);
|
||||||
|
early = currentDay - markerDay >= 2 || currentYear != markerYear;
|
||||||
|
}
|
||||||
if (markerInHistory) {
|
if (markerInHistory) {
|
||||||
itemViewHolder.point.setVisibility(View.VISIBLE);
|
itemViewHolder.point.setVisibility(View.VISIBLE);
|
||||||
itemViewHolder.description.setVisibility(View.VISIBLE);
|
itemViewHolder.description.setVisibility(View.VISIBLE);
|
||||||
itemViewHolder.description.setText(app.getString(R.string.passed, new SimpleDateFormat("MMM dd", Locale.getDefault()).format(new Date(marker.visitedDate))));
|
itemViewHolder.description.setText(app.getString(R.string.passed, new SimpleDateFormat("MMM dd", Locale.getDefault()).format(new Date(marker.visitedDate))));
|
||||||
|
} else if (noGroup && early) {
|
||||||
|
itemViewHolder.point.setVisibility(View.VISIBLE);
|
||||||
|
itemViewHolder.description.setVisibility(View.VISIBLE);
|
||||||
|
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("dd", Locale.getDefault()).format(date);
|
||||||
|
itemViewHolder.description.setText(month + " " + day);
|
||||||
} else {
|
} else {
|
||||||
itemViewHolder.point.setVisibility(View.GONE);
|
itemViewHolder.point.setVisibility(View.GONE);
|
||||||
itemViewHolder.description.setVisibility(View.GONE);
|
itemViewHolder.description.setVisibility(View.GONE);
|
||||||
|
|
Loading…
Reference in a new issue