diff options
author | Allan Wang <me@allanwang.ca> | 2019-01-04 23:06:29 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-01-04 23:06:29 -0500 |
commit | 72d6461a9055929aa5774f1982527c7b9ff406cd (patch) | |
tree | d9aafa7d53a68871eab7d4e1e5f3daa7b0c0c8de /mediapicker/src/main | |
parent | d61ff7cb4f43d71d2170cdd25ceab2e3edcb81fc (diff) | |
download | kau-72d6461a9055929aa5774f1982527c7b9ff406cd.tar.gz kau-72d6461a9055929aa5774f1982527c7b9ff406cd.tar.bz2 kau-72d6461a9055929aa5774f1982527c7b9ff406cd.zip |
Remove frost tag from media method, resolves #186
Diffstat (limited to 'mediapicker/src/main')
-rw-r--r-- | mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt index 32e64e4..ff6784b 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt @@ -42,14 +42,17 @@ internal fun Activity.finish(data: ArrayList<MediaModel>) { else finish() } +/** + * Creates a folder named [prefix] as well as a new file with the prefix, current time, and extension. + */ @Throws(IOException::class) fun createMediaFile(prefix: String, extension: String): File { val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()) val imageFileName = "${prefix}_${timeStamp}_" val storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) - val frostDir = File(storageDir, prefix) - if (!frostDir.exists()) frostDir.mkdirs() - return File.createTempFile(imageFileName, extension, frostDir) + val prefixDir = File(storageDir, prefix) + if (!prefixDir.exists()) prefixDir.mkdirs() + return File.createTempFile(imageFileName, extension, prefixDir) } @Throws(IOException::class) |