Moved the checkbox into the dialog

This commit is contained in:
Agnieszka C 2023-01-11 15:25:46 +01:00
parent ba07d6b01d
commit 249eba4f59
4 changed files with 13 additions and 24 deletions

View File

@ -50,7 +50,6 @@ class SettingsActivity : SimpleActivity() {
setupCursorPlacement()
setupIncognitoMode()
setupCustomizeWidgetColors()
setupAddNewChecklistItemsTop()
updateTextColors(settings_nested_scrollview)
arrayOf(
@ -258,12 +257,4 @@ class SettingsActivity : SimpleActivity() {
config.useIncognitoMode = settings_use_incognito_mode.isChecked
}
}
private fun setupAddNewChecklistItemsTop() {
settings_add_checklist_top.isChecked = config.addNewChecklistItemsTop
settings_add_checklist_top_holder.setOnClickListener {
settings_add_checklist_top.toggle()
config.addNewChecklistItemsTop = settings_add_checklist_top.isChecked
}
}
}

View File

@ -9,8 +9,11 @@ import android.view.inputmethod.EditorInfo
import androidx.appcompat.widget.AppCompatEditText
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.DARK_GREY
import com.simplemobiletools.commons.helpers.SORT_BY_CUSTOM
import com.simplemobiletools.notes.pro.R
import com.simplemobiletools.notes.pro.extensions.config
import kotlinx.android.synthetic.main.dialog_new_checklist_item.view.*
import kotlinx.android.synthetic.main.dialog_new_checklist_item.view.dialog_holder
import kotlinx.android.synthetic.main.item_add_checklist.view.*
class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayList<String>) -> Unit) {
@ -31,6 +34,8 @@ class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayLis
add_item.setOnClickListener {
addNewEditText()
}
settings_add_checklist_top.beVisibleIf(activity.config.sorting == SORT_BY_CUSTOM)
settings_add_checklist_top.isChecked = activity.config.addNewChecklistItemsTop
}
activity.getAlertDialogBuilder()
@ -40,6 +45,7 @@ class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayLis
activity.setupDialogStuff(view, this, R.string.add_new_checklist_items) { alertDialog ->
alertDialog.showKeyboard(titles.first())
alertDialog.getButton(BUTTON_POSITIVE).setOnClickListener {
activity.config.addNewChecklistItemsTop = view.settings_add_checklist_top.isChecked
when {
titles.all { it.text!!.isEmpty() } -> activity.toast(R.string.empty_name)
else -> {

View File

@ -227,21 +227,6 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_add_checklist_top_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_add_checklist_top"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/add_new_checklist_items_top" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_gravity_holder"
style="@style/SettingsHolderTextViewStyle"

View File

@ -32,5 +32,12 @@
android:paddingBottom="@dimen/medium_margin"
android:src="@drawable/ic_plus_vector" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_add_checklist_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/add_new_checklist_items_top"
android:visibility="gone" />
</LinearLayout>
</ScrollView>