From 257b6d93fb1505829b1fa9609fe18ef071b17946 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Fri, 6 Nov 2015 17:15:41 +0300 Subject: [PATCH] Fix date for audio/video notes --- .../plus/audionotes/AudioVideoNotesPlugin.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 1ceacbfb09..0047ca40cf 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -75,6 +75,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; +import java.text.DateFormat; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; @@ -220,20 +221,23 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } } + private String formatDateTime(Context ctx, long dateTime) { + DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(ctx); + DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(ctx); + return dateFormat.format(dateTime) + " " + timeFormat.format(dateTime); + } + public String getName(Context ctx) { String fileName = file.getName(); String desc = getDescriptionName(fileName); if (desc != null) { return desc; } else if (this.isAudio()) { - String time = AndroidUtils.formatDateTime(ctx, file.lastModified()); - return ctx.getString(R.string.rec_audio_description, time).trim(); + return ctx.getString(R.string.rec_audio_description, formatDateTime(ctx, file.lastModified())); } else if (this.isVideo()) { - String time = AndroidUtils.formatDateTime(ctx, file.lastModified()); - return ctx.getString(R.string.rec_video_description, time).trim(); + return ctx.getString(R.string.rec_video_description, formatDateTime(ctx, file.lastModified())); } else if (this.isPhoto()) { - String time = AndroidUtils.formatDateTime(ctx, file.lastModified()); - return ctx.getString(R.string.rec_photo_description, time).trim(); + return ctx.getString(R.string.rec_photo_description, formatDateTime(ctx, file.lastModified())); } return ""; }