@@ -21,13 +21,13 @@ import android.os.Bundle
2121import androidx.core.content.edit
2222import androidx.core.os.bundleOf
2323import androidx.fragment.app.DialogFragment
24- import com.google.android.material.checkbox.MaterialCheckBox
2524import com.google.android.material.dialog.MaterialAlertDialogBuilder
2625import com.google.android.material.snackbar.Snackbar
2726import com.ichi2.anki.AnkiActivity
2827import com.ichi2.anki.CollectionManager.TR
2928import com.ichi2.anki.R
3029import com.ichi2.anki.common.annotations.NeedsTest
30+ import com.ichi2.anki.databinding.DialogForgetCardsBinding
3131import com.ichi2.anki.launchCatchingTask
3232import com.ichi2.anki.libanki.CardId
3333import com.ichi2.anki.libanki.sched.Scheduler
@@ -94,23 +94,23 @@ class ForgetCardsDialog : DialogFragment() {
9494 resetRepetitionAndLapseCounts = getBoolean(ARG_RESET_REPETITION , false )
9595 }
9696 }
97- val contentView =
98- layoutInflater.inflate(R .layout.dialog_forget_cards, null ).apply {
99- findViewById<MaterialCheckBox >(R .id.restore_original_position)!! .apply {
100- isChecked = restoreOriginalPositionIfPossible
101- setOnCheckedChangeListener { _, isChecked ->
102- restoreOriginalPositionIfPossible = isChecked
103- }
104- text = TR .schedulingRestorePosition()
105- }
106- findViewById<MaterialCheckBox >(R .id.reset_lapse_counts)!! .apply {
107- isChecked = resetRepetitionAndLapseCounts
108- setOnCheckedChangeListener { _, isChecked ->
109- resetRepetitionAndLapseCounts = isChecked
110- }
111- text = TR .schedulingResetCounts()
112- }
97+ val binding = DialogForgetCardsBinding .inflate(layoutInflater)
98+
99+ binding.restoreOriginalPosition.apply {
100+ isChecked = restoreOriginalPositionIfPossible
101+ setOnCheckedChangeListener { _, isChecked ->
102+ restoreOriginalPositionIfPossible = isChecked
113103 }
104+ text = TR .schedulingRestorePosition()
105+ }
106+ binding.resetLapseCounts.apply {
107+ isChecked = resetRepetitionAndLapseCounts
108+ setOnCheckedChangeListener { _, isChecked ->
109+ resetRepetitionAndLapseCounts = isChecked
110+ }
111+ text = TR .schedulingResetCounts()
112+ }
113+
114114 return MaterialAlertDialogBuilder (requireContext()).create {
115115 // BUG: this is 'Reset Card'/'Forget Card' in Anki Desktop (24.04)
116116 // title(text = TR.actionsForgetCard().toSentenceCase(R.string.sentence_forget_cards))
@@ -132,7 +132,7 @@ class ForgetCardsDialog : DialogFragment() {
132132 )
133133 }
134134 negativeButton(R .string.dialog_cancel)
135- setView(contentView )
135+ setView(binding.root )
136136 }
137137 }
138138
0 commit comments