adding a few more favorites related queries
This commit is contained in:
parent
b867d2a2eb
commit
fb0badeca5
|
@ -28,10 +28,7 @@ import com.simplemobiletools.gallery.pro.helpers.*
|
||||||
import com.simplemobiletools.gallery.pro.interfaces.DirectoryDao
|
import com.simplemobiletools.gallery.pro.interfaces.DirectoryDao
|
||||||
import com.simplemobiletools.gallery.pro.interfaces.MediumDao
|
import com.simplemobiletools.gallery.pro.interfaces.MediumDao
|
||||||
import com.simplemobiletools.gallery.pro.interfaces.WidgetsDao
|
import com.simplemobiletools.gallery.pro.interfaces.WidgetsDao
|
||||||
import com.simplemobiletools.gallery.pro.models.AlbumCover
|
import com.simplemobiletools.gallery.pro.models.*
|
||||||
import com.simplemobiletools.gallery.pro.models.Directory
|
|
||||||
import com.simplemobiletools.gallery.pro.models.Medium
|
|
||||||
import com.simplemobiletools.gallery.pro.models.ThumbnailItem
|
|
||||||
import com.simplemobiletools.gallery.pro.svg.SvgSoftwareLayerSetter
|
import com.simplemobiletools.gallery.pro.svg.SvgSoftwareLayerSetter
|
||||||
import com.simplemobiletools.gallery.pro.views.MySquareImageView
|
import com.simplemobiletools.gallery.pro.views.MySquareImageView
|
||||||
import pl.droidsonroids.gif.GifDrawable
|
import pl.droidsonroids.gif.GifDrawable
|
||||||
|
@ -721,6 +718,8 @@ fun Context.getFavoritePaths(): ArrayList<String> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Context.getFavoriteFromPath(path: String) = Favorite(null, path, path.getFilenameFromPath(), path.getParentPath())
|
||||||
|
|
||||||
// remove the "recycle_bin" from the file path prefix, replace it with real bin path /data/user...
|
// remove the "recycle_bin" from the file path prefix, replace it with real bin path /data/user...
|
||||||
fun Context.getUpdatedDeletedMedia(mediumDao: MediumDao): ArrayList<Medium> {
|
fun Context.getUpdatedDeletedMedia(mediumDao: MediumDao): ArrayList<Medium> {
|
||||||
val media = try {
|
val media = try {
|
||||||
|
|
|
@ -1,10 +1,25 @@
|
||||||
package com.simplemobiletools.gallery.pro.interfaces
|
package com.simplemobiletools.gallery.pro.interfaces
|
||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
|
import com.simplemobiletools.gallery.pro.models.Favorite
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
interface FavoritesDAO {
|
interface FavoritesDAO {
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(favorite: Favorite)
|
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insertAll(favorites: List<Favorite>)
|
||||||
|
|
||||||
|
@Query("SELECT full_path FROM favorites")
|
||||||
|
fun getFavoriteRawPaths(): List<String>
|
||||||
|
|
||||||
|
@Query("SELECT favorites.full_path FROM favorites INNER JOIN media ON favorites.full_path = media.full_path WHERE media.deleted_ts = 0")
|
||||||
|
fun getValidFavoritePaths(): List<String>
|
||||||
|
|
||||||
@Query("SELECT id FROM favorites WHERE full_path = :path COLLATE NOCASE")
|
@Query("SELECT id FROM favorites WHERE full_path = :path COLLATE NOCASE")
|
||||||
fun isFavorite(path: String): Boolean
|
fun isFavorite(path: String): Boolean
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue