Skip to content

Commit

Permalink
ensure that the fragment is still attached before performing operatio…
Browse files Browse the repository at this point in the history
…ns that require context
  • Loading branch information
Okuro3499 committed Jul 9, 2024
1 parent d37137a commit 355933e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (!isAdded) return
searchTags = ArrayList()
config = Utilities.getCloudConfig().showClose(R.color.black_overlay)
tvAddToLib = view.findViewById(R.id.tv_add)
Expand Down Expand Up @@ -179,6 +180,7 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem
}

private fun createAlertDialog(): AlertDialog {
if (!isAdded) return AlertDialog.Builder(requireContext()).create()
val builder = AlertDialog.Builder(requireContext(), 5)
var msg = getString(R.string.success_you_have_added_these_resources_to_your_mylibrary)
if ((selectedItems?.size ?: 0) <= 5) {
Expand Down Expand Up @@ -291,7 +293,6 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem
return b
}


override fun getSelectedFilter(): Map<String, Set<String>> {
val b: MutableMap<String, Set<String>> = HashMap()
b["languages"] = languages
Expand Down Expand Up @@ -348,7 +349,6 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem
}
}


private fun additionalSetup() {
val bottomSheet = requireView().findViewById<View>(R.id.card_filter)
requireView().findViewById<View>(R.id.filter).setOnClickListener {
Expand Down

0 comments on commit 355933e

Please sign in to comment.