mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
store the info about directory location in the model itself
This commit is contained in:
parent
4941eb642a
commit
c98658d069
4 changed files with 5 additions and 8 deletions
|
@ -349,7 +349,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
|
|||
|
||||
activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails)
|
||||
dir_pin.beVisibleIf(pinnedFolders.contains(directory.path))
|
||||
dir_sd_card.beVisibleIf(activity.isPathOnSD(directory.path))
|
||||
dir_sd_card.beVisibleIf(directory.isOnSDCard)
|
||||
photo_cnt.beVisibleIf(showMediaCount)
|
||||
|
||||
if (isListViewType) {
|
||||
|
|
|
@ -2,10 +2,7 @@ package com.simplemobiletools.gallery.asynctasks
|
|||
|
||||
import android.content.Context
|
||||
import android.os.AsyncTask
|
||||
import com.simplemobiletools.commons.extensions.getFilenameFromPath
|
||||
import com.simplemobiletools.commons.extensions.hasPermission
|
||||
import com.simplemobiletools.commons.extensions.internalStoragePath
|
||||
import com.simplemobiletools.commons.extensions.sdCardPath
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||
import com.simplemobiletools.commons.helpers.SORT_DESCENDING
|
||||
import com.simplemobiletools.gallery.R
|
||||
|
@ -58,7 +55,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
val lastModified = if (config.directorySorting and SORT_DESCENDING > 0) Math.max(firstItem.modified, lastItem.modified) else Math.min(firstItem.modified, lastItem.modified)
|
||||
val dateTaken = if (config.directorySorting and SORT_DESCENDING > 0) Math.max(firstItem.taken, lastItem.taken) else Math.min(firstItem.taken, lastItem.taken)
|
||||
val size = curMedia.sumByLong { it.size }
|
||||
val directory = Directory(parentDir, thumbnail, dirName, curMedia.size, lastModified, dateTaken, size)
|
||||
val directory = Directory(parentDir, thumbnail, dirName, curMedia.size, lastModified, dateTaken, size, context.isPathOnSD(parentDir))
|
||||
directories.add(directory)
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ fun BaseSimpleActivity.addTempFolderIfNeeded(dirs: ArrayList<Directory>): ArrayL
|
|||
val directories = ArrayList<Directory>()
|
||||
val tempFolderPath = config.tempFolderPath
|
||||
if (tempFolderPath.isNotEmpty()) {
|
||||
val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L)
|
||||
val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L, isPathOnSD(tempFolderPath))
|
||||
directories.add(newFolder)
|
||||
}
|
||||
directories.addAll(dirs)
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.simplemobiletools.commons.helpers.*
|
|||
import java.io.Serializable
|
||||
|
||||
data class Directory(val path: String, val tmb: String, val name: String, var mediaCnt: Int, val modified: Long, val taken: Long,
|
||||
val size: Long) : Serializable, Comparable<Directory> {
|
||||
val size: Long, val isOnSDCard: Boolean) : Serializable, Comparable<Directory> {
|
||||
companion object {
|
||||
private val serialVersionUID = -6553345863555455L
|
||||
var sorting: Int = 0
|
||||
|
|
Loading…
Reference in a new issue