From 5db556d140b139636d3115bb0b031cd13555290c Mon Sep 17 00:00:00 2001 From: Prateek Singh Date: Thu, 13 Oct 2022 06:54:38 +0530 Subject: [PATCH] Integrated NotificationSheetDialog.kt with NotificationsSettingsFragment. --- .../preferences/NotificationsSettingsFragment.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/NotificationsSettingsFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/NotificationsSettingsFragment.kt index be26b64e0e8b..2f4c203482e2 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/NotificationsSettingsFragment.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/NotificationsSettingsFragment.kt @@ -24,6 +24,7 @@ import androidx.fragment.app.Fragment import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.ichi2.anki.CollectionHelper +import com.ichi2.anki.NotificationSheetDialog import com.ichi2.anki.R import com.ichi2.anki.UIUtils import com.ichi2.anki.widgets.NotificationPreferenceAdapter @@ -41,7 +42,9 @@ import timber.log.Timber /** * Fragment with preferences related to notifications */ -class NotificationsSettingsFragment : Fragment() { +class NotificationsSettingsFragment : + Fragment(), + NotificationSheetDialog.OnDialogueDismissListener { private lateinit var mDeckListAdapter: NotificationPreferenceAdapter private lateinit var mRecyclerView: RecyclerView @@ -77,8 +80,11 @@ class NotificationsSettingsFragment : Fragment() { return view } + @Suppress("UNCHECKED_CAST") private val mOnTimeClickListener = View.OnClickListener { - TODO("Open Time picker bottom sheet.") + val deckData = it.tag as Triple + val notificationSheetDialog = NotificationSheetDialog(deckData.first, deckData.second, deckData.third, this) + notificationSheetDialog.show(parentFragmentManager, "ModalSheet") } private val mDeckExpanderClickListener = View.OnClickListener { view -> @@ -149,4 +155,8 @@ class NotificationsSettingsFragment : Fragment() { result: List>? ) = context.onDecksLoaded(result) } + + override fun onDialogueDismiss(position: Int) { + mDeckListAdapter.notifyItemChanged(position) + } }