Compare commits
279 Commits
v5.24.3-83
...
delete
| Author | SHA1 | Date | |
|---|---|---|---|
| 684dbcfd87 | |||
| 4f8b961e2c | |||
| 58a7f7c3fa | |||
| ae8267d96d | |||
| e20af462b7 | |||
| e2773ed8c7 | |||
| c77e5ca56b | |||
| e78c23ca4f | |||
| b790d71aa5 | |||
| 5c91023a68 | |||
| 2eae71bc96 | |||
| 909477ec7f | |||
| a5da376f62 | |||
| d084cb1c34 | |||
| 411bf3561f | |||
| 610c006aeb | |||
| ffa81bc4c1 | |||
| 67477ac20a | |||
| a6a16e4694 | |||
| 8f8352dc12 | |||
| 1bbbe575f2 | |||
| 5975d9850f | |||
| ef001b0a77 | |||
| fd49ecbc8a | |||
| d683969eda | |||
| f8527da9df | |||
| f50d901171 | |||
| 71db870bd2 | |||
| b4c550f71b | |||
| 91bde61054 | |||
| d7940121ee | |||
| ef9c473301 | |||
| 2c82437449 | |||
| 311e5e4225 | |||
| 91864e3681 | |||
| 5e66db7435 | |||
| e7c74d3f39 | |||
| d0fa02b221 | |||
| 70e4378ef0 | |||
| f8ee943678 | |||
| 918aa17fbd | |||
| 0a7a3d9878 | |||
| b6a823e793 | |||
| 9a95a4623d | |||
| 206bc1bfcc | |||
| 4045e42a7b | |||
| 15f283d330 | |||
| 97bafee09e | |||
| e32745d9d7 | |||
| c37a54ac89 | |||
| 607d514ae9 | |||
| 62ee0b4a6e | |||
| 11ff054520 | |||
| e96fc0f3b4 | |||
| a7875b21c9 | |||
| e53154c810 | |||
| e1d89725bc | |||
| 1d3ec9eff6 | |||
| 0403743533 | |||
| 1f25b932d5 | |||
| d3545bc766 | |||
| b2b858c403 | |||
| debbe08262 | |||
| 4e746a2b16 | |||
| b86e372e5b | |||
| f65e76a94a | |||
| 05c8de827e | |||
| 78eb10fa3c | |||
| 23dfb7378b | |||
| 0e2e175194 | |||
| 9050a04c3a | |||
| 57df50b0a2 | |||
| 4ff21914c1 | |||
| 0dec30ff56 | |||
| 4bdfe6e190 | |||
| 55813cdaae | |||
| 8668b2b4ec | |||
| b758658ea6 | |||
| 4ca9c32762 | |||
| af8fdd5d65 | |||
| 36dd4f5a82 | |||
| c7161e3483 | |||
| bffaaffc56 | |||
| 3257dd4c53 | |||
| 6793945606 | |||
| 52be14a4ef | |||
| e2cb5a31cf | |||
| d807b7973b | |||
| 1fb0d13646 | |||
| 68a3eadfeb | |||
| a2d904c634 | |||
| 56cd1bdad7 | |||
| 999e1a3ad8 | |||
| 8b4f71bc75 | |||
| be937703b8 | |||
| aa069b7a21 | |||
| f89914746a | |||
| fb0db2feee | |||
| 250dba9198 | |||
| 4c531b40b0 | |||
| 875a84b5ae | |||
| 77b9b731e2 | |||
| bd11481c2d | |||
| a3f1b09da1 | |||
| 1798dfb64d | |||
| 8e5814d389 | |||
| 14c01cf171 | |||
| c800dac1ec | |||
| 88448b7b8d | |||
| 77a1e5fea7 | |||
| ef0a212b85 | |||
| 2ee4ad6752 | |||
| 9173a73ed0 | |||
| 5d8e208ef8 | |||
| 309111c422 | |||
| 3c3a228500 | |||
| 33a5e2061f | |||
| b62b1f399c | |||
| c4449db90a | |||
| 6edd9f2204 | |||
| 8508b9ece2 | |||
| 20d5ef7a6e | |||
| ff70d7a48a | |||
| 4bc2374cb4 | |||
| 73d7a38886 | |||
| 8efa858a01 | |||
| 53e2297976 | |||
| 9cd5e342ac | |||
| 26dfb79ece | |||
| e1f70ce788 | |||
| 7bc36814b7 | |||
| b29651ecfb | |||
| 74aad0e7e0 | |||
| 52a5faacfe | |||
| 5cee489ba6 | |||
| f76c3e3638 | |||
| fe5b93c35a | |||
| 74c3e7a10d | |||
| deb2b07644 | |||
| 386a7f82d9 | |||
| c6b433d09c | |||
| c556a127f5 | |||
| 94983c4b7f | |||
| 119cdf4f91 | |||
| bdfd88a4c3 | |||
| 2697fd57b4 | |||
| bde7685dc6 | |||
| 6acaa95098 | |||
| 610f116b82 | |||
| fe616ed87b | |||
| 06e238b2d5 | |||
| a4c323b5e0 | |||
| fdfb03348e | |||
| 91ba665c4c | |||
| ba65c5e23a | |||
| f05b20ed98 | |||
| 74d3e8b2d4 | |||
| 74364cd452 | |||
| dc2a023fbb | |||
| 47560daec6 | |||
| 657b900418 | |||
| d826c3dcce | |||
| 935d61f910 | |||
| 0a412feefb | |||
| 31111a1cc8 | |||
| cf901ef840 | |||
| 8d70716f15 | |||
| 7cf086874a | |||
| d1698f0c2d | |||
| f80bcbcfb9 | |||
| 0f2fcdba68 | |||
| 548156c159 | |||
| ea08a52750 | |||
| 4c51ca7670 | |||
| 2ea9d46e12 | |||
| 65445859d3 | |||
| 8c9927b9cb | |||
| 5477a4a4cc | |||
| d1277aa1aa | |||
| 2381550e08 | |||
| 3ff4a9b6cf | |||
| 174f47edb1 | |||
| 96fbe30924 | |||
| 954c7e427a | |||
| e466eb6683 | |||
| 01437e9d8a | |||
| eac553ba46 | |||
| e57017f5f2 | |||
| 6506a18d6f | |||
| ed79b230aa | |||
| ac56650ce5 | |||
| 81d5a8a12c | |||
| 192ae916de | |||
| 5047ae5f9c | |||
| f5a30a7dde | |||
| e9c22ef577 | |||
| 8292d8512d | |||
| a606633755 | |||
| 9788b632d6 | |||
| 0e988b2b49 | |||
| 0a8211d40b | |||
| 1b3c2da6d3 | |||
| 48209b05e7 | |||
| 2da42d48e6 | |||
| f6b1813e88 | |||
| c16407e360 | |||
| b7ca5c54a3 | |||
| d42a915ef5 | |||
| 91c1e8fcef | |||
| 9abd0de3fe | |||
| 25cb0de6c0 | |||
| 4db1147c4f | |||
| 7802082797 | |||
| da40da432f | |||
| 6a03b63e65 | |||
| 81400a37f1 | |||
| 228a786f6c | |||
| 224c17c582 | |||
| 64a35316cb | |||
| 78207eb0cb | |||
| c3b9b52f5d | |||
| 690c2e53d9 | |||
| 5a72c12233 | |||
| 74f41404ef | |||
| 586af43050 | |||
| 50510b808f | |||
| d46ef9f068 | |||
| 293561d807 | |||
| 4c64137e9a | |||
| 57e57c19d0 | |||
| 475b03d591 | |||
| a97091bf49 | |||
| 7a12c4ab1d | |||
| 4f732c3921 | |||
| 531deacc3d | |||
| b219e60f13 | |||
| 387fc37b19 | |||
| 1b88c3e0a3 | |||
| af1c7ff2c9 | |||
| 976f315ba8 | |||
| 216c13054b | |||
| 3fd4d330d2 | |||
| f811759bf4 | |||
| 6efc5bb4fa | |||
| 754d7f58c0 | |||
| dc39f9f207 | |||
| 65c46c2eb4 | |||
| 40e30058f9 | |||
| 432f8dc090 | |||
| ea68931461 | |||
| e6a2f0528a | |||
| 71f2c937db | |||
| 2a8ae9a022 | |||
| 3f28fcc211 | |||
| dd850bdbbc | |||
| 6ae8b520ac | |||
| d956081d61 | |||
| fe75be35fb | |||
| 15d6fd98b5 | |||
| d1d22de559 | |||
| 2f69074418 | |||
| 684e7a63db | |||
| 208c21c4ea | |||
| 55c8fd9271 | |||
| 664f35090d | |||
| aaec370afa | |||
| af09f28fdd | |||
| 00b92d2aec | |||
| a90d694a48 | |||
| 03babbfdee | |||
| 32cf945b4d | |||
| 207813376b | |||
| 98a54ad85d | |||
| fc0a36e4b8 | |||
| a3a68d7550 | |||
| 572400a3c7 | |||
| 8b42390175 | |||
| ad71193089 | |||
| f631810acc |
184
.gitlab-ci.yml
184
.gitlab-ci.yml
@ -1,43 +1,159 @@
|
||||
stages:
|
||||
- analysis
|
||||
- sendmail
|
||||
# commit_sha 文件记录上一次成功流水线的commit sha,用于定时计划检测是否有新代码提交,有就执行流水线,没有就终止流水线
|
||||
cache:
|
||||
# 不同的分支采用不同的 cache,防止分支之间相互影响
|
||||
key: "${CI_COMMIT_REF_SLUG}_commit_sha"
|
||||
paths:
|
||||
- commit_sha
|
||||
policy: pull
|
||||
|
||||
## 代码检查
|
||||
# 将打包&发送apk包邮件job 和代码分析job 并行执行
|
||||
stages:
|
||||
- build&analyze
|
||||
- oss-upload&send-email
|
||||
- ci_sonar_mail
|
||||
|
||||
# 阻止了 合并请求 或 push(分支和标签)的流水线。 最后的 when: always 规则运行所有其他流水线类型,包括定时计划流水线。
|
||||
workflow:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push"'
|
||||
when: always
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
when: never
|
||||
- when: always
|
||||
|
||||
before_script:
|
||||
# 检查是否存在 commit_sha 文件
|
||||
- if [ -f commit_sha ]; then cat commit_sha; else echo "0000000" > commit_sha; fi
|
||||
- export BEFORE_COMMIT_SHA=$(cat commit_sha)
|
||||
# 比较commit sha ,若与上一次成功流水线的commit sha 相同,则退出流水线
|
||||
- if [ "$CI_COMMIT_SHA" == "$BEFORE_COMMIT_SHA" ] && [ "$CI_PIPELINE_SOURCE" != "web" ]; then exit 137; fi
|
||||
|
||||
# 使用 .post 阶段使作业在流水线的末尾运行。.post 始终是流水线的最后阶段。
|
||||
change_commit:
|
||||
tags:
|
||||
- offline-test
|
||||
stage: .post
|
||||
# 此job 跳过拉取git代码
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
script:
|
||||
# 更新 commit_sha
|
||||
- if [ "$CI_COMMIT_SHA" != "$BEFORE_COMMIT_SHA" ]; then echo $CI_COMMIT_SHA > commit_sha; fi
|
||||
cache:
|
||||
# 不同的分支采用不同的 cache,防止分支之间相互影响
|
||||
key: "${CI_COMMIT_REF_SLUG}_commit_sha"
|
||||
paths:
|
||||
- commit_sha
|
||||
policy: pull-push
|
||||
allow_failure:
|
||||
exit_codes: 137
|
||||
|
||||
android_build:
|
||||
tags:
|
||||
# - local-runner
|
||||
- offline-test
|
||||
stage: build&analyze
|
||||
image: hub.shanqu.cc/library/ci-android:jdk11-sdk31-33
|
||||
resource_group: android_build
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
KUBERNETES_CPU_LIMIT: "10"
|
||||
script:
|
||||
- export GRADLE_USER_HOME=/home/gitlab-runner/ci-build-cache/$CI_PROJECT_PATH/.gradle
|
||||
- chmod +x ./gradlew
|
||||
- ./scripts/jenkins_build.sh -c
|
||||
#设置打包后的产物,用于job之间共享
|
||||
artifacts:
|
||||
paths:
|
||||
- app/build/tmp/*.apk
|
||||
expire_in: 48 hrs # 指定附件上载后保存的时间24h,默认永久在Gitlab保存
|
||||
allow_failure:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.26.0
|
||||
- dev-5.27.0
|
||||
|
||||
# 代码检查
|
||||
sonarqube_analysis:
|
||||
tags:
|
||||
- offline-test
|
||||
stage: analysis
|
||||
image: sonarsource/sonar-scanner-cli:latest
|
||||
dependencies: [] #禁止传递来的artifact
|
||||
script:
|
||||
## 获取项目的一级组和二级组和项目名作为projectKey,例如projectKey=platform-backend-eci-monitor
|
||||
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
|
||||
- sonar-scanner
|
||||
-Dsonar.host.url=http://sonarqube-server.sonarqube:9000/
|
||||
-Dsonar.login=be43de7264ce4c4766eb0c020373c3e74e6df257
|
||||
-Dsonar.jacoco.reportPaths=target/jacoco.exec
|
||||
-Dsonar.projectKey=$group
|
||||
-Dsonar.projectName=$CI_PROJECT_PATH
|
||||
-Dsonar.sourceEncoding=UTF-8
|
||||
-Dsonar.exclusions=**/vendor/**,**/errcode/**
|
||||
-Dsonar.gitlab.project_id=$CI_PROJECT_ID
|
||||
-Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
|
||||
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
|
||||
-Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID
|
||||
-Dsonar.gitlab.merge_request_discussion=true
|
||||
-Dsonar.java.binaries=. # 如果不使用Maven或Gradle进行分析,则必须手动提供测试二进制文件
|
||||
only:
|
||||
- dev
|
||||
tags:
|
||||
- offline-test
|
||||
stage: build&analyze
|
||||
image: sonarsource/sonar-scanner-cli:latest
|
||||
dependencies: [] #禁止传递来的artifact
|
||||
script:
|
||||
## 获取项目的一级组和二级组和项目名作为projectKey,例如projectKey=platform-backend-eci-monitor
|
||||
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
|
||||
- sonar-scanner
|
||||
-Dsonar.host.url=http://sonarqube-server.sonarqube:9000/
|
||||
-Dsonar.login=be43de7264ce4c4766eb0c020373c3e74e6df257
|
||||
-Dsonar.jacoco.reportPaths=target/jacoco.exec
|
||||
-Dsonar.projectKey=$group
|
||||
-Dsonar.projectName=$CI_PROJECT_PATH
|
||||
-Dsonar.sourceEncoding=UTF-8
|
||||
-Dsonar.exclusions=**/vendor/**,**/errcode/**
|
||||
-Dsonar.gitlab.project_id=$CI_PROJECT_ID
|
||||
-Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
|
||||
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
|
||||
-Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID
|
||||
-Dsonar.gitlab.merge_request_discussion=true
|
||||
-Dsonar.java.binaries=.
|
||||
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
|
||||
allow_failure:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.26.0
|
||||
- dev-5.27.0
|
||||
|
||||
## 发送简易检测结果报告
|
||||
send_sonar_report:
|
||||
tags:
|
||||
- offline-test
|
||||
stage: ci_sonar_mail
|
||||
image: hub.shanqu.cc/library/docker:latest
|
||||
# 此job 跳过拉取git代码
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
script:
|
||||
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
|
||||
- docker run -e PROJECTKEY=$group -e EMAIL=$GITLAB_USER_EMAIL -e BRANCH=$CI_COMMIT_REF_NAME --name send-email --rm hub.shanqu.cc/platform/send-sonar-report:latest
|
||||
allow_failure:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.26.0
|
||||
- dev-5.27.0
|
||||
|
||||
oss-upload&send-email:
|
||||
tags:
|
||||
- offline-test
|
||||
stage: sendmail
|
||||
image: hub.shanqu.cc/library/docker:latest
|
||||
dependencies: [] #禁止传递来的artifact
|
||||
- rancher-k8s
|
||||
stage: oss-upload&send-email
|
||||
image: hub.shanqu.cc/devops/android-apk-oss-upload:latest
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
VAULT_ADDR: https://vault.shanqu.cc # 固定值
|
||||
VAULT_SECRET_PATH: prod/devops/android-apk-oss-upload # 固定值
|
||||
VAULT_ROLE: android-apk-oss-upload # 固定值
|
||||
ENDPOINT: "oss-cn-shenzhen-internal.aliyuncs.com" # 固定值
|
||||
BUCKET: "shanqu" # 固定值
|
||||
FILE_PATH: "app/build/tmp/" # APK 存放路径
|
||||
Email_To_List: $EMAIL_TO_LIST # 邮件接受人列表
|
||||
Email_Title: "光环助手 $CI_COMMIT_BRANCH" # 邮件标题
|
||||
PIPELINE_ID: $CI_PIPELINE_ID # 流水线id
|
||||
COMMIT_BRANCH: $CI_COMMIT_BRANCH # 提交分支
|
||||
MAIL_MESSAGE: "[$CI_COMMIT_AUTHOR] $CI_COMMIT_MESSAGE"
|
||||
needs:
|
||||
- job: android_build
|
||||
artifacts: true
|
||||
script:
|
||||
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
|
||||
- docker run -e PROJECTKEY=$group -e EMAIL=$GITLAB_USER_EMAIL --name send-email --rm hub.shanqu.cc/platform/send-sonar-report:latest
|
||||
### 绑定上传参数 ###
|
||||
- export OSS_PATH="release/dev/${CI_PROJECT_NAME}/$(date "+%Y/%m/%d")"
|
||||
### 开启上传 ###
|
||||
- /usr/local/bin/python /upload.py
|
||||
### 发送邮件
|
||||
- /usr/local/bin/python /ci-android-mail.py
|
||||
only:
|
||||
- dev
|
||||
- dev-5.26.0
|
||||
- dev-5.27.0
|
||||
|
||||
@ -11,6 +11,7 @@ android {
|
||||
|
||||
String CONFIG_ID = ""
|
||||
String FIRST_LAUNCH = ""
|
||||
int ACTIVATE_REPORTING_RATIO = 0
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
@ -76,6 +77,8 @@ android {
|
||||
// 首次启动的跳转配置
|
||||
buildConfigField "String", "FIRST_LAUNCH", "\"${FIRST_LAUNCH}\""
|
||||
|
||||
buildConfigField "int", "ACTIVATE_REPORTING_RATIO", "${ACTIVATE_REPORTING_RATIO}"
|
||||
|
||||
// All third-party appid/appkey
|
||||
buildConfigField "String", "API_HOST", "\"${API_HOST}\""
|
||||
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
|
||||
@ -160,7 +163,7 @@ android {
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
// internal test dev host
|
||||
// internal, 内部测试包使用的 flavor,接口包含包括测试和正式环境
|
||||
internal {
|
||||
dimension "env"
|
||||
versionNameSuffix "-debug"
|
||||
@ -172,7 +175,7 @@ android {
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${DEV_QUICK_LOGIN_APPKEY}\""
|
||||
}
|
||||
|
||||
// publish release host
|
||||
// publish, 发布时候使用的 flavor,接口仅包含正式环境
|
||||
publish {
|
||||
dimension "env"
|
||||
|
||||
@ -198,11 +201,17 @@ android {
|
||||
kuaishou {
|
||||
dimension "env"
|
||||
|
||||
String KUAI_SHOU_APP_ID = ""
|
||||
String KUAI_SHOU_APP_NAME = ""
|
||||
|
||||
buildConfigField "String", "DEV_API_HOST", "\"${API_HOST}\""
|
||||
buildConfigField "String", "NEW_DEV_API_HOST", "\"${NEW_API_HOST}\""
|
||||
buildConfigField "String", "DEV_VAPI_HOST", "\"${VAPI_HOST}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPID", "\"${QUICK_LOGIN_APPID}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
|
||||
buildConfigField "String", "KUAI_SHOU_APP_ID", "\"${KUAI_SHOU_APP_ID}\""
|
||||
buildConfigField "String", "KUAI_SHOU_APP_NAME", "\"${KUAI_SHOU_APP_NAME}\""
|
||||
}
|
||||
|
||||
gdt {
|
||||
@ -294,7 +303,6 @@ dependencies {
|
||||
|
||||
implementation "com.lg:shortcut:${shortcut}"
|
||||
|
||||
compileOnly "com.github.axen1314.lancet:lancet-base:${lancet_version}"
|
||||
kapt "com.alibaba:arouter-compiler:$arouterVersion"
|
||||
|
||||
implementation project(':ndownload')
|
||||
@ -321,9 +329,11 @@ dependencies {
|
||||
implementation(project(':module_sensors_data')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
// implementation(project(':module_vpn'))
|
||||
implementation(project(':module_pkg'))
|
||||
// implementation(project(':feature:vpn'))
|
||||
implementation(project(':feature:pkg'))
|
||||
implementation(project(':feature:oaid'))
|
||||
implementation(project(':feature:floating-window'))
|
||||
implementation(project(':feature:beizi_startup_ad'))
|
||||
}
|
||||
|
||||
File propFile = file('sign.properties')
|
||||
|
||||
@ -26,7 +26,7 @@ class FlavorProviderImp : IFlavorProvider {
|
||||
return channel
|
||||
}
|
||||
|
||||
override fun init(application: Application, activity: Activity) {
|
||||
override fun init(application: Application, activity: Activity, activateRatio: Int) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import com.leon.channel.helper.ChannelReaderUtil
|
||||
|
||||
class FlavorProviderImp : IFlavorProvider {
|
||||
|
||||
override fun init(application: Application, activity: Activity) {
|
||||
override fun init(application: Application, activity: Activity, activateRatio: Int) {
|
||||
GdtHelper.init(application, getChannelStr(application))
|
||||
|
||||
if (HaloApp.getInstance().isBrandNewInstall) {
|
||||
|
||||
Binary file not shown.
BIN
app/src/gdt/libs/GDTActionSDK.min.1.8.6.aar
Normal file
BIN
app/src/gdt/libs/GDTActionSDK.min.1.8.6.aar
Normal file
Binary file not shown.
10
app/src/internal/res/xml/network_security_config.xml
Normal file
10
app/src/internal/res/xml/network_security_config.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="true">
|
||||
<trust-anchors>
|
||||
<!-- Trust user added CAs while debuggable only -->
|
||||
<certificates src="user" />
|
||||
<certificates src="system" />
|
||||
</trust-anchors>
|
||||
</base-config>
|
||||
</network-security-config>
|
||||
@ -5,15 +5,15 @@ import com.kwai.monitor.log.TurboAgent
|
||||
import com.kwai.monitor.log.TurboConfig
|
||||
|
||||
object KuaishouHelper {
|
||||
private const val APP_ID = "80655"
|
||||
private const val APP_NAME = "guanghuanzhushou_1"
|
||||
private val mAppId by lazy { BuildConfig.KUAI_SHOU_APP_ID.ifEmpty { "81537" } }
|
||||
private val mAppName by lazy { BuildConfig.KUAI_SHOU_APP_NAME.ifEmpty { "guanghuanzhushou_1" } }
|
||||
|
||||
@JvmStatic
|
||||
fun init(context: Context, channel: String) {
|
||||
TurboAgent.init(
|
||||
TurboConfig.TurboConfigBuilder.create(context)
|
||||
.setAppId(APP_ID)
|
||||
.setAppName(APP_NAME)
|
||||
.setAppId(mAppId)
|
||||
.setAppName(mAppName)
|
||||
.setAppChannel(channel)
|
||||
.build()
|
||||
)
|
||||
|
||||
@ -8,11 +8,11 @@ import com.gh.gamecenter.core.provider.IFlavorProvider
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.TimeUtils
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.leon.channel.helper.ChannelReaderUtil
|
||||
import com.kwai.monitor.payload.TurboHelper
|
||||
|
||||
class FlavorProviderImp : IFlavorProvider {
|
||||
|
||||
override fun init(application: Application, activity: Activity) {
|
||||
override fun init(application: Application, activity: Activity, activateRatio: Int) {
|
||||
KuaishouHelper.init(application, getChannelStr(application))
|
||||
|
||||
if (HaloApp.getInstance().isBrandNewInstall) {
|
||||
@ -31,7 +31,7 @@ class FlavorProviderImp : IFlavorProvider {
|
||||
}
|
||||
|
||||
override fun getChannelStr(application: Application): String {
|
||||
var channel = ChannelReaderUtil.getChannel(application)
|
||||
var channel = TurboHelper.getChannel(application)
|
||||
if (channel == null || TextUtils.isEmpty(channel.trim())) {
|
||||
channel = KUAISHOU_CHANNEL
|
||||
}
|
||||
|
||||
BIN
app/src/kuaishou/libs/channelsdk-0.2.1-beta.aar
Normal file
BIN
app/src/kuaishou/libs/channelsdk-0.2.1-beta.aar
Normal file
Binary file not shown.
Binary file not shown.
BIN
app/src/kuaishou/libs/monitorsdk-1.0.13.aar
Normal file
BIN
app/src/kuaishou/libs/monitorsdk-1.0.13.aar
Normal file
Binary file not shown.
@ -46,7 +46,8 @@
|
||||
<!-- 如果有视频相关的广告且使用textureView播放,请务必添加,否则黑屏 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.shuyu.gsyvideoplayer,
|
||||
<uses-sdk tools:overrideLibrary="
|
||||
com.shuyu.gsyvideoplayer,
|
||||
com.shuyu.gsyvideoplayer.lib,
|
||||
com.haroldadmin.whatthestack,
|
||||
com.shuyu.gsyvideoplayer.armv7a,
|
||||
@ -106,10 +107,15 @@
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:resizeableActivity="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:theme="@style/AppCompatTheme.APP"
|
||||
tools:replace="android:name,android:allowBackup"
|
||||
tools:targetApi="n">
|
||||
|
||||
<meta-data
|
||||
android:name="EasyGoClient"
|
||||
android:value="true" />
|
||||
|
||||
<meta-data
|
||||
android:name="io.sentry.auto-init"
|
||||
android:value="false" />
|
||||
@ -119,7 +125,7 @@
|
||||
android:name="io.sentry.breadcrumbs.system-events"
|
||||
android:value="false" />
|
||||
|
||||
<service android:name = "com.gh.ndownload.NDownloadService" />
|
||||
<service android:name="com.gh.ndownload.NDownloadService" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.SplashScreenActivity"
|
||||
|
||||
27
app/src/main/assets/easygo.json
Normal file
27
app/src/main/assets/easygo.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"easyGoVersion": "1.0",
|
||||
"client": "com.gh.gamecenter",
|
||||
"logicEntities": [
|
||||
{
|
||||
"head": {
|
||||
"function": "magicwindow",
|
||||
"required": "true"
|
||||
},
|
||||
"body": {
|
||||
"mode":"1",
|
||||
"activityPairs":[
|
||||
{"from":"com.gh.gamecenter.MainActivity","to":"*"}
|
||||
],
|
||||
"defaultDualActivities": {
|
||||
"mainPages": "com.gh.gamecenter.MainActivity"
|
||||
},
|
||||
"UX": {
|
||||
"supportRotationUxCompat": "false",
|
||||
"isDraggable": "true"
|
||||
},
|
||||
"transActivities":[
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -60,7 +60,12 @@ import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.util.*
|
||||
|
||||
class DefaultJsApi(var context: Context, val entrance: String = "", private var mFragment: Fragment? = null) {
|
||||
class DefaultJsApi(
|
||||
var context: Context,
|
||||
val entrance: String = "",
|
||||
private var mFragment: Fragment? = null,
|
||||
private var mBbsId: String? = "",
|
||||
) {
|
||||
|
||||
private var mLoginHandler: CompletionHandler<Any>? = null
|
||||
private var mDownloadWatcher: DataWatcher? = null // 下载观察者
|
||||
@ -204,7 +209,7 @@ class DefaultJsApi(var context: Context, val entrance: String = "", private var
|
||||
runOnUiThread {
|
||||
// 若畅玩列表中安装了,优先启动畅玩游戏
|
||||
if (VHelper.isInstalled(packageName)) {
|
||||
if (!VHelper.showDialogIfVSpaceIsNeeded(context, "", "")) {
|
||||
if (!VHelper.showDialogIfVSpaceIsNeeded(context, "", "", "", "")) {
|
||||
VHelper.launch(context, packageName)
|
||||
}
|
||||
} else {
|
||||
@ -258,6 +263,24 @@ class DefaultJsApi(var context: Context, val entrance: String = "", private var
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为论坛详情的专区
|
||||
*/
|
||||
@JavascriptInterface
|
||||
fun isForumZone(msg: Any): Boolean {
|
||||
return !mBbsId.isNullOrEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开论坛搜索页
|
||||
*/
|
||||
@JavascriptInterface
|
||||
fun openForumSearch(msg: Any) {
|
||||
runOnUiThread {
|
||||
DirectUtils.directToForumOrUserSearch(context, mBbsId ?: "", entrance.ifBlank { "内部网页" })
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun exitWebView(msg: Any) {
|
||||
runOnUiThread { (context as Activity).finish() }
|
||||
|
||||
@ -21,7 +21,7 @@ object FixedRateJobHelper {
|
||||
private const val TIME_PERIOD: Long = 10 * 60 * 1000L
|
||||
private const val LOGHUB_PERIOD: Long = 2 * 60 * 1000L
|
||||
private const val EXPOSURE_PERIOD: Long = 5 * 60 * 1000L
|
||||
private const val REGION_SETTING_PERIOD: Long = 30 * 1000L
|
||||
private const val REGION_SETTING_PERIOD: Long = 60 * 1000L
|
||||
private const val VIDEO_RECORD_PERIOD: Long = 60 * 1000L
|
||||
|
||||
private const val DOWNLOAD_HEARTBEAT_PERIOD: Long = 60 * 1000L
|
||||
|
||||
@ -9,7 +9,7 @@ class CheckDownloadHandler : ChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
|
||||
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
|
||||
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
} else {
|
||||
|
||||
@ -122,17 +122,6 @@ public class Config {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否启用畅玩游戏
|
||||
*/
|
||||
public static boolean isVGameEnabled() {
|
||||
if (getSettings() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !"off".equals(getSettings().getGameSmooth());
|
||||
}
|
||||
|
||||
/**
|
||||
* VPN 开关选项是否开启
|
||||
*/
|
||||
@ -229,6 +218,8 @@ public class Config {
|
||||
if (!TextUtils.isEmpty(json)) {
|
||||
mSettingsEntity = GsonUtils.fromJson(json, SettingsEntity.class);
|
||||
}
|
||||
|
||||
mSettingsEntity.setGameSmooth("off");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import com.gh.common.chain.CertificationHandler;
|
||||
import com.gh.common.chain.ChainBuilder;
|
||||
import com.gh.common.chain.ChainHandler;
|
||||
import com.gh.common.chain.CheckDownloadHandler;
|
||||
import com.gh.common.chain.CheckStoragePermissionHandler;
|
||||
import com.gh.common.chain.DownloadDialogHelperHandler;
|
||||
import com.gh.common.chain.GamePermissionHandler;
|
||||
import com.gh.common.chain.OverseaDownloadHandler;
|
||||
@ -397,8 +398,9 @@ public class BindingAdapters {
|
||||
}
|
||||
|
||||
ChainBuilder builder = new ChainBuilder();
|
||||
builder.addHandler(new ValidateVSpaceHandler());
|
||||
builder.addHandler(new GamePermissionHandler());
|
||||
builder.addHandler(new CheckStoragePermissionHandler());
|
||||
builder.addHandler(new ValidateVSpaceHandler());
|
||||
builder.addHandler(new BrowserInstallHandler());
|
||||
builder.addHandler(new PackageCheckHandler());
|
||||
builder.addHandler(new DownloadDialogHelperHandler());
|
||||
@ -455,7 +457,7 @@ public class BindingAdapters {
|
||||
}
|
||||
|
||||
if (gameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch((AppCompatActivity) v.getContext(), gameEntity.getApk().get(0).getPackageName());
|
||||
VHelper.installOrLaunch((AppCompatActivity) v.getContext(), gameEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -473,10 +475,9 @@ public class BindingAdapters {
|
||||
case INSTALL_NORMAL:
|
||||
if (gameEntity.getApk().size() == 1) {
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
|
||||
String packageName = gameEntity.getApk().get(0).getPackageName();
|
||||
|
||||
if (gameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch(v.getContext(), packageName);
|
||||
VHelper.installOrLaunch(v.getContext(), gameEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ object ExposureManager {
|
||||
private fun uploadExposures(eventSet: HashSet<ExposureEvent>, forced: Boolean) {
|
||||
eventSet.forEach {
|
||||
LoghubHelper.uploadLog(buildLog(it), LOG_STORE, forced)
|
||||
it.recycle()
|
||||
// it.recycle()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.common.exposure
|
||||
import android.text.TextUtils
|
||||
import com.g00fy2.versioncompare.Version
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.common.util.RealNameHelper
|
||||
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
|
||||
import com.gh.gamecenter.common.utils.toObject
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity
|
||||
@ -42,7 +43,9 @@ object ExposureUtils {
|
||||
source = traceEvent?.source ?: ArrayList(),
|
||||
eTrace = ExposureTraceUtils.appendTrace(traceEvent),
|
||||
event = ExposureType.DOWNLOAD
|
||||
)
|
||||
).apply {
|
||||
this.payload.certification = RealNameHelper.getCertificationStatus()
|
||||
}
|
||||
if (!TextUtils.isEmpty(entity.id)) {
|
||||
ExposureManager.log(exposureEvent)
|
||||
}
|
||||
@ -78,7 +81,9 @@ object ExposureUtils {
|
||||
source = traceEvent?.source ?: ArrayList(),
|
||||
eTrace = ExposureTraceUtils.appendTrace(traceEvent),
|
||||
event = ExposureType.DOWNLOAD_COMPLETE
|
||||
)
|
||||
).apply {
|
||||
this.payload.certification = RealNameHelper.getCertificationStatus()
|
||||
}
|
||||
exposureEvent.payload.host = host
|
||||
exposureEvent.payload.path = path
|
||||
exposureEvent.payload.speed = speed
|
||||
|
||||
@ -8,6 +8,8 @@ import com.google.gson.annotations.SerializedName
|
||||
class RegionSetting(
|
||||
@SerializedName("game_mirror")
|
||||
var mirrorGameIdSet: HashSet<String>,
|
||||
@SerializedName("game_mirror2")
|
||||
var mirrorGameIdSet2: HashSet<String>?,
|
||||
@SerializedName("game_block")
|
||||
var filterGameIdSet: HashSet<String>,
|
||||
@SerializedName("channel_control")
|
||||
|
||||
@ -23,7 +23,8 @@ object RegionSettingHelper {
|
||||
|
||||
private var mChannelControl: RegionSetting.ChannelControl? = null
|
||||
private var mFilterGameIdSet: HashSet<String>? = hashSetOf()
|
||||
private var mDisplayMirrorIfoGameIdSet: HashSet<String>? = hashSetOf()
|
||||
private var mDisplayMirrorGameIdSet: HashSet<String>? = hashSetOf()
|
||||
private var mDisplayMirrorGameIdSet2: HashSet<String>? = hashSetOf()
|
||||
private var mGameH5DownloadList: List<RegionSetting.GameH5Download>? = listOf()
|
||||
private var mGameSpecialDownloadInfoList: List<RegionSetting.GameSpecialDownloadInfo>? = listOf()
|
||||
private var mIpInfo: IpInfo? = null
|
||||
@ -33,7 +34,21 @@ object RegionSettingHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun shouldThisGameDisplayMirrorInfo(gameId: String): Boolean {
|
||||
return mDisplayMirrorIfoGameIdSet?.contains(gameId) ?: false
|
||||
return mDisplayMirrorGameIdSet?.contains(gameId) == true
|
||||
|| mDisplayMirrorGameIdSet2?.contains(gameId) == true
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取镜像数据的位置,是归属镜像 1 还是镜像 2
|
||||
*/
|
||||
fun getMirrorPosition(gameId: String): Int {
|
||||
return if (mDisplayMirrorGameIdSet?.contains(gameId) == true) {
|
||||
1
|
||||
} else if (mDisplayMirrorGameIdSet2?.contains(gameId) == true) {
|
||||
2
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ -131,7 +146,8 @@ object RegionSettingHelper {
|
||||
|
||||
private fun updateSettingsInMemory(data: RegionSetting) {
|
||||
mFilterGameIdSet = data.filterGameIdSet
|
||||
mDisplayMirrorIfoGameIdSet = data.mirrorGameIdSet
|
||||
mDisplayMirrorGameIdSet = data.mirrorGameIdSet
|
||||
mDisplayMirrorGameIdSet2 = data.mirrorGameIdSet2
|
||||
mChannelControl = data.channelControl
|
||||
mGameH5DownloadList = data.gameH5DownloadList
|
||||
mGameSpecialDownloadInfoList = data.gameSpecialDownloadInfoList
|
||||
|
||||
@ -22,7 +22,7 @@ class GameDetailProviderImpl : IGameDetailProvider {
|
||||
context: Context,
|
||||
gameEntity: GameEntity?,
|
||||
entrance: String,
|
||||
defaultTab: Int,
|
||||
defaultTab: String,
|
||||
isSkipGameComment: Boolean,
|
||||
scrollToLibao: Boolean,
|
||||
scrollToServer: Boolean,
|
||||
|
||||
@ -14,6 +14,10 @@ class RegionSettingHelperProviderImpl : IRegionSettingHelperProvider {
|
||||
return RegionSettingHelper.shouldThisGameDisplayMirrorInfo(gameId)
|
||||
}
|
||||
|
||||
override fun getMirrorPosition(gameId: String): Int {
|
||||
return RegionSettingHelper.getMirrorPosition(gameId)
|
||||
}
|
||||
|
||||
override fun shouldThisGameShowSpecialDownload(gameId: String): Boolean {
|
||||
return RegionSettingHelper.shouldThisGameShowSpecialDownload(gameId)
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ object ArchiveDownloadButtonHelper {
|
||||
downloadBtn.setOnClickListener {
|
||||
when {
|
||||
// 检查是否已安装畅玩助手
|
||||
!VHelper.isVSpaceInstalled(context) -> showVspaceTipDialog(context, gameEntity)
|
||||
!VHelper.isVSpaceInstalled(context) -> showVSpaceTipDialog(context, gameEntity)
|
||||
// 检查是否已安装游戏
|
||||
!VHelper.isInstalled(packageName) -> {
|
||||
// 检查游戏是否在安装中
|
||||
@ -82,7 +82,7 @@ object ArchiveDownloadButtonHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private fun showVspaceTipDialog(context: Context, gameEntity: GameEntity?) {
|
||||
private fun showVSpaceTipDialog(context: Context, gameEntity: GameEntity?) {
|
||||
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogShow()
|
||||
DialogHelper.showDialog(
|
||||
context,
|
||||
@ -92,7 +92,7 @@ object ArchiveDownloadButtonHelper {
|
||||
R.string.cancel.toResString(),
|
||||
{
|
||||
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.archive_vspace_dialog_confirm.toResString())
|
||||
VHelper.showVspaceDialog(context, gameEntity)
|
||||
VHelper.showVSpaceDialog(context, gameEntity)
|
||||
},
|
||||
{
|
||||
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.cancel.toResString())
|
||||
|
||||
@ -3,11 +3,15 @@ package com.gh.common.util;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@ -19,6 +23,7 @@ import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
|
||||
import com.gh.gamecenter.common.callback.SimpleCallback;
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
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.core.utils.DisplayUtils;
|
||||
@ -45,6 +50,7 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@ -102,17 +108,27 @@ public class CommentUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void showReportDialog(final CommentEntity commentEntity,
|
||||
final Context context,
|
||||
final boolean showConversation,
|
||||
final String patch) {
|
||||
final Dialog dialog = new Dialog(context);
|
||||
|
||||
LinearLayout container = new LinearLayout(context);
|
||||
container.setOrientation(LinearLayout.VERTICAL);
|
||||
container.setBackgroundColor(ContextCompat.getColor(context, R.color.background_white));
|
||||
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
|
||||
public static void showMorePopupWindow(
|
||||
final View anchor,
|
||||
final CommentEntity commentEntity,
|
||||
final boolean showConversation,
|
||||
final String patch,
|
||||
final OnCommentDeleteListener onCommentDeleteListener
|
||||
) {
|
||||
Context context = anchor.getContext();
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
View contentView = inflater.inflate(R.layout.layout_popup_container, null);
|
||||
PopupWindow popupWindow = new PopupWindow(
|
||||
contentView,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
popupWindow.setBackgroundDrawable(new ColorDrawable(0));
|
||||
popupWindow.setTouchable(true);
|
||||
popupWindow.setFocusable(true);
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
|
||||
LinearLayout container = contentView.findViewById(R.id.container);
|
||||
List<String> dialogType = new ArrayList<>();
|
||||
dialogType.add("复制");
|
||||
dialogType.add("投诉");
|
||||
@ -121,21 +137,23 @@ public class CommentUtils {
|
||||
dialogType.add("查看对话");
|
||||
}
|
||||
|
||||
String commentUserId = commentEntity.getUser().getId();
|
||||
String userId = UserManager.getInstance().getUserId();
|
||||
MeEntity me = commentEntity.getMe();
|
||||
boolean isCommentedByUser = Objects.equals(commentUserId, userId);
|
||||
boolean isContentAuthorOrModerator = me != null && (me.isModerator() || me.isContentAuthor());
|
||||
if (isCommentedByUser || isContentAuthorOrModerator) {
|
||||
dialogType.add("删除");
|
||||
}
|
||||
|
||||
for (String s : dialogType) {
|
||||
final TextView reportTv = new TextView(context);
|
||||
View itemView = inflater.inflate(R.layout.layout_popup_option_item, container, false);
|
||||
TextView reportTv = itemView.findViewById(R.id.hint_text);
|
||||
reportTv.setText(s);
|
||||
reportTv.setTextSize(17);
|
||||
reportTv.setTextColor(ContextCompat.getColor(context, R.color.title));
|
||||
reportTv.setBackgroundResource(R.drawable.textview_white_style);
|
||||
int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
|
||||
reportTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||
reportTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
|
||||
0, DisplayUtils.dip2px(context, 12));
|
||||
container.addView(reportTv);
|
||||
container.addView(itemView);
|
||||
|
||||
reportTv.setOnClickListener(v -> {
|
||||
dialog.cancel();
|
||||
popupWindow.dismiss();
|
||||
switch (reportTv.getText().toString()) {
|
||||
case "复制":
|
||||
copyText(commentEntity.getContent(), context);
|
||||
@ -143,19 +161,30 @@ public class CommentUtils {
|
||||
case "投诉":
|
||||
CheckLoginUtils.checkLogin(context, patch + "-投诉",
|
||||
() -> showReportTypeDialog(commentEntity, context));
|
||||
|
||||
break;
|
||||
case "查看对话":
|
||||
context.startActivity(CommentDetailActivity.getIntent(context, commentEntity.getId(), null));
|
||||
break;
|
||||
case "删除":
|
||||
DialogHelper.INSTANCE.showDialog(
|
||||
context,
|
||||
"提示",
|
||||
"删除评论后,评论下所有的回复都将被删除",
|
||||
"删除",
|
||||
"取消",
|
||||
() -> {
|
||||
deleteComment(context, commentEntity, onCommentDeleteListener);
|
||||
return null;
|
||||
},
|
||||
null,
|
||||
new DialogHelper.Config("", false, true, true, false, -1)
|
||||
);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(container);
|
||||
dialog.show();
|
||||
|
||||
ExtensionsKt.showAutoOrientation(popupWindow, anchor, 0, 0);
|
||||
}
|
||||
|
||||
private static void showReportTypeDialog(final CommentEntity commentEntity, final Context context) {
|
||||
@ -430,6 +459,28 @@ public class CommentUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public static void deleteComment(
|
||||
final Context context,
|
||||
final CommentEntity commentEntity,
|
||||
final OnCommentDeleteListener listener
|
||||
) {
|
||||
Dialog dialog = DialogUtils.showWaitDialog(
|
||||
context,
|
||||
context.getString(R.string.post_dialog_hint)
|
||||
);
|
||||
RetrofitManager.getInstance().getApi()
|
||||
.deleteComment(commentEntity.getId())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doFinally(dialog::cancel)
|
||||
.subscribe(new Response<ResponseBody>() {
|
||||
@Override
|
||||
public void onResponse(@Nullable ResponseBody response) {
|
||||
listener.onCommentDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 设置评论item 用户相关的view(点赞/头像/用户名)
|
||||
public static void setCommentUserView(Context mContext, CommentViewHolder holder, CommentEntity entity) {
|
||||
@ -540,4 +591,8 @@ public class CommentUtils {
|
||||
public interface OnVoteListener {
|
||||
void onVote();
|
||||
}
|
||||
|
||||
public interface OnCommentDeleteListener {
|
||||
void onCommentDelete();
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,14 +171,25 @@ public class DataUtils {
|
||||
IdCardEntity idCardEntity = data.getIdCard();
|
||||
|
||||
if (idCardEntity != null) {
|
||||
values.put(GhContentProvider.KEY_IS_CERTIFICATED, !TextUtils.isEmpty(data.getIdCard().getId())); // 是否认证
|
||||
values.put(GhContentProvider.KEY_IS_ADULT,
|
||||
data.getIdCard().getMinor() == null
|
||||
|| !data.getIdCard().getMinor()
|
||||
);
|
||||
boolean isCertificated = !TextUtils.isEmpty(data.getIdCard().getId());
|
||||
boolean isAdult = data.getIdCard().getMinor() == null || !data.getIdCard().getMinor();
|
||||
|
||||
values.put(GhContentProvider.KEY_IS_CERTIFICATED, isCertificated); // 是否认证
|
||||
values.put(GhContentProvider.KEY_IS_ADULT, isAdult); // 是否成年
|
||||
|
||||
if (!isCertificated) {
|
||||
RealNameHelper.updateCertificationStatus(0);
|
||||
} else {
|
||||
if (isAdult) {
|
||||
RealNameHelper.updateCertificationStatus(2);
|
||||
} else {
|
||||
RealNameHelper.updateCertificationStatus(1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
values.put(GhContentProvider.KEY_IS_CERTIFICATED, false);
|
||||
values.put(GhContentProvider.KEY_IS_ADULT, false);
|
||||
RealNameHelper.updateCertificationStatus(0);
|
||||
}
|
||||
|
||||
EventBus.getDefault().post(new EBReuse(Constants.EB_REALNAME_RESULT));
|
||||
|
||||
@ -114,7 +114,7 @@ public class DetailDownloadUtils {
|
||||
if (downloadEntity == null && viewHolder.gameEntity.isVGame()) {
|
||||
String packageName = viewHolder.gameEntity.getUniquePackageName();
|
||||
if (!TextUtils.isEmpty(packageName)) {
|
||||
downloadEntity = VHelper.getDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
|
||||
downloadEntity = VHelper.getVDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ public class DetailDownloadUtils {
|
||||
if (downloadEntity == null && viewHolder.gameEntity.isVGame()) {
|
||||
String packageName = viewHolder.gameEntity.getUniquePackageName();
|
||||
if (!TextUtils.isEmpty(packageName)) {
|
||||
downloadEntity = VHelper.getDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
|
||||
downloadEntity = VHelper.getVDownloadEntitySnapshot(viewHolder.gameEntity.getId(), packageName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ public class DialogUtils {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public static void checkDownload(Context context, String size, CheckDownloadCallBack callBack) {
|
||||
public static void checkDownload(Context context, String size, String gameId, String gameName, CheckDownloadCallBack callBack) {
|
||||
if (!NetworkUtils.isNetworkConnected(context)) {
|
||||
showNoConnectionDownloadDialog(context, () -> {
|
||||
},
|
||||
@ -136,7 +136,9 @@ public class DialogUtils {
|
||||
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(context), "出现弹窗提示");
|
||||
showDownloadDialog(context,
|
||||
() -> callBack.onResponse(false),
|
||||
() -> callBack.onResponse(true));
|
||||
() -> callBack.onResponse(true),
|
||||
gameId,
|
||||
gameName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,9 +167,11 @@ public class DialogUtils {
|
||||
DialogHelper.showDialog(context, "下载提示", "网络异常,请检查手机网络状态", "知道了", "WiFi自动下载", listener::onConfirm, cancelListener::onCancel, false, "", "");
|
||||
}
|
||||
|
||||
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener) {
|
||||
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener, String gameId, String gameName) {
|
||||
context = checkDialogContext(context);
|
||||
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
|
||||
|
||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
||||
|
||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_download_traffic, null);
|
||||
@ -177,6 +181,7 @@ public class DialogUtils {
|
||||
|
||||
Context finalContext = context;
|
||||
allowOnce.setOnClickListener(v -> {
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "允许一次");
|
||||
AppExecutor.getUiExecutor().executeWithDelay(() -> {
|
||||
Utils.toast(finalContext, "已使用移动网络下载,请注意流量消耗");
|
||||
}, 500);
|
||||
@ -185,11 +190,13 @@ public class DialogUtils {
|
||||
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "本次允许");
|
||||
});
|
||||
wifiAuto.setOnClickListener(v -> {
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "WiFi自动下载");
|
||||
cancelListener.onCancel();
|
||||
dialog.dismiss();
|
||||
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "连上WiFi后自动下载");
|
||||
});
|
||||
allowAlways.setOnClickListener(v -> {
|
||||
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "总是允许");
|
||||
SPUtils.setBoolean(getTrafficDownloadHintKey(), false);
|
||||
AppExecutor.getUiExecutor().executeWithDelay(() -> {
|
||||
// 显示了弹窗以后,即便下面这个 toast 放在 listener.onConfirm 后调用也是显示 listener.onConfirm 里的 toast
|
||||
@ -201,6 +208,8 @@ public class DialogUtils {
|
||||
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "总是允许");
|
||||
});
|
||||
|
||||
dialog.setOnCancelListener(downloadDialog -> NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "关闭弹窗"));
|
||||
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(contentView);
|
||||
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
|
||||
@ -45,6 +45,7 @@ import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.forum.detail.ForumDetailActivity
|
||||
import com.gh.gamecenter.forum.home.CommunityHomeFragment
|
||||
import com.gh.gamecenter.forum.search.ForumOrUserSearchActivity
|
||||
import com.gh.gamecenter.fragment.MainWrapperFragment
|
||||
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailActivity
|
||||
import com.gh.gamecenter.game.commoncollection.detail.CommonCollectionDetailActivity
|
||||
@ -310,13 +311,14 @@ object DirectUtils {
|
||||
name = linkEntity.name,
|
||||
display = linkEntity.display ?: Display()
|
||||
),
|
||||
entrance
|
||||
entrance,
|
||||
exposureEvent
|
||||
)
|
||||
}
|
||||
|
||||
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance)
|
||||
|
||||
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path)
|
||||
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path, exposureEvent)
|
||||
|
||||
"top_game_comment" -> directToAmway(context, null, entrance, path)
|
||||
|
||||
@ -438,11 +440,28 @@ object DirectUtils {
|
||||
|
||||
"game_list" -> directToGameCollectionSquare(context, entrance, "", "", "")
|
||||
|
||||
"game_list_detail" -> directToGameCollectionDetail(context, linkEntity.link ?: "", entrance)
|
||||
"game_list_detail" -> directToGameCollectionDetail(
|
||||
context,
|
||||
linkEntity.link ?: "",
|
||||
entrance,
|
||||
exposureEvent = exposureEvent
|
||||
)
|
||||
|
||||
"explore_column", "game_explore" -> context.startActivity(DiscoveryActivity.getIntent(context, entrance))
|
||||
"explore_column", "game_explore" -> context.startActivity(
|
||||
DiscoveryActivity.getIntent(
|
||||
context,
|
||||
entrance,
|
||||
exposureEvent
|
||||
)
|
||||
)
|
||||
|
||||
"column_test_v2" -> context.startActivity(GameServerTestV2Activity.getIntent(context, entrance))
|
||||
"column_test_v2" -> context.startActivity(
|
||||
GameServerTestV2Activity.getIntent(
|
||||
context,
|
||||
entrance,
|
||||
exposureEvent
|
||||
)
|
||||
)
|
||||
|
||||
"" -> {
|
||||
// do nothing
|
||||
@ -660,10 +679,10 @@ object DirectUtils {
|
||||
bundle.putString(KEY_GAMEID, id)
|
||||
if (!TextUtils.isEmpty(tab)) {
|
||||
when (tab) {
|
||||
"comment" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_RATING)
|
||||
"desc" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_DESC)
|
||||
"forum" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_BBS)
|
||||
"zone" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_TRENDES)
|
||||
"comment" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_RATING)
|
||||
"desc" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
"forum" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_BBS)
|
||||
"zone" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_TRENDS)
|
||||
}
|
||||
}
|
||||
if (traceEvent != null) {
|
||||
@ -703,7 +722,7 @@ object DirectUtils {
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_GAMEID, id)
|
||||
bundle.putBoolean(KEY_OPEN_VIDEO_STREAMING, true)
|
||||
bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_DESC)
|
||||
bundle.putString(KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -711,14 +730,14 @@ object DirectUtils {
|
||||
fun directToGameDetail(
|
||||
context: Context,
|
||||
id: String,
|
||||
defaultTab: Int = GameDetailFragment.INDEX_DESC,
|
||||
defaultTab: String = GameDetailFragment.TAB_DESC,
|
||||
entrance: String? = null
|
||||
) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, GameDetailActivity::class.java.name)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_GAMEID, id)
|
||||
bundle.putInt(KEY_TARGET, defaultTab)
|
||||
bundle.putString(KEY_TARGET, defaultTab)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -781,8 +800,11 @@ object DirectUtils {
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 畅玩助手反馈跳转
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToFeedbackCompat(
|
||||
fun directToVGameFeedback(
|
||||
context: Context,
|
||||
content: String? = null,
|
||||
hintType: String? = null,
|
||||
@ -797,14 +819,14 @@ object DirectUtils {
|
||||
if (isQaFeedback) {
|
||||
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
|
||||
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
|
||||
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
|
||||
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.cwzsQuestion)
|
||||
} else {
|
||||
bundle.putString(KEY_CONTENT, content)
|
||||
if (TextUtils.isEmpty(hintType)) {
|
||||
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.gameQuestion)
|
||||
bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN)
|
||||
} else {
|
||||
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
|
||||
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.cwzsQuestion)
|
||||
bundle.putString(KEY_SUGGEST_HINT_TYPE, hintType)
|
||||
}
|
||||
}
|
||||
@ -1352,11 +1374,17 @@ object DirectUtils {
|
||||
* 跳转到板块
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToBlock(context: Context, blockData: SubjectRecommendEntity, entrance: String) {
|
||||
fun directToBlock(
|
||||
context: Context,
|
||||
blockData: SubjectRecommendEntity,
|
||||
entrance: String,
|
||||
exposureEvent: ExposureEvent? = null
|
||||
) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, BlockActivity::class.java.name)
|
||||
bundle.putParcelable(KEY_BLOCK_DATA, blockData)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -1364,10 +1392,11 @@ object DirectUtils {
|
||||
* 跳转到开服表
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToGameServers(context: Context, entrance: String, path: String) {
|
||||
fun directToGameServers(context: Context, entrance: String, path: String, exposureEvent: ExposureEvent? = null) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, GameServersActivity::class.java.name)
|
||||
bundle.putString(KEY_ENTRANCE, ToolBarActivity.mergeEntranceAndPath(entrance, path))
|
||||
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -1395,7 +1424,7 @@ object DirectUtils {
|
||||
response?.apply {
|
||||
if (zone.status == "on") {
|
||||
if (zone.style == "link") {
|
||||
directToGameDetail(context, gameId, GameDetailFragment.INDEX_TRENDES, entrance)
|
||||
directToGameDetail(context, gameId, GameDetailFragment.TAB_TRENDS, entrance)
|
||||
} else {
|
||||
directToWebView(context, url, entrance)
|
||||
}
|
||||
@ -1817,7 +1846,8 @@ object DirectUtils {
|
||||
collectionId: String,
|
||||
blockId: String = "",
|
||||
blockName: String = "",
|
||||
entrance: String = ""
|
||||
entrance: String = "",
|
||||
exposureEvent: ExposureEvent? = null
|
||||
) {
|
||||
if (collectionId.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
@ -1826,6 +1856,7 @@ object DirectUtils {
|
||||
bundle.putString(KEY_BLOCK_NAME, blockName)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_COLLECTION_ID, collectionId)
|
||||
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -1861,13 +1892,20 @@ object DirectUtils {
|
||||
* 跳转至游戏单详情
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToGameCollectionDetail(context: Context, id: String, entrance: String? = null, path: String? = null) {
|
||||
fun directToGameCollectionDetail(
|
||||
context: Context,
|
||||
id: String,
|
||||
entrance: String? = null,
|
||||
path: String? = null,
|
||||
exposureEvent: ExposureEvent? = null
|
||||
) {
|
||||
if (id.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
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)) }
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -1909,6 +1947,15 @@ object DirectUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到论坛搜索页
|
||||
* @param bbsId, 为空时搜索全范围的内容,不为空时搜索该 bbsId 对应的内容
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToForumOrUserSearch(context: Context, bbsId: String, entrance: String) {
|
||||
context.startActivity(ForumOrUserSearchActivity.getIntent(context, bbsId, entrance))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToVGameDownload(context: Context, switchToDownloadingTab: Boolean = false) {
|
||||
val bundle = Bundle()
|
||||
|
||||
@ -29,7 +29,7 @@ object DownloadDialogHelper {
|
||||
|
||||
private fun retrieveAvailableDialog(gameEntity: GameEntity, apkEntity: ApkEntity): GameEntity.Dialog? {
|
||||
val downloadDialog = if (gameEntity.shouldUseMirrorInfo()) {
|
||||
gameEntity.mirrorData?.downloadDialog
|
||||
gameEntity.obtainMirrorData()?.downloadDialog
|
||||
} else {
|
||||
gameEntity.downloadDialog
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.collection.ArrayMap
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.common.chain.*
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.dialog.DeviceRemindDialog
|
||||
@ -25,6 +24,7 @@ import com.gh.download.dialog.DownloadDialog
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.WebActivity
|
||||
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.callback.CancelListener
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
@ -266,7 +266,7 @@ object DownloadItemUtils {
|
||||
var downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
|
||||
|
||||
if (downloadEntity == null && gameEntity.isVGame()) {
|
||||
downloadEntity = VHelper.getDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
|
||||
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
|
||||
}
|
||||
|
||||
if (downloadEntity == null) {
|
||||
@ -836,6 +836,7 @@ object DownloadItemUtils {
|
||||
addHandler(CertificationHandler())
|
||||
addHandler(VersionNumberHandler())
|
||||
addHandler(OverseaDownloadHandler())
|
||||
addHandler(CheckStoragePermissionHandler())
|
||||
addHandler(ValidateVSpaceHandler())
|
||||
addHandler(CheckDownloadHandler())
|
||||
}
|
||||
@ -884,7 +885,7 @@ object DownloadItemUtils {
|
||||
}
|
||||
|
||||
if (gameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity.getUniquePackageName() ?: "")
|
||||
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
|
||||
} else {
|
||||
install(context, gameEntity, position, adapter, refreshCallback)
|
||||
}
|
||||
@ -909,7 +910,7 @@ object DownloadItemUtils {
|
||||
}
|
||||
|
||||
if (gameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity.getUniquePackageName() ?: "")
|
||||
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
|
||||
return
|
||||
}
|
||||
|
||||
@ -927,7 +928,12 @@ object DownloadItemUtils {
|
||||
}
|
||||
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, object : EmptyCallback {
|
||||
override fun onCallback() {
|
||||
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
|
||||
DialogUtils.checkDownload(
|
||||
context,
|
||||
apk.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name
|
||||
) { isSubscribe: Boolean ->
|
||||
update(context, gameEntity, entrance, location, isSubscribe, traceEvent)
|
||||
}
|
||||
}
|
||||
@ -1070,6 +1076,7 @@ object DownloadItemUtils {
|
||||
"game_type", gameEntity.categoryChinese,
|
||||
"download_status", gameEntity.downloadStatusChinese,
|
||||
"button_name", buttonName,
|
||||
"game_schema_type", gameEntity.gameBitChinese,
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
"page_id", GlobalActivityManager.getCurrentPageEntity().pageId,
|
||||
"page_business_id", GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.exposure.ExposureUtils
|
||||
import com.gh.common.simulator.SimulatorDownloadManager
|
||||
@ -10,6 +8,8 @@ import com.gh.common.xapk.XapkInstaller
|
||||
import com.gh.download.DownloadDataHelper
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.common.callback.ConfirmListener
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
@ -18,7 +18,6 @@ import com.gh.gamecenter.common.entity.SuggestType
|
||||
import com.gh.gamecenter.common.eventbus.EBShowDialog
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
@ -235,17 +234,13 @@ object DownloadObserver {
|
||||
downloadEntity.name + " - " + platform + " - 下载完成"
|
||||
)
|
||||
else -> {
|
||||
if (downloadEntity.isVGame()) {
|
||||
VHelper.showFloatingWindow(downloadEntity.packageName)
|
||||
} else {
|
||||
if (!downloadEntity.isVGame()) {
|
||||
Utils.toast(mApplication, downloadEntity.name + " - 下载完成")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (downloadEntity.isVGame()) {
|
||||
VHelper.showFloatingWindow(downloadEntity.packageName)
|
||||
} else {
|
||||
if (!downloadEntity.isVGame()) {
|
||||
Utils.toast(mApplication, downloadEntity.name + " - 下载完成")
|
||||
}
|
||||
}
|
||||
@ -281,7 +276,7 @@ object DownloadObserver {
|
||||
val downloadType = downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE)
|
||||
// 是否是自动安装
|
||||
val isAutoInstall = SPUtils.getBoolean(Constants.SP_AUTO_INSTALL, true)
|
||||
if (downloadType == Constants.SIMULATOR_DOWNLOAD || isAutoInstall) {
|
||||
if (downloadType != Constants.VSPACE_32_DOWNLOAD_ONLY && (downloadType == Constants.SIMULATOR_DOWNLOAD || isAutoInstall)) {
|
||||
if (FileUtils.isEmptyFile(downloadEntity.path)) {
|
||||
Utils.toast(mApplication, R.string.install_failure_hint)
|
||||
downloadManager.cancel(downloadEntity.url)
|
||||
@ -317,9 +312,6 @@ object DownloadObserver {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 统计下载完成
|
||||
uploadData(gameId, downloadEntity.platform)
|
||||
}
|
||||
|
||||
// 下载过程分析统计
|
||||
@ -386,14 +378,22 @@ object DownloadObserver {
|
||||
SensorsBridge.trackEvent(
|
||||
"HaloFunGameDownloadDone",
|
||||
"game_name", downloadEntity.name,
|
||||
"game_id", downloadEntity.gameId
|
||||
"game_id", downloadEntity.gameId,
|
||||
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位"
|
||||
)
|
||||
} else if (downloadEntity.gameId != "62bd412bbbf04747cd3de539") {
|
||||
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
|
||||
SensorsBridge.trackEvent(
|
||||
"HaloFunDownloadDone",
|
||||
"space_schema_type",
|
||||
if (downloadEntity.packageName == VHelper.VSPACE_32BIT_PACKAGENAME) "32位" else "64位"
|
||||
)
|
||||
} else if (downloadEntity.gameId != Constants.GHZS_GAME_ID && downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD) {
|
||||
SensorsBridge.trackEvent(
|
||||
"DownloadProcessFinish",
|
||||
"game_id", downloadEntity.gameId,
|
||||
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
|
||||
"game_type", downloadEntity.meta[Constants.GAME_TYPE] ?: "",
|
||||
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
|
||||
"page_name", getCurrentPageEntity().pageName,
|
||||
"page_id", getCurrentPageEntity().pageId,
|
||||
"page_business_id", getCurrentPageEntity().pageBusinessId,
|
||||
@ -452,19 +452,4 @@ object DownloadObserver {
|
||||
DataLogUtils.uploadHijack(mApplication, downloadEntity)
|
||||
}
|
||||
|
||||
// 统计下载
|
||||
private fun uploadData(id: String, platform: String?) {
|
||||
val params = HashMap<String, String>()
|
||||
params["game"] = id
|
||||
params["platform"] = platform ?: ""
|
||||
val body = RequestBody.create(
|
||||
MediaType.parse("application/json"),
|
||||
JSONObject(params as Map<*, *>).toString()
|
||||
)
|
||||
RetrofitManager.getInstance().api.postDownload(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(Response())
|
||||
}
|
||||
|
||||
}
|
||||
@ -221,7 +221,7 @@ object GameActivityDownloadHelper {
|
||||
) {
|
||||
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
|
||||
CertificationDialog.showCertificationDialog(context, gameEntity) {
|
||||
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
|
||||
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
|
||||
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
|
||||
}
|
||||
}
|
||||
@ -241,7 +241,12 @@ object GameActivityDownloadHelper {
|
||||
VHelper.validateVSpaceBeforeAction(context, gameEntity) {
|
||||
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
|
||||
CertificationDialog.showCertificationDialog(context, gameEntity) {
|
||||
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
|
||||
DialogUtils.checkDownload(
|
||||
context,
|
||||
apk.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name
|
||||
) { isSubscribe: Boolean ->
|
||||
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
|
||||
}
|
||||
}
|
||||
@ -262,7 +267,7 @@ object GameActivityDownloadHelper {
|
||||
DownloadDialog.showDownloadDialog(context, gameEntity, traceEvent, entrance, location)
|
||||
} else {
|
||||
CertificationDialog.showCertificationDialog(context, gameEntity) {
|
||||
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
|
||||
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
|
||||
plugin(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
|
||||
}
|
||||
}
|
||||
@ -298,7 +303,7 @@ object GameActivityDownloadHelper {
|
||||
}
|
||||
|
||||
if (gameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity.getUniquePackageName() ?: "")
|
||||
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
|
||||
} else {
|
||||
downloadEntity?.run {
|
||||
install(context, gameEntity, apk, this)
|
||||
@ -336,7 +341,7 @@ object GameActivityDownloadHelper {
|
||||
}
|
||||
|
||||
if (gameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity.getUniquePackageName() ?: "")
|
||||
VHelper.installOrLaunch((context as AppCompatActivity), gameEntity)
|
||||
return
|
||||
}
|
||||
|
||||
@ -355,7 +360,7 @@ object GameActivityDownloadHelper {
|
||||
location: String,
|
||||
traceEvent: ExposureEvent
|
||||
) {
|
||||
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
|
||||
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
|
||||
update(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public class GameUtils {
|
||||
|
||||
// 在下载管理找不到下载实体,并且为畅玩游戏的时候到畅玩数据库里找
|
||||
if (downloadEntity == null && gameEntity.isVGame()) {
|
||||
downloadEntity = VHelper.getDownloadEntitySnapshot(gameEntity.getId(), apkEntity.getPackageName());
|
||||
downloadEntity = VHelper.getVDownloadEntitySnapshot(gameEntity.getId(), apkEntity.getPackageName());
|
||||
}
|
||||
|
||||
if (downloadEntity != null) {
|
||||
|
||||
@ -568,16 +568,19 @@ public class LogUtils {
|
||||
}
|
||||
|
||||
public static void uploadSearchGame(String event, String location, String key, String searchType) {
|
||||
uploadSearchClick(event, location, key, searchType, "", "", false, false);
|
||||
uploadSearchClick(event, location, key, searchType, "", "", 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mirrorDataPosition 镜像的归类,不是镜像是为 -1 ,使用镜像 1 时为 1,使用镜像 2 时为 2
|
||||
*/
|
||||
public static void uploadSearchClick(String event,
|
||||
String location,
|
||||
String key,
|
||||
String searchType,
|
||||
String gameId,
|
||||
String gameName,
|
||||
Boolean isMirrorData,
|
||||
int mirrorDataPosition,
|
||||
Boolean isAdData) {
|
||||
JSONObject object = new JSONObject();
|
||||
JSONObject payload = new JSONObject();
|
||||
@ -591,7 +594,13 @@ public class LogUtils {
|
||||
payload.put("search_type", searchType); //搜索类型, 有四种取值 默认搜索/历史搜索/自动搜索/主动搜索
|
||||
payload.put(KEY_GAME_ID, gameId); //event为search_click才取值
|
||||
payload.put(KEY_GAME_NAME, gameName); //event为search_click才取值
|
||||
payload.put("is_mirror_data", isMirrorData);
|
||||
|
||||
// 是否使用镜像
|
||||
if (mirrorDataPosition == 1) {
|
||||
payload.put("is_mirror_data", true);
|
||||
} else if (mirrorDataPosition == 2) {
|
||||
payload.put("is_mirror2_data", true);
|
||||
}
|
||||
payload.put("is_ad_data", isAdData);
|
||||
object.put(KEY_PAY_LOAD, payload);
|
||||
} catch (JSONException e) {
|
||||
|
||||
@ -5,7 +5,6 @@ import com.gh.gamecenter.common.json.JsonObjectBuilder
|
||||
import com.gh.gamecenter.common.json.json
|
||||
import com.gh.gamecenter.common.loghub.LoghubUtils
|
||||
import com.gh.gamecenter.common.utils.LogUtils
|
||||
import com.gh.gamecenter.common.utils.NewFlatLogUtils
|
||||
import com.gh.gamecenter.entity.HomeSubSlide
|
||||
import com.lightgame.utils.Utils
|
||||
import org.json.JSONArray
|
||||
@ -54,6 +53,66 @@ object NewFlatLogUtils {
|
||||
log(json)
|
||||
}
|
||||
|
||||
// 畅玩助手下载弹窗展示事件
|
||||
@JvmStatic
|
||||
fun logHaloFunDownloadDialogShow(gameId: String, gameName: String, gameArchitecture: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "halo_fun_download_dialog_show"
|
||||
"game_id" to gameId
|
||||
"game_name" to gameName
|
||||
"game_architecture" to gameArchitecture
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json)
|
||||
}
|
||||
|
||||
// 畅玩助手下载点击事件
|
||||
@JvmStatic
|
||||
fun logHaloFunDownloadDialogDownloadClick(architecture: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "halo_fun_download_dialog_download_click"
|
||||
"architecture" to architecture
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json)
|
||||
}
|
||||
|
||||
// 畅玩助手安装提示弹窗展示事件
|
||||
@JvmStatic
|
||||
fun logHaloFunInstallTipDialogShow(architecture: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "halo_fun_install_tip_dialog_show"
|
||||
"architecture" to architecture
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json)
|
||||
}
|
||||
|
||||
// 畅玩助手更新弹窗展示事件
|
||||
@JvmStatic
|
||||
fun logHaloFunUpdateDialogShow(gameId: String, gameName: String, gameArchitecture: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "halo_fun_update_dialog_show"
|
||||
"game_id" to gameId
|
||||
"game_name" to gameName
|
||||
"game_architecture" to gameArchitecture
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json)
|
||||
}
|
||||
|
||||
// 畅玩助手(32位)弹窗事件
|
||||
@JvmStatic
|
||||
fun logHaloFun32DialogEvent(event: String, gameId: String, gameName: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to event
|
||||
"game_id" to gameId
|
||||
"game_name" to gameName
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json)
|
||||
}
|
||||
|
||||
// 关联游戏跳转icon点击事件
|
||||
@JvmStatic
|
||||
fun logHaloFunGameDetailJumpClick(downloadStatus: String, gameId: String) {
|
||||
@ -80,11 +139,12 @@ object NewFlatLogUtils {
|
||||
|
||||
// 畅玩助手更新弹窗点击事件
|
||||
@JvmStatic
|
||||
fun logHaloFunUpdateDialogClick(dialogType: String, buttonType: String) {
|
||||
fun logHaloFunUpdateDialogClick(dialogType: String, buttonType: String, architecture: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "halo_fun_update_dialog_click"
|
||||
"dialog_type" to dialogType
|
||||
KEY_BUTTON_TYPE to buttonType
|
||||
"architecture" to architecture
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json)
|
||||
@ -2100,4 +2160,29 @@ object NewFlatLogUtils {
|
||||
}
|
||||
log(json)
|
||||
}
|
||||
|
||||
// 下载流量提示弹窗展示事件
|
||||
@JvmStatic
|
||||
fun logDownloadMobileDataDialogShow(gameId: String, gameName: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "download_mobile_data_dialog_show"
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json, "event", false)
|
||||
}
|
||||
|
||||
// 下载流量提示弹窗点击事件
|
||||
@JvmStatic
|
||||
fun logDownloadMobileDataDialogClick(gameId: String, gameName: String, button: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "download_mobile_data_dialog_click"
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
"button" to button
|
||||
parseAndPutMeta().invoke(this)
|
||||
}
|
||||
log(json, "event", false)
|
||||
}
|
||||
}
|
||||
@ -38,6 +38,7 @@ import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.gh.vspace.db.VGameEntity;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lg.vspace.VirtualAppManager;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import net.dongliu.apk.parser.ApkFile;
|
||||
@ -554,9 +555,32 @@ public class PackageUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据包名,判断是否已安装该游戏
|
||||
* 不区分是否有桌面图标
|
||||
*/
|
||||
public static boolean isInstalledFromAllPackage(Context context, String packageName) {
|
||||
ArrayList<String> allPackageName = getAllPackageName(context);
|
||||
return allPackageName.contains(packageName);
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
context.getPackageManager().getPackageInfo(
|
||||
packageName,
|
||||
PackageManager.PackageInfoFlags.of(0)
|
||||
);
|
||||
} else {
|
||||
context.getPackageManager().getPackageInfo(packageName, 0);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
ArrayList<String> allPackageName = getAllPackageName(context);
|
||||
boolean isInstalled = allPackageName.contains(packageName);
|
||||
|
||||
if (isInstalled) {
|
||||
// 能进这里说明上面的 try {} 结果有问题,记录一下
|
||||
SentryHelper.INSTANCE.onEvent("CHECK_INSTALLED_CONFLICT", "packageName", packageName);
|
||||
}
|
||||
|
||||
return isInstalled;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -16,6 +16,9 @@ object RealNameHelper {
|
||||
|
||||
var pendingInstallPkgPath = ""
|
||||
|
||||
// 0表示未实名,1表示未成年,2表示成年
|
||||
private var mCertificationStatus: Int = 0
|
||||
|
||||
/**
|
||||
* 弹未成年人不能下载游戏弹窗
|
||||
*/
|
||||
@ -124,7 +127,21 @@ object RealNameHelper {
|
||||
DownloadManager.getInstance()
|
||||
.addInvisiblePendingTask(downloadEntity)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实名状态 0表示未实名,1表示未成年,2表示成年
|
||||
*/
|
||||
fun getCertificationStatus(): Int {
|
||||
return mCertificationStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新实名状态 0表示未实名,1表示未成年,2表示成年
|
||||
*/
|
||||
@JvmStatic
|
||||
fun updateCertificationStatus(newCertificationStatus: Int) {
|
||||
mCertificationStatus = newCertificationStatus
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.common.xapk
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
@ -20,13 +21,26 @@ import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.help.HelpAndFeedbackBridge
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.utils.Utils
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
object XapkDialogHelper {
|
||||
|
||||
private var mUnzipFailureDialogRef: WeakReference<Dialog>? = null
|
||||
|
||||
fun showUnzipFailureDialog(context: Context, downloadEntity: DownloadEntity, isManualAction: Boolean) {
|
||||
val trigger = if (isManualAction) "手动触发" else "自动触发"
|
||||
NewFlatLogUtils.logXApkUnzipFailedDialogShowed(trigger, downloadEntity.gameId, downloadEntity.name)
|
||||
DialogHelper.showGuideDialog(
|
||||
|
||||
val previousShowedDialog = mUnzipFailureDialogRef?.get()
|
||||
|
||||
if (previousShowedDialog != null
|
||||
&& previousShowedDialog.isShowing
|
||||
&& context == previousShowedDialog.ownerActivity) {
|
||||
// 上一个解压失败弹窗还在显示,当前 activity 不用再显示新的弹窗了
|
||||
return
|
||||
}
|
||||
|
||||
val dialog = DialogHelper.showGuideDialog(
|
||||
context = context,
|
||||
title = "",
|
||||
content = "未授权允许未知来源安装、数据包格式、设备兼容性…等均可能导致解压失败。\n如果开启权限后仍未能解决,请提交反馈帮助我们改进。",
|
||||
@ -107,6 +121,11 @@ object XapkDialogHelper {
|
||||
},
|
||||
extraConfig = DialogHelper.Config(showCloseIcon = true)
|
||||
)
|
||||
|
||||
if (context is Activity) {
|
||||
dialog?.setOwnerActivity(context)
|
||||
}
|
||||
mUnzipFailureDialogRef = WeakReference(dialog)
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.gh.download
|
||||
import android.content.pm.PackageInfo
|
||||
import android.text.TextUtils
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.common.util.RealNameHelper
|
||||
import com.gh.common.xapk.XapkInstaller
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil
|
||||
@ -125,6 +126,7 @@ object DownloadDataHelper {
|
||||
payloadObject.put("gameName", downloadEntity.name)
|
||||
payloadObject.put("platform", downloadEntity.platform)
|
||||
payloadObject.put("package", downloadEntity.packageName)
|
||||
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
|
||||
payloadObject.put("filename", getFileName(downloadEntity))
|
||||
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
|
||||
jsonObject.put("payload", payloadObject)
|
||||
@ -209,6 +211,7 @@ object DownloadDataHelper {
|
||||
payloadObject.put("gameName", downloadEntity.name)
|
||||
payloadObject.put("platform", downloadEntity.platform)
|
||||
payloadObject.put("package", downloadEntity.packageName)
|
||||
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
|
||||
payloadObject.put("filename", getFileName(downloadEntity))
|
||||
payloadObject.put("launch_ms", startupTime)
|
||||
payloadObject.put("task_num", NDataChanger.downloadingTasks.size)
|
||||
@ -247,6 +250,7 @@ object DownloadDataHelper {
|
||||
payloadObject.put("gameName", downloadEntity.name)
|
||||
payloadObject.put("platform", downloadEntity.platform)
|
||||
payloadObject.put("package", downloadEntity.packageName)
|
||||
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
|
||||
payloadObject.put("filename", getFileName(downloadEntity))
|
||||
payloadObject.put("total_size", sizeInMB)
|
||||
if (parallel != null) {
|
||||
@ -317,6 +321,7 @@ object DownloadDataHelper {
|
||||
payloadObject.put("gameName", downloadEntity.name)
|
||||
payloadObject.put("platform", downloadEntity.platform)
|
||||
payloadObject.put("package", downloadEntity.packageName)
|
||||
payloadObject.put("certification", RealNameHelper.getCertificationStatus())
|
||||
payloadObject.put("filename", getFileName(downloadEntity))
|
||||
payloadObject.put("speed_progress", JSONArray(averageSpeedList))
|
||||
payloadObject.put("is_finished", downloadEntity.status == DownloadStatus.done)
|
||||
@ -356,6 +361,7 @@ object DownloadDataHelper {
|
||||
sheet.put("game_id", downloadEntity.gameId)
|
||||
sheet.put("platform", downloadEntity.platform)
|
||||
sheet.put("package", downloadEntity.packageName)
|
||||
sheet.put("certification", RealNameHelper.getCertificationStatus())
|
||||
sheet.put("filename", getFileName(downloadEntity))
|
||||
sheet.put("total_size", downloadEntity.size / 1024 / 1024)
|
||||
sheet.put("current_progress_size", downloadEntity.progress / 1024)
|
||||
|
||||
@ -341,15 +341,18 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
ExtensionsKt.addMetaExtra(downloadEntity, Constants.EXTRA_DOWNLOAD_TYPE, Constants.SMOOTH_GAME);
|
||||
ExtensionsKt.addMetaExtra(downloadEntity, DownloadConfig.KEY_PROGRESS_CALLBACK_INTERVAL, "200");
|
||||
ExtensionsKt.addMetaExtra(downloadEntity, VHelper.KEY_REQUIRED_G_APPS, gameEntity.getGAppsSwitch());
|
||||
ExtensionsKt.addMetaExtra(downloadEntity, VHelper.KEY_BIT, apkEntity.getBit());
|
||||
|
||||
SensorsBridge.trackEvent("HaloFunGameDownloadClick",
|
||||
"game_name", gameEntity.getName(),
|
||||
"game_id", gameEntity.getId());
|
||||
"game_id", gameEntity.getId(),
|
||||
"game_schema_type", gameEntity.getGameBitChinese());
|
||||
} else {
|
||||
SensorsBridge.trackEvent("DownloadProcessBegin",
|
||||
"game_id", gameEntity.getId(),
|
||||
"game_name", gameEntity.getName(),
|
||||
"game_type", gameEntity.getCategoryChinese(),
|
||||
"game_schema_type", gameEntity.getGameBitChinese(),
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().getPageName(),
|
||||
"page_id", GlobalActivityManager.getCurrentPageEntity().getPageId(),
|
||||
"page_business_id", GlobalActivityManager.getCurrentPageEntity().getPageBusinessId(),
|
||||
@ -626,7 +629,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 url 获取下载任务快照 (仅保证下载状态一致)
|
||||
* 根据包名获取下载任务快照 (仅保证下载状态一致)
|
||||
*
|
||||
* @param packageName 包名 (多包名一样时取第一个,若使用场景里有多包名,请使用 url 获取下载任务)
|
||||
* @return null 表示下载列表中不存在该任务,否则返回下载任务
|
||||
|
||||
@ -145,7 +145,8 @@ object PackageObserver {
|
||||
mDownloadEntity?.let {
|
||||
if (it.isVGame()) return@let
|
||||
|
||||
if (it.isPluggable || it.isUpdate) {
|
||||
if (it.isPluggable
|
||||
|| (it.isUpdate && !PackageUtils.isInstalled(application, it.packageName))) {
|
||||
PackageInstaller.install(application, mDownloadEntity)
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import tv.danmaku.ijk.media.exo2.ExoSourceManager
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
object ExoCacheManager {
|
||||
|
||||
@ -98,7 +99,9 @@ object ExoCacheManager {
|
||||
.build()
|
||||
var response: Response? = null
|
||||
try {
|
||||
response = OkHttpClient.Builder().build().newCall(request).execute()
|
||||
response =
|
||||
OkHttpClient.Builder().connectTimeout(5, TimeUnit.SECONDS).readTimeout(5, TimeUnit.SECONDS).build()
|
||||
.newCall(request).execute()
|
||||
if (response!!.isSuccessful && response.body() != null) {
|
||||
val length = response.body()!!.contentLength()
|
||||
contentLength = if (length == 0L) -1L else length
|
||||
|
||||
@ -373,7 +373,9 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
|
||||
override fun onConfirm() {
|
||||
DialogUtils.checkDownload(
|
||||
context,
|
||||
apkEntity.size
|
||||
apkEntity.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name
|
||||
) { isSubscribe ->
|
||||
DownloadManager.createDownload(
|
||||
context,
|
||||
|
||||
@ -27,7 +27,7 @@ class BlockActivity : DownloadToolbarActivity() {
|
||||
}
|
||||
|
||||
override fun provideNormalIntent(): Intent {
|
||||
return getTargetIntent(this, BlockActivity::class.java, GameFragment::class.java)
|
||||
return getTargetIntent(this, BlockActivity::class.java, GameFragment::class.java, intent?.extras)
|
||||
}
|
||||
|
||||
override fun showDownloadMenu(): Boolean {
|
||||
|
||||
@ -101,7 +101,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
entrance: String,
|
||||
traceEvent: ExposureEvent?
|
||||
) {
|
||||
startGameDetailActivity(context, gameEntity, entrance, -1, traceEvent = traceEvent)
|
||||
startGameDetailActivity(context, gameEntity, entrance, "", traceEvent = traceEvent)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,7 +117,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
context: Context,
|
||||
gameEntity: GameEntity?,
|
||||
entrance: String,
|
||||
defaultTab: Int = -1,
|
||||
defaultTab: String = "",
|
||||
isSkipGameComment: Boolean = false,
|
||||
scrollToLibao: Boolean = false,
|
||||
scrollToServer: Boolean = false,
|
||||
@ -140,18 +140,18 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
)
|
||||
traceEvent.payload = payload
|
||||
}
|
||||
if (defaultTab != -1) {
|
||||
bundle.putInt(EntranceConsts.KEY_TARGET, defaultTab)
|
||||
if (defaultTab.isNotEmpty()) {
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, defaultTab)
|
||||
}
|
||||
if (isSkipGameComment) {
|
||||
bundle.putBoolean(EntranceConsts.KEY_SKIP_GAME_COMMENT, true)
|
||||
}
|
||||
if (scrollToLibao) {
|
||||
bundle.putInt(EntranceConsts.KEY_TARGET, GameDetailFragment.INDEX_DESC)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_LIBAO, true)
|
||||
}
|
||||
if (scrollToServer) {
|
||||
bundle.putInt(EntranceConsts.KEY_TARGET, GameDetailFragment.INDEX_DESC)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_SERVER, true)
|
||||
}
|
||||
bundle.putString(EntranceConsts.KEY_GAMEID, gameEntity?.id)
|
||||
@ -257,7 +257,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
}
|
||||
if (openVideoStreaming) {
|
||||
bundle.putBoolean(EntranceConsts.KEY_OPEN_VIDEO_STREAMING, true)
|
||||
bundle.putInt(EntranceConsts.KEY_TARGET, GameDetailFragment.INDEX_DESC)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
}
|
||||
if (openPlatformWindow) {
|
||||
bundle.putBoolean(EntranceConsts.KEY_OPEN_PLATFORM_WINDOW, true)
|
||||
@ -269,7 +269,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
}
|
||||
}
|
||||
if (scrollToLibao) {
|
||||
bundle.putInt(EntranceConsts.KEY_TARGET, GameDetailFragment.INDEX_TRENDES)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_LIBAO, true)
|
||||
}
|
||||
bundle.putString(EntranceConsts.KEY_GAMEID, gameId)
|
||||
|
||||
@ -861,7 +861,7 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
|
||||
imageView.setOnLongClickListener {
|
||||
// 下滑的时候不弹
|
||||
if (imageView.isDragging()) {
|
||||
return@setOnLongClickListener false
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
|
||||
val dialog = Dialog(this@ImageViewerActivity)
|
||||
@ -897,7 +897,7 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
|
||||
}
|
||||
dialog.cancel()
|
||||
}
|
||||
false
|
||||
true
|
||||
}
|
||||
view.tag = position
|
||||
container.addView(view)
|
||||
|
||||
@ -26,7 +26,6 @@ import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
@ -34,6 +33,7 @@ import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -43,6 +43,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.common.DefaultUrlHandler;
|
||||
import com.gh.common.constant.Config;
|
||||
@ -76,6 +77,7 @@ import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
|
||||
import com.gh.gamecenter.common.constant.CommonConsts;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.constant.RouteConsts;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.common.entity.NotificationUgc;
|
||||
import com.gh.gamecenter.common.entity.SuggestType;
|
||||
@ -90,6 +92,7 @@ import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.common.utils.NotificationHelper;
|
||||
import com.gh.gamecenter.common.utils.ShareUtils;
|
||||
import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.core.provider.IStartUpAdProvider;
|
||||
import com.gh.gamecenter.core.utils.ClassUtils;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
@ -189,6 +192,8 @@ public class MainActivity extends BaseActivity {
|
||||
private final Handler handler = new Handler();
|
||||
public boolean showAd = false; // 是否显示广告
|
||||
|
||||
private IStartUpAdProvider mStartUpAdProvider;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
showAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null;
|
||||
@ -469,6 +474,8 @@ public class MainActivity extends BaseActivity {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (mStartUpAdProvider != null) mStartUpAdProvider.cancelStartUpAd(this);
|
||||
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
releaseExoSourceCache();
|
||||
}
|
||||
@ -502,8 +509,17 @@ public class MainActivity extends BaseActivity {
|
||||
showStartUp(startUp);
|
||||
AppExecutor.getUiExecutor().executeWithDelay(() -> {
|
||||
hideStartUp();
|
||||
observeStartUpAd();
|
||||
initStartUpAd();
|
||||
}, 2000);
|
||||
} else {
|
||||
initStartUpAd();
|
||||
}
|
||||
}
|
||||
|
||||
private void initStartUpAd() {
|
||||
mStartUpAdProvider = (IStartUpAdProvider) ARouter.getInstance().build(RouteConsts.provider.adSdk).navigation();
|
||||
if (mStartUpAdProvider != null && mStartUpAdProvider.shouldEnableSDK(HaloApp.getInstance().getChannel())) {
|
||||
initSDKStartUpAd();
|
||||
} else {
|
||||
observeStartUpAd();
|
||||
}
|
||||
@ -597,6 +613,12 @@ public class MainActivity extends BaseActivity {
|
||||
startAdContainer.setVisibility(View.GONE);
|
||||
ExtensionsKt.removeFromParent(startAdContainer);
|
||||
}
|
||||
View startSdkAdContainer = findViewById(R.id.sdkStartAdContainer);
|
||||
if (startSdkAdContainer != null) {
|
||||
startSdkAdContainer.setVisibility(View.GONE);
|
||||
ExtensionsKt.removeFromParent(startSdkAdContainer);
|
||||
if (mStartUpAdProvider != null) mStartUpAdProvider.cancelStartUpAd(this);
|
||||
}
|
||||
checkDialog();
|
||||
}
|
||||
|
||||
@ -654,6 +676,18 @@ public class MainActivity extends BaseActivity {
|
||||
mBaseHandler.sendEmptyMessageDelayed(COUNTDOWN_AD, 1000);
|
||||
}
|
||||
|
||||
private void initSDKStartUpAd() {
|
||||
View startAdContainer = findViewById(R.id.sdkStartAdContainer);
|
||||
startAdContainer.setVisibility(View.VISIBLE);
|
||||
FrameLayout adsFl = findViewById(R.id.adsFl);
|
||||
if (mStartUpAdProvider != null) {
|
||||
mStartUpAdProvider.initStartUpAd(startAdContainer, adsFl, showAd, () -> {
|
||||
hideStartUpAd();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void showStartUp(StartupAdEntity ad) {
|
||||
TextView adContentTv = findViewById(R.id.adContentTv);
|
||||
View containerView = findViewById(R.id.maskContainer);
|
||||
|
||||
@ -30,7 +30,6 @@ import com.ethanhua.skeleton.ViewSkeletonScreen;
|
||||
import com.gh.base.DownloadToolbarActivity;
|
||||
import com.gh.common.filter.RegionSettingHelper;
|
||||
import com.gh.common.history.HistoryHelper;
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils;
|
||||
import com.gh.common.util.CheckLoginUtils;
|
||||
import com.gh.common.util.CollectionUtils;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
@ -41,6 +40,8 @@ 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.EBNetworkState;
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.ShareUtils;
|
||||
@ -49,15 +50,16 @@ import com.gh.gamecenter.common.view.VerticalItemDecoration;
|
||||
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.entity.NewsDetailEntity;
|
||||
import com.gh.gamecenter.feature.entity.NewsEntity;
|
||||
import com.gh.gamecenter.eventbus.EBConcernChanged;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
import com.gh.gamecenter.common.eventbus.EBNetworkState;
|
||||
import com.gh.gamecenter.eventbus.EBPackage;
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils;
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailAdapter;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.download.DataWatcher;
|
||||
@ -557,6 +559,17 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onDeleteComment(EBDeleteComment event) {
|
||||
adapter.getNewsCommentNum();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onAddComment(EBAddComment event) {
|
||||
adapter.getNewsCommentNum();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
switch (ev.getAction() & MotionEventCompat.ACTION_MASK) {
|
||||
|
||||
@ -58,6 +58,7 @@ import com.gh.gamecenter.common.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.common.entity.SimpleGameEntity;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.ToastUtils;
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity;
|
||||
import com.gh.gamecenter.entity.VideoLinkEntity;
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils;
|
||||
@ -148,7 +149,7 @@ public class SkipActivity extends BaseActivity {
|
||||
if (!TextUtils.isEmpty(qaId)) {
|
||||
DirectUtils.directToQa(this, qaTitle, qaId);
|
||||
} else if ("vgame".equals(suggestionType)) {
|
||||
DirectUtils.directToFeedbackCompat(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
|
||||
DirectUtils.directToVGameFeedback(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
|
||||
} else {
|
||||
DirectUtils.directToFeedback(this, content, null, isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
|
||||
}
|
||||
@ -327,11 +328,11 @@ public class SkipActivity extends BaseActivity {
|
||||
entity.setLink(path);
|
||||
entity.setName(name);
|
||||
entity.setText(name);
|
||||
DirectUtils.directToBlock(this, entity, mEntrance);
|
||||
DirectUtils.directToBlock(this, entity, mEntrance, null);
|
||||
break;
|
||||
|
||||
case EntranceConsts.HOST_SERVER_BLOCK:
|
||||
DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器");
|
||||
DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器", null);
|
||||
break;
|
||||
|
||||
case EntranceConsts.HOST_AMWAY_BLOCK:
|
||||
@ -399,7 +400,7 @@ public class SkipActivity extends BaseActivity {
|
||||
DirectUtils.directToHelpAndFeedback(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position));
|
||||
break;
|
||||
case HOST_GAME_COLLECTION_DETAIL:
|
||||
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "");
|
||||
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "", null);
|
||||
break;
|
||||
case HOST_GAME_COLLECTION_SQUARE:
|
||||
DirectUtils.directToGameCollectionSquare(this, ENTRANCE_BROWSER, "", "", "");
|
||||
@ -450,6 +451,12 @@ public class SkipActivity extends BaseActivity {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
if (SkipActivity.this.isFinishing()) {
|
||||
ToastUtils.toast("创建桌面图标失败,请重试");
|
||||
return;
|
||||
}
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@ import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.g00fy2.versioncompare.Version
|
||||
import com.gh.common.dialog.NewPrivacyPolicyDialogFragment
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.common.util.GameSubstituteRepositoryHelper.updateGameSubstituteRepository
|
||||
import com.gh.common.util.UsageStatsHelper.checkAndPostUsageStats
|
||||
import com.gh.download.DownloadManager
|
||||
@ -29,10 +28,12 @@ import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.common.callback.SimpleCallback
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil
|
||||
import com.gh.gamecenter.common.tracker.TrackerLogger
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.provider.IAppProvider
|
||||
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
|
||||
import com.gh.gamecenter.core.provider.IStartUpAdProvider
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.entity.PrivacyPolicyEntity
|
||||
@ -62,6 +63,9 @@ class SplashScreenActivity : BaseActivity() {
|
||||
private var mStartMainActivityDirectly = false // 是否不需要用户点击立即体验就直接跳转首页
|
||||
private var mViewModel: SplashScreenViewModel? = null
|
||||
private var mShouldPrefetchData = true
|
||||
private val mStartUpAdProvider by lazy {
|
||||
ARouter.getInstance().build(RouteConsts.provider.adSdk).navigation() as? IStartUpAdProvider
|
||||
}
|
||||
|
||||
private val mPermissions = arrayOf(
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
@ -160,9 +164,11 @@ class SplashScreenActivity : BaseActivity() {
|
||||
val signatureHash = packageUtilsConfig?.getApkSignatureByPackageName(this, packageName)?.get(0)
|
||||
val sideLoadInfo = packageUtilsConfig?.getSideLoadedInfo()
|
||||
val trackEvent = JSONObject()
|
||||
// 是否首次使用神策
|
||||
val isFirstTime = SPUtils.getBoolean(Constants.SP_SENSORS_IS_FIRST_TIME, true)
|
||||
tryCatchInRelease {
|
||||
trackEvent.run {
|
||||
put("\$is_first_time", SPUtils.getBoolean(Constants.SP_SENSORS_IS_FIRST_TIME, true))
|
||||
put("\$is_first_time", isFirstTime)
|
||||
put("is_side_loaded", sideLoadInfo?.get("is_side_loaded").toBoolean())
|
||||
put("installer_store", sideLoadInfo?.get("installer_store") ?: "")
|
||||
put("package_name", packageName)
|
||||
@ -172,6 +178,10 @@ class SplashScreenActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
SensorsBridge.trackEvent("AppLaunch", trackEvent)
|
||||
if (!isFirstTime && HaloApp.getInstance().isBrandNewInstall) {
|
||||
// 神策不是第一次使用,但是全局标志为全新安装,有问题,上报数据供后续确认
|
||||
SentryHelper.onEvent("WRONG_LAUNCH_LOG", "a_id", MetaUtil.getBase64EncodedAndroidId())
|
||||
}
|
||||
SPUtils.setBoolean(Constants.SP_SENSORS_IS_FIRST_TIME, false)
|
||||
}
|
||||
|
||||
@ -294,19 +304,39 @@ class SplashScreenActivity : BaseActivity() {
|
||||
overridePendingTransition(0, 0)
|
||||
startActivity(intent)
|
||||
doFlavorInit()
|
||||
initStartUpAdSDK()
|
||||
logAppLaunch()
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun doFlavorInit() {
|
||||
HaloApp.getInstance().flavorProvider.init(HaloApp.getInstance(), this)
|
||||
HaloApp.getInstance().flavorProvider.init(HaloApp.getInstance(), this, PkgHelper.getActivateRatio())
|
||||
|
||||
// 仅官网渠道和测试包启用神策
|
||||
if ("GH_206" == HaloApp.getInstance().channel || PackageFlavorHelper.IS_TEST_FLAVOR) {
|
||||
val whiteListChannel = arrayListOf(
|
||||
"GH_206",
|
||||
"KS-GHZS-KY1",
|
||||
"KS-GHZS-MC1",
|
||||
"GDT_GHZS_MC1",
|
||||
"T11-GH-APPDY-ZC01",
|
||||
"T7-GH-APPDY-KY03",
|
||||
"T8-GH-APPUX-KY04",
|
||||
"T1-GHZS-MC01",
|
||||
"T4-GHZS-MC03"
|
||||
)
|
||||
|
||||
if (whiteListChannel.contains(HaloApp.getInstance().channel) || PackageFlavorHelper.IS_TEST_FLAVOR) {
|
||||
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initStartUpAdSDK() {
|
||||
mStartUpAdProvider?.run {
|
||||
if (shouldEnableSDK(HaloApp.getInstance().channel)) {
|
||||
initSDK(applicationContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getGitLogString(): String {
|
||||
if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) {
|
||||
val stringBuilder = StringBuilder()
|
||||
|
||||
@ -8,27 +8,31 @@ import android.view.ViewGroup;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.gh.gamecenter.common.constant.ItemViewType;
|
||||
import com.gh.common.util.CheckLoginUtils;
|
||||
import com.gh.common.util.CommentUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
|
||||
import com.gh.gamecenter.common.constant.ItemViewType;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.entity.ArticleCommentParent;
|
||||
import com.gh.gamecenter.entity.CommentEntity;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.eventbus.EBDeleteComment;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@ -68,22 +72,34 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
mDataExceptionView = dataExceptionView;
|
||||
mRecyclerView = recyclerView;
|
||||
|
||||
loadData();
|
||||
mOnCommentCallBackListener.onCommentCallback(null);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void loadData() {
|
||||
public void refresh() {
|
||||
loadData(1);
|
||||
}
|
||||
|
||||
public void loadMore() {
|
||||
loadData(mPage + 1);
|
||||
}
|
||||
|
||||
public void loadData(int page) {
|
||||
if (mIsLoading) return;
|
||||
mIsLoading = true;
|
||||
RetrofitManager.getInstance().getApi()
|
||||
.getCommentTrace(mCommentId, mPage)
|
||||
.getCommentTrace(mCommentId, page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<CommentEntity>>() {
|
||||
@Override
|
||||
public void onResponse(List<CommentEntity> response) {
|
||||
super.onResponse(response);
|
||||
if (page == 1) {
|
||||
mCommentList.clear();
|
||||
}
|
||||
mCommentList.addAll(response);
|
||||
|
||||
if (response.size() < 20) {
|
||||
mIsOver = true;
|
||||
}
|
||||
@ -91,7 +107,7 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
mDataExceptionView.setVisibility(View.GONE);
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
notifyItemRangeChanged(0, getItemCount() - 1);
|
||||
mPage++;
|
||||
mPage = page;
|
||||
mIsLoading = false;
|
||||
}
|
||||
|
||||
@ -201,8 +217,14 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
});
|
||||
|
||||
holder.commentMore.setOnClickListener(v ->
|
||||
CommentUtils.showReportDialog(commentEntity,
|
||||
mContext, false, "资讯文章-评论"));
|
||||
CommentUtils.showMorePopupWindow(
|
||||
holder.commentMore,
|
||||
commentEntity,
|
||||
false,
|
||||
"资讯文章-评论",
|
||||
() -> EventBus.getDefault().post(new EBDeleteComment(commentEntity))
|
||||
)
|
||||
);
|
||||
|
||||
holder.commentUserIconDv.setOnClickListener(v -> DirectUtils.directToHomeActivity(mContext, commentEntity.getUser().getId(), "", "文章-评论详情"));
|
||||
holder.commentUserNameTv.setOnClickListener(v -> DirectUtils.directToHomeActivity(mContext, commentEntity.getUser().getId(), "", "文章-评论详情"));
|
||||
@ -254,4 +276,24 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
public boolean isLoading() {
|
||||
return mIsLoading;
|
||||
}
|
||||
|
||||
public void notifyCommentRemoved(final CommentEntity entity) {
|
||||
int positionInComments = getCommentIndexByEntity(mCommentList, entity);
|
||||
if (positionInComments != -1) {
|
||||
mCommentList.remove(positionInComments);
|
||||
notifyItemRemoved(positionInComments);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getCommentIndexByEntity(
|
||||
final List<CommentEntity> commentList,
|
||||
final CommentEntity comment
|
||||
) {
|
||||
for (int i = 0; i < commentList.size();i++) {
|
||||
if (Objects.equals(comment.getId(), commentList.get(i).getId())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,7 +324,11 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
if (mLibaoDetailEntity.getTime() != null) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm", Locale.CHINA);
|
||||
String start = format.format((mLibaoDetailEntity.getTime().getStart() * 1000));
|
||||
String end = format.format((mLibaoDetailEntity.getTime().getEnd() * 1000));
|
||||
|
||||
long libaoLingEndTime = mLibaoDetailEntity.getTime().getEnd();
|
||||
String end = libaoLingEndTime == 0
|
||||
? mContext.getString(R.string.libao_ling_time_infinitely) // 礼包领取结束时间为空则表示礼包长期有效
|
||||
: format.format((mLibaoDetailEntity.getTime().getEnd() * 1000));
|
||||
|
||||
holder.binding.libaodetailTimeStart.setText(StringUtils.buildString("开始时间:", start));
|
||||
holder.binding.libaodetailTimeEnd.setText(StringUtils.buildString("截止时间:", end));
|
||||
|
||||
@ -42,6 +42,7 @@ 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.eventbus.EBDeleteComment;
|
||||
import com.gh.gamecenter.manager.VisitManager;
|
||||
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.common.retrofit.OkHttpCache;
|
||||
@ -50,12 +51,14 @@ import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@ -151,6 +154,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
return;
|
||||
}
|
||||
if (isRefresh) {
|
||||
isOver = false;
|
||||
mNormalCommentList.clear();
|
||||
mPage = 1;
|
||||
}
|
||||
@ -467,8 +471,14 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
});
|
||||
|
||||
holder.commentMore.setOnClickListener(v ->
|
||||
CommentUtils.showReportDialog(finalCommentEntity,
|
||||
mContext, true, "资讯文章详情-评论详情"));
|
||||
CommentUtils.showMorePopupWindow(
|
||||
holder.commentMore,
|
||||
finalCommentEntity,
|
||||
true,
|
||||
"资讯文章详情-评论详情",
|
||||
() -> EventBus.getDefault().post(new EBDeleteComment(finalCommentEntity))
|
||||
)
|
||||
);
|
||||
|
||||
holder.commentUserNameTv.setOnClickListener(v -> DirectUtils.directToHomeActivity(mContext, finalCommentEntity.getUser().getId(), mEntrance, "文章-评论详情"));
|
||||
holder.commentUserIconDv.setOnClickListener(v -> DirectUtils.directToHomeActivity(mContext, finalCommentEntity.getUser().getId(), mEntrance, "文章-评论详情"));
|
||||
@ -524,6 +534,42 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
});
|
||||
}
|
||||
|
||||
public void notifyCommentRemoved(final CommentEntity entity) {
|
||||
|
||||
if (mHotCommentList.size() > 0) {
|
||||
int positionInHotComments = getCommentIndexByEntity(mHotCommentList, entity);
|
||||
if (positionInHotComments != -1) {// 如果在热门评论中存在要被删除的评论,则将此评论移除
|
||||
mHotCommentList.remove(positionInHotComments);
|
||||
}
|
||||
}
|
||||
|
||||
if (mNormalCommentList.size() > 0) {
|
||||
int positionInNormalComments = getCommentIndexByEntity(mNormalCommentList, entity);
|
||||
if (positionInNormalComments != -1) {// 如果在热门评论中存在要被删除的评论,则将此评论移除
|
||||
mNormalCommentList.remove(positionInNormalComments);
|
||||
}
|
||||
}
|
||||
|
||||
if (mConcernEntity != null) {
|
||||
int commentNum = mConcernEntity.getCommentnum();
|
||||
mConcernEntity.setCommentnum(commentNum - 1);
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private static int getCommentIndexByEntity(
|
||||
final List<CommentEntity> commentList,
|
||||
final CommentEntity comment
|
||||
) {
|
||||
for (int i = 0; i < commentList.size();i++) {
|
||||
if (Objects.equals(comment.getId(), commentList.get(i).getId())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void statNewsViews(final String news_id) {
|
||||
RetrofitManager.getInstance().getApi().postArticleVisit(news_id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -587,7 +633,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
}
|
||||
|
||||
public void addCommentCount() {
|
||||
mConcernEntity.setCommentnum(mConcernEntity.getCommentnum());
|
||||
mConcernEntity.setCommentnum(mConcernEntity.getCommentnum() + 1);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@ -166,6 +166,7 @@ public class DetailViewHolder {
|
||||
"game_type", mGameEntity.getCategoryChinese(),
|
||||
"download_status", mGameEntity.getDownloadStatusChinese(),
|
||||
"button_name", mViewHolder.mDownloadPb.getText(),
|
||||
"game_schema_type", mGameEntity.getGameBitChinese(),
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().getPageName(),
|
||||
"page_id", GlobalActivityManager.getCurrentPageEntity().getPageId(),
|
||||
"page_business_id", GlobalActivityManager.getCurrentPageEntity().getPageBusinessId(),
|
||||
@ -285,9 +286,9 @@ public class DetailViewHolder {
|
||||
|
||||
ChainBuilder builder = new ChainBuilder();
|
||||
builder.addHandler(new UpdateNewSimulatorHandler());
|
||||
builder.addHandler(new ValidateVSpaceHandler());
|
||||
builder.addHandler(new GamePermissionHandler());
|
||||
builder.addHandler(new CheckStoragePermissionHandler());
|
||||
builder.addHandler(new ValidateVSpaceHandler());
|
||||
|
||||
if (mGameEntity.getApk().size() == 1) {
|
||||
builder.addHandler(new BrowserInstallHandler());
|
||||
@ -346,7 +347,7 @@ public class DetailViewHolder {
|
||||
}
|
||||
|
||||
if (mGameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch(mViewHolder.context, mGameEntity.getApk().get(0).getPackageName());
|
||||
VHelper.installOrLaunch(mViewHolder.context, mGameEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -388,7 +389,7 @@ public class DetailViewHolder {
|
||||
}
|
||||
|
||||
if (mGameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch(v.getContext(), mGameEntity.getApk().get(0).getPackageName());
|
||||
VHelper.installOrLaunch(v.getContext(), mGameEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
private fun backToLaunchApp(showLoading: Boolean = true) {
|
||||
val gamePkg = mGamePkg
|
||||
if (gamePkg != null) { // 跳转回游戏
|
||||
VHelper.launch(this, gamePkg, showLoading = showLoading)
|
||||
VHelper.launch(this, gamePkg, ignoreGApps = true, showLoading = showLoading)
|
||||
return
|
||||
}
|
||||
val remotePkgName = this.mRemotePkgName
|
||||
|
||||
@ -43,14 +43,14 @@ class SpecialCatalogSubjectCollectionAdapter(
|
||||
}
|
||||
val entity = mList[position]
|
||||
ImageUtils.display(subjectCollectionImage, entity.image)
|
||||
subjectCollectionImage.loadingCallback = object : WrapContentDraweeView.LoadingCallback {
|
||||
subjectCollectionImage.registerLoadingCallback(object : WrapContentDraweeView.LoadingCallback {
|
||||
override fun loaded() {
|
||||
subjectCollectionImage.layoutParams = subjectCollectionImage.layoutParams.apply {
|
||||
height = 96F.dip2px()
|
||||
width = (subjectCollectionImage.aspectRatio * 96F.dip2px()).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
root.setOnClickListener {
|
||||
DirectUtils.directToLinkPage(
|
||||
mContext,
|
||||
|
||||
@ -338,7 +338,7 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
|
||||
btnText = getString(R.string.launch)
|
||||
setOnClickListener {
|
||||
CurrentActivityHolder.getCurrentActivity()?.let {
|
||||
VHelper.installOrLaunch(it, downloadEntity.packageName)
|
||||
VHelper.installOrLaunch(it, downloadEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,11 @@ class CloudArchiveManagerViewModel(
|
||||
) :
|
||||
ListViewModel<ArchiveEntity, ArchiveEntity>(application) {
|
||||
|
||||
companion object {
|
||||
private const val SORT_TYPE_CREATE = "time.create:-1"
|
||||
private const val SORT_TYPE_SHARE_AND_CREATE = "time.share:-1,time.create:-1"
|
||||
}
|
||||
|
||||
var archiveConfigStr = ""
|
||||
private val mNewApi = RetrofitManager.getInstance().newApi
|
||||
private val mApi = RetrofitManager.getInstance().api
|
||||
@ -54,10 +59,10 @@ class CloudArchiveManagerViewModel(
|
||||
|
||||
override fun provideDataObservable(page: Int): Observable<List<ArchiveEntity>>? = when (mType) {
|
||||
MyArchiveFragment.Type.MY_ARCHIVE -> {
|
||||
mNewApi.getMyArchives(gameId, page)
|
||||
mNewApi.getMyArchives(gameId, page, SORT_TYPE_CREATE)
|
||||
}
|
||||
MyArchiveFragment.Type.MY_DOWNLOAD_ARCHIVE -> null
|
||||
MyArchiveFragment.Type.MY_SHARE_ARCHIVE -> mNewApi.getMyShareArchives(gameId, page)
|
||||
MyArchiveFragment.Type.MY_SHARE_ARCHIVE -> mNewApi.getMyShareArchives(gameId, page, SORT_TYPE_SHARE_AND_CREATE)
|
||||
}
|
||||
|
||||
override fun provideDataSingle(page: Int): Single<MutableList<ArchiveEntity>>? {
|
||||
@ -77,7 +82,7 @@ class CloudArchiveManagerViewModel(
|
||||
url = vArchiveEntity.url,
|
||||
configUrl = vArchiveEntity.configUrl,
|
||||
md5 = vArchiveEntity.md5,
|
||||
time = ArchiveEntity.Time(update = vArchiveEntity.time),
|
||||
time = ArchiveEntity.Time(create = vArchiveEntity.time),
|
||||
gameVersion = vArchiveEntity.gameVersion
|
||||
)
|
||||
)
|
||||
|
||||
@ -48,7 +48,7 @@ class MyArchiveAdapter(
|
||||
val entity = mEntityList[position]
|
||||
holder.binding.run {
|
||||
titleTv.text = entity.name
|
||||
timeTv.text = entity.time.update.formatTime("yyyy-MM-dd HH:mm")
|
||||
timeTv.text = entity.time.create.formatTime("yyyy-MM-dd HH:mm")
|
||||
versionTv.text = "版本:${entity.gameVersion}"
|
||||
optionsIv.setOnClickListener {
|
||||
MyArchiveOptionDialogFragment.show(
|
||||
|
||||
@ -17,7 +17,7 @@ class MyShareArchiveFragment : MyArchiveFragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mBinding.tipsTv.visibility = View.GONE
|
||||
mBinding.reuseNoneData.reuseNoneDataTv.text = "还没有您分享存档噢~"
|
||||
mBinding.reuseNoneData.reuseNoneDataTv.text = "您还没有分享存档噢~"
|
||||
mBinding.reuseNoneData.reuseNoneDataDescTv.text = "快快把您的有趣存档分享给大家吧!"
|
||||
}
|
||||
|
||||
|
||||
@ -100,9 +100,6 @@ class CommunityArticleAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.bbs == CommunityEntity()) {
|
||||
entity.bbs = entity.community
|
||||
}
|
||||
holder.binding.selectIv.goneIf(mCurrentOption == ManageOption.OPTION_MANAGER)
|
||||
holder.binding.selectIv.isChecked = selectItems.contains(entity.id)
|
||||
holder.binding.imageContainer.setOffset(if (mCurrentOption == ManageOption.OPTION_MANAGER) 40f else 76f)
|
||||
|
||||
@ -7,6 +7,9 @@ import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureSource
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
* 猜你喜欢-发现页
|
||||
@ -27,9 +30,15 @@ class DiscoveryActivity : ToolBarActivity() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, entrance: String): Intent {
|
||||
fun getIntent(context: Context, entrance: String, exposureEvent: ExposureEvent? = null): Intent {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
exposureEvent?.let {
|
||||
bundle.putParcelableArrayList(
|
||||
EntranceConsts.KEY_EXPOSURE_SOURCE_LIST,
|
||||
ArrayList(exposureEvent.source)
|
||||
)
|
||||
}
|
||||
return getTargetIntent(context, DiscoveryActivity::class.java, DiscoveryFragment::class.java, bundle)
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,6 +151,8 @@ class DiscoveryFragment : LazyListFragment<DiscoveryItemData, DiscoveryViewModel
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
val basicExposureSource = arrayListOf<ExposureSource>().apply {
|
||||
arguments?.getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let { add(it) }
|
||||
arguments?.getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
|
||||
?.let { addAll(it) }
|
||||
}
|
||||
val outerSequence = requireArguments().getInt(EntranceConsts.KEY_POSITION, -1)
|
||||
|
||||
|
||||
@ -294,7 +294,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
case subscribe:
|
||||
PermissionHelper.checkStoragePermissionBeforeAction(mContext, () -> {
|
||||
// 下载管理不用判断是否大于50M
|
||||
DialogUtils.checkDownload(mContext, Float.toString(100F), isSubscribe -> {
|
||||
DialogUtils.checkDownload(mContext, Float.toString(100F), downloadEntity.getGameId(), downloadEntity.getName(), isSubscribe -> {
|
||||
if (isSubscribe) {
|
||||
DownloadManager.getInstance().subscribe(downloadEntity);
|
||||
statusMap.put(url, DownloadStatus.subscribe.getStatus());
|
||||
|
||||
@ -127,11 +127,12 @@ class InstalledGameViewModel(application: Application) : AndroidViewModel(applic
|
||||
}
|
||||
if (newEntity.getApk().size > 1) {
|
||||
for (apkEntity in newEntity.getApk()) {
|
||||
val packageName: String = sortedList.get(i).packageName
|
||||
val packageName: String = sortedList[i].packageName
|
||||
if (packageName == apkEntity.packageName) {
|
||||
val list = ArrayList<ApkEntity>()
|
||||
list.add(apkEntity)
|
||||
newEntity.setApk(list)
|
||||
newEntity.dropOtherApk()
|
||||
if (PackageUtils.isCanPluggable(apkEntity)) {
|
||||
val pluggableCollection =
|
||||
GameUtils.getPluggableCollectionFromGameEntity(
|
||||
|
||||
@ -19,6 +19,8 @@ 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.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
@ -341,7 +343,9 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
|
||||
(CurrentActivityHolder.getCurrentActivity() as? FragmentActivity)?.checkStoragePermissionBeforeAction {
|
||||
DialogUtils.checkDownload(
|
||||
updateBtn.context,
|
||||
update.size
|
||||
update.size,
|
||||
downloadEntity?.gameId ?: "",
|
||||
downloadEntity?.name ?: ""
|
||||
) { isSubscribe: Boolean ->
|
||||
if (str.contains("化")) {
|
||||
if (update.pluggableCollection != null) {
|
||||
@ -397,6 +401,21 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
|
||||
updateBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||
}
|
||||
}
|
||||
|
||||
SensorsBridge.trackEvent(
|
||||
"DownLoadbuttonClick",
|
||||
"game_id", update.id,
|
||||
"game_name", update.name ?: "",
|
||||
"game_type", update.categoryChinese,
|
||||
"download_status", update.downloadStatusChinese,
|
||||
"button_name", str,
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
"page_id", GlobalActivityManager.getCurrentPageEntity().pageId,
|
||||
"page_business_id", GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
|
||||
"last_page_name", GlobalActivityManager.getLastPageEntity().pageName,
|
||||
"last_page_id", GlobalActivityManager.getLastPageEntity().pageId,
|
||||
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,16 +6,17 @@ import androidx.lifecycle.*
|
||||
import com.gh.common.exposure.ExposureUtils
|
||||
import com.gh.common.exposure.ExposureUtils.logADownloadExposureEvent
|
||||
import com.gh.common.history.HistoryHelper.insertGameEntity
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.common.util.DataCollectionUtils
|
||||
import com.gh.common.util.PackageInstaller.createDownloadId
|
||||
import com.gh.common.util.PackageInstaller.getDownloadPathWithId
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.common.base.BaseSimpleDao
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge.trackEvent
|
||||
import com.gh.gamecenter.common.utils.addMetaExtra
|
||||
import com.gh.gamecenter.common.utils.secondOrNull
|
||||
import com.gh.gamecenter.common.utils.toProperReadableSize
|
||||
@ -23,10 +24,12 @@ import com.gh.gamecenter.common.utils.tryCatchInRelease
|
||||
import com.gh.gamecenter.core.utils.GsonUtils.toJson
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation
|
||||
import com.gh.gamecenter.eventbus.EBDownloadChanged
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -586,6 +589,8 @@ class UpdatableGameViewModel(
|
||||
downloadEntity.addMetaExtra(Constants.GAME_ICON_SUBSCRIPT, update.iconSubscript)
|
||||
downloadEntity.addMetaExtra(Constants.DOWNLOAD_ID, downloadId)
|
||||
downloadEntity.addMetaExtra(Constants.APK_MD5, update.md5)
|
||||
downloadEntity.addMetaExtra(Constants.GAME_NAME, update.name)
|
||||
downloadEntity.addMetaExtra(Constants.GAME_TYPE, update.categoryChinese)
|
||||
if (update.iconFloat != null) {
|
||||
downloadEntity.addMetaExtra(Constants.GAME_ICON_FLOAT_TOP_TEXT, update.iconFloat?.upperLeftText)
|
||||
downloadEntity.addMetaExtra(Constants.GAME_ICON_FLOAT_TOP_COLOR, update.iconFloat?.upperLeftColor)
|
||||
@ -634,6 +639,19 @@ class UpdatableGameViewModel(
|
||||
|
||||
// 收集下载数据
|
||||
DataCollectionUtils.uploadDownload(getApplication(), downloadEntity, "开始")
|
||||
|
||||
trackEvent(
|
||||
"DownloadProcessBegin",
|
||||
"game_id", update.id,
|
||||
"game_name", update.name ?: "",
|
||||
"game_type", update.categoryChinese,
|
||||
"page_name", getCurrentPageEntity().pageName,
|
||||
"page_id", getCurrentPageEntity().pageId,
|
||||
"page_business_id", getCurrentPageEntity().pageBusinessId,
|
||||
"last_page_name", getLastPageEntity().pageName,
|
||||
"last_page_id", getLastPageEntity().pageId,
|
||||
"last_page_business_id", getLastPageEntity().pageBusinessId
|
||||
)
|
||||
}
|
||||
|
||||
private fun sizeStringToLong(sizeString: String): Long {
|
||||
|
||||
@ -11,6 +11,8 @@ class AppEntity(
|
||||
@SerializedName("version_code")
|
||||
var versionCode: Int = 0,
|
||||
|
||||
var category: String? = "",
|
||||
|
||||
var url: String? = null,
|
||||
|
||||
var size: String? = null,
|
||||
@ -31,6 +33,8 @@ class AppEntity(
|
||||
* EVERY_TIME_OPEN(每次打开)
|
||||
*/
|
||||
var alert: String? = null,
|
||||
// 关联64位更新
|
||||
var relation: AppEntity? = null
|
||||
) : Parcelable {
|
||||
fun isAlertEveryTime() = alert == "EVERY_TIME_OPEN"
|
||||
|
||||
|
||||
@ -52,7 +52,10 @@ class ForumDetailEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String = "",
|
||||
var name: String = "",
|
||||
var permissions: String = ""
|
||||
var permissions: String = "",
|
||||
var icon: String = "",
|
||||
@SerializedName("icon_type")
|
||||
var iconType: String = ""
|
||||
) : Parcelable
|
||||
|
||||
fun convertForumDetailEntityToForumEntity(): ForumEntity {
|
||||
|
||||
@ -48,6 +48,23 @@ data class GameUpdateEntity(
|
||||
var md5: String? = "",
|
||||
var downloadStatus: String? = ""
|
||||
) {
|
||||
val categoryChinese: String
|
||||
get() = when (category) {
|
||||
"online" -> "网络"
|
||||
"local" -> "单机"
|
||||
"welfare" -> "福利"
|
||||
"simulator" -> "模拟器"
|
||||
else -> category ?: ""
|
||||
}
|
||||
|
||||
val downloadStatusChinese: String
|
||||
get() = when (downloadStatus) {
|
||||
"on" -> "开启"
|
||||
"smooth" -> "畅玩"
|
||||
"appointment" -> "预约"
|
||||
"demo" -> "试玩"
|
||||
else -> ""
|
||||
}
|
||||
|
||||
fun isShowPlugin(location: PluginLocation): Boolean {
|
||||
if (plugin.isNullOrEmpty() || "open" == plugin || plugin == location.name) {
|
||||
|
||||
@ -6,6 +6,8 @@ import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class HomeSubSlide(
|
||||
@SerializedName("_id")
|
||||
val id: String = "",
|
||||
@SerializedName("link_type")
|
||||
val linkType: String = "",
|
||||
@SerializedName("link_id")
|
||||
|
||||
@ -41,6 +41,10 @@ data class SubjectRecommendEntity(
|
||||
|
||||
var display: Display = Display(),
|
||||
|
||||
var img: String? = "",
|
||||
@SerializedName("tab_show_img")
|
||||
var showImgOnSelected: Boolean? = false, // 选中时是否显示图片
|
||||
|
||||
// local variable
|
||||
var useLightStyle: Boolean = false,
|
||||
var primaryColor: Int = Color.WHITE,
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
package com.gh.gamecenter.eventbus;
|
||||
|
||||
public class EBAddComment {}
|
||||
@ -0,0 +1,3 @@
|
||||
package com.gh.gamecenter.eventbus
|
||||
|
||||
class EBTopCommunityChanged(val communityId: String)
|
||||
@ -40,7 +40,7 @@ class ForumArticleAskListAdapter(
|
||||
|
||||
private var mDefOrderList = listOf("回复", "发布")
|
||||
private var mVideoOrderList = listOf("推荐", "发布")
|
||||
private var mFilterPosition = 0
|
||||
private var mFilterPosition = if (path == "视频") 1 else 0
|
||||
|
||||
override fun areItemsTheSame(oldItem: AnswerEntity?, newItem: AnswerEntity?): Boolean {
|
||||
return oldItem?.id == newItem?.id
|
||||
|
||||
@ -21,7 +21,7 @@ class ForumArticleAskListViewModel(application: Application, val bbsId: String =
|
||||
var sort: String = "time.reply"
|
||||
var filter: String = "section_id"
|
||||
var selectedSection = ForumDetailEntity.Section("", "全部")
|
||||
var videoSort: String = "recommend"
|
||||
var videoSort: String = "time.upload"
|
||||
var videoList = arrayListOf<ForumVideoEntity>()
|
||||
|
||||
override fun provideDataObservable(page: Int): Observable<MutableList<AnswerEntity>> {
|
||||
|
||||
@ -5,6 +5,7 @@ import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Build
|
||||
@ -14,10 +15,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.TextView
|
||||
import android.widget.*
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.core.content.ContextCompat
|
||||
@ -57,9 +55,11 @@ import com.gh.gamecenter.core.iinterface.IScrollable
|
||||
import com.gh.gamecenter.core.runOnUiThread
|
||||
import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.databinding.FragmentForumDetailBinding
|
||||
import com.gh.gamecenter.databinding.ItemForumSectionBinding
|
||||
import com.gh.gamecenter.databinding.PopupForumDetailSectionsBinding
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.eventbus.EBForumFollowChange
|
||||
import com.gh.gamecenter.eventbus.EBTopCommunityChanged
|
||||
import com.gh.gamecenter.eventbus.EBTypeChange
|
||||
import com.gh.gamecenter.feature.entity.AnswerEntity
|
||||
import com.gh.gamecenter.feature.entity.ForumVideoEntity
|
||||
@ -75,6 +75,7 @@ import com.gh.gamecenter.qa.article.edit.ArticleEditActivity
|
||||
import com.gh.gamecenter.qa.questions.edit.QuestionEditActivity
|
||||
import com.gh.gamecenter.qa.video.publish.VideoPublishActivity
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.halo.assistant.fragment.WebFragment
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@ -171,6 +172,8 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
|
||||
return FragmentStateAdapter(childFragmentManager, mFragmentsList, mTabTitleList)
|
||||
}
|
||||
|
||||
override fun provideIndicatorWidth(): Int = 16
|
||||
|
||||
override fun getInflatedLayout(): View {
|
||||
mBinding = FragmentForumDetailBinding.bind(layoutInflater.inflate(R.layout.fragment_forum_detail, null, false))
|
||||
return mBinding.root
|
||||
@ -373,6 +376,73 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
|
||||
LogUtils.uploadAccessToBbs(mBbsId, "论坛详情")
|
||||
}
|
||||
|
||||
override fun onFragmentFirstVisible() {
|
||||
mTabTitleList.clear()
|
||||
mFragmentsList.clear()
|
||||
|
||||
initTabTitleList(mTabTitleList)
|
||||
mFragmentsList.addAll(restoreFragments())
|
||||
if (mFragmentsList.isEmpty() || mFragmentsList.size != mTabTitleList.size) {
|
||||
mFragmentsList.clear()
|
||||
initFragmentList(mFragmentsList)
|
||||
}
|
||||
|
||||
mViewPager.offscreenPageLimit = mFragmentsList.size
|
||||
mViewPager.addOnPageChangeListener(this)
|
||||
mViewPager.adapter = providePagerAdapter()
|
||||
mViewPager.currentItem = mCheckedIndex
|
||||
mTabLayout.setupWithViewPager(mViewPager)
|
||||
mTabIndicatorView.setupWithTabLayout(mTabLayout)
|
||||
mTabIndicatorView.setupWithViewPager(mViewPager)
|
||||
mTabIndicatorView.setIndicatorWidth(provideIndicatorWidth())
|
||||
initTabLayout()
|
||||
mTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||
override fun onTabSelected(tab: TabLayout.Tab) {
|
||||
updateTabStyle(tab, true)
|
||||
}
|
||||
|
||||
override fun onTabUnselected(tab: TabLayout.Tab) {
|
||||
updateTabStyle(tab, false)
|
||||
}
|
||||
|
||||
override fun onTabReselected(tab: TabLayout.Tab) {
|
||||
updateTabStyle(tab, true)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun initTabLayout() {
|
||||
for (i in 0 until mTabLayout.tabCount) {
|
||||
val tab = mTabLayout.getTabAt(i)
|
||||
if (tab != null) {
|
||||
tab.customView =
|
||||
BaseFragment_TabLayout.createDefaultTabCustomView(requireContext(), tab.text.toString())
|
||||
updateTabStyle(tab, i == mViewPager.currentItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateTabStyle(tab: TabLayout.Tab, isChecked: Boolean) {
|
||||
tab.customView?.findViewById<TextView>(R.id.tab_title)?.run {
|
||||
if (mShowZone && text == mTabTitleList[INDEX_TRENDS]) {
|
||||
compoundDrawablePadding = 2F.dip2px()
|
||||
setDrawableStart(
|
||||
AppCompatResources.getDrawable(
|
||||
requireContext(),
|
||||
if (isChecked) R.drawable.icon_raiders_selected else R.drawable.icon_raiders_default
|
||||
)
|
||||
)
|
||||
}
|
||||
textSize = 16F
|
||||
setTextColor(
|
||||
if (isChecked) R.color.text_title.toColor(requireContext()) else R.color.text_subtitle.toColor(
|
||||
requireContext()
|
||||
)
|
||||
)
|
||||
typeface = if (isChecked) Typeface.DEFAULT_BOLD else Typeface.DEFAULT
|
||||
}
|
||||
}
|
||||
|
||||
private fun initSection() {
|
||||
val sectionLayoutManager = LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
|
||||
mForumSectionAdapter = ForumSectionAdapter(requireContext(), mViewModel!!) {
|
||||
@ -394,7 +464,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
|
||||
mViewModel?.sectionListLiveData?.observe(this) {
|
||||
if (!it.isNullOrEmpty() && it.size >= 2) {
|
||||
mShowSections = true
|
||||
mBinding.sectionContainer.visibility = View.VISIBLE
|
||||
mBinding.sectionContainer.goneIf(mViewPager.currentItem != INDEX_ALL)
|
||||
if (mSectionId.isNotEmpty()) {
|
||||
it.forEachIndexed { index, section ->
|
||||
if (section.id == mSectionId) {
|
||||
@ -569,6 +639,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
|
||||
webBundle.putString(EntranceConsts.KEY_ENTRANCE, "游戏专区")
|
||||
webBundle.putString(EntranceConsts.KEY_URL, it.link)
|
||||
webBundle.putBoolean(WebFragment.KEY_OPEN_NATIVE_PAGE, true)
|
||||
webBundle.putString(EntranceConsts.KEY_BBS_ID, mBbsId)
|
||||
webBundle.putString(EntranceConsts.KEY_PATH, TAB_TRENDS)
|
||||
webFragment.arguments = webBundle
|
||||
mTrendsFragment = webFragment
|
||||
@ -586,6 +657,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
|
||||
mViewPager.adapter?.notifyDataSetChanged()
|
||||
mAskIndex = INDEX_ASK + 1
|
||||
mVideoIndex = INDEX_VIDEO + 1
|
||||
initTabLayout()
|
||||
|
||||
if (arguments?.getBoolean(EntranceConsts.KEY_SCROLL_TO_TRENDS, false) == true) {
|
||||
mViewPager.currentItem = INDEX_TRENDS
|
||||
@ -1016,12 +1088,12 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
|
||||
).apply { mPopupWindow = this }
|
||||
|
||||
mViewModel?.sectionListLiveData?.value?.forEachIndexed { index, section ->
|
||||
val item = getItemTextView(section.name)
|
||||
val item = getSectionItemView(section)
|
||||
binding.flexbox.addView(item)
|
||||
item.tag = section.name
|
||||
toggleHighlightedTextView(item, mViewModel?.selectedSection?.id == section.id)
|
||||
toggleHighlightedView(item, mViewModel?.selectedSection?.id == section.id)
|
||||
item.setOnClickListener {
|
||||
toggleHighlightedTextView(item, true)
|
||||
toggleHighlightedView(item, true)
|
||||
mViewModel?.selectedSection = section
|
||||
setSection(index)
|
||||
mForumSectionAdapter?.run {
|
||||
@ -1046,25 +1118,30 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
|
||||
popupWindow.showAsDropDown(mBinding.tabContainer, 0, 0)
|
||||
}
|
||||
|
||||
private fun toggleHighlightedTextView(targetTextView: TextView, highlightIt: Boolean) {
|
||||
private fun toggleHighlightedView(targetView: View, highlightIt: Boolean) {
|
||||
val sectionTv = targetView.findViewById<TextView>(R.id.sectionTv)
|
||||
if (highlightIt) {
|
||||
targetTextView.background = R.drawable.button_round_primary_light.toDrawable(requireContext())
|
||||
targetTextView.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
targetView.background = R.drawable.button_round_primary_light.toDrawable(requireContext())
|
||||
sectionTv?.setTextColor(R.color.theme_font.toColor(requireContext()))
|
||||
} else {
|
||||
targetTextView.background = R.drawable.button_round_gray_light.toDrawable(requireContext())
|
||||
targetTextView.setTextColor(R.color.text_subtitle.toColor(requireContext()))
|
||||
targetView.background = R.drawable.button_round_gray_light.toDrawable(requireContext())
|
||||
sectionTv?.setTextColor(R.color.text_subtitle.toColor(requireContext()))
|
||||
}
|
||||
}
|
||||
|
||||
private fun getItemTextView(name: String): TextView {
|
||||
return TextView(requireContext()).apply {
|
||||
text = name
|
||||
includeFontPadding = false
|
||||
textSize = 12F
|
||||
gravity = Gravity.CENTER
|
||||
setPadding(12F.dip2px(), 0, 12F.dip2px(), 0)
|
||||
val params = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 24F.dip2px())
|
||||
layoutParams = params
|
||||
private fun getSectionItemView(entity: ForumDetailEntity.Section): View {
|
||||
return ItemForumSectionBinding.bind(
|
||||
LayoutInflater.from(requireContext()).inflate(R.layout.item_forum_section, null)
|
||||
).apply {
|
||||
iconIv.goneIf(entity.iconType.isEmpty() || entity.iconType == "none")
|
||||
when {
|
||||
entity.iconType == "url" && entity.icon.isNotEmpty() -> ImageUtils.display(iconIv, entity.icon)
|
||||
entity.iconType == "new" -> ImageUtils.display(iconIv, R.drawable.icon_section_newest)
|
||||
entity.iconType == "hot" -> ImageUtils.display(iconIv, R.drawable.icon_section_heat)
|
||||
}
|
||||
sectionTv.text = entity.name
|
||||
}.root.apply {
|
||||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 24F.dip2px())
|
||||
}
|
||||
}
|
||||
|
||||
@ -1143,13 +1220,20 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
|
||||
for (i in 0 until mBinding.fragmentTabLayout.tabCount) {
|
||||
val tab = mBinding.fragmentTabLayout.getTabAt(i)
|
||||
if (tab != null) {
|
||||
BaseFragment_TabLayout.updateTabStyle(tab, tab.isSelected)
|
||||
updateTabStyle(tab, tab.isSelected)
|
||||
}
|
||||
}
|
||||
mForumSectionAdapter?.let { it.notifyItemRangeChanged(0, it.itemCount) }
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onTopCommunityChanged(event: EBTopCommunityChanged) {
|
||||
if (event.communityId == mBbsId) {
|
||||
mViewModel?.getForumDetail(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun scrollToTop() {
|
||||
val fragment = mFragmentsList.safelyGetInRelease(mViewPager.currentItem)
|
||||
if (fragment is IScrollable && fragment.isAdded) {
|
||||
|
||||
@ -50,8 +50,12 @@ class ForumDetailViewModel(application: Application, val bbsId: String) : Androi
|
||||
.subscribe(EmptyResponse())
|
||||
}
|
||||
|
||||
fun getForumDetail() {
|
||||
mApi.getForumDetail(bbsId)
|
||||
/**
|
||||
* 获取论坛详情
|
||||
* @param refresh 是否刷新后台缓存
|
||||
*/
|
||||
fun getForumDetail(refresh: Boolean = false) {
|
||||
mApi.getForumDetail(bbsId, refresh)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<ForumDetailEntity>() {
|
||||
|
||||
@ -5,10 +5,7 @@ import android.view.ViewGroup
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.common.utils.toDrawable
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.databinding.ItemForumSectionBinding
|
||||
import com.gh.gamecenter.entity.ForumDetailEntity
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
@ -30,26 +27,38 @@ class ForumSectionAdapter(context: Context, val viewModel: ForumDetailViewModel,
|
||||
|
||||
override fun onBindViewHolder(holder: ForumSectionItemViewHolder, position: Int) {
|
||||
val entity = mSectionList[position]
|
||||
holder.binding.root.run {
|
||||
layoutParams = (layoutParams as MarginLayoutParams).apply {
|
||||
leftMargin = if (position == 0) 16F.dip2px() else 6F.dip2px()
|
||||
}
|
||||
holder.binding.iconIv.goneIf(entity.iconType.isEmpty() || entity.iconType == "none")
|
||||
when {
|
||||
entity.iconType == "url" && entity.icon.isNotEmpty() -> ImageUtils.display(
|
||||
holder.binding.iconIv,
|
||||
entity.icon
|
||||
)
|
||||
|
||||
entity.iconType == "new" -> ImageUtils.display(holder.binding.iconIv, R.drawable.icon_section_newest)
|
||||
entity.iconType == "hot" -> ImageUtils.display(holder.binding.iconIv, R.drawable.icon_section_heat)
|
||||
}
|
||||
holder.binding.sectionTv.run {
|
||||
text = entity.name
|
||||
setTextColor(
|
||||
if (entity.id == viewModel.selectedSection.id) R.color.theme_font.toColor(mContext) else R.color.text_subtitle.toColor(
|
||||
mContext
|
||||
)
|
||||
)
|
||||
background =
|
||||
if (entity.id == viewModel.selectedSection.id) R.drawable.button_round_primary_light.toDrawable(mContext) else R.drawable.button_round_gray_light.toDrawable(
|
||||
mContext
|
||||
)
|
||||
setOnClickListener {
|
||||
viewModel.selectedSection = entity
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
onClick.invoke(position)
|
||||
}
|
||||
}
|
||||
holder.binding.root.run {
|
||||
layoutParams = (layoutParams as MarginLayoutParams).apply {
|
||||
leftMargin = if (position == 0) 16F.dip2px() else 6F.dip2px()
|
||||
}
|
||||
background =
|
||||
if (entity.id == viewModel.selectedSection.id) R.drawable.button_round_primary_light.toDrawable(mContext) else R.drawable.button_round_gray_light.toDrawable(
|
||||
mContext
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class ForumSectionItemViewHolder(val binding: ItemForumSectionBinding) : RecyclerView.ViewHolder(binding.root)
|
||||
|
||||
@ -386,4 +386,9 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
fun getCurrentPosition(): Long {
|
||||
return mCurrentPosition
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
mMuteDisposable?.dispose()
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,7 @@ class CommunityHomeViewModel(application: Application) : AndroidViewModel(applic
|
||||
articleEntity.count = articleDetailEntity.count
|
||||
articleDetailEntity.community.id = articleDetailEntity.communityId
|
||||
articleEntity.community = articleDetailEntity.community
|
||||
articleEntity.bbs = articleDetailEntity.community
|
||||
articleEntity.community = articleDetailEntity.community
|
||||
articleEntity.time = articleDetailEntity.time
|
||||
articleEntity.title = articleDetailEntity.title
|
||||
articleEntity.user = articleDetailEntity.user
|
||||
@ -89,7 +89,7 @@ class CommunityHomeViewModel(application: Application) : AndroidViewModel(applic
|
||||
?: ""
|
||||
articleEntity.count = questionDetailEntity.count
|
||||
articleEntity.community = questionDetailEntity.community
|
||||
articleEntity.bbs = questionDetailEntity.community
|
||||
articleEntity.community = questionDetailEntity.community
|
||||
articleEntity.time = questionDetailEntity.time
|
||||
articleEntity.title = questionDetailEntity.title ?: ""
|
||||
articleEntity.user = questionDetailEntity.user
|
||||
@ -114,7 +114,7 @@ class CommunityHomeViewModel(application: Application) : AndroidViewModel(applic
|
||||
articleEntity.length = forumVideoEntity.length
|
||||
articleEntity.videoInfo = forumVideoEntity.videoInfo
|
||||
articleEntity.count = forumVideoEntity.count
|
||||
articleEntity.bbs = forumVideoEntity.bbs ?: CommunityEntity()
|
||||
articleEntity.community = forumVideoEntity.bbs ?: CommunityEntity()
|
||||
articleEntity.time = TimeEntity(upload = forumVideoEntity.time.upload)
|
||||
articleEntity.title = forumVideoEntity.title
|
||||
forumVideoEntity.user.run {
|
||||
|
||||
@ -62,7 +62,6 @@ class ForumArticleListAdapter(
|
||||
ItemViewType.ITEM_BODY -> {
|
||||
val viewHolder = holder as ForumArticleAskItemViewHolder
|
||||
val articleEntity = mEntityList[position]
|
||||
articleEntity.community = CommunityEntity(articleEntity.bbs.id, articleEntity.bbs.name)
|
||||
|
||||
if (articleEntity.type == "bbs_article") articleEntity.type = "community_article"
|
||||
if (articleEntity.type == "bbs_question") articleEntity.type = "question"
|
||||
@ -102,13 +101,13 @@ class ForumArticleListAdapter(
|
||||
"question" -> "提问帖"
|
||||
else -> "提问帖评论"
|
||||
}
|
||||
val bbsType = if (bbs.type == "official_bbs") "综合论坛" else "游戏论坛"
|
||||
val bbsType = if (community.type == "official_bbs") "综合论坛" else "游戏论坛"
|
||||
NewLogUtils.logRecommendFeedContentClick(
|
||||
"click_for_you_content",
|
||||
contentType,
|
||||
id,
|
||||
position + 1,
|
||||
bbs.id,
|
||||
community.id,
|
||||
bbsType,
|
||||
user.id ?: ""
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@ import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.utils.debugOnly
|
||||
import com.gh.gamecenter.common.utils.singleToMain
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.entity.HomeDataEntity
|
||||
@ -26,12 +27,19 @@ class HomeSearchToolWrapperViewModel(application: Application) : AndroidViewMode
|
||||
val homeDataLiveData = MutableLiveData<HomeDataEntity>()
|
||||
val error = MutableLiveData<Exception>()
|
||||
|
||||
private var mHomeTabPosition: Int = -1
|
||||
private var mHomeTab: SubjectRecommendEntity? = null
|
||||
|
||||
var appBarOffset = 0
|
||||
|
||||
init {
|
||||
getHomeContentUnion()
|
||||
}
|
||||
|
||||
fun getHomeTabEntity() = mHomeTab
|
||||
|
||||
fun getHomeTabPosition() = mHomeTabPosition
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun getHomeContentUnion(isRefresh: Boolean = false) {
|
||||
RetrofitManager.getInstance().api
|
||||
@ -55,6 +63,8 @@ class HomeSearchToolWrapperViewModel(application: Application) : AndroidViewMode
|
||||
tab.isSlideEmpty = true
|
||||
tab.isTopViewShow = false
|
||||
}
|
||||
mHomeTab = tab
|
||||
mHomeTabPosition = index
|
||||
}
|
||||
|
||||
if (tab.type == "bbs") {
|
||||
|
||||
@ -111,7 +111,7 @@ class WelcomeDialogFragment : BaseDialogFragment() {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
binding.ivOpeningCover.loadingCallback = object : WrapContentDraweeView.LoadingCallback {
|
||||
binding.ivOpeningCover.registerLoadingCallback(object : WrapContentDraweeView.LoadingCallback {
|
||||
override fun loaded() {
|
||||
binding.root.post {
|
||||
if (binding.ivOpeningCover.measuredHeight > binding.root.resources.displayMetrics.heightPixels * .8) {
|
||||
@ -121,7 +121,7 @@ class WelcomeDialogFragment : BaseDialogFragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
binding.ivCloseBackup.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
|
||||
@ -136,6 +136,9 @@ class GameFragment : LazyFragment() {
|
||||
arguments?.getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let {
|
||||
add(it)
|
||||
}
|
||||
arguments?.getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)?.let {
|
||||
addAll(it)
|
||||
}
|
||||
add(
|
||||
ExposureSource(
|
||||
"板块",
|
||||
|
||||
@ -45,7 +45,7 @@ class GameColumnCollectionAdapter(
|
||||
|
||||
val data = mSubjectEntity.data!![position]
|
||||
ImageUtils.display(holder.binding.columnCollectionImage, data.image)
|
||||
holder.binding.columnCollectionImage.loadingCallback = object : WrapContentDraweeView.LoadingCallback {
|
||||
holder.binding.columnCollectionImage.registerLoadingCallback(object : WrapContentDraweeView.LoadingCallback {
|
||||
override fun loaded() {
|
||||
holder.binding.columnCollectionImage.layoutParams =
|
||||
holder.binding.columnCollectionImage.layoutParams.apply {
|
||||
@ -53,7 +53,7 @@ class GameColumnCollectionAdapter(
|
||||
width = (holder.binding.columnCollectionImage.aspectRatio * columnCollectionHeight).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
holder.binding.columnCollectionImage.setOnClickListener {
|
||||
mClickClosure(position, data)
|
||||
|
||||
@ -14,7 +14,8 @@ class CommonCollectionDetailActivity : ToolBarActivity() {
|
||||
return getTargetIntent(
|
||||
this,
|
||||
CommonCollectionDetailActivity::class.java,
|
||||
CommonCollectionDetailFragment::class.java
|
||||
CommonCollectionDetailFragment::class.java,
|
||||
intent?.extras
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@ class CommonCollectionDetailAdapter(
|
||||
val mViewModel: CommonCollectionDetailViewModel,
|
||||
val mBlockId: String,
|
||||
val mBlockName: String,
|
||||
val mEntrance: String
|
||||
val mEntrance: String,
|
||||
private val mBasicExposureSource: List<ExposureSource>?
|
||||
) : ListAdapter<CommonCollectionContentEntity>(context), IExposable {
|
||||
|
||||
private val mExposureEventSparseArray = SparseArray<ExposureEvent>()
|
||||
@ -98,13 +99,14 @@ class CommonCollectionDetailAdapter(
|
||||
if (linkEntity.type == "game") {
|
||||
mExposureEventSparseArray.put(
|
||||
position,
|
||||
ExposureEvent.createEvent(
|
||||
ExposureEvent.createEventWithSourceConcat(
|
||||
GameEntity(
|
||||
id = linkEntity.link,
|
||||
name = linkEntity.name
|
||||
).also {
|
||||
it.sequence = position
|
||||
},
|
||||
basicSource = mBasicExposureSource ?: listOf(),
|
||||
listOf(
|
||||
ExposureSource(
|
||||
"内容合集",
|
||||
|
||||
@ -21,6 +21,7 @@ import com.gh.gamecenter.common.view.GridSpacingItemDecoration
|
||||
import com.gh.gamecenter.common.view.VerticalItemDecoration
|
||||
import com.gh.gamecenter.databinding.FragmentListBaseSkeletonBinding
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureSource
|
||||
|
||||
class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollectionDetailViewModel>() {
|
||||
|
||||
@ -47,13 +48,16 @@ class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollec
|
||||
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
if (mAdapter == null) {
|
||||
val exposureEvent =
|
||||
requireArguments().getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
|
||||
mAdapter = CommonCollectionDetailAdapter(
|
||||
requireContext(),
|
||||
mCollectionStyle,
|
||||
mViewModel,
|
||||
mBlockId,
|
||||
mBlockName,
|
||||
mEntrance
|
||||
mEntrance,
|
||||
exposureEvent
|
||||
)
|
||||
}
|
||||
return mAdapter!!
|
||||
|
||||
@ -59,14 +59,34 @@ class GameGallerySlideViewHolder(val binding: GameGallerySlideItemBinding) : Bas
|
||||
binding.cardView.setCardBackgroundColor(R.color.text_FAFAFA.toColor(binding.root.context))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分割好的游戏列表数据
|
||||
*/
|
||||
private fun getDividedGameList(): ArrayList<ArrayList<GameEntity>> {
|
||||
val containerList = arrayListOf<ArrayList<GameEntity>>()
|
||||
val gameDataList = mCachedSubject!!.data!!
|
||||
val gameListSize = gameDataList.size
|
||||
|
||||
val bestNumber = mCachedSubject!!.data!!.size / 3
|
||||
// 分割大小
|
||||
val splitSize = gameDataList.size / 3
|
||||
|
||||
containerList.add(ArrayList(mCachedSubject!!.data!!.subList(0, bestNumber - 1)))
|
||||
containerList.add(ArrayList(mCachedSubject!!.data!!.subList(bestNumber, bestNumber * 2 - 1)))
|
||||
containerList.add(ArrayList(mCachedSubject!!.data!!.subList(bestNumber * 2, mCachedSubject!!.data!!.size - 1)))
|
||||
if (splitSize > 1) {
|
||||
containerList.add(ArrayList(gameDataList.subList(0, splitSize)))
|
||||
containerList.add(ArrayList(gameDataList.subList(splitSize, splitSize * 2)))
|
||||
containerList.add(ArrayList(gameDataList.subList(splitSize * 2, gameListSize)))
|
||||
} else if (splitSize == 1) {
|
||||
containerList.add(ArrayList(gameDataList.subList(0, 1)))
|
||||
containerList.add(ArrayList(gameDataList.subList(1, 2)))
|
||||
containerList.add(ArrayList(gameDataList.subList(2, 3)))
|
||||
} else {
|
||||
val tempGameList = arrayListOf<GameEntity>()
|
||||
if (gameListSize != 0) {
|
||||
tempGameList.add(gameDataList.first())
|
||||
}
|
||||
containerList.add(tempGameList)
|
||||
containerList.add(tempGameList)
|
||||
containerList.add(tempGameList)
|
||||
}
|
||||
return containerList
|
||||
}
|
||||
|
||||
@ -88,6 +108,8 @@ class GameGallerySlideViewHolder(val binding: GameGallerySlideItemBinding) : Bas
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: GameGallerySlideItemViewHolder, position: Int) {
|
||||
if (gameList.isEmpty()) return
|
||||
|
||||
val gameEntity = gameList[position % gameList.size]
|
||||
|
||||
runOnIoThread(true) {
|
||||
|
||||
@ -62,12 +62,13 @@ class GameVerticalAdapter(
|
||||
// 你可能会问为什么这下面会有一些,"加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()
|
||||
|
||||
holder.itemView.layoutParams = if (!isEndOfRow) {
|
||||
paddingEnd += 1
|
||||
ViewGroup.LayoutParams(mMaxWidth - 24F.dip2px(), ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
ViewGroup.LayoutParams(mMaxWidth - 24F.dip2px(), height)
|
||||
} else {
|
||||
ViewGroup.LayoutParams(mMaxWidth - 1, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
ViewGroup.LayoutParams(mMaxWidth - 1, height)
|
||||
}
|
||||
|
||||
val gameEntity = mSubjectEntity.data!![position + getIndex()]
|
||||
@ -158,18 +159,19 @@ class GameVerticalAdapter(
|
||||
|
||||
fun checkResetData(updateData: SubjectEntity) {
|
||||
var dataIds = ""
|
||||
mSubjectEntity = updateData
|
||||
mSubjectEntity.data?.forEach {
|
||||
dataIds += it.id
|
||||
}
|
||||
|
||||
mSubjectEntity = updateData
|
||||
if ((countAndKey?.first == updateData.data?.size && countAndKey?.second != dataIds) || mDarkMode != DarkModeUtils.isDarkModeOn(
|
||||
mContext
|
||||
)
|
||||
) { // 数量不变,内容发生改变
|
||||
if ((countAndKey?.first == updateData.data?.size && countAndKey?.second != dataIds)
|
||||
|| mDarkMode != DarkModeUtils.isDarkModeOn(mContext)
|
||||
) {
|
||||
// 数量不变,内容发生改变
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
mDarkMode = DarkModeUtils.isDarkModeOn(mContext)
|
||||
} else if (countAndKey?.first != updateData.data?.size) { // 数量发生改变
|
||||
} else if (countAndKey?.first != updateData.data?.size) {
|
||||
// 数量发生改变
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
||||
@ -102,9 +102,9 @@ import org.greenrobot.eventbus.ThreadMode
|
||||
import retrofit2.HttpException
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.math.abs
|
||||
|
||||
// TODO 更改现有的使用 INDEX_DESC, INDEX_BBS 等固定数值来确定 tab 位置的做法,避免后续更改 tab 位置出现奇怪的异常
|
||||
class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
|
||||
private var mDownloadMenuIcon: ImageView? = null
|
||||
@ -118,7 +118,6 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
private var mSearchMenuItem: MenuItem? = null
|
||||
private var mDownloadMenuItem: MenuItem? = null
|
||||
private var mTraceEvent: ExposureEvent? = null
|
||||
private var mFirstTimeSelected = true
|
||||
private var mIsTouchScreen = false
|
||||
private var mIsShowKaifuHint: Boolean = false
|
||||
private var mIsScrollToKaiFu: Boolean = false
|
||||
@ -150,6 +149,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
|
||||
private val mFragmentsList = ArrayList<Fragment>()
|
||||
private val mTabTitleList = ArrayList<String>()
|
||||
private val mTabTypeList = ArrayList<String>() // tab 类型的列表,用于确定某个类型的 tab 在第几个位置
|
||||
private val mLooperHandle = LooperHandle(this)
|
||||
private val mServerLooperKey = 123
|
||||
|
||||
@ -217,6 +217,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
detailViewHolder.mDownloadTips.setDownloadTipsAnimation(true)
|
||||
}
|
||||
}
|
||||
|
||||
DownloadStatus.done,
|
||||
DownloadStatus.pause,
|
||||
DownloadStatus.waiting,
|
||||
@ -227,6 +228,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
detailViewHolder.mDownloadTips.visibility = View.VISIBLE
|
||||
detailViewHolder.mDownloadTips.setDownloadTipsAnimation(false)
|
||||
}
|
||||
|
||||
else -> detailViewHolder.mDownloadTips.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
@ -275,6 +277,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"func_libao" -> {
|
||||
mBodyBinding.gamedetailVp.currentItem = 0
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
|
||||
@ -283,6 +286,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
fragment.scrollToLibao()
|
||||
}
|
||||
}
|
||||
|
||||
"func_related_version" -> {
|
||||
mBodyBinding.gamedetailVp.currentItem = 0
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
|
||||
@ -291,6 +295,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
fragment.scrollToRelatedVersion()
|
||||
}
|
||||
}
|
||||
|
||||
"func_zone" -> {
|
||||
val gameDetailEntity = mViewModel.gameDetailLiveData.value?.data
|
||||
if (contentCardEntity.zoneTab && gameDetailEntity?.zone != null && gameDetailEntity.zone!!.style == "link") {
|
||||
@ -303,12 +308,14 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"func_bbs" -> {
|
||||
val funcBbs = contentCardEntity.funcBbs
|
||||
funcBbs?.let {
|
||||
DirectUtils.directForumDetail(requireContext(), it.link, path)
|
||||
}
|
||||
}
|
||||
|
||||
"func_tool_kit" -> {
|
||||
if (contentCardEntity.toolkit.isNotEmpty()) {
|
||||
contentCardEntity.toolkit.safelyGetInRelease(0)?.let {
|
||||
@ -329,6 +336,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> DirectUtils.directToLinkPage(
|
||||
requireContext(),
|
||||
contentCardEntity.toLinkEntity(),
|
||||
@ -336,7 +344,10 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
path,
|
||||
ExposureEvent.createEvent(
|
||||
null,
|
||||
listOf(ExposureSource("游戏详情", mGameEntity?.id ?: ""), ExposureSource("内容卡片", contentCardEntity.id))
|
||||
listOf(
|
||||
ExposureSource("游戏详情", mGameEntity?.id ?: ""),
|
||||
ExposureSource("内容卡片", contentCardEntity.id)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -420,7 +431,6 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
mAutoDownload = args.getBoolean(EntranceConsts.KEY_AUTO_DOWNLOAD)
|
||||
mTraceEvent = args.getParcelable(EntranceConsts.KEY_TRACE_EVENT)
|
||||
mSkipGameComment = args.getBoolean(EntranceConsts.KEY_SKIP_GAME_COMMENT)
|
||||
mDestinationTab = if (mDestinationTab >= 0) mDestinationTab else args.getInt(EntranceConsts.KEY_TARGET, -1)
|
||||
mIsOpenPlatformWindow = args.getBoolean(EntranceConsts.KEY_OPEN_PLATFORM_WINDOW)
|
||||
|
||||
mSkeleton = Skeleton.bind(mBinding.listSkeleton)
|
||||
@ -445,13 +455,10 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
mBodyBinding.gamedetailVp.doOnPageSelected { position ->
|
||||
if (!isAdded) return@doOnPageSelected
|
||||
|
||||
mBinding.gamedetailKaifuHint.visibleIf(mIsShowKaifuHint && position == INDEX_TRENDES)
|
||||
mBinding.gamedetailKaifuHint.visibleIf(mIsShowKaifuHint && position == getTabPositionFromTabType(TAB_TRENDS))
|
||||
|
||||
val bbsPosition = getTabPositionFromTabName(getString(R.string.game_detail_bbs))
|
||||
val trendsPosition = getTabPositionFromTabName(
|
||||
if (mNewGameDetailEntity?.zone?.customName.isNullOrEmpty()) getString(R.string.game_detail_dongtai) else mNewGameDetailEntity?.zone?.customName
|
||||
?: ""
|
||||
)
|
||||
val bbsPosition = getTabPositionFromTabType(TAB_BBS)
|
||||
val trendsPosition = getTabPositionFromTabType(TAB_TRENDS)
|
||||
|
||||
if (mNewGameDetailEntity?.bbsTab != null && position == bbsPosition) {
|
||||
DirectUtils.directToLinkPage(
|
||||
@ -468,7 +475,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
}, 200)
|
||||
} else if (mNewGameDetailEntity?.zone != null && mNewGameDetailEntity?.zone?.style != "default" && position == trendsPosition && mNewGameDetailEntity?.bbsTab != null) {
|
||||
// 跳转论坛-专区
|
||||
val entrance = if (mDestinationTab == INDEX_TRENDES) {
|
||||
val entrance = if (mDestinationTab == getTabPositionFromTabType(TAB_TRENDS)) {
|
||||
if (mEntrance.contains("搜索")) "搜索页面" else "其他"
|
||||
} else "游戏详情页"
|
||||
mNewGameDetailEntity?.bbsTab?.link?.let {
|
||||
@ -755,6 +762,9 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
val viewHolder = detailViewHolder
|
||||
DetailDownloadUtils.detailInitDownload(viewHolder, true)
|
||||
|
||||
mDestinationTab =
|
||||
getTabPositionFromTabType(arguments?.getString(EntranceConsts.KEY_TARGET, TAB_DESC) ?: TAB_DESC)
|
||||
|
||||
// destinationTab 的优先级最高,关注和关联关注在它的后面
|
||||
if (mDestinationTab != -1) {
|
||||
tabPerformClick(mDestinationTab)
|
||||
@ -855,6 +865,8 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initViewPage(data: NewGameDetailEntity) {
|
||||
// 各个 tab 显示的顺序为:详情>云存档>评价>专区>论坛
|
||||
|
||||
val scrollToLibao = arguments?.getBoolean(EntranceConsts.KEY_SCROLL_TO_LIBAO) ?: false
|
||||
var scrollToServer = arguments?.getBoolean(EntranceConsts.KEY_SCROLL_TO_SERVER) ?: false
|
||||
|
||||
@ -889,18 +901,37 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
mTabTitleList.clear()
|
||||
|
||||
val tag = "android:switcher:${mBodyBinding.gamedetailVp.id}:"
|
||||
val descFragment = childFragmentManager.findFragmentByTag("${tag}$INDEX_DESC") ?: DescFragment()
|
||||
val descFragment = childFragmentManager.findFragmentByTag("${tag}$TAB_DESC") ?: DescFragment()
|
||||
descFragment.arguments = bundle
|
||||
mFragmentsList.add(descFragment)
|
||||
mTabTitleList.add(getString(R.string.game_detail_desc))
|
||||
mTabTypeList.add(TAB_DESC)
|
||||
|
||||
if (data.showArchive) {
|
||||
val cloudArchiveFragment =
|
||||
childFragmentManager.findFragmentByTag("${tag}${TAB_ARCHIVE}") ?: CloudArchiveFragment()
|
||||
bundle.putParcelable(EntranceConsts.KEY_GAME, mGameEntity ?: GameEntity())
|
||||
bundle.putString(EntranceConsts.KEY_ARCHIVE_CONFIG_URL, data.archiveTab.configUrl)
|
||||
cloudArchiveFragment.arguments = bundle
|
||||
mFragmentsList.add(cloudArchiveFragment)
|
||||
mTabTitleList.add(getString(R.string.game_detail_cloud_archive))
|
||||
mTabTypeList.add(TAB_ARCHIVE)
|
||||
|
||||
NewFlatLogUtils.logCloudArchiveGameDetailTabRelated(
|
||||
"cloud_save_tab_show",
|
||||
mGameEntity?.id ?: "",
|
||||
mGameEntity?.name ?: ""
|
||||
)
|
||||
}
|
||||
|
||||
if (data.showComment) {
|
||||
val ratingFragment = childFragmentManager.findFragmentByTag("${tag}${INDEX_RATING}") ?: RatingFragment()
|
||||
val ratingFragment = childFragmentManager.findFragmentByTag("${tag}${TAB_RATING}") ?: RatingFragment()
|
||||
bundle.putBoolean(EntranceConsts.KEY_SKIP_GAME_COMMENT, mSkipGameComment)
|
||||
bundle.putBoolean(EntranceConsts.KEY_DIRECT_COMMENT, data.directComment)
|
||||
ratingFragment.arguments = bundle
|
||||
mFragmentsList.add(ratingFragment)
|
||||
mTabTitleList.add(getString(R.string.game_detail_comment))
|
||||
mTabTypeList.add(TAB_RATING)
|
||||
}
|
||||
|
||||
data.zone?.let {
|
||||
@ -911,7 +942,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
mFragmentsList.add(Fragment())
|
||||
} else if (it.style == "link") {
|
||||
//显示web页面
|
||||
val webFragment = childFragmentManager.findFragmentByTag("${tag}${INDEX_TRENDES}") ?: WebFragment()
|
||||
val webFragment = childFragmentManager.findFragmentByTag("${tag}${TAB_TRENDS}") ?: WebFragment()
|
||||
val webBundle = Bundle()
|
||||
webBundle.putString(EntranceConsts.KEY_ENTRANCE, "游戏专区")
|
||||
webBundle.putString(EntranceConsts.KEY_URL, it.link)
|
||||
@ -919,7 +950,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
webFragment.arguments = webBundle
|
||||
mFragmentsList.add(webFragment)
|
||||
} else {
|
||||
val fuliFragment = childFragmentManager.findFragmentByTag("${tag}${INDEX_TRENDES}") ?: FuLiFragment()
|
||||
val fuliFragment = childFragmentManager.findFragmentByTag("${tag}${TAB_TRENDS}") ?: FuLiFragment()
|
||||
fuliFragment.arguments = bundle
|
||||
mFragmentsList.add(fuliFragment)
|
||||
}
|
||||
@ -928,22 +959,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
} else {
|
||||
mTabTitleList.add(getString(R.string.game_detail_dongtai))
|
||||
}
|
||||
}
|
||||
|
||||
if (data.showArchive) {
|
||||
val cloudArchiveFragment =
|
||||
childFragmentManager.findFragmentByTag("${tag}${INDEX_ARCHIVE}") ?: CloudArchiveFragment()
|
||||
bundle.putParcelable(EntranceConsts.KEY_GAME, mGameEntity ?: GameEntity())
|
||||
bundle.putString(EntranceConsts.KEY_ARCHIVE_CONFIG_URL, data.archiveTab.configUrl)
|
||||
cloudArchiveFragment.arguments = bundle
|
||||
mFragmentsList.add(cloudArchiveFragment)
|
||||
mTabTitleList.add(getString(R.string.game_detail_cloud_archive))
|
||||
|
||||
NewFlatLogUtils.logCloudArchiveGameDetailTabRelated(
|
||||
"cloud_save_tab_show",
|
||||
mGameEntity?.id ?: "",
|
||||
mGameEntity?.name ?: ""
|
||||
)
|
||||
mTabTypeList.add(TAB_TRENDS)
|
||||
}
|
||||
|
||||
var isShowBbs = true
|
||||
@ -957,6 +973,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
if (isShowBbs && mGameEntity?.shouldUseMirrorInfo() == false) {
|
||||
mFragmentsList.add(Fragment())
|
||||
mTabTitleList.add(getString(R.string.game_detail_bbs))
|
||||
mTabTypeList.add(TAB_BBS)
|
||||
}
|
||||
}
|
||||
|
||||
@ -969,7 +986,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
gamedetailVp.doOnPageSelected {
|
||||
logTabClick(it)
|
||||
}
|
||||
gamedetailVp.currentItem = INDEX_DESC
|
||||
gamedetailVp.currentItem = getTabPositionFromTabType(TAB_DESC)
|
||||
|
||||
mBodyBinding.tabLayout.setupWithViewPager(gamedetailVp)
|
||||
mBodyBinding.tabIndicator.setupWithTabLayout(mBodyBinding.tabLayout)
|
||||
@ -978,7 +995,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
for (i in 0 until mBodyBinding.tabLayout.tabCount) {
|
||||
val tab = mBodyBinding.tabLayout.getTabAt(i) ?: continue
|
||||
val tabTitle = if (tab.text != null) tab.text.toString() else ""
|
||||
if (data.showArchive && i == getTabPositionFromTabName(getString(R.string.game_detail_cloud_archive))) {
|
||||
if (data.showArchive && i == getTabPositionFromTabType(TAB_ARCHIVE)) {
|
||||
tab.customView = getArchiveTabView(tabTitle)
|
||||
tab.view.run {
|
||||
clipChildren = false
|
||||
@ -1081,7 +1098,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
|
||||
if (mNewGameDetailEntity!!.showComment) {
|
||||
if (mSkipGameComment) {
|
||||
tabPerformClick(INDEX_RATING)
|
||||
tabPerformClick(getTabPositionFromTabType(TAB_RATING))
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(false)
|
||||
mSkipGameComment = false
|
||||
}
|
||||
@ -1288,8 +1305,10 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
when {
|
||||
isHighlightBg && !isLastView -> root.background =
|
||||
R.drawable.bg_content_card_large_primary.toDrawable(requireContext())
|
||||
|
||||
!isHighlightBg && !isLastView -> root.background =
|
||||
R.drawable.bg_content_card_large.toDrawable(requireContext())
|
||||
|
||||
!isHighlightBg && isLastView -> root.background =
|
||||
R.drawable.bg_content_card_large_right.toDrawable(requireContext())
|
||||
}
|
||||
@ -1348,7 +1367,10 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
ExposureManager.log(
|
||||
ExposureEvent.createEvent(
|
||||
GameEntity(sequence = position),
|
||||
listOf(ExposureSource("游戏详情", mGameEntity?.id ?: ""), ExposureSource("内容卡片", contentCardEntity.id))
|
||||
listOf(
|
||||
ExposureSource("游戏详情", mGameEntity?.id ?: ""),
|
||||
ExposureSource("内容卡片", contentCardEntity.id)
|
||||
)
|
||||
)
|
||||
)
|
||||
}.root
|
||||
@ -1383,7 +1405,10 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
ExposureManager.log(
|
||||
ExposureEvent.createEvent(
|
||||
GameEntity(sequence = position),
|
||||
listOf(ExposureSource("游戏详情", mGameEntity?.id ?: ""), ExposureSource("内容卡片", contentCardEntity.id))
|
||||
listOf(
|
||||
ExposureSource("游戏详情", mGameEntity?.id ?: ""),
|
||||
ExposureSource("内容卡片", contentCardEntity.id)
|
||||
)
|
||||
)
|
||||
)
|
||||
}.root
|
||||
@ -1536,19 +1561,19 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(reuse: EBReuse) {
|
||||
if (SKIP_DESC == reuse.type) {
|
||||
tabPerformClick(INDEX_DESC)
|
||||
tabPerformClick(getTabPositionFromTabType(TAB_DESC))
|
||||
} else if (OPEN_APPBAR == reuse.type && !mIsTouchScreen) {
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(true, true)
|
||||
} else if (SKIP_FULI == reuse.type) {
|
||||
tabPerformClick(INDEX_TRENDES)
|
||||
tabPerformClick(getTabPositionFromTabType(TAB_TRENDS))
|
||||
} else if (SKIP_RATING == reuse.type) {
|
||||
tabPerformClick(INDEX_RATING)
|
||||
tabPerformClick(getTabPositionFromTabType(TAB_RATING))
|
||||
} else if ("hideKaifuHint" == reuse.type) {
|
||||
mIsShowKaifuHint = false
|
||||
mBinding.gamedetailKaifuHint.visibility = View.GONE
|
||||
} else if ("showKaifuHint" == reuse.type) {
|
||||
mIsShowKaifuHint = true
|
||||
if (mCurVpPosition == INDEX_TRENDES) {
|
||||
if (mCurVpPosition == getTabPositionFromTabType(TAB_TRENDS)) {
|
||||
mBinding.gamedetailKaifuHint.post { mBinding.gamedetailKaifuHint.visibility = View.VISIBLE }
|
||||
}
|
||||
} else if (CLOSE_APPBAR == reuse.type && !mIsTouchScreen) {
|
||||
@ -1807,28 +1832,29 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
}
|
||||
|
||||
private fun tabPerformClick(position: Int) {
|
||||
val trendsTabPosition = getTabPositionFromTabType(TAB_TRENDS)
|
||||
val bbsTabPosition = getTabPositionFromTabType(TAB_BBS)
|
||||
|
||||
when (position) {
|
||||
INDEX_TRENDES -> {
|
||||
trendsTabPosition -> {
|
||||
val zoneEntity = mNewGameDetailEntity?.zone
|
||||
if (!mTabTitleList.contains(getString(R.string.game_detail_dongtai))
|
||||
&& !mTabTitleList.contains(zoneEntity?.customName)
|
||||
) {
|
||||
performJumpContentCard("func_zone")
|
||||
} else {
|
||||
mBodyBinding.gamedetailVp.currentItem = getTabPositionFromTabName(
|
||||
if (mNewGameDetailEntity?.zone?.customName.isNullOrEmpty()) getString(R.string.game_detail_dongtai) else mNewGameDetailEntity?.zone?.customName
|
||||
?: ""
|
||||
)
|
||||
mBodyBinding.gamedetailVp.currentItem = getTabPositionFromTabType(TAB_TRENDS)
|
||||
}
|
||||
}
|
||||
INDEX_BBS -> {
|
||||
|
||||
bbsTabPosition -> {
|
||||
if (!mTabTitleList.contains(getString(R.string.game_detail_bbs))) {
|
||||
performJumpContentCard("func_bbs")
|
||||
} else {
|
||||
mBodyBinding.gamedetailVp.currentItem =
|
||||
getTabPositionFromTabName(getString(R.string.game_detail_bbs))
|
||||
mBodyBinding.gamedetailVp.currentItem = getTabPositionFromTabType(TAB_BBS)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
mBodyBinding.gamedetailVp.currentItem = position
|
||||
}
|
||||
@ -1850,10 +1876,11 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
|
||||
val entrance = if (mEntrance.contains("论坛详情")) "论坛" else "游戏"
|
||||
mGameEntity?.run {
|
||||
when (getTabContentForReal(position)) {
|
||||
when (mTabTypeList[position]) {
|
||||
TAB_DESC -> {
|
||||
NewLogUtils.logGameDetailTabClick(name ?: "", id, "详情")
|
||||
}
|
||||
|
||||
TAB_TRENDS -> {
|
||||
NewLogUtils.logGameDetailTabClick(
|
||||
"view_game_detail_special_area_tab",
|
||||
@ -1864,6 +1891,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
)
|
||||
NewLogUtils.logGameDetailTabClick(name ?: "", id, "专区")
|
||||
}
|
||||
|
||||
TAB_ARCHIVE -> {
|
||||
NewFlatLogUtils.logCloudArchiveGameDetailTabRelated(
|
||||
"cloud_save_tab_click",
|
||||
@ -1882,10 +1910,12 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
"last_page_business_id", getLastPageEntity().pageBusinessId
|
||||
)
|
||||
}
|
||||
|
||||
TAB_RATING -> {
|
||||
NewLogUtils.logGameDetailTabClick("view_game_detail_comment_tab", entrance, id, gameType, bbsId)
|
||||
NewLogUtils.logGameDetailTabClick(name ?: "", id, "评论")
|
||||
}
|
||||
|
||||
TAB_BBS -> {
|
||||
NewLogUtils.logGameDetailTabClick(name ?: "", id, "论坛")
|
||||
}
|
||||
@ -1893,35 +1923,13 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取真实的 tab 内容类型
|
||||
* @param position tab 的位置
|
||||
* @return 真实的 tab 类型
|
||||
*/
|
||||
private fun getTabContentForReal(position: Int): String {
|
||||
return when (mTabTitleList[position]) {
|
||||
getString(R.string.game_detail_dongtai),
|
||||
mNewGameDetailEntity?.zone?.customName -> TAB_TRENDS
|
||||
|
||||
getString(R.string.game_detail_cloud_archive) -> TAB_ARCHIVE
|
||||
|
||||
getString(R.string.game_detail_comment) -> TAB_RATING
|
||||
|
||||
getString(R.string.game_detail_bbs) -> TAB_BBS
|
||||
|
||||
getString(R.string.game_detail_desc) -> TAB_DESC
|
||||
|
||||
else -> TAB_DESC
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 tab 的位置
|
||||
* @param tabName tab 名字
|
||||
* @param tabType tab 类型
|
||||
* @return tab 的真实位置
|
||||
*/
|
||||
private fun getTabPositionFromTabName(tabName: String): Int {
|
||||
return mTabTitleList.indexOf(tabName)
|
||||
private fun getTabPositionFromTabType(tabType: String): Int {
|
||||
return mTabTypeList.indexOf(tabType)
|
||||
}
|
||||
|
||||
private fun handleTabTouchEvent(title: String) {
|
||||
@ -1938,8 +1946,9 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
getString(R.string.game_detail_comment),
|
||||
getString(R.string.game_detail_cloud_archive) -> {
|
||||
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
|
||||
tabPerformClick(getTabPositionFromTabName(title))
|
||||
tabPerformClick(getTabPositionFromTabType(title))
|
||||
}
|
||||
|
||||
else -> {
|
||||
// do nothing
|
||||
}
|
||||
@ -1971,7 +1980,8 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
} else {
|
||||
hintText =
|
||||
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL)) "当前安装方式为[浏览器安装],点击切换安装方式" else "手机如何解决无法安装问题"
|
||||
closeHintText = "关闭后“切换安装方式”入口将显示在左下角,您也可以前往“我的光环-设置-切换安装方式”进行设置"
|
||||
closeHintText =
|
||||
"关闭后“切换安装方式”入口将显示在左下角,您也可以前往“我的光环-设置-切换安装方式”进行设置"
|
||||
}
|
||||
|
||||
mDownloadBinding.browserInstallHintTv.text = hintText
|
||||
@ -2056,7 +2066,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
mRecommendBinding.recommendText.text = popupDetail.text
|
||||
if (popupDetail.images.isNotEmpty()) {
|
||||
ImageUtils.display(mRecommendBinding.recommendImage, popupDetail.images[0])
|
||||
mRecommendBinding.recommendImage.loadingCallback = object : WrapContentDraweeView.LoadingCallback {
|
||||
mRecommendBinding.recommendImage.registerLoadingCallback(object : WrapContentDraweeView.LoadingCallback {
|
||||
override fun loaded() {
|
||||
mRecommendBinding.recommendImage.post {
|
||||
mRecommendBinding.recommendImage.layoutParams.apply {
|
||||
@ -2066,7 +2076,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
mRecommendBinding.recommendImage.visibility = View.GONE
|
||||
(mRecommendBinding.recommendText.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
@ -2151,7 +2161,7 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
|
||||
private fun updateArchiveTabUI() {
|
||||
mBodyBinding.tabLayout.run {
|
||||
val archivePosition = getTabPositionFromTabName(getString(R.string.game_detail_cloud_archive))
|
||||
val archivePosition = getTabPositionFromTabType(TAB_ARCHIVE)
|
||||
getTabAt(archivePosition)?.customView?.findViewById<ImageView>(R.id.newIv)?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
@ -2168,11 +2178,13 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
override fun onBackPressed(): Boolean {
|
||||
mOrientationUtils?.backToProtVideo()
|
||||
|
||||
if (mBodyBinding.gamedetailVp.currentItem == INDEX_TRENDES
|
||||
&& mFragmentsList[INDEX_TRENDES] is WebFragment
|
||||
&& mFragmentsList[INDEX_TRENDES].isAdded
|
||||
val trendsTabPosition = getTabPositionFromTabType(TAB_TRENDS)
|
||||
|
||||
if (mBodyBinding.gamedetailVp.currentItem == trendsTabPosition
|
||||
&& mFragmentsList[trendsTabPosition] is WebFragment
|
||||
&& mFragmentsList[trendsTabPosition].isAdded
|
||||
) {
|
||||
return (mFragmentsList[INDEX_TRENDES] as WebFragment).onBackPressed()
|
||||
return (mFragmentsList[trendsTabPosition] as WebFragment).onBackPressed()
|
||||
}
|
||||
|
||||
if (CustomManager.backFromWindowFull(requireActivity(), mVideoBinding.player.getKey())) {
|
||||
@ -2349,12 +2361,6 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val INDEX_DESC = 0
|
||||
const val INDEX_RATING = 1
|
||||
const val INDEX_ARCHIVE = 2
|
||||
const val INDEX_TRENDES = 3
|
||||
const val INDEX_BBS = 4
|
||||
|
||||
const val TAB_DESC = "详情"
|
||||
const val TAB_TRENDS = "专区"
|
||||
const val TAB_ARCHIVE = "云存档"
|
||||
@ -2368,7 +2374,6 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
|
||||
const val CLOSE_APPBAR = "closeappbar"
|
||||
const val SCROLL_TO_KAIFU = "scrollToKaiFu"
|
||||
const val EB_SCROLLING = "EB_SCROLLING"
|
||||
const val EB_STAR = "eb_star"
|
||||
const val INITIAL_DELAY = 500L
|
||||
const val CONTENT_CARD_LOOP_TIME = 3000L
|
||||
|
||||
|
||||
@ -208,127 +208,143 @@ class GameDetailViewModel(
|
||||
}
|
||||
|
||||
private fun replaceWithMirrorInfoIfNeeded(data: NewGameDetailEntity) {
|
||||
if (data.mirrorStatus == "on"
|
||||
&& (game?.useMirrorInfo == true
|
||||
|| RegionSettingHelper.shouldThisGameDisplayMirrorInfo(game?.id ?: ""))
|
||||
) {
|
||||
val finalItemList: ArrayList<DetailEntity> = arrayListOf()
|
||||
val mirrorCustomColumnList = data.mirrorData?.customColumnList ?: arrayListOf()
|
||||
mirrorCustomColumnList.sortByDescending { it.order }
|
||||
for (item in data.detailEntity) {
|
||||
// 去掉所有自定义栏目并把镜像相应权重的自定义栏目放到相应的位置
|
||||
if (item.type == DetailEntity.Type.CUSTOM_COLUMN.value) {
|
||||
val usedMirrorCustomColumnList = arrayListOf<CustomColumn>()
|
||||
for (mirrorCustomColumn in mirrorCustomColumnList) {
|
||||
if ((mirrorCustomColumn.order!! > 0 && item.customColumn?.order!! > 0)
|
||||
|| (mirrorCustomColumn.order == item.customColumn?.order)
|
||||
) {
|
||||
finalItemList.add(
|
||||
DetailEntity(
|
||||
type = DetailEntity.Type.CUSTOM_COLUMN.value,
|
||||
customColumn = mirrorCustomColumn
|
||||
)
|
||||
// 获取镜像相关数据,不存在时不替换
|
||||
val mirrorData = getMirrorData(data) ?: return
|
||||
|
||||
val finalItemList: ArrayList<DetailEntity> = arrayListOf()
|
||||
val mirrorCustomColumnList = mirrorData.customColumnList ?: arrayListOf()
|
||||
mirrorCustomColumnList.sortByDescending { it.order }
|
||||
for (item in data.detailEntity) {
|
||||
// 去掉所有自定义栏目并把镜像相应权重的自定义栏目放到相应的位置
|
||||
if (item.type == DetailEntity.Type.CUSTOM_COLUMN.value) {
|
||||
val usedMirrorCustomColumnList = arrayListOf<CustomColumn>()
|
||||
for (mirrorCustomColumn in mirrorCustomColumnList) {
|
||||
if ((mirrorCustomColumn.order!! > 0 && item.customColumn?.order!! > 0)
|
||||
|| (mirrorCustomColumn.order == item.customColumn?.order)
|
||||
) {
|
||||
finalItemList.add(
|
||||
DetailEntity(
|
||||
type = DetailEntity.Type.CUSTOM_COLUMN.value,
|
||||
customColumn = mirrorCustomColumn
|
||||
)
|
||||
usedMirrorCustomColumnList.add(mirrorCustomColumn)
|
||||
}
|
||||
}
|
||||
mirrorCustomColumnList.removeAll(usedMirrorCustomColumnList)
|
||||
continue
|
||||
}
|
||||
|
||||
// 历史版本入口
|
||||
if (item.type == DetailEntity.Type.UPDATE_CONTENT.value) {
|
||||
item.update?.historyApkStatus = "off"
|
||||
}
|
||||
|
||||
// 不显示 "玩家评论`", "相关游戏`"
|
||||
if (item.type == DetailEntity.Type.COMMENTS.value ||
|
||||
item.type == DetailEntity.Type.RELATED_VERSION.value
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
// 处理游戏信息区域
|
||||
if (item.type == DetailEntity.Type.GAME_INFO.value) {
|
||||
item.info?.manufacturer = data.mirrorData?.manufacturer ?: ""
|
||||
item.info?.privacyPolicyUrl = data.mirrorData?.privacyPolicyUrl ?: ""
|
||||
item.info?.manufacturerType = data.mirrorData?.manufacturerType ?: ""
|
||||
item.info?.publisher = data.mirrorData?.publisher ?: ""
|
||||
item.info?.developer = data.mirrorData?.developer ?: ""
|
||||
item.info?.supplier = data.mirrorData?.supplier ?: ""
|
||||
item.info?.creditCode = data.mirrorData?.creditCode ?: ""
|
||||
item.info?.updateTime = data.mirrorData?.updateTime ?: 0L
|
||||
finalItemList.add(item)
|
||||
continue
|
||||
}
|
||||
|
||||
// 去掉游戏信息里的 "mod 版"
|
||||
if (item.type == DetailEntity.Type.GAME_INFO.value) {
|
||||
item.info?.topTags?.removeAll { it.name.toLowerCase(Locale.getDefault()) == "mod版" }
|
||||
}
|
||||
|
||||
// 替换镜像开服信息
|
||||
if (item.type == DetailEntity.Type.LATEST_SERVER.value && data.mirrorData?.server != null) {
|
||||
if (data.mirrorData?.server?.status == "hide") {
|
||||
continue
|
||||
} else {
|
||||
item.server = data.mirrorData?.server
|
||||
}
|
||||
}
|
||||
|
||||
// 镜像游戏去掉推荐游戏 (用于构建大家都在玩)
|
||||
if (item.type == DetailEntity.Type.RECOMMENDED_GAMES.value) {
|
||||
continue
|
||||
}
|
||||
|
||||
finalItemList.add(item)
|
||||
}
|
||||
|
||||
val funcServer = data.contentCard.find { it.type == "func_server" }
|
||||
if (funcServer?.mirrorServer != null) {
|
||||
funcServer.server = funcServer.mirrorServer
|
||||
}
|
||||
|
||||
// 有多余的镜像自定义栏目没找到位置放,统一按权重为0放到详细信息后,连权重为0也没有就放到列表最后!
|
||||
if (!mirrorCustomColumnList.isNullOrEmpty()) {
|
||||
var gameInfoPosition = finalItemList.size - 1
|
||||
for ((index, item) in finalItemList.withIndex()) {
|
||||
if (item.type == DetailEntity.Type.GAME_INFO.value) {
|
||||
gameInfoPosition = index + 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for ((index, remainingMirrorCustomColumn) in mirrorCustomColumnList.withIndex()) {
|
||||
finalItemList.add(
|
||||
gameInfoPosition + index,
|
||||
DetailEntity(
|
||||
type = DetailEntity.Type.CUSTOM_COLUMN.value,
|
||||
customColumn = remainingMirrorCustomColumn
|
||||
)
|
||||
)
|
||||
usedMirrorCustomColumnList.add(mirrorCustomColumn)
|
||||
}
|
||||
}
|
||||
mirrorCustomColumnList.removeAll(usedMirrorCustomColumnList)
|
||||
continue
|
||||
}
|
||||
|
||||
// 历史版本入口
|
||||
if (item.type == DetailEntity.Type.UPDATE_CONTENT.value) {
|
||||
item.update?.historyApkStatus = "off"
|
||||
}
|
||||
|
||||
// 不显示 "玩家评论`", "相关游戏`"
|
||||
if (item.type == DetailEntity.Type.COMMENTS.value ||
|
||||
item.type == DetailEntity.Type.RELATED_VERSION.value
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
// 处理游戏信息区域
|
||||
if (item.type == DetailEntity.Type.GAME_INFO.value) {
|
||||
item.info?.manufacturer = mirrorData.manufacturer ?: ""
|
||||
item.info?.privacyPolicyUrl = mirrorData.privacyPolicyUrl ?: ""
|
||||
item.info?.manufacturerType = mirrorData.manufacturerType
|
||||
item.info?.publisher = mirrorData.publisher
|
||||
item.info?.developer = mirrorData.developer
|
||||
item.info?.supplier = mirrorData.supplier
|
||||
item.info?.creditCode = mirrorData.creditCode
|
||||
item.info?.updateTime = mirrorData.updateTime
|
||||
finalItemList.add(item)
|
||||
continue
|
||||
}
|
||||
|
||||
// 去掉游戏信息里的 "mod 版"
|
||||
if (item.type == DetailEntity.Type.GAME_INFO.value) {
|
||||
item.info?.topTags?.removeAll { it.name.toLowerCase(Locale.getDefault()) == "mod版" }
|
||||
}
|
||||
|
||||
// 替换镜像开服信息
|
||||
if (item.type == DetailEntity.Type.LATEST_SERVER.value && mirrorData.server != null) {
|
||||
if (mirrorData.server?.status == "hide") {
|
||||
continue
|
||||
} else {
|
||||
item.server = mirrorData.server
|
||||
}
|
||||
}
|
||||
|
||||
// 不显示评论 tab
|
||||
data.showComment = false
|
||||
|
||||
for (item in finalItemList) {
|
||||
item.des = data.mirrorData?.des
|
||||
item.gallery = data.mirrorData?.gallery
|
||||
|
||||
item.update?.updateDes = data.mirrorData?.updateDes ?: ""
|
||||
|
||||
item.info?.size = data.mirrorData?.apk?.firstOrNull()?.size ?: ""
|
||||
item.info?.version = data.mirrorData?.apk?.firstOrNull()?.version ?: ""
|
||||
// 镜像游戏去掉推荐游戏 (用于构建大家都在玩)
|
||||
if (item.type == DetailEntity.Type.RECOMMENDED_GAMES.value) {
|
||||
continue
|
||||
}
|
||||
|
||||
data.tagStyle =
|
||||
data.mirrorData?.tagStyle?.apply { removeAll { it.name.toLowerCase(Locale.getDefault()) == "mod版" } }
|
||||
?: arrayListOf()
|
||||
data.detailDialogs = data.mirrorData?.detailDialogs ?: arrayListOf()
|
||||
data.detailEntity = finalItemList
|
||||
finalItemList.add(item)
|
||||
}
|
||||
|
||||
val funcServer = data.contentCard.find { it.type == "func_server" }
|
||||
if (funcServer?.mirrorServer != null) {
|
||||
funcServer.server = funcServer.mirrorServer
|
||||
}
|
||||
|
||||
// 有多余的镜像自定义栏目没找到位置放,统一按权重为0放到详细信息后,连权重为0也没有就放到列表最后!
|
||||
if (!mirrorCustomColumnList.isNullOrEmpty()) {
|
||||
var gameInfoPosition = finalItemList.size - 1
|
||||
for ((index, item) in finalItemList.withIndex()) {
|
||||
if (item.type == DetailEntity.Type.GAME_INFO.value) {
|
||||
gameInfoPosition = index + 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for ((index, remainingMirrorCustomColumn) in mirrorCustomColumnList.withIndex()) {
|
||||
finalItemList.add(
|
||||
gameInfoPosition + index,
|
||||
DetailEntity(
|
||||
type = DetailEntity.Type.CUSTOM_COLUMN.value,
|
||||
customColumn = remainingMirrorCustomColumn
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 不显示评论 tab
|
||||
data.showComment = false
|
||||
|
||||
for (item in finalItemList) {
|
||||
item.des = mirrorData.des
|
||||
item.gallery = mirrorData.gallery
|
||||
|
||||
item.update?.updateDes = mirrorData.updateDes
|
||||
|
||||
item.info?.size = mirrorData.apk?.firstOrNull()?.size ?: ""
|
||||
item.info?.version = mirrorData.apk?.firstOrNull()?.version ?: ""
|
||||
}
|
||||
|
||||
data.tagStyle =
|
||||
mirrorData.tagStyle.apply { removeAll { it.name.toLowerCase(Locale.getDefault()) == "mod版" } }
|
||||
data.detailDialogs = mirrorData.detailDialogs
|
||||
data.detailEntity = finalItemList
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取镜像数据,为空时代表不启用镜像
|
||||
*/
|
||||
private fun getMirrorData(data: NewGameDetailEntity): DetailEntity? {
|
||||
// 游戏 id
|
||||
val id = game?.id ?: ""
|
||||
|
||||
if (RegionSettingHelper.shouldThisGameDisplayMirrorInfo(id) || game?.useMirrorInfo == true) {
|
||||
if (data.mirrorStatus == "on" || data.mirrorStatus2 == "on") {
|
||||
when (RegionSettingHelper.getMirrorPosition(id)) {
|
||||
1 -> return data.mirrorData
|
||||
2 -> return data.mirrorData2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -56,8 +56,8 @@ class CloudArchiveListViewModel(
|
||||
|
||||
private fun getSortTypeFilter(): String {
|
||||
return when (mSortType) {
|
||||
SortType.NEWEST -> "time.create:-1"
|
||||
else -> "hot:-1"
|
||||
SortType.NEWEST -> "time.share:-1"
|
||||
else -> "count.usage:-1,time.share:-1"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class GameGalleryAdapter(
|
||||
is GameGalleryViewHolder -> {
|
||||
holder.binding.screenshotItemIv.setTag(ImageUtils.TAG_TARGET_WIDTH, 260F.dip2px())
|
||||
ImageUtils.display(holder.binding.screenshotItemIv, mGallery?.get(position))
|
||||
holder.binding.screenshotItemIv.loadingCallback = object : WrapContentDraweeView.LoadingCallback {
|
||||
holder.binding.screenshotItemIv.registerLoadingCallback(object : WrapContentDraweeView.LoadingCallback {
|
||||
override fun loaded() {
|
||||
holder.binding.screenshotItemIv.post {
|
||||
holder.binding.screenshotItemIv.layoutParams.apply {
|
||||
@ -63,7 +63,7 @@ class GameGalleryAdapter(
|
||||
holder.itemView.requestLayout()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
holder.itemView.setDebouncedClickListener {
|
||||
DataCollectionUtils.uploadClick(context, "游戏介绍", "游戏详情")
|
||||
MtaHelper.onEvent("游戏详情_新", "点击游戏截图", mGame.name)
|
||||
|
||||
@ -60,11 +60,11 @@ class GameLibaoAdapter(
|
||||
when (holder) {
|
||||
is LibaoViewHolder -> {
|
||||
val libaoEntity = libaos[position]
|
||||
val isTypeCopy = libaoEntity.receiveMethod == "copy"
|
||||
|
||||
holder.binding.libaoNameTv.text = libaoEntity.name
|
||||
holder.binding.contentTv.text = libaoEntity.content?.fromHtml()
|
||||
|
||||
val isTypeCopy = libaoEntity.receiveMethod == "copy"
|
||||
if (isTypeCopy) {
|
||||
// 类型为复制,不需要登录也能直接领取
|
||||
holder.binding.libaoSchedulePb.visibility = View.GONE
|
||||
@ -93,10 +93,7 @@ class GameLibaoAdapter(
|
||||
holder.binding.libaoCodeTv.text = "礼包码:-"
|
||||
} else {
|
||||
when (libaoEntity.status) {
|
||||
"ling" -> {
|
||||
holder.binding.libaoCodeTv.text = "礼包码:-"
|
||||
}
|
||||
"linged", "repeatLing", "repeatLinged" -> {
|
||||
"linged", "repeatLing", "repeatLinged", "taoed", "repeatTao", "repeatTaoed" -> {
|
||||
val size = libaoEntity.me?.userDataLibaoList?.size ?: 0
|
||||
val code = libaoEntity.me?.userDataLibaoList?.get(size - 1)?.code ?: ""
|
||||
val text = "礼包码:$code"
|
||||
@ -125,14 +122,7 @@ class GameLibaoAdapter(
|
||||
initProgressUI(libaoEntity, holder)
|
||||
} else {
|
||||
when (libaoEntity.status) {
|
||||
"ling" -> {
|
||||
holder.binding.libaoSchedulePb.visibility = View.VISIBLE
|
||||
holder.binding.remainingTv.visibility = View.VISIBLE
|
||||
holder.binding.libaoCodeTv.visibility = View.GONE
|
||||
|
||||
initProgressUI(libaoEntity, holder)
|
||||
}
|
||||
"linged", "repeatLing", "repeatLinged" -> {
|
||||
"linged", "repeatLing", "repeatLinged", "taoed", "repeatTao", "repeatTaoed" -> {
|
||||
holder.binding.libaoSchedulePb.visibility = View.GONE
|
||||
holder.binding.remainingTv.visibility = View.GONE
|
||||
holder.binding.libaoCodeTv.visibility = View.VISIBLE
|
||||
@ -152,10 +142,11 @@ class GameLibaoAdapter(
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
holder.binding.libaoSchedulePb.visibility = View.GONE
|
||||
holder.binding.remainingTv.visibility = View.GONE
|
||||
holder.binding.libaoCodeTv.visibility = View.VISIBLE
|
||||
holder.binding.libaoCodeTv.text = "礼包码:-"
|
||||
holder.binding.libaoSchedulePb.visibility = View.VISIBLE
|
||||
holder.binding.remainingTv.visibility = View.VISIBLE
|
||||
holder.binding.libaoCodeTv.visibility = View.GONE
|
||||
|
||||
initProgressUI(libaoEntity, holder)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user