diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/fantalk/ui/CreatorChannelFanTalkMorePopup.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/fantalk/ui/CreatorChannelFanTalkMorePopup.kt new file mode 100644 index 00000000..8d3068f2 --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/fantalk/ui/CreatorChannelFanTalkMorePopup.kt @@ -0,0 +1,49 @@ +package kr.co.vividnext.sodalive.v2.creator.channel.fantalk.ui + +import android.graphics.Color +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.PopupWindow +import androidx.core.graphics.drawable.toDrawable +import androidx.core.view.isVisible +import kr.co.vividnext.sodalive.databinding.ViewCreatorChannelFantalkMorePopupBinding + +class CreatorChannelFanTalkMorePopup( + private val anchor: View, + private val fanTalkId: Long, + private val showEdit: Boolean, + private val showDelete: Boolean, + private val onDeleteClick: (Long) -> Unit +) { + + private val binding = ViewCreatorChannelFantalkMorePopupBinding.inflate(LayoutInflater.from(anchor.context)) + private val popupWindow: PopupWindow = PopupWindow(anchor.context).apply { + contentView = binding.root + width = ViewGroup.LayoutParams.WRAP_CONTENT + height = ViewGroup.LayoutParams.WRAP_CONTENT + isOutsideTouchable = true + isFocusable = true + setBackgroundDrawable(Color.TRANSPARENT.toDrawable()) + } + + init { + binding.tvCreatorChannelFantalkMoreEdit.isVisible = showEdit + binding.tvCreatorChannelFantalkMoreDelete.isVisible = showDelete + binding.tvCreatorChannelFantalkMoreEdit.setOnClickListener { + dismiss() + } + binding.tvCreatorChannelFantalkMoreDelete.setOnClickListener { + dismiss() + onDeleteClick(fanTalkId) + } + } + + fun show() { + popupWindow.showAsDropDown(anchor) + } + + fun dismiss() { + popupWindow.dismiss() + } +} diff --git a/app/src/main/res/layout/view_creator_channel_fantalk_more_popup.xml b/app/src/main/res/layout/view_creator_channel_fantalk_more_popup.xml new file mode 100644 index 00000000..d36e8920 --- /dev/null +++ b/app/src/main/res/layout/view_creator_channel_fantalk_more_popup.xml @@ -0,0 +1,31 @@ + + + + + + +