make sure the new directory is the first one
This commit is contained in:
parent
2aab1ba5e5
commit
551fc3a1c6
1 changed files with 15 additions and 3 deletions
|
@ -210,7 +210,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
|
|
||||||
mLoadedInitialPhotos = true
|
mLoadedInitialPhotos = true
|
||||||
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
||||||
gotDirectories(it)
|
addTempFolderIfNeeded(it, false)
|
||||||
}
|
}
|
||||||
mCurrAsyncTask!!.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
|
mCurrAsyncTask!!.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
|
||||||
}
|
}
|
||||||
|
@ -315,10 +315,21 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) {
|
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) {
|
||||||
CreateNewFolderDialog(this, it) {
|
CreateNewFolderDialog(this, it) {
|
||||||
mNewFolderPath = it
|
mNewFolderPath = it
|
||||||
|
addTempFolderIfNeeded(mDirs, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun addTempFolderIfNeeded(dirs: ArrayList<Directory>, isFromCache: Boolean) {
|
||||||
|
val directories = ArrayList<Directory>()
|
||||||
|
if (mNewFolderPath.isNotEmpty()) {
|
||||||
|
val newFolder = Directory(mNewFolderPath, "", mNewFolderPath.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()
|
||||||
|
@ -416,7 +427,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun gotDirectories(dirs: ArrayList<Directory>, isFromCache: Boolean = false) {
|
private fun gotDirectories(dirs: ArrayList<Directory>, isFromCache: Boolean) {
|
||||||
mLastMediaModified = getLastMediaModified()
|
mLastMediaModified = getLastMediaModified()
|
||||||
directories_refresh_layout.isRefreshing = false
|
directories_refresh_layout.isRefreshing = false
|
||||||
mIsGettingDirs = false
|
mIsGettingDirs = false
|
||||||
|
@ -433,11 +444,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
setupAdapter()
|
setupAdapter()
|
||||||
}
|
}
|
||||||
|
|
||||||
storeDirectories()
|
storeDirectories()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeDirectories() {
|
private fun storeDirectories() {
|
||||||
if (!config.temporarilyShowHidden) {
|
if (!config.temporarilyShowHidden && mNewFolderPath.isEmpty()) {
|
||||||
val directories = Gson().toJson(mDirs)
|
val directories = Gson().toJson(mDirs)
|
||||||
config.directories = directories
|
config.directories = directories
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue