mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-10 13:41:05 +02:00
Moved done checklist setting to the sorting dialog (#462)
This commit is contained in:
parent
86b43ede04
commit
9b45cfc053
@ -38,7 +38,6 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
setupMonospacedFont()
|
setupMonospacedFont()
|
||||||
setupShowKeyboard()
|
setupShowKeyboard()
|
||||||
setupShowNotePicker()
|
setupShowNotePicker()
|
||||||
setupMoveUndoneChecklistItems()
|
|
||||||
setupShowWordCount()
|
setupShowWordCount()
|
||||||
setupEnableLineWrap()
|
setupEnableLineWrap()
|
||||||
setupFontSize()
|
setupFontSize()
|
||||||
@ -133,14 +132,6 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupMoveUndoneChecklistItems() {
|
|
||||||
settings_move_undone_checklist_items.isChecked = config.moveDoneChecklistItems
|
|
||||||
settings_move_undone_checklist_items_holder.setOnClickListener {
|
|
||||||
settings_move_undone_checklist_items.toggle()
|
|
||||||
config.moveDoneChecklistItems = settings_move_undone_checklist_items.isChecked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupShowWordCount() {
|
private fun setupShowWordCount() {
|
||||||
settings_show_word_count.isChecked = config.showWordCount
|
settings_show_word_count.isChecked = config.showWordCount
|
||||||
settings_show_word_count_holder.setOnClickListener {
|
settings_show_word_count_holder.setOnClickListener {
|
||||||
|
@ -106,9 +106,6 @@ class WidgetAdapter(val context: Context, val intent: Intent) : RemoteViewsServi
|
|||||||
|
|
||||||
// checklist title can be null only because of the glitch in upgrade to 6.6.0, remove this check in the future
|
// checklist title can be null only because of the glitch in upgrade to 6.6.0, remove this check in the future
|
||||||
checklistItems = checklistItems.filter { it.title != null }.toMutableList() as ArrayList<ChecklistItem>
|
checklistItems = checklistItems.filter { it.title != null }.toMutableList() as ArrayList<ChecklistItem>
|
||||||
if (context.config.moveDoneChecklistItems) {
|
|
||||||
checklistItems.sortBy { it.isDone }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ class SortChecklistDialog(private val activity: SimpleActivity, private val call
|
|||||||
init {
|
init {
|
||||||
setupSortRadio()
|
setupSortRadio()
|
||||||
setupOrderRadio()
|
setupOrderRadio()
|
||||||
|
setupMoveUndoneChecklistItems()
|
||||||
AlertDialog.Builder(activity)
|
AlertDialog.Builder(activity)
|
||||||
.setPositiveButton(R.string.ok) { _, _ -> dialogConfirmed() }
|
.setPositiveButton(R.string.ok) { _, _ -> dialogConfirmed() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
@ -48,6 +49,13 @@ class SortChecklistDialog(private val activity: SimpleActivity, private val call
|
|||||||
orderBtn.isChecked = true
|
orderBtn.isChecked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupMoveUndoneChecklistItems() {
|
||||||
|
view.settings_move_undone_checklist_items.isChecked = config.moveDoneChecklistItems
|
||||||
|
view.settings_move_undone_checklist_items_holder.setOnClickListener {
|
||||||
|
view.settings_move_undone_checklist_items.toggle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun dialogConfirmed() {
|
private fun dialogConfirmed() {
|
||||||
val sortingRadio = view.sorting_dialog_radio_sorting
|
val sortingRadio = view.sorting_dialog_radio_sorting
|
||||||
var sorting = when (sortingRadio.checkedRadioButtonId) {
|
var sorting = when (sortingRadio.checkedRadioButtonId) {
|
||||||
@ -61,7 +69,9 @@ class SortChecklistDialog(private val activity: SimpleActivity, private val call
|
|||||||
|
|
||||||
if (currSorting != sorting) {
|
if (currSorting != sorting) {
|
||||||
config.sorting = sorting
|
config.sorting = sorting
|
||||||
callback()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.moveDoneChecklistItems = view.settings_move_undone_checklist_items.isChecked
|
||||||
|
callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,9 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
|
|||||||
updateUIVisibility()
|
updateUIVisibility()
|
||||||
ChecklistItem.sorting = requireContext().config.sorting
|
ChecklistItem.sorting = requireContext().config.sorting
|
||||||
items.sort()
|
items.sort()
|
||||||
|
if (context?.config?.moveDoneChecklistItems == true) {
|
||||||
|
items.sortBy { it.isDone }
|
||||||
|
}
|
||||||
ChecklistAdapter(
|
ChecklistAdapter(
|
||||||
activity = activity as SimpleActivity,
|
activity = activity as SimpleActivity,
|
||||||
items = items,
|
items = items,
|
||||||
|
@ -346,29 +346,6 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/settings_move_undone_checklist_items_holder"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/medium_margin"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:paddingStart="@dimen/normal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_margin"
|
|
||||||
android:paddingEnd="@dimen/normal_margin"
|
|
||||||
android:paddingBottom="@dimen/activity_margin">
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
|
||||||
android:id="@+id/settings_move_undone_checklist_items"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@null"
|
|
||||||
android:clickable="false"
|
|
||||||
android:paddingStart="@dimen/medium_margin"
|
|
||||||
android:text="@string/move_done_checklist_items"
|
|
||||||
app:switchPadding="@dimen/medium_margin" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/saving_label"
|
android:id="@+id/saving_label"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/dialog_holder"
|
android:id="@+id/dialog_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@ -59,4 +60,24 @@
|
|||||||
android:text="@string/descending" />
|
android:text="@string/descending" />
|
||||||
|
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_move_undone_checklist_items_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
android:paddingBottom="@dimen/activity_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||||
|
android:id="@+id/settings_move_undone_checklist_items"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="@string/move_done_checklist_items"
|
||||||
|
app:switchPadding="@dimen/medium_margin" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user