remove sorting by date_taken while it doesnt work anyway

This commit is contained in:
tibbi 2018-04-13 22:54:53 +02:00
parent 2f1b545456
commit 26aa79294b
3 changed files with 18 additions and 15 deletions

View file

@ -29,8 +29,8 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti
.setPositiveButton(R.string.ok, this) .setPositiveButton(R.string.ok, this)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .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) currSorting = if (isDirectorySorting) config.directorySorting else config.getFileSorting(path)
setupSortRadio() 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_PATH != 0 -> sortingRadio.sorting_dialog_radio_path
currSorting and SORT_BY_SIZE != 0 -> sortingRadio.sorting_dialog_radio_size 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_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 else -> sortingRadio.sorting_dialog_radio_name
} }
sortBtn.isChecked = true 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_name -> SORT_BY_NAME
R.id.sorting_dialog_radio_path -> SORT_BY_PATH R.id.sorting_dialog_radio_path -> SORT_BY_PATH
R.id.sorting_dialog_radio_size -> SORT_BY_SIZE R.id.sorting_dialog_radio_size -> SORT_BY_SIZE
R.id.sorting_dialog_radio_last_modified -> SORT_BY_DATE_MODIFIED else -> SORT_BY_DATE_MODIFIED
else -> SORT_BY_DATE_TAKEN
} }
if (view.sorting_dialog_radio_order.checkedRadioButtonId == R.id.sorting_dialog_radio_descending) { if (view.sorting_dialog_radio_order.checkedRadioButtonId == R.id.sorting_dialog_radio_descending) {

View file

@ -6,6 +6,7 @@ import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import com.simplemobiletools.commons.helpers.BaseConfig import com.simplemobiletools.commons.helpers.BaseConfig
import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED 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.commons.helpers.SORT_DESCENDING
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.models.AlbumCover import com.simplemobiletools.gallery.models.AlbumCover
@ -17,7 +18,13 @@ class Config(context: Context) : BaseConfig(context) {
} }
var directorySorting: Int 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() set(order) = prefs.edit().putInt(DIRECTORY_SORT_ORDER, order).apply()
fun saveFileSorting(path: String, value: Int) { 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) { fun removeFileSorting(path: String) {
prefs.edit().remove(SORT_FOLDER_PREFIX + path.toLowerCase()).apply() prefs.edit().remove(SORT_FOLDER_PREFIX + path.toLowerCase()).apply()

View file

@ -52,14 +52,6 @@
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:text="@string/last_modified"/> android:text="@string/last_modified"/>
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_date_taken"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/medium_margin"
android:paddingTop="@dimen/medium_margin"
android:text="@string/date_taken"/>
</RadioGroup> </RadioGroup>
<include <include