Compare commits

..

156 Commits

Author SHA1 Message Date
001d062207 chore: 版本更新至 5.15.1 2022-12-01 16:27:31 +08:00
d4b1b822f4 Merge branch 'legacy-release' into 'release'
合并 5.14.X 闪退修复

See merge request halo/android/assistant-android!517
2022-12-01 16:26:32 +08:00
732765118e Merge branch 'hotfix-v5.14.7-637-crashes' into 'legacy-release'
修复一些线上闪退

See merge request halo/android/assistant-android!516
2022-12-01 16:25:36 +08:00
eeacae1fd2 fix: 修复历史游戏列表因为历史副标题颜色不存在引起的闪退 2022-12-01 16:08:17 +08:00
e982ae9125 fix: 修复双列通用合集专题因为获取到错误的位置造成的闪退 2022-12-01 16:03:20 +08:00
a7ee0c754b fix: 捕抓畅玩因为存储空间不足造成的闪退 2022-12-01 16:01:27 +08:00
094a85bfa4 Merge branch 'feature-GHZS-538' into 'release'
fix: 模拟器下载流程问题修改  https://jira.shanqu.cc/browse/GHZS-538

See merge request halo/android/assistant-android!514
2022-12-01 13:52:27 +08:00
54f0fa8dd8 fix: 模拟器下载流程问题修改 https://jira.shanqu.cc/browse/GHZS-538 2022-12-01 13:49:01 +08:00
1f331a20fa Merge branch 'feature-GHZS-538' into 'release'
fix: 模拟器下载流程问题  https://jira.shanqu.cc/browse/GHZS-538

See merge request halo/android/assistant-android!512
2022-12-01 11:40:15 +08:00
ad58699d2f fix: 模拟器下载流程问题 https://jira.shanqu.cc/browse/GHZS-538 2022-12-01 11:30:21 +08:00
2ee01a0819 Merge remote-tracking branch 'origin/legacy-release' into release
# Conflicts:
#	app/src/main/java/com/gh/common/history/HistoryDatabase.kt
#	app/src/main/java/com/gh/gamecenter/entity/AmwayCommentEntity.kt
#	app/src/main/java/com/gh/gamecenter/entity/HistoryGameEntity.kt
#	dependencies.gradle
2022-11-28 16:53:02 +08:00
2242de5f83 chore: 版本更新至 5.14.7-637 2022-11-28 14:26:48 +08:00
b684fff4f1 Merge branch 'hotfix-v5.14.6-636-subtitle' into 'legacy-release'
fix: 补充遗漏的副标题(游戏动态页) https://jira.shanqu.cc/browse/GHZS-344

See merge request halo/android/assistant-android!479
2022-11-28 14:22:37 +08:00
0b0f575c41 fix: 补充遗漏的副标题(游戏动态页) https://jira.shanqu.cc/browse/GHZS-344 2022-11-28 14:05:15 +08:00
fad7083a2c Merge branch 'feature-GHZS-344' into 'legacy-release'
feat: 【光环助手】副标题遗漏场景补充 https://jira.shanqu.cc/browse/GHZS-344

See merge request halo/android/assistant-android!477
2022-11-28 11:25:05 +08:00
da22540af3 feat: 【光环助手】副标题遗漏场景补充 https://jira.shanqu.cc/browse/GHZS-344 2022-11-25 16:23:06 +08:00
0bc638a2f9 Merge branch 'merge-release_to_dev' into 'dev'
Merge release to dev

See merge request halo/android/assistant-android!468
2022-11-24 10:50:10 +08:00
1ae64c35b9 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/game/GameItemViewHolder.kt
#	dependencies.gradle
2022-11-24 10:38:48 +08:00
252566837a chore: 版本更新至 5.14.6 2022-11-24 10:06:24 +08:00
94d249312b Merge branch 'hotfix-v5.13.7-617-try_catch_subtitle_crash' into 'release'
fix:捕获游戏详情副标题的异常

See merge request halo/android/assistant-android!466
2022-11-23 17:03:28 +08:00
4855dda839 fix:捕获游戏详情副标题的异常 2022-11-23 17:03:28 +08:00
c5519fb160 Merge branch 'hotfix-v5.14.5-635-subtitle' into 'release'
fix: 修复模拟器上部分副标题不显示的问题,为分类页面和开服表页面添加副标题支持 https://jira.shanqu.cc/browse/GHZS-319

See merge request halo/android/assistant-android!463
2022-11-23 16:26:09 +08:00
5cd9197d0f fix: 修复模拟器上部分副标题不显示的问题,为分类页面和开服表页面添加副标题支持 https://jira.shanqu.cc/browse/GHZS-319 2022-11-23 16:26:09 +08:00
584512c2ae Merge branch 'merge-release_to_dev' into 'dev'
合并 release 变更至 dev

See merge request halo/android/assistant-android!461
2022-11-23 10:43:24 +08:00
22cfe03a30 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/entity/PrivacyPolicyEntity.kt
#	dependencies.gradle
2022-11-23 10:36:10 +08:00
3b178c0bbe chore: 版本更新至 5.14.5 2022-11-23 10:20:30 +08:00
6270f9fb98 Merge branch 'hotfix-v5.14.4-634-vgame_feedback' into 'release'
fix: 修复畅玩游戏反馈无法正常跳转的问题 https://jira.shanqu.cc/browse/GHZS-309

See merge request halo/android/assistant-android!460
2022-11-23 10:19:40 +08:00
0306caadb5 fix: 修复畅玩游戏反馈无法正常跳转的问题 https://jira.shanqu.cc/browse/GHZS-309 2022-11-23 10:19:40 +08:00
30268a5cda chore: 版本更新至 5.14.4 2022-11-15 11:13:52 +08:00
5d4f489ddd Merge branch 'release-merge-legacy_release' into 'release'
合并 legacy-release 变更

See merge request halo/android/assistant-android!434
2022-11-15 11:13:03 +08:00
102d285c09 Merge remote-tracking branch 'origin/legacy-release' into release-merge-legacy_release
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/SplashScreenActivity.kt
#	dependencies.gradle
2022-11-15 10:57:41 +08:00
6b0611e05f chore: 版本更新至 5.13.7 2022-11-14 15:29:23 +08:00
384469bcae Merge branch 'feature-GHZS-209' into 'legacy-release'
feat: 还原首次启动时的权限提示弹窗和权限获取 https://jira.shanqu.cc/browse/GHZS-209

See merge request halo/android/assistant-android!431
2022-11-14 15:22:06 +08:00
0aeb37a5eb feat: 还原首次启动时的权限提示弹窗和权限获取 https://jira.shanqu.cc/browse/GHZS-209 2022-11-14 14:27:10 +08:00
900ee8e641 chore:版本更新至 5.13.6 2022-11-10 15:14:16 +08:00
bad1e32fda Merge branch 'feature-GHZS-163' into 'legacy-release'
feat:【光环助手】存储权限授权弹窗埋点补充 https://jira.shanqu.cc/browse/GHZS-163

See merge request halo/android/assistant-android!426
2022-11-10 15:11:40 +08:00
b602960882 feat:【光环助手】存储权限授权弹窗埋点补充 https://jira.shanqu.cc/browse/GHZS-163 2022-11-10 15:05:05 +08:00
6be3798b36 Merge branch 'feature-GHZS-116' into 'dev'
fix:【光环助手V5.15.0同步正式问题】登录闪退 https://jira.shanqu.cc/browse/GHZS-116

See merge request halo/android/assistant-android!424
2022-11-10 12:11:21 +08:00
5cf7ab8159 Merge branch 'dev-fix-vector_crash' into 'dev'
fix: 修复5.0以下系统矢量图的闪退问题

See merge request halo/android/assistant-android!425
2022-11-10 11:00:43 +08:00
1e7c56221a fix: 修复5.0以下系统矢量图的闪退问题 2022-11-10 10:52:09 +08:00
424efdafcf fix:【光环助手V5.15.0同步正式问题】登录闪退 https://jira.shanqu.cc/browse/GHZS-116 2022-11-09 17:22:59 +08:00
44b776a156 Merge branch 'fixes-from-release' into 'dev'
合并 release 分支的改动

See merge request halo/android/assistant-android!422
2022-11-09 16:26:24 +08:00
b17fa55f94 fix: 处理合并冲突 2022-11-09 16:06:23 +08:00
5d1bc4aedd Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/src/main/java/com/gh/common/constant/Config.java
#	app/src/main/java/com/gh/gamecenter/entity/NewSettingsEntity.kt
#	dependencies.gradle
#	module_common/src/main/java/com/gh/gamecenter/common/utils/Extensions.kt
2022-11-09 15:07:15 +08:00
fadd165e68 Merge branch 'hotfix-v5.14.3-633-setting_datas_error' into 'release'
fix: 修改设置接口数据保存错误问题

See merge request halo/android/assistant-android!421
2022-11-09 14:34:50 +08:00
255b6ea141 fix: 修改设置接口数据保存错误问题 2022-11-09 13:46:20 +08:00
7712039804 chore: 版本更新至 5.14.3 2022-11-08 15:15:57 +08:00
fee65172d1 Merge branch 'hotfix-v5.14.2-632-delete_apk_crash' into 'release'
fix: 捕抓清理安装包时的 concurrent 异常

See merge request halo/android/assistant-android!419
2022-11-08 15:13:36 +08:00
b09f0cde18 fix: 捕抓清理安装包时的 concurrent 异常 2022-11-08 15:04:12 +08:00
cb355b2490 Merge branch 'hotfix-v5.14.2-632-wrong_dark_mode_setting' into 'release'
fix: 修复错误的深色模式切换开关配置

See merge request halo/android/assistant-android!418
2022-11-08 12:01:27 +08:00
806ceee7e7 Merge branch 'hotfix-v5.14.2-632-super_did_not_called_crash' into 'release'
fix: 修复因为混淆问题导致 onConfigurationChanged 没有调用 super.onConfigurationChanged 而造成的闪退

See merge request halo/android/assistant-android!417
2022-11-08 11:55:35 +08:00
0cc8904852 fix: 修复错误的深色模式切换开关配置 2022-11-08 11:33:33 +08:00
1ffb58feea fix: 修复因为混淆问题导致 onConfigurationChanged 没有调用 super.onConfigurationChanged 而造成的闪退 2022-11-08 11:09:32 +08:00
e80c8d76cd Merge branch 'dev-fix-issues2125-gt' into 'dev'
fix:修复模拟器下载流程问题 https://jira.shanqu.cc/browse/GHZS-122

See merge request halo/android/assistant-android!415
2022-11-08 09:26:58 +08:00
f47b0326f4 fix:修复模拟器下载流程问题 https://jira.shanqu.cc/browse/GHZS-122 2022-11-08 09:26:58 +08:00
a1aada02d6 Merge branch 'dev-fix-issues2125-gt' into 'dev'
光环助手V5.15.0同步正式问题】游戏卡片UI问题

See merge request halo/android/assistant-android!413
2022-11-07 16:19:54 +08:00
659469aabc 光环助手V5.15.0同步正式问题】游戏卡片UI问题 2022-11-07 16:19:54 +08:00
9ee743c14f Merge branch 'feature-issues91' into 'dev'
清理冗余无用资源

See merge request halo/android/assistant-android!412
2022-11-03 16:34:17 +08:00
8be8430543 fix: 清理冗余无用资源 #91 2022-11-03 16:32:00 +08:00
de2c0dc0c3 fix: 清理冗余无用资源 https://git.shanqu.cc/halo/android/assistant-android/-/issues/91 2022-11-03 14:03:32 +08:00
e961642cf7 fix: 清理冗余无用资源 https://git.shanqu.cc/halo/android/assistant-android/-/issues/91 2022-11-03 10:51:57 +08:00
fb8bd8b440 Merge branch 'fix-ci-chucker' into 'dev'
ci: 更新含 chucker 的编译脚本

See merge request halo/android/assistant-android!410
2022-11-02 17:29:30 +08:00
ed19677568 ci: 更新含 chucker 的编译脚本 2022-11-02 17:12:48 +08:00
c4cf232d35 fix: 清理冗余无用资源 https://git.shanqu.cc/halo/android/assistant-android/-/issues/91 2022-11-02 16:35:37 +08:00
5fe552ad91 fix:清理无用资源 https://git.shanqu.cc/halo/android/assistant-android/-/issues/91 2022-11-02 16:20:46 +08:00
1db87a4152 Merge branch 'dev-fix-compress_resource' into 'dev'
fix:压缩我的光环背景资源

See merge request halo/android/assistant-android!409
2022-11-02 16:16:33 +08:00
1bd741be9c fix:压缩我的光环背景资源 2022-11-02 15:28:10 +08:00
7570e3e14e Merge branch 'feature-issues89' into 'dev'
refactor: 移除废弃的旧问答相关代码和资源 https://git.shanqu.cc/halo/android/assistant-android/-/issues/89

See merge request halo/android/assistant-android!408
2022-11-02 11:29:04 +08:00
ca009fb1b2 refactor: 移除废弃的旧问答相关代码和资源 https://git.shanqu.cc/halo/android/assistant-android/-/issues/89 2022-11-02 11:29:04 +08:00
872ac7bb85 Merge branch 'feature-issuess81' into 'dev'
feat:数据解析异常以 toast 形式抛出 https://git.shanqu.cc/halo/android/assistant-android/-/issues/81

See merge request halo/android/assistant-android!400
2022-11-02 10:53:42 +08:00
8ce13fd0db feat:数据解析异常以 toast 形式抛出 https://git.shanqu.cc/halo/android/assistant-android/-/issues/81 2022-11-02 10:53:42 +08:00
3ae27ebdb6 chore: 版本更新至 5.14.2 2022-11-01 17:20:30 +08:00
aab422662a Merge branch 'hotfix-v5.14.1-631-onConfigurationChanged' into 'release'
fix: 添加 onConfigurationChanged 日志辅助闪退确定问题

See merge request halo/android/assistant-android!407
2022-11-01 17:19:23 +08:00
bb80862d19 Merge branch 'feature-issues83' into 'dev'
refactor: 整理接口 timestamp 相关的内容 https://git.shanqu.cc/halo/android/assistant-android/-/issues/83

See merge request halo/android/assistant-android!405
2022-11-01 17:09:27 +08:00
02eea04cdc Merge branch 'dev-fix-issues2065' into 'dev'
fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1101测试问题:3) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!406
2022-11-01 17:05:21 +08:00
133b3aec96 fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1101测试问题:3) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-11-01 17:01:10 +08:00
4b974e3278 refactor: 整理接口 timestamp 相关的内容 https://git.shanqu.cc/halo/android/assistant-android/-/issues/83 2022-11-01 16:33:14 +08:00
8193b9ec9f fix: 添加 onConfigurationChanged 日志辅助闪退确定问题 2022-11-01 16:23:54 +08:00
13929f4dc5 Merge branch 'hotfix-v5.14.1-631-webview_dark_error' into 'release'
fix: 修复web页面开启夜间模式闪退问题

See merge request halo/android/assistant-android!404
2022-11-01 16:18:12 +08:00
0ea0834140 fix: 修复web页面开启夜间模式闪退问题 2022-11-01 16:09:05 +08:00
927e0e2468 Merge branch 'dev-fix-issues2065' into 'dev'
fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031UI测试问题:5) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!403
2022-11-01 15:25:23 +08:00
be3d509c9c fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031UI测试问题:5) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-11-01 15:20:31 +08:00
40bd4a1adf Merge branch 'dev-fix-issues2065' into 'dev'
fix: 修复猜你喜欢-发现页骨架屏显示异常

See merge request halo/android/assistant-android!402
2022-11-01 11:53:25 +08:00
b6bb3bf794 fix: 修复猜你喜欢-发现页骨架屏显示异常 2022-11-01 11:05:01 +08:00
ef6ef5c584 Merge branch 'dev-fix-issues2065' into 'dev'
fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031UI测试问题3,4) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!401
2022-11-01 10:15:24 +08:00
a600a9f0b0 fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031UI测试问题3,4) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-11-01 10:12:10 +08:00
31d0ce1302 Merge branch 'feature-issues2065' into 'dev'
fix:【光环助手V5.15.0】新增 猜你喜欢-发现页(1031测试:15(3)) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!399
2022-10-31 21:03:38 +08:00
bffa36bc5d fix:【光环助手V5.15.0】新增 猜你喜欢-发现页(1031测试:15(3)) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-31 20:49:31 +08:00
716a32a2b5 Merge branch 'feature-issues2065' into 'dev'
fix:【光环助手V5.15.0】新增 猜你喜欢-发现页(1031测试) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!395
2022-10-31 19:56:42 +08:00
70c09648a8 fix: 规范修改 2022-10-31 19:55:44 +08:00
a7cdade878 Merge branch 'dev' into feature-issues2065 2022-10-31 19:38:43 +08:00
b479048a87 fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031测试问题复测:1,2,12) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-31 19:38:05 +08:00
714d975602 Merge branch 'dev_merge_release' into 'dev'
合并 5.14.X 发布分支的问题修复

See merge request halo/android/assistant-android!398
2022-10-31 19:35:51 +08:00
a363090e4e Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt
#	app/src/main/java/com/gh/gamecenter/simulatorgame/SimulatorGameViewModel.kt
#	dependencies.gradle
2022-10-31 19:24:55 +08:00
f07b37ff01 Merge branch 'fix-user-home-paging' into 'dev'
fix: 修复用户主页的用户历史列表分页问题

See merge request halo/android/assistant-android!396
2022-10-31 19:16:55 +08:00
d0efdccb1d fix: 修复用户主页的用户历史列表分页问题 2022-10-31 19:07:59 +08:00
7efdb5e432 Merge branch 'hotfix-v5.14.1-631-simulator_sync_error' into 'release'
fix: 修复模拟器游戏列表可能出现的服务端为空,本地不为空的问题

See merge request halo/android/assistant-android!393
2022-10-31 18:51:40 +08:00
e5d73e5c73 fix:【光环助手V5.15.0】新增 猜你喜欢-发现页(1031测试:14) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-31 17:23:27 +08:00
e2f5de67a7 Merge branch 'feature-issues2065' into 'dev'
fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031测试:1,2,4,10,12) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!394
2022-10-31 15:57:37 +08:00
c34cacb5d0 fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031测试:1,2,4,10,12) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-31 15:50:22 +08:00
681ba37c4e Merge branch 'hotfix-v5.14.1-631-simulator_sync_error' into 'release'
fix: 修复模拟器游戏列表可能出现的服务端为空,本地不为空的问题

See merge request halo/android/assistant-android!393
2022-10-31 14:23:57 +08:00
d4d71d27ce fix: 修复模拟器游戏列表可能出现的服务端为空,本地不为空的问题 2022-10-31 13:47:10 +08:00
609b2805cc Merge branch 'feature-issues2049' into 'dev'
fix:【光环助手V5.15.0】登录相关优化(埋点事件发生部分变更) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2049#note_175334

See merge request halo/android/assistant-android!391
2022-10-31 13:37:38 +08:00
987ab1ccc9 Merge branch 'hotfix-v5.14.1-631-clean_apk_crash' into 'release'
修复清理 APK 时因为原图标过大导致的闪退

See merge request halo/android/assistant-android!392
2022-10-31 12:41:56 +08:00
93a77df0dc fix:【光环助手V5.15.0】登录相关优化(埋点事件发生部分变更) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2049#note_175334 2022-10-31 11:42:01 +08:00
e1c365ffe5 Merge branch 'dev-fix-issues2132-lyr' into 'dev'
fix:【光环助手V5.15.0】前端优化汇总10月第3周(8) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2132

See merge request halo/android/assistant-android!389
2022-10-31 11:41:50 +08:00
8863b02c7a fix: 修复安装包清理遇到原始图标过大而造成的闪退问题 2022-10-31 11:41:02 +08:00
89b97d274b Merge branch 'feature-issues2065' into 'dev'
fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031UI测试问题1,2)

See merge request halo/android/assistant-android!390
2022-10-31 11:34:41 +08:00
bbe3f9c741 fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1031UI测试问题1,2) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-31 11:28:22 +08:00
e7d0c15a0a fix:【光环助手V5.15.0】前端优化汇总10月第3周(8) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2132 2022-10-31 10:38:31 +08:00
ddfb474624 Merge branch 'feature-issues2065' into 'dev'
fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1028测试) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!388
2022-10-31 10:18:02 +08:00
b15b8c1237 fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1028测试) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-31 10:11:58 +08:00
0af8660b14 Merge branch 'feature-issues2065' into 'dev'
fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1028测试:5) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!387
2022-10-28 17:53:14 +08:00
4ea2f8d5af fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(1028测试:5) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-28 17:49:28 +08:00
66c727c874 Merge branch 'dev-fix-issues2125-gt' into 'dev'
fix:去除模拟器游戏合集TextView的默认内边距

See merge request halo/android/assistant-android!386
2022-10-28 16:53:02 +08:00
619abb9805 fix:去除模拟器游戏合集TextView的默认内边距 2022-10-28 16:53:02 +08:00
a94bb4dcb5 fix: 修复模拟器运行即闪退的问题 2022-10-28 16:22:29 +08:00
195d9343eb chore: 版本更新至 5.14.1 2022-10-28 15:45:09 +08:00
5a847970b2 Merge branch 'dev-fix-issues2125-gt' into 'dev'
fix:修复模拟器下载流程20221027测试反馈  https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2125

See merge request halo/android/assistant-android!385
2022-10-28 15:43:29 +08:00
ccd70b6087 fix:修复模拟器下载流程20221027测试反馈 https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2125 2022-10-28 15:43:29 +08:00
bd9fea1551 Merge branch 'dev-fix-issues2114-zyj' into 'dev'
fix: 【光环助手V5.15.0】前端优化汇总10月第1周(1025测试:第2点(2))

See merge request halo/android/assistant-android!384
2022-10-28 15:07:09 +08:00
f8c7bf5f64 Merge branch 'dev' into dev-fix-issues2114-zyj 2022-10-28 15:02:53 +08:00
7b71adc3fa Merge branch 'dev-fix-issues2132-yzw' into 'dev'
fix:【光环助手V5.15.0】前端优化汇总10月第3周(7)(修改分隔线实现方式)

See merge request halo/android/assistant-android!383
2022-10-28 14:56:31 +08:00
1882707e56 fix:【光环助手V5.15.0】前端优化汇总10月第3周(7)(修改分隔线实现方式) 2022-10-28 14:56:31 +08:00
49cafeb8bd fix: 【光环助手V5.15.0】前端优化汇总10月第1周(1025测试:第2点(2)) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2114 2022-10-28 14:52:31 +08:00
072cf65af4 Merge branch 'fix-emulator_crash' into 'dev'
fix: 修复模拟器运行即闪退的问题

See merge request halo/android/assistant-android!381
2022-10-28 11:41:17 +08:00
2f7277e410 fix: 修复模拟器运行即闪退的问题 2022-10-28 11:11:36 +08:00
f10a88a5a4 Merge branch 'feature-issues2049' into 'dev'
fix:【光环助手V5.15.0】前端优化汇总10月第2周(1024UI测试问题-第6点补充问题) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2049#note_175728

See merge request halo/android/assistant-android!380
2022-10-28 11:00:13 +08:00
45b5030ab5 fix:【光环助手V5.15.0】前端优化汇总10月第2周(1024UI测试问题-第6点补充问题) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2049#note_175728 2022-10-28 10:59:08 +08:00
fa35d98d5b Merge branch 'feature-issues2049' into 'dev'
fix:【光环助手V5.15.0】前端优化汇总10月第2周(1024UI测试问题-遗留第6点) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2121#note_175635

See merge request halo/android/assistant-android!379
2022-10-28 10:29:51 +08:00
d4e79a7b47 fix:【光环助手V5.15.0】前端优化汇总10月第2周(1024UI测试问题-遗留第6点) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2121#note_175635 2022-10-28 10:28:59 +08:00
d9fb9bcc2f Merge branch 'feature-issues2121' into 'dev'
fix:【光环助手V5.15.0】前端优化汇总10月第2周(发布手机埋点统一添加前缀publish_) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2121#note_175635

See merge request halo/android/assistant-android!377
2022-10-28 09:37:19 +08:00
13f7ca9f7d Merge branch 'dev-fix-issues2114-zyj' into 'dev'
fix: 【光环助手V5.15.0】前端优化汇总10月第1周(1025测试:第2点(1)(2))...

See merge request halo/android/assistant-android!378
2022-10-28 09:17:17 +08:00
cabe3055cb Merge branch 'dev' into dev-fix-issues2114-zyj 2022-10-27 20:46:38 +08:00
64e45521a6 fix: 【光环助手V5.15.0】前端优化汇总10月第1周(1025测试:第2点(1)(2)) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2114 2022-10-27 20:44:43 +08:00
b6d035f3a9 fix:【光环助手V5.15.0】前端优化汇总10月第2周(发布手机埋点统一添加前缀publish_) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2121#note_175635 2022-10-27 17:55:14 +08:00
313ed74939 Merge branch 'feature-issues2049' into 'dev'
fix:【光环助手V5.15.0】登录相关优化(1027UI测试问题) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2049#note_175516

See merge request halo/android/assistant-android!376
2022-10-27 17:49:54 +08:00
c79e5edc7a fix:【光环助手V5.15.0】登录相关优化(1027UI测试问题) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2049#note_175516 2022-10-27 17:47:44 +08:00
b4ccdcb8fa Merge branch 'feature-update_chucker' into 'dev'
build: 将 chucker 依赖从 jitpack 搬回自有 nexus

See merge request halo/android/assistant-android!375
2022-10-27 17:45:17 +08:00
1ed50c2626 build: 将 chucker 依赖从 jitpack 搬回自有 nexus 2022-10-27 17:35:22 +08:00
7ad6395bab Merge branch 'feature-issues2065' into 'dev'
feat: 【光环助手V5.15.0】新增 猜你喜欢-发现页 https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065

See merge request halo/android/assistant-android!374
2022-10-27 17:04:43 +08:00
28d2a9442c fix: 规范修改 2022-10-27 16:38:15 +08:00
997bfdf93d Merge branch 'hotfix-v5.14.0-630-vector_crash' into 'release'
fix:修复5.0以下系统部分矢量图加载出错导致无法显示的问题

See merge request halo/android/assistant-android!373
2022-10-27 15:34:53 +08:00
8eceb571ca Merge branch 'dev' into feature-issues2065
# Conflicts:
#	app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt
2022-10-27 15:27:02 +08:00
68f8619d09 feat: 【光环助手V5.15.0】新增 猜你喜欢-发现页(数据埋点) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-27 15:06:30 +08:00
de712065f5 Merge branch 'hotfix-v5.14.0-630-soft_keyboard' into 'release'
fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题

See merge request halo/android/assistant-android!372
2022-10-27 14:56:33 +08:00
511449c709 fix:修复5.0以下系统部分矢量图加载出错导致无法显示的问题 2022-10-27 14:50:24 +08:00
e79d5d1dfb Merge branch 'feature-issues2125' into 'dev'
feat: 模拟器下载流程调整 https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2125

See merge request halo/android/assistant-android!368
2022-10-27 14:40:07 +08:00
da8717693d feat: 模拟器下载流程调整 https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2125 2022-10-27 14:40:06 +08:00
03095b682b fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题 2022-10-27 14:32:48 +08:00
8437bfe1e3 Merge branch 'hotfix-v5.14.0-630-soft_keyboard' into 'release'
fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题

See merge request halo/android/assistant-android!369
2022-10-27 11:34:54 +08:00
a169ce1989 fix: 修复评论页面发表评论内容跳转登录页面返回时软键盘消失的问题 2022-10-27 10:48:14 +08:00
c327fcaf99 fix: 【光环助手V5.15.0】新增 猜你喜欢-发现页(UI优化) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-26 17:05:51 +08:00
b032f054f9 feat: 【光环助手V5.15.0】新增 猜你喜欢-发现页(完成UI、接口对接) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2065 2022-10-26 12:06:00 +08:00
9690429e95 Merge branch 'hotfix-v5.14.0-630-banned_vote_error' into 'release'
【光环助手V5.15.0】违规整合-正式环境运营验收问题(19) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2129

See merge request halo/android/assistant-android!367
2022-10-25 16:58:08 +08:00
b1dff15234 fix: 【光环助手V5.15.0】违规整合-正式环境运营验收问题(19) https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2129 2022-10-25 15:45:48 +08:00
381 changed files with 2985 additions and 5558 deletions

View File

@ -391,7 +391,6 @@ andResGuard {
"R.drawable.suggest_type_function_suggest",
"R.drawable.suggest_type_article_collect",
"R.drawable.suggest_type_copyright",
"R.drawable.help_result_empty",
"R.drawable.news_comment_detail_read",
"R.drawable.news_comment_detail_comment",
"R.drawable.news_comment_detail_share",

View File

@ -733,6 +733,10 @@
android:name=".BbsCertificationActivity"
android:screenOrientation="portrait" />
<activity
android:name=".discovery.DiscoveryActivity"
android:screenOrientation="portrait" />
<!-- <activity-->
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
<!-- android:launchMode="singleTask"-->

View File

@ -8,24 +8,26 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.EnvHelper;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.common.util.PackageHelper;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.SuggestionActivity;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.EnvHelper;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.entity.GameGuidePopupEntity;
import com.gh.gamecenter.entity.NewApiSettingsEntity;
import com.gh.gamecenter.entity.NewSettingsEntity;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.SettingsEntity;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.entity.SimulatorEntity;
import com.gh.gamecenter.entity.VSetting;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.vspace.VHelper;
import com.halo.assistant.HaloApp;
@ -64,8 +66,9 @@ public class Config {
private static SettingsEntity mSettingsEntity;
private static NewSettingsEntity mNewSettingsEntity;
private static NewApiSettingsEntity mNewApiSettingsEntity;
private static NewSettingsEntity.NightMode mNightModeSetting;
private static NewApiSettingsEntity.NightMode mNightModeSetting;
private static SimulatorEntity mNewSimulatorEntity;
private static VSetting mVSetting;
private static GameGuidePopupEntity mGameGuidePopupEntity;
@ -227,19 +230,19 @@ public class Config {
public static SimulatorEntity getNewSimulatorEntitySetting() {
if (mNewSimulatorEntity != null) {
return mNewSimulatorEntity;
} else if (mNewSettingsEntity != null && mNewSettingsEntity.getSimulator() != null) {
return mNewSettingsEntity.getSimulator();
} else if (mNewApiSettingsEntity != null && mNewApiSettingsEntity.getSimulator() != null) {
return mNewApiSettingsEntity.getSimulator();
} else {
return null;
}
}
@Nullable
public static NewSettingsEntity.NightMode getNightModeSetting() {
public static NewApiSettingsEntity.NightMode getNightModeSetting() {
if (mNightModeSetting != null) {
return mNightModeSetting;
} else if (mNewSettingsEntity != null && mNewSettingsEntity.getNightMode() != null) {
return mNewSettingsEntity.getNightMode();
} else if (mNewApiSettingsEntity != null && mNewApiSettingsEntity.getNightMode() != null) {
return mNewApiSettingsEntity.getNightMode();
} else {
return null;
}
@ -364,9 +367,6 @@ public class Config {
@Override
public void onSuccess(NewSettingsEntity data) {
mNewSettingsEntity = data;
if (mNightModeSetting != null) {
mNewSettingsEntity.setNightMode(mNightModeSetting);
}
SPUtils.setString(Constants.SP_NEW_SETTINGS, GsonUtils.toJson(data));
}
});
@ -384,27 +384,22 @@ public class Config {
});
}
if (mNightModeSetting == null && mNewSimulatorEntity == null) {
if (mNewApiSettingsEntity == null) {
RetrofitManager.getInstance()
.getNewApi().getNewSettings(PackageUtils.getGhVersionName(), channel)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BiResponse<NewSettingsEntity>() {
.subscribe(new BiResponse<NewApiSettingsEntity>() {
@Override
public void onSuccess(NewSettingsEntity data) {
public void onSuccess(NewApiSettingsEntity data) {
mNewApiSettingsEntity = data;
mNightModeSetting = data.getNightMode();
mNewSimulatorEntity = data.getSimulator();
if (HaloApp.getInstance().isNewForThisVersion && mNightModeSetting != null && mNightModeSetting.getInstall()) {
DarkModeUtils.INSTANCE.updateFollowSystemDarkModeToSp(true);
DarkModeUtils.INSTANCE.updateAppDarkModeStatusToSp(true);
DarkModeUtils.INSTANCE.initDarkMode();
}
if (mNewSettingsEntity != null) {
mNewSettingsEntity.setSimulator(mNewSimulatorEntity);
mNewSettingsEntity.setNightMode(mNightModeSetting);
SPUtils.setString(Constants.SP_NEW_SETTINGS, GsonUtils.toJson(data));
}
SPUtils.setString(Constants.SP_NEW_API_SETTINGS, GsonUtils.toJson(data));
}
});
}

View File

@ -18,7 +18,7 @@ import com.halo.assistant.HaloApp
@Database(
entities = [AnswerEntity::class, ArticleEntity::class, NewsEntity::class, HistoryGameEntity::class, MyVideoEntity::class, GamesCollectionEntity::class],
version = 11,
version = 12,
exportSchema = false
)
@TypeConverters(
@ -28,6 +28,7 @@ import com.halo.assistant.HaloApp
AnswerUserConverter::class,
ThumbnailConverter::class,
TagStyleListConverter::class,
TagStyleConverter::class,
StringArrayListConverter::class,
ListStringConverter::class,
CommunityVideoConverter::class,
@ -127,6 +128,13 @@ abstract class HistoryDatabase : RoomDatabase() {
}
}
val MIGRATION_11_12: Migration = object : Migration(11, 12) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("Alter TABLE HistoryGameEntity add subtitle TEXT NOT NULL DEFAULT ''")
database.execSQL("Alter TABLE HistoryGameEntity add subtitleStyle TEXT")
}
}
val instance by lazy {
Room.databaseBuilder(
HaloApp.getInstance().application,
@ -142,6 +150,7 @@ abstract class HistoryDatabase : RoomDatabase() {
.addMigrations(MIGRATION_8_9)
.addMigrations(MIGRATION_9_10)
.addMigrations(MIGRATION_10_11)
.addMigrations(MIGRATION_11_12)
.build()
}
}

View File

@ -71,6 +71,8 @@ object HistoryHelper {
historyGame.name = gameEntity.name
historyGame.tagStyle = gameEntity.tagStyle
historyGame.tag = gameEntity.getTag()
historyGame.subtitle = gameEntity.subtitle
historyGame.subtitleStyle = gameEntity.subtitleStyle
return historyGame
}

View File

@ -138,6 +138,7 @@ class SimulatorDownloadManager private constructor() {
cancelCallback: (() -> Unit)? = null
) {
if (context == null) return
this.simulatorLocation = location
this.simulator = simulator
this.gameId = gameId
@ -145,21 +146,31 @@ class SimulatorDownloadManager private constructor() {
PermissionHelper.checkGetInstalledAppsListBeforeAction(context, object : EmptyCallback {
override fun onCallback() {
//判断是否隐藏
if (simulator?.active == false) {
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
//当没有安装新版本模拟器时候 判断是否隐藏
if (simulator?.active == false && !isInstalledNewSimulator) {
showNoneEmulatorDialog(context)
return
}
val isInstalled = PackageUtils.isInstalledFromAllPackage(context, simulator?.apk?.packageName)
var isInstalled = PackageUtils.isInstalledFromAllPackage(
context,
simulator?.apk?.packageName
)
//模拟器管理界面还是用之前的逻辑
if (isInstalledNewSimulator && location != SimulatorLocation.SIMULATOR_MANAGE) {
isInstalled = isInstalledNewSimulator
}
// val versionFromInstalledApp = PackageUtils.getVersionNameByPackageName(simulator?.apk?.packageName)
val shouldShowUpdate = PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
val shouldShowUpdate =
PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
val showAlertTag = SPUtils.getString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, "") //当天是否弹过
val todayIsShow = showAlertTag == TimeUtils.getToday()
downloadType = if (shouldShowUpdate && isInstalled) "update" else "download"
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE){
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE) {
return
}
if (downloadType == "download" && isInstalled){
if (downloadType == "download" && isInstalled) {
return
}
val title = if (shouldShowUpdate && isInstalled) "更新模拟器" else "安装模拟器"

View File

@ -6,13 +6,11 @@ import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.CountDownTimer;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.text.Html;
import android.text.Spannable;
@ -1907,13 +1905,21 @@ public class DialogUtils {
}
}
@SuppressLint("SetTextI18n")
public static void showReportReasonDialog(Context context, ArrayList<String> items, ReportReasonCallBack callBack) {
showReportReasonDialog(context, items, "", callBack);
}
@SuppressLint("SetTextI18n")
public static void showReportReasonDialog(Context context, ArrayList<String> items, String title, ReportReasonCallBack callBack) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
DialogReportReasonBinding binding = DialogReportReasonBinding.inflate(LayoutInflater.from(context));
if (!title.isEmpty()) {
binding.reasonTitle.setText(title);
}
ReportReasonAdapter reportReasonAdapter = new ReportReasonAdapter(context, items, reason -> {
if (reason.equals("其他原因")) {
binding.reasonTitle.setText(R.string.report_reason_other_title);

View File

@ -35,6 +35,7 @@ import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.discovery.DiscoveryActivity
import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.eventbus.EBSkip
@ -181,7 +182,8 @@ object DirectUtils {
"common_collection",
"game_list",
"game_list_detail",
"bbs_video"
"bbs_video",
"explore_column"
)
fun directToLinkPage(
@ -434,6 +436,8 @@ object DirectUtils {
"game_list_detail" -> directToGameCollectionDetail(context, linkEntity.link ?: "", entrance)
"explore_column" -> context.startActivity(DiscoveryActivity.getIntent(context, entrance))
"" -> {
// do nothing
}
@ -767,6 +771,36 @@ object DirectUtils {
jumpActivity(context, bundle)
}
@JvmStatic
fun directToFeedbackCompat(
context: Context,
content: String? = null,
hintType: String? = null,
isQaFeedback: Boolean = false,
qaContentId: String? = "",
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, SuggestionActivity::class.java.simpleName)
if (isQaFeedback) {
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
} 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.putString(KEY_SUGGEST_HINT_TYPE, hintType)
}
}
jumpActivityCompat(context, bundle)
}
@JvmStatic
fun directToDownloadManager(context: Context, entrance: String? = null) {
val bundle = Bundle()

View File

@ -787,6 +787,7 @@ object DownloadItemUtils {
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.attempt)) {
ChainBuilder().apply {
addHandler(UpdateNewSimulatorHandler())
addHandler(GamePermissionHandler())
addHandler(BrowserInstallHandler())
addHandler(PackageCheckHandler())
@ -844,8 +845,11 @@ object DownloadItemUtils {
val isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(context)
val isInstalledOldSimulator = SimulatorGameManager.isOldSimulatorInstalled(context)
var simulator = gameEntity.simulator
if (!isInstalledOldSimulator) {
simulator = Config.getNewSimulatorEntitySetting()
val newSimulator = Config.getNewSimulatorEntitySetting()
if (!isInstalledOldSimulator && newSimulator != null) {//在没有安装旧的模拟器且有配置新版模拟器 才使用新版模拟器 否则还是用以前旧的
if (newSimulator.active) {
simulator = newSimulator
}
}
if (downloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled && !isInstalledNewSimulator) {
SimulatorDownloadManager.getInstance().showDownloadDialog(

View File

@ -241,16 +241,20 @@ object DownloadObserver {
val gameName = downloadEntity.getMetaExtra(Constants.GAME_NAME)
if (simulatorJson.isEmpty()) return
var simulator = GsonUtils.fromJson(simulatorJson, SimulatorEntity::class.java)
val isInstalled = PackageUtils.isInstalledFromAllPackage(HaloApp.getInstance().application, simulator.apk?.packageName)
val isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
val isInstalledOldSimulator = SimulatorGameManager.isOldSimulatorInstalled(HaloApp.getInstance().application)
val isInstalled = PackageUtils.isInstalledFromAllPackage(
HaloApp.getInstance().application,
simulator.apk?.packageName
)
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
val isInstalledOldSimulator =
SimulatorGameManager.isOldSimulatorInstalled(HaloApp.getInstance().application)
// if (!isInstalled && !isInstalledNewSimulator) {
val currentActivity = AppManager.getInstance().currentActivity()
?: return
if (!isInstalledOldSimulator || isInstalledNewSimulator) { //如果没有安装任一旧的模拟器 或者下载了新模拟器 则使用新版本模拟器
Config.getNewSimulatorEntitySetting().let {
simulator = it!!
}
val newSimulator = Config.getNewSimulatorEntitySetting()
if ((!isInstalledOldSimulator && newSimulator != null && newSimulator.active) || isInstalledNewSimulator) { //如果没有安装任一旧的模拟器 或者下载了新模拟器 则使用新版本模拟器
simulator = newSimulator!!
}
SimulatorDownloadManager.getInstance().showDownloadDialog(
currentActivity, simulator,

View File

@ -37,6 +37,32 @@ import java.util.Set;
public class EntranceUtils {
public static void jumpActivityCompat(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
if (HaloApp.getInstance().isRunningForeground || HaloApp.getInstance().isAlreadyUpAndRunning) {
// 应用正在运行,前台或后台
String to = bundle.getString(KEY_TO);
Class<?> clazz = ClassUtils.forName(to);
if (clazz == null) clazz = MainActivity.class;
if (ToolbarFragment.class.isAssignableFrom(clazz)) { // 兼容ToolbarFragment
ToolBarActivity.startFragmentNewTask(context, (Class<? extends ToolbarFragment>) clazz, bundle);
} else {
Intent intent1 = new Intent(context, clazz);
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 如果 activity 名称有 singleton 的就添加 reorder_to_front 标签 (有点粗暴有点蠢,但暂时就先这样吧 :C )
if (clazz.getSimpleName().toLowerCase().contains("singleton")) {
intent1.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
}
intent1.putExtras(bundle);
context.startActivity(intent1);
}
} else {
// 应用未在运行
context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
}
}
public static void jumpActivity(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);

View File

@ -558,7 +558,7 @@ object NewFlatLogUtils {
//手机号验证弹窗点击事件
fun logPhoneNumberVerifyDialogClick(entrance: String, text: String) {
val json = json {
"event" to "phone_number_verify_dialog_click"
"event" to "publish_phone_number_verify_dialog_click"
"entrance" to entrance
"text" to text
parseAndPutMeta().invoke(this)
@ -569,7 +569,7 @@ object NewFlatLogUtils {
//手机号验证界面展示事件
fun logPhoneNumberVerifyDialogShow(entrance: String) {
val json = json {
"event" to "phone_number_verify_dialog_show"
"event" to "publish_phone_number_verify_dialog_show"
"entrance" to entrance
parseAndPutMeta().invoke(this)
}
@ -580,7 +580,7 @@ object NewFlatLogUtils {
//完成手机号验证
fun logPhoneNumberVerifyDialogSuccess() {
val json = json {
"event" to "phone_number_verify_dialog_success"
"event" to "publish_phone_number_verify_dialog_success"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
@ -732,4 +732,96 @@ object NewFlatLogUtils {
}
log(json, "event", false)
}
//进入发现页面
fun logDiscoverPageEnter() {
val json = json {
"event" to "discover_page_enter"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//离开发现页面
fun logDiscoverPageQuit(sequence: Int) {
val json = json {
"event" to "discover_page_quit"
"sequence" to sequence
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//发现页面可见事件
fun logDiscoverPageVisible() {
val json = json {
"event" to "discover_page_visible"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//发现页面不可见事件
fun logDiscoverPageInvisible(sequence: Int) {
val json = json {
"event" to "discover_page_invisible"
"sequence" to sequence
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//页面顶部露出
fun logDiscoverPageTopVisible(countNum: Int) {
val json = json {
"event" to "discover_page_top_visible"
"count_num" to countNum
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//页面底部停留
fun logDiscoverPageBottomStay(countNum: Int) {
val json = json {
"event" to "discover_page_bottom_stay"
"count_num" to countNum
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//点击兴趣推荐卡片
fun logDiscoverPageRecommendedInterestCardClick(sequence: Int, linkText: String, linkType: String, linkId: String) {
val json = json {
"event" to "discover_page_recommended_interest_card_click"
"sequence" to sequence
"link_text" to linkText
"link_type" to linkType
"link_id" to linkId
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//点击跳转游戏库
fun logDiscoverPageJumpGamesLibraries() {
val json = json {
"event" to "discover_page_jump_games_libraries"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//触发不感兴趣
fun logDiscoverPageNotInterest(gameId: String, gameName: String) {
val json = json {
"event" to "discover_page_not_interest"
"game_id" to gameId
"game_name" to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
}

View File

@ -36,6 +36,7 @@ import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.core.utils.SentryHelper;
import com.gh.gamecenter.download.DownloadedGameIdAndPackageNameDao;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
@ -389,12 +390,16 @@ public class DownloadManager implements DownloadStatusListener {
* 清理不存在本地 APK 文件的任务
*/
public void clearTasksThatFileBeenDeleted() {
for (DownloadEntity entity : getAllDownloadEntity()) {
if (entity.getStatus() == DownloadStatus.done) {
if (FileUtils.isEmptyFile(entity.getPath())) {
cancel(entity.getUrl());
try {
for (DownloadEntity entity : getAllDownloadEntity()) {
if (entity.getStatus() == DownloadStatus.done) {
if (FileUtils.isEmptyFile(entity.getPath())) {
cancel(entity.getUrl());
}
}
}
} catch (Exception e) {
SentryHelper.INSTANCE.onEvent("CLEAR_DELETED_TASK_ERROR", "exception_digest", e.getLocalizedMessage());
}
}

View File

@ -180,6 +180,7 @@ public class MainActivity extends BaseActivity {
showAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null;
HaloApp.getInstance().initFresco();
HaloApp.getInstance().isAlreadyUpAndRunning = true;
super.onCreate(savedInstanceState);
setStatusBarColor(Color.TRANSPARENT);

View File

@ -137,7 +137,7 @@ public class SkipActivity extends BaseActivity {
if (!TextUtils.isEmpty(qaId)) {
DirectUtils.directToQa(this, qaTitle, qaId);
} else if ("vgame".equals(suggestionType)) {
DirectUtils.directToFeedback(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
DirectUtils.directToFeedbackCompat(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
} else {
DirectUtils.directToFeedback(this, content, null, isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
}

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter
import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
@ -25,6 +26,7 @@ import com.gh.common.util.GameSubstituteRepositoryHelper.updateGameSubstituteRep
import com.gh.common.util.UsageStatsHelper.checkAndPostUsageStats
import com.gh.download.DownloadManager
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.tracker.TrackerLogger
@ -60,6 +62,8 @@ class SplashScreenActivity : BaseActivity() {
private var mShouldPrefetchData = true
private val mPermissions = arrayOf(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
PermissionHelper.PERMISSION_GET_INSTALLED_LIST
)
@ -150,42 +154,41 @@ class SplashScreenActivity : BaseActivity() {
private fun showPrivacyDialog(guideLayout: ViewPager) {
NewPrivacyPolicyDialogFragment.show(this, null) { isSuccess: Boolean ->
if (isSuccess) {
guideLayout.visibility = View.VISIBLE
SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
//
// // 恢复畅玩数据
// VHelper.recoverVDataIfPossible()
//
// requestPermission()
//
// // 检查是否有旧版本光环,有就删掉
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
// if (mStartMainActivityDirectly) {
// launchMainActivity()
// }
// 恢复畅玩数据
VHelper.recoverVDataIfPossible()
mShouldPrefetchData = false
prefetchData()
requestPermission()
// 检查是否有旧版本光环,有就删掉
AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
launchMainActivity()
} else {
mShouldPrefetchData = false
prefetchData()
val callback = object : SimpleCallback<Boolean> {
override fun onCallback(arg: Boolean) {
// Dialog dismiss 后的回调
guideLayout.visibility = View.VISIBLE
SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
if (arg) {
requestPermission()
} else {
mStartMainActivityDirectly = false
}
}
}
// val callback = object : SimpleCallback<Boolean> {
// override fun onCallback(arg: Boolean) {
// // Dialog dismiss 后的回调
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
// if (arg) {
// requestPermission()
// } else {
// mStartMainActivityDirectly = false
// }
// }
// }
//
// mViewModel?.showPrivacyPolicy({
// DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, it, callback)
// }, {
// DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, PrivacyPolicyEntity.createDefaultData(), callback)
// })
mViewModel?.showPrivacyPolicy({
DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, it, callback)
}, {
DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, PrivacyPolicyEntity.createDefaultData(), callback)
})
} else {
DialogUtils.showPrivacyPolicyDisallowDialog(
this,
@ -385,10 +388,10 @@ class SplashScreenActivity : BaseActivity() {
private fun checkAndRequestPermission() {
if (EasyPermissions.hasPermissions(this, *mPermissions)) {
// 恢复畅玩数据
// VHelper.recoverVDataIfPossible()
VHelper.recoverVDataIfPossible()
// 检查是否有旧版本光环,有就删掉
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) {
showGitLogDialogIfNeeded()

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.view.View;
@ -117,7 +118,8 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
appInfo.sourceDir = apk_path;
appInfo.publicSourceDir = apk_path;
Drawable apk_icon = appInfo.loadIcon(pm);
apkEntity.setGameBm(BitmapUtils.drawableToBitmap(apk_icon, true));
Bitmap originalBitmap = BitmapUtils.drawableToBitmap(apk_icon, true);
apkEntity.setGameBm(BitmapUtils.compressBitmap(originalBitmap, 100));
/** apk的绝对路劲 */
apkEntity.setGamePath(apk_path);
/** apk的版本名称 String */

View File

@ -42,6 +42,7 @@ import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.suggest.SuggestType;
import com.lightgame.adapter.BaseRecyclerAdapter;
@ -196,6 +197,8 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
ExtensionsKt.setRootBackgroundColor(holder.binding.getRoot(), R.color.background_white);
if (mLibaoEntity.getGame() != null) {
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getGame().getIcon(), mLibaoEntity.getGame().getIconSubscript());
GameEntity gameEntity = mLibaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, holder.binding.gameSubtitleTv, null, null, false);
} else {
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null);
}

View File

@ -315,9 +315,10 @@ public class DetailViewHolder {
boolean isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(mViewHolder.context);
boolean isInstalledOldSimulator = SimulatorGameManager.isOldSimulatorInstalled(mViewHolder.context);
SimulatorEntity simulator = mGameEntity.getSimulator();
if (!isInstalledOldSimulator){
if (Config.getNewSimulatorEntitySetting() != null){
simulator = Config.getNewSimulatorEntitySetting();
SimulatorEntity newSimulator = Config.getNewSimulatorEntitySetting();
if (!isInstalledOldSimulator && newSimulator != null) {
if (newSimulator.getActive()) {
simulator = newSimulator;
}
}

View File

@ -28,6 +28,7 @@ import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.databinding.AmwayCommentItemBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.game.GameAndPosition
import com.gh.gamecenter.game.GameItemViewHolder
import com.gh.gamecenter.game.vertical.GameVerticalAdapter
import com.gh.gamecenter.gamedetail.rating.RatingFragment
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
@ -206,6 +207,7 @@ class AmwayAdapter(
) {
val context = binding.root.context
val amway = itemData.amwayCommentItem!!
val gameEntity = amway.game.toGameEntity()
binding.gameContainer.background = R.drawable.selector_f8f8f8.toDrawable(context)
binding.commentContainer.background = R.drawable.selector_f8f8f8.toDrawable(context)
@ -237,7 +239,8 @@ class AmwayAdapter(
)
}
itemData.exposureEvent = ExposureEvent.createEvent(amway.game.toGameEntity(), basicExposureSource)
itemData.exposureEvent = ExposureEvent.createEvent(gameEntity, basicExposureSource)
GameItemViewHolder.initGameSubtitle(gameEntity, binding.gameSubtitleTv)
binding.gameContainer.setOnClickListener {
GameDetailActivity.startGameDetailActivity(
@ -295,7 +298,7 @@ class AmwayAdapter(
binding.likeCountTv.setTextColor(R.color.theme_font.toColor(binding.likeCountTv.context))
binding.likeClickableView.setOnClickListener {
debounceActionWithInterval(binding.likeClickableView.id, 1000L) {
binding.likeIv.context.ifLogin("安利墙") {
binding.likeIv.context.ifLogin("安利墙-取消点赞") {
viewModel.undoLikeAmwayComment(amway.game.id, amway.comment.id)
MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_取消点赞")
}
@ -306,7 +309,7 @@ class AmwayAdapter(
binding.likeCountTv.setTextColor(R.color.text_B3B3B3.toColor(binding.likeCountTv.context))
binding.likeClickableView.setOnClickListener {
debounceActionWithInterval(binding.likeClickableView.id, 1000L) {
binding.likeIv.context.ifLogin("安利墙") {
binding.likeIv.context.ifLogin("安利墙-点赞") {
playLikedAnimation(binding.likeCountTv, binding.likeIv, binding.likeAnimView)
viewModel.likeAmwayComment(amway.game.id, amway.comment.id)
MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_点赞")

View File

@ -27,6 +27,7 @@ import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.CategoryGameItemBinding
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.game.GameItemViewHolder
import com.lightgame.download.DownloadEntity
class CategoryV2ListAdapter(
@ -245,6 +246,8 @@ class CategoryV2ListAdapter(
)
)
gameDes.text = gameEntity.decoratedDes
GameItemViewHolder.initGameSubtitle(gameEntity, gameSubtitleTv, gameDesSpace, root)
}
}

View File

@ -14,6 +14,7 @@ import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler;
import com.gh.common.util.CollectionUtils;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
@ -232,6 +233,11 @@ public class AnswerAdapter extends ListAdapter<AnswerEntity> implements ISyncAda
}
});
mPopupBinding.checkAllCb.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
);
mPopupBinding.checkAllCb.setOnClickListener(v -> {
if (mPopupBinding.checkAllCb.isChecked()) {
selectItems.clear();

View File

@ -16,6 +16,7 @@ import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.common.util.NewsUtils;
@ -361,6 +362,11 @@ public class ArticleAdapter extends ListAdapter<NewsEntity> {
}
});
mPopupBinding.checkAllCb.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
);
mPopupBinding.checkAllCb.setOnClickListener(v -> {
if (mPopupBinding.checkAllCb.isChecked()) {
selectItems.clear();

View File

@ -18,6 +18,7 @@ import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.CommunityAnswerItemBinding
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.history.ManageOption
import com.gh.gamecenter.qa.answer.CommunityAnswerItemViewHolder
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity
@ -172,6 +173,11 @@ class CommunityArticleAdapter(
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()

View File

@ -24,6 +24,7 @@ import com.gh.gamecenter.adapter.viewholder.GameCollectionItemViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.collection.GamesCollectionFragment.Companion.TYPE_USER
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.ItemGameCollectionFlexTagBinding
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
@ -424,6 +425,11 @@ class GamesCollectionAdapter(
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()

View File

@ -3,6 +3,7 @@ package com.gh.gamecenter.collection
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.graphics.drawable.StateListDrawable
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@ -17,6 +18,7 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
import com.gh.gamecenter.databinding.VideoNewItemBinding
import com.gh.gamecenter.entity.MyVideoEntity
@ -166,6 +168,11 @@ class VideoAdapter(
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()

View File

@ -0,0 +1,36 @@
package com.gh.gamecenter.discovery
import android.content.Context
import android.content.Intent
import android.os.Bundle
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
/**
* 猜你喜欢-发现页
*/
class DiscoveryActivity : ToolBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
updateStatusBarColor(R.color.background_white, R.color.background_white)
setNavigationTitle("发现")
}
override fun isAutoResetViewBackgroundEnabled(): Boolean = true
override fun onDarkModeChanged() {
super.onDarkModeChanged()
updateStatusBarColor(R.color.background_white, R.color.background_white)
}
companion object {
fun getIntent(context: Context, entrance: String): Intent {
val bundle = Bundle()
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
return getTargetIntent(context, DiscoveryActivity::class.java, DiscoveryFragment::class.java, bundle)
}
}
}

View File

@ -0,0 +1,429 @@
package com.gh.gamecenter.discovery
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.util.SparseArray
import android.view.View
import android.view.ViewGroup
import android.widget.Space
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.databind.BindingAdapters
import com.gh.common.exposure.ExposureEvent
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.ExposureType
import com.gh.common.exposure.IExposable
import com.gh.common.util.*
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.BlockActivity
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.databinding.DiscoveryGameItemBinding
import com.gh.gamecenter.databinding.ItemRecommendInterestBinding
import com.gh.gamecenter.databinding.ItemRecommendInterestFooterBinding
import com.gh.gamecenter.databinding.ItemRecommendInterestImageBinding
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.fragment.MainWrapperRepository
import com.lightgame.download.DownloadEntity
import org.greenrobot.eventbus.EventBus
class DiscoveryAdapter(
context: Context,
private val mViewModel: DiscoveryViewModel,
private val mBaseExposureSource: ArrayList<ExposureSource>,
private val mOuterSequence: Int,
private val mEntrance: String
) : ListAdapter<DiscoveryItemData>(context), IExposable {
private val mExposureEventSparseArray: SparseArray<ExposureEvent> = SparseArray()
override fun getItemViewType(position: Int): Int {
val value = mViewModel.loadStatusLiveData.value
if (position == itemCount - 1) {
if (value == LoadStatus.INIT_OVER || value == LoadStatus.LIST_OVER) {
return ITEM_DIRECT_GAME_BLOCK
}
return ItemViewType.ITEM_FOOTER
}
val itemData = mEntityList[position]
return when {
itemData.interestCardLabels != null -> {
ITEM_RECOMMEND_INTEREST
}
itemData.interestImageCardLabel != null -> {
ITEM_RECOMMEND_INTEREST_IMAGE
}
else -> {
ItemViewType.GAME_NORMAL
}
}
}
override fun areItemsTheSame(oldItem: DiscoveryItemData?, newItem: DiscoveryItemData?): Boolean {
if (oldItem?.gameEntity != null && newItem?.gameEntity != null) {
return oldItem.gameEntity.id == newItem.gameEntity.id
}
if (oldItem?.interestCardLabels != null && newItem?.interestCardLabels != null) {
return oldItem.interestCardLabels.firstOrNull()?.id == newItem.interestCardLabels.firstOrNull()?.id
}
if (oldItem?.interestImageCardLabel != null && newItem?.interestImageCardLabel != null) {
return oldItem.interestImageCardLabel.id == newItem.interestImageCardLabel.id
}
return false
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) {
ItemViewType.GAME_NORMAL -> {
DiscoveryGameViewHolder(parent.toBinding())
}
ItemViewType.ITEM_FOOTER -> {
FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false))
}
ITEM_DIRECT_GAME_BLOCK -> {
DirectGameBlockViewHolder(parent.toBinding())
}
ITEM_RECOMMEND_INTEREST -> {
RecommendInterestViewHolder(parent.toBinding())
}
ITEM_RECOMMEND_INTEREST_IMAGE -> {
RecommendInterestImageViewHolder(parent.toBinding())
}
else -> {
throw NullPointerException()
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
is DiscoveryGameViewHolder -> {
val itemData = mEntityList[position]
val gameEntity = itemData.gameEntity!!
DownloadItemUtils.updateItem(mContext, gameEntity, holder, true, "star")
holder.bindGameItem(gameEntity)
val type = when (gameEntity.type) {
"recommend" -> "专题推荐"
"ad" -> "游戏广告"
"filter" -> "算法过滤"
else -> ""
}
val exposureSources = ArrayList<ExposureSource>().apply {
add(ExposureSource("发现", type))
}
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity.apply {
sequence = position
if (mOuterSequence >= 0) {
outerSequence = mOuterSequence
}
},
mBaseExposureSource,
exposureSources,
null,
ExposureType.EXPOSURE
)
mExposureEventSparseArray.put(position, event)
holder.itemView.setOnClickListener {
GameDetailActivity.startGameDetailActivity(
mContext,
gameEntity,
StringUtils.buildString("(${mEntrance}", "-列表[", (position).toString(), "])"),
traceEvent = event
)
}
holder.itemView.setOnLongClickListener {
discoveryFeedback(position, gameEntity)
true
}
DownloadItemUtils.setOnClickListener(
mContext,
holder.binding.downloadBtn,
gameEntity,
position,
this,
StringUtils.buildString("(${mEntrance}", "-列表[", (position).toString(), "])"),
StringUtils.buildString(mEntrance, ":", gameEntity.name),
event
)
}
is RecommendInterestViewHolder -> {
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
holder.binding.backgroundView.background = R.drawable.bg_shape_space_radius_8.toDrawable(mContext)
holder.binding.interestTv.setTextColor(R.color.text_title.toColor(mContext))
val labels = mEntityList[position].interestCardLabels ?: return
val labelTvList = arrayListOf(holder.binding.labelTv1, holder.binding.labelTv2, holder.binding.labelTv3)
labelTvList.forEachIndexed { index, labelTv ->
labelTv.goneIf(labels.size < index + 1) {
labelTv.setTextColor(R.color.text_subtitle.toColor(mContext))
labelTv.background = R.drawable.bg_shape_white_radius_4.toDrawable(mContext)
labelTv.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
R.drawable.ic_interest_arrow.toDrawable(mContext),
null
)
labels[index].text = labels[index].linkText
labelTv.text = labels[index].title
labelTv.setOnClickListener {
DirectUtils.directToLinkPage(holder.binding.root.context, labels[index], mEntrance, "")
logDiscoverPageRecommendedInterestCardClick(
mEntityList[position].cardPosition,
labels[index]
)
}
}
}
}
is RecommendInterestImageViewHolder -> {
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
val label = mEntityList[position].interestImageCardLabel ?: return
label.text = label.linkText
holder.binding.root.setOnClickListener {
DirectUtils.directToLinkPage(holder.binding.root.context, label, mEntrance, "")
logDiscoverPageRecommendedInterestCardClick(mEntityList[position].cardPosition, label)
}
}
is DirectGameBlockViewHolder -> {
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
holder.binding.root.setOnClickListener {
val navBar = MainWrapperRepository.getInstance().getNavBarLiveData().value
if (navBar == null || mContext is DiscoveryActivity) {
val blockData = HomeBottomBarHelper.getDefaultGameBarData()
mContext.startActivity(BlockActivity.getIntent(mContext, blockData, mEntrance))
} else {
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_GAME))
}
NewFlatLogUtils.logDiscoverPageJumpGamesLibraries()
}
}
is FooterViewHolder -> {
holder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver)
}
}
}
private fun logDiscoverPageRecommendedInterestCardClick(
position: Int?,
label: DiscoveryGameCardLabel
) {
if (position == null) return
NewFlatLogUtils.logDiscoverPageRecommendedInterestCardClick(
position,
label.text ?: "",
label.type ?: "",
label.link ?: ""
)
}
override fun getItemCount(): Int {
return if (mEntityList == null || mEntityList.isEmpty()) return 0 else mEntityList.size + 1
}
private fun discoveryFeedback(position: Int, gameEntity: GameEntity) {
DialogUtils.showReportReasonDialog(
mContext,
Constants.FEEDBACK_REASON_LIST.toList() as ArrayList<String>,
"不喜欢的原因"
) { reason, _ ->
mViewModel.discoveryFeedback(gameEntity.id, reason, gameEntity.type ?: "") {
NewFlatLogUtils.logDiscoverPageNotInterest(gameEntity.id, gameEntity.name ?: "")
mViewModel.forceRefresh = true
mEntityList.removeAt(position)
notifyItemRemoved(position)
}
}
}
fun notifyItemByDownload(download: DownloadEntity) {
val positionAndPackageMap = mViewModel.positionAndPackageMap
for (key in positionAndPackageMap.keys) {
if (key.contains(download.packageName)) {
val position = positionAndPackageMap[key]
if (position != null && mEntityList != null && position < mEntityList.size) {
mEntityList[position].gameEntity?.let {
it.getEntryMap()[download.platform] = download
}
notifyItemChanged(position)
}
}
}
}
fun notifyItemAndRemoveDownload(status: EBDownloadStatus) {
val positionAndPackageMap = mViewModel.positionAndPackageMap
for (key in positionAndPackageMap.keys) {
if (key.contains(status.packageName)) {
val position = positionAndPackageMap[key]
if (position != null && mEntityList != null && position < mEntityList.size) {
mEntityList[position].gameEntity?.let {
it.getEntryMap().remove(status.platform)
}
notifyItemChanged(position)
}
}
}
}
fun clearPositionAndPackageMap() {
mViewModel.positionAndPackageMap.clear()
}
override fun getEventByPosition(pos: Int): ExposureEvent? {
return mExposureEventSparseArray.get(pos)
}
override fun getEventListByPosition(pos: Int): List<ExposureEvent>? {
return null
}
class DiscoveryGameViewHolder(val binding: DiscoveryGameItemBinding) : GameViewHolder(binding.root) {
init {
gameDownloadBtn = binding.downloadBtn
gameProgressbar = binding.gameProgressbar
gameInfo = binding.gameInfo
gameDownloadPercentage = binding.downloadPercentage
gameDes = binding.gameDes
gameDownloadSpeed = binding.downloadSpeed
gameRating = binding.gameRating
recommendContainer = binding.recommendContainer
recommendIv = binding.recommendIv
}
fun bindGameItem(gameEntity: GameEntity) {
binding.run {
root.background = R.drawable.reuse_listview_item_style.toDrawable(root.context)
gameKaifuType.setBackgroundColor(R.color.theme.toColor(root.context))
gameName.setTextColor(R.color.text_title.toColor(root.context))
gameDes.setTextColor(R.color.text_subtitleDesc.toColor(root.context))
downloadSpeed.setTextColor(R.color.text_subtitleDesc.toColor(root.context))
downloadPercentage.setTextColor(R.color.theme_font.toColor(root.context))
gameIconView.displayGameIcon(gameEntity)
BindingAdapters.setGameName(gameName, gameEntity, false, null)
BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10)
gameRating.setCompoundDrawablesWithIntrinsicBounds(
if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null,
null,
null,
null
)
gameRating.text = if (gameEntity.commentCount > 3) {
if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString()
} else {
""
}
gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0)
gameRating.setTextColor(
if (gameEntity.commentCount > 3) {
R.color.theme_font.toColor(binding.root.context)
} else {
R.color.theme.toColor(binding.root.context)
}
)
gameDes.visibleIf(gameEntity.recommendTag.isNotEmpty()) {
gameDes.text = "根据 “${gameEntity.recommendTag}” 兴趣推荐"
}
//type: recommend 专题游戏 | ad 广告游戏 | filter 算法游戏
adLabelTv.goneIf(!(gameEntity.type == "ad" && gameEntity.adIconActive))
if (gameEntity.type == "ad" && gameEntity.adIconActive) {
recommendReasonTv.visibility = View.GONE
} else {
recommendReasonTv.visibility = View.GONE
if (gameEntity.columnRank != null) {
recommendReasonTv.text =
"${gameEntity.columnRank!!.name}·第${gameEntity.columnRank!!.position}"
recommendReasonTv.setTextColor(R.color.theme_yellow.toColor(binding.root.context))
recommendReasonTv.setCompoundDrawablesWithIntrinsicBounds(
R.drawable.ic_discovery_rank.toDrawable(binding.root.context),
null,
null,
null
)
recommendReasonTv.background =
R.drawable.bg_discovery_recommend.toDrawable(binding.root.context)
recommendReasonTv.visibility = View.VISIBLE
} else if (gameEntity.type == "recommend") {
recommendReasonTv.text = "其他玩家推荐"
recommendReasonTv.setTextColor(R.color.theme_font.toColor(binding.root.context))
recommendReasonTv.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null)
recommendReasonTv.background = R.drawable.bg_discovery_rank.toDrawable(binding.root.context)
recommendReasonTv.visibility = View.VISIBLE
}
}
initGameSubtitle(gameEntity, gameSubtitleTv, gameDesSpace)
}
}
private fun initGameSubtitle(
entity: GameEntity,
gameSubtitleTv: TextView,
gameDesSpace: Space,
) {
gameSubtitleTv.visibility = View.GONE
if ((entity.serverLabel == null && entity.subtitle.isNotEmpty() && !entity.advanceDownload) || (entity.subtitle.isNotEmpty())) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = entity.subtitle
if (entity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${entity.subtitleStyle?.color}"))
background = GradientDrawable().apply {
cornerRadius = 2F.dip2px().toFloat()
if (entity.subtitleStyle?.style == "border") {
setColor(Color.TRANSPARENT)
setStroke(0.5F.dip2px(), Color.parseColor("#${entity.subtitleStyle?.background}"))
} else {
shape = GradientDrawable.RECTANGLE
setColor(Color.parseColor("#${entity.subtitleStyle?.background}"))
}
}
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (entity.advanceDownload) {
gameSubtitleTv.apply {
visibility = View.VISIBLE
text = "预下载"
setTextColor(R.color.text_subtitle.toColor(context))
background = R.drawable.bg_advance_download_game_subtitle.toDrawable(context)
}
}
}
}
class RecommendInterestViewHolder(val binding: ItemRecommendInterestBinding) :
BaseRecyclerViewHolder<Any>(binding.root)
class RecommendInterestImageViewHolder(val binding: ItemRecommendInterestImageBinding) :
BaseRecyclerViewHolder<Any>(binding.root)
class DirectGameBlockViewHolder(val binding: ItemRecommendInterestFooterBinding) :
BaseRecyclerViewHolder<Any>(binding.root)
companion object {
const val ITEM_RECOMMEND_INTEREST = 200
const val ITEM_RECOMMEND_INTEREST_IMAGE = 201
const val ITEM_DIRECT_GAME_BLOCK = 202
}
}

View File

@ -0,0 +1,263 @@
package com.gh.gamecenter.discovery
import android.view.LayoutInflater
import android.widget.FrameLayout
import android.widget.RelativeLayout
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
import com.ethanhua.skeleton.Skeleton
import com.gh.common.exposure.ExposureListener
import com.gh.common.exposure.ExposureSource
import com.gh.common.util.DialogUtils
import com.gh.common.util.NewFlatLogUtils
import com.gh.common.xapk.XapkInstaller
import com.gh.common.xapk.XapkUnzipStatus
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.baselist.LazyListFragment
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.getBitmapFromView
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.databinding.LayoutDiscoveryGuideBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.*
import kotlin.concurrent.fixedRateTimer
class DiscoveryFragment : LazyListFragment<DiscoveryItemData, DiscoveryViewModel>() {
private var mAdapter: DiscoveryAdapter? = null
private var mDiscoveryVisibleTimer: Timer? = null
private var mDiscoveryQuitTimer: Timer? = null
//页面顶部露出次数
private var mPageTopVisibleCount = 0
//页面底部露出次数
private var mPageBottomVisibleCount = 0
private lateinit var mExposureListener: ExposureListener
private val dataWatcher = object : DataWatcher() {
override fun onDataChanged(downloadEntity: DownloadEntity) {
mAdapter?.notifyItemByDownload(downloadEntity)
if (downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS] == XapkUnzipStatus.FAILURE.name) {
showUnzipFailureDialog(downloadEntity)
}
}
override fun onDataInit(downloadEntity: DownloadEntity) {
mAdapter?.notifyItemByDownload(downloadEntity)
}
}
override fun initRealView() {
super.initRealView()
mCachedView.setBackgroundColor(R.color.background_white.toColor(requireContext()))
}
override fun initSkeletonScreen() {
if (mSkeletonScreenView == null) return
mSkeletonScreen = Skeleton.bind(mSkeletonScreenView)
.shimmer(true)
.angle(Constants.SHIMMER_ANGLE)
.color(R.color.skeleton_shimmer_color)
.duration(Constants.SHIMMER_DURATION)
.maskWidth(Constants.MASK_WIDTH)
.gradientCenterColorWidth(Constants.GRADIENT_CENTER_COLOR_WIDTH)
.apply {
load(R.layout.fragment_discovery_skeleton)
}
.show()
}
override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible()
if (mAdapter != null) {
mExposureListener = ExposureListener(this, mAdapter!!)
mListRv?.addOnScrollListener(mExposureListener)
mListRv?.addOnScrollListener(object : OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
val layoutManager = mListRv?.layoutManager as? LinearLayoutManager ?: return
val firstVisibleItemPosition = layoutManager.findFirstCompletelyVisibleItemPosition()
val lastVisibleItemPosition = layoutManager.findLastCompletelyVisibleItemPosition()
if (firstVisibleItemPosition == 0) {
mPageTopVisibleCount++
NewFlatLogUtils.logDiscoverPageTopVisible(mPageTopVisibleCount)
}
if (lastVisibleItemPosition == (mAdapter?.itemCount ?: 0) - 1) {
mPageBottomVisibleCount++
NewFlatLogUtils.logDiscoverPageBottomStay(mPageBottomVisibleCount)
}
}
}
})
}
mDiscoveryVisibleTimer =
fixedRateTimer(
"Discovery-Visible-Rate-Timer",
initialDelay = mDiscoveryVisibleDuration,
period = mDiscoveryVisibleDuration
) {
NewFlatLogUtils.logDiscoverPageVisible()
}
mDiscoveryQuitTimer =
fixedRateTimer(
"Discovery-Quit-Rate-Timer",
initialDelay = mDiscoveryQuitDuration,
period = mDiscoveryQuitDuration
) {
val lastVisiblePosition =
(mListRv?.layoutManager as? LinearLayoutManager)?.findLastCompletelyVisibleItemPosition() ?: 0
NewFlatLogUtils.logDiscoverPageQuit(lastVisiblePosition)
mDiscoveryQuitTimer?.cancel()
mDiscoveryQuitTimer = null
}
NewFlatLogUtils.logDiscoverPageEnter()
}
override fun provideListAdapter(): ListAdapter<*> {
val basicExposureSource = arrayListOf<ExposureSource>().apply {
arguments?.getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let { add(it) }
}
val outerSequence = requireArguments().getInt(EntranceConsts.KEY_POSITION, -1)
return mAdapter ?: DiscoveryAdapter(
requireContext(),
mListViewModel,
basicExposureSource,
outerSequence,
"发现页"
).also { mAdapter = it }
}
override fun onFragmentResume() {
super.onFragmentResume()
DownloadManager.getInstance().addObserver(dataWatcher)
}
override fun onFragmentPause() {
super.onFragmentPause()
DownloadManager.getInstance().removeObserver(dataWatcher)
val lastVisiblePosition =
(mListRv?.layoutManager as? LinearLayoutManager)?.findLastCompletelyVisibleItemPosition() ?: 0
NewFlatLogUtils.logDiscoverPageInvisible(lastVisiblePosition)
}
override fun onStop() {
super.onStop()
val lastVisiblePosition =
(mListRv?.layoutManager as? LinearLayoutManager)?.findLastCompletelyVisibleItemPosition() ?: 0
NewFlatLogUtils.logDiscoverPageQuit(lastVisiblePosition)
if (mDiscoveryVisibleTimer != null) {
mDiscoveryVisibleTimer?.cancel()
mDiscoveryVisibleTimer = null
}
if (mDiscoveryQuitTimer != null) {
mDiscoveryQuitTimer?.cancel()
mDiscoveryQuitTimer = null
}
}
override fun getItemDecoration(): RecyclerView.ItemDecoration? = null
private fun showUnzipFailureDialog(downloadEntity: DownloadEntity) {
val data = mListViewModel.positionAndPackageMap
for (gameAndPosition in data) {
if (gameAndPosition.key.contains(downloadEntity.packageName)) {
val targetView = mLayoutManager.findViewByPosition(gameAndPosition.value)
if (targetView != null) {
DialogUtils.showUnzipFailureDialog(requireContext(), downloadEntity)
return
}
}
}
}
override fun onChanged(ts: MutableList<DiscoveryItemData>?) {
super.onChanged(ts)
val isFirstGuide = SPUtils.getBoolean(Constants.SP_DISCOVERY_GUIDE, true)
if (!isFirstGuide) return
AppExecutor.uiExecutor.executeWithDelay({
showGuideView()
SPUtils.setBoolean(Constants.SP_DISCOVERY_GUIDE, false)
}, 800)
}
private fun showGuideView() {
if (!isSupportVisible) return
val firstView = mListRv?.layoutManager?.findViewByPosition(0)
if (firstView != null && requireActivity() is AppCompatActivity) {
val location = IntArray(2)
firstView.getLocationInWindow(location)
val decorView = requireActivity().window.decorView as? FrameLayout
val guideViewBinding =
LayoutDiscoveryGuideBinding.inflate(LayoutInflater.from(requireContext()), decorView, true)
val originalBackground = firstView.background
val newColor =
if (mIsDarkModeOn) R.color.black.toColor(requireContext()) else R.color.white.toColor(requireContext())
firstView.setBackgroundColor(newColor)
guideViewBinding.guideImageContainer.setCardBackgroundColor(newColor)
val snapshotBitmap = firstView.getBitmapFromView(
firstView.width - 16F.dip2px(),
firstView.height,
-8F.dip2px().toFloat(),
0F
)
firstView.background = originalBackground
guideViewBinding.guideImage.setImageBitmap(snapshotBitmap)
(guideViewBinding.guideImageContainer.layoutParams as RelativeLayout.LayoutParams).run {
topMargin = location[1]
guideViewBinding.guideImageContainer.layoutParams = this
}
guideViewBinding.root.setOnClickListener {
decorView?.removeView(it)
}
}
}
override fun onDarkModeChanged() {
super.onDarkModeChanged()
mListRv?.recycledViewPool?.clear()
mAdapter?.notifyItemRangeChanged(0, mAdapter?.itemCount ?: 0)
mCachedView?.setBackgroundColor(R.color.background_white.toColor(requireContext()))
}
override fun isAutomaticLoad(): Boolean = false
// 下载被删除事件
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(status: EBDownloadStatus) {
if ("delete" == status.status) {
mAdapter?.notifyItemAndRemoveDownload(status)
}
}
// 安装/卸载 事件
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(busFour: EBPackage) {
if ("安装" == busFour.type || "卸载" == busFour.type) {
mAdapter?.notifyDataSetChanged()
}
}
companion object {
private const val mDiscoveryVisibleDuration = 5 * 1000L
private const val mDiscoveryQuitDuration = 60 * 60 * 1000L
}
}

View File

@ -0,0 +1,14 @@
package com.gh.gamecenter.discovery
import androidx.annotation.Keep
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
import com.gh.gamecenter.entity.GameEntity
@Keep
data class DiscoveryItemData(
val gameEntity: GameEntity? = null,
val interestCardLabels: ArrayList<DiscoveryGameCardLabel>? = null,
val interestImageCardLabel: DiscoveryGameCardLabel? = null,
//兴趣推荐卡片序号,埋点用
var cardPosition: Int? = null
)

View File

@ -0,0 +1,211 @@
package com.gh.gamecenter.discovery
import android.annotation.SuppressLint
import android.app.Application
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.baselist.ListViewModel
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.baselist.LoadType
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.observableToMain
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.utils.toRequestBody
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import io.reactivex.Observable
import okhttp3.ResponseBody
import retrofit2.HttpException
class DiscoveryViewModel(application: Application) : ListViewModel<GameEntity, DiscoveryItemData>(application) {
val positionAndPackageMap = HashMap<String, Int>()
var forceRefresh = true
private val mApi = RetrofitManager.getInstance().api
private var mGameTags: ArrayList<LinkEntity>? = null
private var mDiscoveryGameCardLabels: ArrayList<DiscoveryGameCardLabel>? = null
private var mDiscoveryGameCardLabelMap: LinkedHashMap<String, ArrayList<DiscoveryGameCardLabel>> = linkedMapOf()
init {
getCardLabels()
}
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData) {
mergeResultItemData(it)
}
}
private fun mergeResultItemData(games: MutableList<GameEntity>) {
val itemDataList = arrayListOf<DiscoveryItemData>()
var insertCount = 0
var i = 0
while (i < games.size) {
val gameEntity = games[i]
//删除已安装的游戏
if (gameEntity.getApk().isNotEmpty() && PackageUtils.isInstalled(
HaloApp.getInstance().application,
gameEntity.getApk()[0].packageName
)
) {
games.removeAt(i)
i--
}
i++
}
games.forEachIndexed { index, gameEntity ->
itemDataList.add(DiscoveryItemData(gameEntity))
//第6、12、18、24个游戏后面固定插入兴趣推荐卡片
when (index) {
5 -> {
itemDataList.add(
DiscoveryItemData(
cardPosition = 1,
interestCardLabels = mDiscoveryGameCardLabelMap["卡片一"]
)
)
insertCount++
}
11 -> {
itemDataList.add(
DiscoveryItemData(
cardPosition = 2,
interestImageCardLabel = mDiscoveryGameCardLabelMap["卡片二"]?.get(0)
)
)
insertCount++
}
17 -> {
itemDataList.add(
DiscoveryItemData(
cardPosition = 3,
interestCardLabels = mDiscoveryGameCardLabelMap["卡片三"]
)
)
insertCount++
}
23 -> {
itemDataList.add(
DiscoveryItemData(
cardPosition = 4,
interestCardLabels = mDiscoveryGameCardLabelMap["卡片四"]
)
)
insertCount++
}
else -> {
//do nothing
}
}
addGamePositionAndPackage(index + insertCount, gameEntity)
}
mResultLiveData.postValue(itemDataList)
}
override fun provideDataObservable(page: Int): Observable<MutableList<GameEntity>>? {
val paramsMap = if (forceRefresh) {
mapOf("refresh" to "true")
} else {
mapOf()
}
return mApi.getDiscoveryGames(page, paramsMap).map {
forceRefresh = false
if (page == 1) {
mGameTags = it.gameTags
groupingDiscoveryLabel()
}
it.games
}
}
//按照card字段分组
private fun groupingDiscoveryLabel() {
mDiscoveryGameCardLabelMap.clear()
var tagIndex = 0
mDiscoveryGameCardLabels?.forEach {
if (mDiscoveryGameCardLabelMap.contains(it.card)) {
mDiscoveryGameCardLabelMap[it.card]?.add(it)
} else {
mDiscoveryGameCardLabelMap[it.card] = arrayListOf(it)
}
}
//如果link_type为空需要在mGameTags中依次获取
mDiscoveryGameCardLabelMap.keys.forEach {
val labels = mDiscoveryGameCardLabelMap[it]
labels?.forEach { label ->
if (!mGameTags.isNullOrEmpty() && mGameTags!!.size > tagIndex && label.type.isNullOrEmpty()) {
val gameTag = mGameTags!![tagIndex]
label.link = gameTag.link
label.type = gameTag.type
label.linkText = gameTag.linkText
label.title = gameTag.linkText
tagIndex++
}
}
}
}
private fun getCardLabels() {
mApi.cardLabels
.compose(observableToMain())
.subscribe(object : Response<ArrayList<DiscoveryGameCardLabel>>() {
override fun onResponse(response: ArrayList<DiscoveryGameCardLabel>?) {
super.onResponse(response)
mDiscoveryGameCardLabels = response
initLoadParams()
loadData()
}
override fun onFailure(e: HttpException?) {
super.onFailure(e)
mLoadStatusLiveData.value = LoadStatus.INIT_FAILED
}
})
}
@SuppressLint("CheckResult")
fun discoveryFeedback(gameId: String, reason: String, type: String, callback: () -> Unit) {
val paramsMap = mapOf(
"reason" to reason,
"type" to type
)
mApi.discorveryFeedback(gameId, paramsMap.toRequestBody())
.compose(singleToMain())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
callback.invoke()
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
ToastUtils.showToast("反馈失败")
}
})
}
private fun addGamePositionAndPackage(position: Int, game: GameEntity) {
var packages = ""
for (apkEntity in game.getApk()) {
packages += apkEntity.packageName
}
positionAndPackageMap[packages + (position)] = position
game.gameLocation = GameEntity.GameLocation.INDEX
game.setEntryMap(DownloadManager.getInstance().getEntryMap(game.name))
}
override fun load(loadType: LoadType?) {
if (loadType == LoadType.REFRESH) {
getCardLabels()
} else {
super.load(loadType)
}
}
}

View File

@ -32,6 +32,10 @@ data class AmwayCommentEntity(
@SerializedName("new_star")
var star: Float,
var subtitle: String? = "",
@SerializedName("subtitle_style")
var subtitleStyle: TagStyleEntity? = null,
// 曝光用的位置
var sequence: Int = 0,
var outerSequence: Int = 0
@ -50,6 +54,9 @@ data class AmwayCommentEntity(
gameEntity.iconSubscript = iconSubscript
gameEntity.platform = ""
gameEntity.subtitle = subtitle ?: ""
gameEntity.subtitleStyle = subtitleStyle
gameEntity.sequence = sequence
gameEntity.outerSequence = outerSequence
return gameEntity

View File

@ -0,0 +1,14 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.LinkEntity
import com.google.gson.annotations.SerializedName
data class DiscoveryGameCardEntity(
val more: Int,
@SerializedName("game_tags")
val gameTags: ArrayList<LinkEntity> = arrayListOf(),
@SerializedName("data")
val games: ArrayList<GameEntity> = arrayListOf()
)

View File

@ -0,0 +1,11 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.LinkEntity
import com.google.gson.annotations.SerializedName
data class DiscoveryGameCardLabel(
@SerializedName("_id")
val id: String = "",
val card: String = "",
val order: Int = 0,
) : LinkEntity()

View File

@ -20,7 +20,6 @@ import com.lightgame.download.DownloadEntity
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import java.util.*
import kotlin.collections.ArrayList
@Parcelize
data class GameEntity(
@ -291,6 +290,13 @@ data class GameEntity(
var welcomeDialogId: String? = null,
var welcomeDialogTitle: String? = null,
@SerializedName("column_rank")
var columnRank: ColumnRank? = null,//榜单详情
@SerializedName("ad_icon_active")
var adIconActive: Boolean = false,// 游戏广告 true显示false隐藏。只有当type=ad时才会返回该字段
@SerializedName("recommend_tag")
var recommendTag: String = "",
// 专题id用于曝光使用
var subjectId: String? = null,
// 专题名字,用于曝光使用
@ -836,6 +842,12 @@ data class GameEntity(
var url: String = ""
) : Parcelable
}
@Parcelize
data class ColumnRank(
val name: String = "",
val position: Int = 0
) : Parcelable
}
@Parcelize
@ -864,7 +876,11 @@ data class SimpleGame(
@SerializedName("recommend_text")
var recommendText: String = "",
@SerializedName("download_status")
var downloadStatus: String = ""
var downloadStatus: String = "",
var subtitle: String? = "",
@SerializedName("subtitle_style")
var subtitleStyle: TagStyleEntity? = null,
) : Parcelable {
@IgnoredOnParcel
@ -890,6 +906,8 @@ data class SimpleGame(
gameEntity.recommendStar = recommendStar
gameEntity.recommendText = recommendText
gameEntity.downloadStatus = downloadStatus
gameEntity.subtitle = subtitle ?: ""
gameEntity.subtitleStyle = subtitleStyle
return gameEntity
}

View File

@ -16,6 +16,9 @@ data class HistoryGameEntity(
var tag: ArrayList<String>? = null,
var isLibaoExist: Boolean = false,
var subtitle: String = "",
var subtitleStyle: TagStyleEntity? = null,
@SerializedName("tag_style")
var tagStyle: ArrayList<TagStyleEntity> = ArrayList(),
@ -31,6 +34,8 @@ data class HistoryGameEntity(
gameEntity.des = des
gameEntity.rawIcon = icon
gameEntity.iconSubscript = iconSubscript
gameEntity.subtitle = subtitle
gameEntity.subtitleStyle = subtitleStyle
gameEntity.name = name
gameEntity.tagStyle = tagStyle
gameEntity.isLibaoExists = isLibaoExist

View File

@ -0,0 +1,21 @@
package com.gh.gamecenter.entity
import com.google.gson.annotations.SerializedName
data class NewApiSettingsEntity(
@SerializedName("night_mode")
var nightMode: NightMode? = null,
var simulator: SimulatorEntity? = null,
) {
/**
*
* "icon": false, // 是否显示切换true显示
* "setting": false, // 设置页面是否显示true显示
* "install": false, // 安装时的默认值true开启
*/
data class NightMode(
val icon: Boolean,
val setting: Boolean,
val install: Boolean
)
}

View File

@ -5,9 +5,6 @@ import com.google.gson.annotations.SerializedName
data class NewSettingsEntity(
@SerializedName("install_model")
var installModel: InstallModel? = null,
@SerializedName("night_mode")
var nightMode: NightMode? = null,
var simulator: SimulatorEntity? = null
) {
data class InstallModel(
var status: String = "",
@ -15,16 +12,4 @@ data class NewSettingsEntity(
@SerializedName("white_list")
var whiteList: ArrayList<String>? = arrayListOf()
)
/**
*
* "icon": false, // 是否显示切换true显示
* "setting": false, // 设置页面是否显示true显示
* "install": false, // 安装时的默认值true开启
*/
data class NightMode(
val icon: Boolean,
val setting: Boolean,
val install: Boolean
)
}

View File

@ -28,13 +28,13 @@ data class PrivacyPolicyEntity(
intro = "用于下载游戏,以及实现内容缓存提升浏览体验"
)
)
permissions.add(
PermissionsEntity(
icon = "res:///" + R.drawable.permission_phone_state,
name = "设备信息",
intro = "为保障您的账号安全及使用软件与服务可安全运行"
)
)
// permissions.add(
// PermissionsEntity(
// icon = "res:///" + R.drawable.permission_phone_state,
// name = "设备信息",
// intro = "为保障您的账号安全及使用软件与服务可安全运行"
// )
// )
// permissions.add(PermissionsEntity(
// icon = "res:///" + R.drawable.permission_sdk,
// name = "第三方SDK使用信息提醒",

View File

@ -722,7 +722,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
val entrance = if (mForumDetail?.type == "game_bbs") "游戏论坛详情页" else "综合论坛详情页"
NewLogUtils.logBbsPostPanelClick(entrance, mBbsId, mBbsType)
contentView.findViewById<View>(R.id.community_edit_article_container).setOnClickListener {
context?.ifLogin("论坛详情", action = {
context?.ifLogin("论坛详情-发布-发帖子", action = {
checkStoragePermissionBeforeAction {
MtaHelper.onEvent("论坛详情", "发布", "发帖子")
NewLogUtils.logArticleEditEnter(entrance, mBbsId, mBbsType)
@ -745,7 +745,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
})
}
contentView.findViewById<View>(R.id.community_edit_question_container).setOnClickListener {
context?.ifLogin("论坛详情", action = {
context?.ifLogin("论坛详情-发布-提问", action = {
checkStoragePermissionBeforeAction {
MtaHelper.onEvent("论坛详情", "发布", "提问")
NewLogUtils.logQuestionEditEnter(entrance, mBbsId, mBbsType)
@ -768,7 +768,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
})
}
contentView.findViewById<View>(R.id.community_edit_video_container).setOnClickListener {
context?.ifLogin("论坛详情", action = {
context?.ifLogin("论坛详情-发布-视频", action = {
checkStoragePermissionBeforeAction {
MtaHelper.onEvent("论坛详情", "发布", "发视频")
NewLogUtils.logPublishVideoEnter(entrance, mBbsId, mBbsType)

View File

@ -404,7 +404,7 @@ class CommunityHomeFragment : LazyFragment() {
dialog.show()
NewLogUtils.logBbsPostPanelClick("推荐信息流", "", "")
contentView.findViewById<View>(R.id.community_edit_article_container).setOnClickListener {
context?.ifLogin("论坛首页", action = {
context?.ifLogin("论坛首页-发布-发帖子", action = {
checkStoragePermissionBeforeAction {
showRegulationTestDialogIfNeeded {
MtaHelper.onEvent("论坛首页", "发布", "发帖子")
@ -419,7 +419,7 @@ class CommunityHomeFragment : LazyFragment() {
})
}
contentView.findViewById<View>(R.id.community_edit_question_container).setOnClickListener {
context?.ifLogin("论坛首页", action = {
context?.ifLogin("论坛首页-发布-提问", action = {
checkStoragePermissionBeforeAction {
showRegulationTestDialogIfNeeded {
MtaHelper.onEvent("论坛首页", "发布", "提问")
@ -431,7 +431,7 @@ class CommunityHomeFragment : LazyFragment() {
})
}
contentView.findViewById<View>(R.id.community_edit_video_container).setOnClickListener {
context?.ifLogin("论坛首页", action = {
context?.ifLogin("论坛首页-发布-视频", action = {
checkStoragePermissionBeforeAction {
showRegulationTestDialogIfNeeded {
MtaHelper.onEvent("论坛首页", "发布", "发视频")

View File

@ -345,7 +345,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) :
}
inviteAnswer.setOnClickListener {
CheckLoginUtils.checkLogin(itemView.context, entrance) {
CheckLoginUtils.checkLogin(itemView.context, "${entrance}-点赞") {
val questionsDetailEntity = QuestionsDetailEntity(
id = entity.id,
title = entity.questions.title,

View File

@ -25,6 +25,7 @@ import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.FragmentMainHomeWrapperBinding
import com.gh.gamecenter.databinding.TabItemMainBinding
import com.gh.gamecenter.discovery.DiscoveryFragment
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.game.GameFragment
@ -486,6 +487,10 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
putString(EntranceConsts.KEY_COLLECTION_ID, tab.link)
putString(EntranceConsts.KEY_COLUMNNAME, tab.text)
})
"explore_column" -> DiscoveryFragment().with(Bundle().apply {
putString(EntranceConsts.KEY_ENTRANCE, "首页")
putInt(EntranceConsts.KEY_POSITION, index)
})
"bbs" -> Fragment()
else -> Fragment()
}

View File

@ -36,6 +36,7 @@ import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.FixGridLayoutManager
import com.gh.gamecenter.common.view.GridSpacingItemDecoration
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.MtaHelper
@ -65,13 +66,13 @@ import com.gh.gamecenter.game.vertical.GameVerticalAdapter
import com.gh.gamecenter.game.vertical.GameVerticalSlideViewHolder
import com.gh.gamecenter.game.vertical.OnPagerSnapScrollListener
import com.gh.gamecenter.home.BlankDividerViewHolder
import com.gh.gamecenter.home.HomeDividerViewHolder
import com.gh.gamecenter.home.HomeGameItemViewHolder
import com.gh.gamecenter.home.gamecollection.HomeGameCollectionViewHolder
import com.gh.gamecenter.servers.GameServersActivity
import com.gh.gamecenter.subject.SubjectActivity
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.download.DownloadEntity
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.home.HomeGameItemViewHolder
class GameFragmentAdapter(
context: Context,
@ -128,6 +129,7 @@ class GameFragmentAdapter(
if (itemData.doubleCardColumn != null) return ItemViewType.DOUBLE_CARD_COLUMN
if (itemData.bigImageRecommend != null) return ItemViewType.BIG_IMAGE_RECOMMEND
if (itemData.attachGame != null) return ItemViewType.GAME_ITEM
if (itemData.lineDivider != null) return ItemViewType.DIVIDER_ITEM
return ItemViewType.LOADING
}
@ -164,6 +166,7 @@ class GameFragmentAdapter(
ItemViewType.DOUBLE_CARD_COLUMN -> DoubleCardViewHolder(parent.toBinding())
ItemViewType.BIG_IMAGE_RECOMMEND -> BigImageRecommendViewHolder(parent.toBinding())
ItemViewType.GAME_ITEM -> HomeGameItemViewHolder(parent.toBinding())
ItemViewType.DIVIDER_ITEM -> HomeDividerViewHolder(parent.toBinding())
else -> GameItemViewHolder(GameItemBinding.bind(mLayoutInflater.inflate(R.layout.game_item, parent, false)))
}
@ -191,6 +194,7 @@ class GameFragmentAdapter(
is DoubleCardViewHolder -> bindGameDoubleCard(holder, position)
is BigImageRecommendViewHolder -> bindBigImageRecommend(holder, position)
is HomeGameItemViewHolder -> bindAttachGame(holder, position)
is HomeDividerViewHolder -> holder.bindView(mItemDataList[position].lineDivider ?: 1F)
}
}

View File

@ -2,6 +2,7 @@ package com.gh.gamecenter.game
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.text.TextUtils
import android.view.View
import android.widget.Space
import android.widget.TextView
@ -11,6 +12,7 @@ import com.gh.common.databind.BindingAdapters
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.maxWidthExcludeZero
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.DrawableView
@ -32,6 +34,7 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
) {
binding.run {
root.background = R.drawable.reuse_listview_item_style.toDrawable(root.context)
selectIv.setImageDrawable(DrawableView.getCheckSelectorDrawable(root.context))
gameKaifuType.setBackgroundColor(R.color.theme.toColor(root.context))
gameName.setTextColor(R.color.text_title.toColor(root.context))
gameDes.setTextColor(R.color.text_subtitleDesc.toColor(root.context))
@ -86,19 +89,17 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
}
@JvmStatic
fun initGameSubtitle(
entity: GameEntity,
gameSubtitleTv: TextView,
gameDesSpace: Space,
rootContainer: ConstraintLayout,
forceShowSubtitle: Boolean = false
) {
fun initGameSubtitle(entity: GameEntity,
gameSubtitleTv: TextView,
gameDesSpace: Space? = null,
rootContainer: ConstraintLayout? = null,
forceShowSubtitle: Boolean = false) {
gameSubtitleTv.visibility = View.GONE
if ((entity.serverLabel == null && entity.subtitle.isNotEmpty() && !entity.advanceDownload) || (forceShowSubtitle && entity.subtitle.isNotEmpty())) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = entity.subtitle
if (entity.subtitleStyle != null) {
if (entity.subtitleStyle != null && !TextUtils.isEmpty(entity.subtitleStyle?.color)) {
setTextColor(Color.parseColor("#${entity.subtitleStyle?.color}"))
background = GradientDrawable().apply {
cornerRadius = 2F.dip2px().toFloat()
@ -112,8 +113,9 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
}
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameDesSpace?.post {
// 模拟器上可能出现未提前 bindView 导致 gameDesSpace.width 为 0 的情况
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (entity.advanceDownload) {
@ -124,15 +126,12 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
background = R.drawable.bg_advance_download_game_subtitle.toDrawable(context)
}
}
ConstraintSet().apply {
clone(rootContainer)
connect(
R.id.game_name,
ConstraintSet.END,
if (entity.serverLabel != null && !entity.advanceDownload && !forceShowSubtitle) R.id.recent_played_tag else R.id.gameSubtitleTv,
ConstraintSet.START
)
}.applyTo(rootContainer)
rootContainer?.let {
ConstraintSet().apply {
clone(rootContainer)
connect(R.id.game_name, ConstraintSet.END, if (entity.serverLabel != null && !entity.advanceDownload && !forceShowSubtitle) R.id.recent_played_tag else R.id.gameSubtitleTv, ConstraintSet.START)
}.applyTo(rootContainer)
}
}
}

View File

@ -527,17 +527,15 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
GameSubstituteRepositoryHelper.replaceGames(data, mSubjectGameIdList, it, false)
}
}
val nextItem = if (index + 1 < mSubjectList.size) {
mSubjectList[index + 1]
} else {
mSubjectList[index]
}
val shouldShowDivider = nextItem.type == "game" || nextItem.type == "video"
val shouldShowDivider = subjectEntity.type == "game" || subjectEntity.type == "video"
// 若在顶端则不添加空白间距
if (!(!isTopItemShown && index == 0) && !shouldShowDivider) {
mItemDataListCache.add(getBlankSpacingItem())
}
if (shouldShowDivider) {
mItemDataListCache.add(GameItemData().apply { lineDivider = DEFAULT_DIVIDER })
}
if (!data.isNullOrEmpty() && !data[0].image.isNullOrEmpty() && subjectEntity.type != "column_collection") {
val itemDataImage = GameItemData()
@ -911,4 +909,8 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
return GameViewModel(mApplication, blockData) as T
}
}
companion object {
const val DEFAULT_DIVIDER = 1F
}
}

View File

@ -37,6 +37,8 @@ class CommonCollectionViewHolder(val binding: CommonCollectionListBinding) : Bas
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
var position = mLayoutManager.findLastCompletelyVisibleItemPosition()
if (position == -1) position = mLayoutManager.findLastVisibleItemPosition() - 1
if (position < 0) return
val linkEntity = mCollection?.commonCollectionList?.get(position)
NewLogUtils.logSlideCommonCollection(
mCollection?.id ?: "",

View File

@ -37,6 +37,8 @@ class GameItemData {
var blankDivider: Float? = null // 空白的空间补全item
var lineDivider: Float? = null
var offset: Int = 0
var exposureEvent: ExposureEvent? = null
var exposureEventList: ArrayList<ExposureEvent>? = null

View File

@ -13,6 +13,7 @@ import com.gh.common.util.DownloadItemUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.maxWidthExcludeZero
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.AsyncUi
@ -111,7 +112,7 @@ class GameVerticalAdapter(
}
}
mGameDesSpace.post {
gameSubtitleTv.maxWidth = mGameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(mGameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -149,7 +149,7 @@ open class GameCollectionDetailAdapter(
}
is CommentItemViewHolder -> {
bindComment(holder.binding, mEntityList[position].commentNormal!!) { deleteCommentEntity ->
bindComment(holder.binding, mEntityList[position].commentNormal!!, position) { deleteCommentEntity ->
val findEntity =
mEntityList.find { it.commentNormal != null && it.commentNormal?.id == deleteCommentEntity.id }
val index = mEntityList.indexOf(findEntity)
@ -193,6 +193,7 @@ open class GameCollectionDetailAdapter(
fun bindComment(
binding: ItemArticleDetailCommentBinding,
comment: CommentEntity,
position: Int,
deleteCallBack: ((comment: CommentEntity) -> Unit)? = null
) {
bindNormalComment(binding, comment, deleteCallBack)
@ -202,7 +203,7 @@ open class GameCollectionDetailAdapter(
updateSubComment(this, comment)
floorHintTv.visibility = View.GONE
bottomDivider.visibility = View.GONE
bottomDivider.goneIf(position == itemCount - 2)
root.setOnClickListener {
mContext.startActivity(
@ -638,7 +639,7 @@ open class GameCollectionDetailAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -592,32 +592,36 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
}
private fun subtractGameNameIfNeeded(textView: TextView, name: CharSequence, tagLayout: FrameLayout) {
if (!isAdded) return
textView.run {
if (lineCount > 2 || (layout != null && layout.getEllipsisCount(1) > 0)) {
val displayName = name.substring(0, name.length - 2) + ""
text = displayName
if (tagLayout.getChildAt(0) != null) {
val tagView = tagLayout.getChildAt(0)
tagView.layoutParams = (tagView.layoutParams as FrameLayout.LayoutParams).apply {
setMargins(if (lineCount == 1) 0 else 4F.dip2px(), 0, 0, 0)
try {
if (!isAdded) return
textView.run {
if (lineCount > 2 || (layout != null && layout.getEllipsisCount(1) > 0)) {
val displayName = name.substring(0, name.length - 2) + ""
text = displayName
if (tagLayout.getChildAt(0) != null) {
val tagView = tagLayout.getChildAt(0)
tagView.layoutParams = (tagView.layoutParams as FrameLayout.LayoutParams).apply {
setMargins(if (lineCount == 1) 0 else 4F.dip2px(), 0, 0, 0)
}
}
}
val tagBitmap = tagLayout.convertViewToBitmap()
text = SpannableStringBuilder("$displayName ").apply {
tagBitmap?.let {
setSpan(
CenterImageSpan(
context,
it
), displayName.length, displayName.length + 1, Spanned.SPAN_EXCLUSIVE_INCLUSIVE
)
val tagBitmap = tagLayout.convertViewToBitmap()
text = SpannableStringBuilder("$displayName ").apply {
tagBitmap?.let {
setSpan(
CenterImageSpan(
context,
it
), displayName.length, displayName.length + 1, Spanned.SPAN_EXCLUSIVE_INCLUSIVE
)
}
}
post {
subtractGameNameIfNeeded(this, displayName, tagLayout)
}
}
post {
subtractGameNameIfNeeded(this, displayName, tagLayout)
}
}
} catch (e: Exception) {
SentryHelper.onEvent("GAME_DETAIL_SUBTRACT_GAME_NAME_ERROR", "exception_digest", e.localizedMessage)
}
}

View File

@ -215,7 +215,8 @@ class RatingReplyActivity : ListActivity<RatingReplyEntity, RatingReplyViewModel
fun onViewClick(view: View) {
if (view.id == R.id.answer_comment_send_btn) {
ifLogin(mEntrance) {
val entrance = if (mReadyReplyData == null) "${mEntrance}-评论详情-评论" else "${mEntrance}-评论详情-回复"
ifLogin(entrance) {
showRegulationTestDialogIfNeeded {
val replyContent = mInputBinding.answerCommentEt.text.toString()
if (replyContent.isNotEmpty()) {

View File

@ -1,15 +1,9 @@
package com.gh.gamecenter.gamedetail.rating
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.TextPaint
import android.text.style.ClickableSpan
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -18,39 +12,37 @@ import android.widget.PopupWindow
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.common.exposure.ExposureEvent
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.IExposable
import com.gh.common.util.*
import com.gh.common.util.DialogUtils
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.common.view.CustomLinkMovementMethod
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.baselist.LoadType
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.common.view.SegmentedFilterView
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.MtaHelper
import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.core.utils.SpanBuilder
import com.gh.gamecenter.databinding.ItemArticleDetailCommentBinding
import com.gh.gamecenter.databinding.PieceArticleDetailCommentFilterBinding
import com.gh.gamecenter.databinding.RatingReplyHeadItemBinding
import com.gh.gamecenter.entity.PluginLocation
import com.gh.gamecenter.entity.RatingComment
import com.gh.gamecenter.entity.RatingReplyEntity
import com.gh.gamecenter.entity.UserEntity
import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity
import com.gh.gamecenter.login.user.UserManager
import com.lightgame.utils.Utils
import com.squareup.picasso.Picasso
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
class RatingReplyAdapter(
context: Context,
@ -196,7 +188,7 @@ class RatingReplyAdapter(
return@OnLongClickListener true
})
likeCountTv.setDebouncedClickListener {
likeCountTv.context.ifLogin(entrance) {
likeCountTv.context.ifLogin("${entrance}-评论详情-点赞") {
if (!commentData.me.isVoted) {
viewModel.voteComment {
likeCountTv.setCompoundDrawablesWithIntrinsicBounds(
@ -565,47 +557,6 @@ class RatingReplyAdapter(
}
}
@SuppressLint("CheckResult")
private fun RatingReplyItemBinding.setBadgeSpan(
user: UserEntity,
replyNameSpannable: SpannableStringBuilder,
startIndex: Int,
endIndex: Int
) {
Single.just(user.badge?.icon)
.map {
ImageUtils.picasso.load(Uri.parse(it)).priority(Picasso.Priority.HIGH).get()
}.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
val bitmapDrawable = BitmapDrawable(mContext.resources, it)
bitmapDrawable.setBounds(0, 0, 16F.dip2px(), 16F.dip2px())
replyNameSpannable.setSpan(
CenterImageSpan(bitmapDrawable),
startIndex,
endIndex,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
replyNameSpannable.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.isUnderlineText = false
}
override fun onClick(widget: View) {
MtaHelper.onEvent("进入徽章墙_用户记录", "游戏评论详情", "${user.name}${user.id}")
MtaHelper.onEvent("徽章中心", "进入徽章中心", "游戏评论详情")
DirectUtils.directToBadgeWall(mContext, user.id, user.name, user.icon)
}
}, startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
userName.movementMethod = CustomLinkMovementMethod.getInstance()
userName.text = replyNameSpannable
}, {
it.printStackTrace()
})
}
fun handleSyncData(requestCode: Int, intent: Intent?) {
SyncDataBetweenPageHelper.resultHandle(intent, object : OnSyncCallBack<RatingComment> {
override fun onData(dataPosition: Int): RatingComment? {

View File

@ -16,6 +16,7 @@ import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.GameItemBinding
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
@ -149,6 +150,11 @@ class HistoryGameListAdapter(context: Context, private val mViewModel: HistoryGa
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()

View File

@ -0,0 +1,17 @@
package com.gh.gamecenter.home
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.databinding.HomeDividerItemBinding
class HomeDividerViewHolder(var binding: HomeDividerItemBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bindView(height: Float) {
val lp = binding.container.layoutParams
lp.height = height.dip2px()
binding.container.layoutParams = lp
binding.divider.setBackgroundColor(R.color.divider.toColor(binding.root.context))
}
}

View File

@ -14,14 +14,15 @@ import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.AboutActivity
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder
import com.gh.gamecenter.common.baselist.DiffUtilAdapter
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.safelyGetInRelease
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.databinding.HomeDividerItemBinding
import com.gh.gamecenter.entity.AmwayCommentEntity
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
@ -474,16 +475,6 @@ class HomeFragmentAdapter(
return mDataList[pos].exposureEventList
}
class HomeDividerViewHolder(var binding: HomeDividerItemBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bindView(height: Float) {
val lp = binding.container.layoutParams
lp.height = height.dip2px()
binding.container.layoutParams = lp
binding.divider.setBackgroundColor(R.color.divider.toColor(binding.root.context))
}
}
companion object {
const val SLIDE_ITEM: Int = 100
const val RECOMMENDS_ITEM: Int = 101

View File

@ -15,7 +15,6 @@ import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.RandomUtils
import com.gh.gamecenter.databinding.HomeGameItemBinding
import com.gh.gamecenter.entity.SubjectEntity
@ -40,18 +39,15 @@ class HomeGameItemViewHolder(val binding: HomeGameItemBinding) : BaseRecyclerVie
val displayContent = subjectEntity.displayContent
game.displayContent = displayContent
var exposureEvent: ExposureEvent? = null
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
gameEntity = game.apply {
outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(ExposureSource("游戏", ""))
)
createExposureEventCallback.invoke(exposureEvent)
holder.bindGameInfo(subjectEntity, adapter, position, exposureEvent, entrance)
runOnIoThread(true) {
exposureEvent = ExposureEvent.createEventWithSourceConcat(
gameEntity = game,
basicSource = mBasicExposureSource,
source = listOf(ExposureSource("游戏", ""))
)
createExposureEventCallback.invoke(exposureEvent!!)
}
holder.binding.gameBrief.text = subjectEntity.recommendText
holder.binding.gameImage.visibleIf(!(displayContent == "video" && game.topVideo != null))
holder.binding.autoVideoView.goneIf(displayContent != "video" || game.topVideo == null) {

View File

@ -12,13 +12,16 @@ import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.AsyncCell
import com.gh.gamecenter.databinding.HomeAmwayItemBinding
import com.gh.gamecenter.entity.AmwayCommentEntity
import com.gh.gamecenter.game.GameItemViewHolder
import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity
import java.util.regex.Pattern
class HomeAmwayItemViewHolder(val binding: HomeAmwayItemBinding) : BaseRecyclerViewHolder<Any>(binding.root) {
fun bindAmway(amway: AmwayCommentEntity) {
binding.gameIcon.displayGameIcon(amway.game.toGameEntity())
val gameEntity = amway.game.toGameEntity()
binding.gameIcon.displayGameIcon(gameEntity)
binding.gameName.text = amway.game.name
binding.amwayScoreNumber.text = amway.game.star.toString()
BindingAdapters.setGameTags(binding.gameTags, amway.game.tag, 2)
@ -51,6 +54,7 @@ class HomeAmwayItemViewHolder(val binding: HomeAmwayItemBinding) : BaseRecyclerV
ratingName.setTextColor(R.color.text_subtitleDesc.toColor(root.context))
all.setTextColor(R.color.text_title.toColor(root.context))
}
GameItemViewHolder.initGameSubtitle(gameEntity, binding.gameSubtitleTv)
}
}

View File

@ -27,10 +27,12 @@ import com.gh.gamecenter.adapter.viewholder.NewsDigestViewHolder;
import com.gh.gamecenter.databinding.NewsDigestItemBinding;
import com.gh.gamecenter.entity.CommentnumEntity;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.entity.ViewsEntity;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.manager.CommentManager;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.manager.VisitManager;
@ -365,6 +367,9 @@ class ConcernAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.binding.newsDigestThumb.displayGameIcon(concernEntity.getGameIcon(), null);
}
viewHolder.binding.newsDigestTitle.setText(concernEntity.getGameName());
GameEntity gameEntity = concernEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, viewHolder.binding.gameSubtitleTv, null, null, false);
NewsUtils.setNewsPublishOn(viewHolder.binding.newsDigestTime, concernEntity.getTime());
if ("libao".equals(concernEntity.getType())) {

View File

@ -22,8 +22,10 @@ import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.databinding.LibaoItemBinding;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -238,6 +240,9 @@ class Libao2FragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
// LibaoUtils.setLiBaoBtnStatusRound(holder.libaoBtnStatus, libaoEntity, true, mContext);
}
GameEntity gameEntity = libaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, holder.binding.gameSubtitleTv, null, null, false);
}
private void initFooterViewHolder(FooterViewHolder holder) {

View File

@ -25,10 +25,12 @@ import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.LibaoNormalViewHolder;
import com.gh.gamecenter.databinding.LibaoItemBinding;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -261,6 +263,9 @@ class Libao3FragmentAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHolder>
holder.binding.libaoBtnStatus.setText("复制");
holder.binding.libaoBtnStatus.setBackgroundResource(R.drawable.button_normal_round_style);
GameEntity gameEntity = libaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, holder.binding.gameSubtitleTv, null, null, false);
} else if (viewHolder instanceof FooterViewHolder) {
initFooterViewHolder((FooterViewHolder) viewHolder);
}

View File

@ -20,10 +20,12 @@ import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.databinding.LibaoItemBinding;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.adapter.BaseRecyclerAdapter;
@ -168,6 +170,8 @@ public class LibaoHistoryAdapter extends BaseRecyclerAdapter<ViewHolder> {
LibaoUtils.setLiBaoBtnStatusRound(viewHolder.binding.libaoBtnStatus,
libaoEntity, true, mContext);
GameEntity gameEntity = libaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, viewHolder.binding.gameSubtitleTv, null, null, false);
} else {
FooterViewHolder viewHolder = (FooterViewHolder) holder;
viewHolder.initFooterViewHolder(isLoading, isNetworkError, isOver, v -> {

View File

@ -18,6 +18,7 @@ import com.gh.gamecenter.databinding.LibaoItemBinding
import com.gh.gamecenter.entity.LibaoEntity
import com.gh.gamecenter.entity.LibaoStatusEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.game.GameItemViewHolder
import com.gh.gamecenter.retrofit.RetrofitManager
import com.lightgame.adapter.BaseRecyclerAdapter
import io.reactivex.android.schedulers.AndroidSchedulers
@ -224,6 +225,10 @@ class LibaoNewAdapter(
}
}
}
libaoEntity.game?.toGameEntity()?.let {
GameItemViewHolder.initGameSubtitle(it, holder.binding.gameSubtitleTv)
}
}
fun getLibaoListSize(): Int {

View File

@ -44,7 +44,7 @@ import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity;
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity;
import com.gh.gamecenter.qa.comment.NewCommentDetailActivity;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.qa.follow.AskFollowMoreDialog;
import com.gh.gamecenter.qa.dialog.AskFollowMoreDialog;
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity;
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity;
import com.gh.gamecenter.retrofit.RetrofitManager;

View File

@ -126,7 +126,7 @@ class MyFollowedGameAdapter(context: Context, var mViewModel: MyFollowedGameView
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -127,7 +127,7 @@ class MyReservationAdapter(context: Context, var mViewModel: MyReservationViewMo
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -165,7 +165,7 @@ open class PlayedGameAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -115,7 +115,7 @@ class HaloPersonalFragment : BaseLazyFragment() {
mStubBinding.motionLayout -> {
if (mUserInfoEntity == null) {
NewFlatLogUtils.logHaloSelfLogin()
CheckLoginUtils.checkLogin(context, "我的光环-手机登录", null)
CheckLoginUtils.checkLogin(context, "我的光环-立即登录", null)
} else {
mStubBinding.ivArrow.performClick()
}
@ -123,7 +123,7 @@ class HaloPersonalFragment : BaseLazyFragment() {
mStubBinding.toolbarContainer -> {
if (mUserInfoEntity == null) {
NewFlatLogUtils.logHaloSelfLogin()
CheckLoginUtils.checkLogin(context, "我的光环-手机登录", null)
CheckLoginUtils.checkLogin(context, "我的光环-立即登录", null)
}
}
mStubBinding.darkModeIv -> {
@ -181,7 +181,7 @@ class HaloPersonalFragment : BaseLazyFragment() {
)
} else {
NewFlatLogUtils.logHaloSelfLogin()
CheckLoginUtils.checkLogin(context, "我的光环-手机登录", null)
CheckLoginUtils.checkLogin(context, "我的光环-立即登录", null)
}
}
mStubBinding.ivArrow -> {

View File

@ -52,53 +52,30 @@ class HaloPersonalRecommendAdapter(val context: Context) : BaseRecyclerAdapter<R
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is PersonalRecommendItemViewHolder && mEntityList.isNotEmpty()) {
val addonLinkEntity = mEntityList[position]
holder.binding.rightDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.topDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.leftDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.bottomDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.bottomDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.nameTv.setTextColor(R.color.text_title.toColor(mContext))
holder.binding.descTv.setTextColor(R.color.text_subtitleDesc.toColor(mContext))
when (position) {
0 -> {
holder.binding.rightDivider.visibility = View.VISIBLE
holder.binding.leftDivider.visibility = View.GONE
holder.binding.topDivider.visibility = View.GONE
if (itemCount > 2) {
holder.binding.bottomDivider.visibility = View.VISIBLE
holder.binding.bottomDivider.layoutParams =
(holder.binding.bottomDivider.layoutParams as ConstraintLayout.LayoutParams).apply {
setMargins(12F.dip2px(), 0, 0, 0)
}
}
}
1 -> {
holder.binding.rightDivider.visibility = View.GONE
holder.binding.leftDivider.visibility = View.VISIBLE
holder.binding.topDivider.visibility = View.GONE
if (itemCount > 2) {
holder.binding.bottomDivider.visibility = View.VISIBLE
holder.binding.bottomDivider.layoutParams =
(holder.binding.bottomDivider.layoutParams as ConstraintLayout.LayoutParams).apply {
setMargins(0, 0, 12F.dip2px(), 0)
}
}
}
2 -> {
holder.binding.rightDivider.visibility = View.VISIBLE
holder.binding.leftDivider.visibility = View.GONE
holder.binding.topDivider.visibility = View.VISIBLE
holder.binding.bottomDivider.visibility = View.GONE
holder.binding.topDivider.layoutParams =
(holder.binding.topDivider.layoutParams as ConstraintLayout.LayoutParams).apply {
setMargins(12F.dip2px(), 0, 0, 0)
}
}
3 -> {
holder.binding.rightDivider.visibility = View.GONE
holder.binding.leftDivider.visibility = View.VISIBLE
holder.binding.topDivider.visibility = View.VISIBLE
holder.binding.bottomDivider.visibility = View.GONE
holder.binding.topDivider.layoutParams =
(holder.binding.topDivider.layoutParams as ConstraintLayout.LayoutParams).apply {
setMargins(0, 0, 12F.dip2px(), 0)

View File

@ -37,6 +37,10 @@ class UserHistoryViewModel(
var videoList = arrayListOf<ForumVideoEntity>()
var count = MutableLiveData<Int>()
init {
setOverLimitSize(1)
}
override fun provideDataObservable(page: Int): Observable<MutableList<PersonalHistoryEntity>> {
getCount()
return mApi.getPersonalHistory(

View File

@ -102,7 +102,7 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
if (filterIllegalVoteStatus(entity.active)) return@setOnClickListener
debounceActionWithInterval(R.id.container_like, 1000) {
CheckLoginUtils.checkLogin(itemView.context, entrance) {
CheckLoginUtils.checkLogin(itemView.context, "${entrance}-点赞") {
if (!voteIcon.isChecked) voteAnswer(entity)
else cancelAnswerVote(entity)
}
@ -254,7 +254,7 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
if (filterIllegalVoteStatus(entity.active)) return@setOnClickListener
debounceActionWithInterval(R.id.container_like, 1000) {
CheckLoginUtils.checkLogin(itemView.context, entrance) {
CheckLoginUtils.checkLogin(itemView.context, "${entrance}-点赞") {
if (entrance == "社区+(推荐)" && position != null) {
entity.run {
NewLogUtils.logRecommendFeedContentClick(
@ -340,17 +340,24 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
RetrofitManager.getInstance()
.api.voteVideo(entity.id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
//Utils.toast(getApplication(), "已点赞")
entity.count.vote = entity.count.vote + 1
entity.me.isVoted = true
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
EnergyBridge.postEnergyTask("vote_video", entity.id)
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
entity.count.vote = entity.count.vote - 1
entity.me.isVoted = false
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
if (exception is HttpException) {
ErrorHelper.handleError(
itemView.context,
exception.response()?.errorBody()?.string()
)
}
setVoteAndCommentStyle(entity)
}
})
@ -375,6 +382,9 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
EnergyBridge.postEnergyTask("vote_answer", entity.id)
}
ToastUtils.showToast("已赞同")
entity.count.vote = entity.count.vote + 1
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
}
override fun onFailure(e: HttpException?) {
@ -383,69 +393,64 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
e?.response()?.errorBody()?.string(),
false
) {
if (403008 == it) {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
} else if (403036 == it) {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
} else if (404001 == it) {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
} else {
entity.count.vote = entity.count.vote - 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = true
} else {
entity.me.isAnswerVoted = true
when (it) {
403008 -> {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
}
403036 -> {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
}
404001 -> {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
}
else -> {
setVoteAndCommentStyle(entity)
false
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
false
}
}
}
})
}
entity.count.vote = entity.count.vote + 1
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
playVoteAnimation()
}
@SuppressLint("CheckResult")
fun cancelAnswerVote(entity: AnswerEntity) {
entity.count.vote = entity.count.vote - 1
voteIcon.isChecked = false
voteCount.setTextColor(R.color.text_subtitleDesc.toColor(voteCount.context))
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
if (entity.type == "video") {
RetrofitManager.getInstance()
.api.undoVoteVideo(entity.id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
entity.count.vote = entity.count.vote - 1
entity.me.isVoted = false
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
Utils.toast(itemView.context, "取消点赞")
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
entity.count.vote = entity.count.vote + 1
entity.me.isVoted = true
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
if (exception is HttpException) {
ErrorHelper.handleError(
itemView.context,
exception.response()?.errorBody()?.string()
)
}
setVoteAndCommentStyle(entity)
}
})
} else {
val unVoteObservable = if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = false
RetrofitManager.getInstance().api.postCommunityArticleUnVote(entity.id)
} else {
entity.me.isAnswerVoted = false
RetrofitManager.getInstance().api
.postAnswerUnvote(entity.id)
}
@ -454,6 +459,14 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<VoteEntity>() {
override fun onResponse(response: VoteEntity?) {
entity.count.vote = entity.count.vote - 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = false
} else {
entity.me.isAnswerVoted = false
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
Utils.toast(itemView.context, "取消赞同")
}
@ -463,27 +476,25 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
e?.response()?.errorBody()?.string(),
false
) {
if (403008 == it) {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
} else if (403036 == it) {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
} else if (404001 == it) {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
} else {
entity.count.vote = entity.count.vote + 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = true
} else {
entity.me.isAnswerVoted = true
when (it) {
403008 -> {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
}
403036 -> {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
}
404001 -> {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
}
else -> {
setVoteAndCommentStyle(entity)
false
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
false
}
}
}

View File

@ -326,6 +326,13 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
super.onResume()
mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
EventBus.getDefault().post(EBReuse(COMMENT_RESUME))
if (::commentEt.isInitialized && commentEt.text.isNotEmpty()) {
// 若不延迟,可能回来的时候不能获取焦点导致弹不起来
mBaseHandler.postDelayed({
Util_System_Keyboard.showSoftKeyboard(context, commentEt)
}, 200)
}
}
override fun onPause() {
@ -536,9 +543,9 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
CommentType.VIDEO,
CommentType.VIDEO_CONVERSATION -> {
if (mCommentEntity == null) {
"视频详情-评论-写评论"
if (this is StairsCommentFragment) "视频流详情-评论-写评论" else "视频详情-评论-写评论"
} else {
"视频详情-评论-回复"
if (this is StairsCommentFragment) "视频流详情-评论-回复" else "视频详情-评论-回复"
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.qa.follow
package com.gh.gamecenter.qa.dialog
import android.app.Activity
import android.content.Context
@ -9,10 +9,10 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.common.util.NewsUtils
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.databinding.DialogAskFollowMoreBinding
import com.gh.gamecenter.databinding.ItemAskFollowMoreBinding

View File

@ -12,7 +12,6 @@ import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.collection.AnswerFragment
import com.gh.gamecenter.databinding.AskAnswerItemBinding
import com.gh.gamecenter.qa.entity.AnswerEntity
import com.gh.gamecenter.qa.questions.detail.AnswerViewHolder
class AnswerAdapter(context: Context, private val mEntrance: String?) : ListAdapter<AnswerEntity>(context) {

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.qa.questions.detail;
package com.gh.gamecenter.qa.editor;
import android.content.Context;
import android.graphics.Paint;

View File

@ -1,117 +0,0 @@
//package com.gh.gamecenter.qa.editor
//
//import android.app.Activity
//import androidx.lifecycle.Observer
//import androidx.lifecycle.ViewModelProviders
//import android.content.Intent
//import android.os.Bundle
//import android.view.View
//import android.widget.EditText
//import android.widget.TextView
//import com.gh.gamecenter.common.base.fragment.BaseFragment
//import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
//import com.gh.gamecenter.R
//import com.gh.gamecenter.qa.entity.AnswerEntity
//import com.gh.gamecenter.qa.entity.ArticleEntity
//import com.gh.gamecenter.qa.questions.edit.manager.HistoryDetailActivity
//import com.lightgame.utils.Util_System_Keyboard
//import kotterknife.bindView
//
//class LinkFragment : BaseFragment<Any>() {
//
// val searchEt by bindView<EditText>(R.id.et_search)
// val searchTv by bindView<TextView>(R.id.tv_search)
// val backTv by bindView<TextView>(R.id.tv_back)
// val hint by bindView<TextView>(R.id.link_hint)
//
// private lateinit var mViewModel: LinkViewModel
// private var mProcessingDialog: WaitingDialogFragment? = null
//
// override fun getLayoutId(): Int {
// return R.layout.fragment_link
// }
//
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// mViewModel = ViewModelProviders.of(this).get(LinkViewModel::class.java)
// mViewModel.processDialog.observe(this, Observer { it ->
// if (it?.isShow!!) {
// mProcessingDialog = WaitingDialogFragment.newInstance(it.msg, false)
// mProcessingDialog?.show(childFragmentManager, HistoryDetailActivity::class.java.simpleName)
// } else {
// mProcessingDialog?.dismiss()
// }
// })
// mViewModel.articleLiveData.observe(this, Observer {
// val intent = Intent()
// intent.putExtra(ArticleEntity::class.java.simpleName, it)
// activity?.setResult(Activity.RESULT_OK, intent)
// activity?.finish()
// })
// mViewModel.answerLiveData.observe(this, Observer {
// val intent = Intent()
// intent.putExtra(AnswerEntity::class.java.simpleName, it)
// activity?.setResult(Activity.RESULT_OK, intent)
// activity?.finish()
// })
// }
//
// override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// super.onViewCreated(view, savedInstanceState)
// searchTv.text = "确定"
// if (activity is InsertAnswerWrapperActivity) {
// searchEt.hint = "请输入回答链接"
// hint.text = "获取回答链接的方式:(暂不支持外部链接)\n1.在回答详情页面,点击下方的\"分享\"按钮 \n2.在分享窗口内,再点击【复制链接】即可"
// } else {
// searchEt.hint = "请输入帖子链接"
// hint.text = "获取帖子链接的方式:(暂不支持外部链接)\n1.在帖子详情页面,点击下方的【分享】按钮 \n2.在分享窗口内,再点击【复制链接】即可"
// }
//
// searchTv.setOnClickListener {
// val link = searchEt.text.toString()
// if ((link.contains("articles") || link.contains("article")) && activity is InsertArticleWrapperActivity) {
// var communityId: String? = null
// var articleId: String? = null
// val splits = link.split("/")
// for (i in 0 until splits.size) {
// val split = splits[i]
// if (split.contains("articles") || split.contains("article")) {
// if (i > 0) {
// communityId = splits[i - 1]
// }
//
// if (splits.size - 1 > i) {
// articleId = splits[i + 1].split(".")[0]
// }
// }
// }
// if (communityId != null && articleId != null) {
// mViewModel.getArticleData(communityId, articleId)
// return@setOnClickListener
// }
// } else if (link.contains("answer") && activity is InsertAnswerWrapperActivity) {
// var answerId: String? = null
// var splits = link.split("=")
// if (splits.size > 1) answerId = splits[1]
// if (answerId.isNullOrEmpty()) {
// splits = link.split("/")
// answerId = splits[splits.size - 1]
// }
// if (!answerId.isNullOrEmpty()) {
// mViewModel.getAnswerData(answerId)
// return@setOnClickListener
// }
// }
// toast("链接格式不对,请检查并重新输入")
// }
// }
//
// fun onPageChanged(position: Int) {
// if (position == 0) {
// searchEt.requestFocus()
// Util_System_Keyboard.showSoftKeyboard(context, searchEt)
// } else {
// Util_System_Keyboard.hideSoftKeyboard(context, searchEt)
// }
// }
//}

View File

@ -1,64 +0,0 @@
//package com.gh.gamecenter.qa.editor
//
//import android.app.Application
//import androidx.lifecycle.AndroidViewModel
//import androidx.lifecycle.MediatorLiveData
//import androidx.lifecycle.MutableLiveData
//import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
//import com.gh.gamecenter.qa.entity.AnswerEntity
//import com.gh.gamecenter.qa.entity.ArticleEntity
//import com.gh.gamecenter.retrofit.Response
//import com.gh.gamecenter.retrofit.RetrofitManager
//import com.lightgame.utils.Utils
//import io.reactivex.android.schedulers.AndroidSchedulers
//import io.reactivex.schedulers.Schedulers
//import retrofit2.HttpException
//
//class LinkViewModel(application: Application) : AndroidViewModel(application) {
//
// private val mApi = RetrofitManager.getInstance().api
//
// val answerLiveData = MutableLiveData<AnswerEntity>()
// val articleLiveData = MutableLiveData<ArticleEntity>()
// val processDialog = MediatorLiveData<WaitingDialogFragment.WaitingDialogData>()
//
// fun getAnswerData(answerId: String) {
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", true))
// mApi
// .getCommunityArticle(answerId)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(object : Response<AnswerEntity>() {
// override fun onResponse(response: AnswerEntity?) {
// answerLiveData.postValue(response)
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", false))
// }
//
// override fun onFailure(e: HttpException?) {
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", false))
// Utils.toast(getApplication(), "插入链接失败,内容可能已被删除")
// }
// })
// }
//
// fun getArticleData(communityId: String, article: String) {
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", true))
// mApi
// .getCommunityArticle(communityId, article)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(object : Response<ArticleEntity>() {
// override fun onResponse(response: ArticleEntity?) {
// articleLiveData.postValue(response)
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", false))
// }
//
// override fun onFailure(e: HttpException?) {
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", false))
// Utils.toast(getApplication(), "插入链接失败,内容可能已被删除")
// }
// })
//
// }
//
//}

View File

@ -1,76 +0,0 @@
package com.gh.gamecenter.qa.editor
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.view.GridSpacingItemDecoration
import com.gh.gamecenter.common.baselist.ListFragment
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.databinding.FragmentLocalMediaBinding
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.video.upload.view.UploadVideoActivity
import com.gh.gamecenter.video.videomanager.VideoManagerActivity
import com.zhihu.matisse.Matisse
import com.zhihu.matisse.internal.utils.PathUtils
@Deprecated("v5.0.0废弃")
class OnlineVideoFragment : ListFragment<MyVideoEntity, OnlineVideoViewModel>() {
private lateinit var binding: FragmentLocalMediaBinding
private var mAdapter: VideoAdapter? = null
override fun getInflatedLayout(): View {
binding = FragmentLocalMediaBinding.inflate(LayoutInflater.from(requireContext()), null, false)
return binding.root
}
override fun provideListAdapter(): VideoAdapter {
if (mAdapter == null) {
mAdapter = VideoAdapter(requireContext(), mListViewModel)
}
return mAdapter!!
}
override fun getItemDecoration(): RecyclerView.ItemDecoration? {
return GridSpacingItemDecoration(3, 1f.dip2px(), false)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (VideoManagerActivity.REQUEST_CODE_SELECT_VIDEO == requestCode && data != null) {
val uris = Matisse.obtainResult(data)
if (uris.size > 0) {
val videoPath = PathUtils.getPath(requireContext(), uris[0])
val intent = UploadVideoActivity.getIntent(requireContext(), videoPath, mEntrance, "插入视频")
startActivityForResult(intent, VideoManagerActivity.REQUEST_CODE_VIDEO)
}
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val gridLayoutManager = GridLayoutManager(requireContext(), 3)
gridLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
return if (position == mAdapter!!.itemCount - 1) {
3
} else {
1
}
}
}
mListRv.layoutManager = gridLayoutManager
}
override fun provideListViewModel(): OnlineVideoViewModel {
return viewModelProvider()
}
}

View File

@ -1,25 +0,0 @@
package com.gh.gamecenter.qa.editor
import android.app.Application
import com.gh.common.constant.Config
import com.gh.gamecenter.common.baselist.ListViewModel
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.retrofit.RetrofitManager
import io.reactivex.Observable
@Deprecated("v5.0.0废弃")
class OnlineVideoViewModel(application: Application) : ListViewModel<MyVideoEntity, MyVideoEntity>(application) {
override fun provideDataObservable(page: Int): Observable<MutableList<MyVideoEntity>> {
return RetrofitManager.getInstance().api.getCommunityInsertVideo(
UserManager.getInstance().userId,
page,
Config.VIDEO_PAGE_SIZE
)
}
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData, mResultLiveData::postValue)
}
}

View File

@ -1,87 +0,0 @@
package com.gh.gamecenter.qa.editor
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.common.utils.toSimpleCount
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.databinding.VideoStatusItemBinding
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.video.VideoStatusItemViewHolder
import com.gh.gamecenter.video.VideoVerifyItemViewHolder
import java.text.SimpleDateFormat
import java.util.*
@Deprecated("v5.0.0废弃")
class VideoAdapter(
context: Context,
val mViewModel: OnlineVideoViewModel
) : ListAdapter<MyVideoEntity>(context) {
override fun getItemViewType(position: Int): Int {
if (position == itemCount - 1) return ItemViewType.ITEM_FOOTER
return ItemViewType.ITEM_BODY
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val view: View
return when (viewType) {
ItemViewType.ITEM_FOOTER -> {
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)
FooterViewHolder(view)
}
else -> {
view = mLayoutInflater.inflate(R.layout.video_status_item, parent, false)
return VideoStatusItemViewHolder(VideoStatusItemBinding.bind(view))
}
}
}
override fun getItemCount(): Int {
return if (mEntityList == null || mEntityList.isEmpty()) 0 else mEntityList.size + FOOTER_ITEM_COUNT
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is VideoStatusItemViewHolder) {
val entity = mEntityList[position]
VideoVerifyItemViewHolder.setVideoStatus(holder.binding.status, entity.status)
ImageUtils.display(holder.binding.includeVideo.videoCover, entity.poster)
holder.binding.includeVideo.videoLikeCount.text = entity.vote.toSimpleCount()
holder.itemView.setOnClickListener {
val lastHintTime = SPUtils.getString("pending_hint_time", "")
val format = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val today = format.format(Date())
if (entity.status == "pending" && today != lastHintTime) {
DialogHelper.showDialog(mContext, "提示",
"当前视频正在审核中,审核通过才会显示",
"知道了", "", { setResultAndFinish(entity) })
SPUtils.setString("pending_hint_time", today)
} else {
setResultAndFinish(entity)
}
}
} else if (holder is FooterViewHolder) {
holder.initFooterViewHolder(mViewModel, mIsLoading, mIsNetworkError, mIsOver)
}
}
private fun setResultAndFinish(entity: MyVideoEntity) {
if (mContext is Activity) {
val intent = Intent()
intent.putExtra(MyVideoEntity::class.java.simpleName, entity)
(mContext as Activity).setResult(Activity.RESULT_OK, intent)
(mContext as Activity).finish()
}
}
}

View File

@ -1,54 +0,0 @@
package com.gh.gamecenter.qa.entity
import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
/**
* Created by khy on 11/12/17.
*/
class AskTagGroupsEntity() : Parcelable {
@SerializedName("_id")
var id: String? = null
var name: String? = null
var icon: String? = null
@SerializedName("description")
var des: String? = null
var order: Int = 1000 // 优先级 默认最高(最后)
constructor(parcel: Parcel) : this() {
id = parcel.readString()
name = parcel.readString()
icon = parcel.readString()
des = parcel.readString()
order = parcel.readInt()
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(id)
parcel.writeString(name)
parcel.writeString(icon)
parcel.writeString(des)
parcel.writeInt(order)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<AskTagGroupsEntity> {
override fun createFromParcel(parcel: Parcel): AskTagGroupsEntity {
return AskTagGroupsEntity(parcel)
}
override fun newArray(size: Int): Array<AskTagGroupsEntity?> {
return arrayOfNulls(size)
}
}
}

View File

@ -1,45 +0,0 @@
package com.gh.gamecenter.qa.entity
import android.os.Parcel
import android.os.Parcelable
/**
* Created by khy on 11/12/17.
*/
class AskTimeEntity() : Parcelable {
var create: Long? = null
var update: Long? = null
var open: Long? = null
constructor(parcel: Parcel) : this() {
create = parcel.readValue(Long::class.java.classLoader) as? Long
update = parcel.readValue(Long::class.java.classLoader) as? Long
open = parcel.readValue(Long::class.java.classLoader) as? Long
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeValue(create)
parcel.writeValue(update)
parcel.writeValue(open)
}
override fun describeContents(): Int {
return 0
}
companion object {
@JvmField
val CREATOR: Parcelable.Creator<AskTimeEntity> = object : Parcelable.Creator<AskTimeEntity> {
override fun createFromParcel(parcel: Parcel): AskTimeEntity {
return AskTimeEntity(parcel)
}
override fun newArray(size: Int): Array<AskTimeEntity?> {
return arrayOfNulls(size)
}
}
}
}

View File

@ -1,85 +0,0 @@
package com.gh.gamecenter.qa.myqa;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.databinding.CommunityQuestionItemBinding;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.qa.questions.CommunityQuestionViewHolder;
import kotlin.Pair;
/**
* Created by khy on 20/12/17.
*/
class ConcernQuestionsAdapter extends ListAdapter<Questions> implements ISyncAdapterHandler {
private OnListClickListener mListClickListener;
private String mEntrance = "";
public ConcernQuestionsAdapter(Context context, String entrance, OnListClickListener listClickListener) {
super(context);
mEntrance = entrance;
mListClickListener = listClickListener;
}
@Override
public int getItemViewType(int position) {
if (position == getItemCount() - 1) return ItemViewType.ITEM_FOOTER;
return ItemViewType.ITEM_BODY;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch (viewType) {
case ItemViewType.ITEM_FOOTER:
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
return new FooterViewHolder(view, mListClickListener);
case ItemViewType.ITEM_BODY:
view = mLayoutInflater.inflate(R.layout.community_question_item, parent, false);
return new CommunityQuestionViewHolder(CommunityQuestionItemBinding.bind(view));
default:
return null;
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (getItemViewType(position)) {
case ItemViewType.ITEM_BODY:
Questions questions = mEntityList.get(position);
((CommunityQuestionViewHolder) holder).bindMyQuestionViewHolder(questions, mEntrance, "我的问答-关注问题");
break;
case ItemViewType.ITEM_FOOTER:
FooterViewHolder footerViewHolder = (FooterViewHolder) holder;
footerViewHolder.initItemPadding();
footerViewHolder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver);
break;
}
}
@Override
public int getItemCount() {
return mEntityList == null || mEntityList.isEmpty() ? 0 : mEntityList.size() + FOOTER_ITEM_COUNT;
}
@Nullable
@Override
public Pair<String, Object> getSyncData(int position) {
if (position >= mEntityList.size()) return null;
Questions entity = mEntityList.get(position);
return new Pair(entity.getId(), entity);
}
}

View File

@ -1,79 +0,0 @@
package com.gh.gamecenter.qa.myqa;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.common.baselist.ListFragment;
import com.gh.gamecenter.common.baselist.LoadType;
import com.gh.gamecenter.common.baselist.NormalListViewModel;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.retrofit.RetrofitManager;
import java.util.List;
import io.reactivex.Observable;
/**
* Created by khy on 20/12/17.
*/
public class ConcernQuestionsFragment extends ListFragment<Questions, NormalListViewModel> {
public static final int KEY_CHECK_QUESTION_CONCERN = 105;
private ConcernQuestionsAdapter mAdapter;
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == KEY_CHECK_QUESTION_CONCERN && resultCode == Activity.RESULT_OK) {
onLoadRefresh();
}
}
public static ConcernQuestionsFragment getInstance(String entrance) {
ConcernQuestionsFragment fragment = new ConcernQuestionsFragment();
Bundle args = new Bundle();
args.putString(EntranceConsts.KEY_ENTRANCE, entrance);
fragment.setArguments(args);
return fragment;
}
@Override
protected ListAdapter provideListAdapter() {
return mAdapter == null ? mAdapter = new ConcernQuestionsAdapter(getContext(), mEntrance, this) : mAdapter;
}
@Override
public Observable<List<Questions>> provideDataObservable(int page) {
return RetrofitManager.getInstance().getApi().getConcernQuestions(UserManager.getInstance().getUserId(), page);
}
@Override
public void onListClick(View view, int position, Object data) {
if (view.getId() == R.id.footerview_item) {
if (mAdapter.isNetworkError()) {
mListViewModel.load(LoadType.RETRY);
}
}
}
@Override
protected boolean addSyncPageObserver() {
return true;
}
@Nullable
@Override
protected RecyclerView.Adapter provideSyncAdapter() {
return mAdapter;
}
}

View File

@ -4,19 +4,19 @@ import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.R;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.qa.article.MyArticleFragment;
import com.gh.gamecenter.qa.draft.CommunityDraftWrapperActivity;
import java.util.List;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
/**
* Created by khy on 20/12/17.
*/
@ -28,16 +28,12 @@ public class MyAskWrapperFragment extends BaseFragment_TabLayout {
String entrance = null;
if (getArguments() != null) entrance = getArguments().getString(EntranceConsts.KEY_ENTRANCE);
// fragments.add(ConcernQuestionsFragment.getInstance(entrance));
// fragments.add(MyQuestionsFragment.getInstance(entrance));
fragments.add(MyAnswerFragment.getInstance(entrance));
fragments.add(MyArticleFragment.getInstance(entrance, UserManager.getInstance().getUserId()));
}
@Override
protected void initTabTitleList(List<String> tabTitleList) {
// tabTitleList.add("关注问题");
// tabTitleList.add("我的问题");
tabTitleList.add("我的回答");
tabTitleList.add("我的帖子");
}

View File

@ -1,87 +0,0 @@
package com.gh.gamecenter.qa.myqa;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.databinding.CommunityQuestionItemBinding;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.qa.questions.CommunityQuestionViewHolder;
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity;
import kotlin.Pair;
/**
* Created by khy on 20/12/17.
*/
public class MyQuestionsAdapter extends ListAdapter<Questions> implements ISyncAdapterHandler {
private OnListClickListener mListClickListener;
private String mEntrance = "";
public MyQuestionsAdapter(Context context, String entrance, OnListClickListener listClickListener) {
super(context);
mEntrance = entrance;
mListClickListener = listClickListener;
}
@Override
public int getItemViewType(int position) {
if (position == getItemCount() - 1) return ItemViewType.ITEM_FOOTER;
return ItemViewType.ITEM_BODY;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch (viewType) {
case ItemViewType.ITEM_FOOTER:
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
return new FooterViewHolder(view, mListClickListener);
case ItemViewType.ITEM_BODY:
view = mLayoutInflater.inflate(R.layout.community_question_item, parent, false);
return new CommunityQuestionViewHolder(CommunityQuestionItemBinding.bind(view));
default:
return null;
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (getItemViewType(position)) {
case ItemViewType.ITEM_BODY:
Questions questions = mEntityList.get(position);
((CommunityQuestionViewHolder) holder).bindMyQuestionViewHolder(questions, mEntrance, "我的光环-我的问答-我的问题");
holder.itemView.setOnClickListener(v -> mContext.startActivity(NewQuestionDetailActivity.getIntent(mContext, questions.getId(), mEntrance, "我的光环-我的问答-我的问题")));
break;
case ItemViewType.ITEM_FOOTER:
FooterViewHolder footerViewHolder = (FooterViewHolder) holder;
footerViewHolder.initItemPadding();
footerViewHolder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver);
break;
}
}
@Override
public int getItemCount() {
return mEntityList == null || mEntityList.isEmpty() ? 0 : mEntityList.size() + FOOTER_ITEM_COUNT;
}
@Nullable
@Override
public Pair<String, Object> getSyncData(int position) {
if (position >= mEntityList.size()) return null;
Questions entity = mEntityList.get(position);
return new Pair(entity.getId(), entity);
}
}

View File

@ -1,71 +0,0 @@
package com.gh.gamecenter.qa.myqa;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.common.baselist.ListFragment;
import com.gh.gamecenter.common.baselist.LoadType;
import com.gh.gamecenter.common.baselist.NormalListViewModel;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.Utils;
import java.util.List;
import io.reactivex.Observable;
/**
* Created by khy on 20/12/17.
*/
public class MyQuestionsFragment extends ListFragment<Questions, NormalListViewModel> {
private MyQuestionsAdapter mAdapter;
public static MyQuestionsFragment getInstance(String entrance) {
MyQuestionsFragment fragment = new MyQuestionsFragment();
Bundle args = new Bundle();
args.putString(EntranceConsts.KEY_ENTRANCE, entrance);
fragment.setArguments(args);
return fragment;
}
@Override
protected ListAdapter provideListAdapter() {
return mAdapter == null ? mAdapter = new MyQuestionsAdapter(getContext(), mEntrance, this) : mAdapter;
}
@Override
public Observable<List<Questions>> provideDataObservable(int page) {
return RetrofitManager.getInstance().getApi().getMyQuestions(UserManager.getInstance().getUserId(), page,
HaloApp.getInstance().getChannel(), Utils.getTime(getContext()));
}
@Override
public void onListClick(View view, int position, Object data) {
if (view.getId() == R.id.footerview_item) {
if (mAdapter.isNetworkError()) {
mListViewModel.load(LoadType.RETRY);
}
}
}
@Override
protected boolean addSyncPageObserver() {
return true;
}
@Nullable
@Override
protected RecyclerView.Adapter provideSyncAdapter() {
return mAdapter;
}
}

View File

@ -1,81 +0,0 @@
package com.gh.gamecenter.qa.questions
import android.annotation.SuppressLint
import android.view.MotionEvent
import android.view.View
import android.widget.TextView
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.common.util.CheckLoginUtils
import com.gh.common.util.NewsUtils
import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.CommunityQuestionItemBinding
import com.gh.gamecenter.qa.answer.edit.AnswerEditActivity
import com.gh.gamecenter.qa.entity.Questions
class CommunityQuestionViewHolder(val binding: CommunityQuestionItemBinding) :
BaseRecyclerViewHolder<Any>(binding.root) {
fun bindQuestionViewHolder(questions: Questions, entrance: String, path: String) {
bindViewHolder(questions, entrance, path)
binding.endDesc.text = NewsUtils.getFormattedTime(questions.time)
}
fun bindMyQuestionViewHolder(questions: Questions, entrance: String, path: String) {
bindViewHolder(questions, entrance, path)
binding.endDesc.text = questions.communityName
}
@SuppressLint("ClickableViewAccessibility")
private fun bindViewHolder(questions: Questions, entrance: String, path: String) {
binding.title.text = questions.title
bindAnswerCount(questions, binding.answerCountContainer, binding.answerCount, entrance)
}
companion object {
fun bindAnswerCount(
questions: Questions,
answerCountContainer: View,
answerCountTv: TextView,
entrance: String
) {
if (questions.answerCount > 0) {
DrawableView.setTextDrawable(
answerCountTv,
R.drawable.community_question_answer_count,
NumberUtils.transSimpleCount(questions.answerCount)
)
} else {
DrawableView.setTextDrawable(
answerCountTv,
R.drawable.community_answer_count,
"回答"
)
}
// 虽然很丑陋但是没有想到其它好的办法实现https://gitlab.ghzs.com/pm/halo-app-issues/issues/812 (7)
if (questions.answerCount <= 0 && questions.me.myAnswerId.isNullOrEmpty()) {
answerCountContainer.setOnTouchListener { _, event ->
if (event.action == MotionEvent.ACTION_DOWN || event.action == MotionEvent.ACTION_MOVE) {
answerCountContainer.setBackgroundResource(R.drawable.reuse_listview_item_style)
} else {
answerCountContainer.background = null
}
false
}
answerCountContainer.setOnClickListener {
CheckLoginUtils.checkLogin(it.context, entrance) {
val communityName = questions.communityName
it.context.startActivity(AnswerEditActivity.getIntent(it.context, questions, communityName))
}
}
answerCountContainer.isClickable = true
} else {
answerCountContainer.isClickable = false
answerCountContainer.setOnTouchListener(null)
}
}
}
}

View File

@ -63,7 +63,7 @@ class VideoDescViewModel(application: Application) :
fun postVote() {
if (topVideoDetail == null) return
if (!UserManager.getInstance().isLoggedIn) {
CheckLoginUtils.checkLogin(getApplication(), "视频详情") {}
CheckLoginUtils.checkLogin(getApplication(), "视频详情-点赞") {}
return
}
if (topVideoDetail!!.me.isVoted) {

View File

@ -756,7 +756,7 @@ public interface ApiService {
* 新的设置接口
*/
@GET("settings")
Single<NewSettingsEntity> getNewSettings(@Query("version") String version, @Query("channel") String channel);
Single<NewApiSettingsEntity> getNewSettings(@Query("version") String version, @Query("channel") String channel);
/**
* 获取新的配置信息,因为旧的已经太大了避免冲突
@ -1657,12 +1657,6 @@ public interface ApiService {
@GET("users/{user_id}/videos")
Observable<List<MyVideoEntity>> getUserVideo(@Path("user_id") String userId, @Query("page") int page, @Query("page_size") int pageSize);
/**
* 获取用户的视频草稿列表(包括审核中)
*/
@GET("users/{user_id}/videos?view=insert_video_page")
Observable<List<MyVideoEntity>> getCommunityInsertVideo(@Path("user_id") String userId, @Query("page") int page, @Query("page_size") int pageSize);
/**
* 获取用户的视频收藏列表
*/
@ -2942,4 +2936,22 @@ public interface ApiService {
*/
@POST("mobile_auth/{user_id}:unbind")
Single<ResponseBody> unBindPhone();
/**
* 获取发现页游戏列表
*/
@GET("home/explore/games")
Observable<DiscoveryGameCardEntity> getDiscoveryGames(@Query("page") int page, @QueryMap Map<String, Object> params);
/**
* 获取发现页卡片列表
*/
@GET("home/explore/cards")
Observable<ArrayList<DiscoveryGameCardLabel>> getCardLabels();
/**
* 反馈游戏
*/
@POST("home/explore/games/{game_id}/feedback")
Single<ResponseBody> discorveryFeedback(@Path("game_id") String gameId, @Body RequestBody body);
}

View File

@ -0,0 +1,20 @@
package com.gh.gamecenter.room.converter
import androidx.room.TypeConverter
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.entity.TagStyleEntity
class TagStyleConverter {
@TypeConverter
fun toString(entity: TagStyleEntity?): String {
return entity?.toJson() ?: ""
}
@TypeConverter
fun toObject(value: String?): TagStyleEntity {
return value?.toObject() ?: TagStyleEntity()
}
}

View File

@ -166,7 +166,7 @@ class SearchGameIndexAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -228,7 +228,7 @@ class SearchGameResultAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
}
}
if (gameEntity.advanceDownload) {

View File

@ -25,6 +25,7 @@ import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.game.GameItemViewHolder
import com.lightgame.adapter.BaseRecyclerAdapter
import java.text.SimpleDateFormat
import java.util.*
@ -299,6 +300,8 @@ class GameServersContentAdapter(
viewHolder.binding.home2TestType.background = getServerDrawableBySource(R.color.tag_orange)
}
GameItemViewHolder.initGameSubtitle(gameEntity, viewHolder.binding.gameSubtitleTv, forceShowSubtitle = true)
if (gameEntity.fixedTop!!) {
val tag = "今日开服"
viewHolder.binding.home2TestType.visibility = View.VISIBLE

View File

@ -36,6 +36,7 @@ import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.callback.BiCallback
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.SimulatorGameItemBinding
import com.gh.gamecenter.databinding.SimulatorHeaderViewBinding
@ -199,6 +200,7 @@ class SimulatorGameListAdapter(
recommendStar.rating = gameEntity.recommendStar.toFloat()
}
gameItemIncluded.recentPlayedTag.goneIf(!gameEntity.isRecentlyPlayed)
gameItemIncluded.selectIv.setImageDrawable(DrawableView.getCheckSelectorDrawable(mContext))
gameItemIncluded.selectIv.goneIf(!mShowSelectFlag)
gameItemIncluded.selectIv.isChecked = mSelectList[position - 1]
gameItemIncluded.selectIv.setOnClickListener {

View File

@ -60,6 +60,11 @@ class SimulatorGameViewModel(application: Application) : AndroidViewModel(applic
}
}
}
} else {
// 若网络数据为空,本地数据不为空时同步本地数据到服务端 (避免本地数据与网络数据不一致的问题)
if (localSimulatorList.isNotEmpty()) {
SimulatorGameManager.recordDownloadSimulatorGames()
}
}
}, {
simulators.postValue(mResultSimulatorsList)

View File

@ -1,6 +0,0 @@
package com.gh.gamecenter.video
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.databinding.VideoStatusItemBinding
class VideoStatusItemViewHolder(var binding: VideoStatusItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)

View File

@ -437,7 +437,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
}
} else {
uploadVideoStreamingPlaying("点赞-跳转登录")
CheckLoginUtils.checkLogin(context, "(游戏详情)") {}
CheckLoginUtils.checkLogin(context, "视频流详情-点赞") {}
}
}
}

View File

@ -25,6 +25,7 @@ import com.gh.gamecenter.common.baselist.LoadType
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.CurrentActivityHolder
@ -136,7 +137,7 @@ class VDownloadManagerAdapter(
holder.binding.descTv.goneIf(!mViewModel.isTypeDownloaded() || gameEntity.des?.isEmpty() == true)
holder.binding.descTv.text = gameEntity.des
holder.binding.selectIv.setImageDrawable(R.drawable.selector_ic_simulator.toDrawable(mContext))
holder.binding.selectIv.setImageDrawable(DrawableView.getCheckSelectorDrawable(mContext))
holder.binding.selectIv.goneIf(mCurrentOption == ManageOption.OPTION_MANAGER)
holder.binding.selectIv.isChecked = selectItems.contains(gameEntity.id)
@ -242,6 +243,11 @@ class VDownloadManagerAdapter(
extraConfig = DialogHelper.Config(centerTitle = true)
)
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()
@ -261,7 +267,7 @@ class VDownloadManagerAdapter(
checkAllCb.setTextColor(R.color.text_title.toColor(mContext))
selectNumTv.setTextColor(R.color.theme_font.toColor(mContext))
checkAllCb.setCompoundDrawablesWithIntrinsicBounds(
R.drawable.selector_ic_simulator.toDrawable(mContext),
DrawableView.getCheckSelectorDrawable(mContext),
null,
null,
null

View File

@ -5,6 +5,7 @@ import android.annotation.SuppressLint
import android.content.ContentValues
import android.content.Context
import android.content.Intent
import android.database.sqlite.SQLiteFullException
import android.net.Uri
import android.os.Build
import android.text.TextUtils
@ -610,9 +611,13 @@ object VHelper {
*/
private fun updateVGamePlayedTime(packageName: String, lastPlayedTime: Long, totalPlayedTime: Long) {
getVGameSnapshot(null, packageName)?.let {
it.downloadEntity.addMetaExtra(KEY_LAST_PLAYED_TIME, totalPlayedTime.toString())
it.downloadEntity.addMetaExtra(KEY_LAST_PLAYED_TIME, lastPlayedTime.toString())
it.downloadEntity.addMetaExtra(KEY_TOTAL_PLAYED_TIME, totalPlayedTime.toString())
mVGameDao.insert(it)
try {
mVGameDao.insert(it)
} catch (e: SQLiteFullException) {
ToastUtils.toast("设备存储空间不足,请清理后重试")
}
}
// 更新首页排序

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