mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
show the temp folder at Copy/move dialog too
This commit is contained in:
parent
189f9b7410
commit
54a4d29233
6 changed files with 21 additions and 15 deletions
|
@ -211,7 +211,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
|
|
||||||
mLoadedInitialPhotos = true
|
mLoadedInitialPhotos = true
|
||||||
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
||||||
addTempFolderIfNeeded(it, false)
|
gotDirectories(addTempFolderIfNeeded(it), false)
|
||||||
}
|
}
|
||||||
mCurrAsyncTask!!.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
|
mCurrAsyncTask!!.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
|
||||||
}
|
}
|
||||||
|
@ -316,22 +316,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) {
|
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) {
|
||||||
CreateNewFolderDialog(this, it) {
|
CreateNewFolderDialog(this, it) {
|
||||||
config.tempFolderPath = it
|
config.tempFolderPath = it
|
||||||
addTempFolderIfNeeded(mDirs, true)
|
gotDirectories(addTempFolderIfNeeded(mDirs), true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addTempFolderIfNeeded(dirs: ArrayList<Directory>, isFromCache: Boolean) {
|
|
||||||
val directories = ArrayList<Directory>()
|
|
||||||
val tempFolderPath = config.tempFolderPath
|
|
||||||
if (tempFolderPath.isNotEmpty()) {
|
|
||||||
val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L)
|
|
||||||
directories.add(newFolder)
|
|
||||||
}
|
|
||||||
directories.addAll(dirs)
|
|
||||||
gotDirectories(directories, isFromCache)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun increaseColumnCount() {
|
private fun increaseColumnCount() {
|
||||||
config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount
|
config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.simplemobiletools.gallery.activities
|
package com.simplemobiletools.gallery.activities
|
||||||
|
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
|
import com.simplemobiletools.commons.extensions.getFilenameFromPath
|
||||||
import com.simplemobiletools.commons.extensions.toast
|
import com.simplemobiletools.commons.extensions.toast
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
import com.simplemobiletools.gallery.dialogs.PickDirectoryDialog
|
import com.simplemobiletools.gallery.dialogs.PickDirectoryDialog
|
||||||
|
import com.simplemobiletools.gallery.extensions.config
|
||||||
|
import com.simplemobiletools.gallery.models.Directory
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -19,4 +22,15 @@ open class SimpleActivity : BaseSimpleActivity() {
|
||||||
copyMoveFilesTo(files, source.trimEnd('/'), it, isCopyOperation, true, callback)
|
copyMoveFilesTo(files, source.trimEnd('/'), it, isCopyOperation, true, callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun addTempFolderIfNeeded(dirs: ArrayList<Directory>): ArrayList<Directory> {
|
||||||
|
val directories = ArrayList<Directory>()
|
||||||
|
val tempFolderPath = config.tempFolderPath
|
||||||
|
if (tempFolderPath.isNotEmpty()) {
|
||||||
|
val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L)
|
||||||
|
directories.add(newFolder)
|
||||||
|
}
|
||||||
|
directories.addAll(dirs)
|
||||||
|
return directories
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,6 +405,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
private fun copyMoveTo(isCopyOperation: Boolean) {
|
private fun copyMoveTo(isCopyOperation: Boolean) {
|
||||||
val files = ArrayList<File>(1).apply { add(getCurrentFile()) }
|
val files = ArrayList<File>(1).apply { add(getCurrentFile()) }
|
||||||
tryCopyMoveFilesTo(files, isCopyOperation) {
|
tryCopyMoveFilesTo(files, isCopyOperation) {
|
||||||
|
config.tempFolderPath = ""
|
||||||
if (!isCopyOperation) {
|
if (!isCopyOperation) {
|
||||||
reloadViewPager()
|
reloadViewPager()
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,6 +234,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.tryCopyMoveFilesTo(files, isCopyOperation) {
|
activity.tryCopyMoveFilesTo(files, isCopyOperation) {
|
||||||
|
config.tempFolderPath = ""
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
actMode?.finish()
|
actMode?.finish()
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,6 +174,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
selectedPositions.forEach { files.add(File(media[it].path)) }
|
selectedPositions.forEach { files.add(File(media[it].path)) }
|
||||||
|
|
||||||
activity.tryCopyMoveFilesTo(files, isCopyOperation) {
|
activity.tryCopyMoveFilesTo(files, isCopyOperation) {
|
||||||
|
config.tempFolderPath = ""
|
||||||
if (!isCopyOperation) {
|
if (!isCopyOperation) {
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,11 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String,
|
||||||
|
|
||||||
val dirs = activity.getCachedDirectories()
|
val dirs = activity.getCachedDirectories()
|
||||||
if (dirs.isNotEmpty()) {
|
if (dirs.isNotEmpty()) {
|
||||||
gotDirectories(dirs)
|
gotDirectories(activity.addTempFolderIfNeeded(dirs))
|
||||||
}
|
}
|
||||||
|
|
||||||
GetDirectoriesAsynctask(activity, false, false) {
|
GetDirectoriesAsynctask(activity, false, false) {
|
||||||
gotDirectories(it)
|
gotDirectories(activity.addTempFolderIfNeeded(it))
|
||||||
}.execute()
|
}.execute()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue