• R/O
  • HTTP
  • SSH
  • HTTPS

PKRemote: Commit

Pentax DSLR Remote Control app.


Commit MetaInfo

Révisione3f0abe83f5459f012563d201b94863ed27979b4 (tree)
l'heure2021-01-03 13:45:04
AuteurMRSa <mrsa@myad...>
CommiterMRSa

Message de Log

動画がきちんと保管できなかったのを修正する。

Change Summary

Modification

--- a/app/src/main/java/net/osdn/gokigen/pkremote/playback/MyContentDownloader.kt
+++ b/app/src/main/java/net/osdn/gokigen/pkremote/playback/MyContentDownloader.kt
@@ -68,6 +68,7 @@ class MyContentDownloader(private val activity : Activity, private val playbackC
6868
6969 // Download the image.
7070 var isSmallSize = requestSmallSize
71+ var isVideo = false
7172 try
7273 {
7374 isDownloading = true
@@ -131,10 +132,12 @@ class MyContentDownloader(private val activity : Activity, private val playbackC
131132 contentFileName.toUpperCase(Locale.US).contains(MOVIE_SUFFIX) -> {
132133 mimeType = "video/mp4"
133134 isSmallSize = false
135+ isVideo = true
134136 }
135137 contentFileName.toUpperCase(Locale.US).contains(MOVIE_SUFFIX_MP4) -> {
136138 mimeType = "video/mp4"
137139 isSmallSize = false
140+ isVideo = true
138141 }
139142 else -> {
140143 mimeType = "image/jpeg"
@@ -170,10 +173,24 @@ class MyContentDownloader(private val activity : Activity, private val playbackC
170173 val extStorageUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
171174 values.put(MediaStore.Images.Media.RELATIVE_PATH, directoryPath)
172175 values.put(MediaStore.Images.Media.IS_PENDING, true)
173- MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
176+ if (isVideo)
177+ {
178+ MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
179+ }
180+ else
181+ {
182+ MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
183+ }
174184 } else {
175185 values.put(MediaStore.Images.Media.DATA, getExternalOutputDirectory().absolutePath + File.separator + outputFileName)
176- MediaStore.Images.Media.EXTERNAL_CONTENT_URI
186+ if (isVideo)
187+ {
188+ MediaStore.Video.Media.EXTERNAL_CONTENT_URI
189+ }
190+ else
191+ {
192+ MediaStore.Images.Media.EXTERNAL_CONTENT_URI
193+ }
177194 }
178195 imageUri = resolver.insert(extStorageUri, values)
179196 if (imageUri != null)
Afficher sur ancien navigateur de dépôt.