lets rescan files after some file operations, reverting #4d00682ec6
This commit is contained in:
parent
d507228f41
commit
ff6726b476
3 changed files with 35 additions and 15 deletions
|
@ -631,7 +631,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
val fileDirItems = arrayListOf(FileDirItem(currPath, currPath.getFilenameFromPath()))
|
val fileDirItems = arrayListOf(FileDirItem(currPath, currPath.getFilenameFromPath()))
|
||||||
tryCopyMoveFilesTo(fileDirItems, isCopyOperation) {
|
tryCopyMoveFilesTo(fileDirItems, isCopyOperation) {
|
||||||
val newPath = "$it/${currPath.getFilenameFromPath()}"
|
val newPath = "$it/${currPath.getFilenameFromPath()}"
|
||||||
fixDateTaken(arrayListOf(newPath), false)
|
rescanPaths(arrayListOf(newPath)) {
|
||||||
|
fixDateTaken(arrayListOf(newPath), false)
|
||||||
|
}
|
||||||
|
|
||||||
config.tempFolderPath = ""
|
config.tempFolderPath = ""
|
||||||
if (!isCopyOperation) {
|
if (!isCopyOperation) {
|
||||||
|
@ -1029,11 +1031,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
|
|
||||||
toast(R.string.file_saved)
|
toast(R.string.file_saved)
|
||||||
val paths = arrayListOf(file.absolutePath)
|
val paths = arrayListOf(file.absolutePath)
|
||||||
fixDateTaken(paths, false)
|
rescanPaths(paths) {
|
||||||
|
fixDateTaken(paths, false)
|
||||||
|
|
||||||
if (config.keepLastModified) {
|
if (config.keepLastModified) {
|
||||||
File(file.absolutePath).setLastModified(lastModified)
|
File(file.absolutePath).setLastModified(lastModified)
|
||||||
updateLastModified(file.absolutePath, lastModified)
|
updateLastModified(file.absolutePath, lastModified)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
out.close()
|
out.close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,10 @@ import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.collections.HashMap
|
import kotlin.collections.HashMap
|
||||||
|
|
||||||
class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView,
|
class DirectoryAdapter(
|
||||||
val isPickIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout? = null, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit) :
|
activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView,
|
||||||
|
val isPickIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout? = null, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit
|
||||||
|
) :
|
||||||
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick), ItemTouchHelperContract {
|
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick), ItemTouchHelperContract {
|
||||||
|
|
||||||
private val config = activity.config
|
private val config = activity.config
|
||||||
|
@ -457,10 +459,11 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
val hashToCheck = config.getFolderProtectionHash(firstPath)
|
val hashToCheck = config.getFolderProtectionHash(firstPath)
|
||||||
SecurityDialog(activity, hashToCheck, tabToShow) { hash, type, success ->
|
SecurityDialog(activity, hashToCheck, tabToShow) { hash, type, success ->
|
||||||
if (success) {
|
if (success) {
|
||||||
paths.filter { config.isFolderProtected(it) && config.getFolderProtectionType(it) == tabToShow && config.getFolderProtectionHash(it) == hashToCheck }.forEach {
|
paths.filter { config.isFolderProtected(it) && config.getFolderProtectionType(it) == tabToShow && config.getFolderProtectionHash(it) == hashToCheck }
|
||||||
config.removeFolderProtection(it)
|
.forEach {
|
||||||
lockedFolderPaths.remove(it)
|
config.removeFolderProtection(it)
|
||||||
}
|
lockedFolderPaths.remove(it)
|
||||||
|
}
|
||||||
|
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
finishActMode()
|
finishActMode()
|
||||||
|
@ -522,8 +525,10 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
val fileDirItems = paths.map { FileDirItem(it, it.getFilenameFromPath()) } as ArrayList<FileDirItem>
|
val fileDirItems = paths.map { FileDirItem(it, it.getFilenameFromPath()) } as ArrayList<FileDirItem>
|
||||||
activity.tryCopyMoveFilesTo(fileDirItems, isCopyOperation) {
|
activity.tryCopyMoveFilesTo(fileDirItems, isCopyOperation) {
|
||||||
val destinationPath = it
|
val destinationPath = it
|
||||||
val newPaths = fileDirItems.map { "$destinationPath/${it.name}" }.toMutableList() as java.util.ArrayList<String>
|
val newPaths = fileDirItems.map { "$destinationPath/${it.name}" }.toMutableList() as ArrayList<String>
|
||||||
activity.fixDateTaken(newPaths, false)
|
activity.rescanPaths(newPaths) {
|
||||||
|
activity.fixDateTaken(newPaths, false)
|
||||||
|
}
|
||||||
|
|
||||||
config.tempFolderPath = ""
|
config.tempFolderPath = ""
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
|
@ -788,7 +793,16 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
||||||
else -> ROUNDED_CORNERS_BIG
|
else -> ROUNDED_CORNERS_BIG
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners, directory.getKey())
|
activity.loadImage(
|
||||||
|
thumbnailType,
|
||||||
|
directory.tmb,
|
||||||
|
dir_thumbnail,
|
||||||
|
scrollHorizontally,
|
||||||
|
animateGifs,
|
||||||
|
cropThumbnails,
|
||||||
|
roundedCorners,
|
||||||
|
directory.getKey()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
dir_pin.beVisibleIf(pinnedFolders.contains(directory.path))
|
dir_pin.beVisibleIf(pinnedFolders.contains(directory.path))
|
||||||
|
|
|
@ -357,7 +357,9 @@ class MediaAdapter(
|
||||||
activity.applicationContext.rescanFolderMedia(fileDirItems.first().getParentPath())
|
activity.applicationContext.rescanFolderMedia(fileDirItems.first().getParentPath())
|
||||||
|
|
||||||
val newPaths = fileDirItems.map { "$destinationPath/${it.name}" }.toMutableList() as ArrayList<String>
|
val newPaths = fileDirItems.map { "$destinationPath/${it.name}" }.toMutableList() as ArrayList<String>
|
||||||
activity.fixDateTaken(newPaths, false)
|
activity.rescanPaths(newPaths) {
|
||||||
|
activity.fixDateTaken(newPaths, false)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isCopyOperation) {
|
if (!isCopyOperation) {
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
|
|
Loading…
Reference in a new issue