mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Move some method to the companion
This commit is contained in:
parent
b7a1f96294
commit
61ed436c44
1 changed files with 15 additions and 13 deletions
|
@ -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 */
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue