Skip to content

Commit 249eba4

Browse files
committed
Moved the checkbox into the dialog
1 parent ba07d6b commit 249eba4

File tree

4 files changed

+13
-24
lines changed

4 files changed

+13
-24
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/SettingsActivity.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class SettingsActivity : SimpleActivity() {
5050
setupCursorPlacement()
5151
setupIncognitoMode()
5252
setupCustomizeWidgetColors()
53-
setupAddNewChecklistItemsTop()
5453
updateTextColors(settings_nested_scrollview)
5554

5655
arrayOf(
@@ -258,12 +257,4 @@ class SettingsActivity : SimpleActivity() {
258257
config.useIncognitoMode = settings_use_incognito_mode.isChecked
259258
}
260259
}
261-
262-
private fun setupAddNewChecklistItemsTop() {
263-
settings_add_checklist_top.isChecked = config.addNewChecklistItemsTop
264-
settings_add_checklist_top_holder.setOnClickListener {
265-
settings_add_checklist_top.toggle()
266-
config.addNewChecklistItemsTop = settings_add_checklist_top.isChecked
267-
}
268-
}
269260
}

app/src/main/kotlin/com/simplemobiletools/notes/pro/dialogs/NewChecklistItemDialog.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ import android.view.inputmethod.EditorInfo
99
import androidx.appcompat.widget.AppCompatEditText
1010
import com.simplemobiletools.commons.extensions.*
1111
import com.simplemobiletools.commons.helpers.DARK_GREY
12+
import com.simplemobiletools.commons.helpers.SORT_BY_CUSTOM
1213
import com.simplemobiletools.notes.pro.R
14+
import com.simplemobiletools.notes.pro.extensions.config
1315
import kotlinx.android.synthetic.main.dialog_new_checklist_item.view.*
16+
import kotlinx.android.synthetic.main.dialog_new_checklist_item.view.dialog_holder
1417
import kotlinx.android.synthetic.main.item_add_checklist.view.*
1518

1619
class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayList<String>) -> Unit) {
@@ -31,6 +34,8 @@ class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayLis
3134
add_item.setOnClickListener {
3235
addNewEditText()
3336
}
37+
settings_add_checklist_top.beVisibleIf(activity.config.sorting == SORT_BY_CUSTOM)
38+
settings_add_checklist_top.isChecked = activity.config.addNewChecklistItemsTop
3439
}
3540

3641
activity.getAlertDialogBuilder()
@@ -40,6 +45,7 @@ class NewChecklistItemDialog(val activity: Activity, callback: (titles: ArrayLis
4045
activity.setupDialogStuff(view, this, R.string.add_new_checklist_items) { alertDialog ->
4146
alertDialog.showKeyboard(titles.first())
4247
alertDialog.getButton(BUTTON_POSITIVE).setOnClickListener {
48+
activity.config.addNewChecklistItemsTop = view.settings_add_checklist_top.isChecked
4349
when {
4450
titles.all { it.text!!.isEmpty() } -> activity.toast(R.string.empty_name)
4551
else -> {

app/src/main/res/layout/activity_settings.xml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,6 @@
227227

228228
</RelativeLayout>
229229

230-
<RelativeLayout
231-
android:id="@+id/settings_add_checklist_top_holder"
232-
style="@style/SettingsHolderCheckboxStyle"
233-
android:layout_width="match_parent"
234-
android:layout_height="wrap_content">
235-
236-
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
237-
android:id="@+id/settings_add_checklist_top"
238-
style="@style/SettingsCheckboxStyle"
239-
android:layout_width="match_parent"
240-
android:layout_height="wrap_content"
241-
android:text="@string/add_new_checklist_items_top" />
242-
243-
</RelativeLayout>
244-
245230
<RelativeLayout
246231
android:id="@+id/settings_gravity_holder"
247232
style="@style/SettingsHolderTextViewStyle"

app/src/main/res/layout/dialog_new_checklist_item.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,12 @@
3232
android:paddingBottom="@dimen/medium_margin"
3333
android:src="@drawable/ic_plus_vector" />
3434

35+
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
36+
android:id="@+id/settings_add_checklist_top"
37+
android:layout_width="match_parent"
38+
android:layout_height="wrap_content"
39+
android:text="@string/add_new_checklist_items_top"
40+
android:visibility="gone" />
41+
3542
</LinearLayout>
3643
</ScrollView>

0 commit comments

Comments
 (0)