avoid rescanning paths in some cases
This can make files not be recognized as media files in some other apps, but rescanning can also too easily delete files. Let's try playing it safe.
This commit is contained in:
parent
d9194176ee
commit
4d00682ec6
|
@ -78,7 +78,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:94ece2461b'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:03149a0586'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
|
||||
|
|
|
@ -887,11 +887,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
|
||||
private fun scanFinalPath(path: String) {
|
||||
val paths = arrayListOf(path)
|
||||
rescanPaths(paths) {
|
||||
fixDateTaken(paths, false)
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
toast(R.string.file_saved)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -625,9 +625,7 @@ 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) {
|
||||
|
@ -1019,14 +1017,12 @@ 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()
|
||||
}
|
||||
|
||||
|
|
|
@ -523,9 +523,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
activity.tryCopyMoveFilesTo(fileDirItems, isCopyOperation) {
|
||||
val destinationPath = it
|
||||
val newPaths = fileDirItems.map { "$destinationPath/${it.name}" }.toMutableList() as java.util.ArrayList<String>
|
||||
activity.rescanPaths(newPaths) {
|
||||
activity.fixDateTaken(newPaths, false)
|
||||
}
|
||||
|
||||
config.tempFolderPath = ""
|
||||
listener?.refreshItems()
|
||||
|
|
|
@ -40,8 +40,10 @@ import kotlinx.android.synthetic.main.video_item_grid.view.medium_name
|
|||
import kotlinx.android.synthetic.main.video_item_grid.view.medium_thumbnail
|
||||
import java.util.*
|
||||
|
||||
class MediaAdapter(activity: BaseSimpleActivity, var media: ArrayList<ThumbnailItem>, val listener: MediaOperationsListener?, val isAGetIntent: Boolean,
|
||||
val allowMultiplePicks: Boolean, val path: String, recyclerView: MyRecyclerView, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit) :
|
||||
class MediaAdapter(
|
||||
activity: BaseSimpleActivity, var media: ArrayList<ThumbnailItem>, val listener: MediaOperationsListener?, val isAGetIntent: Boolean,
|
||||
val allowMultiplePicks: Boolean, val path: String, recyclerView: MyRecyclerView, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit
|
||||
) :
|
||||
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
|
||||
|
||||
private val INSTANT_LOAD_DURATION = 2000L
|
||||
|
@ -355,9 +357,8 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: ArrayList<ThumbnailI
|
|||
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()
|
||||
activity.updateFavoritePaths(fileDirItems, destinationPath)
|
||||
|
@ -531,11 +532,13 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: ArrayList<ThumbnailI
|
|||
}
|
||||
|
||||
if (showFileTypes && (medium.isGIF() || medium.isRaw() || medium.isSVG())) {
|
||||
file_type.setText(when (medium.type) {
|
||||
file_type.setText(
|
||||
when (medium.type) {
|
||||
TYPE_GIFS -> R.string.gif
|
||||
TYPE_RAWS -> R.string.raw
|
||||
else -> R.string.svg
|
||||
})
|
||||
}
|
||||
)
|
||||
file_type.beVisible()
|
||||
} else {
|
||||
file_type?.beGone()
|
||||
|
@ -573,16 +576,20 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: ArrayList<ThumbnailI
|
|||
}
|
||||
|
||||
if (loadImageInstantly) {
|
||||
activity.loadImage(medium.type, path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners, medium.getKey(),
|
||||
rotatedImagePaths)
|
||||
activity.loadImage(
|
||||
medium.type, path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners, medium.getKey(),
|
||||
rotatedImagePaths
|
||||
)
|
||||
} else {
|
||||
medium_thumbnail.setImageDrawable(null)
|
||||
medium_thumbnail.isHorizontalScrolling = scrollHorizontally
|
||||
delayHandler.postDelayed({
|
||||
val isVisible = visibleItemPaths.contains(medium.path)
|
||||
if (isVisible) {
|
||||
activity.loadImage(medium.type, path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners,
|
||||
medium.getKey(), rotatedImagePaths)
|
||||
activity.loadImage(
|
||||
medium.type, path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners,
|
||||
medium.getKey(), rotatedImagePaths
|
||||
)
|
||||
}
|
||||
}, IMAGE_LOAD_DELAY)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue