mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-27 06:57:59 +01:00
refresh thumbnail items after rotating
This commit is contained in:
parent
040d6357c9
commit
c0e4176779
3 changed files with 11 additions and 3 deletions
|
@ -587,8 +587,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
val currPath = getCurrentPath()
|
val currPath = getCurrentPath()
|
||||||
SaveAsDialog(this, currPath, false) {
|
SaveAsDialog(this, currPath, false) {
|
||||||
handleSAFDialog(it) {
|
handleSAFDialog(it) {
|
||||||
|
toast(R.string.saving)
|
||||||
Thread {
|
Thread {
|
||||||
saveRotatedImageToFile(currPath, it, mRotationDegrees) {
|
saveRotatedImageToFile(currPath, it, mRotationDegrees) {
|
||||||
|
toast(R.string.file_saved)
|
||||||
mRotationDegrees = 0
|
mRotationDegrees = 0
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,11 +277,19 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun rotateSelection(degrees: Int) {
|
private fun rotateSelection(degrees: Int) {
|
||||||
|
activity.toast(R.string.saving)
|
||||||
Thread {
|
Thread {
|
||||||
val paths = getSelectedPaths()
|
val paths = getSelectedPaths()
|
||||||
|
var fileCnt = paths.size
|
||||||
paths.forEach {
|
paths.forEach {
|
||||||
activity.saveRotatedImageToFile(it, it, degrees) {
|
activity.saveRotatedImageToFile(it, it, degrees) {
|
||||||
|
fileCnt--
|
||||||
|
if (fileCnt == 0) {
|
||||||
|
activity.runOnUiThread {
|
||||||
|
listener?.refreshItems()
|
||||||
|
finishActMode()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start()
|
}.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) {
|
fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String, degrees: Int, callback: () -> Unit) {
|
||||||
toast(R.string.saving)
|
|
||||||
if (oldPath == newPath && oldPath.isJpg()) {
|
if (oldPath == newPath && oldPath.isJpg()) {
|
||||||
if (tryRotateByExif(oldPath, degrees, callback)) {
|
if (tryRotateByExif(oldPath, degrees, callback)) {
|
||||||
return
|
return
|
||||||
|
@ -406,7 +405,6 @@ fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String,
|
||||||
|
|
||||||
copyFile(tmpPath, newPath)
|
copyFile(tmpPath, newPath)
|
||||||
scanPathRecursively(newPath)
|
scanPathRecursively(newPath)
|
||||||
toast(R.string.file_saved)
|
|
||||||
fileRotatedSuccessfully(newPath, oldLastModified)
|
fileRotatedSuccessfully(newPath, oldLastModified)
|
||||||
|
|
||||||
it.flush()
|
it.flush()
|
||||||
|
|
Loading…
Reference in a new issue