diff --git a/CHANGELOG.md b/CHANGELOG.md index 6964a32c4..f7493d164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,19 @@ 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)* +---------------------------- + + * 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)* ---------------------------- diff --git a/app/build.gradle b/app/build.gradle index a4484e186..3f01904bc 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 168 + versionName "3.6.2" multiDexEnabled true setProperty("archivesBaseName", "gallery") } @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.16.10' + 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' 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 } 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 = "" } } 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)) { 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) 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 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..46fe56a5b 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,13 @@ class MediaFetcher(val context: Context) { } } - config.includedFolders.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.forEach { + val screenshotsFolder = "${Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)}/Screenshots" + val foldersToScan = config.includedFolders + 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 { @@ -255,7 +262,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 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. 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.