From fa7b710ff44978f42a0f10df0d7d02a636567eec Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 3 Jul 2024 09:56:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/xypower/mpapp/MainActivity.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/xypower/mpapp/MainActivity.java b/app/src/main/java/com/xypower/mpapp/MainActivity.java index 4d76e1e7..2f5dc42b 100644 --- a/app/src/main/java/com/xypower/mpapp/MainActivity.java +++ b/app/src/main/java/com/xypower/mpapp/MainActivity.java @@ -577,16 +577,18 @@ public class MainActivity extends AppCompatActivity { if (!tempFile.exists()) { tempFile.mkdirs(); } - File photoFile = new File(tempFile, Integer.toString(channel) + "-img.jpg"); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss"); + Date dt = new Date(); + + File photoFile = new File(tempFile, "IMG-" + Integer.toString(channel) + "-" + simpleDateFormat.format(dt) + (photoOrVideo ? ".jpg" : ".mp4")); if (photoFile.exists()) { photoFile.delete(); } - SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - Date dt = new Date(); - String leftTopOsd = simpleDateFormat2.format(dt); + File configFile = new File(appPath); + configFile = new File(configFile, "data/channels/" + Integer.toString(channel) + ".json"); - MicroPhotoService.takePhoto(channel, preset, channel - 1, (channel == 4), photoFile.getAbsolutePath(), leftTopOsd, null, null, null); + MicroPhotoService.takePhoto(channel, preset, photoOrVideo, configFile.getAbsolutePath(), photoFile.getAbsolutePath()); } else { MicroPhotoService.takePhoto(this.getApplicationContext(), channel, preset, photoOrVideo); }