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 5d4395988..fffac4f25 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt @@ -44,6 +44,7 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti currSorting and SORT_BY_PATH != 0 -> sortingRadio.sorting_dialog_radio_path currSorting and SORT_BY_SIZE != 0 -> sortingRadio.sorting_dialog_radio_size currSorting and SORT_BY_DATE_MODIFIED != 0 -> sortingRadio.sorting_dialog_radio_last_modified + currSorting and SORT_BY_DATE_TAKEN != 0 -> sortingRadio.sorting_dialog_radio_date_taken else -> sortingRadio.sorting_dialog_radio_name } sortBtn.isChecked = true @@ -65,7 +66,8 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti R.id.sorting_dialog_radio_name -> SORT_BY_NAME R.id.sorting_dialog_radio_path -> SORT_BY_PATH R.id.sorting_dialog_radio_size -> SORT_BY_SIZE - else -> SORT_BY_DATE_MODIFIED + R.id.sorting_dialog_radio_last_modified -> SORT_BY_DATE_MODIFIED + else -> SORT_BY_DATE_TAKEN } if (view.sorting_dialog_radio_order.checkedRadioButtonId == R.id.sorting_dialog_radio_descending) { 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 596a672ab..b4af46227 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -6,7 +6,6 @@ import com.google.gson.Gson import com.google.gson.reflect.TypeToken import com.simplemobiletools.commons.helpers.BaseConfig import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED -import com.simplemobiletools.commons.helpers.SORT_BY_DATE_TAKEN import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.models.AlbumCover @@ -18,13 +17,7 @@ class Config(context: Context) : BaseConfig(context) { } var directorySorting: Int - get(): Int { - var sort = prefs.getInt(DIRECTORY_SORT_ORDER, SORT_BY_DATE_MODIFIED or SORT_DESCENDING) - if (sort and SORT_BY_DATE_TAKEN != 0) { - sort = sort - SORT_BY_DATE_TAKEN + SORT_BY_DATE_MODIFIED - } - return sort - } + get(): Int = prefs.getInt(DIRECTORY_SORT_ORDER, SORT_BY_DATE_MODIFIED or SORT_DESCENDING) set(order) = prefs.edit().putInt(DIRECTORY_SORT_ORDER, order).apply() fun saveFileSorting(path: String, value: Int) { @@ -35,13 +28,7 @@ class Config(context: Context) : BaseConfig(context) { } } - fun getFileSorting(path: String): Int { - var sort = prefs.getInt(SORT_FOLDER_PREFIX + path.toLowerCase(), sorting) - if (sort and SORT_BY_DATE_TAKEN != 0) { - sort = sort - SORT_BY_DATE_TAKEN + SORT_BY_DATE_MODIFIED - } - return sort - } + fun getFileSorting(path: String) = prefs.getInt(SORT_FOLDER_PREFIX + path.toLowerCase(), sorting) fun removeFileSorting(path: String) { prefs.edit().remove(SORT_FOLDER_PREFIX + path.toLowerCase()).apply() 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 2327feadb..b6a183cef 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt @@ -20,7 +20,7 @@ data class Medium( @ColumnInfo(name = "full_path") var path: String, @ColumnInfo(name = "parent_path") var parentPath: String, @ColumnInfo(name = "last_modified") val modified: Long, - @ColumnInfo(name = "date_taken") val taken: Long, + @ColumnInfo(name = "date_taken") var taken: Long, @ColumnInfo(name = "size") val size: Long, @ColumnInfo(name = "type") val type: Int) : Serializable, Comparable { diff --git a/app/src/main/res/layout/dialog_change_sorting.xml b/app/src/main/res/layout/dialog_change_sorting.xml index 812840f40..e0e642acc 100644 --- a/app/src/main/res/layout/dialog_change_sorting.xml +++ b/app/src/main/res/layout/dialog_change_sorting.xml @@ -52,6 +52,14 @@ android:paddingTop="@dimen/medium_margin" android:text="@string/last_modified"/> + +