update commons to 2.31.1

This commit is contained in:
tibbi 2017-10-23 12:09:55 +02:00
parent f739f42fc2
commit 208d005139
4 changed files with 3 additions and 25 deletions

View file

@ -37,7 +37,7 @@ android {
} }
dependencies { 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.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View file

@ -10,14 +10,10 @@ import android.provider.MediaStore
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.getCompressionFormat import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.getFileOutputStream
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.getRealPathFromURI
import com.simplemobiletools.gallery.extensions.openEditor import com.simplemobiletools.gallery.extensions.openEditor
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.*

View file

@ -10,6 +10,7 @@ import android.provider.MediaStore
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import com.simplemobiletools.commons.extensions.getRealPathFromURI
import com.simplemobiletools.commons.extensions.scanPath import com.simplemobiletools.commons.extensions.scanPath
import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE

View file

@ -3,12 +3,9 @@ package com.simplemobiletools.gallery.extensions
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.res.Configuration import android.content.res.Configuration
import android.database.Cursor
import android.graphics.Point import android.graphics.Point
import android.media.AudioManager import android.media.AudioManager
import android.net.Uri
import android.os.Build import android.os.Build
import android.provider.MediaStore
import android.view.WindowManager import android.view.WindowManager
import com.simplemobiletools.commons.extensions.humanizePath import com.simplemobiletools.commons.extensions.humanizePath
import com.simplemobiletools.gallery.activities.SettingsActivity import com.simplemobiletools.gallery.activities.SettingsActivity
@ -44,22 +41,6 @@ val Context.realScreenSize: Point
return size 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 { fun Context.getHumanizedFilename(path: String): String {
val humanized = humanizePath(path) val humanized = humanizePath(path)
return humanized.substring(humanized.lastIndexOf("/") + 1) return humanized.substring(humanized.lastIndexOf("/") + 1)