From 208d005139de8ed1fc8329aedbc8b9b3b8a57bc3 Mon Sep 17 00:00:00 2001
From: tibbi <tibor@kaputa.sk>
Date: Mon, 23 Oct 2017 12:09:55 +0200
Subject: [PATCH] update commons to 2.31.1

---
 app/build.gradle                              |  2 +-
 .../gallery/activities/EditActivity.kt        |  6 +-----
 .../gallery/activities/PhotoVideoActivity.kt  |  1 +
 .../gallery/extensions/context.kt             | 19 -------------------
 4 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/app/build.gradle b/app/build.gradle
index 3d9d663c6..5d0a8fe7d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -37,7 +37,7 @@ android {
 }
 
 dependencies {
-    compile 'com.simplemobiletools:commons:2.30.13'
+    compile 'com.simplemobiletools:commons:2.31.1'
     compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
     compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
     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 0da6c4bef..dc09ee11e 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt
@@ -10,14 +10,10 @@ import android.provider.MediaStore
 import android.util.Log
 import android.view.Menu
 import android.view.MenuItem
-import com.simplemobiletools.commons.extensions.getCompressionFormat
-import com.simplemobiletools.commons.extensions.getFileOutputStream
-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.getRealPathFromURI
 import com.simplemobiletools.gallery.extensions.openEditor
 import com.theartofdev.edmodo.cropper.CropImageView
 import kotlinx.android.synthetic.main.view_crop_image.*
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
index eb6c13fb2..97b3e12c5 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
@@ -10,6 +10,7 @@ import android.provider.MediaStore
 import android.view.Menu
 import android.view.MenuItem
 import android.view.View
+import com.simplemobiletools.commons.extensions.getRealPathFromURI
 import com.simplemobiletools.commons.extensions.scanPath
 import com.simplemobiletools.commons.extensions.toast
 import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt
index f7cd61529..cdda71ab7 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt
@@ -3,12 +3,9 @@ package com.simplemobiletools.gallery.extensions
 import android.content.Context
 import android.content.Intent
 import android.content.res.Configuration
-import android.database.Cursor
 import android.graphics.Point
 import android.media.AudioManager
-import android.net.Uri
 import android.os.Build
-import android.provider.MediaStore
 import android.view.WindowManager
 import com.simplemobiletools.commons.extensions.humanizePath
 import com.simplemobiletools.gallery.activities.SettingsActivity
@@ -44,22 +41,6 @@ val Context.realScreenSize: Point
         return size
     }
 
-fun Context.getRealPathFromURI(uri: Uri): String? {
-    var cursor: Cursor? = null
-    try {
-        val projection = arrayOf(MediaStore.Images.Media.DATA)
-        cursor = contentResolver.query(uri, projection, null, null, null)
-        if (cursor?.moveToFirst() == true) {
-            val index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA)
-            return cursor.getString(index)
-        }
-    } catch (e: Exception) {
-    } finally {
-        cursor?.close()
-    }
-    return null
-}
-
 fun Context.getHumanizedFilename(path: String): String {
     val humanized = humanizePath(path)
     return humanized.substring(humanized.lastIndexOf("/") + 1)