lets rescan files after some file operations, reverting #4d00682ec6
This commit is contained in:
parent
d507228f41
commit
ff6726b476
|
@ -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()}"
|
||||||
|
rescanPaths(arrayListOf(newPath)) {
|
||||||
fixDateTaken(arrayListOf(newPath), false)
|
fixDateTaken(arrayListOf(newPath), false)
|
||||||
|
}
|
||||||
|
|
||||||
config.tempFolderPath = ""
|
config.tempFolderPath = ""
|
||||||
if (!isCopyOperation) {
|
if (!isCopyOperation) {
|
||||||
|
@ -1029,12 +1031,14 @@ 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)
|
||||||
|
rescanPaths(paths) {
|
||||||
fixDateTaken(paths, false)
|
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,7 +459,8 @@ 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 }
|
||||||
|
.forEach {
|
||||||
config.removeFolderProtection(it)
|
config.removeFolderProtection(it)
|
||||||
lockedFolderPaths.remove(it)
|
lockedFolderPaths.remove(it)
|
||||||
}
|
}
|
||||||
|
@ -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.rescanPaths(newPaths) {
|
||||||
activity.fixDateTaken(newPaths, false)
|
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.rescanPaths(newPaths) {
|
||||||
activity.fixDateTaken(newPaths, false)
|
activity.fixDateTaken(newPaths, false)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isCopyOperation) {
|
if (!isCopyOperation) {
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
|
|
Loading…
Reference in New Issue