refresh thumbnail items after rotating
This commit is contained in:
parent
040d6357c9
commit
c0e4176779
|
@ -587,8 +587,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
val currPath = getCurrentPath()
|
||||
SaveAsDialog(this, currPath, false) {
|
||||
handleSAFDialog(it) {
|
||||
toast(R.string.saving)
|
||||
Thread {
|
||||
saveRotatedImageToFile(currPath, it, mRotationDegrees) {
|
||||
toast(R.string.file_saved)
|
||||
mRotationDegrees = 0
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
|
|
|
@ -277,11 +277,19 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
|
|||
}
|
||||
|
||||
private fun rotateSelection(degrees: Int) {
|
||||
activity.toast(R.string.saving)
|
||||
Thread {
|
||||
val paths = getSelectedPaths()
|
||||
var fileCnt = paths.size
|
||||
paths.forEach {
|
||||
activity.saveRotatedImageToFile(it, it, degrees) {
|
||||
|
||||
fileCnt--
|
||||
if (fileCnt == 0) {
|
||||
activity.runOnUiThread {
|
||||
listener?.refreshItems()
|
||||
finishActMode()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
|
|
|
@ -374,7 +374,6 @@ fun Activity.fixDateTaken(paths: ArrayList<String>, callback: (() -> Unit)? = nu
|
|||
}
|
||||
|
||||
fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String, degrees: Int, callback: () -> Unit) {
|
||||
toast(R.string.saving)
|
||||
if (oldPath == newPath && oldPath.isJpg()) {
|
||||
if (tryRotateByExif(oldPath, degrees, callback)) {
|
||||
return
|
||||
|
@ -406,7 +405,6 @@ fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String,
|
|||
|
||||
copyFile(tmpPath, newPath)
|
||||
scanPathRecursively(newPath)
|
||||
toast(R.string.file_saved)
|
||||
fileRotatedSuccessfully(newPath, oldLastModified)
|
||||
|
||||
it.flush()
|
||||
|
|
Loading…
Reference in New Issue