remove a directory from local db if it is empty
This commit is contained in:
parent
d2e2e315e1
commit
bb943daf38
1 changed files with 8 additions and 0 deletions
|
@ -485,6 +485,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private fun isDirEmpty(): Boolean {
|
private fun isDirEmpty(): Boolean {
|
||||||
return if (mMedia.size <= 0 && config.filterMedia > 0) {
|
return if (mMedia.size <= 0 && config.filterMedia > 0) {
|
||||||
deleteDirectoryIfEmpty()
|
deleteDirectoryIfEmpty()
|
||||||
|
deleteDBDirectory()
|
||||||
finish()
|
finish()
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
@ -492,6 +493,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun deleteDBDirectory() {
|
||||||
|
Thread {
|
||||||
|
galleryDB.DirectoryDao().deleteDirPath(mPath)
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
|
||||||
private fun tryToggleTemporarilyShowHidden() {
|
private fun tryToggleTemporarilyShowHidden() {
|
||||||
if (config.temporarilyShowHidden) {
|
if (config.temporarilyShowHidden) {
|
||||||
toggleTemporarilyShowHidden(false)
|
toggleTemporarilyShowHidden(false)
|
||||||
|
@ -671,6 +678,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(R.string.unknown_error_occurred)
|
||||||
} else if (mMedia.isEmpty()) {
|
} else if (mMedia.isEmpty()) {
|
||||||
deleteDirectoryIfEmpty()
|
deleteDirectoryIfEmpty()
|
||||||
|
deleteDBDirectory()
|
||||||
finish()
|
finish()
|
||||||
} else {
|
} else {
|
||||||
Thread {
|
Thread {
|
||||||
|
|
Loading…
Reference in a new issue