Skip to content

Commit

Permalink
Merge pull request #12 from Atwa/enhancemnt/add_file_extensions
Browse files Browse the repository at this point in the history
add extension to video files and images from camera
  • Loading branch information
Atwa authored Mar 9, 2023
2 parents 0d588fd + 14863ac commit b93b67d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ made in uploading them to server without the need to ask use for a single permis
| 1.0.3 | Fix bug : LifecycleOwner Activity is attempting to register while current state is RESUMED. |
| 1.0.4 | Enhancement : Avoid possible activity reference leaking. <br /> Feature : Implement camera image picker. |
| 1.0.5 | Feature : Support fragments. <br /> Feature : Implement file picking from initial directory. <br /> fix : obsolete app icon unintended overriding. |
| 1.0.6 | Enhancement : Add file extension to video files and images picked from camera. |



Expand Down
2 changes: 1 addition & 1 deletion filepicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ afterEvaluate {

groupId = 'com.github.atwa'
artifactId = 'filepicker'
version = '1.0.5'
version = '1.0.6'
}
}
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ internal class UriDecoder(
private fun saveImageToFile(bitmap: Bitmap): ImageMeta? {
var byteStream: ByteArrayInputStream? = null
return try {
val fileName = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()).toString()
val fileName =
TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()).toString().plus(".jpg")
val imageFile = File(context?.cacheDir, fileName)
val size = imageFile.length().getFileSize()

Expand Down Expand Up @@ -112,7 +113,8 @@ internal class UriDecoder(
return try {
uri?.let { uri ->
inputStream = contentResolver?.openInputStream(uri)
val fileName = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()).toString()
val fileName =
TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()).toString().plus(".mp4")
val videoFile = File(context?.cacheDir, fileName)
val outputStream = FileOutputStream(videoFile)
inputStream?.let { streamer.copyFile(it, outputStream) }
Expand Down

0 comments on commit b93b67d

Please sign in to comment.