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 f7020498d..95513a98e 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt
@@ -42,12 +42,12 @@ class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting:
val sortingRadio = view.sorting_dialog_radio_sorting
var sortBtn = sortingRadio.sorting_dialog_radio_name
- if (currSorting and SORT_BY_SIZE != 0) {
- sortBtn = sortingRadio.sorting_dialog_radio_size
- } else if (currSorting and SORT_BY_DATE_MODIFIED != 0) {
- sortBtn = sortingRadio.sorting_dialog_radio_last_modified
- } else if (currSorting and SORT_BY_DATE_TAKEN != 0)
- sortBtn = sortingRadio.sorting_dialog_radio_date_taken
+ when {
+ currSorting and SORT_BY_PATH != 0 -> sortBtn = sortingRadio.sorting_dialog_radio_path
+ currSorting and SORT_BY_SIZE != 0 -> sortBtn = sortingRadio.sorting_dialog_radio_size
+ currSorting and SORT_BY_DATE_MODIFIED != 0 -> sortBtn = sortingRadio.sorting_dialog_radio_last_modified
+ currSorting and SORT_BY_DATE_TAKEN != 0 -> sortBtn = sortingRadio.sorting_dialog_radio_date_taken
+ }
sortBtn.isChecked = true
}
@@ -65,6 +65,7 @@ class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting:
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_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
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 4f102e380..d03b4d1be 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt
@@ -14,6 +14,7 @@ data class Directory(val path: String, val tmb: String, val name: String, var me
var result: Int
when {
sorting and SORT_BY_NAME != 0 -> result = AlphanumericComparator().compare(name.toLowerCase(), other.name.toLowerCase())
+ sorting and SORT_BY_PATH != 0 -> result = AlphanumericComparator().compare(path.toLowerCase(), other.path.toLowerCase())
sorting and SORT_BY_SIZE != 0 -> result = when {
size == other.size -> 0
size > other.size -> 1
diff --git a/app/src/main/res/layout/dialog_change_sorting.xml b/app/src/main/res/layout/dialog_change_sorting.xml
index d0ab9b36f..e0e642acc 100644
--- a/app/src/main/res/layout/dialog_change_sorting.xml
+++ b/app/src/main/res/layout/dialog_change_sorting.xml
@@ -28,6 +28,14 @@
android:paddingTop="@dimen/medium_margin"
android:text="@string/name"/>
+
+