diff --git a/app/build.gradle b/app/build.gradle index d94bbecb5..8f638ff0b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } 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.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/dialogs/SaveAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt index 59ec49c6b..9a146c371 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt @@ -47,18 +47,18 @@ class SaveAsDialog(val activity: SimpleActivity, val path: String, val callback: val extension = view.save_as_extension.value if (filename.isEmpty()) { - context.toast(R.string.filename_cannot_be_empty) + activity.toast(R.string.filename_cannot_be_empty) return@setOnClickListener } if (extension.isEmpty()) { - context.toast(R.string.extension_cannot_be_empty) + activity.toast(R.string.extension_cannot_be_empty) return@setOnClickListener } val newFile = File(realPath, "$filename.$extension") if (!newFile.name.isAValidFilename()) { - context.toast(R.string.filename_invalid_characters) + activity.toast(R.string.filename_invalid_characters) return@setOnClickListener } 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 12dab6bbb..595e629bc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -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() { 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) 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 c25fff7d1..410c54a17 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -6,8 +6,6 @@ import android.database.Cursor import android.net.Uri import android.provider.MediaStore 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.helpers.Config import com.simplemobiletools.gallery.helpers.NOMEDIA @@ -35,15 +33,6 @@ fun Context.getHumanizedFilename(path: String): String { 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() { startActivity(Intent(this, SettingsActivity::class.java)) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 557abba1d..eb857b6e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -72,7 +72,7 @@ class PhotoFragment : ViewPagerFragment() { rotated.compress(Bitmap.CompressFormat.JPEG, 100, out) medium.path = file.absolutePath } catch (e: Exception) { - context.toast(R.string.unknown_error_occurred) + activity.toast(R.string.unknown_error_occurred) return view } finally { try {