mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
fix #2080, make sure Favorites and Recycle bin has priority at refreshing
This commit is contained in:
parent
811d5e88c5
commit
ff6de731c9
2 changed files with 28 additions and 7 deletions
|
@ -943,13 +943,27 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
val dateTakens = mLastMediaFetcher!!.getDateTakens()
|
||||
|
||||
if (config.showRecycleBinAtFolders && !config.showRecycleBinLast && !dirs.map { it.path }.contains(RECYCLE_BIN)) {
|
||||
val recycleBin = Directory().apply {
|
||||
path = RECYCLE_BIN
|
||||
name = getString(R.string.recycle_bin)
|
||||
location = LOCATION_INTERNAL
|
||||
}
|
||||
if (mediaDB.getDeletedMediaCount() > 0) {
|
||||
val recycleBin = Directory().apply {
|
||||
path = RECYCLE_BIN
|
||||
name = getString(R.string.recycle_bin)
|
||||
location = LOCATION_INTERNAL
|
||||
}
|
||||
|
||||
dirs.add(0, recycleBin)
|
||||
dirs.add(0, recycleBin)
|
||||
}
|
||||
}
|
||||
|
||||
if (dirs.map { it.path }.contains(FAVORITES)) {
|
||||
if (mediaDB.getFavoritesCount() > 0) {
|
||||
val favorites = Directory().apply {
|
||||
path = FAVORITES
|
||||
name = getString(R.string.favorites)
|
||||
location = LOCATION_INTERNAL
|
||||
}
|
||||
|
||||
dirs.add(0, favorites)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -1042,6 +1056,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
}
|
||||
|
||||
val foldersToScan = mLastMediaFetcher!!.getFoldersToScan()
|
||||
foldersToScan.remove(FAVORITES)
|
||||
foldersToScan.add(0, FAVORITES)
|
||||
if (config.showRecycleBinAtFolders) {
|
||||
if (foldersToScan.contains(RECYCLE_BIN)) {
|
||||
|
@ -1054,7 +1069,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
foldersToScan.remove(RECYCLE_BIN)
|
||||
}
|
||||
|
||||
dirs.filterNot { it.path == RECYCLE_BIN }.forEach {
|
||||
dirs.filterNot { it.path == RECYCLE_BIN || it.path == FAVORITES }.forEach {
|
||||
foldersToScan.remove(it.path)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,15 @@ interface MediumDao {
|
|||
@Query("SELECT filename, full_path, parent_path, last_modified, date_taken, size, type, video_duration, is_favorite, deleted_ts FROM media WHERE deleted_ts = 0 AND is_favorite = 1")
|
||||
fun getFavorites(): List<Medium>
|
||||
|
||||
@Query("SELECT COUNT(filename) FROM media WHERE deleted_ts = 0 AND is_favorite = 1")
|
||||
fun getFavoritesCount(): Long
|
||||
|
||||
@Query("SELECT filename, full_path, parent_path, last_modified, date_taken, size, type, video_duration, is_favorite, deleted_ts FROM media WHERE deleted_ts != 0")
|
||||
fun getDeletedMedia(): List<Medium>
|
||||
|
||||
@Query("SELECT COUNT(filename) FROM media WHERE deleted_ts != 0")
|
||||
fun getDeletedMediaCount(): Long
|
||||
|
||||
@Insert(onConflict = REPLACE)
|
||||
fun insert(medium: Medium)
|
||||
|
||||
|
|
Loading…
Reference in a new issue