rename timestamp of media and directories to date_modified

This commit is contained in:
tibbi 2016-12-05 22:07:44 +01:00
parent e6585180c3
commit b0c9d72044
7 changed files with 19 additions and 19 deletions

View file

@ -275,7 +275,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
toggleItemSelection(itemView, markedItems.contains(pos), pos) toggleItemSelection(itemView, markedItems.contains(pos), pos)
val tmb = directory.thumbnail val tmb = directory.thumbnail
val timestampSignature = StringSignature(directory.timestamp.toString()) val timestampSignature = StringSignature(directory.date_modified.toString())
if (tmb.toLowerCase().endsWith(".gif")) { if (tmb.toLowerCase().endsWith(".gif")) {
Glide.with(activity).load(tmb).asGif().diskCacheStrategy(DiskCacheStrategy.NONE).signature(timestampSignature) Glide.with(activity).load(tmb).asGif().diskCacheStrategy(DiskCacheStrategy.NONE).signature(timestampSignature)
.placeholder(R.color.tmb_background).centerCrop().crossFade().into(itemView.dir_thumbnail) .placeholder(R.color.tmb_background).centerCrop().crossFade().into(itemView.dir_thumbnail)

View file

@ -186,7 +186,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
toggleItemSelection(itemView, markedItems.contains(pos), pos) toggleItemSelection(itemView, markedItems.contains(pos), pos)
val path = medium.path val path = medium.path
val timestampSignature = StringSignature(medium.timestamp.toString()) val timestampSignature = StringSignature(medium.date_modified.toString())
if (medium.isGif()) { if (medium.isGif()) {
Glide.with(activity).load(path).asGif().diskCacheStrategy(DiskCacheStrategy.NONE).signature(timestampSignature).into(itemView.medium_thumbnail) Glide.with(activity).load(path).asGif().diskCacheStrategy(DiskCacheStrategy.NONE).signature(timestampSignature).into(itemView.medium_thumbnail)
} else if (medium.isPng()) { } else if (medium.isPng()) {

View file

@ -40,7 +40,7 @@ class ChangeSortingDialog(val activity: Activity, val isDirectorySorting: Boolea
val sortingRadio = view.sorting_dialog_radio_sorting val sortingRadio = view.sorting_dialog_radio_sorting
var sortBtn = sortingRadio.sorting_dialog_radio_name var sortBtn = sortingRadio.sorting_dialog_radio_name
if (currSorting and SORT_BY_DATE != 0) { if (currSorting and SORT_BY_DATE_MODIFIED != 0) {
sortBtn = sortingRadio.sorting_dialog_radio_date sortBtn = sortingRadio.sorting_dialog_radio_date
} else if (currSorting and SORT_BY_SIZE != 0) { } else if (currSorting and SORT_BY_SIZE != 0) {
sortBtn = sortingRadio.sorting_dialog_radio_size sortBtn = sortingRadio.sorting_dialog_radio_size
@ -62,7 +62,7 @@ class ChangeSortingDialog(val activity: Activity, val isDirectorySorting: Boolea
val sortingRadio = view.sorting_dialog_radio_sorting val sortingRadio = view.sorting_dialog_radio_sorting
var sorting = when (sortingRadio.checkedRadioButtonId) { var sorting = when (sortingRadio.checkedRadioButtonId) {
R.id.sorting_dialog_radio_name -> SORT_BY_NAME R.id.sorting_dialog_radio_name -> SORT_BY_NAME
R.id.sorting_dialog_radio_date -> SORT_BY_DATE R.id.sorting_dialog_radio_date -> SORT_BY_DATE_MODIFIED
else -> SORT_BY_SIZE else -> SORT_BY_SIZE
} }

View file

@ -28,11 +28,11 @@ class Config private constructor(context: Context) {
set(isSameSorting) = mPrefs.edit().putBoolean(IS_SAME_SORTING, isSameSorting).apply() set(isSameSorting) = mPrefs.edit().putBoolean(IS_SAME_SORTING, isSameSorting).apply()
var sorting: Int var sorting: Int
get() = if (isSameSorting) directorySorting else mPrefs.getInt(SORT_ORDER, SORT_BY_DATE or SORT_DESCENDING) get() = if (isSameSorting) directorySorting else mPrefs.getInt(SORT_ORDER, SORT_BY_DATE_MODIFIED or SORT_DESCENDING)
set(order) = if (isSameSorting) directorySorting = order else mPrefs.edit().putInt(SORT_ORDER, order).apply() set(order) = if (isSameSorting) directorySorting = order else mPrefs.edit().putInt(SORT_ORDER, order).apply()
var directorySorting: Int var directorySorting: Int
get() = mPrefs.getInt(DIRECTORY_SORT_ORDER, SORT_BY_DATE or SORT_DESCENDING) get() = mPrefs.getInt(DIRECTORY_SORT_ORDER, SORT_BY_DATE_MODIFIED or SORT_DESCENDING)
set(order) = mPrefs.edit().putInt(DIRECTORY_SORT_ORDER, order).apply() set(order) = mPrefs.edit().putInt(DIRECTORY_SORT_ORDER, order).apply()
var showHiddenFolders: Boolean var showHiddenFolders: Boolean

View file

@ -16,7 +16,7 @@ val PINNED_FOLDERS = "pinned_folders"
// sorting // sorting
val SORT_BY_NAME = 1 val SORT_BY_NAME = 1
val SORT_BY_DATE = 2 val SORT_BY_DATE_MODIFIED = 2
val SORT_BY_SIZE = 4 val SORT_BY_SIZE = 4
val SORT_DESCENDING = 1024 val SORT_DESCENDING = 1024

View file

@ -1,10 +1,10 @@
package com.simplemobiletools.gallery.models package com.simplemobiletools.gallery.models
import com.simplemobiletools.gallery.helpers.SORT_BY_DATE 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 timestamp: Long, var size: Long) : Comparable<Directory> { class Directory(val path: String, val thumbnail: String, val name: String, var mediaCnt: Int, val date_modified: Long, var size: Long) : Comparable<Directory> {
companion object { companion object {
var sorting: Int = 0 var sorting: Int = 0
} }
@ -17,10 +17,10 @@ class Directory(val path: String, val thumbnail: String, val name: String, var m
var res: Int var res: Int
if (sorting and SORT_BY_NAME != 0) { if (sorting and SORT_BY_NAME != 0) {
res = name.toLowerCase().compareTo(other.name.toLowerCase()) res = name.toLowerCase().compareTo(other.name.toLowerCase())
} else if (sorting and SORT_BY_DATE != 0) { } else if (sorting and SORT_BY_DATE_MODIFIED != 0) {
res = if (timestamp == other.timestamp) res = if (date_modified == other.date_modified)
0 0
else if (timestamp > other.timestamp) else if (date_modified > other.date_modified)
1 1
else else
-1 -1
@ -39,5 +39,5 @@ 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, timestamp=$timestamp, size $size}" override fun toString() = "Directory {path=$path, thumbnail=$thumbnail, name=$name, mediaCnt=$mediaCnt, date_modified=$date_modified, size $size}"
} }

View file

@ -1,11 +1,11 @@
package com.simplemobiletools.gallery.models package com.simplemobiletools.gallery.models
import com.simplemobiletools.gallery.helpers.SORT_BY_DATE 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
import java.io.Serializable import java.io.Serializable
class Medium(val name: String, var path: String, val isVideo: Boolean, val timestamp: Long, val size: Long) : Serializable, Comparable<Medium> { class Medium(val name: String, var path: String, val isVideo: Boolean, val date_modified: 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
@ -23,10 +23,10 @@ class Medium(val name: String, var path: String, val isVideo: Boolean, val times
var res: Int var res: Int
if (sorting and SORT_BY_NAME != 0) { if (sorting and SORT_BY_NAME != 0) {
res = name.toLowerCase().compareTo(other.name.toLowerCase()) res = name.toLowerCase().compareTo(other.name.toLowerCase())
} else if (sorting and SORT_BY_DATE != 0) { } else if (sorting and SORT_BY_DATE_MODIFIED != 0) {
res = if (timestamp == other.timestamp) res = if (date_modified == other.date_modified)
0 0
else if (timestamp > other.timestamp) else if (date_modified > other.date_modified)
1 1
else else
-1 -1
@ -45,5 +45,5 @@ class Medium(val name: String, var path: String, val isVideo: Boolean, val times
return res return res
} }
override fun toString() = "Medium {name=$name, path=$path, isVideo=$isVideo, timestamp=$timestamp, size=$size}" override fun toString() = "Medium {name=$name, path=$path, isVideo=$isVideo, date_modified=$date_modified, size=$size}"
} }