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 efbf4fe0e..5d4395988 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt
@@ -29,8 +29,8 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti
.setPositiveButton(R.string.ok, this)
.setNegativeButton(R.string.cancel, null)
.create().apply {
- activity.setupDialogStuff(view, this, R.string.sort_by)
- }
+ activity.setupDialogStuff(view, this, R.string.sort_by)
+ }
currSorting = if (isDirectorySorting) config.directorySorting else config.getFileSorting(path)
setupSortRadio()
@@ -44,7 +44,6 @@ 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
@@ -66,8 +65,7 @@ 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
- R.id.sorting_dialog_radio_last_modified -> SORT_BY_DATE_MODIFIED
- else -> SORT_BY_DATE_TAKEN
+ else -> SORT_BY_DATE_MODIFIED
}
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 131545dd1..428c214b7 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt
@@ -6,6 +6,7 @@ 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
@@ -17,7 +18,13 @@ class Config(context: Context) : BaseConfig(context) {
}
var directorySorting: Int
- get() = prefs.getInt(DIRECTORY_SORT_ORDER, SORT_BY_DATE_MODIFIED or SORT_DESCENDING)
+ 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
+ }
set(order) = prefs.edit().putInt(DIRECTORY_SORT_ORDER, order).apply()
fun saveFileSorting(path: String, value: Int) {
@@ -28,7 +35,13 @@ class Config(context: Context) : BaseConfig(context) {
}
}
- fun getFileSorting(path: String) = prefs.getInt(SORT_FOLDER_PREFIX + path.toLowerCase(), sorting)
+ 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 removeFileSorting(path: String) {
prefs.edit().remove(SORT_FOLDER_PREFIX + path.toLowerCase()).apply()
diff --git a/app/src/main/res/layout/dialog_change_sorting.xml b/app/src/main/res/layout/dialog_change_sorting.xml
index e0e642acc..812840f40 100644
--- a/app/src/main/res/layout/dialog_change_sorting.xml
+++ b/app/src/main/res/layout/dialog_change_sorting.xml
@@ -52,14 +52,6 @@
android:paddingTop="@dimen/medium_margin"
android:text="@string/last_modified"/>
-
-