Compare commits
7 Commits
feat/insta
...
fix/GHZSCY
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d6917d7af | |||
| e56f7a0d32 | |||
| 8f18bcc71c | |||
| 556615f57f | |||
| c5ed1fefae | |||
| 2c71803fd7 | |||
| f613bbd60c |
@ -3,14 +3,9 @@ package com.gh.vspace.installexternalgames
|
||||
import android.Manifest
|
||||
import android.app.Dialog
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.provider.Settings
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.gh.common.util.DialogUtils
|
||||
@ -42,9 +37,6 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
||||
|
||||
private var uninstallDisposable: Disposable? = null
|
||||
|
||||
|
||||
private var shouldScan = false
|
||||
|
||||
override fun getLayoutId() = 0
|
||||
|
||||
override fun getInflatedLayout() =
|
||||
@ -82,24 +74,7 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
if (!Environment.isExternalStorageManager()) {
|
||||
shouldScan = true
|
||||
AlertDialog.Builder(requireContext()).setMessage("请在设置页面允许光环助手")
|
||||
.setNegativeButton("去") { dialog, which ->
|
||||
val intent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(intent)
|
||||
}.show()
|
||||
} else {
|
||||
mViewModel.scanPaths()
|
||||
}
|
||||
} else {
|
||||
requestStoragePermission()
|
||||
}
|
||||
|
||||
|
||||
requestStoragePermission()
|
||||
}
|
||||
|
||||
private fun requestStoragePermission() {
|
||||
@ -121,12 +96,6 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
if (shouldScan) {
|
||||
mViewModel.scanPaths()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
dialog = DialogUtils.showWaitDialog(requireContext(), "")
|
||||
@ -183,7 +152,7 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
||||
}, true)
|
||||
|
||||
VHelper.newCwValidateVspaceBeforeAction(
|
||||
requireContext(), null,
|
||||
requireContext(),null,
|
||||
) {
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
@ -55,8 +55,6 @@ public class DetailDownloadUtils {
|
||||
}
|
||||
|
||||
viewHolder.setSpeedViewsVisible(false);
|
||||
// 默认为显示状态
|
||||
viewHolder.getDownloadPb().setVisibility(View.VISIBLE);
|
||||
|
||||
// 根据预置的配置更新 ViewHolder 的状态 (譬如青少年模式、下载内容为空等)
|
||||
if (updateViewHolderWithPredefinedConfig(viewHolder, gameEntity)) {
|
||||
|
||||
@ -2,9 +2,10 @@ package com.gh.common.util
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.DialogHelper
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.common.utils.replaceLineBreakWithBr
|
||||
import com.gh.gamecenter.common.utils.toResString
|
||||
import com.gh.gamecenter.core.utils.EmptyCallback
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
@ -31,7 +32,7 @@ object DownloadDialogHelper {
|
||||
DialogHelper.showDialogWithHtmlContent(
|
||||
context,
|
||||
dialog.title,
|
||||
dialog.content.replaceLineBreakWithBr(),
|
||||
dialog.content,
|
||||
"继续下载",
|
||||
"取消",
|
||||
confirmClickCallback = {
|
||||
@ -58,8 +59,7 @@ object DownloadDialogHelper {
|
||||
gameName = gameEntity.name ?: "",
|
||||
gameType = gameEntity.categoryChinese
|
||||
)
|
||||
},
|
||||
extraConfig = DialogHelper.Config(centerTitle = true)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
callback.onCallback()
|
||||
|
||||
@ -217,7 +217,7 @@ class DetailViewHolder(
|
||||
}
|
||||
|
||||
private fun restoreDialogFragment() {
|
||||
val gamePermissionDialogFragment = (context.getActivity() as? AppCompatActivity)?.supportFragmentManager?.findFragmentByTag(
|
||||
val gamePermissionDialogFragment = (context as AppCompatActivity).supportFragmentManager.findFragmentByTag(
|
||||
GamePermissionDialogFragment::class.java.name
|
||||
) as DialogFragment?
|
||||
gamePermissionDialogFragment?.dismissAllowingStateLoss()
|
||||
@ -233,6 +233,7 @@ class DetailViewHolder(
|
||||
getDownloadBtnText(context, gameEntity, false, true, PluginLocation.only_game)
|
||||
when {
|
||||
localText.contains(com.gh.gamecenter.feature.R.string.update.toResString()) -> { // 本地游戏需要更新
|
||||
localDownloadButton?.goneIf(true)
|
||||
localDownloadContainer?.goneIf(true)
|
||||
downloadPb.goneIf(true)
|
||||
overlayTv?.goneIf(true)
|
||||
@ -249,6 +250,7 @@ class DetailViewHolder(
|
||||
|
||||
localText.contains(com.gh.gamecenter.feature.R.string.launch.toResString()) && downloadText == "更新" -> { // 畅玩游戏需要更新:显示 加速/更新
|
||||
localDownloadContainer?.goneIf(true)
|
||||
localDownloadButton?.goneIf(true)
|
||||
downloadPb.goneIf(true)
|
||||
overlayTv?.goneIf(true)
|
||||
|
||||
@ -261,6 +263,7 @@ class DetailViewHolder(
|
||||
}
|
||||
|
||||
localText.contains(com.gh.gamecenter.feature.R.string.launch.toResString()) -> { // 本地游戏为启动状态:显示 加速/畅玩
|
||||
localDownloadButton?.goneIf(true)
|
||||
localDownloadContainer?.goneIf(true)
|
||||
downloadPb.goneIf(true)
|
||||
overlayTv?.goneIf(true)
|
||||
@ -285,20 +288,20 @@ class DetailViewHolder(
|
||||
val downloadText = getDownloadBtnText(context, gameEntity, false, false, PluginLocation.only_game)
|
||||
when {
|
||||
downloadText.contains(com.gh.gamecenter.feature.R.string.launch.toResString()) -> {
|
||||
localDownloadButton?.goneIf(true)
|
||||
localDownloadContainer?.goneIf(true)
|
||||
downloadPb.goneIf(true)
|
||||
true
|
||||
}
|
||||
|
||||
downloadText.contains(R.string.update.toResString()) -> true
|
||||
|
||||
downloadText == com.gh.gamecenter.feature.R.string.launch.toResString() -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
it.checkIfShowSpeedUi(showSpeedUi, showDualDownloadButton)
|
||||
it.checkIfShowSpeedUi(showSpeedUi)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ import com.gh.gamecenter.gamedetail.detail.viewholder.GameDetailContentRecommend
|
||||
import com.gh.gamecenter.gamedetail.entity.*
|
||||
import com.gh.gamecenter.livedata.Event
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.login.user.UserRepository
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.vspace.VHelper
|
||||
@ -104,7 +105,7 @@ class GameDetailViewModel(
|
||||
private var relatedGameList = arrayListOf<GameEntity>()
|
||||
|
||||
// 内容卡片相关
|
||||
private var contentCardList: List<ContentCardEntity>? = null
|
||||
private var contentCardList: List<ContentCardEntity>?= null
|
||||
private val contentCardSp by lazy {
|
||||
HaloApp.getInstance().getSharedPreferences(SP_CONTENT_CARD, Context.MODE_PRIVATE)
|
||||
}
|
||||
@ -133,9 +134,9 @@ class GameDetailViewModel(
|
||||
private var isGameUpdatable = false
|
||||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
|
||||
private var userRelatedInfoReceivedCallback: (() -> Unit)? = null
|
||||
|
||||
|
||||
init {
|
||||
loadData()
|
||||
}
|
||||
@ -1116,14 +1117,6 @@ class GameDetailViewModel(
|
||||
compositeDisposable.clear()
|
||||
}
|
||||
|
||||
fun markContentCardRedDot(contentCardEntity: ContentCardEntity) {
|
||||
SPUtils.setString(contentCardSp, RED_DOT_PREFIX + (gameId ?: "") + contentCardEntity.link.type, contentCardEntity.redDot.toString())
|
||||
}
|
||||
|
||||
fun shouldShowContentCardRedDot(contentCardEntity: ContentCardEntity): Boolean {
|
||||
return SPUtils.getString(contentCardSp, RED_DOT_PREFIX + (gameId ?: "") + contentCardEntity.link.type) != contentCardEntity.redDot.toString()
|
||||
}
|
||||
|
||||
class Factory(
|
||||
private val application: Application,
|
||||
private val gameId: String?,
|
||||
@ -1140,7 +1133,6 @@ class GameDetailViewModel(
|
||||
companion object {
|
||||
const val SP_CONTENT_CARD = "content_card"
|
||||
const val TAG = "GameDetailViewModel"
|
||||
const val RED_DOT_PREFIX = "red_dot_"
|
||||
|
||||
//[已领取/已淘号/再领/再淘]的礼包置底显示
|
||||
fun sortLibaoList(libaoList: ArrayList<LibaoEntity>?) {
|
||||
|
||||
@ -635,7 +635,7 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
DialogHelper.showDialogWithHtmlContent(
|
||||
requireContext(),
|
||||
dialog.title,
|
||||
dialog.content.replaceLineBreakWithBr(),
|
||||
dialog.content,
|
||||
dialog.confirmButton.text.toString(),
|
||||
dialog.closeButtonText,
|
||||
{
|
||||
@ -669,8 +669,7 @@ class GameDetailWrapperFragment : BaseLazyFragment(), IScrollable {
|
||||
"game_type", gameEntity?.categoryChinese ?: "",
|
||||
"button_name", "关闭弹窗"
|
||||
)
|
||||
},
|
||||
extraConfig = DialogHelper.Config(centerTitle = true)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -55,8 +55,6 @@ class GameDetailAcceleratorUiHelper(private val binding: DetailDownloadItemBindi
|
||||
|
||||
private var hasAnyAcctRecord = false
|
||||
|
||||
private var showDualDownloadButton: Boolean = false
|
||||
|
||||
private val accelerationListener = object : OnAccelerateListener {
|
||||
override fun onStateChanged(state: AccelerateState) {
|
||||
when (state) {
|
||||
@ -133,17 +131,13 @@ class GameDetailAcceleratorUiHelper(private val binding: DetailDownloadItemBindi
|
||||
|
||||
val isCurrentGameAccelerating = AcceleratorDataHolder.instance.isCurrentGameAccelerating(game.id)
|
||||
|
||||
if (!showDualDownloadButton) {
|
||||
when {
|
||||
isCurrentGameAccelerating -> {// 如果当前游戏正处于加速状态,则需要隐藏当前下载按钮
|
||||
binding.detailProgressbar.goneIf(true)
|
||||
}
|
||||
when {
|
||||
isCurrentGameAccelerating -> {// 如果当前游戏正处于加速状态,则需要隐藏当前下载按钮
|
||||
binding.detailProgressbar.goneIf(true)
|
||||
}
|
||||
|
||||
binding.detailProgressbar.text == "更新" -> { // 游戏没有处于加速状态,如果 下载按钮为 “更新” 状态,则需要显示出来
|
||||
binding.detailProgressbar.setBackgroundResource(com.gh.gamecenter.common.R.drawable.bg_common_button_light_fill_blue)
|
||||
binding.detailProgressbar.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
|
||||
binding.detailProgressbar.goneIf(false)
|
||||
}
|
||||
binding.detailProgressbar.text == "更新" -> { // 游戏没有处于加速状态,如果 下载按钮为 “更新” 状态,则需要显示出来
|
||||
binding.detailProgressbar.goneIf(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,8 +152,7 @@ class GameDetailAcceleratorUiHelper(private val binding: DetailDownloadItemBindi
|
||||
} ?: R.string.network_acceleration.toResString()
|
||||
}
|
||||
|
||||
fun checkIfShowSpeedUi(show: Boolean, showDualDownloadButton: Boolean) {
|
||||
this.showDualDownloadButton = showDualDownloadButton
|
||||
fun checkIfShowSpeedUi(show: Boolean) {
|
||||
if (!isInit) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -684,7 +684,7 @@ class GameDetailFragment : LazyFragment(), IScrollable {
|
||||
null,
|
||||
gameStatus = gameStatus
|
||||
)
|
||||
GameFunctionDialogFragment.show(requireContext(), gameEntity, gameDetailInfoTag.infoTags, gameDetailInfoTag.link)
|
||||
GameFunctionDialogFragment.show(requireContext(), gameDetailInfoTag.infoTags)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,6 @@ class GameDetailCoverAdapter(
|
||||
|
||||
holder.binding.player.viewModel = viewModel
|
||||
holder.binding.player.showOrHideCoverFilter = showOrHideCoverFilter
|
||||
holder.binding.player.scrollCalculatorHelper = scrollCalculatorHelper
|
||||
holder.binding.player.video = topVideo
|
||||
holder.binding.player.updateThumb(topVideo.poster)
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.gh.gamecenter.gamedetail.detail.viewholder
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.gh.common.constant.Config
|
||||
@ -132,9 +131,11 @@ class GameDetailContentCardSingleItemViewHolder(
|
||||
contentBannerView.startBannerLoop()
|
||||
}
|
||||
|
||||
val showRedDot = contentCardEntity.redDot != 0 && viewModel.shouldShowContentCardRedDot(contentCardEntity)
|
||||
redDotTv.goneIf(!showRedDot) {
|
||||
redDotTv.text = contentCardEntity.redDot.toString()
|
||||
redDotTv.goneIf(!((contentCardEntity.link.type == TYPE_SERVER && contentCardEntity.server?.total != 0) || contentCardEntity.link.type == TYPE_GIFT)) {
|
||||
if ((contentCardEntity.link.type == TYPE_SERVER) && (contentCardEntity.server?.calendar?.isNotEmpty() == true))
|
||||
redDotTv.text = contentCardEntity.server?.total.toString()
|
||||
if ((contentCardEntity.link.type == TYPE_GIFT) && (contentCardEntity.libao != null))
|
||||
redDotTv.text = contentCardEntity.libao?.total.toString()
|
||||
}
|
||||
|
||||
val showNewTag = contentCardEntity.link.type == TYPE_ARCHIVE && contentCardEntity.archive != null && contentCardEntity.showNewTag
|
||||
@ -172,11 +173,11 @@ class GameDetailContentCardSingleItemViewHolder(
|
||||
confirmText = context.getString(com.gh.gamecenter.common.R.string.confirm),
|
||||
cancelText = context.getString(com.gh.gamecenter.common.R.string.cancel),
|
||||
confirmClickCallback = {
|
||||
jumpToContentCardLink(context, contentCardEntity, viewModel, redDotTv)
|
||||
jumpToContentCardLink(context, contentCardEntity, viewModel)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
jumpToContentCardLink(context, contentCardEntity, viewModel, redDotTv)
|
||||
jumpToContentCardLink(context, contentCardEntity, viewModel)
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,16 +189,11 @@ class GameDetailContentCardSingleItemViewHolder(
|
||||
}
|
||||
}
|
||||
|
||||
fun jumpToContentCardLink(context: Context, contentCardEntity: ContentCardEntity, viewModel: GameDetailViewModel, redDotTv: TextView) {
|
||||
fun jumpToContentCardLink(context: Context, contentCardEntity: ContentCardEntity, viewModel: GameDetailViewModel) {
|
||||
val path = "游戏详情->内容卡片"
|
||||
when (contentCardEntity.link.type) {
|
||||
TYPE_GIFT,
|
||||
TYPE_ARCHIVE -> {
|
||||
if (contentCardEntity.link.type == TYPE_GIFT) {
|
||||
viewModel.markContentCardRedDot(contentCardEntity)
|
||||
redDotTv.isVisible = false
|
||||
}
|
||||
|
||||
val type = if (contentCardEntity.link.type == TYPE_GIFT) GameDetailTabEntity.TYPE_GIFT else GameDetailTabEntity.TYPE_ARCHIVE
|
||||
val tabList = viewModel.gameDetailTabListLiveData.value?.data
|
||||
if (tabList?.find { it.type == type } != null) {
|
||||
@ -212,8 +208,6 @@ class GameDetailContentCardSingleItemViewHolder(
|
||||
|
||||
TYPE_SERVER -> {
|
||||
if (viewModel.game != null && contentCardEntity.server != null) {
|
||||
viewModel.markContentCardRedDot(contentCardEntity)
|
||||
redDotTv.isVisible = false
|
||||
context.startActivity(
|
||||
ServersCalendarActivity.getIntent(
|
||||
context,
|
||||
|
||||
@ -10,6 +10,8 @@ import com.gh.gamecenter.gamedetail.GameDetailViewModel
|
||||
import com.gh.gamecenter.gamedetail.detail.viewholder.GameDetailContentCardSingleItemViewHolder.Companion.jumpToContentCardLink
|
||||
import com.gh.gamecenter.gamedetail.entity.ContentCardEntity
|
||||
import com.gh.gamecenter.gamedetail.entity.ContentCardEntity.Companion.TYPE_ARCHIVE
|
||||
import com.gh.gamecenter.gamedetail.entity.ContentCardEntity.Companion.TYPE_GIFT
|
||||
import com.gh.gamecenter.gamedetail.entity.ContentCardEntity.Companion.TYPE_SERVER
|
||||
import com.gh.gamecenter.gamedetail.entity.GameDetailData
|
||||
|
||||
class GameDetailContentCardTripleItemViewHolder(
|
||||
@ -72,9 +74,11 @@ class GameDetailContentCardTripleItemViewHolder(
|
||||
titleTv.text = contentCardEntity.title
|
||||
ImageUtils.display(iconIv, contentCardEntity.icon)
|
||||
|
||||
val showRedDot = contentCardEntity.redDot != 0 && viewModel.shouldShowContentCardRedDot(contentCardEntity)
|
||||
redDotTv.goneIf(!showRedDot) {
|
||||
redDotTv.text = contentCardEntity.redDot.toString()
|
||||
redDotTv.goneIf(!((contentCardEntity.link.type == TYPE_SERVER && contentCardEntity.server?.total != 0) || contentCardEntity.link.type == TYPE_GIFT)) {
|
||||
if ((contentCardEntity.link.type == TYPE_SERVER) && (contentCardEntity.server?.calendar?.isNotEmpty() == true))
|
||||
redDotTv.text = contentCardEntity.server?.total.toString()
|
||||
if ((contentCardEntity.link.type == TYPE_GIFT) && (contentCardEntity.libao != null))
|
||||
redDotTv.text = contentCardEntity.libao?.total.toString()
|
||||
}
|
||||
|
||||
val showNewTag = contentCardEntity.link.type == TYPE_ARCHIVE && contentCardEntity.archive != null && contentCardEntity.showNewTag
|
||||
@ -112,11 +116,11 @@ class GameDetailContentCardTripleItemViewHolder(
|
||||
confirmText = context.getString(com.gh.gamecenter.common.R.string.confirm),
|
||||
cancelText = context.getString(com.gh.gamecenter.common.R.string.cancel),
|
||||
confirmClickCallback = {
|
||||
jumpToContentCardLink(context, contentCardEntity, viewModel, redDotTv)
|
||||
jumpToContentCardLink(context, contentCardEntity, viewModel)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
jumpToContentCardLink(context, contentCardEntity, viewModel, redDotTv)
|
||||
jumpToContentCardLink(context, contentCardEntity, viewModel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,29 +9,19 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.base.fragment.BaseBottomDialogFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.databinding.DialogGameDetailRecyclerViewBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.gamedetail.entity.GameDetailInfoTag
|
||||
import com.lightgame.utils.AppManager
|
||||
|
||||
class GameFunctionDialogFragment: BaseBottomDialogFragment<DialogGameDetailRecyclerViewBinding>() {
|
||||
private var infoTags: List<GameDetailInfoTag.InfoTag> = arrayListOf()
|
||||
private var linkEntity: LinkEntity? = null
|
||||
private var gameEntity: GameEntity? = null
|
||||
private val adapter by lazy { GameFunctionAdapter(requireContext(), infoTags) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
gameEntity = arguments?.getParcelable(EntranceConsts.KEY_GAME_ENTITY)
|
||||
infoTags = arguments?.getParcelableArrayList(KEY_INFO_TAG) ?: arrayListOf()
|
||||
linkEntity = arguments?.getParcelable(EntranceConsts.KEY_LINK)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@ -40,28 +30,6 @@ class GameFunctionDialogFragment: BaseBottomDialogFragment<DialogGameDetailRecyc
|
||||
mBinding.closeIv.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
mBinding.subtitleTv.goneIf(linkEntity == null) {
|
||||
mBinding.subtitleTv.text = linkEntity?.text
|
||||
mBinding.subtitleTv.setOnClickListener { _ ->
|
||||
linkEntity?.let {
|
||||
DirectUtils.directToLinkPage(requireContext(), it, "游戏详情-功能说明", "")
|
||||
SensorsBridge.trackGameDetailModuleClick(
|
||||
gameEntity?.id,
|
||||
gameEntity?.name,
|
||||
gameEntity?.categoryChinese,
|
||||
"组件内容",
|
||||
"功能标签",
|
||||
"功能标签",
|
||||
null,
|
||||
subModuleName = "跳转入口",
|
||||
linkType = it.type,
|
||||
linkId = it.link,
|
||||
linkText = it.text,
|
||||
gameStatus = null
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
mBinding.recyclerView.run {
|
||||
layoutManager = LinearLayoutManager(requireContext())
|
||||
adapter = this@GameFunctionDialogFragment.adapter
|
||||
@ -78,7 +46,7 @@ class GameFunctionDialogFragment: BaseBottomDialogFragment<DialogGameDetailRecyc
|
||||
const val KEY_INFO_TAG = "info_tag"
|
||||
|
||||
@JvmStatic
|
||||
fun show(context: Context?, gameEntity: GameEntity?, infoTags: List<GameDetailInfoTag.InfoTag>, linkEntity: LinkEntity?) {
|
||||
fun show(context: Context?, infoTags: List<GameDetailInfoTag.InfoTag>) {
|
||||
val fragmentActivity: FragmentActivity = if (context is FragmentActivity) {
|
||||
context
|
||||
} else if (BuildConfig.DEBUG) {
|
||||
@ -97,9 +65,7 @@ class GameFunctionDialogFragment: BaseBottomDialogFragment<DialogGameDetailRecyc
|
||||
|
||||
val dialogFragment = GameFunctionDialogFragment()
|
||||
dialogFragment.arguments = bundleOf(
|
||||
EntranceConsts.KEY_GAME_ENTITY to gameEntity,
|
||||
KEY_INFO_TAG to infoTags,
|
||||
EntranceConsts.KEY_LINK to linkEntity
|
||||
KEY_INFO_TAG to infoTags
|
||||
)
|
||||
dialogFragment.show(fragmentActivity.supportFragmentManager, GameFunctionDialogFragment::class.java.name)
|
||||
}
|
||||
|
||||
@ -31,13 +31,6 @@ class ContentCardEntity(
|
||||
var showNewTag: Boolean = false,
|
||||
) {
|
||||
|
||||
val redDot
|
||||
get() = when (link.type) {
|
||||
TYPE_SERVER -> server?.total ?: 0
|
||||
TYPE_GIFT -> libao?.total ?: 0
|
||||
else -> 0
|
||||
}
|
||||
|
||||
@Keep
|
||||
class Dialog(
|
||||
@SerializedName("_id")
|
||||
|
||||
@ -219,9 +219,7 @@ data class GameDetailInfoTag(
|
||||
@SerializedName("info_tags")
|
||||
val infoTags: List<InfoTag> = listOf(), // 功能标签
|
||||
@SerializedName("request_speed_status")
|
||||
val requestSpeedStatus: String = "", // 求加速状态, on/off
|
||||
@SerializedName("plugin_tutorial_link")
|
||||
val link: LinkEntity? = null, // 插件教程链接
|
||||
val requestSpeedStatus: String = "" // 求加速状态, on/off
|
||||
) {
|
||||
@Parcelize
|
||||
data class InfoTag(
|
||||
|
||||
@ -50,7 +50,6 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
private var mLastGetContentLengthTime = 0L
|
||||
|
||||
var showOrHideCoverFilter: ((Boolean) -> Unit)? = null
|
||||
var scrollCalculatorHelper: GameDetailScrollCalculatorHelper? = null
|
||||
|
||||
init {
|
||||
post {
|
||||
@ -257,7 +256,6 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
|
||||
|
||||
// 不需要弹弹窗,直接播放
|
||||
override fun showWifiDialog() {
|
||||
scrollCalculatorHelper?.currentPlayer = this
|
||||
startPlayLogic(false)
|
||||
//val trafficVideo = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SettingsFragment.TRAFFIC_VIDEO_SP_KEY, false)
|
||||
//if (trafficVideo) {
|
||||
|
||||
@ -91,8 +91,7 @@ class CustomGamePluginAdapter(
|
||||
binding.gameRating.textSize =
|
||||
(if (gameEntity.commentCount > 3) 12 else 10).toFloat()
|
||||
BindingAdapters.setGameName(binding.gameName, gameEntity, true)
|
||||
binding.gamePlayCount.visibility = View.GONE
|
||||
BindingAdapters.setGameTagsWithSellingPoint(binding.labelList, binding.layoutSellingPoints, gameEntity, "")
|
||||
BindingAdapters.setGameTags(binding.labelList, gameEntity, "")
|
||||
binding.gameRating.setDrawableStart(
|
||||
if (gameEntity.commentCount > 3) com.gh.gamecenter.feature.R.drawable.game_horizontal_rating.toDrawable() else null,
|
||||
null,
|
||||
|
||||
@ -133,8 +133,7 @@ class CustomGameRefreshVerticalAdapter(
|
||||
with(ui) {
|
||||
gameNameTv.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
|
||||
serverTypeTv.setTextColor(com.gh.gamecenter.common.R.color.primary_theme.toColor(context))
|
||||
downloadTv.background =
|
||||
com.gh.gamecenter.common.R.drawable.download_button_normal_style.toDrawable(context)
|
||||
downloadTv.background = com.gh.gamecenter.common.R.drawable.download_button_normal_style.toDrawable(context)
|
||||
gameDesTv.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
|
||||
|
||||
BindingAdapters.setGameName(
|
||||
@ -143,7 +142,7 @@ class CustomGameRefreshVerticalAdapter(
|
||||
false
|
||||
)
|
||||
BindingAdapters.setGame(iconIv, gameEntity)
|
||||
BindingAdapters.setGameTagsWithSellingPoint(gameTagContainer, sellingPointsBinding, gameEntity, "")
|
||||
BindingAdapters.setGameTags(gameTagContainer, gameEntity, "")
|
||||
GameItemViewHolder.initServerType(gameNameTv, serverTypeTv, gameEntity)
|
||||
gameDesTv.text = gameEntity.decoratedDes
|
||||
GameItemViewHolder.initGameSubtitleAndAdLabel(
|
||||
|
||||
@ -47,16 +47,8 @@ class WGameSubjectCPMRemoteDataSource(
|
||||
miniGameExtData = info.extData,
|
||||
miniGameRecommendId = info.recommendID,
|
||||
mTagStyle = arrayListOf(
|
||||
TagStyleEntity(
|
||||
name = info.categoryName,
|
||||
color = TAG_COLOR,
|
||||
background = TAG_BACKGROUND
|
||||
),
|
||||
TagStyleEntity(
|
||||
name = info.subcategoryName,
|
||||
color = TAG_COLOR,
|
||||
background = TAG_BACKGROUND
|
||||
)
|
||||
TagStyleEntity(name = info.categoryName),
|
||||
TagStyleEntity(name = info.subcategoryName)
|
||||
)
|
||||
)
|
||||
}.toMutableList()
|
||||
@ -109,10 +101,4 @@ class WGameSubjectCPMRemoteDataSource(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val TAG_COLOR = "999999"
|
||||
private const val TAG_BACKGROUND = "F5F5F5"
|
||||
}
|
||||
}
|
||||
@ -527,7 +527,7 @@ class SearchGameResultAdapter(
|
||||
for (key in positionAndPackageMap.keys) {
|
||||
if (key.contains(download.packageName) && key.contains(download.gameId)) {
|
||||
val position = positionAndPackageMap[key]
|
||||
if (position != null && position < itemCount && getItemViewType(position) == ItemViewType.GAME_SUBJECT) {
|
||||
if (position != null && getItemViewType(position) == ItemViewType.GAME_SUBJECT) {
|
||||
val view = _recyclerView?.layoutManager?.findViewByPosition(position)
|
||||
val adapter = view?.findViewById<RecyclerView>(R.id.subjectRv)?.adapter
|
||||
if (adapter != null && adapter is SearchSubjectAdapter) {
|
||||
|
||||
@ -97,11 +97,9 @@ class SearchGameResultViewModel(
|
||||
// 数据源来自于第三方的专题列表,包括 CPM 专题和 DSP 专题
|
||||
val thirdPartySearchSubjectList = mutableListOf<SearchSubjectEntity>()
|
||||
|
||||
// 避免重复添加同一个 location 位置的专题
|
||||
for (item in mutableList) {
|
||||
// 避免同一个位置重复的专题
|
||||
if (!mSearchSubjects.any {
|
||||
it.location == item.location && it.columnId == item.columnId
|
||||
}) {
|
||||
if (!mSearchSubjects.any { it.location == item.location }) {
|
||||
mSearchSubjects.add(item)
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="@dimen/secondary_title_text_size"
|
||||
@ -34,27 +35,6 @@
|
||||
app:layout_constraintTop_toTopOf="@+id/closeIv"
|
||||
tools:text="其他2款游戏" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitleTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:lines="1"
|
||||
android:textColor="@color/text_theme"
|
||||
android:textSize="@dimen/secondary_size"
|
||||
android:visibility="gone"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/titleTv"
|
||||
app:layout_constraintEnd_toStartOf="@+id/closeIv"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@+id/titleTv"
|
||||
app:layout_constraintTop_toTopOf="@+id/titleTv"
|
||||
tools:text="使用教程使用教程使用教程使用教程使用教程使用教程使用教程使用教程"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="0dp"
|
||||
|
||||
@ -8,6 +8,7 @@ import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableStringBuilder
|
||||
@ -22,9 +23,11 @@ import androidx.constraintlayout.widget.ConstraintSet
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.therouter.TheRouter
|
||||
import com.gh.gamecenter.common.R
|
||||
import com.gh.gamecenter.common.base.TrackableDialog
|
||||
import com.gh.gamecenter.common.callback.ConfirmListener
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.databinding.DialogAlertDefaultBinding
|
||||
import com.gh.gamecenter.common.databinding.DialogGuideBinding
|
||||
import com.gh.gamecenter.common.databinding.DialogProgressBinding
|
||||
@ -38,7 +41,6 @@ import com.google.android.material.imageview.ShapeableImageView
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.utils.AppManager
|
||||
import com.lightgame.view.CheckableLinearLayout
|
||||
import com.therouter.TheRouter
|
||||
import splitties.systemservices.layoutInflater
|
||||
|
||||
object DialogHelper {
|
||||
@ -640,8 +642,7 @@ object DialogHelper {
|
||||
cancelText: String,
|
||||
confirmClickCallback: (() -> Unit)? = null,
|
||||
cancelClickCallback: (() -> Unit)? = null,
|
||||
touchOutsideCallback: (() -> Unit)? = null,
|
||||
extraConfig: Config? = null
|
||||
touchOutsideCallback: (() -> Unit)? = null
|
||||
) {
|
||||
val webContent = Html.fromHtml(content)
|
||||
showDialog(
|
||||
@ -652,8 +653,7 @@ object DialogHelper {
|
||||
cancelText,
|
||||
confirmClickCallback,
|
||||
cancelClickCallback,
|
||||
touchOutsideCallback = touchOutsideCallback,
|
||||
extraConfig = extraConfig
|
||||
touchOutsideCallback = touchOutsideCallback
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import android.app.Activity
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.ContextWrapper
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
@ -425,13 +424,6 @@ fun Context.ifLogin(entrance: String, action: (() -> Unit)? = null) {
|
||||
checkLoginConfig?.checkLogin(this, entrance, action)
|
||||
}
|
||||
|
||||
fun Context.getActivity(): Activity? {
|
||||
return when (this) {
|
||||
is Activity -> this
|
||||
is ContextWrapper -> this.baseContext.getActivity()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gson related extensions.
|
||||
@ -1840,7 +1832,4 @@ fun ViewPager.setRestoredCurItem(defaultPosition: Int) {
|
||||
// RGBA转换为ARGB格式颜色字符串
|
||||
fun String.RGBAToARGB(): String = if (length == 9) {
|
||||
substring(0, 1) + substring(7, 9) + substring(1, 7)
|
||||
} else this
|
||||
|
||||
// 换行符替换为Html的<br>换行
|
||||
fun String.replaceLineBreakWithBr(): String = replace("\n", "<br>")
|
||||
} else this
|
||||
@ -662,7 +662,7 @@ public class UserRepository {
|
||||
String userInfo = mPreferences.getString(Constants.USER_INFO_KEY, null);
|
||||
if (!TextUtils.isEmpty(userInfo)) {
|
||||
UserInfoEntity infoEntity = GsonUtils.fromJson(userInfo, UserInfoEntity.class);
|
||||
setAcceleratorToken(infoEntity.getUserId(), () -> null);
|
||||
setAcceleratorToken(infoEntity.getUserId(), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user