Pentax DSLR Remote Control app.
Révision | e3f0abe83f5459f012563d201b94863ed27979b4 (tree) |
---|---|
l'heure | 2021-01-03 13:45:04 |
Auteur | MRSa <mrsa@myad...> |
Commiter | MRSa |
動画がきちんと保管できなかったのを修正する。
@@ -68,6 +68,7 @@ class MyContentDownloader(private val activity : Activity, private val playbackC | ||
68 | 68 | |
69 | 69 | // Download the image. |
70 | 70 | var isSmallSize = requestSmallSize |
71 | + var isVideo = false | |
71 | 72 | try |
72 | 73 | { |
73 | 74 | isDownloading = true |
@@ -131,10 +132,12 @@ class MyContentDownloader(private val activity : Activity, private val playbackC | ||
131 | 132 | contentFileName.toUpperCase(Locale.US).contains(MOVIE_SUFFIX) -> { |
132 | 133 | mimeType = "video/mp4" |
133 | 134 | isSmallSize = false |
135 | + isVideo = true | |
134 | 136 | } |
135 | 137 | contentFileName.toUpperCase(Locale.US).contains(MOVIE_SUFFIX_MP4) -> { |
136 | 138 | mimeType = "video/mp4" |
137 | 139 | isSmallSize = false |
140 | + isVideo = true | |
138 | 141 | } |
139 | 142 | else -> { |
140 | 143 | mimeType = "image/jpeg" |
@@ -170,10 +173,24 @@ class MyContentDownloader(private val activity : Activity, private val playbackC | ||
170 | 173 | val extStorageUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { |
171 | 174 | values.put(MediaStore.Images.Media.RELATIVE_PATH, directoryPath) |
172 | 175 | 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 | + } | |
174 | 184 | } else { |
175 | 185 | 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 | + } | |
177 | 194 | } |
178 | 195 | imageUri = resolver.insert(extStorageUri, values) |
179 | 196 | if (imageUri != null) |