From 61ed436c4477a540bd77d4d7a47c79856a577976 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 5 Nov 2020 15:41:52 +0100 Subject: [PATCH] Move some method to the companion --- .../im/vector/lib/multipicker/CameraPicker.kt | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/multipicker/src/main/java/im/vector/lib/multipicker/CameraPicker.kt b/multipicker/src/main/java/im/vector/lib/multipicker/CameraPicker.kt index 3f24a28c28..64df788e53 100644 --- a/multipicker/src/main/java/im/vector/lib/multipicker/CameraPicker.kt +++ b/multipicker/src/main/java/im/vector/lib/multipicker/CameraPicker.kt @@ -94,19 +94,21 @@ class CameraPicker { return Intent(MediaStore.ACTION_IMAGE_CAPTURE) } - private fun createPhotoUri(context: Context): Uri { - val file = createImageFile(context) - val authority = context.packageName + ".multipicker.fileprovider" - return FileProvider.getUriForFile(context, authority, file) - } + companion object { + fun createPhotoUri(context: Context): Uri { + val file = createImageFile(context) + val authority = context.packageName + ".multipicker.fileprovider" + return FileProvider.getUriForFile(context, authority, file) + } - private fun createImageFile(context: Context): File { - val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()) - val storageDir: File = context.filesDir - return File.createTempFile( - "${timeStamp}_", /* prefix */ - ".jpg", /* suffix */ - storageDir /* directory */ - ) + private fun createImageFile(context: Context): File { + val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()) + val storageDir: File = context.filesDir + return File.createTempFile( + "${timeStamp}_", /* prefix */ + ".jpg", /* suffix */ + storageDir /* directory */ + ) + } } }