renaming some variables here and there
This commit is contained in:
parent
d2c152ecd6
commit
53beff0949
11 changed files with 39 additions and 39 deletions
|
@ -677,7 +677,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
|
||||
ensureBackgroundThread {
|
||||
folders.filter { !getDoesFilePathExist(it.absolutePath, OTGPath) }.forEach {
|
||||
directoryDao.deleteDirPath(it.absolutePath)
|
||||
directoryDB.deleteDirPath(it.absolutePath)
|
||||
}
|
||||
|
||||
if (config.deleteEmptyFolders) {
|
||||
|
@ -1063,7 +1063,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
if (dirPathsToRemove.isNotEmpty()) {
|
||||
val dirsToRemove = dirs.filter { dirPathsToRemove.contains(it.path) }
|
||||
dirsToRemove.forEach {
|
||||
directoryDao.deleteDirPath(it.path)
|
||||
directoryDB.deleteDirPath(it.path)
|
||||
}
|
||||
dirs.removeAll(dirsToRemove)
|
||||
setupAdapter(dirs)
|
||||
|
@ -1132,7 +1132,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
// make sure to create a new thread for these operations, dont just use the common bg thread
|
||||
Thread {
|
||||
try {
|
||||
directoryDao.insert(newDir)
|
||||
directoryDB.insert(newDir)
|
||||
if (folder != RECYCLE_BIN && folder != FAVORITES) {
|
||||
mediaDB.insertAll(newMedia)
|
||||
}
|
||||
|
@ -1346,7 +1346,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
setupAdapter(dirs)
|
||||
invalidDirs.forEach {
|
||||
try {
|
||||
directoryDao.deleteDirPath(it.path)
|
||||
directoryDB.deleteDirPath(it.path)
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -517,7 +517,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
val paths = mMedia.filter { it is Medium }.map { (it as Medium).path } as ArrayList<String>
|
||||
restoreRecycleBinPaths(paths) {
|
||||
ensureBackgroundThread {
|
||||
directoryDao.deleteDirPath(RECYCLE_BIN)
|
||||
directoryDB.deleteDirPath(RECYCLE_BIN)
|
||||
}
|
||||
finish()
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
|
||||
if (mPath == FAVORITES) {
|
||||
ensureBackgroundThread {
|
||||
directoryDao.deleteDirPath(FAVORITES)
|
||||
directoryDB.deleteDirPath(FAVORITES)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -639,7 +639,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
private fun deleteDBDirectory() {
|
||||
ensureBackgroundThread {
|
||||
try {
|
||||
directoryDao.deleteDirPath(mPath)
|
||||
directoryDB.deleteDirPath(mPath)
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,7 +224,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
private fun setupShowHiddenItems() {
|
||||
if (isRPlus() && !isExternalStorageManager()) {
|
||||
settings_show_hidden_items_holder.beGone()
|
||||
settings_manage_excluded_folders_holder.background = resources.getDrawable(R.drawable.ripple_bottom_corners, theme)
|
||||
}
|
||||
|
||||
settings_show_hidden_items.isChecked = config.showHiddenMedia
|
||||
|
|
|
@ -173,7 +173,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
ensureBackgroundThread {
|
||||
val path = directoryDao.getDirectoryThumbnail(folderPath)
|
||||
val path = directoryDB.getDirectoryThumbnail(folderPath)
|
||||
if (path != null) {
|
||||
runOnUiThread {
|
||||
val signature = ObjectKey(System.currentTimeMillis().toString())
|
||||
|
|
|
@ -266,7 +266,7 @@ class DirectoryAdapter(
|
|||
updateDirs(dirs)
|
||||
ensureBackgroundThread {
|
||||
try {
|
||||
activity.directoryDao.updateDirectoryAfterRename(firstDir.tmb, firstDir.name, firstDir.path, sourcePath)
|
||||
activity.directoryDB.updateDirectoryAfterRename(firstDir.tmb, firstDir.name, firstDir.path, sourcePath)
|
||||
listener?.refreshItems()
|
||||
} catch (e: Exception) {
|
||||
activity.showErrorToast(e)
|
||||
|
|
|
@ -18,16 +18,16 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickImage
|
|||
override fun doInBackground(vararg params: Void): ArrayList<ThumbnailItem> {
|
||||
val pathToUse = if (showAll) SHOW_ALL else mPath
|
||||
val folderGrouping = context.config.getFolderGrouping(pathToUse)
|
||||
val fileSorting = context.config.getFolderSorting(pathToUse)
|
||||
val getProperDateTaken = fileSorting and SORT_BY_DATE_TAKEN != 0 ||
|
||||
val folderSorting = context.config.getFolderSorting(pathToUse)
|
||||
val getProperDateTaken = folderSorting and SORT_BY_DATE_TAKEN != 0 ||
|
||||
folderGrouping and GROUP_BY_DATE_TAKEN_DAILY != 0 ||
|
||||
folderGrouping and GROUP_BY_DATE_TAKEN_MONTHLY != 0
|
||||
|
||||
val getProperLastModified = fileSorting and SORT_BY_DATE_MODIFIED != 0 ||
|
||||
val getProperLastModified = folderSorting and SORT_BY_DATE_MODIFIED != 0 ||
|
||||
folderGrouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 ||
|
||||
folderGrouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0
|
||||
|
||||
val getProperFileSize = fileSorting and SORT_BY_SIZE != 0
|
||||
val getProperFileSize = folderSorting and SORT_BY_SIZE != 0
|
||||
val favoritePaths = context.getFavoritePaths()
|
||||
val getVideoDurations = context.config.showThumbnailVideoDuration
|
||||
val lastModifieds = if (getProperLastModified) mediaFetcher.getLastModifieds() else HashMap()
|
||||
|
|
|
@ -460,7 +460,7 @@ fun BaseSimpleActivity.emptyTheRecycleBin(callback: (() -> Unit)? = null) {
|
|||
try {
|
||||
recycleBin.deleteRecursively()
|
||||
mediaDB.clearRecycleBin()
|
||||
directoryDao.deleteRecycleBin()
|
||||
directoryDB.deleteRecycleBin()
|
||||
toast(R.string.recycle_bin_emptied)
|
||||
callback?.invoke()
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -56,7 +56,7 @@ val Context.widgetsDB: WidgetsDao get() = GalleryDatabase.getInstance(applicatio
|
|||
|
||||
val Context.mediaDB: MediumDao get() = GalleryDatabase.getInstance(applicationContext).MediumDao()
|
||||
|
||||
val Context.directoryDao: DirectoryDao get() = GalleryDatabase.getInstance(applicationContext).DirectoryDao()
|
||||
val Context.directoryDB: DirectoryDao get() = GalleryDatabase.getInstance(applicationContext).DirectoryDao()
|
||||
|
||||
val Context.favoritesDB: FavoritesDao get() = GalleryDatabase.getInstance(applicationContext).FavoritesDao()
|
||||
|
||||
|
@ -397,7 +397,7 @@ fun Context.rescanFolderMediaSync(path: String) {
|
|||
|
||||
fun Context.storeDirectoryItems(items: ArrayList<Directory>) {
|
||||
ensureBackgroundThread {
|
||||
directoryDao.insertAll(items)
|
||||
directoryDB.insertAll(items)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ fun Context.getCachedDirectories(
|
|||
}
|
||||
|
||||
val directories = try {
|
||||
directoryDao.getAll() as ArrayList<Directory>
|
||||
directoryDB.getAll() as ArrayList<Directory>
|
||||
} catch (e: Exception) {
|
||||
ArrayList()
|
||||
}
|
||||
|
@ -801,11 +801,11 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
|
|||
}
|
||||
|
||||
fun Context.removeInvalidDBDirectories(dirs: ArrayList<Directory>? = null) {
|
||||
val dirsToCheck = dirs ?: directoryDao.getAll()
|
||||
val dirsToCheck = dirs ?: directoryDB.getAll()
|
||||
val OTGPath = config.OTGPath
|
||||
dirsToCheck.filter { !it.areFavorites() && !it.isRecycleBin() && !getDoesFilePathExist(it.path, OTGPath) && it.path != config.tempFolderPath }.forEach {
|
||||
try {
|
||||
directoryDao.deleteDirPath(it.path)
|
||||
directoryDB.deleteDirPath(it.path)
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ fun Context.updateDBMediaPath(oldPath: String, newPath: String) {
|
|||
|
||||
fun Context.updateDBDirectory(directory: Directory) {
|
||||
try {
|
||||
directoryDao.updateDirectory(
|
||||
directoryDB.updateDirectory(
|
||||
directory.path,
|
||||
directory.tmb,
|
||||
directory.mediaCnt,
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
|||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.activities.MediaActivity
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
import com.simplemobiletools.gallery.pro.extensions.directoryDao
|
||||
import com.simplemobiletools.gallery.pro.extensions.directoryDB
|
||||
import com.simplemobiletools.gallery.pro.extensions.getFolderNameFromPath
|
||||
import com.simplemobiletools.gallery.pro.extensions.widgetsDB
|
||||
import com.simplemobiletools.gallery.pro.models.Widget
|
||||
|
@ -45,7 +45,7 @@ class MyWidgetProvider : AppWidgetProvider() {
|
|||
setText(R.id.widget_folder_name, context.getFolderNameFromPath(it.folderPath))
|
||||
}
|
||||
|
||||
val path = context.directoryDao.getDirectoryThumbnail(it.folderPath) ?: return@forEach
|
||||
val path = context.directoryDB.getDirectoryThumbnail(it.folderPath) ?: return@forEach
|
||||
val options = RequestOptions()
|
||||
.signature(path.getFileSignature())
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
|
|
|
@ -40,7 +40,7 @@ interface MediumDao {
|
|||
fun deleteMediumPath(path: String)
|
||||
|
||||
@Query("UPDATE OR REPLACE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath COLLATE NOCASE")
|
||||
fun updateMedium(newFilename: String, newFullPath: String, newParentPath: String, oldPath: String)
|
||||
fun updateMedium(oldPath: String, newParentPath: String, newFilename: String, newFullPath: String)
|
||||
|
||||
@Query("UPDATE OR REPLACE media SET full_path = :newPath, deleted_ts = :deletedTS WHERE full_path = :oldPath COLLATE NOCASE")
|
||||
fun updateDeleted(newPath: String, deletedTS: Long, oldPath: String)
|
||||
|
|
|
@ -10,22 +10,23 @@ import com.simplemobiletools.gallery.pro.helpers.RECYCLE_BIN
|
|||
|
||||
@Entity(tableName = "directories", indices = [Index(value = ["path"], unique = true)])
|
||||
data class Directory(
|
||||
@PrimaryKey(autoGenerate = true) var id: Long?,
|
||||
@ColumnInfo(name = "path") var path: String,
|
||||
@ColumnInfo(name = "thumbnail") var tmb: String,
|
||||
@ColumnInfo(name = "filename") var name: String,
|
||||
@ColumnInfo(name = "media_count") var mediaCnt: Int,
|
||||
@ColumnInfo(name = "last_modified") var modified: Long,
|
||||
@ColumnInfo(name = "date_taken") var taken: Long,
|
||||
@ColumnInfo(name = "size") var size: Long,
|
||||
@ColumnInfo(name = "location") var location: Int,
|
||||
@ColumnInfo(name = "media_types") var types: Int,
|
||||
@ColumnInfo(name = "sort_value") var sortValue: String,
|
||||
@PrimaryKey(autoGenerate = true) var id: Long?,
|
||||
@ColumnInfo(name = "path") var path: String,
|
||||
@ColumnInfo(name = "thumbnail") var tmb: String,
|
||||
@ColumnInfo(name = "filename") var name: String,
|
||||
@ColumnInfo(name = "media_count") var mediaCnt: Int,
|
||||
@ColumnInfo(name = "last_modified") var modified: Long,
|
||||
@ColumnInfo(name = "date_taken") var taken: Long,
|
||||
@ColumnInfo(name = "size") var size: Long,
|
||||
@ColumnInfo(name = "location") var location: Int,
|
||||
@ColumnInfo(name = "media_types") var types: Int,
|
||||
@ColumnInfo(name = "sort_value") var sortValue: String,
|
||||
|
||||
// used with "Group direct subfolders" enabled
|
||||
@Ignore var subfoldersCount: Int = 0,
|
||||
@Ignore var subfoldersMediaCount: Int = 0,
|
||||
@Ignore var containsMediaFilesDirectly: Boolean = true) {
|
||||
// used with "Group direct subfolders" enabled
|
||||
@Ignore var subfoldersCount: Int = 0,
|
||||
@Ignore var subfoldersMediaCount: Int = 0,
|
||||
@Ignore var containsMediaFilesDirectly: Boolean = true
|
||||
) {
|
||||
|
||||
constructor() : this(null, "", "", "", 0, 0L, 0L, 0L, 0, 0, "", 0, 0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue