File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
data/src/main/java/com/android/developers/androidify/data Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -56,19 +56,16 @@ internal class ImageGenerationRepositoryImpl @Inject constructor(
5656 firebaseAiDataSource.validatePromptHasEnoughInformation(inputPrompt)
5757
5858 private suspend fun validateImageIsFullPerson (file : File ): ValidatedImage {
59+ val bitmap = BitmapFactory .decodeFile(file.absolutePath)
5960 val validateImageResult = if (remoteConfigDataSource.useGeminiNano()) {
60- geminiNanoDataSource.validateImageHasEnoughInformation(BitmapFactory .decodeFile(file.absolutePath) )
61+ geminiNanoDataSource.validateImageHasEnoughInformation(bitmap )
6162 } else {
6263 null
6364 }
6465
6566 // If validating image with Nano is not successful, fallback to using Firebase AI
6667 return validateImageResult
67- ? : firebaseAiDataSource.validateImageHasEnoughInformation(
68- BitmapFactory .decodeFile(
69- file.absolutePath,
70- ),
71- )
68+ ? : firebaseAiDataSource.validateImageHasEnoughInformation(bitmap)
7269 }
7370
7471 @Throws(InsufficientInformationException ::class )
@@ -138,7 +135,8 @@ internal class ImageGenerationRepositoryImpl @Inject constructor(
138135 }
139136
140137 override suspend fun saveImageToExternalStorage (imageBitmap : Bitmap ): Uri {
141- val cacheFile = localFileProvider.createCacheFile(" androidify_image_result_${UUID .randomUUID()} .png" )
138+ val cacheFile =
139+ localFileProvider.createCacheFile(" androidify_image_result_${UUID .randomUUID()} .png" )
142140 localFileProvider.saveBitmapToFile(imageBitmap, cacheFile)
143141 return localFileProvider.saveToSharedStorage(cacheFile, cacheFile.name, " image/png" )
144142 }
You can’t perform that action at this time.
0 commit comments