feat: 内容卡片新增提示弹窗—客户端 https://jira.shanqu.cc/browse/GHZS-4956
This commit is contained in:
@ -285,95 +285,114 @@ class GameDetailFragment : BaseLazyFragment(), IScrollable {
|
||||
linkType = contentCardEntity.type ?: "",
|
||||
linkId = contentCardEntity.id
|
||||
)
|
||||
val path = "游戏详情->内容卡片"
|
||||
when (contentCardEntity.type) {
|
||||
"func_server" -> {
|
||||
if (contentCardEntity.server != null) {
|
||||
requireContext().startActivity(
|
||||
ServersCalendarActivity.getIntent(
|
||||
requireContext(),
|
||||
mViewModel.game!!, contentCardEntity.server!!,
|
||||
mNewGameDetailEntity?.me
|
||||
)
|
||||
|
||||
val dialog = contentCardEntity.dialog
|
||||
if (dialog != null) {// 展示内容卡片提示弹窗
|
||||
DialogHelper.showDialog(
|
||||
context = requireContext(),
|
||||
title = dialog.title ?: "",
|
||||
content = dialog.body ?: "",
|
||||
confirmText = requireContext().getString(R.string.confirm),
|
||||
cancelText = requireContext().getString(R.string.cancel),
|
||||
confirmClickCallback = {
|
||||
jumpToContentCardLink(contentCardEntity)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
jumpToContentCardLink(contentCardEntity)
|
||||
}
|
||||
}
|
||||
|
||||
private fun jumpToContentCardLink(contentCardEntity: ContentCardEntity) {
|
||||
val path = "游戏详情->内容卡片"
|
||||
when (contentCardEntity.type) {
|
||||
"func_server" -> {
|
||||
if (contentCardEntity.server != null) {
|
||||
requireContext().startActivity(
|
||||
ServersCalendarActivity.getIntent(
|
||||
requireContext(),
|
||||
mViewModel.game!!, contentCardEntity.server!!,
|
||||
mNewGameDetailEntity?.me
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"func_libao" -> {
|
||||
mBodyBinding.gamedetailVp.currentItem = 0
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
|
||||
val fragment = mFragmentsList[0]
|
||||
if (fragment is DescFragment && fragment.isAdded) {
|
||||
fragment.scrollToLibao()
|
||||
}
|
||||
"func_libao" -> {
|
||||
mBodyBinding.gamedetailVp.currentItem = 0
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
|
||||
val fragment = mFragmentsList[0]
|
||||
if (fragment is DescFragment && fragment.isAdded) {
|
||||
fragment.scrollToLibao()
|
||||
}
|
||||
}
|
||||
|
||||
"func_related_version" -> {
|
||||
mBodyBinding.gamedetailVp.currentItem = 0
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
|
||||
val fragment = mFragmentsList[0]
|
||||
if (fragment is DescFragment && fragment.isAdded) {
|
||||
fragment.scrollToRelatedVersion()
|
||||
}
|
||||
"func_related_version" -> {
|
||||
mBodyBinding.gamedetailVp.currentItem = 0
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
|
||||
val fragment = mFragmentsList[0]
|
||||
if (fragment is DescFragment && fragment.isAdded) {
|
||||
fragment.scrollToRelatedVersion()
|
||||
}
|
||||
}
|
||||
|
||||
"func_zone" -> {
|
||||
val gameDetailEntity = mViewModel.gameDetailLiveData.value?.data
|
||||
if (contentCardEntity.zoneTab && gameDetailEntity?.zone != null && gameDetailEntity.zone!!.style == "link") {
|
||||
requireContext().startActivity(
|
||||
WebActivity.getIntent(
|
||||
requireContext(),
|
||||
gameDetailEntity.zone!!.link,
|
||||
true
|
||||
)
|
||||
"func_zone" -> {
|
||||
val gameDetailEntity = mViewModel.gameDetailLiveData.value?.data
|
||||
if (contentCardEntity.zoneTab && gameDetailEntity?.zone != null && gameDetailEntity.zone!!.style == "link") {
|
||||
requireContext().startActivity(
|
||||
WebActivity.getIntent(
|
||||
requireContext(),
|
||||
gameDetailEntity.zone!!.link,
|
||||
true
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"func_bbs" -> {
|
||||
val funcBbs = contentCardEntity.funcBbs
|
||||
funcBbs?.let {
|
||||
DirectUtils.directForumDetail(requireContext(), it.link, path)
|
||||
}
|
||||
"func_bbs" -> {
|
||||
val funcBbs = contentCardEntity.funcBbs
|
||||
funcBbs?.let {
|
||||
DirectUtils.directForumDetail(requireContext(), it.link, path)
|
||||
}
|
||||
}
|
||||
|
||||
"func_tool_kit" -> {
|
||||
if (contentCardEntity.toolkit.isNotEmpty()) {
|
||||
contentCardEntity.toolkit.safelyGetInRelease(0)?.let {
|
||||
val url = it.url
|
||||
if (url != null && url.contains(Config.URL_ARTICLE)) {
|
||||
val newsId = url.substring(url.lastIndexOf("/") + 1, url.length - 5) // 5: ".html"
|
||||
val intent = NewsDetailActivity.getIntentById(requireContext(), newsId, path)
|
||||
requireContext().startActivity(intent)
|
||||
} else {
|
||||
requireContext().startActivity(
|
||||
WebActivity.getWebByCollectionTools(
|
||||
requireContext(),
|
||||
it,
|
||||
false
|
||||
)
|
||||
"func_tool_kit" -> {
|
||||
if (contentCardEntity.toolkit.isNotEmpty()) {
|
||||
contentCardEntity.toolkit.safelyGetInRelease(0)?.let {
|
||||
val url = it.url
|
||||
if (url != null && url.contains(Config.URL_ARTICLE)) {
|
||||
val newsId = url.substring(url.lastIndexOf("/") + 1, url.length - 5) // 5: ".html"
|
||||
val intent = NewsDetailActivity.getIntentById(requireContext(), newsId, path)
|
||||
requireContext().startActivity(intent)
|
||||
} else {
|
||||
requireContext().startActivity(
|
||||
WebActivity.getWebByCollectionTools(
|
||||
requireContext(),
|
||||
it,
|
||||
false
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> DirectUtils.directToLinkPage(
|
||||
requireContext(),
|
||||
contentCardEntity.toLinkEntity(),
|
||||
mEntrance,
|
||||
path,
|
||||
ExposureEvent.createEvent(
|
||||
null,
|
||||
listOf(
|
||||
ExposureSource("游戏详情", mGameEntity?.id ?: ""),
|
||||
ExposureSource("内容卡片", contentCardEntity.id)
|
||||
)
|
||||
),
|
||||
"游戏详情页-内容卡片"
|
||||
)
|
||||
}
|
||||
|
||||
else -> DirectUtils.directToLinkPage(
|
||||
requireContext(),
|
||||
contentCardEntity.toLinkEntity(),
|
||||
mEntrance,
|
||||
path,
|
||||
ExposureEvent.createEvent(
|
||||
null,
|
||||
listOf(
|
||||
ExposureSource("游戏详情", mGameEntity?.id ?: ""),
|
||||
ExposureSource("内容卡片", contentCardEntity.id)
|
||||
)
|
||||
),
|
||||
"游戏详情页-内容卡片"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = 0
|
||||
override fun getInflatedLayout(): View {
|
||||
|
||||
@ -15,6 +15,7 @@ import com.gh.common.util.CheckLoginUtils
|
||||
import com.gh.gamecenter.feature.utils.ConcernUtils
|
||||
import com.gh.common.util.LibaoUtils
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.livedata.NonStickyMutableLiveData
|
||||
import com.gh.gamecenter.common.mvvm.Resource
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
@ -30,10 +31,7 @@ import com.gh.gamecenter.feature.entity.LibaoStatusEntity
|
||||
import com.gh.gamecenter.feature.entity.SimpleGame
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.gamecenter.feature.utils.ContentBlockedHelper
|
||||
import com.gh.gamecenter.gamedetail.entity.BigEvent
|
||||
import com.gh.gamecenter.gamedetail.entity.CustomColumn
|
||||
import com.gh.gamecenter.gamedetail.entity.DetailEntity
|
||||
import com.gh.gamecenter.gamedetail.entity.NewGameDetailEntity
|
||||
import com.gh.gamecenter.gamedetail.entity.*
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
@ -54,8 +54,18 @@ class ContentCardEntity(
|
||||
var relatedVersion: Boolean = false,
|
||||
var toolkit: ArrayList<ToolBoxEntity> = ArrayList(),
|
||||
@SerializedName("func_bbs")
|
||||
val funcBbs: LinkEntity? = null
|
||||
val funcBbs: LinkEntity? = null,
|
||||
val dialog: Dialog? = null
|
||||
) {
|
||||
|
||||
@Keep
|
||||
class Dialog(
|
||||
@SerializedName("_id")
|
||||
val id: String? = "",
|
||||
val title: String? = "",
|
||||
val body: String? = ""
|
||||
)
|
||||
|
||||
fun toLinkEntity(): LinkEntity {
|
||||
return LinkEntity(
|
||||
name = name,
|
||||
|
||||
Reference in New Issue
Block a user