mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
update commons to 2.16.3
This commit is contained in:
parent
95d3701b80
commit
49f7fc389a
6 changed files with 5 additions and 24 deletions
|
@ -32,7 +32,7 @@ android {
|
|||
}
|
||||
|
||||
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.theartofdev.edmodo:android-image-cropper:2.3.1'
|
||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||
|
|
|
@ -8,15 +8,10 @@ import android.os.Bundle
|
|||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import com.simplemobiletools.commons.extensions.getFileDocument
|
||||
import com.simplemobiletools.commons.extensions.needsStupidWritePermissions
|
||||
import com.simplemobiletools.commons.extensions.scanPath
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.dialogs.ResizeDialog
|
||||
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.theartofdev.edmodo.cropper.CropImageView
|
||||
import kotlinx.android.synthetic.main.view_crop_image.*
|
||||
|
@ -125,7 +120,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
try {
|
||||
if (needsStupidWritePermissions(path)) {
|
||||
handleSAFDialog(file) {
|
||||
var document = getFileDocument(path, config.treeUri) ?: return@handleSAFDialog
|
||||
var document = getFileDocument(path) ?: return@handleSAFDialog
|
||||
if (!file.exists()) {
|
||||
document = document.createFile("", file.name)
|
||||
}
|
||||
|
|
|
@ -127,11 +127,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
config.temporarilyShowHidden = false
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
config.isFirstRun = false
|
||||
}
|
||||
|
||||
private fun tryloadGallery() {
|
||||
if (hasWriteStoragePermission()) {
|
||||
if (config.showAll)
|
||||
|
|
|
@ -243,7 +243,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
val bitmap = BitmapFactory.decodeFile(currPath)
|
||||
if (needsStupidWritePermissions(it)) {
|
||||
handleSAFDialog(file) {
|
||||
var document = getFileDocument(it, config.treeUri) ?: return@handleSAFDialog
|
||||
var document = getFileDocument(it) ?: return@handleSAFDialog
|
||||
if (!file.exists()) {
|
||||
document = document.createFile("", file.name)
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
|
|||
|
||||
if (needsStupidWritePermissions(path)) {
|
||||
handleSAFDialog(file) {
|
||||
getFileDocument(path, config.treeUri)?.createFile("", NOMEDIA)
|
||||
getFileDocument(path)?.createFile("", NOMEDIA)
|
||||
}
|
||||
} else {
|
||||
file.createNewFile()
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
package com.simplemobiletools.gallery.extensions
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Environment
|
||||
import com.simplemobiletools.gallery.helpers.NOMEDIA
|
||||
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.isDownloadsFolder() = absolutePath == Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString()
|
||||
|
|
Loading…
Reference in a new issue