From a101b528efdee74fc1970b7f1fe68263f0b20269 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 18 Aug 2017 14:39:40 -0700 Subject: Create media picker action items (#40) * Create action items * Increment version * Update camera action * Abstract camera action * Add and test * Refactor and add docs --- .../main/kotlin/ca/allanwang/kau/utils/FileUtils.kt | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'core') diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt index 25e0519..b03707d 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt @@ -11,23 +11,5 @@ import java.util.* /** * Created by Allan Wang on 2017-08-04. */ -@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) -} - -@Throws(IOException::class) -fun Context.createPrivateMediaFile(prefix: String, extension: String): File { - val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()) - val imageFileName = "${prefix}_${timeStamp}_" - val storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES) - return File.createTempFile(imageFileName, extension, storageDir) -} - fun File.copyFromInputStream(inputStream: InputStream) = inputStream.use { input -> outputStream().use { output -> input.copyTo(output) } } \ No newline at end of file -- cgit v1.2.3