File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
app/src/main/java/ai/elimu/content_provider/util Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ object FileHelper {
1919 if ((imageGson.id == null ) || (imageGson.revisionNumber == null )) {
2020 return null
2121 }
22- val imagesDirectory = context.getExternalFilesDir( Environment . DIRECTORY_PICTURES )
22+ val imagesDirectory = getImagesDirectory(context )
2323 val fileName = imageGson.checksumMd5
2424 return File (
2525 imagesDirectory, (fileName + " ."
@@ -34,7 +34,7 @@ object FileHelper {
3434 if ((imageGson.id == null ) || (imageGson.revisionNumber == null )) {
3535 return null
3636 }
37- val imagesDirectory = context.getExternalFilesDir( Environment . DIRECTORY_PICTURES )
37+ val imagesDirectory = getImagesDirectory(context )
3838 return File (
3939 imagesDirectory, (imageGson.checksumMd5 + " ."
4040 + imageGson.imageFormat.toString().lowercase(Locale .getDefault()))
@@ -80,4 +80,13 @@ object FileHelper {
8080 } ? : context.getExternalFilesDir(Environment .DIRECTORY_MOVIES )
8181 return videosDirectory
8282 }
83+
84+ private fun getImagesDirectory (context : Context ): File ? {
85+ val languageIsoCode: String? = SharedPreferencesHelper .getLanguage(context)?.isoCode
86+
87+ val videosDirectory = languageIsoCode?.let { isoCode ->
88+ context.getExternalFilesDir(Environment .DIRECTORY_PICTURES + " /lang-" + isoCode.uppercase())
89+ } ? : context.getExternalFilesDir(Environment .DIRECTORY_PICTURES )
90+ return videosDirectory
91+ }
8392}
You can’t perform that action at this time.
0 commit comments