mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Move story post display logic into a single fragment.
This commit is contained in:
@@ -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) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user