From 619647b16ab4d26bec4875b717e1eaa2b274337a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 4 Sep 2017 20:08:07 +0200 Subject: [PATCH] update commons to 2.27.8 --- app/build.gradle | 2 +- .../simplemobiletools/gallery/activities/EditActivity.kt | 6 +++++- .../gallery/activities/ViewPagerActivity.kt | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 54035fb66..04af3840c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.26.9' + compile 'com.simplemobiletools:commons:2.27.8' 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 ca9cf9bf6..0da6c4bef 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -172,7 +172,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener try { getFileOutputStream(file) { - saveBitmap(file, bitmap, it) + if (it != null) { + saveBitmap(file, bitmap, it) + } else { + toast(R.string.image_editing_failed) + } } } catch (e: Exception) { Log.e(TAG, "Crop compressing failed $path $e") 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 648f28abd..bbb805353 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -418,6 +418,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View try { val bitmap = BitmapFactory.decodeFile(currPath) getFileOutputStream(tmpFile) { + if (it == null) { + toast(R.string.unknown_error_occurred) + deleteFile(tmpFile) {} + return@getFileOutputStream + } + saveFile(tmpFile, bitmap, it) if (needsStupidWritePermissions(selectedFile.absolutePath)) { deleteFile(selectedFile) {}