Merge pull request #26 from SimpleMobileTools/master

upd
This commit is contained in:
solokot 2018-03-23 13:54:27 +03:00 committed by GitHub
commit a2401a4c79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 49 additions and 22 deletions

View File

@ -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)*
----------------------------

View File

@ -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'

View File

@ -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
}

View File

@ -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 = ""
}
}

View File

@ -17,7 +17,7 @@ import java.io.File
class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, val isPickImage: Boolean,
val callback: (dirs: ArrayList<Directory>) -> Unit) : AsyncTask<Void, Void, ArrayList<Directory>>() {
val mediaFetcher = MediaFetcher(context)
private val mediaFetcher = MediaFetcher(context)
override fun doInBackground(vararg params: Void): ArrayList<Directory> {
if (!context.hasPermission(PERMISSION_WRITE_STORAGE)) {

View File

@ -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)

View File

@ -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

View File

@ -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<String>, includedPaths: MutableSet<String>) =
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<Medium>, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int, allowRecursion: Boolean) {
val files = File(folder).listFiles() ?: return

View File

@ -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à.</string>
<string name="faq_9_title">Les imatges a pantalla completa tenen artefactes estranys, puc millorar d\'alguna manera la qualitat?</string>
<string name="faq_9_text">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.</string>
<string name="faq_10_title">Can I crop images with this app?</string>
<string name="faq_10_text">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.</string>
<string name="faq_10_title">Puc retallar imatges amb aquesta aplicació?</string>
<string name="faq_10_text">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.</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -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á.</string>
<string name="faq_9_title">Las imágenes a pantalla completa tienen artefactos extraños, ¿puedo de alguna manera mejorar la calidad?</string>
<string name="faq_9_text">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.</string>
<string name="faq_10_title">Can I crop images with this app?</string>
<string name="faq_10_text">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.</string>
<string name="faq_10_title">¿Puedo recortar imágenes con esta aplicación?</string>
<string name="faq_10_text">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.</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->