Compare commits

...

39 Commits

Author SHA1 Message Date
2eaaf63607 feat: 礼包功能模块化 2023-07-06 18:02:50 +08:00
4ce46474c0 Merge remote-tracking branch 'origin/dev-5.30.0' into feature-GHZS-libao-modulization
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/servers/GameServersContentFragment.kt
#	ndownload
2023-07-06 14:26:20 +08:00
3f4b86eaf0 移除无用的代码文件 2023-07-06 14:24:40 +08:00
56c8885030 chore: 版本更新至 5.30.0 2023-07-05 09:56:12 +08:00
0e9f7feff9 Merge branch 'feature/CWZS-80' into 'dev-5.29.0'
feat: 新增谷歌框架版本管理 https://jira.shanqu.cc/browse/CWZS-81

See merge request halo/android/assistant-android!1181
2023-07-04 17:45:56 +08:00
3697cd720e feat: 新增谷歌框架版本管理 https://jira.shanqu.cc/browse/CWZS-81 2023-07-04 17:38:55 +08:00
07a3c06804 Merge branch 'feature/GHZS-2738' into 'dev-5.29.0'
feat: 相关曝光数据埋点补充 https://jira.shanqu.cc/browse/GHZS-2738

See merge request halo/android/assistant-android!1180
2023-07-04 16:13:09 +08:00
2fce492689 feat: 相关曝光数据埋点补充 https://jira.shanqu.cc/browse/GHZS-2738 2023-07-04 16:13:09 +08:00
d87d12e1ec fix: 合并冲突 2023-07-04 14:58:57 +08:00
a595730c50 Merge remote-tracking branch 'origin/dev' into dev-5.29.0
# Conflicts:
#	libraries/LGLibrary
2023-07-04 14:45:40 +08:00
b9abf2009d Merge branch 'fix/GHZS-2838' into 'dev-5.29.0'
fix: 游戏单功能优化-游戏单合集-前端部分—0703UI优化(2、6) https://jira.shanqu.cc/browse/GHZS-2838

See merge request halo/android/assistant-android!1176
2023-07-04 11:55:37 +08:00
a7dfd6c16c fix: 游戏单功能优化-游戏单合集-前端部分—0703UI优化(2、6) https://jira.shanqu.cc/browse/GHZS-2838 2023-07-04 11:51:05 +08:00
7499bdad93 1. 成功迁移礼包模块 2023-07-04 11:32:04 +08:00
07dcb4aca2 Merge branch 'fix/web_share_info' into 'dev-5.29.0'
fix: 修复网页分享时分享回调类型为与需求对应不上的问题

See merge request halo/android/assistant-android!1175
2023-07-04 11:09:45 +08:00
48123ff991 fix: 修复网页分享时分享回调类型为与需求对应不上的问题 2023-07-04 11:08:56 +08:00
a6a411f2e3 Merge branch 'fix/GHZS-2838' into 'dev-5.29.0'
fix: 游戏单功能优化-游戏单合集-前端部分—0703UI优化 https://jira.shanqu.cc/browse/GHZS-2838

See merge request halo/android/assistant-android!1172
2023-07-03 17:48:47 +08:00
59976dcccd fix: 游戏单功能优化-游戏单合集-前端部分—0703UI优化 https://jira.shanqu.cc/browse/GHZS-2838 2023-07-03 17:47:18 +08:00
e22a3ddcdb Merge branch 'fix/web_share_info' into 'dev-5.29.0'
feat: JS 分享结果回调添加分享类型

See merge request halo/android/assistant-android!1173
2023-07-03 17:41:50 +08:00
ecfd133ce2 feat: JS 分享结果回调添加分享类型 2023-07-03 17:36:37 +08:00
d13ef56eb8 Merge branch 'fix/GHZS-2831' into 'dev-5.29.0'
fix: 游戏单功能优化-游戏单合集-前端部分—0630测试-客户端 https://jira.shanqu.cc/browse/GHZS-2831

See merge request halo/android/assistant-android!1171
2023-07-03 13:36:19 +08:00
66f2d1df99 fix: 游戏单功能优化-游戏单合集-前端部分—0630测试-客户端 https://jira.shanqu.cc/browse/GHZS-2831 2023-07-03 11:38:09 +08:00
1b1b753feb Merge remote-tracking branch 'origin/dev' into dev-5.29.0 2023-06-30 14:40:29 +08:00
f634d60605 Merge remote-tracking branch 'origin/dev' into dev-5.29.0 2023-06-30 13:52:06 +08:00
0a90a7ddd9 Merge branch 'feature/GHZS-2748' into 'dev-5.29.0'
feat: 游戏单活动:游戏单狂欢季—客户端-埋点 https://jira.shanqu.cc/browse/GHZS-2748

See merge request halo/android/assistant-android!1165
2023-06-29 17:47:32 +08:00
27ca5073d7 feat: 游戏单活动:游戏单狂欢季—客户端-埋点 https://jira.shanqu.cc/browse/GHZS-2748 2023-06-29 17:39:04 +08:00
e3eb8178a3 fix: merge conflict 2023-06-29 14:52:21 +08:00
10104812d6 Merge remote-tracking branch 'origin/dev' into dev-5.29.0 2023-06-29 14:29:23 +08:00
1e87610899 Merge branch 'feature/GHZS-2481' into 'dev-5.29.0'
feat: 游戏单功能优化-游戏单合集-前端部分—客户端 https://jira.shanqu.cc/browse/GHZS-2481

See merge request halo/android/assistant-android!1158
2023-06-28 10:50:33 +08:00
d04d486425 feat: 游戏单功能优化-游戏单合集-前端部分—客户端 https://jira.shanqu.cc/browse/GHZS-2481 2023-06-28 10:50:33 +08:00
b66827e216 Merge branch 'feature/GHZS-2800' into 'dev-5.29.0'
feat: 帖子发布按钮展示优化—客户端 https://jira.shanqu.cc/browse/GHZS-2800

See merge request halo/android/assistant-android!1159
2023-06-27 13:52:39 +08:00
485c34d402 feat: 帖子发布按钮展示优化—客户端 https://jira.shanqu.cc/browse/GHZS-2800 2023-06-27 13:49:42 +08:00
5a4f19dd8a Merge branch 'feature-GHZS-2730' into 'dev-5.29.0'
feat:插件化安装弹窗优化—客户端 https://jira.shanqu.cc/browse/GHZS-2730

See merge request halo/android/assistant-android!1154
2023-06-21 15:05:39 +08:00
b54be8cb79 feat:插件化安装弹窗优化—客户端 https://jira.shanqu.cc/browse/GHZS-2730 2023-06-21 14:59:11 +08:00
76ba3a5938 Merge branch 'feature-GHZS-2731' into 'dev-5.29.0'
feat:视频播放组件优化—客户端 https://jira.shanqu.cc/browse/GHZS-2731

See merge request halo/android/assistant-android!1150
2023-06-21 09:27:46 +08:00
db596a6c75 feat:视频播放组件优化—客户端 https://jira.shanqu.cc/browse/GHZS-2731 2023-06-20 18:40:31 +08:00
173361587f feat:评论详情删除评论弹窗标题居中 2023-06-19 14:57:42 +08:00
a154fba1d0 Updated merge dev-5.28.0 2023-06-19 13:42:51 +08:00
0a433566b1 chore: 版本更新至 5.29.0 2023-06-19 10:01:48 +08:00
66272da79b 迁移代码到模块上 2023-05-05 20:32:19 +08:00
321 changed files with 4236 additions and 1379 deletions

View File

@ -71,7 +71,8 @@ android_build:
exit_codes: 137
only:
- dev
- dev-5.28.0
- dev-5.29.0
- dev-5.30.0
# 代码检查
sonarqube_analysis:
@ -102,7 +103,8 @@ sonarqube_analysis:
exit_codes: 137
only:
- dev
- dev-5.28.0
- dev-5.29.0
- dev-5.30.0
## 发送简易检测结果报告
send_sonar_report:
@ -120,7 +122,8 @@ send_sonar_report:
exit_codes: 137
only:
- dev
- dev-5.28.0
- dev-5.29.0
- dev-5.30.0
oss-upload&send-email:
tags:
@ -152,4 +155,5 @@ oss-upload&send-email:
- /usr/local/bin/python /ci-android-mail.py
only:
- dev
- dev-5.28.0
- dev-5.29.0
- dev-5.30.0

View File

@ -319,6 +319,9 @@ dependencies {
implementation(project(':module_login')) {
exclude group: 'androidx.swiperefreshlayout'
}
implementation(project(':module_libao')) {
exclude group: 'androidx.swiperefreshlayout'
}
implementation(project(':module_setting')) {
exclude group: 'androidx.swiperefreshlayout'
}

View File

@ -24,8 +24,8 @@
-keep class com.gh.gamecenter.BR
-keep class com.gh.gamecenter.retrofit.* {*;}
-keep class com.gh.gamecenter.eventbus.* {*;}
-keep class com.gh.gamecenter.home.gamecollection.GameCollectionStackLayout {*;}
-keep class com.gh.gamecenter.home.gamecollection.GameCollectionStackAnimation {*;}
-keep class com.gh.gamecenter.home.gamecollection.carousel.GameCollectionStackLayout {*;}
-keep class com.gh.gamecenter.home.gamecollection.carousel.GameCollectionStackAnimation {*;}
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {

View File

@ -232,15 +232,6 @@
android:screenOrientation="portrait"
android:theme="@style/TransparentStatusBarAndNavigationBar" />
<activity
android:name="com.gh.gamecenter.LibaoActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.gh.gamecenter.LibaoDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.ShareGhActivity"
android:screenOrientation="portrait" />

View File

@ -0,0 +1 @@
{"v":"5.9.1","fr":60,"ip":0,"op":60,"w":72,"h":72,"nm":"icon_title_change","ddd":0,"assets":[{"id":"comp_0","nm":"arrow","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"arrow_e_dark","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[29.25,30,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.701,0.456],[-1.627,-0.674],[-0.705,-0.667],[0,0],[-0.552,0],[0,-0.552],[0,0],[0.552,0],[0,0],[0.012,0],[0,0],[0,0.552],[-0.552,0],[0,0],[0.615,0.255],[1.276,-0.342],[0.804,-1.048],[0,-1.321],[-0.804,-1.048],[-1.276,-0.342],[-1.22,0.505],[-0.66,1.144],[-0.478,-0.276],[0.276,-0.478],[1.627,-0.674],[1.701,0.456],[1.072,1.397],[0,1.761],[-1.072,1.397]],"o":[[1.701,-0.456],[0.909,0.376],[0,0],[0,-0.552],[0.552,0],[0,0],[0,0.552],[0,0],[-0.012,0],[0,0],[-0.552,0],[0,-0.552],[0,0],[-0.493,-0.435],[-1.22,-0.505],[-1.276,0.342],[-0.804,1.048],[0,1.321],[0.804,1.048],[1.276,0.342],[1.22,-0.505],[0.276,-0.478],[0.478,0.276],[-0.881,1.525],[-1.627,0.674],[-1.701,-0.456],[-1.072,-1.397],[0,-1.761],[1.072,-1.397]],"v":[[-1.821,-7.727],[3.311,-7.391],[5.75,-5.809],[5.75,-6.5],[6.75,-7.5],[7.75,-6.5],[7.75,-3.5],[6.75,-2.5],[6.331,-2.5],[6.295,-2.5],[3.75,-2.5],[2.75,-3.5],[3.75,-4.5],[4.219,-4.5],[2.546,-5.543],[-1.303,-5.796],[-4.51,-3.653],[-5.75,0],[-4.51,3.653],[-1.303,5.796],[2.546,5.543],[5.446,3],[6.812,2.634],[7.178,4],[3.311,7.391],[-1.821,7.727],[-6.097,4.87],[-7.75,0],[-6.097,-4.87]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.158117651939,0.532358944416,0.878431379795,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"arrow_e_dark","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"arrow","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[0]},{"t":36,"s":[360]}],"ix":10},"p":{"a":0,"k":[36,36,0],"ix":2,"l":2},"a":{"a":0,"k":[30,30,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":60,"h":60,"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}

View File

@ -0,0 +1 @@
{"v":"5.9.1","fr":60,"ip":0,"op":60,"w":72,"h":72,"nm":"icon_title_change","ddd":0,"assets":[{"id":"comp_0","nm":"arrow","fr":60,"layers":[{"ddd":0,"ind":2,"ty":4,"nm":"arrow_e_light","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[29.25,30,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.701,0.456],[-1.627,-0.674],[-0.705,-0.667],[0,0],[-0.552,0],[0,-0.552],[0,0],[0.552,0],[0,0],[0.012,0],[0,0],[0,0.552],[-0.552,0],[0,0],[0.615,0.255],[1.276,-0.342],[0.804,-1.048],[0,-1.321],[-0.804,-1.048],[-1.276,-0.342],[-1.22,0.505],[-0.66,1.144],[-0.478,-0.276],[0.276,-0.478],[1.627,-0.674],[1.701,0.456],[1.072,1.397],[0,1.761],[-1.072,1.397]],"o":[[1.701,-0.456],[0.909,0.376],[0,0],[0,-0.552],[0.552,0],[0,0],[0,0.552],[0,0],[-0.012,0],[0,0],[-0.552,0],[0,-0.552],[0,0],[-0.493,-0.435],[-1.22,-0.505],[-1.276,0.342],[-0.804,1.048],[0,1.321],[0.804,1.048],[1.276,0.342],[1.22,-0.505],[0.276,-0.478],[0.478,0.276],[-0.881,1.525],[-1.627,0.674],[-1.701,-0.456],[-1.072,-1.397],[0,-1.761],[1.072,-1.397]],"v":[[-1.821,-7.727],[3.311,-7.391],[5.75,-5.809],[5.75,-6.5],[6.75,-7.5],[7.75,-6.5],[7.75,-3.5],[6.75,-2.5],[6.331,-2.5],[6.295,-2.5],[3.75,-2.5],[2.75,-3.5],[3.75,-4.5],[4.219,-4.5],[2.546,-5.543],[-1.303,-5.796],[-4.51,-3.653],[-5.75,0],[-4.51,3.653],[-1.303,5.796],[2.546,5.543],[5.446,3],[6.812,2.634],[7.178,4],[3.311,7.391],[-1.821,7.727],[-6.097,4.87],[-7.75,0],[-6.097,-4.87]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.141176477075,0.588235318661,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"arrow_e_light","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"arrow","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[0]},{"t":36,"s":[360]}],"ix":10},"p":{"a":0,"k":[36,36,0],"ix":2,"l":2},"a":{"a":0,"k":[30,30,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":60,"h":60,"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}

View File

@ -15,7 +15,7 @@ import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils.getBoolean
import com.gh.gamecenter.entity.GameUpdateEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.packagehelper.PackageViewModel
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode

View File

@ -12,6 +12,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.common.exposure.ExposureManager
import com.gh.common.util.*
import com.gh.common.util.LogUtils
import com.gh.download.DownloadManager
@ -33,10 +34,12 @@ import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.entity.SensorsEvent
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.gh.gamecenter.feature.entity.Badge
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.login.user.LoginTag
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.login.user.UserRepository
@ -71,6 +74,7 @@ class DefaultJsApi(
private var mDownloadWatcher: DataWatcher? = null // 下载观察者
private var mDownloadUrlSet: HashSet<String>? = null // 下载的 url 集合
private var mDownloadHandler: CompletionHandler<Any>? = null // 下载信息回调
private var mExposureEvent: ExposureEvent? = null // 活动曝光实体
init {
if (mFragment != null) {
@ -624,6 +628,26 @@ class DefaultJsApi(
}
}
@JavascriptInterface
fun logExposure(event: Any) {
val simpleExposureEvent = event.toString().toObject() ?: SimpleExposureEvent()
if (simpleExposureEvent.id.isNotEmpty()) {
val exposureSource = ExposureSource("游戏活动", "${simpleExposureEvent.title}+${simpleExposureEvent.id}")
mExposureEvent = ExposureEvent.createEvent(
gameEntity = null,
source = arrayListOf(exposureSource),
)
ExposureManager.log(mExposureEvent!!)
}
}
/**
* 获取 ExposureEvent可能为空
*/
fun getExposureEvent(): ExposureEvent? {
return mExposureEvent
}
private fun autoUnregisterDownloadObserverIfNeeded(fragment: Fragment?) {
fragment?.parentFragmentManager?.registerFragmentLifecycleCallbacks(
object : FragmentManager.FragmentLifecycleCallbacks() {
@ -676,6 +700,9 @@ class DefaultJsApi(
@Keep
internal class TextShareEvent(var text: String = "", var type: String = "")
@Keep
internal class SimpleExposureEvent(var title: String = "", var id: String = "")
@Keep
internal class InviteFriendsEvent(
var type: String = "",

View File

@ -15,7 +15,6 @@ import com.gh.common.util.DirectUtils.directToLegacyVideoDetail
import com.gh.common.util.DirectUtils.directToLinkPage
import com.gh.common.util.DirectUtils.directToQa
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.LibaoDetailActivity
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.NewsDetailActivity
import com.gh.gamecenter.WebActivity
@ -36,6 +35,7 @@ import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.entity.VideoLinkEntity
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.utils.PlatformUtils
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity
@ -51,14 +51,21 @@ object DefaultUrlHandler {
@JvmStatic
fun interceptUrl(context: Context, url: String, entrance: String): Boolean {
return interceptUrl(context, url, entrance, false)
return interceptUrl(context, url, null, entrance, false)
}
/**
* 检查并拦截部分内部处理的 url
* @param traceEvent 供一些页面用于登记曝光来源的实体
* @param bringAppToFront 是否需要在不匹配 host 的时候把 APP 调回到前台 (如微信调起)
*
* @return 是否已拦截处理
*/
@JvmStatic
fun interceptUrl(context: Context, url: String, entrance: String, bringAppToFront: Boolean = false): Boolean {
fun interceptUrl(context: Context, url: String,
traceEvent: ExposureEvent? = null,
entrance: String,
bringAppToFront: Boolean = false): Boolean {
val uri = Uri.parse(url)
if ("ghzhushou" == uri.scheme) {
Utils.log("url = $url")
@ -82,6 +89,7 @@ object DefaultUrlHandler {
id = id,
tab = uri.getQueryParameter("to"),
autoDownload = uri.getQueryParameter("auto_download") == "true",
traceEvent = traceEvent,
entrance = entrance
)
@ -90,10 +98,11 @@ object DefaultUrlHandler {
id,
uri.getQueryParameter("name"),
false,
null,
entrance
)
"libao" -> context.startActivity(LibaoDetailActivity.getIntentById(context, id, entrance))
"libao" -> DirectUtils.directToGiftDetail(context, id, entrance)
"qq" -> try {
DirectUtils.directToQqConversation(context, id)
@ -467,7 +476,7 @@ object DefaultUrlHandler {
}
EntranceConsts.HOST_GAME_COLLECTION_DETAIL -> {
DirectUtils.directToGameCollectionDetail(context, id, entrance)
DirectUtils.directToGameCollectionDetail(context, id, entrance, traceEvent = traceEvent)
}
EntranceConsts.HOST_GAME_COLLECTION_SQUARE -> {

View File

@ -311,7 +311,7 @@ public class Config {
@SuppressLint("CheckResult")
public static void refreshVSettingEntity() {
RetrofitManager.getInstance()
.getVApi().getSettings(BuildConfig.VERSION_NAME)
.getVApi().getSettings(BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BiResponse<VSetting>() {

View File

@ -18,9 +18,9 @@ import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.R
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.databinding.KaifuAddItemBinding
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupBinding
import com.gh.gamecenter.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.feature.entity.ServerCalendarEntity
import com.gh.gamecenter.servers.add.AddKaiFuPopupAdapter
import java.text.SimpleDateFormat

View File

@ -281,68 +281,68 @@ public class BindingAdapters {
}
}
public static void setLiBaoBtn(TextView view, String status) {
if (TextUtils.isEmpty(status)) return;
switch (status) {
case "coming":
view.setText(R.string.libao_coming);
view.setBackgroundResource(R.drawable.textview_blue_style);
break;
case "ling":
view.setText(R.string.libao_ling);
view.setBackgroundResource(R.drawable.textview_green_style);
break;
case "tao":
view.setText(R.string.libao_tao);
view.setBackgroundResource(R.drawable.textview_orange_style);
break;
case "used_up":
view.setText(R.string.libao_used_up);
view.setBackgroundResource(R.drawable.textview_cancel_up);
break;
case "finish":
view.setText(R.string.libao_finish);
view.setBackgroundResource(R.drawable.textview_cancel_up);
break;
case "linged":
view.setText(R.string.libao_linged);
view.setBackgroundResource(R.drawable.libao_linged_style);
view.setTextColor(ContextCompat.getColorStateList(view.getContext(), R.color.libao_linged_selector));
break;
case "taoed":
view.setText(R.string.libao_taoed);
view.setBackgroundResource(R.drawable.libao_taoed_style);
view.setTextColor(ContextCompat.getColorStateList(view.getContext(), R.color.libao_taoed_selector));
break;
case "copy":
view.setText(R.string.libao_copy);
view.setBackgroundResource(R.drawable.textview_blue_style);
break;
case "repeatLing":
view.setText(R.string.libao_repeat_ling);
view.setBackgroundResource(R.drawable.textview_cancel_up);
break;
case "repeatLinged":
view.setText(R.string.libao_repeat_ling);
view.setBackgroundResource(R.drawable.textview_green_style);
break;
case "repeatTao":
view.setText(R.string.libao_repeat_tao);
view.setBackgroundResource(R.drawable.textview_cancel_up);
break;
case "repeatTaoed":
view.setText(R.string.libao_repeat_tao);
view.setBackgroundResource(R.drawable.textview_orange_style);
break;
case "unshelve":
view.setBackgroundResource(R.drawable.textview_cancel_style);
view.setText(R.string.libao_unshelve);
break;
default:
view.setBackgroundResource(R.drawable.textview_cancel_style);
view.setText("异常");
}
}
// public static void setLiBaoBtn(TextView view, String status) {
// if (TextUtils.isEmpty(status)) return;
// switch (status) {
// case "coming":
// view.setText(R.string.libao_coming);
// view.setBackgroundResource(R.drawable.textview_blue_style);
// break;
// case "ling":
// view.setText(R.string.libao_ling);
// view.setBackgroundResource(R.drawable.textview_green_style);
// break;
// case "tao":
// view.setText(R.string.libao_tao);
// view.setBackgroundResource(R.drawable.textview_orange_style);
// break;
// case "used_up":
// view.setText(R.string.libao_used_up);
// view.setBackgroundResource(R.drawable.textview_cancel_up);
// break;
// case "finish":
// view.setText(R.string.libao_finish);
// view.setBackgroundResource(R.drawable.textview_cancel_up);
// break;
// case "linged":
// view.setText(R.string.libao_linged);
// view.setBackgroundResource(R.drawable.libao_linged_style);
// view.setTextColor(ContextCompat.getColorStateList(view.getContext(), R.color.libao_linged_selector));
// break;
// case "taoed":
// view.setText(R.string.libao_taoed);
// view.setBackgroundResource(R.drawable.libao_taoed_style);
// view.setTextColor(ContextCompat.getColorStateList(view.getContext(), R.color.libao_taoed_selector));
// break;
// case "copy":
// view.setText(R.string.libao_copy);
// view.setBackgroundResource(R.drawable.textview_blue_style);
// break;
// case "repeatLing":
// view.setText(R.string.libao_repeat_ling);
// view.setBackgroundResource(R.drawable.textview_cancel_up);
// break;
// case "repeatLinged":
// view.setText(R.string.libao_repeat_ling);
// view.setBackgroundResource(R.drawable.textview_green_style);
// break;
// case "repeatTao":
// view.setText(R.string.libao_repeat_tao);
// view.setBackgroundResource(R.drawable.textview_cancel_up);
// break;
// case "repeatTaoed":
// view.setText(R.string.libao_repeat_tao);
// view.setBackgroundResource(R.drawable.textview_orange_style);
// break;
// case "unshelve":
// view.setBackgroundResource(R.drawable.textview_cancel_style);
// view.setText(R.string.libao_unshelve);
// break;
// default:
// view.setBackgroundResource(R.drawable.textview_cancel_style);
// view.setText("异常");
// }
// }
// 大图下的进度条
public static void setDownloadButton(DownloadButton progressBar,

View File

@ -24,6 +24,7 @@ import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.eventbus.EBPackage
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.CustomLinkMovementMethod
import com.gh.gamecenter.core.utils.DisplayUtils
@ -34,7 +35,6 @@ import com.gh.gamecenter.databinding.PackageCheckItemBinding
import com.gh.gamecenter.feature.entity.DetectionObjectEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.PackageDialogEntity
import com.gh.gamecenter.eventbus.EBPackage
import com.halo.assistant.HaloApp
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.dialog.BaseDialogFragment

View File

@ -4,6 +4,8 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.gh.gamecenter.feature.exposure.ExposureEvent
import io.reactivex.functions.Consumer
@ -18,7 +20,7 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
Consumer(Throwable::printStackTrace)
)
}
var layoutManager: LinearLayoutManager? = null
var layoutManager: LayoutManager? = null
var visibleState: ExposureThrottleBus.VisibleState? = null
init {
@ -47,12 +49,28 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (layoutManager == null) layoutManager = recyclerView.layoutManager as LinearLayoutManager
layoutManager = recyclerView.layoutManager
layoutManager?.run {
visibleState =
ExposureThrottleBus.VisibleState(findFirstVisibleItemPosition(), findLastVisibleItemPosition())
throttleBus.postVisibleState(visibleState!!)
if (layoutManager != null) {
if (layoutManager is LinearLayoutManager) {
(layoutManager as LinearLayoutManager).run {
visibleState =
ExposureThrottleBus.VisibleState(findFirstVisibleItemPosition(), findLastVisibleItemPosition())
throttleBus.postVisibleState(visibleState!!)
}
} else if (layoutManager is StaggeredGridLayoutManager) {
(recyclerView.layoutManager as StaggeredGridLayoutManager).run {
val firstVisibleItemArray = IntArray(2)
val lastVisibleItemArray = IntArray(2)
findFirstVisibleItemPositions(firstVisibleItemArray)
findLastVisibleItemPositions(lastVisibleItemArray)
visibleState =
ExposureThrottleBus.VisibleState(firstVisibleItemArray.first(), lastVisibleItemArray.first())
throttleBus.postVisibleState(visibleState!!)
}
}
}
}

View File

@ -0,0 +1,22 @@
package com.gh.common.provider
import android.app.Dialog
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IAppDialogUtilsProvider
@Route(path = RouteConsts.provider.appDialogUtils, name = "DialogUtils暴露服务")
class AppDialogUtilsProviderImpl : IAppDialogUtilsProvider {
override fun showWaitDialog(context: Context, string: String): Dialog {
return DialogUtils.showWaitDialog(context, string)
}
override fun init(context: Context?) {
}
}

View File

@ -0,0 +1,18 @@
package com.gh.common.provider
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.ConcernActivity
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.provider.IConcernProvider
@Route(path = RouteConsts.provider.concern, name = "ConcernActivity暴露服务")
class ConcernProviderImpl : IConcernProvider {
override fun getIntent(context: Context, entrance: String): Intent {
return ConcernActivity.getIntent(context, entrance)
}
override fun init(context: Context?) {}
}

View File

@ -15,7 +15,7 @@ class DefaultUrlHandlerProviderImpl : IDefaultUrlHandlerProvider {
entrance: String,
bringAppToFront: Boolean
): Boolean {
return DefaultUrlHandler.interceptUrl(context, url, entrance, bringAppToFront)
return DefaultUrlHandler.interceptUrl(context, url, null, entrance, bringAppToFront)
}
override fun init(context: Context?) {

View File

@ -0,0 +1,70 @@
package com.gh.common.provider
import android.content.Context
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DetailDownloadUtils
import com.gh.gamecenter.adapter.viewholder.DetailViewHolder
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.IDetailDownloadUtilsProvider
import com.lightgame.download.DownloadEntity
@Route(path = RouteConsts.provider.detailDownloadUtils, name = "DetailDownloadUtils暴露服务")
class DetailDownloadUtilsProviderImpl : IDetailDownloadUtilsProvider {
override fun detailInitDownload(
contentView: View,
gameEntity: GameEntity?,
downloadEntity: DownloadEntity?,
isNewsDetail: Boolean,
entrance: String?,
name: String?,
title: String?,
exposureEvent: ExposureEvent?,
isCheck: Boolean
) {
return DetailDownloadUtils.detailInitDownload(
DetailViewHolder(
contentView,
gameEntity,
downloadEntity,
isNewsDetail,
entrance,
name,
title,
exposureEvent
),
isCheck
)
}
override fun detailInitInvalidate(
contentView: View,
gameEntity: GameEntity,
downloadEntity: DownloadEntity,
isNewsDetail: Boolean,
entrance: String,
name: String,
title: String,
exposureEvent: ExposureEvent?
) {
return DetailDownloadUtils.detailInvalidate(
DetailViewHolder(
contentView,
gameEntity,
downloadEntity,
isNewsDetail,
entrance,
name,
title,
exposureEvent
)
)
}
override fun init(context: Context?) {
}
}

View File

@ -0,0 +1,17 @@
package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DeviceTokenUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IDeviceTokenUtilsProvider
@Route(path = RouteConsts.provider.deviceTokenUtils, name = "DeviceTokenUtils暴露服务")
class DeviceTokenUtilsProviderImpl : IDeviceTokenUtilsProvider {
override fun syncServerTime(context: Context) {
DeviceTokenUtils.syncServerTime(context)
}
override fun init(context: Context?) {}
}

View File

@ -5,7 +5,9 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IDownloadManagerProvider
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
@Route(path = RouteConsts.provider.downloadManager, name = "DownloadManager暴露服务")
class DownloadManagerProviderImpl : IDownloadManagerProvider {
@ -18,6 +20,18 @@ class DownloadManagerProviderImpl : IDownloadManagerProvider {
DownloadManager.getInstance().resumeAllInvisiblePendingTask()
}
override fun getStatus(url: String): DownloadStatus {
return DownloadManager.getInstance().getStatus(url)
}
override fun addObserver(dataWatcher: DataWatcher) {
return DownloadManager.getInstance().addObserver(dataWatcher)
}
override fun removeObserver(dataWatcher: DataWatcher) {
return DownloadManager.getInstance().removeObserver(dataWatcher)
}
override fun init(context: Context?) {
// Do nothing
}

View File

@ -18,6 +18,16 @@ class GameDetailProviderImpl : IGameDetailProvider {
) {
GameDetailActivity.startGameDetailActivity(context, gameId, entrance, traceEvent)
}
override fun startGameDetailActivity(
context: Context,
gameEntity: GameEntity?,
entrance: String,
traceEvent: ExposureEvent?
) {
GameDetailActivity.startGameDetailActivity(context, gameEntity, entrance, traceEvent)
}
override fun startGameDetailActivity(
context: Context,
gameEntity: GameEntity?,

View File

@ -33,6 +33,10 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
return PackageUtils.getSideLoadedInfo()
}
override fun launchApplicationByPackageName(context: Context, packageName: String) {
PackageUtils.launchApplicationByPackageName(context, packageName)
}
override fun init(context: Context?) {
// Do nothing
}

View File

@ -30,6 +30,10 @@ class RegionSettingHelperProviderImpl : IRegionSettingHelperProvider {
return RegionSettingHelper.getIpInfo()
}
override fun shouldThisGameBeFiltered(gameId: String?): Boolean {
return RegionSettingHelper.shouldThisGameBeFiltered(gameId)
}
override fun init(context: Context?) {
// Do nothing
}

View File

@ -1,7 +1,7 @@
package com.gh.common.util
import android.text.TextUtils
import com.gh.gamecenter.eventbus.EBConcernChanged
import com.gh.gamecenter.common.eventbus.EBConcernChanged
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
@ -38,7 +38,12 @@ object ConcernUtils {
override fun onResponse(response: ResponseBody?) {
super.onResponse(response)
listener?.onSuccess()
EventBus.getDefault().post(EBConcernChanged(gameId, true))
EventBus.getDefault().post(
EBConcernChanged(
gameId,
true
)
)
}
override fun onFailure(e: HttpException?) {
@ -57,7 +62,12 @@ object ConcernUtils {
override fun onResponse(response: ResponseBody?) {
super.onResponse(response)
listener?.onSuccess()
EventBus.getDefault().post(EBConcernChanged(gameId, false))
EventBus.getDefault().post(
EBConcernChanged(
gameId,
false
)
)
}
override fun onFailure(e: HttpException?) {

View File

@ -8,6 +8,7 @@ import com.gh.common.filter.RegionSetting;
import com.gh.common.filter.RegionSettingHelper;
import com.gh.common.repository.ReservationRepository;
import com.gh.common.simulator.SimulatorGameManager;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.common.xapk.XapkInstaller;
import com.gh.common.xapk.XapkUnzipStatus;

View File

@ -57,6 +57,7 @@ import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.common.view.CustomLinkMovementMethod;
import com.gh.gamecenter.common.view.DrawableView;

View File

@ -9,6 +9,7 @@ import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.common.constant.Config
import com.gh.common.exposure.ExposureManager.log
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
@ -21,6 +22,7 @@ import com.gh.gamecenter.category2.CategoryV2Activity
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.base.activity.ToolBarActivity.NORMAL_FRAGMENT_NAME
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout
import com.gh.gamecenter.common.constant.CommonConsts
import com.gh.gamecenter.common.constant.Constants
@ -28,17 +30,19 @@ import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.constant.EntranceConsts.*
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.*
import com.gh.gamecenter.common.entity.Display
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.discovery.DiscoveryActivity
import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.entity.VideoLinkEntity
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.entity.GameDetailServer
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.LibaoEntity
import com.gh.gamecenter.feature.entity.MeEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
@ -58,6 +62,7 @@ import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
import com.gh.gamecenter.gamedetail.history.HistoryApkListActivity
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
import com.gh.gamecenter.help.HelpAndFeedbackBridge
import com.gh.gamecenter.libao.view.LibaoFragment
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.personalhome.UserHomeActivity
import com.gh.gamecenter.personalhome.background.PersonalityBackgroundActivity
@ -91,6 +96,7 @@ import org.greenrobot.eventbus.EventBus
import retrofit2.HttpException
import java.net.URLEncoder
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.roundToInt
/**
@ -318,7 +324,7 @@ object DirectUtils {
)
}
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance)
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance, "", exposureEvent)
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path, exposureEvent)
@ -446,7 +452,7 @@ object DirectUtils {
context,
linkEntity.link ?: "",
entrance,
exposureEvent = exposureEvent
traceEvent = exposureEvent
)
"explore_column", "game_explore" -> context.startActivity(
@ -515,7 +521,8 @@ object DirectUtils {
id: String,
position: Int = -1,
entrance: String,
columnName: String = ""
columnName: String = "",
exposureEvent: ExposureEvent? = null
) {
if (id.isEmpty()) return
val bundle = Bundle()
@ -524,6 +531,9 @@ object DirectUtils {
bundle.putString(KEY_COLLECTION_ID, id)
bundle.putString(KEY_COLUMNNAME, columnName)
bundle.putInt(KEY_POSITION, position)
if (exposureEvent != null) {
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST ,ArrayList(exposureEvent.source))
}
jumpActivity(context, bundle)
}
@ -1002,29 +1012,6 @@ object DirectUtils {
}
/**
* 跳转到 礼包详情
*/
@JvmStatic
fun directToGiftDetail(context: Context, giftId: String, entrance: String? = null) {
if (giftId.isEmpty()) return
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, LibaoDetailActivity::class.java.simpleName)
bundle.putString(EntranceConsts.KEY_ID, giftId)
HaloApp.put(LibaoEntity.TAG, null)
jumpActivity(context, bundle)
}
/**
* 跳转到礼包中心,请不要随意修改方法名
*/
@JvmStatic
fun directToGift(context: Context, entrance: String) {
val intent = LibaoActivity.getIntent(context, entrance)
context.startActivity(intent)
}
/**
* 切换到社区页面(旧社区页面已经没有了,处理为跳转到论坛详情)
*/
@ -1914,15 +1901,20 @@ object DirectUtils {
id: String,
entrance: String? = null,
path: String? = null,
exposureEvent: ExposureEvent? = null
traceEvent: ExposureEvent? = null,
) {
if (id.isEmpty()) return
val bundle = Bundle()
val exposureSourceList = traceEvent?.source
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_PATH, path)
bundle.putString(KEY_TO, GameCollectionDetailActivity::class.java.name)
bundle.putString(KEY_GAME_COLLECTION_ID, id)
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
if (exposureSourceList is ArrayList) {
bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, exposureSourceList)
} else if (exposureSourceList != null) {
bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureSourceList))
}
jumpActivity(context, bundle)
}
@ -2047,4 +2039,75 @@ object DirectUtils {
platform = platform
)
}
/**
* 跳转到礼包页
* @param context 上下文
* @param entrance
*/
@JvmStatic
fun directToGift(
context: Context,
entrance: String
) {
ARouter
.getInstance()
.build(RouteConsts.activity.libaoActivity)
.withString(KEY_ENTRANCE, entrance)
.withString(NORMAL_FRAGMENT_NAME, LibaoFragment::class.java.canonicalName)
.navigation(context)
}
/**
* 跳转到礼包详情
* @param context 上下文
* @param libaoEntity 礼包信息
* @param isClickReceiveBtnIn
* @param entrance
*/
@JvmStatic
@JvmOverloads
fun directToGiftDetail(
context: Context,
libaoEntity: LibaoEntity,
isClickReceiveBtnIn: Boolean = false,
entrance: String,
requestCode: Int = -1,
) {
if (context !is Activity) return
HaloApp.put(LibaoEntity.TAG, libaoEntity)
ARouter
.getInstance()
.build(RouteConsts.activity.libaoDetailActivity)
.withString(KEY_ENTRANCE, entrance)
.withBoolean(KEY_IS_CLICK_RECEIVE_BTN, isClickReceiveBtnIn)
.navigation(context, requestCode, null)
}
/**
* 跳转到礼包详情
* @param context 上下文
* @param id 礼包ID
* @param entrance
*/
@JvmStatic
fun directToGiftDetail(
context: Context,
giftId: String,
entrance: String? = null
) {
if (giftId.isEmpty()) return
HaloApp.put(LibaoEntity.TAG, null)
ARouter
.getInstance()
.build(RouteConsts.activity.libaoDetailActivity)
.withString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
.withString(KEY_ID, giftId)
.navigation(context)
}
}

View File

@ -3,6 +3,7 @@ package com.gh.common.util
import android.content.Context
import android.os.Build
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameEntity

View File

@ -1076,7 +1076,7 @@ object DownloadItemUtils {
}
PackageUtils.isCanPluggable(apkEntity) -> {
DialogHelper.showPluginDialog(context) { PackageInstaller.uninstall(context, path) }
DialogHelper.showPluginDialog(context, gameEntity.pluginDesc) { PackageInstaller.uninstall(context, path) }
}
else -> {

View File

@ -18,7 +18,7 @@ import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.common.eventbus.EBShowDialog
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.SimulatorEntity
import com.gh.gamecenter.feature.utils.PlatformUtils
@ -217,7 +217,8 @@ object DownloadObserver {
EventBus.getDefault().post(
EBShowDialog(
BaseActivity.PLUGGABLE,
downloadEntity.path
downloadEntity.path,
downloadEntity.pluginDesc
)
)
downloadEntity.isPlugin -> Utils.toast(
@ -287,7 +288,8 @@ object DownloadObserver {
EventBus.getDefault().post(
EBShowDialog(
BaseActivity.PLUGGABLE,
downloadEntity.path
downloadEntity.path,
downloadEntity.pluginDesc
)
)
} else {

View File

@ -18,7 +18,6 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.ErrorEntity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.login.user.LoginTag
import com.halo.assistant.fragment.user.UserInfoEditFragment
import com.halo.assistant.fragment.user.VerifyPhoneFragment
import com.lightgame.utils.AppManager

View File

@ -22,10 +22,7 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.retrofit.ApiResponse
import com.gh.gamecenter.common.retrofit.EmptyResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.DataLogUtils
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.observableToMain
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.core.utils.EmptyCallback
@ -476,7 +473,7 @@ object GameActivityDownloadHelper {
gameEntity.getEntryMap().remove(apkEntity.getPlatform())
}
PackageUtils.isCanPluggable(apkEntity) -> {
DialogHelper.showPluginDialog(context) { PackageInstaller.uninstall(context, path) }
DialogHelper.showPluginDialog(context, gameEntity.pluginDesc) { PackageInstaller.uninstall(context, path) }
}
else -> {
PackageInstaller.install(context, downloadEntity)

View File

@ -10,7 +10,9 @@ import android.os.Message;
import android.text.TextUtils;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.common.eventbus.EBDownloadStatus;
import com.gh.gamecenter.common.eventbus.EBPackage;
import com.halo.assistant.HaloApp;
import com.lightgame.download.DownloadEntity;

View File

@ -3,6 +3,7 @@ package com.gh.common.util
import android.content.Context
import android.content.pm.ApplicationInfo
import com.gh.common.constant.Config
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.feature.entity.SettingsEntity
import com.halo.assistant.HaloApp

View File

@ -16,6 +16,7 @@ import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.common.utils.getExtension
import com.gh.gamecenter.common.utils.getMetaExtra
import com.gh.gamecenter.core.utils.CurrentActivityHolder
@ -120,7 +121,7 @@ object PackageInstaller {
}
} else {
if (isPluggin) {
DialogHelper.showPluginDialog(context) {
DialogHelper.showPluginDialog(context, downloadEntity?.pluginDesc) {
uninstall(context, pkgPath)
}
} else {

View File

@ -2,6 +2,7 @@ package com.gh.common.util
import com.gh.gamecenter.common.constant.Constants
import com.gh.common.dialog.DeviceRemindDialog
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.TimeUtils

View File

@ -45,7 +45,7 @@ import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.entity.HomePluggableFilterEntity;
import com.gh.gamecenter.feature.entity.PluginLocation;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.common.eventbus.EBDownloadStatus;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.packagehelper.PackageRepository;
@ -309,6 +309,7 @@ public class DownloadManager implements DownloadStatusListener {
downloadEntity.setUrl(apkEntity.getUrl());
downloadEntity.setName(gameEntity.getName());
downloadEntity.setPath(path);
downloadEntity.setPluginDesc(gameEntity.getPluginDesc());
downloadEntity.setETag(apkEntity.getEtag());
downloadEntity.setIcon(gameEntity.getIcon());
downloadEntity.setPlatform(apkEntity.getPlatform());

View File

@ -9,6 +9,7 @@ import com.gh.common.util.PackageUtils
import com.gh.common.xapk.XapkInstaller
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.eventbus.EBPackage
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.retrofit.EmptyResponse
import com.gh.gamecenter.common.retrofit.Response
@ -18,7 +19,6 @@ import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.ThirdPartyPackageHelper
import com.gh.gamecenter.core.utils.UrlFilterUtils
import com.gh.gamecenter.entity.GameDigestEntity
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.packagehelper.PackageRepository
import com.gh.gamecenter.packagehelper.PackageViewModel

View File

@ -22,6 +22,7 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.base.fragment.BaseDraggableDialogFragment
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.observeNonNull
import com.gh.gamecenter.common.utils.throwExceptionInDebug
@ -30,7 +31,8 @@ import com.gh.gamecenter.core.utils.TimeElapsedHelper
import com.gh.gamecenter.databinding.DialogDownloadBinding
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.halo.assistant.HaloApp
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity

View File

@ -3,14 +3,14 @@ package com.gh.download.dialog
import android.view.View
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.common.constant.Config
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.common.util.*
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.throwExceptionInDebug
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.databinding.DownloadDialogInstalledItemBinding
import com.gh.gamecenter.feature.entity.ApkEntity
import com.lightgame.download.DownloadStatus

View File

@ -279,7 +279,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
DownloadManager.getInstance().cancel(apkEntity.url)
} else {
if (PackageUtils.isCanPluggable(apkEntity)) {
DialogHelper.showPluginDialog(it.context) {
DialogHelper.showPluginDialog(it.context, gameEntity.pluginDesc) {
PackageInstaller.uninstall(it.context, downloadEntity.path)
}
} else {

View File

@ -165,7 +165,7 @@ object DownloadMessageHandler : InnerDownloadListener {
* @param error 错误类型
* @param exception 包裹错误的 Exception
*/
override fun onError(id: String, error: DownloadError?, exception: Exception) {
override fun onError(id: String, error: DownloadError?, exception: Exception?) {
error ?: return
when (error) {

View File

@ -7,14 +7,21 @@ import com.gh.base.DownloadToolbarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.game.GameFragment
class BlockActivity : DownloadToolbarActivity() {
companion object {
fun getIntent(context: Context, blockData: SubjectRecommendEntity, entrance: String): Intent {
fun getIntent(context: Context,
blockData: SubjectRecommendEntity,
exposureSourceList: ArrayList<ExposureSource>? = null,
entrance: String): Intent {
val args = Bundle()
args.putParcelable(EntranceConsts.KEY_BLOCK_DATA, blockData)
if (exposureSourceList != null) {
args.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, exposureSourceList)
}
args.putString(EntranceConsts.KEY_ENTRANCE, entrance)
return getTargetIntent(context, BlockActivity::class.java, GameFragment::class.java, args)
}

View File

@ -10,7 +10,7 @@ import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.feature.entity.ConcernEntity;
import com.gh.gamecenter.message.MessageDetailFragment;
import com.halo.assistant.HaloApp;

View File

@ -40,7 +40,10 @@ import com.gh.gamecenter.adapter.viewholder.DetailViewHolder;
import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.eventbus.EBConcernChanged;
import com.gh.gamecenter.common.eventbus.EBDownloadStatus;
import com.gh.gamecenter.common.eventbus.EBNetworkState;
import com.gh.gamecenter.common.eventbus.EBPackage;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.ExtensionsKt;
@ -51,11 +54,8 @@ import com.gh.gamecenter.core.utils.ClickUtils;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.entity.NewsDetailEntity;
import com.gh.gamecenter.eventbus.EBConcernChanged;
import com.gh.gamecenter.eventbus.EBAddComment;
import com.gh.gamecenter.eventbus.EBDeleteComment;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.MeEntity;
import com.gh.gamecenter.feature.entity.NewsEntity;

View File

@ -23,7 +23,7 @@ import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.common.util.MessageShareUtils;
import com.gh.common.util.QRCodeUtils;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.feature.entity.ConcernEntity;
import java.io.File;

View File

@ -32,7 +32,7 @@ import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.common.util.MessageShareUtils;
import com.gh.common.util.QRCodeUtils;
import com.gh.gamecenter.core.utils.StringUtils;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.feature.entity.ConcernEntity;
import com.gh.gamecenter.common.retrofit.ObservableUtil;
import java.io.File;

View File

@ -320,7 +320,7 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directCategoryDirectory(this, path, title, ENTRANCE_BROWSER, "浏览器");
break;
case HOST_COLUMN_COLLECTION:
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "浏览器");
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "", null);
break;
case EntranceConsts.HOST_BLOCK:
name = uri.getQueryParameter("name");

View File

@ -13,7 +13,7 @@ import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.EnvHelper
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.entity.ConcernEntity
import com.gh.gamecenter.feature.entity.ConcernEntity
import com.gh.gamecenter.feature.entity.NewsEntity
import com.gh.gamecenter.common.entity.ToolBoxEntity
import com.halo.assistant.fragment.WebFragment

View File

@ -259,7 +259,7 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
if ("NORMAL".equals(mShareStyle)) {
com.gh.gamecenter.common.utils.LogUtils.uploadShareResult(ShareUtils.shareType, ShareUtils.shareEntrance.getName(), "success",
ShareUtils.shareEntity.getShareUrl(), ShareUtils.shareEntity.getShareTitle(), ShareUtils.shareEntity.getSummary(), ShareUtils.resourceId);
EventBus.getDefault().post(new EBShare(ShareUtils.shareEntrance));
EventBus.getDefault().post(new EBShare(ShareUtils.shareEntrance, "新浪微博"));
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.inviteFriends) {
IntegralLogHelper.INSTANCE.logInviteResult("成功", "微博");
}

View File

@ -41,7 +41,7 @@ import com.gh.gamecenter.databinding.CommentHeadItemBinding;
import com.gh.gamecenter.databinding.NewsDigestItemBinding;
import com.gh.gamecenter.entity.ArticleCommentParent;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.feature.entity.ConcernEntity;
import com.gh.gamecenter.eventbus.EBDeleteComment;
import com.gh.gamecenter.manager.VisitManager;
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;

View File

@ -31,6 +31,8 @@ class GameHeadViewHolder(var binding: GameHeadItemBinding) :
binding.arrowIv.visibility = View.GONE
val text = if ("change" == subject.home) {
"换一批"
} else if (subject.type == "game_list_collection" && subject.style?.contains("slide") == true) {
"游戏单广场"
} else {
when (subject.home) {
"more" -> "更多"
@ -62,7 +64,7 @@ class GameHeadViewHolder(var binding: GameHeadItemBinding) :
} else {
binding.headMore.visibility = View.VISIBLE
}
if (binding.headMore.visibility == View.VISIBLE && (binding.headMore.text == "更多" || binding.headMore.text == "全部")) {
if (binding.headMore.visibility == View.VISIBLE && (binding.headMore.text == "更多" || binding.headMore.text == "全部" || binding.headMore.text == "游戏单广场")) {
binding.arrowIv.visibility = View.VISIBLE
}
binding.headTitle.setTextColor(R.color.text_title.toColor(binding.root.context))

View File

@ -3,7 +3,7 @@ package com.gh.gamecenter.adapter.viewholder;
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder;
import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.databinding.NewsDigestItemBinding;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.feature.entity.ConcernEntity;
/**
* Created by Administrator on 2016/9/8.

View File

@ -24,7 +24,7 @@ import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.MtaHelper
import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.databinding.AmwayCommentItemBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.game.GameItemViewHolder
@ -42,7 +42,7 @@ import java.util.regex.Pattern
class AmwayAdapter(
context: Context,
private var mViewModel: AmwayViewModel,
private var mBasicExposureSource: List<ExposureSource>,
private var mBasicExposureSource: ArrayList<ExposureSource>,
private var mUseAlternativeLayout: Boolean,
private var mLayoutManager: RecyclerView.LayoutManager
) : ListAdapter<AmwayListItemData>(context), IExposable {

View File

@ -32,8 +32,8 @@ import com.gh.gamecenter.core.utils.TimeElapsedHelper
import com.gh.gamecenter.databinding.FragmentAmwayAlBinding
import com.gh.gamecenter.databinding.FragmentAmwayBinding
import com.gh.gamecenter.entity.RatingComment
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.gh.gamecenter.fragment.HomeSearchToolWrapperFragment
import com.gh.gamecenter.gamedetail.rating.RatingFragment
import com.google.android.material.appbar.AppBarLayout

View File

@ -15,7 +15,7 @@ import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource

View File

@ -21,8 +21,8 @@ import com.gh.gamecenter.databinding.FragmentCatalogListBinding
import com.gh.gamecenter.entity.CatalogEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.entity.SubjectSettingEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import org.greenrobot.eventbus.Subscribe

View File

@ -184,6 +184,7 @@ class SpecialCatalogAdapter(
specialLink.link,
specialLink.text,
false,
null,
"(游戏-专题:" + specialLink.text + "-全部)"
)
}

View File

@ -15,7 +15,7 @@ import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource

View File

@ -23,8 +23,8 @@ import com.gh.gamecenter.databinding.FragmentTagsBinding
import com.gh.gamecenter.entity.CategoryEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.entity.SubjectSettingEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import org.greenrobot.eventbus.Subscribe

View File

@ -24,7 +24,7 @@ import com.gh.gamecenter.core.utils.PageSwitchDataHelper
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.databinding.CategoryGameItemBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.lightgame.download.DownloadEntity
import org.json.JSONException

View File

@ -20,8 +20,8 @@ import com.gh.gamecenter.databinding.LayoutSelectedCategoryBinding
import com.gh.gamecenter.entity.CategoryEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.entity.SubjectSettingEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.google.android.flexbox.FlexboxLayout
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity

View File

@ -31,7 +31,7 @@ import com.gh.gamecenter.databinding.ItemRecommendInterestImageBinding
import com.gh.gamecenter.discovery.DiscoveryFragment.Companion.INTERESTED_GAME_REQUEST_CODE
import com.gh.gamecenter.discovery.interestedgame.InterestedGameActivity
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
@ -223,7 +223,7 @@ class DiscoveryAdapter(
val navBar = MainWrapperRepository.getInstance().getNavBarLiveData().value
if (navBar == null || mContext is DiscoveryActivity) {
val blockData = HomeBottomBarHelper.getDefaultGameBarData()
mContext.startActivity(BlockActivity.getIntent(mContext, blockData, mEntrance))
mContext.startActivity(BlockActivity.getIntent(mContext, blockData, mBaseExposureSource, mEntrance))
} else {
EventBus.getDefault()
.post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_GAME))

View File

@ -32,8 +32,8 @@ import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.databinding.LayoutDiscoveryGuideBinding
import com.gh.gamecenter.databinding.LayoutPopupDiscoveryDislikeBinding
import com.gh.gamecenter.eventbus.EBDiscoverChanged
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.google.android.flexbox.FlexboxLayout
import com.lightgame.download.DataWatcher

View File

@ -23,7 +23,7 @@ import com.gh.gamecenter.entity.HomePluggableFilterEntity
import com.gh.gamecenter.feature.entity.PluginLocation
import com.gh.gamecenter.eventbus.EBDownloadChanged
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.eventbus.EBUISwitch
import com.gh.gamecenter.common.eventbus.EBUISwitch
import com.gh.gamecenter.manager.PackagesManager
import com.lightgame.download.DownloadStatus
import org.greenrobot.eventbus.EventBus
@ -122,7 +122,12 @@ class DownloadFragment : BaseFragment_TabLayout() {
}
override fun onPageSelected(index: Int) {
EventBus.getDefault().post(EBUISwitch(DownloadManagerActivity.TAG, index))
EventBus.getDefault().post(
EBUISwitch(
DownloadManagerActivity.TAG,
index
)
)
if (index == INDEX_UPDATE) {
mIsUpdateTabHasBeenSelected = true

View File

@ -8,36 +8,36 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.common.xapk.XapkDialogHelper;
import com.gh.gamecenter.common.base.fragment.BaseFragment;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.xapk.XapkDialogHelper;
import com.gh.common.xapk.XapkInstaller;
import com.gh.common.xapk.XapkUnzipStatus;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.DownloadManagerActivity;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.base.fragment.BaseFragment;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.eventbus.EBMiPush;
import com.gh.gamecenter.common.eventbus.EBPackage;
import com.gh.gamecenter.common.eventbus.EBUISwitch;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.databinding.DownloadmanagerBinding;
import com.gh.gamecenter.eventbus.EBDownloadChanged;
import com.gh.gamecenter.common.eventbus.EBMiPush;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.fragment.MainWrapperFragment;
import com.halo.assistant.HaloApp;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadDao;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
@ -222,6 +222,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
protected void initView(View view) {
super.initView(view);
String path = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_PATH);
String pluginDesc = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_PLUGIN_DESC);
url = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_URL);
isScroll = false;
@ -297,7 +298,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
});
if (path != null) {
adapter.showPluginDialog(path);
adapter.showPluginDialog(path, pluginDesc);
}
mBinding.downloadmanagerTvAllstart.setOnClickListener(this);
}
@ -342,8 +343,8 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBMiPush mipush) {
if ("plugin_install".equals(mipush.getFrom())) {
String path = (String) mipush.getObj();
adapter.showPluginDialog(path);
DownloadEntity downloadEntity = (DownloadEntity) mipush.getObj();
adapter.showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
}
}

View File

@ -282,7 +282,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
final String path = downloadEntity.getPath();
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
showPluginDialog(downloadEntity.getPath());
showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
} else {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
@ -331,7 +331,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
final String path = downloadEntity.getPath();
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
showPluginDialog(downloadEntity.getPath());
showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
} else {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
@ -477,8 +477,8 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
// 显示插件化
void showPluginDialog(final String path) {
DialogHelper.showPluginDialog(mContext, () -> {
void showPluginDialog(final String path, final String pluginDesc) {
DialogHelper.showPluginDialog(mContext, pluginDesc, () -> {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
} else {

View File

@ -24,8 +24,8 @@ import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.databinding.FragmentMyGameBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.entity.GameInstall
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.manager.PackagesManager
import com.gh.gamecenter.packagehelper.PackageRepository

View File

@ -8,23 +8,23 @@ import android.widget.LinearLayout
import androidx.core.view.setPadding
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.common.exposure.IExposable
import com.gh.common.util.*
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.download.DownloadManager
import com.gh.download.dialog.DownloadDialog
import com.gh.gamecenter.DownloadManagerActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.entity.GameUpdateEntity
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.home.BlankDividerViewHolder
import com.gh.gamecenter.manager.PackagesManager
import com.lightgame.download.DownloadEntity

View File

@ -13,7 +13,7 @@ import com.gh.gamecenter.common.view.FixLinearLayoutManager
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.databinding.FragmentGameUpdatableBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.packagehelper.PackageRepository
import com.gh.gamecenter.packagehelper.PackageViewModel

View File

@ -0,0 +1,10 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.gamecollection.square.GameCollectionListItemData
data class GameListCollection(
var id: String = "",
var name: String = "",
var style: String = "",
var gameCollectionItemDataList: List<GameCollectionListItemData> = arrayListOf(),
)

View File

@ -15,7 +15,7 @@ data class HomeContent(
@SerializedName("link_column")
val linkColumn: SubjectEntity? = null,
@SerializedName("game_list")
val linkGameCollection: List<GamesCollectionEntity>? = null,
var linkGameCollection: List<HomeGameCollectionEntity>? = null,
@SerializedName("link_top_game_comment")
val linkTopGameComment: List<AmwayCommentEntity>? = null,
@SerializedName("display_content")
@ -35,4 +35,5 @@ data class HomeContent(
val recommendTag: String = "",
@SerializedName("ad_icon_active")
val adIconActive: Boolean = false,
var style: String = "",
)

View File

@ -0,0 +1,53 @@
package com.gh.gamecenter.entity
import android.os.Parcelable
import com.gh.gamecenter.feature.entity.*
import com.gh.gamecenter.feature.entity.TimeEntity
import com.gh.gamecenter.room.converter.*
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize
@Parcelize
data class HomeGameCollectionEntity(
@SerializedName("_id")
var id: String = "",
var games: ArrayList<GameEntity>? = null,
var title: String = "",
var intro: String = "",
var cover: String = "",
var display: String = "",//self_only: 仅自己可见
var stamp: String = "",//special_choice: 精选 offical: 官方
var count: Count? = null,
var user: User? = null,
var time: TimeEntity? = null,
@SerializedName("ad_icon_active")
var adIconActive: Boolean = false,
) : Parcelable {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as HomeGameCollectionEntity
// 这里只对比游戏单id判断是否相同
if (id != other.id) return false
return true
}
override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + (games?.hashCode() ?: 0)
result = 31 * result + title.hashCode()
result = 31 * result + intro.hashCode()
result = 31 * result + cover.hashCode()
result = 31 * result + display.hashCode()
result = 31 * result + stamp.hashCode()
result = 31 * result + (count?.hashCode() ?: 0)
result = 31 * result + (user?.hashCode() ?: 0)
result = 31 * result + (time?.hashCode() ?: 0)
result = 31 * result + adIconActive.hashCode()
return result
}
}

View File

@ -2,6 +2,7 @@ package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.Display
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.google.gson.annotations.SerializedName
data class HomeRecommend(
@ -13,7 +14,10 @@ data class HomeRecommend(
val linkText: String = "",
val icon: String = "",
val name: String = "",
val display: Display = Display()
val display: Display = Display(),
// 绑定的曝光实体
var exposureEvent: ExposureEvent? = null,
) {
fun transformLinkEntity(): LinkEntity {

View File

@ -41,7 +41,7 @@ data class SubjectEntity(
var verticalLine: String = "", // 竖排时才有数据,代表竖排行数控制
@SerializedName("game_list_collection")
var gameListCollection: List<GamesCollectionEntity>? = null,
var gameListCollection: List<HomeGameCollectionEntity>? = null,
@SerializedName("column_test_v2_data")
val testV2Data: HomeItemTestV2Entity? = null,

View File

@ -3,6 +3,7 @@ package com.gh.gamecenter.entity
import android.graphics.Color
import android.os.Parcelable
import com.gh.gamecenter.common.entity.Display
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize
@ -52,6 +53,7 @@ data class SubjectRecommendEntity(
var currentSelectColor: Int = 0,
var isTopViewShow: Boolean = true,
var isSlideEmpty: Boolean = false, // 首页轮播图是否为空
var exposureEvent: ExposureEvent? = null, // 绑定的曝光实体
) : Parcelable {
/*init {

View File

@ -2,6 +2,7 @@ package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.ToolBoxEntity
import com.gh.gamecenter.feature.entity.AnswerEntity
import com.gh.gamecenter.feature.entity.LibaoEntity
import com.google.gson.annotations.SerializedName
class UnifiedUserTrendEntity(

View File

@ -3,8 +3,8 @@ package com.gh.gamecenter.entity
import com.google.gson.annotations.SerializedName
class VSetting {
@SerializedName("va")
var va: Va? = null
var gsf: GApp? = null
class Va(
@SerializedName("32-bit")
@ -23,4 +23,9 @@ class VSetting {
val versionCode: Int,
val url: String
)
class GApp(
val url: String? = null,
var md5: String? = null
)
}

View File

@ -115,11 +115,6 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > Constants.FOLLOW_HINT_TRIGGER_HEIGHT) {
EventBus.getDefault().post(EBTypeChange(ForumDetailFragment.EB_HIDE_QUESTION_BUTTON, 0))
} else if (dy < -Constants.FOLLOW_HINT_TRIGGER_HEIGHT) {
EventBus.getDefault().post(EBTypeChange(ForumDetailFragment.EB_SHOW_QUESTION_BUTTON, 0))
}
if (dy != 0) scroll()
}
})

View File

@ -27,7 +27,7 @@ import com.gh.gamecenter.databinding.FragmentCommunityHomeBinding
import com.gh.gamecenter.databinding.TabItemCommunityBinding
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.eventbus.EBTypeChange
import com.gh.gamecenter.eventbus.EBUISwitch
import com.gh.gamecenter.common.eventbus.EBUISwitch
import com.gh.gamecenter.feature.entity.ArticleEntity
import com.gh.gamecenter.feature.entity.ForumVideoEntity
import com.gh.gamecenter.forum.search.ForumOrUserSearchActivity

View File

@ -96,11 +96,6 @@ class ForumArticleListFragment : LazyListFragment<ArticleEntity, ForumArticleLis
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (dy > Constants.FOLLOW_HINT_TRIGGER_HEIGHT) {
EventBus.getDefault().post(EBTypeChange(CommunityHomeFragment.EB_HIDE_QUESTION_BUTTON, 0))
} else if (dy < -Constants.FOLLOW_HINT_TRIGGER_HEIGHT) {
EventBus.getDefault().post(EBTypeChange(CommunityHomeFragment.EB_SHOW_QUESTION_BUTTON, 0))
}
if (dy != 0) scroll()
if (parentFragment is CommunityHomeFragment) {
(parentFragment as CommunityHomeFragment).translateTopBg(recyclerView.computeVerticalScrollOffset() - 8F.dip2px())

View File

@ -39,8 +39,8 @@ import com.gh.gamecenter.discovery.DiscoveryFragment
import com.gh.gamecenter.entity.HomePush
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.game.GameItemViewHolder
@ -1097,6 +1097,11 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
putInt(EntranceConsts.KEY_POSITION, 0)
putString(EntranceConsts.KEY_COLUMNNAME, tabEntity.text)
putBoolean(EntranceConsts.KEY_IS_COLUMN_COLLECTION, true)
putInt(EntranceConsts.KEY_TAB_INDEX, index)
putParcelableArrayList(
EntranceConsts.KEY_EXPOSURE_SOURCE_LIST,
arrayListOf(ExposureSource("顶部tab", tabEntity.name ?: ""))
)
})
"column" -> SubjectFragment().with(Bundle().apply {
@ -1121,6 +1126,11 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
putString(EntranceConsts.KEY_ENTRANCE, "首页顶部Tab栏")
putString(EntranceConsts.KEY_COLLECTION_ID, tabEntity.link)
putString(EntranceConsts.KEY_COLUMNNAME, tabEntity.text)
putInt(EntranceConsts.KEY_TAB_INDEX, index)
putParcelableArrayList(
EntranceConsts.KEY_EXPOSURE_SOURCE_LIST,
arrayListOf(ExposureSource("顶部tab", tabEntity.name ?: ""))
)
})
"explore_column" -> DiscoveryFragment().with(Bundle().apply {

View File

@ -57,7 +57,7 @@ import com.gh.gamecenter.entity.SubjectData;
import com.gh.gamecenter.entity.SubjectRecommendEntity;
import com.gh.gamecenter.entity.WelcomeDialogEntity;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.common.eventbus.EBUISwitch;
import com.gh.gamecenter.feature.entity.SettingsEntity;
import com.gh.gamecenter.feature.exposure.ExposureSource;
import com.gh.gamecenter.forum.home.CommunityHomeFragment;

View File

@ -41,7 +41,7 @@ import com.gh.gamecenter.MessageActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.SearchActivity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.common.eventbus.EBDownloadStatus;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.message.MessageUnreadViewModel;
import com.gh.gamecenter.packagehelper.PackageViewModel;

View File

@ -28,9 +28,9 @@ import com.gh.gamecenter.core.utils.MD5Utils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.databinding.FragmentGameBinding
import com.gh.gamecenter.eventbus.EBDiscoverChanged
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.eventbus.EBUISwitch
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBPackage
import com.gh.gamecenter.common.eventbus.EBUISwitch
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.game.data.GameItemData

View File

@ -44,7 +44,7 @@ import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.databinding.GameViewpagerItemBinding
import com.gh.gamecenter.entity.CommonCollectionContentEntity
import com.gh.gamecenter.entity.GameNavigationEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.databinding.GameItemBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
@ -68,12 +68,14 @@ import com.gh.gamecenter.game.rank.RankCollectionViewHolder
import com.gh.gamecenter.game.vertical.GameVerticalAdapter
import com.gh.gamecenter.game.vertical.GameVerticalSlideViewHolder
import com.gh.gamecenter.game.vertical.OnPagerSnapScrollListener
import com.gh.gamecenter.home.BlankDividerViewHolder
import com.gh.gamecenter.home.HomeDividerViewHolder
import com.gh.gamecenter.home.HomeGameItemViewHolder
import com.gh.gamecenter.home.*
import com.gh.gamecenter.home.discovercard.DiscoverCardGameAdapter
import com.gh.gamecenter.home.discovercard.HomeDiscoverCardViewHolder
import com.gh.gamecenter.home.gamecollection.HomeGameCollectionViewHolder
import com.gh.gamecenter.home.gamecollection.carousel.HomeGameCollectionCarouselViewHolder
import com.gh.gamecenter.home.gamecollection.refresh.HomeGameCollectionRefreshAdapter
import com.gh.gamecenter.home.gamecollection.refresh.HomeGameCollectionRefreshViewHolder
import com.gh.gamecenter.home.gamecollection.slide.HomeGameCollectionSlideAdapter
import com.gh.gamecenter.home.gamecollection.slide.HomeGameCollectionSlideViewHolder
import com.gh.gamecenter.home.horizontalslidevideo.HomeHorizontalSlideVideoAdapter
import com.gh.gamecenter.home.horizontalslidevideo.HomeHorizontalSlideVideoListViewHolder
import com.gh.gamecenter.home.test_v2.HomeGameTestV2GameListRvAdapter
@ -91,7 +93,7 @@ class GameFragmentAdapter(
model: GameViewModel,
private val mLifecycleOwner: LifecycleOwner,
private val mHomeGameTestV2ViewModel: HomeGameTestV2ViewModel,
private val mBasicExposureSource: List<ExposureSource>,
private val mBasicExposureSource: ArrayList<ExposureSource>,
private val mLayoutManager: LinearLayoutManager?,
private val mScrollCalculatorHelper: ScrollCalculatorHelper? = null
) : BaseRecyclerAdapter<ViewHolder>(context), IExposable {
@ -140,7 +142,16 @@ class GameFragmentAdapter(
if (itemData.gallerySlide != null) return ItemViewType.GALLERY_SLIDE
if (itemData.blankDivider != null) return ItemViewType.BLANK_DIVIDER
if (itemData.rankCollection != null) return ItemViewType.RANK_COLLECTION
if (itemData.gameCollection != null) return ItemViewType.GAME_COLLECTION_ITEM
if (itemData.gameCollection != null) {
return when (itemData.gameCollection!!.style) {
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_CAROUSEL_STYLE -> ItemViewType.GAME_COLLECTION_CAROUSEL
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_BIG_SLIDE_STYLE -> ItemViewType.GAME_COLLECTION_BIG_SLIDE
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_SMALL_SLIDE_STYLE -> ItemViewType.GAME_COLLECTION_SMALL_SLIDE
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_HORIZONTAL_REFRESH_STYLE -> ItemViewType.GAME_COLLECTION_HORIZONTAL_REFRESH
LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_VERTICAL_REFRESH_STYLE -> ItemViewType.GAME_COLLECTION_VERTICAL_REFRESH
else -> ItemViewType.GAME_COLLECTION_CAROUSEL // style为空时默认展示轮播图
}
}
if (itemData.doubleCardColumn != null) return ItemViewType.DOUBLE_CARD_COLUMN
if (itemData.bigImageRecommend != null) return ItemViewType.BIG_IMAGE_RECOMMEND
if (itemData.attachGame != null) return ItemViewType.GAME_ITEM
@ -160,6 +171,7 @@ class GameFragmentAdapter(
GameViewpagerItemBinding.bind(mLayoutInflater.inflate(R.layout.game_viewpager_item, parent, false))
GameViewPagerViewHolder(view, displayMetrics)
}
ItemViewType.LOADING -> {
FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false))
}
@ -176,11 +188,12 @@ class GameFragmentAdapter(
ItemViewType.GALLERY -> GameGalleryViewHolder(
GameGalleryViewHolder.GameGalleryItemCell(mContext).apply { inflate() }
)
ItemViewType.BLANK_DIVIDER -> BlankDividerViewHolder(parent.toBinding())
ItemViewType.COMMON_LINK_COLLECTION -> CommonCollectionViewHolder(parent.toBinding())
ItemViewType.COMMON_LINK_COLLECTION12 -> CommonCollection12ViewHolder(parent.toBinding())
ItemViewType.RANK_COLLECTION -> RankCollectionViewHolder(parent.toBinding())
ItemViewType.GAME_COLLECTION_ITEM -> HomeGameCollectionViewHolder(parent.toBinding())
ItemViewType.GAME_COLLECTION_CAROUSEL -> HomeGameCollectionCarouselViewHolder(parent.toBinding())
ItemViewType.DOUBLE_CARD_COLUMN -> DoubleCardViewHolder(parent.toBinding())
ItemViewType.BIG_IMAGE_RECOMMEND -> BigImageRecommendViewHolder(parent.toBinding())
ItemViewType.GAME_ITEM -> HomeGameItemViewHolder(parent.toBinding())
@ -191,7 +204,13 @@ class GameFragmentAdapter(
mHomeGameTestV2ViewModel,
mLifecycleOwner
)
ItemViewType.HORIZONTAL_SLIDE_VIDEO -> HomeHorizontalSlideVideoListViewHolder(parent.toBinding())
ItemViewType.GAME_COLLECTION_BIG_SLIDE,
ItemViewType.GAME_COLLECTION_SMALL_SLIDE -> HomeGameCollectionSlideViewHolder(parent.toBinding())
ItemViewType.GAME_COLLECTION_HORIZONTAL_REFRESH,
ItemViewType.GAME_COLLECTION_VERTICAL_REFRESH -> HomeGameCollectionRefreshViewHolder(parent.toBinding())
else -> GameItemViewHolder(GameItemBinding.bind(mLayoutInflater.inflate(R.layout.game_item, parent, false)))
}
@ -215,7 +234,7 @@ class GameFragmentAdapter(
is CommonCollectionViewHolder -> bindCommonCollection(holder, position)
is CommonCollection12ViewHolder -> bindCommonCollection(holder, position)
is RankCollectionViewHolder -> bindRankCollection(holder, position)
is HomeGameCollectionViewHolder -> bindGameCollection(holder, position)
is HomeGameCollectionCarouselViewHolder -> bindGameCollectionCarousel(holder, position)
is DoubleCardViewHolder -> bindGameDoubleCard(holder, position)
is BigImageRecommendViewHolder -> bindBigImageRecommend(holder, position)
is HomeGameItemViewHolder -> bindAttachGame(holder, position)
@ -223,6 +242,8 @@ class GameFragmentAdapter(
is HomeDiscoverCardViewHolder -> bindDiscoverCard(holder, position)
is HomeItemGameTestV2ViewHolder -> bindGameTestV2ViewHolder(holder, position)
is HomeHorizontalSlideVideoListViewHolder -> bindHomeHorizontalSlideVideo(holder, position)
is HomeGameCollectionSlideViewHolder -> bindGameCollectionSlide(holder, position)
is HomeGameCollectionRefreshViewHolder -> bindGameCollectionRefresh(holder, position)
}
}
@ -267,24 +288,27 @@ class GameFragmentAdapter(
}
private fun bindColumnCollection(holder: GameColumnCollectionViewHolder, position: Int) {
val itemData = mItemDataList[position]
val columnCollection = mItemDataList[position].columnCollection!!
// 重置曝光列表
mItemDataList[position].exposureEventList = arrayListOf()
val clickClosure: (position: Int, gameEntity: GameEntity) -> Unit = { prefixedPosition, gameEntity ->
// 类型为排行榜时点击处理不一样
if (columnCollection.style == "top") {
MtaHelper.onEvent("游戏专题合集", "首页合集图片", columnCollection.name)
DirectUtils.directToColumnCollection(
mContext, columnCollection.id
?: "", prefixedPosition, "(首页游戏)"
)
} else {
MtaHelper.onEvent("游戏专题合集", "首页合集图片", gameEntity.name)
setPageSwitchData()
DirectUtils.directToLinkPage(
mContext,
LinkEntity(link = gameEntity.link, type = gameEntity.type),
"(首页游戏)",
"游戏-专题"
"游戏-专题",
gameEntity.exposureEvent
)
}
NewLogUtils.logColumnCategoryHomeContentClick(
@ -294,7 +318,10 @@ class GameFragmentAdapter(
)
}
holder.bindColumnCollection(columnCollection, clickClosure)
holder.bindColumnCollection(columnCollection, mBasicExposureSource, clickClosure) {
it.payload.outerSequence = itemData.columnCollection?.outerSequence
itemData.exposureEventList?.add(it)
}
val dataList = columnCollection.data!!
if (dataList.size == 1) {
@ -458,7 +485,13 @@ class GameFragmentAdapter(
DataCollectionUtils.uploadClick(mContext, subjectData?.name + "-列表", "游戏-专题", gameEntity.name)
GameDetailActivity.startGameDetailActivity(
mContext, gameEntity,
StringUtils.buildString("(游戏-专题:", subjectData?.name, "-列表[", (subjectData?.position).toString(), "])"),
StringUtils.buildString(
"(游戏-专题:",
subjectData?.name,
"-列表[",
(subjectData?.position).toString(),
"])"
),
traceEvent = gameEntity.exposureEvent
)
}
@ -697,10 +730,10 @@ class GameFragmentAdapter(
val blockData = mViewModel.blockData
val clickListener = OnViewClickListener<Int> { v, clickedPosition ->
if (clickedPosition is Int) {
MtaHelper.onEvent("推荐入口", blockData?.name, (clickedPosition + 1).toString())
if (clickedPosition < subjectDigestList?.size!!) {
val entity = subjectDigestList[clickedPosition]
val exposureEvent = entity.exposureEvent
setPageSwitchData(false)
@ -715,9 +748,20 @@ class GameFragmentAdapter(
mContext,
entity.link!!,
-1,
entrance
entrance,
"",
exposureEvent
)
"block" -> mContext.startActivity(BlockActivity.getIntent(mContext, entity, entrance))
"block" -> mContext.startActivity(
BlockActivity.getIntent(
mContext,
entity,
exposureEvent?.source?.toArrayList(),
entrance
)
)
"category" -> mContext.startActivity(
CategoryDirectoryActivity.getIntent(
mContext,
@ -725,12 +769,14 @@ class GameFragmentAdapter(
entity.text!!
)
)
"column" -> {
SubjectActivity.startSubjectActivity(
mContext,
entity.link,
entity.text,
entity.order,
exposureEvent?.source?.toArrayList(),
StringUtils.buildString(
"(游戏-专题:",
entity.name,
@ -741,15 +787,20 @@ class GameFragmentAdapter(
)
)
}
"game" -> GameDetailActivity.startGameDetailActivity(mContext, entity.link ?: "", entrance)
"game" -> GameDetailActivity.startGameDetailActivity(
mContext,
entity.link ?: "",
entrance,
exposureEvent
)
EntranceConsts.HOST_COMMUNITY -> DirectUtils.directToCommunity(
mContext,
CommunityEntity(entity.link!!, entity.text!!)
)
"top_game_comment" -> DirectUtils.directToAmway(mContext, null, entrance, "")
"server" -> mContext.startActivity(GameServersActivity.getIntent(mContext, entrance, ""))
//entity.type == "h5_game_center" -> DirectUtils.directLetoGameCenter(mContext)
// else -> DialogUtils.showLowVersionDialog(mContext)
"common_collection" -> {
val linkEntity =
LinkEntity(
@ -761,7 +812,7 @@ class GameFragmentAdapter(
blockId = blockData?.link ?: "",
blockName = blockData?.name ?: ""
)
DirectUtils.directToLinkPage(mContext, linkEntity, "板块推荐入口", "")
DirectUtils.directToLinkPage(mContext, linkEntity, "板块推荐入口", "", exposureEvent)
NewLogUtils.logAccessToCommonCollectionDetail(
entity.link ?: "",
entity.text ?: "",
@ -770,27 +821,29 @@ class GameFragmentAdapter(
blockData?.name ?: ""
)
}
"game_list_square" -> {
DirectUtils.directToGameCollectionSquare(
mContext,
"版块推荐入口",
blockData?.name ?: ""
blockData?.name ?: "",
)
}
else -> {
val linkEntity =
LinkEntity(
name = entity.name,
link = entity.link,
text = entity.text,
type = entity.type,
display = entity.display
)
val linkEntity = LinkEntity(
name = entity.name,
link = entity.link,
text = entity.text,
type = entity.type,
display = entity.display
)
DirectUtils.directToLinkPage(
mContext,
linkEntity,
entrance,
"",
exposureEvent = exposureEvent
)
}
}
@ -802,55 +855,53 @@ class GameFragmentAdapter(
}
}
binding.run {
if (mTopViewExposureEventList == null) {
mTopViewExposureEventList = arrayListOf()
mTopViewExposureEventList = arrayListOf()
subjectDigestList?.forEachIndexed { index, entity ->
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity(
containerId = blockData?.link ?: "",
containerType = ExposureEntity.BLOCK_ID
).also {
it.sequence = index
it.outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(
ExposureSource(
"推荐入口",
if (Config.isShowPlugin()) entity.name ?: "" else entity.nameNormal ?: ""
)
subjectDigestList?.forEachIndexed { index, entity ->
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity(
containerId = blockData?.link ?: "",
containerType = ExposureEntity.BLOCK_ID
).also {
it.sequence = index
it.outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(
ExposureSource(
"推荐入口",
if (Config.isShowPlugin()) entity.name ?: "" else entity.nameNormal ?: ""
)
)
event.payload.controlType = "推荐入口"
event.payload.controlName = if (Config.isShowPlugin()) entity.name else entity.nameNormal
event.payload.controlLinkType = entity.type
event.payload.controlLinkName = entity.text
mTopViewExposureEventList?.add(event)
}
val slideList = mItemDataList[position].slideList
slideList?.forEachIndexed { index, entity ->
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity(
containerId = blockData?.link ?: "",
containerType = ExposureEntity.BLOCK_ID
).also {
it.sequence = index
it.outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(ExposureSource("轮播图"))
)
event.payload.controlType = "轮播图"
event.payload.controlName = entity.name
event.payload.controlLinkType = entity.type
event.payload.controlLinkName = entity.text
mTopViewExposureEventList?.add(event)
}
mItemDataList[position].exposureEventList = mTopViewExposureEventList
} else {
mItemDataList[position].exposureEventList = mTopViewExposureEventList
)
event.payload.controlType = "推荐入口"
event.payload.controlName = if (Config.isShowPlugin()) entity.name else entity.nameNormal
event.payload.controlLinkType = entity.type
event.payload.controlLinkName = entity.text
entity.exposureEvent = event
mTopViewExposureEventList?.add(event)
}
val slideList = mItemDataList[position].slideList
slideList?.forEachIndexed { index, entity ->
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity(
containerId = blockData?.link ?: "",
containerType = ExposureEntity.BLOCK_ID
).also {
it.sequence = index
it.outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(ExposureSource("轮播图"))
)
event.payload.controlType = "轮播图"
event.payload.controlName = entity.name
event.payload.controlLinkType = entity.type
event.payload.controlLinkName = entity.text
mTopViewExposureEventList?.add(event)
}
mItemDataList[position].exposureEventList = mTopViewExposureEventList
viewpagerTvFailure.goneIf(subjectDigestList != null)
viewpagerTvFailure.setOnClickListener {
@ -1094,12 +1145,14 @@ class GameFragmentAdapter(
holder.binding.headPb.visibility = View.VISIBLE
mViewModel.changeSubjectGame(column.id!!)
}
"more" -> {
setPageSwitchData()
column.moreLink?.let { link ->
DirectUtils.directToLinkPage(it.context, link, "(板块)", "(游戏-专题:" + column.name + "-全部)")
}
}
else -> {
setPageSwitchData()
when (column.type) {
@ -1110,6 +1163,7 @@ class GameFragmentAdapter(
buttonType, column.name ?: "", column.id ?: "", "板块", mViewModel.blockData?.name ?: ""
)
}
"common_collection" -> {
val blockData = mViewModel.blockData
mContext.startActivity(
@ -1136,7 +1190,16 @@ class GameFragmentAdapter(
blockData?.name ?: ""
)
}
"game_list_collection" -> {
NewFlatLogUtils.logGameListCollectionClick(
"版块内容列表",
mViewModel.blockData?.name ?: "",
mViewModel.blockData?.link ?: "",
column.name ?: "",
column.id ?: "",
"游戏单广场"
)
DirectUtils.directToGameCollectionSquare(
mContext,
"版块内容列表",
@ -1145,6 +1208,7 @@ class GameFragmentAdapter(
collectionId = column.id ?: ""
)
}
"column_test_v2" -> {
//跳转到新游开测页面
val link = column.indexRightTopLink
@ -1176,6 +1240,7 @@ class GameFragmentAdapter(
}
}
}
else -> {
if (column.indexRightTopLink != null) {
val link = column.indexRightTopLink!!
@ -1193,6 +1258,7 @@ class GameFragmentAdapter(
column.id,
column.getFilterName(),
column.isOrder,
mBasicExposureSource,
"(游戏-专题:" + column.name + "-全部)"
)
}
@ -1204,42 +1270,82 @@ class GameFragmentAdapter(
}
}
private fun bindGameCollection(holder: HomeGameCollectionViewHolder, position: Int) {
val gameItemData = mItemDataList[position]
val gameCollectionItemDataList = gameItemData.gameCollection ?: listOf()
private fun getGameCollectionExposureEventList(itemData: GameItemData): ArrayList<ExposureEvent> {
val exposureList = arrayListOf<ExposureEvent>()
for (gameCollectionItemData in gameCollectionItemDataList) {
runOnIoThread(true) {
val gameCollection = gameCollectionItemData.gameCollectionItem
runOnIoThread(true) {
itemData.gameCollection?.gameCollectionItemDataList?.forEachIndexed { index, gameCollectionItemData ->
val gameCollection = gameCollectionItemData.homeGameCollectionItem
val gameCollectionSource =
listOf(ExposureSource("游戏单", "${gameCollection?.title} + ${gameCollection?.id}"))
val gameExposureList = arrayListOf<ExposureEvent>()
gameCollection?.games?.take(3)?.forEachIndexed { index, game ->
gameExposureList.add(
ExposureEvent.createEventWithSourceConcat(
gameEntity = game.toGameEntity().apply {
isAdData = gameCollection.adIconActive
outerSequence = gameCollectionItemData.outerSequence; sequence =
gameCollectionItemData.gameStartPosition + index + 1
},
basicSource = mBasicExposureSource,
source = gameCollectionSource
)
listOf(
ExposureSource("游戏单合集", itemData.gameCollection?.id ?: ""),
ExposureSource("游戏单", "${gameCollection?.title} + ${gameCollection?.id}")
)
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
gameEntity = GameEntity().apply {
isAdData = gameCollection?.adIconActive ?: false
outerSequence = gameCollectionItemData.outerSequence
sequence = index
},
basicSource = mBasicExposureSource,
source = gameCollectionSource
)
gameCollection?.games?.forEach {
it.exposureEvent = ExposureEvent.createEventWithSourceConcat(
gameEntity = it.apply {
isAdData = gameCollection.adIconActive
outerSequence = gameCollectionItemData.outerSequence
sequence = index
},
basicSource = mBasicExposureSource,
source = gameCollectionSource
)
}
gameCollectionItemData.exposureEventList = gameExposureList
exposureList.addAll(gameExposureList)
gameCollectionItemData.exposureEvent = exposureEvent
exposureList.add(exposureEvent)
}
}
return exposureList
}
private fun bindGameCollectionCarousel(holder: HomeGameCollectionCarouselViewHolder, position: Int) {
val gameItemData = mItemDataList[position]
gameItemData.exposureEventList = getGameCollectionExposureEventList(gameItemData)
gameItemData.gameCollection?.let {
holder.bindGameCollectionList(
it,
"版块内容列表",
mViewModel.blockData?.link ?: "",
mViewModel.blockData?.name ?: ""
)
}
}
private fun bindGameCollectionSlide(holder: HomeGameCollectionSlideViewHolder, position: Int) {
val gameItemData = mItemDataList[position]
gameItemData.exposureEventList = getGameCollectionExposureEventList(gameItemData)
gameItemData.gameCollection?.let {
holder.bindGameCollectionSlide(
it,
"版块内容列表",
mViewModel.blockData?.link ?: "",
mViewModel.blockData?.name ?: ""
)
}
}
private fun bindGameCollectionRefresh(holder: HomeGameCollectionRefreshViewHolder, position: Int) {
val gameItemData = mItemDataList[position]
gameItemData.exposureEventList = getGameCollectionExposureEventList(gameItemData)
gameItemData.gameCollection?.let {
holder.bindGameCollectionRefresh(
it,
"版块内容列表",
mViewModel.blockData?.link ?: "",
mViewModel.blockData?.name ?: ""
) {
mViewModel.changeGameCollectionRefresh(it.id)
}
}
gameItemData.exposureEventList = exposureList
holder.bindGameCollectionList(
gameCollectionItemDataList,
"版块内容列表",
mBasicExposureSource,
mViewModel.blockData?.link ?: "",
mViewModel.blockData?.name ?: ""
)
}
private fun bindGameDoubleCard(holder: DoubleCardViewHolder, position: Int) {
@ -1367,6 +1473,8 @@ class GameFragmentAdapter(
|| getItemViewType(gameAndPosition.position) == ItemViewType.DISCOVER_CARD
|| getItemViewType(gameAndPosition.position) == ItemViewType.COLUMN_TEST_V2
|| getItemViewType(gameAndPosition.position) == ItemViewType.HORIZONTAL_SLIDE_VIDEO
|| getItemViewType(gameAndPosition.position) == ItemViewType.GAME_COLLECTION_BIG_SLIDE
|| getItemViewType(gameAndPosition.position) == ItemViewType.GAME_COLLECTION_VERTICAL_REFRESH
) {
val view = mLayoutManager?.findViewByPosition(gameAndPosition.position)
val recyclerView = view?.findViewById<RecyclerView>(R.id.recycler_view)
@ -1376,6 +1484,8 @@ class GameFragmentAdapter(
is DiscoverCardGameAdapter -> adapter.notifyItemByDownload(download)
is HomeGameTestV2GameListRvAdapter -> adapter.notifyItemByDownload(download)
is HomeHorizontalSlideVideoAdapter -> adapter.notifyItemByDownload(download)
is HomeGameCollectionSlideAdapter -> adapter.notifyItemByDownload(download)
is HomeGameCollectionRefreshAdapter -> adapter.notifyItemByDownload(download)
}
} else {
notifyItemChanged(gameAndPosition.position)
@ -1500,6 +1610,20 @@ class GameFragmentAdapter(
continue
}
val gameListCollection = mItemDataList[position].gameCollection
if (gameListCollection != null) {
gameListCollection.gameCollectionItemDataList.forEach { gameCollectionItemData ->
gameCollectionItemData.homeGameCollectionItem?.games?.forEach {
for (apkEntity in it.getApk()) {
if (apkEntity.packageName == packageName) {
positionList.add(GameAndPosition(it, position))
}
}
}
}
continue
}
val image = mItemDataList[position].image
if (image != null) positionList.add(GameAndPosition(image, position))
}

View File

@ -15,10 +15,7 @@ import com.gh.gamecenter.common.entity.ExposureEntity
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.countOccurrences
import com.gh.gamecenter.common.utils.debugOnly
import com.gh.gamecenter.common.utils.observableToMain
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.iinterface.IOffsetable
import com.gh.gamecenter.core.utils.RandomUtils
import com.gh.gamecenter.core.utils.SPUtils
@ -31,6 +28,7 @@ import com.gh.gamecenter.game.data.GameItemData
import com.gh.gamecenter.game.rank.RankCollectionAdapter
import com.gh.gamecenter.gamecollection.square.GameCollectionListItemData
import com.gh.gamecenter.home.BlankDividerViewHolder
import com.gh.gamecenter.home.LegacyHomeFragmentAdapterAssistant
import com.gh.gamecenter.home.test_v2.HomeGameTestV2DownloadStateUpdateHelper
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
@ -56,6 +54,8 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
private val mItemDataListCache: MutableList<GameItemData> = ArrayList()
private val mSubjectChangedMap: ArrayMap<String, List<GameEntity>> = ArrayMap() // 存储换一换的数据
private val mSubjectRefreshMap: ArrayMap<String, MutableList<GameEntity>> = ArrayMap() // 存储专题刷新数据
private val mRefreshGameCollectionMap: ArrayMap<String, List<HomeGameCollectionEntity>> = ArrayMap() // 存储刷新轮换游戏单的数据
private val mRefreshGameCollectionPageMap: ArrayMap<String, Int> = ArrayMap() // 存储刷新轮换游戏单的次数
private var mSmartSubject: SubjectEntity? = null // 猜你喜欢专题
private var mDiscoveryGameCard: DiscoveryGameCardEntity? = null
private var mDiscoveryGameCardLabels: List<DiscoveryGameCardLabel>? = null
@ -595,6 +595,44 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
}
}
fun changeGameCollectionRefresh(collectionId: String): Boolean {
val page = (mRefreshGameCollectionPageMap[collectionId] ?: 1) + 1
return if (page != 0) {
getGameCollectionRefresh(collectionId, page)
true // 表示需要从接口获取数据
} else {
false // 表示已加载完毕
}
}
private fun getGameCollectionRefresh(collectionId: String, page: Int) {
mSensitiveApi.getGameCollectionRefresh(collectionId, "block", page, 1)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<List<HomeGameCollectionEntity>>() {
override fun onResponse(response: List<HomeGameCollectionEntity>?) {
if (response != null) {
if (response.isNotEmpty()) {
mRefreshGameCollectionPageMap[collectionId] = page
mRefreshGameCollectionMap[collectionId] = mRefreshGameCollectionMap[collectionId]?.let {
ArrayList(it).apply {
addAll(response)
}
}
} else {
// -1 表示加载完毕
mRefreshGameCollectionPageMap[collectionId] = -1
}
transformationItemData()
}
}
override fun onFailure(e: HttpException?) {
Utils.toast(getApplication(), "网络异常")
}
})
}
private fun transformationItemData() {
mItemDataListCache.clear()
positionAndPackageMap.clear()
@ -724,7 +762,8 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
&& subjectEntity.type != "news"
&& subjectEntity.type != "game"
&& subjectEntity.type != "video"
&& subjectEntity.type != "game_explore")
&& subjectEntity.type != "game_explore"
&& subjectEntity.type != "game_list_collection")
|| (subjectEntity.type == "column_collection" && subjectEntity.style != "top")
) {
val itemDataHead = GameItemData()
@ -954,26 +993,56 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
val gameCollectionItem = GameItemData()
val itemDataList = arrayListOf<GameCollectionListItemData>().apply {
if (!subjectEntity.gameListCollection.isNullOrEmpty()) {
var position = 0
if (subjectEntity.style?.contains("refresh") == true) {
if (mRefreshGameCollectionMap[subjectEntity.id] == null) {
mRefreshGameCollectionMap[subjectEntity.id] = subjectEntity.gameListCollection
mRefreshGameCollectionPageMap[subjectEntity.id] = 1
} else {
subjectEntity.gameListCollection = mRefreshGameCollectionMap[subjectEntity.id]
}
}
for (item in subjectEntity.gameListCollection!!) {
item.games = RegionSettingHelper.filterSimpleGame(item.games)
add(
GameCollectionListItemData(
gameCollectionItem = item,
gameStartPosition = position,
outerSequence = subjectEntity.outerSequence + 1,
collectionId = subjectEntity.id ?: "",
collectionName = subjectEntity.name ?: "",
item.games = RegionSettingHelper.filterGame(item.games)
if (!item.games.isNullOrEmpty() || subjectEntity.style?.contains("carousel") == true) {
add(
GameCollectionListItemData(
homeGameCollectionItem = item,
outerSequence = index
)
)
)
position += if (item.count?.game!! > 2) 3 else if (item.games?.size == 0) 0 else
item.count?.game ?: 0
}
}
}
}
// 轮播图样式需要至少3个游戏单
if ((subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_CAROUSEL_STYLE && itemDataList.size >= 3) || subjectEntity.style != LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_CAROUSEL_STYLE) {
if (subjectEntity.style?.contains("refresh") == false) {
val head = GameItemData()
head.columnHead =
SubjectEntity(
id = subjectEntity.id,
type = subjectEntity.type,
name = subjectEntity.name,
adIconActive = subjectEntity.adIconActive,
style = subjectEntity.style
)
mItemDataListCache.add(head)
}
gameCollectionItem.gameCollection = GameListCollection(
id = subjectEntity.id ?: "",
name = subjectEntity.name ?: "",
style = subjectEntity.style ?: "",
gameCollectionItemDataList = itemDataList
)
mItemDataListCache.add(gameCollectionItem)
if (subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_BIG_SLIDE_STYLE || subjectEntity.style == LegacyHomeFragmentAdapterAssistant.GAME_COLLECTION_VERTICAL_REFRESH_STYLE) {
gameCollectionItem.gameCollection?.gameCollectionItemDataList?.forEach {
it.homeGameCollectionItem?.games?.forEach { game ->
addGamePositionAndPackage(game)
}
}
}
}
gameCollectionItem.gameCollection = itemDataList
appendAdditionalInfoToSubjectGame(subjectEntity, index)
mItemDataListCache.add(gameCollectionItem)
continue
}

View File

@ -9,12 +9,16 @@ import com.gh.gamecenter.common.view.WrapContentDraweeView
import com.gh.gamecenter.databinding.GameColumnCollectionItemBinding
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.lightgame.adapter.BaseRecyclerAdapter
class GameColumnCollectionAdapter(
context: Context,
private var mSubjectEntity: SubjectEntity,
private var mClickClosure: (position: Int, gameEntity: GameEntity) -> Unit
private var mBasicExposureSourceList: ArrayList<ExposureSource>,
private var mClickClosure: (position: Int, gameEntity: GameEntity) -> Unit,
private var mExposureClosure: (exposureEvent: ExposureEvent) -> Unit
) : BaseRecyclerAdapter<GameColumnCollectionItemViewHolder>(context) {
private var mCountAndKey: Pair<Int, String>? = null
@ -55,6 +59,17 @@ class GameColumnCollectionAdapter(
}
})
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
data,
mBasicExposureSourceList,
arrayListOf(ExposureSource("游戏专题合集","${mSubjectEntity.name}+${mSubjectEntity.id}"))
).apply {
payload.sequence = position
}
data.exposureEvent = exposureEvent
mExposureClosure.invoke(exposureEvent)
holder.binding.columnCollectionImage.setOnClickListener {
mClickClosure(position, data)
}

View File

@ -10,13 +10,17 @@ import com.gh.gamecenter.common.view.SpacingItemDecoration
import com.gh.gamecenter.databinding.GameColumnCollectionListBinding
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
class GameColumnCollectionViewHolder(val binding: GameColumnCollectionListBinding) :
BaseRecyclerViewHolder<Any>(binding.root) {
fun bindColumnCollection(
columnCollection: SubjectEntity,
clickClosure: (position: Int, gameEntity: GameEntity) -> Unit
basicExposureList: ArrayList<ExposureSource>,
clickClosure: (position: Int, gameEntity: GameEntity) -> Unit,
exposureClosure: (exposureEvent: ExposureEvent) -> Unit
) {
val context = binding.root.context
val dataList = columnCollection.data!!
@ -32,7 +36,7 @@ class GameColumnCollectionViewHolder(val binding: GameColumnCollectionListBindin
binding.columnCollectionList.visibility = View.VISIBLE
var slideAdapter = binding.columnCollectionList.adapter
if (slideAdapter == null) {
slideAdapter = GameColumnCollectionAdapter(context, columnCollection, clickClosure)
slideAdapter = GameColumnCollectionAdapter(context, columnCollection, basicExposureList, clickClosure, exposureClosure)
binding.columnCollectionList.layoutManager =
LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
binding.columnCollectionList.addItemDecoration(

View File

@ -1,14 +1,15 @@
package com.gh.gamecenter.game.columncollection.detail
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.catalog.CatalogActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
/**
* 游戏专题合集详情页
*/
class ColumnCollectionDetailActivity : ToolBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@ -40,29 +41,4 @@ class ColumnCollectionDetailActivity : ToolBarActivity() {
}
}
companion object {
/**
* [position] 当专题合集是排行榜(多专题)类型时的起始位置
*/
fun getIntent(
context: Context,
collectionId: String,
position: Int = -1,
entrance: String = "",
columnName: String = ""
): Intent {
val bundle = Bundle()
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
bundle.putString(EntranceConsts.KEY_COLLECTION_ID, collectionId)
bundle.putInt(EntranceConsts.KEY_POSITION, position)
bundle.putString(EntranceConsts.KEY_COLUMNNAME, columnName)
return getTargetIntent(
context,
CatalogActivity::class.java,
ColumnCollectionDetailFragment::class.java,
bundle
)
}
}
}

View File

@ -1,10 +1,12 @@
package com.gh.gamecenter.game.columncollection.detail
import android.content.Context
import android.util.SparseArray
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.gh.common.exposure.IExposable
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.common.util.DirectUtils
import com.gh.common.util.NewLogUtils
@ -17,12 +19,18 @@ import com.gh.gamecenter.adapter.viewholder.GameColumnCollectionItemViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.databinding.GameColumnCollectionItemBinding
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
class ColumnCollectionDetailAdapter(
context: Context,
private val mViewModel: ColumnCollectionDetailViewModel,
private var mTabIndex: Int,
private val mBasicExposureSourceList: ArrayList<ExposureSource>?,
private val mEntrance: String,
) : ListAdapter<LinkEntity>(context) {
) : ListAdapter<LinkEntity>(context), IExposable {
private var mExposureSparseArray = SparseArray<ExposureEvent>()
override fun areItemsTheSame(oldItem: LinkEntity?, newItem: LinkEntity?): Boolean {
return oldItem == newItem
@ -66,12 +74,21 @@ class ColumnCollectionDetailAdapter(
Pair(PageSwitchDataHelper.PAGE_BUSINESS_NAME, mViewModel.columnCollection.value?.name ?: "")
)
)
DirectUtils.directToLinkPage(mContext, data, mEntrance, "专题合集")
DirectUtils.directToLinkPage(mContext, data, mEntrance, "专题合集", mExposureSparseArray.get(position))
NewLogUtils.logColumnCategoryDetailContentClick(
data.name ?: "", data?.link ?: "",
mViewModel.columnCollection.value?.name ?: "", mViewModel.collectionId
)
}
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
null,
mBasicExposureSourceList ?: arrayListOf(),
arrayListOf(ExposureSource("游戏专题合集", "${mViewModel.getGameColumnCollectionName()}+${mViewModel.collectionId}"))
).apply {
payload.outerSequence = mTabIndex
payload.sequence = position
}
mExposureSparseArray.put(position, exposureEvent)
} else if (holder is FooterViewHolder) {
holder.initFooterViewHolder(mViewModel, mIsLoading, mIsNetworkError, mIsOver)
if (holder.itemView.layoutParams is StaggeredGridLayoutManager.LayoutParams) {
@ -79,4 +96,10 @@ class ColumnCollectionDetailAdapter(
}
}
}
override fun getEventByPosition(pos: Int): ExposureEvent? {
return mExposureSparseArray.get(pos)
}
override fun getEventListByPosition(pos: Int) = null
}

View File

@ -1,9 +1,11 @@
package com.gh.gamecenter.game.columncollection.detail
import android.os.Bundle
import android.view.View
import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.ethanhua.skeleton.Skeleton
import com.gh.common.exposure.ExposureListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.dip2px
@ -15,6 +17,7 @@ import com.gh.gamecenter.common.baselist.LazyListFragment
import com.gh.gamecenter.databinding.FragmentColumnCollectionDetailBinding
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.subject.tab.SubjectTabFragment
class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollectionDetailViewModel>() {
@ -22,6 +25,11 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
private var mAdapter: ColumnCollectionDetailAdapter? = null
private var mBinding: FragmentColumnCollectionDetailBinding? = null
private var mExposureListener: ExposureListener? = null
private var mTabIndex = -1
private var mBasicExposureSourceList : ArrayList<ExposureSource>? = null
override fun getItemDecoration() = null
override fun getRealLayoutId() = R.layout.fragment_column_collection_detail
@ -31,6 +39,13 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
mBinding = FragmentColumnCollectionDetailBinding.bind(inflatedView)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mTabIndex = arguments?.getInt(EntranceConsts.KEY_TAB_INDEX) ?: -1
mBasicExposureSourceList = arguments?.getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
}
override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible()
@ -57,8 +72,12 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
val gridLayoutManager =
StaggeredGridLayoutManager(mListViewModel.rowCount(), StaggeredGridLayoutManager.VERTICAL)
gridLayoutManager.gapStrategy = StaggeredGridLayoutManager.GAP_HANDLING_NONE
mExposureListener = ExposureListener(this, provideListAdapter())
mListRv.clipToPadding = false
mListRv.layoutManager = gridLayoutManager
mListRv.addOnScrollListener(mExposureListener!!)
if (mListViewModel.rowCount() == 1) {
mListRv.setPadding(16F.dip2px(), 0, 16F.dip2px(), 0)
mListRv.addItemDecoration(GridSpacingItemDecoration(mListViewModel.rowCount(), 16F.dip2px(), false))
@ -113,7 +132,7 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
override fun provideListAdapter(): ColumnCollectionDetailAdapter {
if (mAdapter == null) {
mAdapter = ColumnCollectionDetailAdapter(requireContext(), mListViewModel, mEntrance)
mAdapter = ColumnCollectionDetailAdapter(requireContext(), mListViewModel, mTabIndex, mBasicExposureSourceList, mEntrance)
}
return mAdapter!!
}

View File

@ -25,6 +25,7 @@ class ColumnCollectionDetailViewModel(
) : ListViewModel<LinkEntity, LinkEntity>(application) {
private val mSensitiveApi = RetrofitManager.getInstance().api
private var mCollectionName = ""
val collectionId: String
get() = mCollectionId
@ -41,6 +42,10 @@ class ColumnCollectionDetailViewModel(
mResultLiveData.addSource(mListLiveData) { mResultLiveData.postValue(it) }
}
fun getGameColumnCollectionName(): String {
return mCollectionName
}
@SuppressLint("CheckResult")
fun getGameColumnCollection() {
mSensitiveApi.getGameColumnCollection(mCollectionId)
@ -50,6 +55,7 @@ class ColumnCollectionDetailViewModel(
override fun onResponse(response: GameColumnCollection?) {
super.onResponse(response)
columnCollection.postValue(response)
mCollectionName = response?.name ?: ""
loadData()
}

View File

@ -28,6 +28,7 @@ class CommonCollectionDetailAdapter(
val mViewModel: CommonCollectionDetailViewModel,
val mBlockId: String,
val mBlockName: String,
val mTabIndex: Int,
val mEntrance: String,
private val mBasicExposureSource: List<ExposureSource>?
) : ListAdapter<CommonCollectionContentEntity>(context), IExposable {
@ -70,7 +71,13 @@ class CommonCollectionDetailAdapter(
val linkEntity = mEntityList[position].linkEntity
val listener: (v: View) -> Unit = {
DirectUtils.directToLinkPage(mContext, linkEntity, "通用链接合集详情", "")
DirectUtils.directToLinkPage(
mContext,
linkEntity,
"通用链接合集详情",
"",
mExposureEventSparseArray.get(position)
)
val commonLinkCollection = mViewModel.commonCollectionLiveData.value
NewLogUtils.logCommonCollectionClick(
commonLinkCollection?.id ?: "",
@ -110,11 +117,13 @@ class CommonCollectionDetailAdapter(
listOf(
ExposureSource(
"内容合集",
mViewModel.commonCollectionLiveData.value?.name ?: ""
"${mViewModel.commonCollectionLiveData.value?.name}+${mViewModel.commonCollectionLiveData.value?.id}"
),
ExposureSource("合集详情")
),
)
).apply {
this.payload.outerSequence = mTabIndex
}
)
}

View File

@ -32,6 +32,7 @@ class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollec
private lateinit var mBinding: FragmentListBaseSkeletonBinding
private var mBlockId = ""
private var mBlockName = ""
private var mTabIndexValue = 0 // 在首页的 tab 位置
override fun getRealLayoutId(): Int = R.layout.fragment_list_base_skeleton
@ -39,6 +40,7 @@ class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollec
super.onCreate(savedInstanceState)
mBlockId = requireArguments().getString(EntranceConsts.KEY_BLOCK_ID, "")
mBlockName = requireArguments().getString(EntranceConsts.KEY_BLOCK_NAME, "")
mTabIndexValue = requireArguments().getInt(EntranceConsts.KEY_TAB_INDEX, -1)
}
override fun onRealLayoutInflated(inflatedView: View) {
@ -56,6 +58,7 @@ class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollec
mViewModel,
mBlockId,
mBlockName,
mTabIndexValue,
mEntrance,
exposureEvent
)

View File

@ -28,7 +28,7 @@ class GameItemData : ExposureItemData {
var rankCollection: SubjectEntity? = null
var gameCollection: List<GameCollectionListItemData>? = null
var gameCollection: GameListCollection? = null
var doubleCardColumn: SubjectEntity? = null // 双列卡片专题

View File

@ -18,7 +18,7 @@ import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.RankGameItemBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.TagStyleEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.download.DownloadEntity
import java.util.*

View File

@ -14,7 +14,7 @@ import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.databinding.RankCollectionItemBinding
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.download.DownloadEntity

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.graphics.drawable.Drawable
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.gh.common.databind.BindingAdapters
import com.gh.common.util.DownloadItemUtils
import com.gh.gamecenter.R
@ -12,6 +13,7 @@ import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.AsyncUi
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.GameSubjectData
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.download.DownloadEntity
@ -21,7 +23,7 @@ class GameVerticalAdapter(
private var mSubjectEntity: SubjectEntity,
private var mItemClick: (Int, GameEntity) -> Unit,
private var mTransparentBackground: Boolean = false
) : BaseRecyclerAdapter<GameVerticalAdapter.SimpleGameItemViewHolder>(context) {
) : BaseRecyclerAdapter<ViewHolder>(context) {
private val mMaxWidth = mContext.resources.displayMetrics.widthPixels
private var countAndKey: Pair<Int, String>? = null
@ -50,114 +52,26 @@ class GameVerticalAdapter(
return mSubjectEntity.data!!.size - getIndex()
}
override fun onBindViewHolder(holder: SimpleGameItemViewHolder, position: Int) {
if (mTransparentBackground) holder.itemView.setBackgroundColor(R.color.transparent.toColor())
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
if (holder is SimpleGameItemViewHolder) {
if (mTransparentBackground) holder.itemView.setBackgroundColor(R.color.transparent.toColor())
val paddingStart = 16F.dip2px()
val isEndOfRow = position >= if (itemCount % mSubjectEntity.list == 0) {
itemCount - mSubjectEntity.list
} else {
itemCount - itemCount % mSubjectEntity.list
}
// 你可能会问为什么这下面会有一些,"加1减1" 的魔法。没错,这里的 "加1减1"就是为了规避 bug做出的一些 UI 补偿
// bug 的表现可以 checkout https://git.shanqu.cc/android/playground/-/tree/test-snap_adapter_culprit 代码,然后滑动到最后一列体验一下
var paddingEnd = if (isEndOfRow) 16F.dip2px() else 0F.dip2px()
val height = 80F.dip2px()
val gameEntity = mSubjectEntity.data!![position + getIndex()]
val subjectData = gameEntity.subjectData!!
holder.itemView.layoutParams = if (!isEndOfRow) {
paddingEnd += 1
ViewGroup.LayoutParams(mMaxWidth - 24F.dip2px(), height)
} else {
ViewGroup.LayoutParams(mMaxWidth - 1, height)
}
holder.bindSimpleGameItem(
this@GameVerticalAdapter,
gameEntity,
subjectData,
position,
mSubjectEntity.list,
mMaxWidth
)
val gameEntity = mSubjectEntity.data!![position + getIndex()]
val subjectData = gameEntity.subjectData!!
(holder.itemView as AsyncGameItemUi).bindWhenInflated {
(holder.itemView as AsyncGameItemUi).ui!!.run {
gameNameTv.setTextColor(R.color.text_title.toColor(mContext))
serverTypeTv.setTextColor(R.color.theme.toColor(mContext))
downloadTv.background = R.drawable.download_button_normal_style.toDrawable(mContext)
gameDesTv.setTextColor(R.color.text_subtitleDesc.toColor(mContext))
BindingAdapters.setGameName(
gameNameTv,
gameEntity,
false,
subjectData.isShowSuffix
)
BindingAdapters.setGame(iconIv, gameEntity)
BindingAdapters.setGameTags(gameTagContainer, gameEntity)
GameItemViewHolder.initServerType(gameNameTv, serverTypeTv, gameEntity)
gameDesTv.text = gameEntity.decoratedDes
GameItemViewHolder.initGameSubtitleAndAdLabel(
gameEntity,
gameSubtitleTv,
gameNameContainer,
gameNameTv,
gameEntity.adIconActive,
adLabelTv
)
var gameRatingPaddingEnd = 0
var gameRatingDrawableStart: Drawable? = null
var gameRatingTextColor = R.color.theme.toColor(mContext)
var gameRatingText = ""
gameRatingTv.textSize = if (gameEntity.commentCount > 3) 12F else 10F
if (gameEntity.commentCount > 3) {
gameRatingPaddingEnd = 8F.dip2px()
gameRatingDrawableStart = R.drawable.game_horizontal_rating.toDrawable()
gameRatingTextColor = R.color.theme_font.toColor(mContext)
gameRatingText =
if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString()
}
gameRatingTv.setDrawableStart(gameRatingDrawableStart)
gameRatingTv.setPadding(0, 0, gameRatingPaddingEnd, 0)
gameRatingTv.setTextColor(gameRatingTextColor)
gameRatingTv.text = gameRatingText
// 没错,产品就把这个通用样式叫推荐榜单专题
downloadTv.putWidgetBusinessName("推荐榜单专题")
// Fuck this view holder
val tempViewHolder =
holder.placeholderGameViewHolder ?: GameViewHolder(this@run.root).apply {
holder.placeholderGameViewHolder = this
}
tempViewHolder.gameDes = gameDesTv
tempViewHolder.gameDownloadBtn = downloadTv
tempViewHolder.multiVersionDownloadTv = multiVersionDownloadTv
tempViewHolder.gameDownloadTips = downloadTipsLottie
tempViewHolder.gameLabelList = gameTagContainer
tempViewHolder.recommendIv = recommendIv
tempViewHolder.recommendTv = recommendTv
tempViewHolder.recommendContainer = recommendConstraintLayout
tempViewHolder.gameServerType = serverTypeTv
DownloadItemUtils.updateItem(
mContext,
gameEntity,
tempViewHolder,
!gameEntity.isPluggable,
subjectData.briefStyle
)
DownloadItemUtils.setOnClickListener(
mContext, downloadTv, gameEntity, position,
this@GameVerticalAdapter, "", "", gameEntity.exposureEvent
)
root.setPadding(paddingStart, 8F.dip2px(), paddingEnd, 8F.dip2px())
holder.itemView.setOnClickListener {
mItemClick.invoke(position % mSubjectEntity.list, gameEntity)
}
}
holder.itemView.setOnClickListener {
mItemClick.invoke(position % mSubjectEntity.list, gameEntity)
}
}
fun checkResetData(updateData: SubjectEntity) {
@ -212,9 +126,120 @@ class GameVerticalAdapter(
override fun provideUi(context: Context) = GameItemUi(context)
}
class SimpleGameItemViewHolder(view: AsyncGameItemUi) :
RecyclerView.ViewHolder(view) {
class SimpleGameItemViewHolder(view: AsyncGameItemUi) : ViewHolder(view) {
var placeholderGameViewHolder: GameViewHolder? = null
fun bindSimpleGameItem(
adapter: RecyclerView.Adapter<ViewHolder>,
gameEntity: GameEntity,
subjectData: GameSubjectData? = null,
position: Int,
spanCount: Int,
maxWidth: Int,
entrance: String = "",
location: String = ""
) {
val context = itemView.context
val paddingStart = 16F.dip2px()
val isEndOfRow = position >= if (adapter.itemCount % spanCount == 0) {
adapter.itemCount - spanCount
} else {
adapter.itemCount - adapter.itemCount % spanCount
}
// 你可能会问为什么这下面会有一些,"加1减1" 的魔法。没错,这里的 "加1减1"就是为了规避 bug做出的一些 UI 补偿
// bug 的表现可以 checkout https://git.shanqu.cc/android/playground/-/tree/test-snap_adapter_culprit 代码,然后滑动到最后一列体验一下
var paddingEnd = if (isEndOfRow) 16F.dip2px() else 0F.dip2px()
val height = 80F.dip2px()
itemView.layoutParams = if (!isEndOfRow) {
paddingEnd += 1
ViewGroup.LayoutParams(maxWidth - 24F.dip2px(), height)
} else {
ViewGroup.LayoutParams(maxWidth - 1, height)
}
(itemView as AsyncGameItemUi).bindWhenInflated {
(itemView as AsyncGameItemUi).ui!!.run {
gameNameTv.setTextColor(R.color.text_title.toColor(context))
serverTypeTv.setTextColor(R.color.theme.toColor(context))
downloadTv.background = R.drawable.download_button_normal_style.toDrawable(context)
gameDesTv.setTextColor(R.color.text_subtitleDesc.toColor(context))
BindingAdapters.setGameName(
gameNameTv,
gameEntity,
false,
subjectData?.isShowSuffix
)
BindingAdapters.setGame(iconIv, gameEntity)
BindingAdapters.setGameTags(gameTagContainer, gameEntity)
GameItemViewHolder.initServerType(gameNameTv, serverTypeTv, gameEntity)
gameDesTv.text = gameEntity.decoratedDes
GameItemViewHolder.initGameSubtitleAndAdLabel(
gameEntity,
gameSubtitleTv,
gameNameContainer,
gameNameTv,
gameEntity.adIconActive,
adLabelTv
)
var gameRatingPaddingEnd = 0
var gameRatingDrawableStart: Drawable? = null
var gameRatingTextColor = R.color.theme.toColor(context)
var gameRatingText = ""
gameRatingTv.textSize = if (gameEntity.commentCount > 3) 12F else 10F
if (gameEntity.commentCount > 3) {
gameRatingPaddingEnd = 8F.dip2px()
gameRatingDrawableStart = R.drawable.game_horizontal_rating.toDrawable()
gameRatingTextColor = R.color.theme_font.toColor(context)
gameRatingText =
if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString()
}
gameRatingTv.setDrawableStart(gameRatingDrawableStart)
gameRatingTv.setPadding(0, 0, gameRatingPaddingEnd, 0)
gameRatingTv.setTextColor(gameRatingTextColor)
gameRatingTv.text = gameRatingText
// 没错,产品就把这个通用样式叫推荐榜单专题
downloadTv.putWidgetBusinessName("推荐榜单专题")
// Fuck this view holder
val tempViewHolder =
placeholderGameViewHolder ?: GameViewHolder(this@run.root).apply {
placeholderGameViewHolder = this
}
tempViewHolder.gameDes = gameDesTv
tempViewHolder.gameDownloadBtn = downloadTv
tempViewHolder.multiVersionDownloadTv = multiVersionDownloadTv
tempViewHolder.gameDownloadTips = downloadTipsLottie
tempViewHolder.gameLabelList = gameTagContainer
tempViewHolder.recommendIv = recommendIv
tempViewHolder.recommendTv = recommendTv
tempViewHolder.recommendContainer = recommendConstraintLayout
tempViewHolder.gameServerType = serverTypeTv
DownloadItemUtils.updateItem(
context,
gameEntity,
tempViewHolder,
!gameEntity.isPluggable,
subjectData?.briefStyle
)
DownloadItemUtils.setOnClickListener(
context, downloadTv, gameEntity, position,
adapter, entrance, location, gameEntity.exposureEvent
)
root.setPadding(paddingStart, 8F.dip2px(), paddingEnd, 8F.dip2px())
}
}
}
}
}

View File

@ -34,7 +34,7 @@ import com.gh.gamecenter.databinding.GameCollectionGameItemBinding
import com.gh.gamecenter.databinding.ItemArticleDetailCommentBinding
import com.gh.gamecenter.databinding.LayoutGameCollectionAuthTagBinding
import com.gh.gamecenter.entity.CommentEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.common.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource

Some files were not shown because too many files have changed in this diff Show More