Fix date for audio/video notes
This commit is contained in:
parent
6de074cf5d
commit
257b6d93fb
1 changed files with 10 additions and 6 deletions
|
@ -75,6 +75,7 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.text.DateFormat;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
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) {
|
public String getName(Context ctx) {
|
||||||
String fileName = file.getName();
|
String fileName = file.getName();
|
||||||
String desc = getDescriptionName(fileName);
|
String desc = getDescriptionName(fileName);
|
||||||
if (desc != null) {
|
if (desc != null) {
|
||||||
return desc;
|
return desc;
|
||||||
} else if (this.isAudio()) {
|
} else if (this.isAudio()) {
|
||||||
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
return ctx.getString(R.string.rec_audio_description, formatDateTime(ctx, file.lastModified()));
|
||||||
return ctx.getString(R.string.rec_audio_description, time).trim();
|
|
||||||
} else if (this.isVideo()) {
|
} else if (this.isVideo()) {
|
||||||
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
return ctx.getString(R.string.rec_video_description, formatDateTime(ctx, file.lastModified()));
|
||||||
return ctx.getString(R.string.rec_video_description, time).trim();
|
|
||||||
} else if (this.isPhoto()) {
|
} else if (this.isPhoto()) {
|
||||||
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
return ctx.getString(R.string.rec_photo_description, formatDateTime(ctx, file.lastModified()));
|
||||||
return ctx.getString(R.string.rec_photo_description, time).trim();
|
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue