Move some method to the companion
This commit is contained in:
parent
b7a1f96294
commit
61ed436c44
|
@ -94,19 +94,21 @@ class CameraPicker {
|
||||||
return Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
return Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createPhotoUri(context: Context): Uri {
|
companion object {
|
||||||
val file = createImageFile(context)
|
fun createPhotoUri(context: Context): Uri {
|
||||||
val authority = context.packageName + ".multipicker.fileprovider"
|
val file = createImageFile(context)
|
||||||
return FileProvider.getUriForFile(context, authority, file)
|
val authority = context.packageName + ".multipicker.fileprovider"
|
||||||
}
|
return FileProvider.getUriForFile(context, authority, file)
|
||||||
|
}
|
||||||
|
|
||||||
private fun createImageFile(context: Context): File {
|
private fun createImageFile(context: Context): File {
|
||||||
val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date())
|
val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date())
|
||||||
val storageDir: File = context.filesDir
|
val storageDir: File = context.filesDir
|
||||||
return File.createTempFile(
|
return File.createTempFile(
|
||||||
"${timeStamp}_", /* prefix */
|
"${timeStamp}_", /* prefix */
|
||||||
".jpg", /* suffix */
|
".jpg", /* suffix */
|
||||||
storageDir /* directory */
|
storageDir /* directory */
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue