From b0c9d72044e17edc7ae7e28370a580fa89833ead Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Dec 2016 22:07:44 +0100 Subject: [PATCH] rename timestamp of media and directories to date_modified --- .../gallery/adapters/DirectoryAdapter.kt | 2 +- .../gallery/adapters/MediaAdapter.kt | 2 +- .../gallery/dialogs/ChangeSortingDialog.kt | 4 ++-- .../com/simplemobiletools/gallery/helpers/Config.kt | 4 ++-- .../simplemobiletools/gallery/helpers/Constants.kt | 2 +- .../simplemobiletools/gallery/models/Directory.kt | 12 ++++++------ .../com/simplemobiletools/gallery/models/Medium.kt | 12 ++++++------ 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 2bfc4ea0e..71c6c9e52 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -275,7 +275,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList, toggleItemSelection(itemView, markedItems.contains(pos), pos) val path = medium.path - val timestampSignature = StringSignature(medium.timestamp.toString()) + val timestampSignature = StringSignature(medium.date_modified.toString()) if (medium.isGif()) { Glide.with(activity).load(path).asGif().diskCacheStrategy(DiskCacheStrategy.NONE).signature(timestampSignature).into(itemView.medium_thumbnail) } else if (medium.isPng()) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt index 7c59fcc40..778404c20 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt @@ -40,7 +40,7 @@ class ChangeSortingDialog(val activity: Activity, val isDirectorySorting: Boolea val sortingRadio = view.sorting_dialog_radio_sorting 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 } else if (currSorting and SORT_BY_SIZE != 0) { 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 var sorting = when (sortingRadio.checkedRadioButtonId) { 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 } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 484e0ecee..0e8467c75 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -28,11 +28,11 @@ class Config private constructor(context: Context) { set(isSameSorting) = mPrefs.edit().putBoolean(IS_SAME_SORTING, isSameSorting).apply() 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() 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() var showHiddenFolders: Boolean diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 0aedfe75e..1dc4931d6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -16,7 +16,7 @@ val PINNED_FOLDERS = "pinned_folders" // sorting val SORT_BY_NAME = 1 -val SORT_BY_DATE = 2 +val SORT_BY_DATE_MODIFIED = 2 val SORT_BY_SIZE = 4 val SORT_DESCENDING = 1024 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt index 4ae82ec46..7a16a5fce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt @@ -1,10 +1,10 @@ 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_DESCENDING -class Directory(val path: String, val thumbnail: String, val name: String, var mediaCnt: Int, val timestamp: Long, var size: Long) : Comparable { +class Directory(val path: String, val thumbnail: String, val name: String, var mediaCnt: Int, val date_modified: Long, var size: Long) : Comparable { companion object { var sorting: Int = 0 } @@ -17,10 +17,10 @@ class Directory(val path: String, val thumbnail: String, val name: String, var m var res: Int if (sorting and SORT_BY_NAME != 0) { res = name.toLowerCase().compareTo(other.name.toLowerCase()) - } else if (sorting and SORT_BY_DATE != 0) { - res = if (timestamp == other.timestamp) + } else if (sorting and SORT_BY_DATE_MODIFIED != 0) { + res = if (date_modified == other.date_modified) 0 - else if (timestamp > other.timestamp) + else if (date_modified > other.date_modified) 1 else -1 @@ -39,5 +39,5 @@ class Directory(val path: String, val thumbnail: String, val name: String, var m 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}" } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt index ba5b01eb4..a98d583b7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt @@ -1,11 +1,11 @@ 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_DESCENDING import java.io.Serializable -class Medium(val name: String, var path: String, val isVideo: Boolean, val timestamp: Long, val size: Long) : Serializable, Comparable { +class Medium(val name: String, var path: String, val isVideo: Boolean, val date_modified: Long, val size: Long) : Serializable, Comparable { companion object { private val serialVersionUID = -6553149466975455L var sorting: Int = 0 @@ -23,10 +23,10 @@ class Medium(val name: String, var path: String, val isVideo: Boolean, val times var res: Int if (sorting and SORT_BY_NAME != 0) { res = name.toLowerCase().compareTo(other.name.toLowerCase()) - } else if (sorting and SORT_BY_DATE != 0) { - res = if (timestamp == other.timestamp) + } else if (sorting and SORT_BY_DATE_MODIFIED != 0) { + res = if (date_modified == other.date_modified) 0 - else if (timestamp > other.timestamp) + else if (date_modified > other.date_modified) 1 else -1 @@ -45,5 +45,5 @@ class Medium(val name: String, var path: String, val isVideo: Boolean, val times 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}" }