store the date_taken at media and directories
This commit is contained in:
parent
b0c9d72044
commit
8a24eeba86
6 changed files with 17 additions and 11 deletions
|
@ -48,7 +48,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentClic
|
||||||
|
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
val file = File(mUri.toString())
|
val file = File(mUri.toString())
|
||||||
mMedium = Medium(file.name, mUri.toString(), mIsVideo, 0, file.length())
|
mMedium = Medium(file.name, mUri.toString(), mIsVideo, 0, 0, file.length())
|
||||||
bundle.putSerializable(MEDIUM, mMedium)
|
bundle.putSerializable(MEDIUM, mMedium)
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
||||||
|
|
||||||
uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
|
uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
|
||||||
}
|
}
|
||||||
val columns = arrayOf(MediaStore.Images.Media.DATA, MediaStore.Images.Media.DATE_MODIFIED, MediaStore.Images.Media.SIZE)
|
val columns = arrayOf(MediaStore.Images.Media.DATA, MediaStore.Images.Media.DATE_MODIFIED, MediaStore.Images.Media.DATE_TAKEN, MediaStore.Images.Media.SIZE)
|
||||||
val order = getSortOrder()
|
val order = getSortOrder()
|
||||||
var cursor: Cursor? = null
|
var cursor: Cursor? = null
|
||||||
|
|
||||||
|
@ -69,8 +69,9 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
||||||
dirName += " ${context.resources.getString(R.string.hidden)}"
|
dirName += " ${context.resources.getString(R.string.hidden)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
val timestamp = cursor.getLongValue(MediaStore.Images.Media.DATE_MODIFIED)
|
val dateModified = cursor.getLongValue(MediaStore.Images.Media.DATE_MODIFIED)
|
||||||
directories.put(parentDir, Directory(parentDir, fullPath, dirName, 1, timestamp, size))
|
val dateTaken = cursor.getLongValue(MediaStore.Images.Media.DATE_TAKEN)
|
||||||
|
directories.put(parentDir, Directory(parentDir, fullPath, dirName, 1, dateModified, dateTaken, size))
|
||||||
}
|
}
|
||||||
} while (cursor.moveToNext())
|
} while (cursor.moveToNext())
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,8 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo
|
||||||
}
|
}
|
||||||
val where = "${MediaStore.Images.Media.DATA} LIKE ?"
|
val where = "${MediaStore.Images.Media.DATA} LIKE ?"
|
||||||
val args = arrayOf("$mPath%")
|
val args = arrayOf("$mPath%")
|
||||||
val columns = arrayOf(MediaStore.Images.Media.DATA, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DATE_MODIFIED, MediaStore.Images.Media.SIZE)
|
val columns = arrayOf(MediaStore.Images.Media.DATA, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DATE_MODIFIED,
|
||||||
|
MediaStore.Images.Media.DATE_TAKEN, MediaStore.Images.Media.SIZE)
|
||||||
var cursor: Cursor? = null
|
var cursor: Cursor? = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -62,8 +63,9 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo
|
||||||
continue
|
continue
|
||||||
|
|
||||||
val name = cursor.getStringValue(MediaStore.Images.Media.DISPLAY_NAME)
|
val name = cursor.getStringValue(MediaStore.Images.Media.DISPLAY_NAME)
|
||||||
val timestamp = cursor.getLongValue(MediaStore.Images.Media.DATE_MODIFIED)
|
val dateModified = cursor.getLongValue(MediaStore.Images.Media.DATE_MODIFIED)
|
||||||
media.add(Medium(name, curPath, i == 1, timestamp, size))
|
val dateTaken = cursor.getLongValue(MediaStore.Images.Media.DATE_TAKEN)
|
||||||
|
media.add(Medium(name, curPath, i == 1, dateModified, dateTaken, size))
|
||||||
}
|
}
|
||||||
} while (cursor.moveToNext())
|
} while (cursor.moveToNext())
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ val PINNED_FOLDERS = "pinned_folders"
|
||||||
val SORT_BY_NAME = 1
|
val SORT_BY_NAME = 1
|
||||||
val SORT_BY_DATE_MODIFIED = 2
|
val SORT_BY_DATE_MODIFIED = 2
|
||||||
val SORT_BY_SIZE = 4
|
val SORT_BY_SIZE = 4
|
||||||
|
val SORT_BY_DATE_TAKEN = 8
|
||||||
|
|
||||||
val SORT_DESCENDING = 1024
|
val SORT_DESCENDING = 1024
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@ import com.simplemobiletools.gallery.helpers.SORT_BY_DATE_MODIFIED
|
||||||
import com.simplemobiletools.gallery.helpers.SORT_BY_NAME
|
import com.simplemobiletools.gallery.helpers.SORT_BY_NAME
|
||||||
import com.simplemobiletools.gallery.helpers.SORT_DESCENDING
|
import com.simplemobiletools.gallery.helpers.SORT_DESCENDING
|
||||||
|
|
||||||
class Directory(val path: String, val thumbnail: String, val name: String, var mediaCnt: Int, val date_modified: Long, var size: Long) : Comparable<Directory> {
|
class Directory(val path: String, val thumbnail: String, val name: String, var mediaCnt: Int, val date_modified: Long, val date_taken: Long,
|
||||||
|
var size: Long) : Comparable<Directory> {
|
||||||
companion object {
|
companion object {
|
||||||
var sorting: Int = 0
|
var sorting: Int = 0
|
||||||
}
|
}
|
||||||
|
@ -39,5 +40,6 @@ class Directory(val path: String, val thumbnail: String, val name: String, var m
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString() = "Directory {path=$path, thumbnail=$thumbnail, name=$name, mediaCnt=$mediaCnt, date_modified=$date_modified, size $size}"
|
override fun toString() = "Directory {path=$path, thumbnail=$thumbnail, name=$name, mediaCnt=$mediaCnt, date_modified=$date_modified, " +
|
||||||
|
"date_taken=$date_taken, size $size}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.simplemobiletools.gallery.helpers.SORT_BY_NAME
|
||||||
import com.simplemobiletools.gallery.helpers.SORT_DESCENDING
|
import com.simplemobiletools.gallery.helpers.SORT_DESCENDING
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
class Medium(val name: String, var path: String, val isVideo: Boolean, val date_modified: Long, val size: Long) : Serializable, Comparable<Medium> {
|
class Medium(val name: String, var path: String, val isVideo: Boolean, val date_modified: Long, val date_taken: Long, val size: Long) : Serializable, Comparable<Medium> {
|
||||||
companion object {
|
companion object {
|
||||||
private val serialVersionUID = -6553149466975455L
|
private val serialVersionUID = -6553149466975455L
|
||||||
var sorting: Int = 0
|
var sorting: Int = 0
|
||||||
|
@ -45,5 +45,5 @@ class Medium(val name: String, var path: String, val isVideo: Boolean, val date_
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString() = "Medium {name=$name, path=$path, isVideo=$isVideo, date_modified=$date_modified, size=$size}"
|
override fun toString() = "Medium {name=$name, path=$path, isVideo=$isVideo, date_modified=$date_modified, date_taken=$date_taken, size=$size}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue