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()))
|
||||
tryCopyMoveFilesTo(fileDirItems, isCopyOperation) {
|
||||
val newPath = "$it/${currPath.getFilenameFromPath()}"
|
||||
rescanPaths(arrayListOf(newPath)) {
|
||||
fixDateTaken(arrayListOf(newPath), false)
|
||||
}
|
||||
|
||||
config.tempFolderPath = ""
|
||||
if (!isCopyOperation) {
|
||||
|
@ -1029,12 +1031,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
toast(R.string.file_saved)
|
||||
val paths = arrayListOf(file.absolutePath)
|
||||
rescanPaths(paths) {
|
||||
fixDateTaken(paths, false)
|
||||
|
||||
if (config.keepLastModified) {
|
||||
File(file.absolutePath).setLastModified(lastModified)
|
||||
updateLastModified(file.absolutePath, lastModified)
|
||||
}
|
||||
}
|
||||
out.close()
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,10 @@ import java.util.*
|
|||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
|
||||
class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView,
|
||||
val isPickIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout? = null, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit) :
|
||||
class DirectoryAdapter(
|
||||
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 {
|
||||
|
||||
private val config = activity.config
|
||||
|
@ -457,7 +459,8 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
val hashToCheck = config.getFolderProtectionHash(firstPath)
|
||||
SecurityDialog(activity, hashToCheck, tabToShow) { hash, type, 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)
|
||||
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>
|
||||
activity.tryCopyMoveFilesTo(fileDirItems, isCopyOperation) {
|
||||
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)
|
||||
}
|
||||
|
||||
config.tempFolderPath = ""
|
||||
listener?.refreshItems()
|
||||
|
@ -788,7 +793,16 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
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))
|
||||
|
|
|
@ -357,7 +357,9 @@ class MediaAdapter(
|
|||
activity.applicationContext.rescanFolderMedia(fileDirItems.first().getParentPath())
|
||||
|
||||
val newPaths = fileDirItems.map { "$destinationPath/${it.name}" }.toMutableList() as ArrayList<String>
|
||||
activity.rescanPaths(newPaths) {
|
||||
activity.fixDateTaken(newPaths, false)
|
||||
}
|
||||
|
||||
if (!isCopyOperation) {
|
||||
listener?.refreshItems()
|
||||
|
|
Loading…
Reference in a new issue