update commons to 2.17.3

This commit is contained in:
tibbi 2017-04-24 22:47:47 +02:00
parent f94c09a83c
commit 972916f6b2
5 changed files with 14 additions and 16 deletions

View file

@ -32,7 +32,7 @@ android {
} }
dependencies { dependencies {
compile 'com.simplemobiletools:commons:2.17.2' compile 'com.simplemobiletools:commons:2.17.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.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

@ -47,18 +47,18 @@ class SaveAsDialog(val activity: SimpleActivity, val path: String, val callback:
val extension = view.save_as_extension.value val extension = view.save_as_extension.value
if (filename.isEmpty()) { if (filename.isEmpty()) {
context.toast(R.string.filename_cannot_be_empty) activity.toast(R.string.filename_cannot_be_empty)
return@setOnClickListener return@setOnClickListener
} }
if (extension.isEmpty()) { if (extension.isEmpty()) {
context.toast(R.string.extension_cannot_be_empty) activity.toast(R.string.extension_cannot_be_empty)
return@setOnClickListener return@setOnClickListener
} }
val newFile = File(realPath, "$filename.$extension") val newFile = File(realPath, "$filename.$extension")
if (!newFile.name.isAValidFilename()) { if (!newFile.name.isAValidFilename()) {
context.toast(R.string.filename_invalid_characters) activity.toast(R.string.filename_invalid_characters)
return@setOnClickListener return@setOnClickListener
} }

View file

@ -175,6 +175,15 @@ fun Activity.hasNavBar(): Boolean {
} }
} }
fun Activity.launchCamera() {
val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)
if (intent.resolveActivity(packageManager) != null) {
startActivity(intent)
} else {
toast(R.string.no_camera_app_found)
}
}
fun SimpleActivity.launchAbout() { fun SimpleActivity.launchAbout() {
startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_MULTISELECT or LICENSE_RTL startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_MULTISELECT or LICENSE_RTL
or LICENSE_PHOTOVIEW or LICENSE_SUBSAMPLING, BuildConfig.VERSION_NAME) or LICENSE_PHOTOVIEW or LICENSE_SUBSAMPLING, BuildConfig.VERSION_NAME)

View file

@ -6,8 +6,6 @@ import android.database.Cursor
import android.net.Uri import android.net.Uri
import android.provider.MediaStore import android.provider.MediaStore
import com.simplemobiletools.commons.extensions.humanizePath import com.simplemobiletools.commons.extensions.humanizePath
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SettingsActivity import com.simplemobiletools.gallery.activities.SettingsActivity
import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.helpers.Config
import com.simplemobiletools.gallery.helpers.NOMEDIA import com.simplemobiletools.gallery.helpers.NOMEDIA
@ -35,15 +33,6 @@ fun Context.getHumanizedFilename(path: String): String {
return humanized.substring(humanized.lastIndexOf("/") + 1) return humanized.substring(humanized.lastIndexOf("/") + 1)
} }
fun Context.launchCamera() {
val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)
if (intent.resolveActivity(packageManager) != null) {
startActivity(intent)
} else {
toast(R.string.no_camera_app_found)
}
}
fun Context.launchSettings() { fun Context.launchSettings() {
startActivity(Intent(this, SettingsActivity::class.java)) startActivity(Intent(this, SettingsActivity::class.java))
} }

View file

@ -72,7 +72,7 @@ class PhotoFragment : ViewPagerFragment() {
rotated.compress(Bitmap.CompressFormat.JPEG, 100, out) rotated.compress(Bitmap.CompressFormat.JPEG, 100, out)
medium.path = file.absolutePath medium.path = file.absolutePath
} catch (e: Exception) { } catch (e: Exception) {
context.toast(R.string.unknown_error_occurred) activity.toast(R.string.unknown_error_occurred)
return view return view
} finally { } finally {
try { try {