Move story post display logic into a single fragment.

This commit is contained in:
Alex Hart
2022-10-12 10:02:27 -03:00
committed by GitHub
parent 96d60e11b0
commit e1c6dfb73b
18 changed files with 488 additions and 312 deletions

View File

@@ -10,8 +10,6 @@ import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import org.thoughtcrime.securesms.stories.viewer.text.StoryTextPostPreviewFragment
import org.thoughtcrime.securesms.util.fragments.requireListener
/**
* Helper functions to display custom views in AlertDialogs anchored to the top of the specified view.
@@ -40,7 +38,8 @@ object FragmentDialogs {
anchorView: View,
contentView: View,
windowDim: Float = -1f,
onShow: (DialogInterface, View) -> Unit = { _, _ -> }
onShow: (DialogInterface, View) -> Unit = { _, _ -> },
onDismiss: (DialogInterface) -> Unit = { }
): DialogInterface {
val alertDialog = AlertDialog.Builder(requireContext())
.setView(contentView)
@@ -59,9 +58,7 @@ object FragmentDialogs {
}
alertDialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
alertDialog.setOnDismissListener {
requireListener<StoryTextPostPreviewFragment.Callback>().setIsDisplayingLinkPreviewTooltip(false)
}
alertDialog.setOnDismissListener(onDismiss)
alertDialog.setOnShowListener { onShow(alertDialog, contentView) }