For #25505: Clear the stored result in case there is no listener with the same key set.

This is the case when the sharing happens outside the tabs tray.
pull/543/head
mcarare 2 years ago committed by mergify[bot]
parent e01647a7e8
commit 48cb5ec268

@ -10,6 +10,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.appcompat.app.AppCompatDialogFragment import androidx.appcompat.app.AppCompatDialogFragment
import androidx.fragment.app.clearFragmentResult
import androidx.fragment.app.setFragmentResult import androidx.fragment.app.setFragmentResult
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory
@ -128,6 +129,8 @@ class ShareFragment : AppCompatDialogFragment() {
override fun onDestroy() { override fun onDestroy() {
setFragmentResult(RESULT_KEY, Bundle()) setFragmentResult(RESULT_KEY, Bundle())
// Clear the stored result in case there is no listener with the same key set.
clearFragmentResult(RESULT_KEY)
super.onDestroy() super.onDestroy()
} }

Loading…
Cancel
Save