update commons to 2.16.3

This commit is contained in:
tibbi 2017-04-09 22:32:38 +02:00
parent 95d3701b80
commit 49f7fc389a
6 changed files with 5 additions and 24 deletions

View file

@ -32,7 +32,7 @@ android {
} }
dependencies { dependencies {
compile 'com.simplemobiletools:commons:2.16.1' compile 'com.simplemobiletools:commons:2.16.3'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1' compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View file

@ -8,15 +8,10 @@ import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import com.simplemobiletools.commons.extensions.getFileDocument import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.needsStupidWritePermissions
import com.simplemobiletools.commons.extensions.scanPath
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.dialogs.ResizeDialog import com.simplemobiletools.gallery.dialogs.ResizeDialog
import com.simplemobiletools.gallery.dialogs.SaveAsDialog import com.simplemobiletools.gallery.dialogs.SaveAsDialog
import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.extensions.getCompressionFormat
import com.simplemobiletools.gallery.extensions.getRealPathFromURI import com.simplemobiletools.gallery.extensions.getRealPathFromURI
import com.theartofdev.edmodo.cropper.CropImageView import com.theartofdev.edmodo.cropper.CropImageView
import kotlinx.android.synthetic.main.view_crop_image.* import kotlinx.android.synthetic.main.view_crop_image.*
@ -125,7 +120,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
try { try {
if (needsStupidWritePermissions(path)) { if (needsStupidWritePermissions(path)) {
handleSAFDialog(file) { handleSAFDialog(file) {
var document = getFileDocument(path, config.treeUri) ?: return@handleSAFDialog var document = getFileDocument(path) ?: return@handleSAFDialog
if (!file.exists()) { if (!file.exists()) {
document = document.createFile("", file.name) document = document.createFile("", file.name)
} }

View file

@ -127,11 +127,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
config.temporarilyShowHidden = false config.temporarilyShowHidden = false
} }
override fun onDestroy() {
super.onDestroy()
config.isFirstRun = false
}
private fun tryloadGallery() { private fun tryloadGallery() {
if (hasWriteStoragePermission()) { if (hasWriteStoragePermission()) {
if (config.showAll) if (config.showAll)

View file

@ -243,7 +243,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
val bitmap = BitmapFactory.decodeFile(currPath) val bitmap = BitmapFactory.decodeFile(currPath)
if (needsStupidWritePermissions(it)) { if (needsStupidWritePermissions(it)) {
handleSAFDialog(file) { handleSAFDialog(file) {
var document = getFileDocument(it, config.treeUri) ?: return@handleSAFDialog var document = getFileDocument(it) ?: return@handleSAFDialog
if (!file.exists()) { if (!file.exists()) {
document = document.createFile("", file.name) document = document.createFile("", file.name)
} }

View file

@ -167,7 +167,7 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
if (needsStupidWritePermissions(path)) { if (needsStupidWritePermissions(path)) {
handleSAFDialog(file) { handleSAFDialog(file) {
getFileDocument(path, config.treeUri)?.createFile("", NOMEDIA) getFileDocument(path)?.createFile("", NOMEDIA)
} }
} else { } else {
file.createNewFile() file.createNewFile()

View file

@ -1,18 +1,9 @@
package com.simplemobiletools.gallery.extensions package com.simplemobiletools.gallery.extensions
import android.graphics.Bitmap
import android.os.Environment import android.os.Environment
import com.simplemobiletools.gallery.helpers.NOMEDIA import com.simplemobiletools.gallery.helpers.NOMEDIA
import java.io.File import java.io.File
fun File.getCompressionFormat(): Bitmap.CompressFormat {
return when (extension.toLowerCase()) {
"png" -> Bitmap.CompressFormat.PNG
"webp" -> Bitmap.CompressFormat.WEBP
else -> Bitmap.CompressFormat.JPEG
}
}
fun File.containsNoMedia() = isDirectory && File(this, NOMEDIA).exists() fun File.containsNoMedia() = isDirectory && File(this, NOMEDIA).exists()
fun File.isDownloadsFolder() = absolutePath == Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() fun File.isDownloadsFolder() = absolutePath == Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString()