From 49f7fc389a5bdc055503dfab875b9bc4154b765c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 9 Apr 2017 22:32:38 +0200 Subject: [PATCH] update commons to 2.16.3 --- app/build.gradle | 2 +- .../simplemobiletools/gallery/activities/EditActivity.kt | 9 ++------- .../simplemobiletools/gallery/activities/MainActivity.kt | 5 ----- .../gallery/activities/ViewPagerActivity.kt | 2 +- .../com/simplemobiletools/gallery/extensions/activity.kt | 2 +- .../com/simplemobiletools/gallery/extensions/file.kt | 9 --------- 6 files changed, 5 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 38e6866aa..d85fd9d06 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' 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 90acd0001..1cc7ff603 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -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) } 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 97f6fd081..a82906719 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -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) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 4ba6eb362..68e3ce1e9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -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) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 4a2d40034..5fa1540ce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -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() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/file.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/file.kt index a2156588c..668c3acb5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/file.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/file.kt @@ -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()