Add date/time to av notes
This commit is contained in:
parent
ae0559cd65
commit
e66a4047b0
3 changed files with 15 additions and 5 deletions
|
@ -40,6 +40,12 @@ public class AndroidUtils {
|
|||
return DateFormat.getDateFormat(ctx).format(new Date(time));
|
||||
}
|
||||
|
||||
public static String formatDateTime(Context ctx, long time) {
|
||||
Date d = new Date(time);
|
||||
return DateFormat.getDateFormat(ctx).format(d) +
|
||||
" " + DateFormat.getTimeFormat(ctx).format(d);
|
||||
}
|
||||
|
||||
public static String formatTime(Context ctx, long time) {
|
||||
return DateFormat.getTimeFormat(ctx).format(new Date(time));
|
||||
}
|
||||
|
|
|
@ -275,20 +275,23 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
|
||||
public String getDescription(Context ctx) {
|
||||
String nm = name == null ? "" : name;
|
||||
String time = AndroidUtils.formatDateTime(ctx, file.lastModified());
|
||||
if (isPhoto()) {
|
||||
return ctx.getString(R.string.recording_photo_description, nm, AndroidUtils.formatTime(ctx, file.lastModified())).trim();
|
||||
return ctx.getString(R.string.recording_photo_description, nm, time).trim();
|
||||
}
|
||||
updateInternalDescription();
|
||||
return ctx.getString(R.string.recording_description, nm, getDuration(ctx), AndroidUtils.formatTime(ctx, file.lastModified()))
|
||||
return ctx.getString(R.string.recording_description, nm, getDuration(ctx), time)
|
||||
.trim();
|
||||
}
|
||||
|
||||
public String getSmallDescription(Context ctx) {
|
||||
String nm = name == null ? "" : name;
|
||||
|
||||
String time = AndroidUtils.formatDateTime(ctx,file.lastModified());
|
||||
if (isPhoto()) {
|
||||
return ctx.getString(R.string.recording_photo_description, nm, AndroidUtils.formatTime(ctx,file.lastModified())).trim();
|
||||
return ctx.getString(R.string.recording_photo_description, nm, time).trim();
|
||||
}
|
||||
return ctx.getString(R.string.recording_description, nm, "", AndroidUtils.formatTime(ctx, file.lastModified())).trim();
|
||||
return ctx.getString(R.string.recording_description, nm, "", time).trim();
|
||||
}
|
||||
|
||||
private String getDuration(Context ctx) {
|
||||
|
@ -307,6 +310,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
|||
|
||||
private static void initializeRemoteControlRegistrationMethods() {
|
||||
try {
|
||||
// API 8
|
||||
if (mRegisterMediaButtonEventReceiver == null) {
|
||||
mRegisterMediaButtonEventReceiver = AudioManager.class.getMethod("registerMediaButtonEventReceiver",
|
||||
new Class[] { ComponentName.class });
|
||||
|
|
|
@ -15,7 +15,7 @@ public class MediaRemoteControlReceiver extends BroadcastReceiver {
|
|||
AudioVideoNotesPlugin plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
if(plugin != null && intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT) != null) {
|
||||
System.out.println("OsmAnd AV Button pressed " + intent.getIntExtra(Intent.EXTRA_KEY_EVENT, 0));
|
||||
Toast.makeText(context, "Button pressed " + intent.getIntExtra(Intent.EXTRA_KEY_EVENT, 0), Toast.LENGTH_LONG).show();
|
||||
// Toast.makeText(context, "Button pressed " + intent.getIntExtra(Intent.EXTRA_KEY_EVENT, 0), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue