From 640ff05e204baa1d78593ff4ed839f7d5737cf72 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 9 May 2019 12:08:14 +0200 Subject: [PATCH] optimize temporary folder adding a bit --- .../gallery/pro/extensions/Context.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index 59cb44f5e..ff62abdd2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -471,14 +471,16 @@ fun Context.loadImage(type: Int, path: String, target: MySquareImageView, horizo } fun Context.addTempFolderIfNeeded(dirs: ArrayList): ArrayList { - val directories = ArrayList() val tempFolderPath = config.tempFolderPath - if (tempFolderPath.isNotEmpty()) { + return if (tempFolderPath.isNotEmpty()) { + val directories = ArrayList() val newFolder = Directory(null, tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L, getPathLocation(tempFolderPath), 0) directories.add(newFolder) + directories.addAll(dirs) + directories + } else { + dirs } - directories.addAll(dirs) - return directories } fun Context.getPathLocation(path: String): Int {