Skip to content

Commit

Permalink
Integrated NotificationSheetDialog.kt with NotificationsSettingsFragm…
Browse files Browse the repository at this point in the history
…ent.
  • Loading branch information
prateek-singh-3212 committed Oct 20, 2022
1 parent a9b3f3e commit 5db556d
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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<DeckId, String, Int>
val notificationSheetDialog = NotificationSheetDialog(deckData.first, deckData.second, deckData.third, this)
notificationSheetDialog.show(parentFragmentManager, "ModalSheet")
}

private val mDeckExpanderClickListener = View.OnClickListener { view ->
Expand Down Expand Up @@ -149,4 +155,8 @@ class NotificationsSettingsFragment : Fragment() {
result: List<TreeNode<T>>?
) = context.onDecksLoaded(result)
}

override fun onDialogueDismiss(position: Int) {
mDeckListAdapter.notifyItemChanged(position)
}
}

0 comments on commit 5db556d

Please sign in to comment.