always refresh viewpager when successfully returning from the editor

This commit is contained in:
tibbi 2018-02-24 20:16:03 +01:00
parent 02b6525ee9
commit 97236d6ed2
4 changed files with 5 additions and 3 deletions

View file

@ -46,7 +46,7 @@ ext {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.13.0' implementation 'com.simplemobiletools:commons:3.13.4'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.code.gson:gson:2.8.2' implementation 'com.google.code.gson:gson:2.8.2'

View file

@ -204,7 +204,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
Thread { Thread {
val file = File(path) val file = File(path)
val fileDirItem = FileDirItem(path, path.getFilenameFromPath()) val fileDirItem = FileDirItem(path, path.getFilenameFromPath())
getFileOutputStream(fileDirItem) { getFileOutputStream(fileDirItem, true) {
if (it != null) { if (it != null) {
saveBitmap(file, bitmap, it) saveBitmap(file, bitmap, it)
} else { } else {

View file

@ -654,8 +654,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} }
private fun checkLastMediaChanged() { private fun checkLastMediaChanged() {
if (isActivityDestroyed()) if (isActivityDestroyed()) {
return return
}
mLastMediaHandler.removeCallbacksAndMessages(null) mLastMediaHandler.removeCallbacksAndMessages(null)
mLastMediaHandler.postDelayed({ mLastMediaHandler.postDelayed({

View file

@ -713,6 +713,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
if (requestCode == REQUEST_EDIT_IMAGE) { if (requestCode == REQUEST_EDIT_IMAGE) {
if (resultCode == Activity.RESULT_OK && resultData != null) { if (resultCode == Activity.RESULT_OK && resultData != null) {
mPos = -1 mPos = -1
mPrevHashcode = 0
refreshViewPager() refreshViewPager()
} }
} else if (requestCode == REQUEST_SET_AS) { } else if (requestCode == REQUEST_SET_AS) {