From 4387b85aafc3125497b1bb3f466f2e4f1b226488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Solatec=20Inform=C3=A0tica?= <35220662+Solatec@users.noreply.github.com> Date: Wed, 21 Mar 2018 21:22:10 +0100 Subject: [PATCH 01/16] Update strings.xml --- app/src/main/res/values-ca/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 3ad86b548..3c3f1b436 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -164,8 +164,8 @@ Això farà que només les carpetes seleccionades siguin visibles, ja que tant excloure com incloure són recursius i si una carpeta està exclosa i inclosa, es mostrarà. Les imatges a pantalla completa tenen artefactes estranys, puc millorar d\'alguna manera la qualitat? Sí, hi ha un commutador a la configuració que diu \"Substituïu imatges ampliades i de gran qualitat\", podeu fer-ho. Millora la qualitat de les imatges, però es borraran una vegada que intenteu fer zoom massa. - Can I crop images with this app? - Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. + Puc retallar imatges amb aquesta aplicació? + Sí, pots retallar imatges a l\'editor, arrossegant les cantonades de la imatge. Pots accedir a l\'editor prement una miniatura d\'imatge i seleccionant Edita o seleccionant Edita des de la visualització de pantalla completa. From f335e2eb56fe7583f64a4858925f5b440b253889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Solatec=20Inform=C3=A0tica?= <35220662+Solatec@users.noreply.github.com> Date: Wed, 21 Mar 2018 21:24:16 +0100 Subject: [PATCH 02/16] Update strings.xml --- app/src/main/res/values-es/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index e01054678..8e0615795 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -164,8 +164,8 @@ Esto hará que solo las carpetas seleccionadas sean visibles, ya que tanto la exclusión como la inclusión son recursivas y si una carpeta está excluida e incluida, aparecerá. Las imágenes a pantalla completa tienen artefactos extraños, ¿puedo de alguna manera mejorar la calidad? Sí, hay una alternancia en Configuración que dice \"Reemplazar imágenes con zoom profundo con las de mejor calidad\", puedes usar eso. Mejorará la calidad de las imágenes, pero se volverán borrosas una vez que intente ampliar demasiado. - Can I crop images with this app? - Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. + ¿Puedo recortar imágenes con esta aplicación? + Sí, puede recortar imágenes en el editor arrastrando las esquinas de la imagen. Puede acceder al editor pulsando prolongadamente una imagen en miniatura y seleccionando Editar, o seleccionando Editar en la vista de pantalla completa. From 91819ba354145a7824607db91716394ae0b0f7bb Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 21 Mar 2018 23:26:12 +0100 Subject: [PATCH 03/16] update commons to 3.16.12 --- app/build.gradle | 2 +- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a4484e186..6148641ab 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.16.10' + implementation 'com.simplemobiletools:commons:3.16.12' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.3' implementation 'com.google.code.gson:gson:2.8.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index e4ee2ee21..af0f5ff6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -17,7 +17,7 @@ import java.io.File class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, val isPickImage: Boolean, val callback: (dirs: ArrayList) -> Unit) : AsyncTask>() { - val mediaFetcher = MediaFetcher(context) + private val mediaFetcher = MediaFetcher(context) override fun doInBackground(vararg params: Void): ArrayList { if (!context.hasPermission(PERMISSION_WRITE_STORAGE)) { From 3b14330b5d8c304719a56beab6eb2b0ec66003d8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 14:10:38 +0100 Subject: [PATCH 04/16] temporarily comment out deleting of newly created folders --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 7127391c5..1ca189290 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -238,12 +238,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun removeTempFolder() { if (config.tempFolderPath.isNotEmpty()) { - val newFolder = File(config.tempFolderPath) + /*val newFolder = File(config.tempFolderPath) if (newFolder.exists() && newFolder.isDirectory) { if (newFolder.list()?.isEmpty() == true) { deleteFile(newFolder.toFileDirItem(applicationContext), true) } - } + }*/ config.tempFolderPath = "" } } From 2acc6d01b9fae365e06c1908d01291b83c17ac19 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:05:28 +0100 Subject: [PATCH 05/16] use incasesensitive comparison at Downloads folder obtaining --- .../com/simplemobiletools/gallery/extensions/FileDirItem.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/FileDirItem.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/FileDirItem.kt index b882a9bb7..b9f637574 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/FileDirItem.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/FileDirItem.kt @@ -3,4 +3,4 @@ package com.simplemobiletools.gallery.extensions import android.os.Environment import com.simplemobiletools.commons.models.FileDirItem -fun FileDirItem.isDownloadsFolder() = path == Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() +fun FileDirItem.isDownloadsFolder() = path.equals(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString(), true) From be3c8a7b8956cd92e3d221b959d1a837e8b90711 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:11:22 +0100 Subject: [PATCH 06/16] use incasesensitive checking at included/excluded paths --- .../com/simplemobiletools/gallery/helpers/MediaFetcher.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 939a03e3c..97a4e4114 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -255,7 +255,7 @@ class MediaFetcher(val context: Context) { } private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet, includedPaths: MutableSet) = - includedPaths.none { path.startsWith(it) } && excludedPaths.any { path.startsWith(it) } + includedPaths.none { path.startsWith(it, true) } && excludedPaths.any { path.startsWith(it, true) } private fun getMediaInFolder(folder: String, curMedia: ArrayList, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int, allowRecursion: Boolean) { val files = File(folder).listFiles() ?: return From 5468baf5132833feade35a60e0486d697e95f093 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:12:20 +0100 Subject: [PATCH 07/16] try scanning Screenshots and Downloads folders thoroughly --- .../gallery/helpers/MediaFetcher.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 97a4e4114..659636d1e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.helpers import android.content.Context import android.database.Cursor import android.net.Uri +import android.os.Environment import android.provider.MediaStore import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* @@ -200,7 +201,18 @@ class MediaFetcher(val context: Context) { } } - config.includedFolders.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.forEach { + val downloadsFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() + val screenshotsFolder = "${Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)}/Screenshots" + val foldersToScan = config.includedFolders + if (File(downloadsFolder).exists()) { + foldersToScan.add(downloadsFolder) + } + + if (File(screenshotsFolder).exists()) { + foldersToScan.add(screenshotsFolder) + } + + foldersToScan.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.forEach { if (it.startsWith(OTG_PATH)) { getMediaOnOTG(it, curMedia, isPickImage, isPickVideo, filterMedia, allowRecursion) } else { From f8a4e68a1f7b7cb0a62f7d5654368b50bf0828f2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:16:09 +0100 Subject: [PATCH 08/16] add an extra activity existing check at trying to reload bitmap --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 85c4212ef..8f830f336 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -258,7 +258,9 @@ class PhotoFragment : ViewPagerFragment() { if (!useHalfResolution && e?.rootCauses?.firstOrNull() is OutOfMemoryError) { useHalfResolution = true Handler().post { - loadBitmap(degrees) + if (activity?.isActivityDestroyed() == false) { + loadBitmap(degrees) + } } } return false From cb3b3b65d63b270a79ccb542d35d4e3885506bcf Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:19:28 +0100 Subject: [PATCH 09/16] update commons to 3.16.14 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 6148641ab..4a50a5dba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.16.12' + implementation 'com.simplemobiletools:commons:3.16.14' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.3' implementation 'com.google.code.gson:gson:2.8.2' From 6eeece124a62bddb1aae4644e833b4e0b0acbb8a Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:43:27 +0100 Subject: [PATCH 10/16] couple edits to URI obtaining at Edit activity --- .../gallery/activities/EditActivity.kt | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index 37a17ae93..6f6338795 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -63,15 +63,20 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } - saveUri = when { - intent.extras?.containsKey(REAL_FILE_PATH) == true -> { - val realPath = intent.extras.getString(REAL_FILE_PATH) - if (realPath.startsWith(OTG_PATH)) { - Uri.parse(realPath) - } else { - Uri.fromFile(File(realPath)) - } + if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { + val realPath = intent.extras.getString(REAL_FILE_PATH) + uri = when { + realPath.startsWith(OTG_PATH) -> Uri.parse(realPath) + realPath.startsWith("file:/") -> Uri.parse(realPath) + else -> Uri.fromFile(File(realPath)) } + } else { + (getRealPathFromURI(uri))?.apply { + uri = Uri.fromFile(File(this)) + } + } + + saveUri = when { intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true -> intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri else -> uri } From 675bddc7e384d27b1ec2fb403c90ea193e39703d Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:54:25 +0100 Subject: [PATCH 11/16] update version to 3.6.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4a50a5dba..429c0cd52 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 27 - versionCode 166 - versionName "3.6.0" + versionCode 167 + versionName "3.6.1" multiDexEnabled true setProperty("archivesBaseName", "gallery") } From 6cf7c72920ef74d36e7062b88816946d7eef4504 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Mar 2018 15:54:30 +0100 Subject: [PATCH 12/16] updating changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6964a32c4..b5986eb9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========== +Version 3.6.1 *(2018-03-22)* +---------------------------- + + * Set proper file mimetype after editing or other file operation + * Try scanning Screenshots and Download folders more thoroughly + * Couple stability improvements + Version 3.6.0 *(2018-03-15)* ---------------------------- From 50af6a428e2ee90a08749dbdfc27638ed0294220 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 23 Mar 2018 10:14:08 +0100 Subject: [PATCH 13/16] update commons to 3.16.15 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 429c0cd52..b22a899ca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.16.14' + implementation 'com.simplemobiletools:commons:3.16.15' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.3' implementation 'com.google.code.gson:gson:2.8.2' From 33e4ca5d16a577abac07a323e7b5099237d61f16 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 23 Mar 2018 10:48:18 +0100 Subject: [PATCH 14/16] remove the Download folder from the explicitly included ones --- .../com/simplemobiletools/gallery/helpers/MediaFetcher.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 659636d1e..46fe56a5b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -201,13 +201,8 @@ class MediaFetcher(val context: Context) { } } - val downloadsFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() val screenshotsFolder = "${Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)}/Screenshots" val foldersToScan = config.includedFolders - if (File(downloadsFolder).exists()) { - foldersToScan.add(downloadsFolder) - } - if (File(screenshotsFolder).exists()) { foldersToScan.add(screenshotsFolder) } From 72b15ed822afcabebcfba8bbb06970ce38a2a9e7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 23 Mar 2018 10:50:03 +0100 Subject: [PATCH 15/16] update version to 3.6.2 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b22a899ca..3f01904bc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 27 - versionCode 167 - versionName "3.6.1" + versionCode 168 + versionName "3.6.2" multiDexEnabled true setProperty("archivesBaseName", "gallery") } From 8aa7c774da36e856f20b14c7ce134204e4d446c5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 23 Mar 2018 10:50:10 +0100 Subject: [PATCH 16/16] updating changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5986eb9f..f7493d164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========== +Version 3.6.2 *(2018-03-23)* +---------------------------- + + * Fixing some crashes related to file scanning + * Do not scan Download folder file by file, it can contain many items + Version 3.6.1 *(2018-03-22)* ----------------------------