improve folder discovery after renaming
This commit is contained in:
parent
4248d87be5
commit
2bad1e2088
|
@ -47,7 +47,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:4.0.23'
|
||||
implementation 'com.simplemobiletools:commons:4.1.1'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
|
|
|
@ -261,7 +261,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
}
|
||||
|
||||
private fun scanFinalPath(path: String) {
|
||||
scanPath(path) {
|
||||
scanPathRecursively(path) {
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
toast(R.string.file_saved)
|
||||
finish()
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.view.Menu
|
|||
import android.view.MenuItem
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.scanPath
|
||||
import com.simplemobiletools.commons.extensions.scanPathRecursively
|
||||
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.adapters.ManageFoldersAdapter
|
||||
|
@ -55,7 +55,7 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
config.addIncludedFolder(it)
|
||||
updateFolders()
|
||||
Thread {
|
||||
scanPath(it)
|
||||
scanPathRecursively(it)
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,14 +67,14 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
|
||||
mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false)
|
||||
if (mUri!!.scheme == "file") {
|
||||
scanPath(mUri!!.path)
|
||||
scanPathRecursively(mUri!!.path)
|
||||
sendViewPagerIntent(mUri!!.path)
|
||||
finish()
|
||||
return
|
||||
} else {
|
||||
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
|
||||
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms") {
|
||||
scanPath(mUri!!.path)
|
||||
scanPathRecursively(mUri!!.path)
|
||||
sendViewPagerIntent(path)
|
||||
finish()
|
||||
return
|
||||
|
|
|
@ -182,7 +182,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
if (!getDoesFilePathExist(mPath)) {
|
||||
Thread {
|
||||
scanPath(mPath)
|
||||
scanPathRecursively(mPath)
|
||||
}.start()
|
||||
finish()
|
||||
return
|
||||
|
@ -554,7 +554,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
|
||||
copyFile(tmpPath, newPath)
|
||||
scanPath(newPath)
|
||||
scanPathRecursively(newPath)
|
||||
toast(R.string.file_saved)
|
||||
|
||||
if (config.keepLastModified) {
|
||||
|
@ -833,7 +833,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
tryDeleteFileDirItem(fileDirItem, true)
|
||||
}
|
||||
|
||||
scanPath(mDirectory)
|
||||
scanPathRecursively(mDirectory)
|
||||
}
|
||||
|
||||
private fun checkOrientation() {
|
||||
|
|
|
@ -169,7 +169,10 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
tmb = File(it, tmb.getFilenameFromPath()).absolutePath
|
||||
}
|
||||
updateDirs(dirs)
|
||||
listener?.updateDirectories(dirs.toList() as ArrayList)
|
||||
Thread {
|
||||
activity.galleryDB.DirectoryDao().updateDirectoryAfterRename(firstDir.tmb, firstDir.name, firstDir.path, sourcePath)
|
||||
listener?.refreshItems()
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ fun BaseSimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
|
|||
val fileDocument = getDocumentFile(path)
|
||||
if (fileDocument?.exists() == true && fileDocument.isDirectory) {
|
||||
fileDocument.createFile("", NOMEDIA)
|
||||
applicationContext.scanFile(file) {
|
||||
applicationContext.scanFileRecursively(file) {
|
||||
callback()
|
||||
}
|
||||
} else {
|
||||
|
@ -117,7 +117,7 @@ fun BaseSimpleActivity.addNoMedia(path: String, callback: () -> Unit) {
|
|||
} else {
|
||||
try {
|
||||
file.createNewFile()
|
||||
applicationContext.scanFile(file) {
|
||||
applicationContext.scanFileRecursively(file) {
|
||||
callback()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -20,6 +20,9 @@ interface DirectoryDao {
|
|||
@Query("DELETE FROM directories WHERE path = :path")
|
||||
fun deleteDirPath(path: String)
|
||||
|
||||
@Query("UPDATE OR REPLACE directories SET thumbnail = :thumbnail, media_count = :mediaCnt, last_modified = :lastModified, date_taken = :dateTaken, size = :size, media_types = :mediaTypes WHERE path = :path")
|
||||
@Query("UPDATE OR REPLACE directories SET thumbnail = :thumbnail, media_count = :mediaCnt, last_modified = :lastModified, date_taken = :dateTaken, size = :size, media_types = :mediaTypes WHERE path = :path")
|
||||
fun updateDirectory(path: String, thumbnail: String, mediaCnt: Int, lastModified: Long, dateTaken: Long, size: Long, mediaTypes: Int)
|
||||
|
||||
@Query("UPDATE directories SET thumbnail = :thumbnail, filename = :name, path = :newPath WHERE path = :oldPath")
|
||||
fun updateDirectoryAfterRename(thumbnail: String, name: String, newPath: String, oldPath: String)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue