Compare commits

...

137 Commits

Author SHA1 Message Date
e6a155a532 feat: 移除 build caches 避免镜像过大
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-23 15:22:40 +08:00
d455d4ef54 build: 构建编译镜像 2024-10-23 15:22:40 +08:00
8f8ac99dae chore: 版本更新至 5.38.2
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-23 12:37:29 +08:00
0be7db94ad Merge branch 'hotfix/v5.38.1-1111/crashes' into 'release'
修复 5.38.1 的部分闪退问题

See merge request halo/android/assistant-android!1947
2024-10-23 11:52:09 +08:00
ae80359b48 Merge branch 'fix/catch_view_lifecycle_owner_crash' into 'release'
fix: 捕获加载图片时获取ViewLifecycleOwner出现的闪退问题

See merge request halo/android/assistant-android!1946
2024-10-23 11:47:53 +08:00
81281855a1 fix: 修复继续下载 VA 插件异常时的闪退问题(遇到异常尝试重下) https://sentry.shanqu.cc/organizations/lightgame/issues/416793
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-23 11:28:58 +08:00
a5174c6931 fix: 捕获加载图片时获取ViewLifecycleOwner出现的闪退问题 2024-10-23 11:16:36 +08:00
a3cc74afb3 fix: 修复部分位置在处理图片选择回调时处理不合理造成的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/416811
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-23 10:13:39 +08:00
84e78de6fc fix: 当 PackageName 为空时的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/416770
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-23 09:54:50 +08:00
9bf4c73250 chore: 版本更新至 5.38.1
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-22 15:13:34 +08:00
57a222b87a Merge branch 'hotfix/v5.38.0-1110/get_install_list_anr' into 'release'
fix: 修复错误使用全量已安装应用列表进行应用是否已安装判断依据的问题

See merge request halo/android/assistant-android!1945
2024-10-22 10:42:53 +08:00
3e125b90a2 fix: 修复错误使用全量已安装应用列表进行应用是否已安装判断依据的问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-22 10:32:33 +08:00
1809265d4f Merge branch 'fix/sentry-415534' into 'release'
fixed: Sentry415534 VA启动游戏弹窗报“Can not perform this action after onSaveInstanceState”的异常问题

See merge request halo/android/assistant-android!1944
2024-10-22 10:10:36 +08:00
3b3774596d fixed: Sentry415534 VA启动游戏弹窗报“Can not perform this action after onSaveInstanceState”的异常问题 2024-10-22 09:58:40 +08:00
bded49c366 Merge branch 'hotfix/v5.38.0-1110/remove_duplicated_sentry_log' into 'release'
fix: 移除部分 Sentry 日志上报,避免数据量过大

See merge request halo/android/assistant-android!1943
2024-10-21 18:04:47 +08:00
841711b5f1 fix: 移除部分 Sentry 日志上报,避免数据量过大
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-21 18:02:17 +08:00
7a080115a7 Merge branch 'hotfix/v5.38.0-1110/remove_duplicated_sentry_log' into 'release'
fix: 移除 AndroidException 类型的 Sentry 日志上报,避免数据量过大

See merge request halo/android/assistant-android!1942
2024-10-21 17:31:24 +08:00
337c4724a7 fix: 移除 AndroidException 类型的 Sentry 日志上报,避免数据量过大
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-21 17:28:44 +08:00
2119691bf6 Merge branch 'fix/GHZSCY-6799' into 'release'
fix: 【光环助手】V5.38版本群测汇总(1) https://jira.shanqu.cc/browse/GHZSCY-6799

See merge request halo/android/assistant-android!1941
2024-10-18 16:12:03 +08:00
caf50055c9 fix: 【光环助手】V5.38版本群测汇总(1) https://jira.shanqu.cc/browse/GHZSCY-6799 2024-10-18 16:11:13 +08:00
3ee3c2453f Merge branch 'fix/GHZSCY-6799' into 'release'
fix: 【光环助手】V5.38版本群测汇总(3) https://jira.shanqu.cc/browse/GHZSCY-6799

See merge request halo/android/assistant-android!1940
2024-10-18 15:27:05 +08:00
5e431e8a61 fix: 【光环助手】V5.38版本群测汇总(3) https://jira.shanqu.cc/browse/GHZSCY-6799 2024-10-18 15:14:18 +08:00
ff72c7cac8 Merge branch 'fix/navigation_bar_view_issue' into 'release'
fix: 修复 navigationBarView 的高度占位问题 https://jira.shanqu.cc/browse/GHZSCY-6799

See merge request halo/android/assistant-android!1939
2024-10-18 14:54:48 +08:00
047325e9bc fix: 修复 navigationBarView 的高度占位问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-18 11:27:31 +08:00
afbb758740 Merge branch 'refactor/sync-va' into 'dev'
feat: 更新插件1.0.3 正式版本 url

See merge request halo/android/assistant-android!1938
2024-10-17 15:43:21 +08:00
5de629cfdd feat: 更新插件1.0.3 正式版本 url 2024-10-17 15:42:59 +08:00
f026623600 Merge branch 'refactor/sync-va' into 'dev'
chore: va组件升级到2.0.6

See merge request halo/android/assistant-android!1937
2024-10-17 11:24:35 +08:00
2f5ee0eb91 chore: va组件升级到2.0.6
refactor: update commit id
2024-10-17 11:24:12 +08:00
e7651e8092 Merge branch 'feat/GHZSCY-6708-patch' into 'dev'
feat: CPM微信小游戏API接入兼容OkHttp 4.x

See merge request halo/android/assistant-android!1936
2024-10-17 11:23:47 +08:00
82d51d6375 feat: CPM微信小游戏API接入兼容OkHttp 4.x 2024-10-17 11:23:24 +08:00
6080edfd8a Merge branch 'feat/GHZSCY-6708' into 'dev'
feat: CPM微信小游戏API接入工作—客户端 https://jira.shanqu.cc/browse/GHZSCY-6708

See merge request halo/android/assistant-android!1911
2024-10-17 10:17:19 +08:00
d9713571c9 feat: CPM微信小游戏API接入工作—客户端 https://jira.shanqu.cc/browse/GHZSCY-6708 2024-10-17 10:17:19 +08:00
b466525e8b Merge branch 'feat/GHZSCY-6790' into 'dev'
feat: 更新 OkHttp 至 4.X 最新版本并启用 brotli 压缩 https://jira.shanqu.cc/browse/GHZSCY-6790

See merge request halo/android/assistant-android!1935
2024-10-16 16:56:07 +08:00
2a25675dce feat: 更新 OkHttp 至 4.X 最新版本并启用 brotli 压缩 https://jira.shanqu.cc/browse/GHZSCY-6790 2024-10-16 16:56:06 +08:00
5486ad8818 Merge branch 'fix/home_appbar_style' into 'dev'
fix: 修复多tab导航页在无Tab样式下AppBar变色异常的问题

See merge request halo/android/assistant-android!1934
2024-10-16 13:47:17 +08:00
5552fcf7bc Merge branch 'fix/stop_banner_play_on_pause' into 'dev'
fix: 修复部分轮播图没有在页面暂停时停止播放的问题

See merge request halo/android/assistant-android!1933
2024-10-16 13:47:10 +08:00
782a0af13c fix: 修复多tab导航页在无Tab样式下AppBar变色异常的问题 2024-10-16 11:44:44 +08:00
c6c2d9cd12 fix: 修复部分轮播图没有在页面暂停时停止播放的问题 2024-10-16 10:09:51 +08:00
f929a08e46 Merge branch 'fix/GHZSCY-6685' into 'dev'
fix: 修复 Fresco 不能根据 ViewPager/ViewPager2 页面可见性变更动图播放状态的问题 https://jira.shanqu.cc/browse/GHZSCY-6685

See merge request halo/android/assistant-android!1930
2024-10-15 18:16:41 +08:00
e48f96d7d7 fix: 修复 Fresco 不能根据 ViewPager/ViewPager2 页面可见性变更动图播放状态的问题 https://jira.shanqu.cc/browse/GHZSCY-6685 2024-10-15 18:16:41 +08:00
3cc95dbc08 Merge branch 'fix/system-properties-sensitive' into 'dev'
fix: 修复xcrash敏感行为【读取系统属性】

See merge request halo/android/assistant-android!1929
2024-10-15 15:08:29 +08:00
f75396d7ae fix: 修复xcrash敏感行为【读取系统属性】 2024-10-15 15:07:57 +08:00
72c3df7fa6 Merge branch 'fix/GHZSCY-6773' into 'dev'
fix:【光环助手】游戏专题-右上角显示问题 https://jira.shanqu.cc/browse/GHZSCY-6773

See merge request halo/android/assistant-android!1928
2024-10-15 09:35:38 +08:00
2d4920cfb0 fix:【光环助手】游戏专题-右上角显示问题 https://jira.shanqu.cc/browse/GHZSCY-6773 2024-10-15 09:31:13 +08:00
2d30b97cca Merge branch 'fix/hiddenapibypass-bug' into 'dev'
fix: 更新hiddenapibypass库,观察native crash的hiddenapi相关问题是否解决。

See merge request halo/android/assistant-android!1927
2024-10-14 17:09:30 +08:00
40346e3c9a fix: 更新hiddenapibypass库,观察native crash的hiddenapi相关问题是否解决。 2024-10-14 17:08:20 +08:00
7f601c856a Merge branch 'fix/illegal_state_exception' into 'dev'
fix: 尝试修复游戏专题合集详情页闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/388936

See merge request halo/android/assistant-android!1924
2024-10-12 11:36:49 +08:00
6e56f2e3a0 fix: 尝试修复游戏专题合集详情页闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/388936 2024-10-12 10:40:26 +08:00
e2fbda1e4c Merge branch 'fix/GHZSCY-6778' into 'dev'
fix: 分类页面展示异常 https://jira.shanqu.cc/browse/GHZSCY-6778

See merge request halo/android/assistant-android!1921
2024-10-11 16:45:57 +08:00
1e88ba8539 fix: 分类页面展示异常 https://jira.shanqu.cc/browse/GHZSCY-6778 2024-10-11 15:40:03 +08:00
0f43b5610d Merge branch 'feat/GHZSCY-6474' into 'dev'
feat: 【光环助手】搜索榜单的神策埋点问题 https://jira.shanqu.cc/browse/GHZSCY-6747

See merge request halo/android/assistant-android!1920
2024-10-11 15:10:51 +08:00
04dcfbab2e feat: 【光环助手】搜索榜单的神策埋点问题 https://jira.shanqu.cc/browse/GHZSCY-6747 2024-10-11 15:10:51 +08:00
8dd33cb599 Merge branch 'fix/GHZSCY-6777' into 'dev'
fix: 【光环助手】进入QA详情页埋点上报问题 https://jira.shanqu.cc/browse/GHZSCY-6777

See merge request halo/android/assistant-android!1917
2024-10-11 15:02:10 +08:00
af5826962b fix: 【光环助手】进入QA详情页埋点上报问题 https://jira.shanqu.cc/browse/GHZSCY-6777 2024-10-11 15:02:10 +08:00
9883f8d5c0 Merge branch 'fix/GHZSCY-6772' into 'dev'
fix: 分流器-验收问题-客户端 https://jira.shanqu.cc/browse/GHZSCY-6772

See merge request halo/android/assistant-android!1918
2024-10-11 15:01:59 +08:00
848207784e fix: 分流器-验收问题-客户端 https://jira.shanqu.cc/browse/GHZSCY-6772 2024-10-11 15:01:59 +08:00
fc294f9e7b Merge branch 'revert/GHZSCY-5572' into 'dev'
Revert: 搜索业务-新增搜索发现取代热门标签—客户端 https://jira.shanqu.cc/browse/GHZSCY-5572

See merge request halo/android/assistant-android!1916
2024-10-09 17:00:42 +08:00
96cd53a2c9 Revert: 搜索业务-新增搜索发现取代热门标签—客户端 https://jira.shanqu.cc/browse/GHZSCY-5572 2024-10-09 17:00:42 +08:00
5458c93475 fix: 处理合并冲突
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-10-09 15:53:40 +08:00
675d63c1d6 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	.gitlab-ci.yml
#	app/src/main/java/com/gh/gamecenter/download/DownloadFragment.kt
#	dependencies.gradle
#	vasdk
2024-10-09 15:34:08 +08:00
1040f5ff4d Merge branch 'sentry/407275' into 'release'
fix: Sentry 407275 修复Z10机型报BadTokenException的异常

See merge request halo/android/assistant-android!1915
2024-10-09 14:56:18 +08:00
97be320529 fix: Sentry 407275 修复Z10机型报BadTokenException的异常 2024-10-09 14:56:18 +08:00
0e086c9452 Merge branch 'fix/va-some-npe' into 'dev'
fix: 修复sentry捕获异常。

See merge request halo/android/assistant-android!1914
2024-10-09 14:13:09 +08:00
dc677d1b9f fix: 修复sentry捕获异常。
1.https://sentry.shanqu.cc/organizations/lightgame/issues/396947/?project=22
2.https://sentry.shanqu.cc/organizations/lightgame/issues/398572/events/0d99a320eee243efa7089b59cb10219c/?project=22
3.https://sentry.shanqu.cc/organizations/lightgame/issues/382462/events/30a62c7d5e0a40df80f36ff25b325728/?project=22
4.https://sentry.shanqu.cc/organizations/lightgame/issues/407819/?project=22
5.https://sentry.shanqu.cc/organizations/lightgame/issues/397248/?project=22
2024-10-09 14:10:54 +08:00
fa50c6e417 Merge branch 'fix/crashes' into 'dev'
修复Sentry闪退问题

See merge request halo/android/assistant-android!1913
2024-10-09 14:04:48 +08:00
dc96f2274f fix: 修复启动时QQ小游戏获取WebView的默认UserAgent导致的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/352547/?project=22 2024-10-09 11:32:36 +08:00
ad5f5048a6 Merge branch 'fix/auto-login-crash' into 'dev'
fix:自动登录页面闪退

See merge request halo/android/assistant-android!1912
2024-10-09 11:20:24 +08:00
e5491fb297 fix:自动登录页面闪退 2024-10-09 11:20:24 +08:00
ff96eaafee fix: 修复获取统计数据时出现的空指针闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/387745/?project=22 2024-10-08 17:33:43 +08:00
da0ace0aa6 Merge branch 'fix/get_packagename_culprit' into 'dev'
fix: 修复多线程同时请求已安装包名列表的问题

See merge request halo/android/assistant-android!1909
2024-09-27 14:14:41 +08:00
11a2d7aa53 fix: 修复因为获取已安装包名延迟造成的下载按钮状态更新问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-27 10:04:09 +08:00
d3444918dd fix: 修复多线程同时请求已安装包名列表的问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-27 10:04:09 +08:00
09f54daa76 Merge branch 'feat/optimise_search_toolbar_tab_wrapper' into 'dev'
feat: 优化首页多Tab导航页渲染速度

See merge request halo/android/assistant-android!1908
2024-09-27 09:45:41 +08:00
fa800284f5 feat: 优化首页底部Tab图标加载速度 2024-09-26 17:42:44 +08:00
cdae5e4427 feat: 优化首页多Tab导航页渲染速度 2024-09-26 17:42:44 +08:00
e3e3155b95 Merge branch 'fix/GHZSCY-6728' into 'dev'
fix:【光环助手】搜索业务:搜索分类导航功能问题 https://jira.shanqu.cc/browse/GHZSCY-6728

See merge request halo/android/assistant-android!1907
2024-09-26 17:36:34 +08:00
ac38f3b239 fix:【光环助手】搜索业务:搜索分类导航功能问题 https://jira.shanqu.cc/browse/GHZSCY-6728 2024-09-26 17:36:34 +08:00
c775ddd922 Merge branch 'feat/GHZSCY-6476' into 'dev'
feat: 光环工具服务APP多合一—客户端 https://jira.shanqu.cc/browse/GHZSCY-6476

See merge request halo/android/assistant-android!1891
2024-09-26 14:49:18 +08:00
70a50f7d4a feat: 光环工具服务APP多合一—客户端 https://jira.shanqu.cc/browse/GHZSCY-6476 2024-09-26 14:49:18 +08:00
773c9da941 Revert "Revert "fix: 修复因为低级失误导致 sentry.onEvent 方法失效的问题""
This reverts commit 1ee0f292ba.
2024-09-26 10:10:51 +08:00
c5fdcd5902 Merge branch 'fix/GHZSCY-6736' into 'dev'
fix:游戏预约功能(第五期)-0925验收问题-客户端 https://jira.shanqu.cc/browse/GHZSCY-6736

See merge request halo/android/assistant-android!1905
2024-09-25 15:29:33 +08:00
fee31f2672 fix:游戏预约功能(第五期)-0925验收问题-客户端 https://jira.shanqu.cc/browse/GHZSCY-6736 2024-09-25 15:25:55 +08:00
e64585746e Merge branch 'fix/search_page_hotfix' into 'dev'
fix: 修复搜索页清除搜索关键字后,没有回退到搜索首页的问题

See merge request halo/android/assistant-android!1904
2024-09-25 14:55:04 +08:00
236b6e5205 fix: 修复搜索页清除搜索关键字后,没有回退到搜索首页的问题 2024-09-25 14:49:31 +08:00
c0d1c97490 Merge branch 'feat/optimise_home_performance' into 'dev'
feat: 尝试优化首页页面渲染效果

See merge request halo/android/assistant-android!1903
2024-09-25 13:34:26 +08:00
818a9eaf31 feat: 尝试优化首页页面渲染效果 2024-09-25 13:34:26 +08:00
1fbd6d9f81 Merge branch 'feat/GHZSCY-5915-pr' into 'dev'
feat:游戏预约功能(第五期)-前端部分—客户端 https://jira.shanqu.cc/browse/GHZSCY-5915

See merge request halo/android/assistant-android!1902
2024-09-23 15:59:11 +08:00
c37b8f5a59 feat:游戏预约功能(第五期)-前端部分—客户端 https://jira.shanqu.cc/browse/GHZSCY-5915 2024-09-23 15:59:10 +08:00
0d5c51f087 Merge branch 'feat/GHZSCY-5922' into 'dev'
fix: 游戏信息-APK包增加[预设控量] https://jira.shanqu.cc/browse/GHZSCY-5922

See merge request halo/android/assistant-android!1762
2024-09-23 15:15:34 +08:00
ba171e27d9 fix: 游戏信息-APK包增加[预设控量] https://jira.shanqu.cc/browse/GHZSCY-5922
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-23 15:07:25 +08:00
c217e524a7 Merge branch 'feat/GHZSCY-6680' into 'dev'
fix: 【光环助手】排行榜详情页没有显示角标 https://jira.shanqu.cc/browse/GHZSCY-6680

See merge request halo/android/assistant-android!1897
2024-09-23 14:02:33 +08:00
29729ec154 fix: 【光环助手】排行榜详情页没有显示角标 https://jira.shanqu.cc/browse/GHZSCY-6680 2024-09-23 14:02:33 +08:00
299eba4b60 Merge branch 'feat/GHZSCY-6583' into 'dev'
feat: 更新 Sentry SDK https://jira.shanqu.cc/browse/GHZSCY-6583

See merge request halo/android/assistant-android!1899
2024-09-20 17:22:19 +08:00
c2b3d40525 feat: 更新 Sentry SDK https://jira.shanqu.cc/browse/GHZSCY-6583 2024-09-20 17:14:08 +08:00
b7de6ab1bf build: 修改 CI sonar 镜像
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-20 14:12:56 +08:00
a0c5343326 Merge branch 'feat/GHZSCY-6464' into 'dev'
feat: 多渠道多版本管理 新增“我的光环”—客户端 https://jira.shanqu.cc/browse/GHZSCY-6464

See merge request halo/android/assistant-android!1822
2024-09-20 11:05:35 +08:00
b2b42c3f0f feat: 多渠道多版本管理 新增“我的光环”—客户端 https://jira.shanqu.cc/browse/GHZSCY-6464 2024-09-20 11:05:35 +08:00
b318fab26f Merge branch 'feat/GHZSCY-6651' into 'dev'
fix: 【光环助手】求版本下载跳转问题 https://jira.shanqu.cc/browse/GHZSCY-6651

See merge request halo/android/assistant-android!1896
2024-09-20 11:02:05 +08:00
59cde4e2bf Merge branch 'hotfix/v5.37.5-1095/privacy-policy' into 'release'
feat: 优化获取进程名的方式 https://jira.shanqu.cc/browse/GHZSCY-6690

See merge request halo/android/assistant-android!1898
2024-09-20 10:56:40 +08:00
cc0c7c7fae feat: 优化获取进程名的方式 https://jira.shanqu.cc/browse/GHZSCY-6690 2024-09-20 10:32:29 +08:00
013398d14b fix: 【光环助手】求版本下载跳转问题 https://jira.shanqu.cc/browse/GHZSCY-6651 2024-09-18 10:51:36 +08:00
9e9ce6a84f Merge branch 'hotfix/v5.37.5-1095/download_ad_crash' into 'release'
fix: 修复下载管理展示第三方广告失败回落展示自有广告时出现的闪退问题...

See merge request halo/android/assistant-android!1895
2024-09-14 17:23:26 +08:00
7d0b500ff9 fix: 修复下载管理展示第三方广告失败回落展示自有广告时出现的闪退问题 https://sentry.shanqu.cc/organizations/lightgame/issues/409586/?project=22 2024-09-14 17:13:23 +08:00
ac86baaca9 Merge branch 'fix/diverter-timeout' into 'dev'
fix: 修复分流器因为自身原因有一定概率超时的问题

See merge request halo/android/assistant-android!1894
2024-09-14 16:18:36 +08:00
c42e6705c2 fix: 修复分流器因为自身原因有一定概率超时的问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-14 15:17:50 +08:00
0508f6b7ea Merge branch 'fix/GHZSCY-6665' into 'dev'
fix: 发帖时图片选择问题 https://jira.shanqu.cc/browse/GHZSCY-6665

See merge request halo/android/assistant-android!1892
2024-09-14 10:11:51 +08:00
04094a0016 fix: 发帖时图片选择问题 https://jira.shanqu.cc/browse/GHZSCY-6665 2024-09-14 10:10:35 +08:00
f99f513ed9 Merge branch 'fix/id_mismatched' into 'dev'
fix: 修复 id 指向异常的问题

See merge request halo/android/assistant-android!1893
2024-09-14 09:58:06 +08:00
03ef795e26 fix: 修复 id 指向异常的问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-14 09:57:19 +08:00
39599a8f99 Merge branch 'feat/shrink_apk_size' into 'dev'
feat: 优化安装包体积 https://jira.shanqu.cc/browse/GHZSCY-6146

See merge request halo/android/assistant-android!1889
2024-09-13 16:59:05 +08:00
ba9e5b28c6 feat: 优化安装包体积(微调风格) https://jira.shanqu.cc/browse/GHZSCY-6146
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-13 16:00:41 +08:00
65dfa665f5 feat: 优化安装包体积(minSdk 改为 21) https://jira.shanqu.cc/browse/GHZSCY-6146 2024-09-13 16:00:41 +08:00
9e77ca818f feat: 优化安装包体积(移除穿山甲 SDK 和广点通 SDK proguard 规则) https://jira.shanqu.cc/browse/GHZSCY-6146 2024-09-13 16:00:41 +08:00
615acae0b5 feat: 优化安装包体积(移除无用资源文件和无用代码) https://jira.shanqu.cc/browse/GHZSCY-6146 2024-09-13 16:00:41 +08:00
158928253a feat: 优化安装包体积(移除旧首页相关的代码和资源) https://jira.shanqu.cc/browse/GHZSCY-6146
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-13 15:59:53 +08:00
45242baa8b feat: 优化安装包体积(non-transitive-r) https://jira.shanqu.cc/browse/GHZSCY-6146
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-09-13 15:59:53 +08:00
04331b8881 feat: 优化安装包体积(部分图片资源改为联网加载) https://jira.shanqu.cc/browse/GHZSCY-6146 2024-09-13 15:59:53 +08:00
425456b263 Merge branch 'feat/v5.37.5-1095/va-2.0.5' into 'release'
Feat/v5.37.5 1095/va 2.0.5

See merge request halo/android/assistant-android!1890
2024-09-11 17:08:07 +08:00
f6abab9a2d Revert "chore: 组件升级 2.0.5-debug" 2024-09-11 17:05:56 +08:00
6fc7eea011 feat: 优化安装包体积 https://jira.shanqu.cc/browse/GHZSCY-6146 2024-09-11 11:02:36 +08:00
d194f969e4 chore: va组件2.0.5-debug 2024-09-10 16:43:57 +08:00
95f66344fb chore: va组件2.0.5 2024-09-10 13:46:15 +08:00
dca0fc7261 Merge branch 'feat/GHZSCY-6545' into 'dev'
feat: 【光环助手】神策埋点问题-帖子浏览来源入口上报缺失 https://jira.shanqu.cc/browse/GHZSCY-6545

See merge request halo/android/assistant-android!1846
2024-09-10 11:00:45 +08:00
fd77516e7c feat: 【光环助手】神策埋点问题-帖子浏览来源入口上报缺失 https://jira.shanqu.cc/browse/GHZSCY-6545 2024-09-10 10:57:22 +08:00
21226ec96c Merge branch 'fix/GHZSCY-6588' into 'dev'
fix: 荣耀安卓14手机安装游戏跳转至浏览器 https://jira.shanqu.cc/browse/GHZSCY-6588

See merge request halo/android/assistant-android!1888
2024-09-10 10:06:55 +08:00
f932978caf fix: 荣耀安卓14手机安装游戏跳转至浏览器 https://jira.shanqu.cc/browse/GHZSCY-6588 2024-09-10 09:56:50 +08:00
803498460c Merge branch 'feat/GHZSCY-5580' into 'dev'
feat:游戏搜索页面新增分类导航—客户端 https://jira.shanqu.cc/browse/GHZSCY-5585

See merge request halo/android/assistant-android!1882
2024-09-10 09:18:36 +08:00
d32d00a4fa feat:游戏搜索页面新增分类导航—客户端 https://jira.shanqu.cc/browse/GHZSCY-5585 2024-09-10 09:18:36 +08:00
3b916a527d Merge branch 'feat/sync-va' into 'dev'
refactor: update va commit id.

See merge request halo/android/assistant-android!1887
2024-09-09 18:06:27 +08:00
51830d0e09 Merge branch 'feat/sync-va' into 'dev'
feat: 去掉Va保活通知栏,简单的为每一个游戏bindservice到va_core进程。

See merge request halo/android/assistant-android!1886
2024-09-09 18:03:25 +08:00
570e2fa9bc Revert "feat:同步商业版代码至:dbc3b8ecaca3e774b1e63f41e70b651f4acfaee1"
This reverts commit 811d42457c.
2024-09-05 15:22:32 +08:00
9e07080043 feat: 调整依赖源顺序 2024-09-04 17:03:37 +08:00
e10a329159 chore: 版本更新至 5.37.5 2024-09-04 16:00:00 +08:00
b3bc7b43f7 Merge branch 'feat/v5.37.5-1095/update-va' into 'release'
feat:同步商业版代码至:dbc3b8ecaca3e774b1e63f41e70b651f4acfaee1

See merge request halo/android/assistant-android!1875
2024-09-04 15:54:34 +08:00
811d42457c feat:同步商业版代码至:dbc3b8ecaca3e774b1e63f41e70b651f4acfaee1 2024-09-04 15:52:46 +08:00
ac0b819ea9 Merge branch 'feat/GHZSCY-6644' into 'release'
feat: 【光环助手】安装相关优化功能埋点事件的属性字段英文错误的问题 https://jira.shanqu.cc/browse/GHZSCY-6644

See merge request halo/android/assistant-android!1874
2024-09-04 15:43:47 +08:00
d931fb5940 feat: 【光环助手】安装相关优化功能埋点事件的属性字段英文错误的问题 https://jira.shanqu.cc/browse/GHZSCY-6644 2024-09-04 14:42:17 +08:00
1158 changed files with 14381 additions and 14832 deletions

View File

@ -1,161 +1,35 @@
# commit_sha 文件记录上一次成功流水线的commit sha用于定时计划检测是否有新代码提交有就执行流水线没有就终止流水线
cache:
# 不同的分支采用不同的 cache防止分支之间相互影响
key: "${CI_COMMIT_REF_SLUG}_commit_sha"
paths:
- commit_sha
policy: pull
# 将打包&发送apk包邮件job 和代码分析job 并行执行
stages:
- build&analyze
- oss-upload&send-email
- ci_sonar_mail
- docker-build && sendmail
- deploy-trigger
# 阻止了 合并请求 或 push分支和标签的流水线。 最后的 when: always 规则运行所有其他流水线类型,包括定时计划流水线。
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- when: always
before_script:
# 检查是否存在 commit_sha 文件
- if [ -f commit_sha ]; then cat commit_sha; else echo "0000000" > commit_sha; fi
- export BEFORE_COMMIT_SHA=$(cat commit_sha)
# 比较commit sha ,若与上一次成功流水线的commit sha 相同,则退出流水线
- if [ "$CI_COMMIT_SHA" == "$BEFORE_COMMIT_SHA" ] && [ "$CI_PIPELINE_SOURCE" != "web" ]; then exit 137; fi
# 使用 .post 阶段使作业在流水线的末尾运行。.post 始终是流水线的最后阶段。
change_commit:
tags:
- offline-test
stage: .post
# 此job 跳过拉取git代码
variables:
GIT_STRATEGY: none
script:
# 更新 commit_sha
- if [ "$CI_COMMIT_SHA" != "$BEFORE_COMMIT_SHA" ]; then echo $CI_COMMIT_SHA > commit_sha; fi
cache:
# 不同的分支采用不同的 cache防止分支之间相互影响
key: "${CI_COMMIT_REF_SLUG}_commit_sha"
paths:
- commit_sha
policy: pull-push
allow_failure:
exit_codes: 137
android_build:
tags:
# - local-runner
- offline-test
stage: build&analyze
image: hub.shanqu.cc/library/ci-android:jdk11-sdk31-33
resource_group: android_build
variables:
GIT_SUBMODULE_STRATEGY: recursive
KUBERNETES_CPU_LIMIT: "10"
script:
- export GRADLE_USER_HOME=/home/gitlab-runner/ci-build-cache/$CI_PROJECT_PATH/.gradle
- chmod +x ./gradlew
- ./scripts/jenkins_build.sh $CI_COMMIT_REF_NAME $BEFORE_COMMIT_SHA $CI_COMMIT_SHA
#设置打包后的产物用于job之间共享
artifacts:
paths:
- app/build/tmp/*.apk
expire_in: 48 hrs # 指定附件上载后保存的时间24h默认永久在Gitlab保存
allow_failure:
exit_codes: 137
only:
- dev
- release
- feat/GHZSCY-6578
# 代码检查
sonarqube_analysis:
tags:
- offline-test
stage: build&analyze
image: sonarsource/sonar-scanner-cli:latest
dependencies: [] #禁止传递来的artifact
script:
## 获取项目的一级组和二级组和项目名作为projectKey例如projectKey=platform-backend-eci-monitor
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
- sonar-scanner
-Dsonar.host.url=http://sonarqube-server.sonarqube:9000/
-Dsonar.login=be43de7264ce4c4766eb0c020373c3e74e6df257
-Dsonar.jacoco.reportPaths=target/jacoco.exec
-Dsonar.projectKey=$group
-Dsonar.projectName=$CI_PROJECT_PATH
-Dsonar.sourceEncoding=UTF-8
-Dsonar.exclusions=**/vendor/**,**/errcode/**
-Dsonar.gitlab.project_id=$CI_PROJECT_ID
-Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
-Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID
-Dsonar.gitlab.merge_request_discussion=true
-Dsonar.java.binaries=.
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
allow_failure:
exit_codes: 137
only:
- dev
- release
## 发送简易检测结果报告
send_sonar_report:
tags:
- offline-test
stage: ci_sonar_mail
image: hub.shanqu.cc/library/docker:latest
# 此job 跳过拉取git代码
variables:
GIT_STRATEGY: none
script:
- group=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
- docker run -e PROJECTKEY=$group -e EMAIL=$GITLAB_USER_EMAIL -e BRANCH=$CI_COMMIT_REF_NAME --name send-email --rm hub.shanqu.cc/platform/send-sonar-report:latest
allow_failure:
exit_codes: 137
only:
- dev
- release
oss-upload&send-email:
# 构建推送docker镜像
docker-build:
tags:
- sysadm-devops
stage: oss-upload&send-email
image: hub.shanqu.cc/devops/android-apk-oss-upload:latest
id_tokens:
VAULT_ID_TOKEN:
aud: https://vault.shanqu.cc
variables:
GIT_STRATEGY: none
VAULT_ADDR: https://vault.shanqu.cc # 固定值
VAULT_SECRET_PATH: prod/devops/android-apk-oss-upload # 固定值
VAULT_ROLE: android-apk-oss-upload # 固定值
ENDPOINT: "tos-cn-guangzhou.ivolces.com" # 固定值
BUCKET: "sysadm-public" # 固定值
FILE_PATH: "app/build/tmp/" # APK 存放路径
Email_To_List: $EMAIL_TO_LIST # 邮件接受人列表
Email_Title: "光环助手 $CI_COMMIT_BRANCH" # 邮件标题
PIPELINE_ID: $CI_PIPELINE_ID # 流水线id
COMMIT_BRANCH: $CI_COMMIT_BRANCH # 提交分支
MAIL_MESSAGE: "[$CI_COMMIT_AUTHOR] $CI_COMMIT_MESSAGE"
needs:
- job: android_build
artifacts: true
- offline-test
stage: docker-build && sendmail
image: hub.shanqu.cc/library/docker:latest
script:
### 绑定上传参数 ###
- export OSS_PATH="release/dev/${CI_PROJECT_NAME}/$(date "+%Y/%m/%d")"
### 开启上传 ###
- /usr/local/bin/python /upload.py
### 发送邮件
- /usr/local/bin/python /ci-android-mail-jira-comment.py
- projectPath=`echo $CI_PROJECT_PATH | sed 's#/#-#g'`
- date
- rm -rf /home/gitlab-runner/ci-build-cache/$CI_PROJECT_PATH/.gradle/caches/build-cache-1
- cp -R /home/gitlab-runner/ci-build-cache/$CI_PROJECT_PATH/.gradle .
- date
- docker build -t hub-vol.shanqu.cc/ghzs/$projectPath:latest .
- date
- docker push hub-vol.shanqu.cc/ghzs/$projectPath:latest
- date
- docker run -e PROJECTKEY=$projectPath -e EMAIL=$GITLAB_USER_EMAIL -e BRANCH=$CI_COMMIT_REF_NAME --name send-email --rm hub.shanqu.cc/platform/send-sonar-report:latest
resource_group: android_build
only:
- dev
- release
- feat/GHZSCY-6578
- feature-meta_build
## 触发多项目构建
trigger_job:
stage: deploy-trigger
variables:
BUILD_PROJECT_NAME: $CI_PROJECT_PATH
trigger:
project: devops/automation/build-eci
branch: dev
only:
- feature-meta_build

View File

@ -1,15 +1,21 @@
FROM openjdk:11-jdk
FROM hub.shanqu.cc/library/openjdk:11-jdk
WORKDIR /project
SHELL ["/bin/bash", "-c"]
#配置SDK环境变量
ENV ANDROID_SDK_ROOT /usr/lib/sdk
ENV ANDROID_HOME /usr/lib/sdk
ENV PATH $ANDROID_SDK_ROOT:$PATH
ENV PATH=$PATH:${ANDROID_HOME}/cmdline-tools/cmdline-tools/bin/
ENV GRADLE_USER_HOME /project/.gradle
RUN source ~/.bashrc
RUN sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list \
&& apt-get --quiet update --yes \
&& apt-get --quiet install --yes lib32stdc++6 lib32z1 libncurses5 util-linux bash tzdata librdkafka-dev pkgconf \
&& rm -rf /var/lib/apt/lists/*
COPY .gradle /project/.gradle
COPY .gradle /project/.gradle

View File

@ -101,6 +101,8 @@ android {
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
buildConfigField "String", "LOG_HUB_PROJECT", "\"${LOG_HUB_PROJECT}\""
buildConfigField "String", "VAPI_HOST", "\"${VAPI_HOST}\""
buildConfigField "String", "WGAME_CPM_BUSIAPPID", "\"${WGAME_CPM_BUSIAPPID}\""
buildConfigField "String", "WGAME_CPM_API_HOST", "\"${WGAME_CPM_API_HOST}\""
buildConfigField "String", "WECHAT_APPID", "\"${WECHAT_APPID}\""
buildConfigField "String", "WECHAT_SECRET", "\"${WECHAT_SECRET}\""
buildConfigField "String", "TENCENT_APPID", "\"${TENCENT_APPID}\""
@ -128,7 +130,20 @@ android {
}
packagingOptions {
// exclude 部分冗余的文件
exclude 'META-INF/gradle/incremental.annotation.processors'
exclude 'darwin/x86_64/liblz4-java.dylib'
exclude 'assets/libwbsafeedit_x86'
exclude 'assets/libwbsafeedit_x86_64'
exclude 'lib/armeabi-v7a/libRSSupport.so'
exclude 'lib/arm64-v8a/libRSSupport.so'
exclude 'lib/armeabi-v7a/librsjni.so'
exclude 'lib/arm64-v8a/librsjni.so'
resources.excludes += "com/j256/*"
resources.excludes += "org/apache/commons/codec/language/bm/*"
}
buildTypes {
@ -327,6 +342,21 @@ repositories {
}
}
// 删除不需要的 assets
android.applicationVariants.configureEach { variant ->
variant.mergeAssets.doLast {
def assetDir = variant.mergeAssetsProvider.get().outputDir.get()
def unwantedAssets = ['2011394667', 'gdt_plugin/gdtadv2.jar']
unwantedAssets.each { assetPath ->
def file = new File([assetDir, assetPath].join(File.separator))
if (file.exists()) {
file.delete()
}
}
}
}
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
@ -350,8 +380,6 @@ dependencies {
implementation "androidx.viewpager2:viewpager2:${viewpager2}"
kapt "androidx.room:room-compiler:${room}"
implementation "com.kyleduo.switchbutton:library:${switchButton}"
implementation "com.tencent.vasdolly:helper:${apkChannelPackage}"
implementation "com.tencent.vasdolly:writer:${apkChannelPackage}"
@ -374,7 +402,9 @@ dependencies {
exclude module: "gsyvideoplayer-androidvideocache"
exclude group: "tv.danmaku.ijk.media"
})
implementation "com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:$gsyVideo"
implementation ("com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:$gsyVideo") {
exclude group: 'com.google.android.exoplayer', module: 'extension-rtmp'
}
implementation "com.llew.huawei:verifier:${verifier}"

View File

@ -9,7 +9,6 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
import com.gh.gamecenter.common.exposure.meta.MetaUtil
import com.gh.gamecenter.common.utils.dip2px
@ -105,7 +104,7 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
it.layoutManager = LinearLayoutManager(requireContext())
val itemDecoration = HorizontalDividerItemDecoration.Builder(requireContext())
.size(2F.dip2px())
.color(R.color.ui_divider.toColor(requireContext()))
.color(com.gh.gamecenter.common.R.color.ui_divider.toColor(requireContext()))
.build()
if (it.itemDecorationCount != 0) {
it.removeItemDecorationAt(0)

View File

@ -7,6 +7,15 @@
<package android:name="com.gh.gamecenter" />
</queries>
<queries>
<package android:name="com.gh.toolmap" />
<intent>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="ghtoolmap"/>
</intent>
</queries>
<queries>
<package android:name="com.lg.vspace" />
<package android:name="com.gh.gamecenter.addon" />
@ -794,6 +803,12 @@
android:screenOrientation="portrait"
android:theme="@style/AppCompatTheme.APP" />
<activity
android:name=".search.SearchTabActivity"
android:configChanges="keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/AppCompatTheme.APP" />
<!-- <activity-->
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
<!-- android:launchMode="singleTask"-->

View File

@ -1 +0,0 @@
{"v":"5.6.9","fr":30,"ip":0,"op":20,"w":66,"h":66,"nm":"bottom bar tab/论坛/选中/E","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"白-修正","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":0,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":4,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":9,"s":[110,110,100]},{"t":13,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":0,"s":[{"i":[[0,-0.66],[0,0],[1.38,0],[0,1.38],[0,0],[-0.66,0],[0,0]],"o":[[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.66],[0,0],[0.66,0]],"v":[[2.5,-1.3],[2.5,0],[0,2.5],[-2.5,0],[-2.5,-1.3],[-1.3,-2.5],[1.3,-2.5]],"c":true}]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":4,"s":[{"i":[[0,-0.66],[0,0],[1.38,0],[0,1.38],[0,0],[-0.66,0],[0,0]],"o":[[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.66],[0,0],[0.66,0]],"v":[[2.5,-0.102],[2.5,0],[0,2.109],[-2.5,0],[-2.5,-0.102],[-1.3,-1.302],[1.3,-1.302]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":9,"s":[{"i":[[0,-0.66],[0,0],[1.38,0],[0,1.38],[0,0],[-0.66,0],[0,0]],"o":[[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.66],[0,0],[0.66,0]],"v":[[2.498,-1.845],[2.5,0],[0,2.734],[-2.5,0],[-2.502,-1.845],[-1.302,-3.045],[1.298,-3.045]],"c":true}]},{"t":13,"s":[{"i":[[0,-0.66],[0,0],[1.38,0],[0,1.38],[0,0],[-0.66,0],[0,0]],"o":[[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.66],[0,0],[0.66,0]],"v":[[2.5,-1.3],[2.5,0],[0,2.5],[-2.5,0],[-2.5,-1.3],[-1.3,-2.5],[1.3,-2.5]],"c":true}]}],"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":150,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"蓝","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33.76,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.8,0.42],[-3.44,-0.79],[-0.09,-1.71],[0,0],[0,0],[1.98,-0.1],[0,0],[0,0],[0,0],[0.62,0.57],[0,0],[0,0],[0,0],[0,0],[0,0],[0.2,1.89],[0,0],[0,0],[0,0]],"o":[[3.44,-0.79],[1.74,0.41],[0,0],[0,0],[0,2],[0,0],[0,0],[0,0],[-0.69,0.52],[0,0],[0,0],[0,0],[0,0],[0,0],[-1.94,0],[0,0],[0,0],[0,0],[0,-1.8]],"v":[[-6.39,-8.971],[6.39,-8.971],[9.49,-5.471],[9.5,-5.271],[9.5,3.249],[5.95,6.989],[5.75,6.999],[3.25,6.999],[0.3,9.209],[-1.95,9.089],[-2.06,8.969],[-2.17,8.849],[-2.21,8.779],[-3.4,6.999],[-5.75,6.999],[-9.48,3.639],[-9.49,3.449],[-9.5,3.249],[-9.5,-5.271]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"bm":0,"g":{"p":3,"k":{"a":0,"k":[0,0.266,0.638,1,0.5,0.242,0.595,1,1,0.217,0.552,1],"ix":9}},"s":{"a":0,"k":[-9.5,-9.561],"ix":5},"e":{"a":0,"k":[9.5,9.561],"ix":6},"t":1,"nm":"color","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"路径","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":150,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"预合成 1","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33,0],"ix":2},"a":{"a":0,"k":[33,33,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":0,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":4,"s":[70,70,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":9,"s":[110,110,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":13,"s":[90,90,100]},{"t":16,"s":[100,100,100]}],"ix":6}},"ao":0,"w":66,"h":66,"ip":0,"op":20,"st":0,"bm":0}],"markers":[]}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"v":"5.5.9","fr":30,"ip":0,"op":20,"w":66,"h":66,"nm":"tab_video","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"形状图层 1","parent":2,"sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.771],"y":[0]},"t":0,"s":[0]},{"t":5,"s":[100]}],"ix":11},"r":{"a":0,"k":90,"ix":10},"p":{"a":0,"k":[-3.742,6.835,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[30.937,31.042,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"sr","sy":2,"d":1,"pt":{"a":0,"k":3,"ix":3},"p":{"a":0,"k":[0,0],"ix":4},"r":{"a":0,"k":0,"ix":5},"or":{"a":0,"k":29.286,"ix":7},"os":{"a":0,"k":75,"ix":9},"ix":1,"nm":"多边星形路径 1","mn":"ADBE Vector Shape - Star","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":13,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[-20.75,-13.25],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[102.743,88.578],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"多边星形 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.657],"y":[0]},"t":0,"s":[0]},{"t":8,"s":[100]}],"ix":2},"o":{"a":0,"k":-115,"ix":3},"m":1,"ix":2,"nm":"修剪路径 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":60,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"路径 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33.004,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.508,0.508,0.333],"y":[0,0,0]},"t":0,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.488,0.488,0.333],"y":[0,0,0]},"t":4,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.502,0.502,0.333],"y":[0,0,0]},"t":9,"s":[110,110,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.534,0.534,0.333],"y":[0,0,0]},"t":13,"s":[95,95,100]},{"t":16,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[2.16,0.38],[3.22,-0.55],[0.38,-2.16],[-0.55,-3.22],[-2.16,-0.38],[-1.63,0],[-1.61,0.27],[-0.38,2.16],[0.55,3.22]],"o":[[-0.38,-2.16],[-3.22,-0.55],[-2.16,0.38],[-0.55,3.22],[0.38,2.16],[1.61,0.27],[1.63,0],[2.16,-0.38],[0.55,-3.22],[0,0]],"v":[[9.09,-4.86],[4.86,-9.09],[-4.86,-9.09],[-9.09,-4.86],[-9.09,4.86],[-4.86,9.09],[0,9.5],[4.86,9.09],[9.09,4.86],[9.09,-4.86]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"bm":0,"g":{"p":3,"k":{"a":0,"k":[0,0.266,0.638,1,0.5,0.242,0.595,1,1,0.217,0.552,1],"ix":9}},"s":{"a":0,"k":[-5.174,-4.43],"ix":5},"e":{"a":0,"k":[8.612,8.214],"ix":6},"t":1,"nm":"Gradient Fill 3","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"路径","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60,"st":0,"bm":0}],"markers":[]}

View File

@ -588,7 +588,7 @@ document.addEventListener("selectionchange", function(e) {
});
document.addEventListener("selectionchange", function(e) {
RE.enabledEditingItems(e)
setTimeout(() => RE.enabledEditingItems(e), 10)
});
RE.recursion = function(dom) {

View File

@ -28,6 +28,7 @@ import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.provider.ICsjAdProvider
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.SPUtils
@ -78,6 +79,19 @@ object AdDelegateHelper {
var gameSearchKeyword = ""
fun initAdSdk(context: Context) {
if (AdPluginDownloadHelper.isCsjPluginDownloaded()) {
initAdSdkInternal(context)
} else {
// 首次启动,为了不影响首页加载,延迟 3 秒再下载广告插件并初始化
AppExecutor.uiExecutor.executeWithDelay({
AdPluginDownloadHelper.downloadPluginIfNeeded(isCsj = true) {
initAdSdkInternal(context)
}
}, 3000L)
}
}
private fun initAdSdkInternal(context: Context) {
// 初始化穿山甲
if (mCsjAdImpl == null) {
mCsjAdImpl =

View File

@ -0,0 +1,149 @@
package com.gh.ad
import com.gh.download.simple.DownloadMessageHandler
import com.gh.download.simple.SimpleDownloadDatabase
import com.gh.download.simple.SimpleDownloadManager
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.PluginRedirectHelper
import com.gh.gamecenter.core.utils.SPUtils
import com.lg.download.DownloadError
import com.lg.download.DownloadStatus
import com.lg.download.httpclient.DefaultHttpClient
import com.lg.download.listener.InnerDownloadListener
import com.lg.ndownload.DownloadConfig
import com.lg.ndownload.DownloadConfigBuilder
import com.lg.ndownload.DownloadIoExecutor
import com.lightgame.utils.Utils
import java.lang.Exception
import java.net.URLConnection
object AdPluginDownloadHelper : InnerDownloadListener {
private const val CSJ_FILE_NAME = "2011394667"
private const val GDT_FILE_NAME = "gdt_plugin/gdtadv2.jar"
private const val CSJ_PLUGIN_URL = "https://and-static.ghzs66.com/android/static/2011394667"
private const val GDT_PLUGIN_URL = "https://and-static.ghzs66.com/android/static/gdtadv2.jar"
private var csjDownloadedCallback: (() -> Unit)? = null
/**
* 是否已经下载了广告插件
*/
fun isCsjPluginDownloaded(): Boolean {
return SPUtils.getBoolean(CSJ_FILE_NAME, false)
}
/**
* 下载广告插件并初始化 (初始化限定穿山甲)
*/
fun downloadPluginIfNeeded(isCsj: Boolean = false, isGdt: Boolean = false, csjCallback: (() -> Unit)? = null) {
val isCsjPluginDownloaded = SPUtils.getBoolean(CSJ_FILE_NAME, false)
val isGdtPluginDownloaded = SPUtils.getBoolean(GDT_FILE_NAME, false)
if (isCsj && isCsjPluginDownloaded) {
csjCallback?.invoke()
return
}
if (isGdt && isGdtPluginDownloaded) {
return
}
runOnIoThread {
csjDownloadedCallback = csjCallback
DownloadMessageHandler.init(SimpleDownloadDatabase.instance.downloadDao())
if (!isCsjPluginDownloaded && isCsj) {
val csjPluginConfig = DownloadConfigBuilder()
.setUniqueId(CSJ_FILE_NAME)
.setUrl(CSJ_PLUGIN_URL)
.setFileName(CSJ_FILE_NAME)
.setHttpClient(DefaultHttpClient())
.setDownloadThreadSize(2)
.setPathToStore(PluginRedirectHelper.getAssetDir())
.setDownloadExecutor(DownloadIoExecutor.getInstance())
.setDownloadListener(this).build()
SimpleDownloadManager.download(csjPluginConfig)
}
if (!isGdtPluginDownloaded && isGdt) {
val gdtPluginConfig = DownloadConfigBuilder()
.setUniqueId(GDT_FILE_NAME)
.setUrl(GDT_PLUGIN_URL)
.setFileName(GDT_FILE_NAME)
.setHttpClient(DefaultHttpClient())
.setDownloadThreadSize(2)
.setPathToStore(PluginRedirectHelper.getAssetDir())
.setDownloadExecutor(DownloadIoExecutor.getInstance())
.setDownloadListener(this).build()
SimpleDownloadManager.download(gdtPluginConfig)
}
}
}
override fun onError(id: String?, error: DownloadError?, exception: Exception?) {
Utils.log("下载广告插件失败 $id")
id?.let {
if (it == CSJ_FILE_NAME) {
csjDownloadedCallback = null
}
SimpleDownloadManager.cancel(it)
}
}
override fun onProgress(id: String?, progress: Float) {
Utils.log("下载广告插件进度 $id $progress")
}
override fun onProgressWithoutThrottle(id: String?, progress: Float) {
// do nothing
}
override fun onSizeReceived(id: String?, fileSize: Long) {
// do nothing
}
override fun onReadyToDownload(id: String?, actualThreadSize: Int) {
// do nothing
}
override fun onStatusChanged(id: String?, status: DownloadStatus?) {
// do nothing
}
override fun onDownloadComplete(id: String?, elapsedTime: Long) {
id?.let {
// id 即为插件名
SPUtils.setBoolean(it, true)
if (it == CSJ_FILE_NAME) {
csjDownloadedCallback?.invoke()
csjDownloadedCallback = null
}
}
}
override fun onSpeedChanged(id: String?, speed: Float) {
// do nothing
}
override fun onRedirectingUrl(
id: String?,
connection: URLConnection?,
config: DownloadConfig?
) {
// do nothing
}
override fun onRedirectedUrl(
id: String?,
connection: URLConnection?,
redirectedUrl: String?
) {
// do nothing
}
}

View File

@ -236,7 +236,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
mKeyboardHeightProvider = KeyboardHeightProvider(this)
mRichEditor.post { mKeyboardHeightProvider?.start() }
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
mRichEditor.setEditorBackgroundColor(R.color.ui_surface.toColor(this))
mRichEditor.setEditorBackgroundColor(com.gh.gamecenter.common.R.color.ui_surface.toColor(this))
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
// 防止个别手机在Js里无法获取粘贴内容
mRichEditor.addJavascriptInterface(OnPasteListener(), "onPasteListener")
@ -800,9 +800,9 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
override fun onDarkModeChanged() {
super.onDarkModeChanged()
updateStatusBarColor(R.color.ui_surface, R.color.ui_surface)
updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
mRichEditor.setEditorBackgroundColor(R.color.ui_surface.toColor(this))
mRichEditor.setEditorBackgroundColor(com.gh.gamecenter.common.R.color.ui_surface.toColor(this))
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
}

View File

@ -10,7 +10,6 @@ import android.text.TextUtils
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
import com.gh.gamecenter.common.entity.ErrorEntity
import com.gh.gamecenter.common.retrofit.BiResponse
@ -84,7 +83,7 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
val application: Application = getApplication()
Utils.toast(
getApplication(),
application.getString(R.string.pic_max_hint, count)
application.getString(com.gh.gamecenter.common.R.string.pic_max_hint, count)
)
continue
}

View File

@ -256,7 +256,7 @@ class DefaultJsApi(
@JavascriptInterface
fun isInstalled(event: Any): String {
val localInstalledPackageList = PackageUtils.getAllPackageName(HaloApp.getInstance().application)
val localInstalledPackageList = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
val packageNameList: ArrayList<String> = event.toString().toObject() ?: ArrayList()
for (packageName in packageNameList) {
@ -555,7 +555,7 @@ class DefaultJsApi(
@JavascriptInterface
fun getInstallStatus(event: Any): String {
val localInstalledPackageList = PackageUtils.getAllPackageName(HaloApp.getInstance().application)
val localInstalledPackageList = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
val packageNameList: ArrayList<String> = event.toString().toObject() ?: ArrayList()
val installStatusMap: HashMap<String, Boolean> = hashMapOf()

View File

@ -374,7 +374,7 @@ object DefaultUrlHandler {
val iconSubscript = uri.getQueryParameter("game_icon_subscript") ?: ""
val gameEntity =
if (forumType == BbsType.OFFICIAL_BBS.value && gameId.isNotEmpty() && gameName.isNotEmpty() && icon.isNotEmpty()) {
GameEntity(id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
GameEntity(_id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
} else null
val activityLabelEntity = if (activityId.isNotEmpty() && activityName.isNotEmpty()) {
ActivityLabelEntity(

View File

@ -30,7 +30,7 @@ class VersionNumberHandler : DownloadChainHandler() {
"温馨提示",
gameEntity.getVersionNumberString(),
"继续下载",
R.string.cancel.toResString(),
com.gh.gamecenter.common.R.string.cancel.toResString(),
{
confirmCallback.invoke()
SensorsBridge.trackGameDemoDialogClick(
@ -42,7 +42,7 @@ class VersionNumberHandler : DownloadChainHandler() {
},
cancelClickCallback = {
SensorsBridge.trackGameDemoDialogClick(
buttonName = R.string.cancel.toResString(),
buttonName = com.gh.gamecenter.common.R.string.cancel.toResString(),
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese

View File

@ -26,6 +26,7 @@ import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.entity.AppEntity;
import com.gh.gamecenter.entity.FloatWindowSettingEntity;
import com.gh.gamecenter.entity.GameGuidePopupEntity;
import com.gh.gamecenter.entity.NewApiSettingsEntity;
import com.gh.gamecenter.entity.NewSettingsEntity;
@ -62,6 +63,9 @@ public class Config {
public static final String NEW_API_HOST = EnvHelper.getNewHost();
public static final String VAPI_HOST = EnvHelper.getVHost();
public static final String WGAME_CPM_BUSIAPPID = BuildConfig.WGAME_CPM_BUSIAPPID;
public static final String WGAME_CPM_API_HOST = EnvHelper.getWGameCPMHost();
// Third-Party confs
public static final String WECHAT_APPID = BuildConfig.WECHAT_APPID;
public static final String WECHAT_SECRET = BuildConfig.WECHAT_SECRET;
@ -82,6 +86,8 @@ public class Config {
private static VSetting mVSetting;
private volatile static VNewSetting mVNewSetting;
private static FloatWindowSettingEntity mFloatWindowSetting;
private static AppEntity mNew32UpdateEntity;
private static BehaviorSubject<VNewSetting> vNewSettingSubject = BehaviorSubject.create();
private static GameGuidePopupEntity mGameGuidePopupEntity;
@ -213,6 +219,21 @@ public class Config {
}
return mVNewSetting;
}
@Nullable
public static FloatWindowSettingEntity getFloatWindowSettingEntity() {
if (mFloatWindowSetting == null) {
try {
String json = SPUtils.getString(Constants.SP_FLOAT_WINDOW_SETTINGS);
if (!TextUtils.isEmpty(json)) {
mFloatWindowSetting = GsonUtils.fromJson(json, FloatWindowSettingEntity.class);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return mFloatWindowSetting;
}
@NonNull
public static Observable<VNewSetting> getVNewSettingObservable() {
@ -330,6 +351,7 @@ public class Config {
refreshVSettingEntity();
getNewSetting();
getFloatWindowSetting();
RetrofitManager.getInstance()
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)
@ -408,6 +430,20 @@ public class Config {
}
}
@SuppressLint("CheckResult")
private static void getFloatWindowSetting() {
RetrofitManager.getInstance().getNewApi()
.getFloatWindowSettings()
.subscribeOn(Schedulers.io())
.subscribe(new BiResponse<FloatWindowSettingEntity>() {
@Override
public void onSuccess(FloatWindowSettingEntity data) {
mFloatWindowSetting = data;
SPUtils.setString(Constants.SP_FLOAT_WINDOW_SETTINGS, GsonUtils.toJson(data));
}
});
}
public static void observePackageChange(NewApiSettingsEntity.PackageObserveActions packageObserveActions) {
PackageChangeBroadcastReceiver receiver = new PackageChangeBroadcastReceiver(packageObserveActions);
IntentFilter intentFilter = new IntentFilter();

View File

@ -120,14 +120,14 @@ object AddKaiFuBindingAdapter {
@BindingAdapter("kaiFuTextColor", "kaiFuTextPosition")
fun kaiFuTextColor(view: EditText, dataMark: Int, position: Int) {
if (dataMark == 1 && view.id == R.id.kaifu_add_time || dataMark == 2 && view.id == R.id.kaifu_add_first_name || dataMark == 3 && view.id == R.id.kaifu_add_server_name || dataMark == 4) {
view.setTextColor(ContextCompat.getColor(view.context, R.color.secondary_red))
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.secondary_red))
view.setTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.secondary_red))
view.setHintTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.secondary_red))
} else if (position == 0) {
view.setTextColor(ContextCompat.getColor(view.context, R.color.hint))
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.hint))
view.setTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.hint))
view.setHintTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.hint))
} else {
view.setTextColor(ContextCompat.getColor(view.context, R.color.text_primary))
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.hint))
view.setTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.text_primary))
view.setHintTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.hint))
}
}
@ -176,7 +176,7 @@ object AddKaiFuBindingAdapter {
popupWindow.isTouchable = true
popupWindow.inputMethodMode = PopupWindow.INPUT_METHOD_NEEDED
popupWindow.isOutsideTouchable = true
popupWindow.animationStyle = R.style.popwindow_option_anim_style
popupWindow.animationStyle = com.gh.gamecenter.common.R.style.popwindow_option_anim_style
// 设置偏移
windowPos[1] = windowPos[1] - 12F.dip2px()

View File

@ -27,7 +27,6 @@ import com.gh.common.chain.PackageCheckHandler;
import com.gh.common.chain.UnsupportedFeatureHandler;
import com.gh.common.chain.ValidateVSpaceHandler;
import com.gh.common.chain.VersionNumberHandler;
import com.gh.common.constant.Config;
import com.gh.common.filter.RegionSetting;
import com.gh.common.filter.RegionSettingHelper;
import com.gh.common.history.HistoryHelper;
@ -53,7 +52,6 @@ import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.FileUtils;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.utils.MtaHelper;
@ -296,7 +294,7 @@ public class BindingAdapters {
});
});
} else {
ReservationHelper.showCancelReservationDialog(progressBar.getContext(), () -> {
ReservationHelper.showCancelReservationDialog(progressBar.getContext(),gameEntity, () -> {
ReservationHelper.cancelReservation(gameEntity, () -> {
updateReservation(progressBar, gameEntity);
});
@ -389,7 +387,7 @@ public class BindingAdapters {
case diskisfull:
case diskioerror:
case waiting:
progressBar.setText(R.string.downloading);
progressBar.setText(com.gh.gamecenter.feature.R.string.downloading);
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
progressBar.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
} else {
@ -397,7 +395,7 @@ public class BindingAdapters {
}
break;
case done:
progressBar.setText(R.string.install);
progressBar.setText(com.gh.gamecenter.feature.R.string.install);
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
progressBar.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_PLUGIN);
@ -555,15 +553,15 @@ public class BindingAdapters {
gameName = String.format("%s - %s", game.getName(),
PlatformUtils.getInstance(view.getContext()).getPlatformName(
game.getApk().get(0).getPlatform()));
if (!gameName.equals((String) view.getTag(R.string.tag_game_name_id))) {
if (!gameName.equals((String) view.getTag(com.gh.gamecenter.common.R.string.tag_game_name_id))) {
view.setText(gameName);
view.setTag(R.string.tag_game_name_id, gameName);
view.setTag(com.gh.gamecenter.common.R.string.tag_game_name_id, gameName);
}
} else {
gameName = game.getName();
if (gameName != null && !gameName.equals((String) view.getTag(R.string.tag_game_name_id))) {
if (gameName != null && !gameName.equals((String) view.getTag(com.gh.gamecenter.common.R.string.tag_game_name_id))) {
view.setText(gameName);
view.setTag(R.string.tag_game_name_id, gameName);
view.setTag(com.gh.gamecenter.common.R.string.tag_game_name_id, gameName);
}
}

View File

@ -7,7 +7,6 @@ import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.dip2px
@ -49,7 +48,7 @@ class ApplyModeratorDialogFragment : BaseDialogFragment() {
requireContext(),
startText.length,
startText.length + mGroupNumber.length,
R.color.text_theme,
com.gh.gamecenter.common.R.color.text_theme,
true
) {
DirectUtils.directToQqGroup(

View File

@ -40,7 +40,7 @@ import java.lang.ref.WeakReference
* 设备提醒弹窗
*/
class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val gameEntity: GameEntity) :
Dialog(context, R.style.GhAlertDialog) {
Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog) {
private val mBinding: DialogDeviceRemindBinding by lazy { DialogDeviceRemindBinding.inflate(layoutInflater) }
private var currentPage = 0
private var mSlideLooperInterval = 3000L
@ -136,13 +136,13 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
val isFirst = SPUtils.getBoolean(Constants.SP_FIRST_DEVICE_REMIND, false)
if (!isFirst) {
mBinding.cancelTv.isEnabled = false
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_round_f5f5f5)
mBinding.cancelTv.background = ContextCompat.getDrawable(context, com.gh.gamecenter.common.R.drawable.button_round_f5f5f5)
disposable = countDownTimer(3) { finish, time ->
if (finish) {
mBinding.cancelTv.isEnabled = true
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
mBinding.cancelTv.background = ContextCompat.getDrawable(context, com.gh.gamecenter.common.R.drawable.button_blue_oval)
mBinding.cancelTv.text = "我知道了"
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.white))
} else {
mBinding.cancelTv.text = "我知道了(${time}S)"
}
@ -153,8 +153,8 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
mBinding.noRemindAgainCb.visibility = View.VISIBLE
mBinding.cancelTv.text = "我知道了"
mBinding.cancelTv.isEnabled = true
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.white))
mBinding.cancelTv.background = ContextCompat.getDrawable(context, com.gh.gamecenter.common.R.drawable.button_blue_oval)
}
mBinding.cancelTv.setOnClickListener {
SPUtils.setBoolean(Constants.SP_NO_REMIND_AGAIN, mBinding.noRemindAgainCb.isChecked)

View File

@ -14,7 +14,6 @@ import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DialogGameOffServiceBinding
import com.gh.gamecenter.feature.entity.GameEntity
@ -62,7 +61,7 @@ class GameOffServiceDialogFragment : BaseDialogFragment() {
if (index == notEmptySite.size - 1) bottomMargin = 8F.dip2px()
}
siteTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14F)
siteTv.setTextColor(R.color.text_theme.toColor(requireContext()))
siteTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(requireContext()))
siteTv.text = site.text
siteTv.paintFlags = siteTv.paintFlags or Paint.UNDERLINE_TEXT_FLAG
siteTv.setOnClickListener {

View File

@ -76,12 +76,12 @@ class NewPrivacyPolicyDialogFragment : BaseDialogFragment() {
contentText.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
ds.color = ContextCompat.getColor(requireContext(), com.gh.gamecenter.common.R.color.text_theme)
ds.isUnderlineText = false
}
override fun onClick(widget: View) {
val privacyPolicyUrl = requireContext().getString(R.string.privacy_policy_url)
val privacyPolicyUrl = requireContext().getString(com.gh.gamecenter.common.R.string.privacy_policy_url)
val childrenPrivacyPolicyUrl = requireContext().getString(R.string.children_policy_url)
val thirdPartySdkUrl = requireContext().getString(R.string.sdk_list_url)
val permissionListUrl = requireContext().getString(R.string.permission_and_usage_url)

View File

@ -22,7 +22,6 @@ import com.gh.common.util.LogUtils
import com.gh.common.util.PackageHelper
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.Constants
@ -126,7 +125,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
requireContext(),
0,
(link.title ?: "").length,
R.color.text_theme,
com.gh.gamecenter.common.R.color.text_theme,
true
) {
LogUtils.uploadPackageCheck(
@ -285,7 +284,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
if (it >= mDuration) {
mDisposable?.dispose()
binding.downloadBtn.isEnabled = true
binding.downloadBtn.background = R.drawable.bg_notification_open_btn_style_2.toDrawable()
binding.downloadBtn.background = com.gh.gamecenter.common.R.drawable.bg_notification_open_btn_style_2.toDrawable()
}
}
val animator = ValueAnimator.ofInt(0, 100)
@ -392,10 +391,10 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
val isAllInstalled = checkDetectionsInstalled(mAllInstalledPackages, entity.packages)
if (isAllInstalled) {
holder.binding.statusTv.text = "已安装"
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme))
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme))
} else {
holder.binding.statusTv.text = "未安装"
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.secondary_red))
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.secondary_red))
}
holder.binding.statusTv.visibility = View.VISIBLE
} else {

View File

@ -12,7 +12,6 @@ import android.view.*
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentTransaction
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.constant.Constants
@ -68,13 +67,13 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
skipText.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
ds.color = ContextCompat.getColor(requireContext(), com.gh.gamecenter.common.R.color.text_theme)
ds.isUnderlineText = false
}
override fun onClick(widget: View) {
val intent =
WebActivity.getIntent(requireContext(), context!!.getString(R.string.privacy_policy_url), true)
WebActivity.getIntent(requireContext(), context!!.getString(com.gh.gamecenter.common.R.string.privacy_policy_url), true)
context?.startActivity(intent)
}
}, skipText.length - 6, skipText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
@ -110,13 +109,13 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
skipText.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
ds.color = ContextCompat.getColor(requireContext(), com.gh.gamecenter.common.R.color.text_theme)
ds.isUnderlineText = false
}
override fun onClick(widget: View) {
val intent =
WebActivity.getIntent(requireContext(), context!!.getString(R.string.privacy_policy_url), true)
WebActivity.getIntent(requireContext(), context!!.getString(com.gh.gamecenter.common.R.string.privacy_policy_url), true)
context?.startActivity(intent)
}
}, skipText.length - 9, skipText.length - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
@ -124,12 +123,12 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
skipText.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
ds.color = ContextCompat.getColor(requireContext(), com.gh.gamecenter.common.R.color.text_theme)
ds.isUnderlineText = false
}
override fun onClick(widget: View) {
val intent = WebActivity.getIntent(requireContext(), context!!.getString(R.string.disclaimer_url), true)
val intent = WebActivity.getIntent(requireContext(), context!!.getString(com.gh.gamecenter.common.R.string.disclaimer_url), true)
context?.startActivity(intent)
}
}, skipText.length - 4, skipText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)

View File

@ -1,27 +1,42 @@
package com.gh.common.dialog
import android.content.Context
import android.content.DialogInterface
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.exposure.ExposureListener
import com.gh.common.exposure.IExposable
import com.gh.gamecenter.DownloadManagerActivity
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.fromHtml
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.FixLinearLayoutManager
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils.getBoolean
import com.gh.gamecenter.databinding.DialogReserveBinding
import com.gh.gamecenter.databinding.DialogReserveItemBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.ReserveOnlineEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.mygame.MyGameActivity
import com.halo.assistant.HaloApp
import com.lightgame.adapter.BaseRecyclerAdapter
class ReserveDialog : BaseDialogFragment() {
private lateinit var mReserveList: List<SimpleGameEntity>
private lateinit var reserveOnlineEntity: ReserveOnlineEntity
val games: List<GameEntity>
get() = reserveOnlineEntity.games
private var mDismissListener: (() -> Unit)? = null
override fun onCreate(savedInstanceState: Bundle?) {
@ -36,66 +51,162 @@ class ReserveDialog : BaseDialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
val binding: DialogReserveBinding = DialogReserveBinding.inflate(layoutInflater, null, false)
mReserveList = arguments?.getParcelableArrayList(RESERVE_LIST) ?: arrayListOf()
reserveOnlineEntity = arguments?.getParcelable(RESERVE_ONLINE) ?: ReserveOnlineEntity()
binding.title.text = resources.getString(R.string.dialog_reserve_title, mReserveList.size).fromHtml()
binding.more.visibility = if (mReserveList.size > 4) {
View.VISIBLE
} else View.GONE
binding.more.setOnClickListener {
binding.tvTitle.text =
resources.getString(R.string.dialog_reserve_title, reserveOnlineEntity.gamesTotal).fromHtml()
binding.tvViewAllAppointment.setOnClickListener {
SensorsBridge.trackAppointmentGameOnlineDialogClick(buttonName = "查看全部预约")
val intent = MyGameActivity.getIntentWithConfig(requireContext(), MyGameActivity.RESERVATION_INDEX)
startActivity(intent)
}
val adapter = ReserveDialogAdapter(requireContext(), games)
binding.rvGames.layoutManager = FixLinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
binding.rvGames.adapter = adapter
val exposureListener = ExposureListener(this, adapter)
binding.rvGames.addOnScrollListener(exposureListener)
binding.ivClose.setOnClickListener {
dismissAllowingStateLoss()
}
binding.recyclerView.layoutManager = if (mReserveList.size > 4) {
GridLayoutManager(context, 4)
} else {
FixLinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
}
binding.recyclerView.adapter = object : BaseRecyclerAdapter<ReserveDialogItemViewHolder>(context) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReserveDialogItemViewHolder {
val inflate = mLayoutInflater.inflate(R.layout.dialog_reserve_item, parent, false)
return ReserveDialogItemViewHolder(DialogReserveItemBinding.bind(inflate))
}
override fun getItemCount(): Int {
return if (mReserveList.size > 4) 4 else mReserveList.size
}
override fun onBindViewHolder(holder: ReserveDialogItemViewHolder, position: Int) {
val entity = mReserveList[position]
ImageUtils.display(holder.binding.icon, entity.icon)
holder.binding.gameNameTv.text = entity.name
holder.itemView.setOnClickListener {
GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(预约弹窗)")
dismissAllowingStateLoss()
}
}
}
checkHasAutoDownload(binding)
dialog?.setCanceledOnTouchOutside(true)
return binding.root
}
private fun checkHasAutoDownload(binding: DialogReserveBinding) {
if (reserveOnlineEntity.wifiAutoDownloadTotal > 0) {
// 开启自动下载
binding.tvAutoDownloadTips.goneIf(false)
var firstAutoDownloadGameName =
reserveOnlineEntity.games.find { it.wifiAutoDownload && !it.isLandPageAddressDialog() }?.name
if(!firstAutoDownloadGameName.isNullOrBlank() && firstAutoDownloadGameName.length > GAME_NAME_SHOW_MAX_LENGTH){
firstAutoDownloadGameName = "${firstAutoDownloadGameName.take(GAME_NAME_SHOW_MAX_LENGTH-1)}..."
}
val isWifiOpen = NetworkUtils.isWifiConnected(HaloApp.getInstance())
binding.tvAutoDownloadTips.text =
if (isWifiOpen) {
if (firstAutoDownloadGameName.isNullOrBlank()) {
getString(
R.string.reserve_reminder_auto_download,
"${reserveOnlineEntity.wifiAutoDownloadTotal}"
)
} else {
getString(
R.string.reserve_reminder_auto_download_with_name,
firstAutoDownloadGameName,
"${reserveOnlineEntity.wifiAutoDownloadTotal}"
)
}
} else {
if (firstAutoDownloadGameName.isNullOrBlank()) {
getString(
R.string.reserve_reminder_wait_for_wifi_to_auto_download,
"${reserveOnlineEntity.wifiAutoDownloadTotal}"
)
} else {
getString(
R.string.reserve_reminder_wait_for_wifi_to_auto_download_with_name,
firstAutoDownloadGameName,
"${reserveOnlineEntity.wifiAutoDownloadTotal}"
)
}
}
binding.tvAutoDownloadTips.setOnClickListener {
SensorsBridge.trackAppointmentGameOnlineDialogClick(buttonName = "查看进度")
val intent = DownloadManagerActivity.getDownloadMangerIntent(requireContext(), "")
startActivity(intent)
}
} else {
binding.tvAutoDownloadTips.goneIf(true)
}
}
fun setOnDismissListener(dismissListener: () -> Unit) {
mDismissListener = dismissListener
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
SensorsBridge.trackAppointmentGameOnlineDialogClick(buttonName = "关闭弹窗")
}
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val params = it.attributes
params.width = DisplayUtils.dip2px(300F)
it.attributes = params
}
}
override fun onDestroy() {
super.onDestroy()
mDismissListener?.invoke()
}
companion object {
const val RESERVE_LIST = "reserve_list"
const val RESERVE_ONLINE = "reserve_online"
private const val GAME_NAME_SHOW_MAX_LENGTH = 8
@JvmStatic
fun getInstance(reserveList: List<SimpleGameEntity>) = ReserveDialog().apply {
arguments = Bundle()
arguments?.putParcelableArrayList(RESERVE_LIST, ArrayList(reserveList))
fun getInstance(reserveOnlineEntity: ReserveOnlineEntity?) = ReserveDialog().apply {
arguments = Bundle().apply {
putParcelable(RESERVE_ONLINE, reserveOnlineEntity)
}
}
}
}
class ReserveDialogAdapter(
context: Context,
private val games: List<GameEntity>
) :
BaseRecyclerAdapter<ReserveDialogItemViewHolder>(context), IExposable {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReserveDialogItemViewHolder {
return ReserveDialogItemViewHolder(parent.toBinding())
}
override fun getItemCount(): Int {
return if (games.size > 8) 8 else games.size
}
override fun onBindViewHolder(holder: ReserveDialogItemViewHolder, position: Int) {
val entity = games[position]
holder.binding.icon.displayGameIcon(entity)
holder.binding.gameNameTv.text = entity.name
holder.itemView.setOnClickListener {
SensorsBridge.trackAppointmentGameOnlineDialogClick(
"游戏",
entity.id,
entity.name ?: "",
entity.categoryChinese,
)
GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(预约弹窗)", entity.exposureEvent)
}
entity.exposureEvent = ExposureEvent.createEvent(
entity,
listOf(ExposureSource("预约上线弹窗", ""))
)
}
override fun getEventByPosition(pos: Int): ExposureEvent? {
return games.getOrNull(pos)?.exposureEvent
}
override fun getEventListByPosition(pos: Int): List<ExposureEvent>? {
return null
}
}
class ReserveDialogItemViewHolder(val binding: DialogReserveItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)

View File

@ -0,0 +1,278 @@
package com.gh.common.dialog
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.text.InputFilter
import android.view.LayoutInflater
import androidx.core.widget.addTextChangedListener
import com.gh.gamecenter.R
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.databinding.DialogReserveReminderPhoneNumberBinding
import com.gh.gamecenter.entity.ReserveModifyEntity
import com.gh.gamecenter.entity.ValidateCodeResponse
import com.halo.assistant.fragment.reserve.OnReserveReminderListener
import com.halo.assistant.fragment.reserve.ReserveReminderRepository
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
import org.json.JSONObject
import retrofit2.HttpException
import java.util.concurrent.TimeUnit
class ReserveReminderPhoneNumberDialog(
context: Context,
themeResId: Int,
private val dialogType: Int,
private val phoneNumber: String,
private var serviceId: String,
private val gameId: String,
private val repository: ReserveReminderRepository,
private val listener: OnReserveReminderListener
) :
Dialog(context, themeResId) {
private val compositeDisposable = CompositeDisposable()
private lateinit var binding: DialogReserveReminderPhoneNumberBinding
private var hasValidated = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DialogReserveReminderPhoneNumberBinding.inflate(LayoutInflater.from(context))
setContentView(binding.root)
initView()
}
private fun initView() {
binding.vClose.setOnClickListener {
dismiss()
}
setSubmitState(phoneNumber)
binding.etInput.addTextChangedListener {
val content = binding.etInput.text?.toString() ?: ""
if (dialogType == DIALOG_TYPE_BIND_PHONE || dialogType == DIALOG_TYPE_CHANGE_PHONE) {
setSubmitState(content)
} else {
val length = content.length
if (length == VALIDATE_CODE_LENGTH) {
verifyPhoneNumber(content)
}
}
}
when (dialogType) {
DIALOG_TYPE_BIND_PHONE -> {
binding.tvTitle.setText(R.string.enable_sms_reminder)
binding.tvDescription.setText(R.string.enable_sms_reminder_description)
binding.etInput.setText(phoneNumber)
binding.etInput.setHint(com.gh.gamecenter.login.R.string.input_phone_hint)
}
DIALOG_TYPE_CHANGE_PHONE -> {
binding.tvTitle.setText(R.string.change_phone_number_2)
binding.tvDescription.setText(R.string.enable_sms_reminder_description)
binding.etInput.setText(phoneNumber)
binding.etInput.setHint(com.gh.gamecenter.login.R.string.input_phone_hint)
}
DIALOG_TYPE_VERIFY_PHONE -> {
startCountDown()
binding.tvTitle.setText(R.string.please_input_sms_verify_code)
if (phoneNumber.length == PHONE_NUMBER_LENGTH) {
val phoneNumberWithMask = phoneNumber.substring(0, 3) + MASK + phoneNumber.substring(7)
binding.tvDescription.text =
context.getString(R.string.verify_code_send_with_phone_number, phoneNumberWithMask)
}
binding.tvSubmit.alpha = 1.0F
binding.etInput.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(VALIDATE_CODE_LENGTH))
binding.etInput.setHint(R.string.please_input_verify_code)
}
}
binding.tvSubmit.setOnClickListener {
val text = binding.etInput.text?.toString() ?: ""
if (dialogType == DIALOG_TYPE_VERIFY_PHONE) {
resendValidateCode()
} else {
if (isEnableSubmit(text)) {
when (dialogType) {
DIALOG_TYPE_BIND_PHONE -> bindPhoneNumber(text)
DIALOG_TYPE_CHANGE_PHONE -> bindPhoneNumber(text)
}
} else {
if (text != phoneNumber) {
ToastUtils.toast(R.string.invalid_phone_number_format.toResString())
}
}
}
}
}
private fun resendValidateCode() {
repository.sendVerifyCode(phoneNumber)
.compose(singleToMain())
.subscribe(object : BiResponse<ValidateCodeResponse>() {
override fun onSuccess(data: ValidateCodeResponse) {
serviceId = data.serviceId
startCountDown()
}
}).let(compositeDisposable::add)
}
private fun verifyPhoneNumber(content: String) {
repository.verifyPhoneNumber(phoneNumber, content, serviceId)
.compose(singleToMain())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
hasValidated = true
listener.phoneNumberValidateSuccessfully()
ToastUtils.toast(R.string.phone_number_validate_successfully.toResString())
dismiss()
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
binding.etInput.text = null
ToastUtils.toast(R.string.phone_number_validate_failure.toResString())
}
}).let(compositeDisposable::add)
}
private fun bindPhoneNumber(phone: String) {
repository.bindPhone(gameId, phone)
.compose(singleToMain())
.subscribe(object : BiResponse<ReserveModifyEntity>() {
override fun onSuccess(data: ReserveModifyEntity) {
listener.bindPhoneSuccessfully(data.smsConfig.mobileValidated, phone)
dismiss()
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
if (exception is HttpException) {
try {
val string = exception.response().errorBody()?.string()
if (!string.isNullOrBlank()) {
val json = JSONObject(string)
val message = json.getJSONObject("toast").getString("sms_config.mobile")
ToastUtils.showToast(message)
}
} catch (e: Exception) {
// no implement
}
}
}
}).let(compositeDisposable::add)
}
private fun startCountDown() {
binding.tvSubmit.isEnabled = false
binding.tvSubmit.setBackgroundResource(com.gh.gamecenter.common.R.drawable.bg_common_button_light_fill_gray)
binding.tvSubmit.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
Observable.interval(0, 1, TimeUnit.SECONDS)
.take(COUNT_DOWN_DURATION)
.map {
COUNT_DOWN_DURATION - it
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<Long>() {
override fun onSubscribe(d: Disposable) {
compositeDisposable.add(d)
}
override fun onNext(time: Long) {
binding.tvSubmit.text = context.getString(R.string.resend_with_time, "$time")
}
override fun onComplete() {
binding.tvSubmit.isEnabled = true
binding.tvSubmit.setBackgroundResource(com.gh.gamecenter.common.R.drawable.bg_common_button_fill_blue)
binding.tvSubmit.setTextColor(com.gh.gamecenter.common.R.color.text_aw_primary.toColor(context))
binding.tvSubmit.setText(R.string.resend)
}
})
}
override fun dismiss() {
compositeDisposable.clear()
if (dialogType == DIALOG_TYPE_VERIFY_PHONE && !hasValidated) {
ToastUtils.toast(R.string.phone_number_validate_cancel.toResString())
}
super.dismiss()
}
private fun isEnableSubmit(phone: String) =
PHONE_NUMBER_PATTERN.toRegex().matches(phone)
&& if (dialogType == DIALOG_TYPE_CHANGE_PHONE) phone != phoneNumber else true
private fun setSubmitState(phone: String) {
val isEnable = isEnableSubmit(phone)
binding.tvSubmit.alpha = if (isEnable) {
TV_SUBMIT_ENABLE_ALPHA
} else {
TV_SUBMIT_UNABLE_ALPHA
}
}
companion object {
private const val PHONE_NUMBER_PATTERN = "^1\\d{10}$"
private const val MASK = "****"
private const val PHONE_NUMBER_LENGTH = 11
private const val VALIDATE_CODE_LENGTH = 6
const val DIALOG_TYPE_BIND_PHONE = 0
const val DIALOG_TYPE_CHANGE_PHONE = 1
const val DIALOG_TYPE_VERIFY_PHONE = 2
private const val COUNT_DOWN_DURATION = 60L
private const val TV_SUBMIT_ENABLE_ALPHA = 1F
private const val TV_SUBMIT_UNABLE_ALPHA = 0.4F
fun create(
context: Context,
dialogType: Int,
phoneNumber: String,
serviceId: String,
gameId: String,
repository: ReserveReminderRepository,
listener: OnReserveReminderListener
) =
ReserveReminderPhoneNumberDialog(
context,
com.gh.gamecenter.common.R.style.DialogWindowTransparent,
dialogType,
phoneNumber,
serviceId,
gameId,
repository,
listener
)
}
}

View File

@ -0,0 +1,428 @@
package com.gh.common.dialog
import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.*
import android.view.ViewGroup.MarginLayoutParams
import androidx.core.view.updateLayoutParams
import com.gh.common.pop.EditBindPhoneInfoPop
import com.gh.common.pop.EditBindWechatPop
import com.gh.common.pop.RealNameTipsPop
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.entity.ReserveReminderEntity
import com.gh.gamecenter.login.entity.UserInfoEntity
import com.gh.gamecenter.login.user.UserManager
import com.halo.assistant.HaloApp
import com.halo.assistant.fragment.reserve.OnReserveReminderListener
class ReserveSuccessReminderDialog(
context: Context,
themeResId: Int,
private val listener: OnReserveReminderListener
) :
Dialog(context, themeResId), OnReserveSuccessListener {
private var reserveReminder = ReserveReminderEntity()
private val handler = Handler(Looper.getMainLooper())
private val handlers = arrayListOf<ReminderContentHandler>()
private lateinit var binding: DialogReserveSuccessWithSmsBinding
private val realNameQuestionPop by lazy {
RealNameTipsPop.create(context, listener)
}
private var hasAutoPopped = false
private var isInit = true
override fun onTouchEvent(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_UP) {
if (realNameQuestionPop.isShowing) {
realNameQuestionPop.dismiss()
return true
} else if (handlers.any { it.hasPopShowing }) {
handlers.forEach {
it.dismissPop()
}
return true
}
}
return super.onTouchEvent(event)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DialogReserveSuccessWithSmsBinding.inflate(LayoutInflater.from(context))
setContentView(binding.root)
binding.ivClose.setOnClickListener {
dismiss()
}
binding.ivQuestion.setOnClickListener {
realNameQuestionPop.showAtLocation(binding.cbAutoDownload, Gravity.BOTTOM, 0, 4F.dip2px())
}
}
private fun initView() {
handlers.clear()
binding.flContentContainer.removeAllViews()
val smsConfig = reserveReminder.smsConfig
val wechatConfig = reserveReminder.wechatConfig
when {
reserveReminder.onlyShowWechatReminder && !wechatConfig.isReminderEnable -> { // 只显示微信:未开启
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
arrayListOf(OnlyWechatReminderUnableHandler(16.dp, binding.flContentContainer, this))
}
reserveReminder.onlyShowWechatReminder && wechatConfig.isReminderEnable -> { // 只显示微信:已开
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
arrayListOf(
WechatReminderEnableHandler(
reserveReminder.wechatConfig.nickName,
8.dp,
binding.flContentContainer,
this
)
)
}
!smsConfig.notice && !wechatConfig.isReminderEnable -> { // 短信,微信未开启
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
arrayListOf(
SmsReminderUnableHandler(16.dp, binding.flContentContainer, this),
WechatReminderUnableHandler(8.dp, binding.flContentContainer, this)
)
}
smsConfig.notice && wechatConfig.isReminderEnable -> {// 短信,微信已开启
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
arrayListOf(
SmsReminderEnableHandler(reserveReminder.smsConfig, 8.dp, binding.flContentContainer, this),
WechatReminderEnableHandler(
reserveReminder.wechatConfig.nickName,
8.dp,
binding.flContentContainer,
this
)
)
}
smsConfig.notice && !wechatConfig.isReminderEnable -> { // 短信开启,微信未开启
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
arrayListOf(
SmsReminderEnableHandler(smsConfig, 8.dp, binding.flContentContainer, this),
WechatReminderUnableHandler(16.dp, binding.flContentContainer, this)
)
}
!smsConfig.notice && wechatConfig.isReminderEnable -> { // 微信开启,短信未开启
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
arrayListOf(
WechatReminderEnableHandler(
wechatConfig.nickName,
8.dp,
binding.flContentContainer,
this
),
SmsReminderUnableHandler(16.dp, binding.flContentContainer, this)
)
}
else -> {
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
arrayListOf()
}
}.let {
handlers.clear()
handlers.addAll(it)
}
handlers.forEach {
binding.flContentContainer.addView(it.init())
}
if (isInit) {
isInit = false
binding.gAutoDownload.goneIf(!reserveReminder.isEnableAutoDownload)
if (reserveReminder.isEnableAutoDownload) {
binding.cbAutoDownload.isChecked = reserveReminder.wifiAutoDownload
checkIfShowRealNamePop()
}
binding.cbAutoDownload.setOnCheckedChangeListener { _, isChecked ->
listener.enableAutoDownload(isChecked)
checkIfShowRealNamePop()
}
}
}
private fun checkIfShowRealNamePop() {
if (hasAutoPopped) {
return
}
hasAutoPopped = true
handler.postDelayed({
val idCard = UserManager.getInstance().userInfoEntity?.idCard
if (idCard != null && idCard.status != 1 && idCard.minor != true) {
// 账号已实名
return@postDelayed
}
val deviceCertificationInfoString =
SPUtils.getString(Constants.SP_DEVICE_CERTIFICATION_PREFIX + HaloApp.getInstance().gid)
if (!TextUtils.isEmpty(deviceCertificationInfoString)) {
val deviceIdCard = deviceCertificationInfoString.toObject<UserInfoEntity>()?.idCard
if (deviceIdCard != null && deviceIdCard.status != 1 && deviceIdCard.minor != true) {
// 设备已实名
return@postDelayed
}
}
realNameQuestionPop.showAtLocation(binding.cbAutoDownload, Gravity.BOTTOM, 0, 0)
}, 16)
}
override fun updateSmsReminder(isEnable: Boolean) {
listener.updateSmsReminder(isEnable)
}
override fun updateWechatReminder() {
listener.updateWechatReminder()
}
override fun changePhoneNumber() {
listener.changedPhoneNumber()
}
override fun verifyPhoneNumber() {
listener.verifyPhoneNumber()
}
override fun changeWechatBinding() {
listener.changeWechatBinding()
}
override fun onStart() {
super.onStart()
window?.let {
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val params = it.attributes
params.width = DisplayUtils.dip2px(300F)
it.attributes = params
}
}
fun updateReserveReminder(reserveReminder: ReserveReminderEntity) {
this.reserveReminder = reserveReminder
initView()
}
override fun dismiss() {
handler.removeCallbacksAndMessages(null)
super.dismiss()
}
companion object {
private val Int.dp: Int
get() = DisplayUtils.dip2px(this.toFloat())
fun create(context: Context, listener: OnReserveReminderListener) =
ReserveSuccessReminderDialog(
context,
com.gh.gamecenter.common.R.style.DialogWindowTransparent,
listener
).apply {
}
}
abstract class ReminderContentHandler(
val topMargin: Int,
val parent: ViewGroup,
val listener: OnReserveSuccessListener
) {
open val hasPopShowing: Boolean = false
fun init(): View {
val root = createView(LayoutInflater.from(parent.context))
root.updateLayoutParams<MarginLayoutParams> {
this.topMargin = this@ReminderContentHandler.topMargin
}
initView()
return root
}
protected abstract fun createView(inflater: LayoutInflater): View
protected abstract fun initView()
open fun dismissPop() = Unit
}
class SmsReminderUnableHandler(topMargin: Int, parent: ViewGroup, listener: OnReserveSuccessListener) :
ReminderContentHandler(topMargin, parent, listener) {
private lateinit var binding: LayoutReserveSmsReminderUnableBinding
override fun createView(inflater: LayoutInflater): View {
return LayoutReserveSmsReminderUnableBinding.inflate(inflater, parent, false)
.also {
binding = it
}.root
}
override fun initView() {
binding.vSmsAdd.setOnClickListener {
listener.updateSmsReminder(true)
}
}
}
class WechatReminderUnableHandler(topMargin: Int, parent: ViewGroup, listener: OnReserveSuccessListener) :
ReminderContentHandler(topMargin, parent, listener) {
private lateinit var binding: LayoutReserveWechatReminderUnableBinding
override fun createView(inflater: LayoutInflater): View {
return LayoutReserveWechatReminderUnableBinding.inflate(inflater, parent, false)
.also {
binding = it
}.root
}
override fun initView() {
binding.vWechatAdd.setOnClickListener {
listener.updateWechatReminder()
}
}
}
class SmsReminderEnableHandler(
private val smsConfig: ReserveReminderEntity.SmsConfig,
topMargin: Int,
parent: ViewGroup, listener:
OnReserveSuccessListener
) :
ReminderContentHandler(topMargin, parent, listener) {
private lateinit var binding: LayoutReserveSmsReminderEnableBinding
override val hasPopShowing: Boolean
get() = editBindPhoneInfoPop.isShowing
override fun dismissPop() {
if (hasPopShowing) {
editBindPhoneInfoPop.dismiss()
}
}
private val editBindPhoneInfoPop by lazy {
EditBindPhoneInfoPop.create(parent.context, smsConfig.mobileValidated, listener)
}
override fun createView(inflater: LayoutInflater) =
LayoutReserveSmsReminderEnableBinding.inflate(inflater, parent, false)
.also {
binding = it
}.root
override fun initView() {
binding.tvPhone.text = smsConfig.mobile
binding.vSmsEdit.setOnClickListener {
editBindPhoneInfoPop.showAsDropDown(
binding.ivSmsEdit,
(-104).dp,
0,
)
}
}
}
class WechatReminderEnableHandler(
private val nickName: String,
topMargin: Int,
parent: ViewGroup,
listener: OnReserveSuccessListener
) :
ReminderContentHandler(topMargin, parent, listener) {
private lateinit var binding: LayoutReserveWechatReminderEnableBinding
private val editWechatPop by lazy {
EditBindWechatPop.create(parent.context, listener)
}
override fun createView(inflater: LayoutInflater) =
LayoutReserveWechatReminderEnableBinding.inflate(inflater, parent, false)
.also {
binding = it
}.root
override fun initView() {
binding.tvWechat.text = nickName
binding.vModifyWechat.setOnClickListener {
editWechatPop.showAsDropDown(
binding.ivModifyWechat,
(-104).dp,
0
)
}
}
}
class OnlyWechatReminderUnableHandler(topMargin: Int, parent: ViewGroup, listener: OnReserveSuccessListener) :
ReminderContentHandler(topMargin, parent, listener) {
private lateinit var binding: LayoutReserveOnlyWechatUnableBinding
override fun createView(inflater: LayoutInflater) =
LayoutReserveOnlyWechatUnableBinding.inflate(inflater, parent, false)
.also {
binding = it
}.root
override fun initView() {
binding.vSubmitBackground.setOnClickListener {
listener.updateWechatReminder()
}
}
}
}
interface OnReserveSuccessListener {
fun updateSmsReminder(isEnable: Boolean)
fun updateWechatReminder()
fun changePhoneNumber()
fun verifyPhoneNumber()
fun changeWechatBinding()
}

View File

@ -0,0 +1,63 @@
package com.gh.common.dialog
import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.DialogWechatBindingConflictBinding
class WechatBindingConflictDialogFragment : BaseDialogFragment() {
private lateinit var binding: DialogWechatBindingConflictBinding
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return super.onCreateDialog(savedInstanceState).apply {
setCanceledOnTouchOutside(true)
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return DialogWechatBindingConflictBinding.inflate(inflater, container, false)
.also {
binding = it
}.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.tvIKnow.setOnClickListener {
dismiss()
}
}
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val params = it.attributes
params.width = DisplayUtils.dip2px(300F)
it.attributes = params
}
}
companion object {
fun show(context: Context) {
if (context is AppCompatActivity) {
context.supportFragmentManager
} else {
(CurrentActivityHolder.getCurrentActivity() as? AppCompatActivity)?.supportFragmentManager
}?.let {
WechatBindingConflictDialogFragment().show(it, WechatBindingConflictDialogFragment::class.java.name)
}
}
}
}

View File

@ -0,0 +1,125 @@
package com.gh.common.dialog
import android.app.Dialog
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.entity.ErrorEntity
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.DialogWechatBindingFailedBinding
import com.gh.gamecenter.login.user.UserRepository
import com.lightgame.utils.Utils
class WechatBindingFailedDialogFragment : BaseDialogFragment() {
private lateinit var binding: DialogWechatBindingFailedBinding
private var currentUserId: String? = null
private lateinit var userConflict: ErrorEntity.Data.UserConflict
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
userConflict = arguments?.getParcelable(KEY_USER_CONFLICT) ?: ErrorEntity.Data.UserConflict()
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return super.onCreateDialog(savedInstanceState).apply {
setCanceledOnTouchOutside(true)
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return DialogWechatBindingFailedBinding.inflate(inflater, container, false)
.also {
binding = it
}.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
UserRepository.getInstance().loginUserInfo.observe(viewLifecycleOwner) {
currentUserId = it.data.getShortUserId()
binding.tvCurrentName.text = it.data.name
binding.ivCurrentAvatar.displayAvatar(it.data.icon)
binding.tvUserId.text = getString(R.string.user_id, currentUserId)
}
binding.tvConflictName.text = userConflict.name
binding.ivConflictAvatar.displayAvatar(userConflict.icon)
binding.tvConflictUserId.text = getString(R.string.user_id, userConflict.seq)
binding.tvConflictProblem.setOnClickListener {
dismiss()
WechatBindingConflictDialogFragment.show(requireContext())
}
binding.tvIKnow.setOnClickListener {
dismiss()
}
binding.tvUserId.setOnLongClickListener {
currentUserId?.let {
copyTextToClipboard(it)
true
} ?: false
}
binding.tvConflictUserId.setOnLongClickListener {
copyTextToClipboard(userConflict.id)
true
}
}
private fun copyTextToClipboard(text: String) {
val clipboardManager = context?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
if (clipboardManager != null) {
val clip = ClipData.newPlainText(COPY_ID_TEXT, text)
clipboardManager.setPrimaryClip(clip)
Utils.toast(requireContext(), R.string.copy_user_id_successfully)
}
}
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val params = it.attributes
params.width = DisplayUtils.dip2px(300F)
it.attributes = params
}
}
companion object {
private const val COPY_ID_TEXT = "user_id"
private const val KEY_USER_CONFLICT = "key_user_conflict"
fun show(context: Context, userConflict: ErrorEntity.Data.UserConflict?) {
if (context is AppCompatActivity) {
context.supportFragmentManager
} else {
(CurrentActivityHolder.getCurrentActivity() as? AppCompatActivity)?.supportFragmentManager
}?.let {
val fragment = WechatBindingFailedDialogFragment().apply {
arguments = Bundle().apply {
putParcelable(KEY_USER_CONFLICT, userConflict)
}
}
fragment.show(it, WechatBindingFailedDialogFragment::class.java.name)
}
}
}
}

View File

@ -6,6 +6,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.LayoutManager
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.feature.exposure.ExposureEvent
import io.reactivex.functions.Consumer
@ -16,8 +17,9 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
val throttleBus: ExposureThrottleBus by lazy {
ExposureThrottleBus(
Consumer { commitExposure(it) },
Consumer(Throwable::printStackTrace)
{ commitExposure(it) },
Consumer(Throwable::printStackTrace),
{ commitWXCPMExposure(it) }
)
}
var layoutManager: LayoutManager? = null
@ -93,4 +95,32 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
ExposureManager.log(eventList)
}
/**
* 微信小游戏CPM曝光事件接口上报由于普通曝光事件的上报通道存在节流特性不符合CPM接口对于数据上报的实时性和准确性的要求所以使用额外的通道进行上报
*/
private fun commitWXCPMExposure(visibleState: ExposureThrottleBus.VisibleState) {
val eventList = arrayListOf<ExposureEvent>()
for (pos in visibleState.firstVisiblePosition..visibleState.lastVisiblePosition) {
try {
exposable.getEventByPosition(pos)?.let {
if (it.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
eventList.add(it)
}
}
exposable.getEventListByPosition(pos)?.let { list ->
list.forEach {
if (it.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
eventList.add(it)
}
}
}
} catch (ignore: Exception) {
// Just ignore the error.
}
}
ExposureManager.logCPM(eventList)
}
}

View File

@ -1,11 +1,13 @@
package com.gh.common.exposure
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.loghub.TLogHubHelper
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.minigame.wechat.WGameSubjectCPMListReportHelper
import com.lightgame.utils.Utils
import com.volcengine.model.tls.LogItem
@ -32,6 +34,9 @@ object ExposureManager {
*/
fun log(event: ExposureEvent) {
AppExecutor.logExecutor.execute {
if (event.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
WGameSubjectCPMListReportHelper.reportExposure(event)
}
if (!exposureCache.contains(event.id)) {
exposureSet.add(event)
exposureCache.add(event.id)
@ -58,6 +63,17 @@ object ExposureManager {
}
}
/**
* Log a wechat mini game cpm collection of exposure event.
*/
fun logCPM(eventList: List<ExposureEvent>) {
AppExecutor.logExecutor.execute {
if (eventList.isNotEmpty()) {
WGameSubjectCPMListReportHelper.reportExposure(eventList.toSet())
}
}
}
/**
* @param forcedUpload Ignore all restrictions.
*/

View File

@ -3,16 +3,20 @@ package com.gh.common.exposure
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.BehaviorSubject
import java.util.concurrent.TimeUnit
class ExposureThrottleBus(var onSuccess: Consumer<VisibleState>, var onError: Consumer<Throwable>) {
class ExposureThrottleBus(
var onSuccess: Consumer<VisibleState>,
var onError: Consumer<Throwable>,
onPreSuccess: Consumer<VisibleState>
) {
companion object {
private const val THRESHOLD_TIME = 300L
}
private val mPublishSubject: PublishSubject<VisibleState> = PublishSubject.create()
private val mPublishSubject: BehaviorSubject<VisibleState> = BehaviorSubject.create()
private val mCompositeDisposable: CompositeDisposable = CompositeDisposable()
init {
@ -24,6 +28,7 @@ class ExposureThrottleBus(var onSuccess: Consumer<VisibleState>, var onError: Co
*/
val disposable = mPublishSubject
.distinctUntilChanged()
.doOnNext(onPreSuccess)
.throttleWithTimeout(THRESHOLD_TIME, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.io())
.subscribe(onSuccess, onError)

View File

@ -53,7 +53,6 @@ object ExposureUtils {
return exposureEvent
}
@JvmStatic
fun logADownloadCompleteExposureEvent(
entity: GameEntity,
platform: String?,
@ -61,6 +60,7 @@ object ExposureUtils {
speed: Long,
host: String? = "unknown",
path: String? = "unknown",
redirectedUrlList: String? = "unknown",
downloadType: DownloadType
): ExposureEvent? {
val gameEntity = entity.copy()
@ -88,6 +88,7 @@ object ExposureUtils {
exposureEvent.payload.host = host
exposureEvent.payload.path = path
exposureEvent.payload.speed = speed
exposureEvent.payload.redirectedUrlList = redirectedUrlList
ExposureManager.log(exposureEvent)
ExposureManager.commitSavedExposureEvents(forcedUpload = true)

View File

@ -5,6 +5,6 @@ import com.gh.gamecenter.entity.BottomTab
interface ISearchToolbarTab {
fun onScrollChanged(totalHeight: Int, offset: Int, isDarkModeChanged: Boolean)
fun changeAppBarColor(color: Int, pageId: String)
fun setSearchStyle(searchStyle: BottomTab.SearchStyle)
fun updateSearchStyle(searchStyle: BottomTab.SearchStyle)
fun getCurrentTabIndex(): Int?
}

View File

@ -0,0 +1,44 @@
package com.gh.common.pop
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.view.updateLayoutParams
import com.gh.gamecenter.R
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupItemBinding
class BatchManagementPop(
binding: LayoutPopupContainerBinding,
private val listener: OnBatchManagementListener
) :
CommonPopupWindow(binding) {
override val viewDataList: List<ViewData>
get() = listOf(
ViewData(R.string.enable_automatic_downloading_in_batches) {
listener.enableAutoDownload()
},
ViewData(R.string.batch_management) {
listener.batchManage()
}
)
companion object {
fun create(context: Context, listener: OnBatchManagementListener): BatchManagementPop {
val binding = LayoutPopupContainerBinding.inflate(LayoutInflater.from(context))
return BatchManagementPop(binding, listener).apply {
initView()
}
}
}
interface OnBatchManagementListener {
fun enableAutoDownload()
fun batchManage()
}
}

View File

@ -0,0 +1,49 @@
package com.gh.common.pop
import android.content.Context
import android.view.LayoutInflater
import com.gh.gamecenter.R
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.feature.entity.GameEntity
class CancelReservePop(
private val game: GameEntity,
binding: LayoutPopupContainerBinding,
private val listener: OnCancelReserveListener
) : CommonPopupWindow(binding) {
override val viewDataList: List<ViewData>
get() {
val list = arrayListOf<ViewData>()
if (game.wifiAutoDownloadEnable) {
list.add(ViewData(if (game.wifiAutoDownload) R.string.cancel_auto_download_with_wifi else R.string.enable_automatic_downloading_with_wifi) {
listener.enableAutoDownload(!game.wifiAutoDownload)
})
}
list.add(ViewData(R.string.cancel_reserve, listener::cancelReserve))
return list
}
companion object {
fun create(
game: GameEntity,
context: Context,
listener: OnCancelReserveListener
): CancelReservePop {
val inflater = LayoutInflater.from(context)
val binding = LayoutPopupContainerBinding.inflate(inflater)
return CancelReservePop(game, binding, listener).apply {
initView()
}
}
}
interface OnCancelReserveListener {
fun enableAutoDownload(isEnable: Boolean)
fun cancelReserve()
}
}

View File

@ -0,0 +1,47 @@
package com.gh.common.pop
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.view.updateLayoutParams
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupBinding
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupItemBinding
import com.gh.gamecenter.databinding.LayoutPopupOptionItemBinding
import com.gh.gamecenter.databinding.LayoutPopupReserveReminderOptionItemBinding
abstract class CommonPopupWindow(
private val binding: LayoutPopupContainerBinding,
) : BugFixedPopupWindow(binding.root, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
private val inflater = LayoutInflater.from(binding.root.context)
abstract val viewDataList: List<ViewData>
fun initView() {
isFocusable = true
binding.container.updateLayoutParams<ViewGroup.LayoutParams> {
width = DisplayUtils.dip2px(128F)
}
viewDataList.forEach {
addItemView(it.textResId, it.click)
}
}
private fun addItemView(textResId: Int, click: () -> Unit) =
LayoutPopupReserveReminderOptionItemBinding.inflate(inflater, binding.container, false)
.also {
it.hintText.setText(textResId)
binding.container.addView(it.root)
it.root.setOnClickListener {
dismiss()
click()
}
}.root
data class ViewData(
val textResId: Int,
val click: () -> Unit
)
}

View File

@ -0,0 +1,70 @@
package com.gh.common.pop
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.view.updateLayoutParams
import com.gh.common.dialog.OnReserveSuccessListener
import com.gh.gamecenter.R
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupItemBinding
class EditBindPhoneInfoPop(
private val hasValidated: Boolean,
private val binding: LayoutPopupContainerBinding,
private val listener: OnReserveSuccessListener
) : BugFixedPopupWindow(binding.root, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
private val context
get() = binding.root.context
init {
initView()
}
private fun initView() {
isOutsideTouchable = false
isFocusable = true
binding.container.updateLayoutParams<ViewGroup.LayoutParams> {
width = DisplayUtils.dip2px(128F)
}
val inflater = LayoutInflater.from(context)
fun createItemView(textResId: Int) =
LayoutAddKaifuPopupItemBinding.inflate(inflater, binding.container, false)
.also {
it.hintText.setText(textResId)
binding.container.addView(it.root)
}.root
val tvChangePhoneNumber = createItemView(R.string.change_phone_number)
if(!hasValidated){
val tvVerifyPhoneNumber = createItemView(R.string.verify_phone_number)
tvVerifyPhoneNumber.setOnClickListener {
dismiss()
listener.verifyPhoneNumber()
}
}
val tvTurnOffSmsReminder = createItemView(R.string.turn_off_sms_reminders)
tvChangePhoneNumber.setOnClickListener {
dismiss()
listener.changePhoneNumber()
}
tvTurnOffSmsReminder.setOnClickListener {
dismiss()
listener.updateSmsReminder(false)
}
}
companion object {
fun create(context: Context, hasValidated: Boolean, listener: OnReserveSuccessListener): EditBindPhoneInfoPop {
val binding = LayoutPopupContainerBinding.inflate(LayoutInflater.from(context))
return EditBindPhoneInfoPop(hasValidated, binding, listener)
}
}
}

View File

@ -0,0 +1,26 @@
package com.gh.common.pop
import android.content.Context
import android.view.LayoutInflater
import com.gh.common.dialog.OnReserveSuccessListener
import com.gh.gamecenter.R
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
class EditBindWechatPop(
binding: LayoutPopupContainerBinding,
private val listener: OnReserveSuccessListener
) : CommonPopupWindow(binding) {
override val viewDataList: List<ViewData>
get() = listOf(
ViewData(R.string.change_the_wechat_binding, listener::changeWechatBinding)
)
companion object {
fun create(context: Context, listener: OnReserveSuccessListener): EditBindWechatPop {
val inflater = LayoutInflater.from(context)
return EditBindWechatPop(LayoutPopupContainerBinding.inflate(inflater), listener).apply { initView() }
}
}
}

View File

@ -0,0 +1,69 @@
package com.gh.common.pop
import android.content.Context
import android.graphics.Color
import android.text.SpannableString
import android.text.TextPaint
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.text.style.ForegroundColorSpan
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.core.text.set
import com.gh.common.dialog.OnReserveSuccessListener
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.PopRealNameTipsBinding
import com.halo.assistant.fragment.reserve.OnReserveReminderListener
class RealNameTipsPop(
private val binding: PopRealNameTipsBinding,
private val listener: OnReserveReminderListener
) :
BugFixedPopupWindow(binding.root, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
private val context: Context
get() = binding.root.context
init {
initView()
}
private fun initView() {
val text = R.string.reserve_real_name_description.toResString()
val spannableString = SpannableString(text)
val clickSpan = object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
ds.bgColor = Color.TRANSPARENT
ds.setColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
}
override fun onClick(widget: View) {
dismiss()
listener.realName()
}
}
spannableString.set(start = text.length - 6, end = text.length, span = clickSpan)
binding.tvRealNameDescription.text = spannableString
binding.tvRealNameDescription.movementMethod = LinkMovementMethod.getInstance()
binding.tvRealNameDescription.setHighlightColor(Color.TRANSPARENT)
}
companion object {
@JvmStatic
fun create(context: Context, listener: OnReserveReminderListener): RealNameTipsPop {
val pop = RealNameTipsPop(PopRealNameTipsBinding.inflate(LayoutInflater.from(context)), listener)
pop.isFocusable = true
pop.isOutsideTouchable = false
return pop
}
}
}

View File

@ -0,0 +1,95 @@
package com.gh.common.pop
import android.content.Context
import android.view.Gravity
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.CompoundButton
import androidx.appcompat.app.AppCompatActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.databinding.PopReserveAllSelectBinding
import com.gh.gamecenter.mygame.MyReservationFragment
class ReserveAllSelectPop(
val binding: PopReserveAllSelectBinding,
private val listener: OnReserveAllSelectListener
) : BugFixedPopupWindow(binding.root, ViewGroup.LayoutParams.MATCH_PARENT, 56F.dip2px()) {
private var pageStatus: MyReservationFragment.ReservePageState =
MyReservationFragment.ReservePageState.EnableAutoDownload
private val onCheckedChangeListener = { _: CompoundButton, isChecked: Boolean ->
val count = listener.selectAll(isChecked)
updateSelectedCount(count)
}
init {
isOutsideTouchable = false
binding.cbAll.setOnCheckedChangeListener(onCheckedChangeListener)
binding.tvSubmit.setOnClickListener {
listener.submit()
}
}
fun show(state: MyReservationFragment.ReservePageState, context: Context) {
enableSubmit(false)
binding.tvSubmit.setText(
if (state == MyReservationFragment.ReservePageState.EnableAutoDownload) {
R.string.enable_automatic_downloading_with_wifi
} else {
R.string.cancel_reserve
}
)
// 清空上一次的状态
pageStatus = state
updateSelectedCount(0)
if (!isShowing) {
showAtLocation((context as AppCompatActivity).window.decorView, Gravity.BOTTOM, 0, 0)
}
}
fun updateSelectedCount(count: Int) {
if (count == 0) {
enableSubmit(false)
binding.cbAll.setOnCheckedChangeListener(null)
binding.cbAll.isChecked = false
binding.cbAll.setOnCheckedChangeListener(onCheckedChangeListener)
} else {
enableSubmit(true)
binding.tvNumber.text = binding.root.context.getString(R.string.count_with_parentheses, "$count")
}
}
private fun enableSubmit(isEnable: Boolean) {
binding.tvSubmit.isEnabled = isEnable
if (isEnable) {
binding.tvSubmit.alpha = 1F
} else {
binding.tvSubmit.alpha = 0.4F
binding.tvNumber.setText(null)
}
}
companion object {
fun create(context: Context, listener: OnReserveAllSelectListener): ReserveAllSelectPop {
val inflater = LayoutInflater.from(context)
return ReserveAllSelectPop(PopReserveAllSelectBinding.inflate(inflater), listener)
}
}
interface OnReserveAllSelectListener {
fun selectAll(isChecked: Boolean): Int
fun submit()
}
}

View File

@ -7,7 +7,6 @@ import android.view.LayoutInflater
import android.widget.FrameLayout
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.DisplayUtils
@ -121,7 +120,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
isTouchable = true
isFocusable = true
isOutsideTouchable = true
animationStyle = R.style.popup_window_ease_in_and_out_anim_style
animationStyle = com.gh.gamecenter.common.R.style.popup_window_ease_in_and_out_anim_style
showAtLocation(
activity.window.decorView,
Gravity.TOP,

View File

@ -8,7 +8,6 @@ import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.updateLayoutParams
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.view.BugFixedPopupWindow
@ -153,7 +152,7 @@ class BottomTabGuideHandler(priority: Int): PriorityChainHandler(priority) {
return popupWindow.apply {
isFocusable = false
isOutsideTouchable = false
animationStyle = R.style.popup_window_ease_in_and_out_anim_style
animationStyle = com.gh.gamecenter.common.R.style.popup_window_ease_in_and_out_anim_style
setOnDismissListener {
dismissCallback?.invoke()
}

View File

@ -5,25 +5,35 @@ import android.app.Activity
import android.app.Application.ActivityLifecycleCallbacks
import android.os.Bundle
import android.preference.PreferenceManager
import android.text.TextUtils
import androidx.annotation.WorkerThread
import androidx.fragment.app.FragmentActivity
import com.gh.common.iinterface.ISuperiorChain
import com.gh.common.util.CheckLoginUtils
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.SplashAdActivity
import com.gh.gamecenter.SplashScreenActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.SPUtils.getBoolean
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.entity.DialogEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.ReserveOnlineEntity
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.hud.PendingInstallHUDHandler
import com.gh.gamecenter.hud.ResumeDownloadHudHandler
import com.gh.gamecenter.login.entity.UserInfoEntity
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
/**
@ -35,6 +45,7 @@ import io.reactivex.schedulers.Schedulers
object GlobalPriorityChainHelper : ISuperiorChain {
private val api = RetrofitManager.getInstance().api
private val newApi = RetrofitManager.getInstance().newApi
private var inferiorChain: PriorityChain? = null
private val mainChain: PriorityChain by lazy { PriorityChain { inferiorChain?.start() } }
@ -223,7 +234,7 @@ object GlobalPriorityChainHelper : ISuperiorChain {
/**
* 请求预约弹窗相关的数据
*/
@SuppressLint("CheckResult")
private fun requestReserveDialogData(reserveDialogHandler: ReserveDialogHandler) {
// debugOnly {
// reserveDialogHandler.doPreProcess(arrayListOf(SimpleGameEntity(
@ -236,23 +247,145 @@ object GlobalPriorityChainHelper : ISuperiorChain {
// }
if (CheckLoginUtils.isLogin()) {
api.getReserveDialog(UserManager.getInstance().userId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<List<SimpleGameEntity>>() {
override fun onSuccess(data: List<SimpleGameEntity>) {
reserveDialogHandler.doPreProcess(data)
}
override fun onFailure(exception: Exception) {
reserveDialogHandler.doPreProcess(null)
}
})
val isTeenagerMode = getBoolean(Constants.SP_TEENAGER_MODE)
loadReserveDialogOnlineData(isTeenagerMode, reserveDialogHandler)
} else {
reserveDialogHandler.doPreProcess(null)
}
}
/**
* 由于用户预约的游戏个数没有限制为避免一次加载游戏过多这里采用先加载第一页显示出dialog,后续数据在第二页返回
* 注意:当page = 2 时,后台会将后续所有数据一次性返回,所以递归到第三层时,就会结束
* @param isTeenagerMode 青少年模式关闭时才需要启动自动下载,所以当 isTeenagerMode == true 时,不需要加载后续数据,也不需要启动自动下载
*/
@SuppressLint("CheckResult")
private fun loadReserveDialogOnlineData(isTeenagerMode: Boolean, handler: ReserveDialogHandler? = null) {
newApi.getReserveDialog()
.compose(singleToMain())
.subscribe(object : BiResponse<ReserveOnlineEntity>() {
override fun onSuccess(data: ReserveOnlineEntity) {
handler?.doPreProcess(data)
// 继续获取后续需要自动下载的游戏
runOnIoThread {
loadGamesWithAutoDownload(1, 20, isTeenagerMode)
}
}
override fun onFailure(exception: Exception) {
handler?.doPreProcess(null)
}
})
}
/**
* 由于这个方法本身就是在子线程调用的,这里不需要另外在做线程切换
*/
@SuppressLint("CheckResult")
@WorkerThread
private fun loadGamesWithAutoDownload(page: Int, pageSize: Int, isTeenagerMode: Boolean) {
if (page >= 5) {
// 为防止死循环这里设置最多请求到第5页(正常情况下,第一页就是全部数据)
return
}
val filter = "wifi_auto_download:true"
newApi.loadGamesWithAutoDownload(page, pageSize, filter)
.doOnSuccess(::trackAppointmentGameOnlineDialogShow)
.subscribe(object : BiResponse<List<GameEntity>>() {
override fun onSuccess(data: List<GameEntity>) {
// 请注意,这是在子线程中
if (data.isNotEmpty()) {
loadGamesWithAutoDownload(page + 1, pageSize, isTeenagerMode)
startAutoDownloadIfNeed(data, isTeenagerMode)
}
}
})
}
@SuppressLint("CheckResult")
private fun startAutoDownloadIfNeed(games: List<GameEntity>, isTeenagerMode: Boolean) {
val autoDownloadGameIds = mutableSetOf<String>()
games.forEach {
autoDownloadGameIds.add(it.id)
if (it.wifiAutoDownload && !it.isLandPageAddressDialog() && !isTeenagerMode) {
// 开启了 wifi 自动下载,并且不能为第三方落地页跳转
val apk = when (it.getApk().size) {
0 -> null
1 -> it.getApk().first()
else -> {
// 自动下载,多版本默认:九游版
it.getApk().find { apk -> "9u" == apk.getPlatform() && apk.isActive }
}
}
if (apk != null) {
val updateEntities = PackageUtils.getUpdateData(it, false)
val isCanUpdate = if (updateEntities.size == 1) {
true
} else {
// 多版本只需要判断九游版是否需要更新
updateEntities.any { update -> "9u" == update.platform }
}
val isCanPluggable = PackageUtils.isCanPluggable(apk)
if ((!PackageUtils.isInstalled(HaloApp.getInstance(), apk.packageName)
|| isCanUpdate
|| isCanPluggable)
&& DownloadManager.getInstance().getDownloadEntityByUrl(apk.url) == null
) {
// 未下载/可更新/可插件化 且 之前没有下载记录
val msg = FileUtils.isCanDownload(HaloApp.getInstance(), apk.size ?: "")
if (msg.isNullOrBlank()) {
val isWifiOpen = NetworkUtils.isWifiConnected(HaloApp.getInstance())
val isSubscribe = !isWifiOpen
DownloadManager.createDownload(
HaloApp.getInstance(),
apk,
it,
false,
false,
"",
"",
isSubscribe,
ExposureEvent.createEvent(it, listOf(ExposureSource("预约上线弹窗-自动下载", "")))
)
} else {
// 存储空间不足,直接跳出循环,放弃后续的所有游戏
ToastUtils.showToast(msg)
return@forEach
}
}
}
}
}
if (autoDownloadGameIds.isNotEmpty()) {
val body = hashMapOf(
"game_ids" to autoDownloadGameIds,
"type" to "wifi_auto_download"
)
newApi.logAutoDownload(body)
.subscribe({}, {})
}
}
private fun trackAppointmentGameOnlineDialogShow(games: List<GameEntity>) {
if (games.isNotEmpty()) {
val gameIds = arrayListOf<String>()
val gameNames = arrayListOf<String>()
val gameTypes = arrayListOf<String>()
games.forEach { game ->
gameIds.add(game.id)
gameNames.add(game.name ?: "")
gameTypes.add(game.categoryChinese)
}
val gameId = gameIds.joinToString()
val gameName = gameNames.joinToString()
val gameType = gameTypes.joinToString()
SensorsBridge.trackAppointmentGameOnlineDialogShow(gameId, gameName, gameType)
}
}
override fun registerInferiorChain(chain: PriorityChain) {
inferiorChain = chain
if (mainChain.isHandlerQueueEmpty()) {

View File

@ -6,7 +6,6 @@ import android.view.LayoutInflater
import android.view.View
import android.widget.PopupWindow
import androidx.constraintlayout.widget.ConstraintLayout
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.goneIf
@ -282,7 +281,7 @@ class MultiTabGuideHandler(priority: Int): PriorityChainHandler(priority) {
isTouchable = false
isFocusable = false
isOutsideTouchable = true
animationStyle = R.style.popup_window_ease_in_and_out_anim_style
animationStyle = com.gh.gamecenter.common.R.style.popup_window_ease_in_and_out_anim_style
setOnDismissListener {
dismissCallback?.invoke()
}

View File

@ -2,28 +2,28 @@ package com.gh.common.prioritychain
import androidx.fragment.app.FragmentActivity
import com.gh.common.dialog.ReserveDialog
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.feature.entity.ReserveOnlineEntity
class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
private var mReserveData: List<SimpleGameEntity>? = null
private var mReserveData: ReserveOnlineEntity? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(reserveData: List<SimpleGameEntity>?) {
fun doPreProcess(reserveData: ReserveOnlineEntity?) {
mReserveData = reserveData
if (getStatus() == STATUS_PENDING) {
if (reserveData.isNullOrEmpty()) {
if (reserveData?.games.isNullOrEmpty()) {
processNext()
} else {
updateStatus(STATUS_VALID)
process()
}
} else {
if (reserveData.isNullOrEmpty()) {
if (reserveData?.games.isNullOrEmpty()) {
updateStatus(STATUS_INVALID)
} else {
updateStatus(STATUS_VALID)
@ -37,7 +37,7 @@ class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
when (getStatus()) {
STATUS_VALID -> {
val reserveDialog = ReserveDialog.getInstance(mReserveData!!)
val reserveDialog = ReserveDialog.getInstance(mReserveData ?:ReserveOnlineEntity())
reserveDialog.setOnDismissListener {
processNext()
}

View File

@ -33,5 +33,9 @@ class BuildConfigImpl : IBuildConfigProvider {
override fun getVDevApiHost(): String = BuildConfig.DEV_VAPI_HOST
override fun getWGameCPMApiHost(): String = BuildConfig.WGAME_CPM_API_HOST
override fun getWGameCPMBusiAppId(): String = BuildConfig.WGAME_CPM_BUSIAPPID
override fun getLogProducerProject(): String = BuildConfig.LOG_HUB_PROJECT
}

View File

@ -17,7 +17,6 @@ import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.toArrayList
import com.gh.gamecenter.core.provider.IConcernArticleUtilsProvider
import com.gh.gamecenter.databinding.RecyclerGameArticleBinding
import com.gh.gamecenter.R
@Route(path = RouteConsts.provider.concernContentUtils, name = "ConcernContentUtils暴露服务")
class ConcernArticleUtilsProviderImpl : IConcernArticleUtilsProvider {
@ -40,13 +39,13 @@ class ConcernArticleUtilsProviderImpl : IConcernArticleUtilsProvider {
if (binding is RecyclerGameArticleBinding) {
val context = binding.root.context
binding.root
.setBackground(ContextCompat.getDrawable(context, R.drawable.reuse_listview_item_style))
binding.tvGameName.setTextColor(ContextCompat.getColor(context, R.color.text_primary))
binding.tvTime.setTextColor(ContextCompat.getColor(context, R.color.text_tertiary))
binding.tvTitle.setTextColor(ContextCompat.getColor(context, R.color.text_primary))
binding.tvDescription.setTextColor(ContextCompat.getColor(context, R.color.text_secondary))
binding.tvComment.setTextColor(ContextCompat.getColor(context, R.color.text_tertiary))
binding.tvShare.setTextColor(ContextCompat.getColor(context, R.color.text_tertiary))
.setBackground(ContextCompat.getDrawable(context, com.gh.gamecenter.common.R.drawable.reuse_listview_item_style))
binding.tvGameName.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_primary))
binding.tvTime.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_tertiary))
binding.tvTitle.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_primary))
binding.tvDescription.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_secondary))
binding.tvComment.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_tertiary))
binding.tvShare.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_tertiary))
}
}

View File

@ -7,7 +7,6 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.viewbinding.ViewBinding
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.toColor
@ -27,10 +26,10 @@ class ConcernGiftPackUtilsProviderImpl : IConcernGiftPackUtilsProvider {
override fun initStyle(viewBinding: ViewBinding) {
with(viewBinding as RecyclerGiftPackBinding) {
val context = root.context
tvGameName.setTextColor(R.color.text_primary.toColor(context))
tvTime.setTextColor(R.color.text_tertiary.toColor(context))
tvGiftPackName.setTextColor(R.color.text_primary.toColor(context))
tvGiftPackContent.setTextColor(R.color.text_secondary.toColor(context))
tvGameName.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
tvTime.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
tvGiftPackName.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
tvGiftPackContent.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(context))
}
}

View File

@ -62,7 +62,13 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directToCommunityArticle(context, articleId, communityId, entrance, path, sourceEntrance)
}
override fun directToVideoDetail(context: Context, videoId: String, entrance: String?, path: String?, sourceEntrance: String) {
override fun directToVideoDetail(
context: Context,
videoId: String,
entrance: String?,
path: String?,
sourceEntrance: String
) {
DirectUtils.directToVideoDetail(context, videoId, entrance, path, sourceEntrance)
}
@ -78,8 +84,13 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directToQQGameById(activity, qqAppId)
}
override fun directToWechatGameById(activity: Activity, qqAppId: String) {
DirectUtils.directToWechatGameById(activity, qqAppId)
override fun directToWechatGameById(
activity: Activity,
wechatAppId: String,
wechatAppPath: String,
wechatAppExtData: String
) {
DirectUtils.directToWechatGameById(activity, wechatAppId, wechatAppPath, wechatAppExtData)
}
override fun directToExternalBrowser(context: Context, url: String) {

View File

@ -3,7 +3,6 @@ package com.gh.common.provider
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.exposure.ExposureSource
@ -107,7 +106,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
) {
val text = downloadButton.text.ifEmpty {
downloadButton.getTag(R.string.download) ?: ""
downloadButton.getTag(com.gh.gamecenter.feature.R.string.download) ?: ""
}.toString()
val downloadType = if (text.contains("畅玩")) {

View File

@ -9,7 +9,7 @@ import com.gh.gamecenter.core.provider.IPackageHelperProvider
@Route(path = RouteConsts.provider.packageHelper, name = "PackageHelper暴露服务")
class PackageHelperProviderImpl : IPackageHelperProvider {
override fun getLocalPackageNameSet(): HashSet<String> {
override fun getLocalPackageNameSet(): Set<String> {
return PackageHelper.localPackageNameSet
}

View File

@ -0,0 +1,36 @@
package com.gh.common.provider
import android.content.Context
import androidx.fragment.app.Fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.ISearchTabUtilsProvider
import com.gh.gamecenter.search.viewmodel.SearchTabViewModel
@Route(path = RouteConsts.provider.searchTabUtils, name = "SearchTabUtils暴露服务")
class SearchTabUtilsProviderImpl : ISearchTabUtilsProvider {
override fun obtainParentViewModel(fragment: Fragment): ViewModel {
val store = (fragment.parentFragment ?: fragment).viewModelStore
val factory = fragment.defaultViewModelProviderFactory
return ViewModelProvider(
store,
factory
).get(SearchTabViewModel::class.java)
}
override fun getKeyAndTypeLiveData(viewModel: ViewModel?): LiveData<Pair<String, String>>? =
if (viewModel is SearchTabViewModel) {
viewModel.searchKeyAndType
} else {
null
}
override fun init(context: Context?) {
// no implement
}
}

View File

@ -4,16 +4,19 @@ import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.WechatBindHelper
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.WechatConfigEntity
import com.gh.gamecenter.core.provider.IWechatBindHelperProvider
@Route(path = RouteConsts.provider.wechatHelper, name = "WechatHelper暴露服务")
class WechatHelperProviderImpl : IWechatBindHelperProvider {
override fun getWechatConfig(callback: (() -> Unit)?) {
class WechatHelperProviderImpl : IWechatBindHelperProvider<WechatConfigEntity> {
override fun getWechatConfig(callback: ((WechatConfigEntity) -> Unit)?) {
WechatBindHelper.getWechatConfig {
callback?.invoke()
callback?.invoke(it)
}
}
override fun init(context: Context?) {
// Do nothing
}

View File

@ -11,7 +11,6 @@ import com.gh.common.constant.Config
import com.gh.common.util.LogUtils
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.core.utils.SPUtils
@ -91,7 +90,7 @@ object NewSimulatorGameManager {
},
uiModificationCallback = { binding ->
binding.contentTv.gravity = Gravity.START
binding.contentTv.setTextColor(R.color.text_secondary.toColor(context))
binding.contentTv.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(context))
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)

View File

@ -339,8 +339,8 @@ class SimulatorDownloadManager private constructor() {
Utils.toast(context, "当前使用移动数据进行下载")
}
downloadDialog = TrackableDialog(context, R.style.GhAlertDialog, "模拟器下载", "下载中弹窗")
downloadDialog?.window?.setBackgroundDrawableResource(R.color.transparent)
downloadDialog = TrackableDialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog, "模拟器下载", "下载中弹窗")
downloadDialog?.window?.setBackgroundDrawableResource(com.gh.gamecenter.common.R.color.transparent)
val view = View.inflate(context, R.layout.download_simulator_dialog, null)
@ -392,7 +392,7 @@ class SimulatorDownloadManager private constructor() {
ToastUtils.showToast("该模拟器暂未提供下载")
},
uiModificationCallback = { binding ->
binding.confirmTv.setTextColor(R.color.text_instance.toColor(context))
binding.confirmTv.setTextColor(com.gh.gamecenter.common.R.color.text_instance.toColor(context))
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)

View File

@ -95,13 +95,13 @@ object ArchiveDownloadButtonHelper {
R.string.archive_dialog_title.toResString(),
R.string.archive_vspace_dialog_content.toResString(),
R.string.archive_vspace_dialog_confirm.toResString(),
R.string.cancel.toResString(),
com.gh.gamecenter.common.R.string.cancel.toResString(),
{
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.archive_vspace_dialog_confirm.toResString())
VHelper.showVSpaceDialog(context, gameEntity)
},
{
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.cancel.toResString())
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(com.gh.gamecenter.common.R.string.cancel.toResString())
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
@ -114,14 +114,14 @@ object ArchiveDownloadButtonHelper {
R.string.archive_dialog_title.toResString(),
R.string.archive_download_dialog_content.toResString(),
R.string.archive_download_dialog_confirm.toResString(),
R.string.cancel.toResString(),
com.gh.gamecenter.common.R.string.cancel.toResString(),
confirmClickCallback = {
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.archive_download_dialog_confirm.toResString())
VHelper.disableLaunchGameAfterInstallation()
EventBus.getDefault().post(EBReuse("download"))
},
cancelClickCallback = {
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.cancel.toResString())
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(com.gh.gamecenter.common.R.string.cancel.toResString())
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
@ -178,7 +178,7 @@ object ArchiveDownloadButtonHelper {
VArchiveHelper.downloadArchive(archiveEntity)
// 下载进度弹窗
val archiveLoadingDialog = Dialog(context, R.style.DialogWindowTransparent)
val archiveLoadingDialog = Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent)
val archiveLoadingBinding = DialogArchiveLoadingBinding.inflate(context.layoutInflater)
showArchiveLoadingDialog(archiveLoadingDialog, archiveLoadingBinding.root)
@ -271,7 +271,7 @@ object ArchiveDownloadButtonHelper {
R.string.archive_dialog_title.toResString(),
R.string.archive_apply_dialog_content.toResString(),
R.string.archive_apply.toResString(),
R.string.cancel.toResString(),
com.gh.gamecenter.common.R.string.cancel.toResString(),
{
if(gameEntity.is32() && VHelper.isInnerInstalled(packageName) && !VCore.getInstance().isExtPackageInstalled()) {
// 32位的游戏 并且 32位畅玩没有安装 并且 一体化

View File

@ -41,7 +41,7 @@ object BbsReportHelper {
CurrentActivityHolder.getCurrentActivity()?.apply {
if (this.isFinishing) return@apply
val dialog = Dialog(this, R.style.DialogWindowTransparent)
val dialog = Dialog(this, com.gh.gamecenter.common.R.style.DialogWindowTransparent)
val binding: DialogReportReasonBinding =
DialogReportReasonBinding.inflate(LayoutInflater.from(this))
val reportReasonAdapter = ReportReasonAdapter(
@ -64,7 +64,7 @@ object BbsReportHelper {
this,
1f,
false,
R.color.ui_background
com.gh.gamecenter.common.R.color.ui_background
)
)
binding.reasonRv.adapter = reportReasonAdapter
@ -94,7 +94,7 @@ object BbsReportHelper {
binding.otherReasonEt.doOnTextChanged { text, start, before, count ->
val tvCount: Int = text.toString().length
if (tvCount >= 500) {
binding.tvCount.setTextColor(R.color.secondary_red.toColor(binding.tvCount.context))
binding.tvCount.setTextColor(com.gh.gamecenter.common.R.color.secondary_red.toColor(binding.tvCount.context))
}
binding.tvCount.text = "$tvCount/500"
}

View File

@ -177,7 +177,7 @@ object CommentHelper {
}
val inflater = LayoutInflater.from(context)
val layout = inflater.inflate(R.layout.layout_popup_container, null)
val layout = inflater.inflate(com.gh.gamecenter.common.R.layout.layout_popup_container, null)
val popupWindow = BugFixedPopupWindow(
layout,
LinearLayout.LayoutParams.WRAP_CONTENT,

View File

@ -117,7 +117,7 @@ public class CommentUtils {
) {
Context context = anchor.getContext();
LayoutInflater inflater = LayoutInflater.from(context);
View contentView = inflater.inflate(R.layout.layout_popup_container, null);
View contentView = inflater.inflate(com.gh.gamecenter.common.R.layout.layout_popup_container, null);
PopupWindow popupWindow = new PopupWindow(
contentView,
ViewGroup.LayoutParams.WRAP_CONTENT,
@ -198,14 +198,14 @@ public class CommentUtils {
LinearLayout container = new LinearLayout(context);
container.setOrientation(LinearLayout.VERTICAL);
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
container.setBackgroundColor(ContextCompat.getColor(context, R.color.ui_surface));
container.setBackgroundColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.ui_surface));
for (final String s : arrReportType) {
TextView reportTypeTv = new TextView(context);
reportTypeTv.setText(s);
reportTypeTv.setTextSize(17);
reportTypeTv.setTextColor(ContextCompat.getColor(context, R.color.title));
reportTypeTv.setBackgroundResource(R.drawable.textview_white_style);
reportTypeTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.title));
reportTypeTv.setBackgroundResource(com.gh.gamecenter.common.R.drawable.textview_white_style);
reportTypeTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
LinearLayout.LayoutParams.WRAP_CONTENT));
reportTypeTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
@ -248,12 +248,12 @@ public class CommentUtils {
public static void postVote(final Context context, final CommentEntity commentEntity,
final TextView commentLikeCountTv, final ImageView commentLikeIv,
final OnVoteListener listener) {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.text_theme)) {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme)) {
ToastUtils.INSTANCE.showToast("已经点过赞啦!");
return;
}
commentEntity.setVote(commentEntity.getVote() + 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme));
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
commentLikeCountTv.setVisibility(View.VISIBLE);
@ -271,7 +271,7 @@ public class CommentUtils {
public void postFailed(Throwable e) {
commentEntity.setVote(commentEntity.getVote() - 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.hint));
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
if (commentEntity.getVote() == 0) {
@ -318,12 +318,12 @@ public class CommentUtils {
entrance = "视频流-评论-点赞";
}
CheckLoginUtils.checkLogin(context, entrance, () -> {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.text_theme)) {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme)) {
ToastUtils.INSTANCE.showToast("已经点过赞啦!");
return;
}
commentEntity.setVote(commentEntity.getVote() + 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme));
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
commentLikeCountTv.setVisibility(View.VISIBLE);
@ -340,7 +340,7 @@ public class CommentUtils {
@Override
public void postFailed(Throwable e) {
commentEntity.setVote(commentEntity.getVote() - 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.hint));
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
if (commentEntity.getVote() == 0) {
@ -394,7 +394,7 @@ public class CommentUtils {
@Override
public void postFailed(Throwable e) {
commentEntity.setVote(commentEntity.getVote() - 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.hint));
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
if (commentEntity.getVote() == 0) {
@ -444,7 +444,7 @@ public class CommentUtils {
public void onFailure(@Nullable HttpException e) {
super.onFailure(e);
commentEntity.setVote(commentEntity.getVote() + 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme));
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
commentLikeCountTv.setVisibility(View.VISIBLE);
@ -487,7 +487,7 @@ public class CommentUtils {
// 设置评论item 用户相关的view(点赞/头像/用户名)
public static void setCommentUserView(Context mContext, CommentViewHolder holder, CommentEntity entity) {
MeEntity userDataEntity = entity.getMe();
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, R.color.hint));
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, com.gh.gamecenter.common.R.color.hint));
holder.commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
if (userDataEntity == null || !userDataEntity.isCommentOwner()) {
@ -502,7 +502,7 @@ public class CommentUtils {
holder.commentLikeCountTv.setVisibility(View.GONE);
} else { // 检查是否已点赞
if (userDataEntity != null && (userDataEntity.isCommentVoted())) {
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, R.color.text_theme));
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, com.gh.gamecenter.common.R.color.text_theme));
holder.commentLikeIv.setImageResource(R.drawable.comment_vote_select);
}
holder.commentLikeCountTv.setVisibility(View.VISIBLE);

View File

@ -194,7 +194,7 @@ public class DetailDownloadUtils {
if (showAsVGame) {
// 显示为畅玩游戏
if (context.getString(R.string.launch).equals(rawBtnText)) {
if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
@ -203,13 +203,13 @@ public class DetailDownloadUtils {
String decoratedBtnText;
// 双下载按钮时,显示特殊样式
if (showDualDownloadButton
&& (context.getString(R.string.launch).equals(rawBtnText) || context.getString(R.string.install).equals(rawBtnText) || context.getString(R.string.smooth).equals(rawBtnText) || context.getString(R.string.update).equals(rawBtnText))) {
if (context.getString(R.string.smooth).equals(rawBtnText)) {
decoratedBtnText = context.getString(R.string.download_v);
} else if (context.getString(R.string.update).equals(rawBtnText)) {
decoratedBtnText = context.getString(R.string.update_v);
&& (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.smooth).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText))) {
if (context.getString(com.gh.gamecenter.feature.R.string.smooth).equals(rawBtnText)) {
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.download_v);
} else if (context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText)) {
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.update_v);
} else {
decoratedBtnText = context.getString(R.string.launch_v);
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.launch_v);
}
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
@ -221,8 +221,8 @@ public class DetailDownloadUtils {
decoratedBtnText = rawBtnText + (containsAddWord? "" : downloadAddWord) + getWrappedDownloadSizeText(viewHolder);
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
if (context.getString(R.string.launch).equals(rawBtnText)
|| context.getString(R.string.install).equals(rawBtnText)) {
if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)
|| context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
overlayTv.setVisibility(View.VISIBLE);
overlayTv.setText("启动(畅玩)");
} else {
@ -246,11 +246,11 @@ public class DetailDownloadUtils {
}
} else {
// 非畅玩,显示为普通游戏
if (context.getString(R.string.pluggable).equals(rawBtnText)) {
if (context.getString(com.gh.gamecenter.feature.R.string.pluggable).equals(rawBtnText)) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.PLUGIN);
} else if (context.getString(R.string.launch).equals(rawBtnText)) {
} else if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else if (context.getString(R.string.install).equals(rawBtnText)) {
} else if (context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
} else {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
@ -278,14 +278,14 @@ public class DetailDownloadUtils {
if (viewHolder.isNewsDetail()) {
decoratedBtnText = rawBtnText;
localBtnText = rawBtnText;
} else if (context.getString(R.string.pluggable).equals(rawBtnText)) {
} else if (context.getString(com.gh.gamecenter.feature.R.string.pluggable).equals(rawBtnText)) {
decoratedBtnText = "升级" + (!containsAddWord ? "" : "" + downloadAddWord) + getWrappedDownloadSizeText(viewHolder);
localBtnText = "升级" + (!containsAddWord ? "" : "" + downloadAddWord);
} else if (context.getString(R.string.launch).equals(rawBtnText)) {
} else if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
decoratedBtnText = rawBtnText + (!containsAddWord ? "" : "-" + downloadAddWord);
localBtnText = context.getString(R.string.launch_local);
} else if (context.getString(R.string.attempt).equals(rawBtnText)) {
decoratedBtnText = context.getString(R.string.attempt);
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.launch_local);
} else if (context.getString(com.gh.gamecenter.feature.R.string.attempt).equals(rawBtnText)) {
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.attempt);
localBtnText = rawBtnText;
if (showDualDownloadButton
&& viewHolder.getLocalDownloadContainer() != null
@ -294,12 +294,12 @@ public class DetailDownloadUtils {
} else if (viewHolder.getOverlayTv() != null) {
useAlternativeTextStyle = true;
}
} else if (context.getString(R.string.install).equals(rawBtnText)) {
decoratedBtnText = context.getString(R.string.install);
localBtnText = context.getString(R.string.install_local);
} else if (context.getString(R.string.update).equals(rawBtnText)) {
decoratedBtnText = context.getString(R.string.update);
localBtnText = context.getString(R.string.update_local);
} else if (context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.install);
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.install_local);
} else if (context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText)) {
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.update);
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.update_local);
if (showDualDownloadButton
&& viewHolder.getLocalDownloadContainer() != null
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
@ -311,7 +311,7 @@ public class DetailDownloadUtils {
} else {
decoratedBtnText = rawBtnText;
}
localBtnText = context.getString(R.string.download_local);
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.download_local);
if (showDualDownloadButton
&& viewHolder.getLocalDownloadContainer() != null
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
@ -346,9 +346,9 @@ public class DetailDownloadUtils {
}
if (overlayTv != null && overlayTv.getVisibility() == View.VISIBLE) {
downloadButton.setTag(R.string.download, overlayTv.getText());
downloadButton.setTag(com.gh.gamecenter.feature.R.string.download, overlayTv.getText());
} else {
downloadButton.setTag(R.string.download, downloadButton.getText());
downloadButton.setTag(com.gh.gamecenter.feature.R.string.download, downloadButton.getText());
}
if (downloadEntity == null) return;
@ -488,7 +488,7 @@ public class DetailDownloadUtils {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
break;
case waiting:
downloadButton.setText(R.string.waiting);
downloadButton.setText(com.gh.gamecenter.feature.R.string.waiting);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
break;
case overflow:
@ -498,12 +498,12 @@ public class DetailDownloadUtils {
case diskisfull:
case diskioerror:
case pause:
String pausedText = viewHolder.getContext().getString(R.string.paused);
String pausedText = viewHolder.getContext().getString(com.gh.gamecenter.feature.R.string.paused);
downloadButton.setText(getValidProgress(downloadEntity) + "% " + pausedText);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
break;
case done:
String updateText = viewHolder.getContext().getString(R.string.update);
String updateText = viewHolder.getContext().getString(com.gh.gamecenter.feature.R.string.update);
if (!status.contains(updateText)) {
if (VHelper.isInstalled(downloadEntity.getPackageName())) {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
@ -544,7 +544,7 @@ public class DetailDownloadUtils {
case diskisfull:
case diskioerror:
case overflow:
String pausedText = context.getString(R.string.paused);
String pausedText = context.getString(com.gh.gamecenter.feature.R.string.paused);
String downloadingText = SpeedUtils.getSpeed(downloadEntity.getSpeed());
String resumeText = getValidProgress(downloadEntity) + "% " + pausedText;
downloadButton.setText((downloadEntity.getStatus() == DownloadStatus.downloading || downloadEntity.getStatus() == DownloadStatus.redirected) ? downloadingText : resumeText);
@ -555,7 +555,7 @@ public class DetailDownloadUtils {
}
break;
case waiting:
downloadButton.setText(R.string.waiting);
downloadButton.setText(com.gh.gamecenter.feature.R.string.waiting);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
break;
case done:
@ -563,21 +563,21 @@ public class DetailDownloadUtils {
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(context, gameEntity.getSimulator().getApk().getPackageName());
boolean isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(context);
if (isInstalled || isInstalledNewSimulator) {
downloadButton.setText(R.string.launch);
downloadButton.setText(com.gh.gamecenter.feature.R.string.launch);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
} else {
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
downloadButton.setText(R.string.browser_install_install);
downloadButton.setText(com.gh.gamecenter.feature.R.string.browser_install_install);
} else {
downloadButton.setText(R.string.install);
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
}
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
}
} else {
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
downloadButton.setText(R.string.browser_install_install);
downloadButton.setText(com.gh.gamecenter.feature.R.string.browser_install_install);
} else {
downloadButton.setText(R.string.install);
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
}
}
@ -617,7 +617,7 @@ public class DetailDownloadUtils {
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_UNZIPPING);
return true;
} else if (XapkUnzipStatus.FAILURE.name().equals(xapkStatus)) {
downloadButton.setText(R.string.install);
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_FAILURE);
return true;
}

View File

@ -2,6 +2,7 @@ package com.gh.common.util;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
@ -66,6 +67,7 @@ import com.gh.gamecenter.databinding.DialogReportReasonBinding;
import com.gh.gamecenter.databinding.DialogWechatReserveSuccessBinding;
import com.gh.gamecenter.databinding.ImprintContentItemBinding;
import com.gh.gamecenter.entity.BadgeEntity;
import com.gh.gamecenter.entity.ReserveReminderEntity;
import com.gh.gamecenter.entity.TrackableEntity;
import com.gh.gamecenter.feature.entity.ApkEntity;
import com.gh.gamecenter.feature.entity.Badge;
@ -73,6 +75,7 @@ import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.SettingsEntity;
import com.gh.gamecenter.help.HelpAndFeedbackBridge;
import com.gh.gamecenter.setting.SettingBridge;
import com.halo.assistant.fragment.reserve.ReserveReminderContainerFragment;
import com.lightgame.download.DownloadEntity;
import com.lightgame.utils.AppManager;
import com.lightgame.utils.Util_System_Keyboard;
@ -91,13 +94,13 @@ public class DialogUtils {
context = checkDialogContext(context);
Dialog dialog = new Dialog(context);
View view = View.inflate(context, R.layout.set_wait_dialog, null);
TextView message = view.findViewById(R.id.set_wait_message);
View view = View.inflate(context, com.gh.gamecenter.common.R.layout.set_wait_dialog, null);
TextView message = view.findViewById(com.gh.gamecenter.common.R.id.set_wait_message);
message.setText(msg);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setBackgroundDrawableResource(R.drawable.background_shape_white_radius_8);
dialog.getWindow().setBackgroundDrawableResource(com.gh.gamecenter.common.R.drawable.background_shape_white_radius_8);
WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
layoutParams.width = DisplayUtils.dip2px(160);
dialog.getWindow().setAttributes(layoutParams);
@ -148,6 +151,7 @@ public class DialogUtils {
}
return false;
}
public static void showNoConnectionDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener) {
DialogHelper.showDialog(context, "下载提示", "网络异常,请检查手机网络状态", "知道了", "WiFi自动下载", listener::onConfirm, cancelListener::onCancel, false, "", "");
}
@ -159,7 +163,7 @@ public class DialogUtils {
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_download_traffic, null);
View allowOnce = contentView.findViewById(R.id.allow_once);
@ -255,7 +259,7 @@ public class DialogUtils {
final ConfirmListener cmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_community, null);
View contentContainer = contentView.findViewById(R.id.content_container);
@ -314,7 +318,7 @@ public class DialogUtils {
EmptyCallback callback) {
final Context activityContext = checkDialogContext(context);
final Dialog dialog = new Dialog(activityContext, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(activityContext, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(activityContext).inflate(R.layout.dialog_disallow_privacy_policy, null);
View backButton = contentView.findViewById(R.id.back_button);
@ -350,14 +354,14 @@ public class DialogUtils {
final ConfirmListener cmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_video_upload_draft, null);
TextView negativeTv = contentView.findViewById(R.id.negative);
TextView positiveTv = contentView.findViewById(R.id.positive);
TextView content = contentView.findViewById(R.id.content);
positiveTv.setBackground(DrawableView.getOvalDrawable(R.color.ui_background, 999));
negativeTv.setBackground(DrawableView.getOvalDrawable(R.color.primary_theme, 999));
positiveTv.setBackground(DrawableView.getOvalDrawable(com.gh.gamecenter.common.R.color.ui_background, 999));
negativeTv.setBackground(DrawableView.getOvalDrawable(com.gh.gamecenter.common.R.color.primary_theme, 999));
content.setText(Html.fromHtml(context.getString(R.string.video_upload_draft_dialog_content)));
negativeTv.setOnClickListener(view -> {
@ -407,7 +411,7 @@ public class DialogUtils {
context = checkDialogContext(context);
final TrackableDialog dialog = new TrackableDialog(context,
R.style.GhAlertDialog,
com.gh.gamecenter.common.R.style.GhAlertDialog,
trackableEntity.getEvent(),
trackableEntity.getKey(),
trackableEntity.getValue(),
@ -423,7 +427,7 @@ public class DialogUtils {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
} else {
contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
contentView = LayoutInflater.from(context).inflate(com.gh.gamecenter.common.R.layout.dialog_alert, null);
}
TextView contentTv = contentView.findViewById(R.id.dialog_content);
@ -478,7 +482,7 @@ public class DialogUtils {
public static Dialog showUsageStatsDialog(Context context, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_usage_stats, null);
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
@ -518,7 +522,7 @@ public class DialogUtils {
public static void showDownloadMutexDialog(Context context) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_downlaod_mutex, null);
TextView positive = contentView.findViewById(R.id.dialog_positive);
@ -558,7 +562,7 @@ public class DialogUtils {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
@ -625,7 +629,7 @@ public class DialogUtils {
public static void showLandPageAddressDialog(Context context, GameEntity gameEntity, @NonNull ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
@ -696,7 +700,7 @@ public class DialogUtils {
public static void showGameH5DownloadDialog(Context context, GameEntity gameEntity, RegionSetting.GameH5Download gameH5Download) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
@ -737,7 +741,7 @@ public class DialogUtils {
params = window.getAttributes();
params.width = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.9);
window.setAttributes(params);
window.setBackgroundDrawableResource(R.drawable.textview_white_up);
window.setBackgroundDrawableResource(com.gh.gamecenter.common.R.drawable.textview_white_up);
}
inflate.findViewById(R.id.imprint_close).setOnClickListener(v -> dialog.dismiss());
@ -767,7 +771,7 @@ public class DialogUtils {
// close line
View view = new View(context);
view.setBackgroundColor(context.getResources().getColor(R.color.text_5d5d5d));
view.setBackgroundColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_5d5d5d));
view.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(1)));
content.addView(view);
}
@ -775,7 +779,7 @@ public class DialogUtils {
public static void showKaifuRemindDialog(Context context, String content, String gameName) {
context = checkDialogContext(context);
final Dialog dialog = new TrackableDialog(context, R.style.GhAlertDialog, "开服说明弹窗", "弹窗", gameName, null, null, true);
final Dialog dialog = new TrackableDialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog, "开服说明弹窗", "弹窗", gameName, null, null, true);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_kaifu_remind, null);
@ -805,7 +809,7 @@ public class DialogUtils {
public static void showStopServerExplanationDialog(Context context, String content, String gameName) {
context = checkDialogContext(context);
final Dialog dialog = new TrackableDialog(context, R.style.GhAlertDialog, "评论说明弹窗", "弹窗", gameName, null, null, true);
final Dialog dialog = new TrackableDialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog, "评论说明弹窗", "弹窗", gameName, null, null, true);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_stop_service_explanation, null);
@ -850,7 +854,7 @@ public class DialogUtils {
final Dialog dialog = new TrackableDialog(
context,
R.style.GhAlertDialog,
com.gh.gamecenter.common.R.style.GhAlertDialog,
"礼仪考试",
"礼仪考试弹窗",
null, null, null,
@ -904,9 +908,9 @@ public class DialogUtils {
public static void showNoticeDialog(Context context, String title, String content, @NonNull ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_notice, null);
View contentView = LayoutInflater.from(context).inflate(com.gh.gamecenter.common.R.layout.dialog_notice, null);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
@ -931,7 +935,7 @@ public class DialogUtils {
public static void showViewBadgeDialog(Context context, Badge badge, ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_view_badge, null);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
@ -952,7 +956,7 @@ public class DialogUtils {
});
}
Animation animation = AnimationUtils.loadAnimation(context, R.anim.anim_badge_light_bg);
Animation animation = AnimationUtils.loadAnimation(context, com.gh.gamecenter.common.R.anim.anim_badge_light_bg);
badgeLightBg.startAnimation(animation);
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
@ -969,7 +973,7 @@ public class DialogUtils {
public static void showReceiveBadgeDialog(Context context, BadgeEntity badge, ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_receive_badge, null);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
@ -999,7 +1003,7 @@ public class DialogUtils {
receiveTv.setText(R.string.apply_badge);
}
Animation animation = AnimationUtils.loadAnimation(context, R.anim.anim_badge_light_bg);
Animation animation = AnimationUtils.loadAnimation(context, com.gh.gamecenter.common.R.anim.anim_badge_light_bg);
badgeLightBg.startAnimation(animation);
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
@ -1016,7 +1020,7 @@ public class DialogUtils {
public static void showPassRegulationDialog(Context context, String icon) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_pass_regulation, null);
SimpleDraweeView userIcon = contentView.findViewById(R.id.dialog_icon);
@ -1035,7 +1039,7 @@ public class DialogUtils {
public static void showShortCutPermissionDialog(Context context) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_shortcut_permission, null);
@ -1060,7 +1064,7 @@ public class DialogUtils {
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_cancel_reservation, null);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
@ -1101,11 +1105,11 @@ public class DialogUtils {
public static void showSimulatorParseErrorDialog(Context context, String gameId, String gameName, ConfirmListener confirmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
DialogPackageParseErrorBinding binding = DialogPackageParseErrorBinding.inflate(LayoutInflater.from(context), null, false);
Context finalContext = context;
SpannableStringBuilder builder = new SpanBuilder("您也可以点击提交反馈跟我们联系").click(context, 6, 10, R.color.text_theme, true, new Function0<Unit>() {
SpannableStringBuilder builder = new SpanBuilder("您也可以点击提交反馈跟我们联系").click(context, 6, 10, com.gh.gamecenter.common.R.color.text_theme, true, new Function0<Unit>() {
@Override
public Unit invoke() {
SimpleGameEntity entity = new SimpleGameEntity(gameId, gameName, "", "");
@ -1145,7 +1149,7 @@ public class DialogUtils {
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);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
DialogReportReasonBinding binding = DialogReportReasonBinding.inflate(LayoutInflater.from(context));
if (!title.isEmpty()) {
@ -1164,7 +1168,7 @@ public class DialogUtils {
return null;
});
binding.reasonRv.setLayoutManager(new LinearLayoutManager(context));
binding.reasonRv.addItemDecoration(new VerticalItemDecoration(context, 1F, false, R.color.ui_background));
binding.reasonRv.addItemDecoration(new VerticalItemDecoration(context, 1F, false, com.gh.gamecenter.common.R.color.ui_background));
binding.reasonRv.setAdapter(reportReasonAdapter);
binding.negativeBtn.setOnClickListener(v -> {
@ -1186,7 +1190,7 @@ public class DialogUtils {
ExtensionsKt.setTextChangedListener(binding.otherReasonEt, (s, start, before, count) -> {
int tvCount = s.length();
if (tvCount >= 500) {
binding.tvCount.setTextColor(ContextCompat.getColor(finalContext, R.color.secondary_red));
binding.tvCount.setTextColor(ContextCompat.getColor(finalContext, com.gh.gamecenter.common.R.color.secondary_red));
}
binding.tvCount.setText(tvCount + "/500");
return null;
@ -1200,7 +1204,7 @@ public class DialogUtils {
public static Dialog showBindPhoneDialog(Context context, ConfirmListener listener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
DialogBindPhoneBinding binding = DialogBindPhoneBinding.inflate(LayoutInflater.from(context));
binding.positiveTv.setOnClickListener(v -> {
@ -1221,10 +1225,10 @@ public class DialogUtils {
public static void showReserveOrVoteSuccess2WechatBindDialog(Context context, Boolean isReserve, ConfirmListener confirmListener, CancelListener cancelListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
DialogWechatReserveSuccessBinding binding = DialogWechatReserveSuccessBinding.inflate(LayoutInflater.from(context));
binding.titleIv.setImageResource(isReserve ? R.drawable.bg_reserve_success : R.drawable.bg_vote_success);
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心收到通知。为了避免错过通知,建议您开启微信公众号提醒": "版本上线时,您将在消息中心收到通知。为了避免错过通知,亦建议您开启微信公众号提醒");
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心收到通知。为了避免错过通知,建议您开启微信公众号提醒" : "版本上线时,您将在消息中心收到通知。为了避免错过通知,亦建议您开启微信公众号提醒");
binding.closeBtn.setOnClickListener(v -> {
cancelListener.onCancel();
dialog.dismiss();
@ -1248,7 +1252,7 @@ public class DialogUtils {
public static void showReserveOrVoteSuccessDialog(Context context, Boolean isReserve) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
DialogAlertDefaultBinding binding = DialogAlertDefaultBinding.inflate(LayoutInflater.from(context));
binding.titleTv.setText(isReserve ? "游戏预约成功" : "版本投票成功");
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心和微信公众号收到通知,不会错过任何预约的游戏" : "版本上线时,您将在消息中心和微信公众号收到通知,不会错过任何投票的版本");
@ -1269,10 +1273,14 @@ public class DialogUtils {
}
}
public static void showReserveReminderDialog(Context context, GameEntity gameEntity, ReserveReminderEntity reserveReminder) {
ReserveReminderContainerFragment.show(context, gameEntity, reserveReminder);
}
public static void showRelievePhoneDialog(Context context) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
DialogRelievePhoneBinding binding = DialogRelievePhoneBinding.inflate(LayoutInflater.from(context));
Context finalContext = context;

View File

@ -12,6 +12,7 @@ import android.text.TextUtils
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.ad.AdPluginDownloadHelper
import com.gh.common.constant.Config
import com.gh.common.exposure.ExposureManager.log
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
@ -78,6 +79,7 @@ import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity
import com.gh.gamecenter.qa.subject.CommunitySubjectActivity
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.SearchActivity
import com.gh.gamecenter.servers.GameServerTestActivity
import com.gh.gamecenter.servers.GameServersActivity
import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity
@ -177,7 +179,8 @@ object DirectUtils {
"bbs_section",
"qa",
"feedback",
"toolkit"
"toolkit",
"float_window_game"
)
fun directToLinkPage(
@ -482,11 +485,13 @@ object DirectUtils {
ColumnCollectionDetailFragment.TYPE_QQ_MINI_GAME_COLUMN -> directToQGameHome(context)
// QQ游戏专题详情页
ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN, ViewPagerFragmentHelper.TYPE_WECHAT_GAME_COLUMN -> {
val subjectType = if (linkEntity.type == ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN) {
SubjectData.SubjectType.QQ_GAME
} else {
SubjectData.SubjectType.WECHAT_GAME
ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN,
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_COLUMN,
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_CPM_COLUMN -> {
val subjectType = when (linkEntity.type) {
ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN -> SubjectData.SubjectType.QQ_GAME
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_CPM_COLUMN -> SubjectData.SubjectType.WECHAT_GAME_CPM
else -> SubjectData.SubjectType.WECHAT_GAME
}
directToSubject(
context = context,
@ -549,6 +554,22 @@ object DirectUtils {
MiniGameItemHelper.launchMiniGame(it, Constants.WECHAT_MINI_GAME)
}
"float_window_game" -> linkEntity.link?.let { link ->
if (PackageUtils.isInstalled(context, Constants.TOOL_MAP_PACKAGE_NAME)) {
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse("ghtoolmap://floatWindow")
).also {
it.addCategory(Intent.CATEGORY_DEFAULT)
it.addCategory(Intent.CATEGORY_BROWSABLE)
it.putExtra("gameId", linkEntity.link)
}
context.startActivity(intent)
} else {
directToGameDetail(context, Config.getFloatWindowSettingEntity()?.gameId ?: "")
}
}
"" -> {
// do nothing
}
@ -1964,19 +1985,23 @@ object DirectUtils {
return
}
CheckLoginUtils.checkLogin(
activity, null, true, "QQ小游戏-秒开"
) {
val qGameProvider = ARouter
.getInstance()
.build(RouteConsts.provider.qGame)
.navigation() as? IQGameProvider
if (qGameProvider == null) return
// 下载广点通广告插件,供 QQ 小游戏启动使用 (当次启动不保证能用,但是下一次就大概率就能了)
AdPluginDownloadHelper.downloadPluginIfNeeded(isGdt = true)
CheckLoginUtils.checkLogin(activity, null, true, "QQ小游戏-秒开") {
val userToken = UserManager.getInstance().token
val userId = UserManager.getInstance().userId
val userName = UserManager.getInstance().userInfoEntity?.name ?: "unknown"
val qGameProvider = ARouter
.getInstance()
.build(RouteConsts.provider.qGame)
.navigation() as? IQGameProvider
qGameProvider?.setLoginInfo(activity, userId, userName, userToken)
qGameProvider?.launchGame(activity, qqAppId) { _, _ ->
qGameProvider.setLoginInfo(activity, userId, userName, userToken)
qGameProvider.launchGame(activity, qqAppId) { _, _ ->
MiniGameRecentlyPlayUseCase.submitRecentPlayedQGame(qqAppId, userId)
}
}
@ -1986,6 +2011,8 @@ object DirectUtils {
fun directToWechatGameById(
activity: Activity,
wechatAppId: String,
wechatAppPath: String = "",
wechatAppExtData: String = ""
) {
val wxApiProxy = WXAPIFactory.createWXAPI(
@ -2000,8 +2027,9 @@ object DirectUtils {
wxApiProxy.sendReq(
WXLaunchMiniProgram.Req().apply {
userName = wechatAppId
path = Constants.WECHAT_MINI_GAME_PCS
miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;
path = wechatAppPath.ifEmpty { Constants.WECHAT_MINI_GAME_PCS }
extData = wechatAppExtData
miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE
}
)

View File

@ -27,6 +27,8 @@ import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
import com.gh.gamecenter.common.callback.CancelListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
@ -128,6 +130,7 @@ object DownloadItemUtils {
holder.gameDownloadBtn.text = "已预约"
holder.gameDownloadBtn.visibility = View.VISIBLE
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.RESERVED
holder.multiVersionDownloadTv.visibility = View.GONE
updateItemViewStatus(holder, null, null)
}
}
@ -241,9 +244,9 @@ object DownloadItemUtils {
if (RegionSettingHelper.getGameH5DownloadByGameId(gameEntity.id) != null) {
downloadBtn.apply {
isClickable = true
text = context.getString(R.string.check)
setBackgroundResource(R.drawable.download_button_normal_style)
setTextColor(R.color.white.toColor(context))
text = context.getString(com.gh.gamecenter.feature.R.string.check)
setBackgroundResource(com.gh.gamecenter.common.R.drawable.download_button_normal_style)
setTextColor(com.gh.gamecenter.common.R.color.white.toColor(context))
}
return
}
@ -251,15 +254,15 @@ object DownloadItemUtils {
if (gameEntity.isMiniGameOffShelve()) {
downloadBtn.apply {
isClickable = false
text = context.getString(R.string.off_shelve)
text = context.getString(com.gh.gamecenter.feature.R.string.off_shelve)
buttonStyle = DownloadButton.ButtonStyle.NONE
}
} else {
downloadBtn.apply {
isClickable = true
setBackgroundResource(R.drawable.download_button_normal_style)
setTextColor(R.color.white.toColor(context))
text = context.getString(R.string.quick_play)
setBackgroundResource(com.gh.gamecenter.common.R.drawable.download_button_normal_style)
setTextColor(com.gh.gamecenter.common.R.color.white.toColor(context))
text = context.getString(com.gh.gamecenter.feature.R.string.quick_play)
}
}
return
@ -270,21 +273,21 @@ object DownloadItemUtils {
downloadBtn.apply {
if (h5LinkEntity != null) {
text = if ("play" == h5LinkEntity.type) {
context.getString(R.string.start_playing)
context.getString(com.gh.gamecenter.feature.R.string.start_playing)
} else {
context.getString(R.string.check)
context.getString(com.gh.gamecenter.feature.R.string.check)
}
isClickable = true
buttonStyle = DownloadButton.ButtonStyle.NORMAL
} else {
if ("dialog" == offStatus) {
text = context.getString(R.string.check)
text = context.getString(com.gh.gamecenter.feature.R.string.check)
buttonStyle = DownloadButton.ButtonStyle.NORMAL
} else if ("updating" == offStatus) {
text = context.getString(R.string.updating)
text = context.getString(com.gh.gamecenter.feature.R.string.updating)
buttonStyle = DownloadButton.ButtonStyle.UPDATING
} else {
text = context.getString(R.string.none)
text = context.getString(com.gh.gamecenter.feature.R.string.none)
buttonStyle = DownloadButton.ButtonStyle.NONE
if (hideDownloadBtnIfNoAvailableContent) {
visibility = View.GONE
@ -297,11 +300,13 @@ object DownloadItemUtils {
// 来自于下载管理的实体快照
val entityFromDownloadManager = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
// 是否正在下载中
val isDownloading = entityFromDownloadManager != null && entityFromDownloadManager.status != DownloadStatus.done
val isDownloading =
entityFromDownloadManager != null && entityFromDownloadManager.status != DownloadStatus.done
// 是否已安装至本地
val isInstalledLocally = PackagesManager.isInstalled(gameEntity.getUniquePackageName())
// 来自于畅玩安装列表的实体快照,若存在,代表游戏已下载并成功安装
val entityFromInstalledVGame = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
val entityFromInstalledVGame =
VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
// 是否已安装至畅玩
val isInstalledToVSpace = entityFromInstalledVGame != null
// 是否处于待安装状态 (仅本地安装有这个状态)
@ -318,19 +323,20 @@ object DownloadItemUtils {
// 3. 存在待安装任务时,待安装任务优先
// 4. 存在一个已安装,已安装的显示优先
// 5. 都已安装,按后台配置显示的状态优先
val isVGamePreferred = if (!isInstalledLocally && !isInstalledToVSpace && entityFromDownloadManager == null) {
gameEntity.isVGamePreferred()
} else if (isDownloading || isPendingToInstall) {
entityFromDownloadManager?.isVGameDownloadInDualDownloadMode() == true
} else if (isInstalledLocally && isInstalledToVSpace) {
gameEntity.isVGamePreferred()
} else if (isInstalledLocally) {
false
} else if (isInstalledToVSpace) {
true
} else {
gameEntity.isVGamePreferred()
}
val isVGamePreferred =
if (!isInstalledLocally && !isInstalledToVSpace && entityFromDownloadManager == null) {
gameEntity.isVGamePreferred()
} else if (isDownloading || isPendingToInstall) {
entityFromDownloadManager?.isVGameDownloadInDualDownloadMode() == true
} else if (isInstalledLocally && isInstalledToVSpace) {
gameEntity.isVGamePreferred()
} else if (isInstalledLocally) {
false
} else if (isInstalledToVSpace) {
true
} else {
gameEntity.isVGamePreferred()
}
val downloadEntity: DownloadEntity? = if (isDownloading) {
entityFromDownloadManager
@ -358,17 +364,17 @@ object DownloadItemUtils {
asVGame = true
)
) {
setText(R.string.update)
setText(com.gh.gamecenter.feature.R.string.update)
DownloadButton.ButtonStyle.NORMAL
} else {
setText(R.string.launch)
setText(com.gh.gamecenter.feature.R.string.launch)
DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
}
} else {
val xapkStatus = downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS]
if (XapkUnzipStatus.SUCCESS.name == xapkStatus && isInstalling(downloadEntity.path)) {
progress = 100
setText(R.string.installing)
setText(com.gh.gamecenter.feature.R.string.installing)
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
return
}
@ -379,23 +385,27 @@ object DownloadItemUtils {
buttonStyle = DownloadButton.ButtonStyle.XAPK_UNZIPPING
return
} else if (XapkUnzipStatus.FAILURE.name == xapkStatus) {
setText(R.string.install)
setText(com.gh.gamecenter.feature.R.string.install)
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
return
}
if (PackagesManager.isInstalled(downloadEntity.packageName) && !downloadEntity.isUpdate) {
// 双下载按钮快速安装时存在已下载的安装包过时,需要重新下载的情况
if (PackagesManager.isCanUpdate(downloadEntity.gameId, downloadEntity.packageName)) {
if (PackagesManager.isCanUpdate(
downloadEntity.gameId,
downloadEntity.packageName
)
) {
buttonStyle = DownloadButton.ButtonStyle.NORMAL
setText(R.string.update)
setText(com.gh.gamecenter.feature.R.string.update)
} else {
buttonStyle = DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
setText(R.string.launch)
setText(com.gh.gamecenter.feature.R.string.launch)
}
} else {
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
setText(R.string.install)
setText(com.gh.gamecenter.feature.R.string.install)
}
}
buttonStyle =
@ -414,7 +424,7 @@ object DownloadItemUtils {
DownloadStatus.diskioerror,
DownloadStatus.overflow -> {
buttonStyle = DownloadButton.ButtonStyle.NORMAL
setText(R.string.resume)
setText(com.gh.gamecenter.feature.R.string.resume)
}
DownloadStatus.cancel -> {
@ -500,13 +510,13 @@ object DownloadItemUtils {
DownloadStatus.downloading -> {
if (isMultiVersion) {
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
val darkMode = (holder.gameDownloadTips?.getTag(R.string.is_dark_mode_on_id) as? Boolean) ?: false
val darkMode = (holder.gameDownloadTips?.getTag(com.gh.gamecenter.common.R.string.is_dark_mode_on_id) as? Boolean) ?: false
val isDarkModeChanged = DarkModeUtils.isDarkModeOn(context) != darkMode
if (holder.gameDownloadTips?.visibility == View.GONE || holder.gameDownloadTips?.isAnimating == false || isDarkModeChanged) {
holder.gameDownloadTips?.visibility = View.VISIBLE
holder.gameDownloadTips?.setDownloadTipsAnimation(true)
}
holder.gameDownloadTips?.setTag(R.string.is_dark_mode_on_id, DarkModeUtils.isDarkModeOn(context))
holder.gameDownloadTips?.setTag(com.gh.gamecenter.common.R.string.is_dark_mode_on_id, DarkModeUtils.isDarkModeOn(context))
} else {
holder.gameDownloadTips?.visibility = View.GONE
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_NORMAL
@ -521,7 +531,7 @@ object DownloadItemUtils {
holder.gameDownloadTips?.setDownloadTipsAnimation(false)
}
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.WAITING
holder.gameDownloadBtn.text = context.getString(R.string.waiting)
holder.gameDownloadBtn.text = context.getString(com.gh.gamecenter.feature.R.string.waiting)
}
DownloadStatus.pause,
@ -536,7 +546,7 @@ object DownloadItemUtils {
holder.gameDownloadTips?.setDownloadTipsAnimation(false)
}
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
holder.gameDownloadBtn.text = context.getString(R.string.resume)
holder.gameDownloadBtn.text = context.getString(com.gh.gamecenter.feature.R.string.resume)
}
DownloadStatus.done -> {
@ -551,7 +561,7 @@ object DownloadItemUtils {
holder.gameDownloadBtn.text = "$percent%"
return
} else if (XapkUnzipStatus.FAILURE.name == xapkStatus) {
holder.gameDownloadBtn.setText(R.string.install)
holder.gameDownloadBtn.setText(com.gh.gamecenter.feature.R.string.install)
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
return
}
@ -626,7 +636,17 @@ object DownloadItemUtils {
location: String,
sourceEntrance: String = "其他"
) {
setOnClickListener(context, downloadBtn, gameEntity, position, adapter, entrance, sourceEntrance, location, null)
setOnClickListener(
context,
downloadBtn,
gameEntity,
position,
adapter,
entrance,
sourceEntrance,
location,
null
)
}
@JvmStatic
@ -641,7 +661,18 @@ object DownloadItemUtils {
location: String,
traceEvent: ExposureEvent?,
) {
setOnClickListener(context, downloadBtn, gameEntity, position, adapter, entrance, sourceEntrance, location, traceEvent, null)
setOnClickListener(
context,
downloadBtn,
gameEntity,
position,
adapter,
entrance,
sourceEntrance,
location,
traceEvent,
null
)
}
/**
@ -779,14 +810,18 @@ object DownloadItemUtils {
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.id)) {
SensorsBridge.trackEvent(
"AppointmentGame",
"game_name",
gameEntity.name ?: "",
"game_id",
gameEntity.id,
"game_type",
gameEntity.categoryChinese,
"source_entrance",
sourceEntrance
"game_name", gameEntity.name ?: "",
"game_id", gameEntity.id,
"game_type", gameEntity.categoryChinese,
"source_entrance", sourceEntrance,
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId,
"source", gameEntity.exposureEvent?.source?.toString() ?: "",
*gameEntity.customPageTrackData?.toKV() ?: arrayOf()
)
allStateClickCallback?.onCallback()
CheckLoginUtils.checkLogin(context, entrance) {
@ -812,7 +847,7 @@ object DownloadItemUtils {
}
}
} else {
ReservationHelper.showCancelReservationDialog(context, {
ReservationHelper.showCancelReservationDialog(context, gameEntity,{
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
"确定取消",
gameEntity.id,
@ -845,7 +880,7 @@ object DownloadItemUtils {
}
if (gameEntity.isMiniGame()) {
downloadBtn.setOnClickListener {
MiniGameItemHelper.launchMiniGame(gameEntity.miniGameAppId, gameEntity.miniGameType)
MiniGameItemHelper.launchMiniGame(gameEntity)
clickCallback?.onCallback()
allStateClickCallback?.onCallback()
}
@ -887,7 +922,7 @@ object DownloadItemUtils {
}
// 启动不需要请求存储权限
if (downloadBtn is DownloadButton && downloadBtn.text == context.getString(R.string.launch)) {
if (downloadBtn is DownloadButton && downloadBtn.text == context.getString(com.gh.gamecenter.feature.R.string.launch)) {
clickRunnable.onCallback()
} else {
PermissionHelper.checkStoragePermissionBeforeAction(
@ -935,13 +970,13 @@ object DownloadItemUtils {
traceEvent: ExposureEvent? = null,
refreshCallback: EmptyCallback? = null
) {
val str = if (downloadBtn is DownloadButton) downloadBtn.text else context.getString(R.string.download)
val str = if (downloadBtn is DownloadButton) downloadBtn.text else context.getString(com.gh.gamecenter.feature.R.string.download)
if (gameEntity.getApk().isEmpty()) return
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
val shouldPerformAsVGame = GameUtils.shouldPerformAsVGame(gameEntity)
if (str == context.getString(R.string.download)) {
if (str == context.getString(com.gh.gamecenter.feature.R.string.download)) {
DownloadChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(UpdateNewSimulatorHandler())
@ -959,7 +994,7 @@ object DownloadItemUtils {
.buildHandlerChain()
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.attempt)) {
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.attempt)) {
DownloadChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(UpdateNewSimulatorHandler())
@ -978,7 +1013,7 @@ object DownloadItemUtils {
.buildHandlerChain()
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.smooth)) {
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.smooth)) {
DownloadChainBuilder().apply {
addHandler(UnsupportedFeatureHandler())
addHandler(GamePermissionHandler())
@ -1010,7 +1045,7 @@ object DownloadItemUtils {
.buildHandlerChain()
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
}
} else if (str == context.getString(R.string.install)) {
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.install)) {
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apk.url)
com.gh.gamecenter.common.utils.NewFlatLogUtils.logGameInstall(
@ -1050,14 +1085,15 @@ object DownloadItemUtils {
}
install(context, gameEntity, position, adapter, refreshCallback)
} else if (str == context.getString(R.string.launch)) {
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.launch)) {
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
return
}
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().firstOrNull()?.url)
val downloadEntity =
SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().firstOrNull()?.url)
if (downloadEntity != null) {
val file = File(downloadEntity.path)
if (!file.exists()) {
@ -1080,7 +1116,7 @@ object DownloadItemUtils {
}
PackageLauncher.launch(context, gameEntity)
} else if (str == context.getString(R.string.update)) {
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.update)) {
if (shouldPerformAsVGame) {
VHelper.updateOrReDownload(gameEntity)
return
@ -1122,11 +1158,11 @@ object DownloadItemUtils {
return
}
when (str) {
context.getString(R.string.resume) -> {
context.getString(com.gh.gamecenter.feature.R.string.resume) -> {
DownloadManager.getInstance().resume(downloadEntity, false)
}
context.getString(R.string.waiting) -> {
context.getString(com.gh.gamecenter.feature.R.string.waiting) -> {
Utils.toast(context, "最多只能同时下载三个任务,请稍等")
}
@ -1204,7 +1240,7 @@ object DownloadItemUtils {
}, 1000)
}
if (downloadBtn is DownloadButton) {
downloadBtn.setText(R.string.downloading)
downloadBtn.setText(com.gh.gamecenter.feature.R.string.downloading)
downloadBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN
}
} else {
@ -1226,7 +1262,7 @@ object DownloadItemUtils {
val path = downloadEntity.path
when {
FileUtils.isEmptyFile(path) -> {
Utils.toast(context, R.string.install_failure_hint)
Utils.toast(context, com.gh.gamecenter.common.R.string.install_failure_hint)
DownloadManager.getInstance().cancel(downloadEntity.url)
gameEntity.getEntryMap().remove(apkEntity?.getPlatform())
adapter?.notifyItemChanged(position)

View File

@ -10,7 +10,6 @@ import android.os.Build
import androidx.core.app.NotificationCompat
import com.gh.common.xapk.XapkInstaller
import com.gh.common.xapk.XapkUnzipStatus
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.getMetaExtra
@ -199,6 +198,6 @@ object DownloadNotificationHelper {
}
private fun getNotificationIcon(): Int {
return R.mipmap.logo
return com.gh.gamecenter.common.R.mipmap.logo
}
}

View File

@ -30,6 +30,7 @@ import com.gh.gamecenter.feature.entity.SimulatorEntity
import com.gh.gamecenter.feature.utils.PlatformUtils
import com.gh.gamecenter.help.HelpAndFeedbackBridge
import com.gh.gamecenter.pkg.PkgHelper
import com.gh.ndownload.NDownloadBridge
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
import com.lightgame.download.DataWatcher
@ -53,6 +54,12 @@ object DownloadObserver {
private val mRetryableHashMap = hashMapOf<String, Boolean>()
/**
* 当下载任务是 预约上线提醒 触发的,则所有弹窗均不显示
*/
private val DownloadEntity.isDownloadByReserveOnlineReminder: Boolean
get() = !meta?.get(Constants.IS_RESERVE_ONLINE_REMINDER).isNullOrBlank()
// 如果在WIFI状态下,下载自动暂停,则再重试一遍
@JvmStatic
fun initObserver() {
@ -73,6 +80,9 @@ object DownloadObserver {
if (DownloadStatus.hijack == status) {
// 链接被劫持
if (downloadEntity.isDownloadByReserveOnlineReminder) {
return
}
processHijack(downloadEntity)
return
} else if (DownloadStatus.notfound == status) {
@ -89,7 +99,9 @@ object DownloadObserver {
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
if (downloadEntity.isDownloadByReserveOnlineReminder) {
return
}
DialogHelper.showDialog(
currentActivity,
"下载失败",
@ -158,7 +170,9 @@ object DownloadObserver {
DownloadDataHelper.uploadRedirectEvent(downloadEntity)
} else if (DownloadStatus.unqualified == status) {
// 未成年
RealNameHelper.showRealNameUnqualifiedDialog(downloadEntity)
if (!downloadEntity.isDownloadByReserveOnlineReminder) {
RealNameHelper.showRealNameUnqualifiedDialog(downloadEntity)
}
// 删除任务
downloadEntity.status = DownloadStatus.cancel
@ -167,7 +181,7 @@ object DownloadObserver {
// 未接入防沉迷系统
val currentActivity = AppManager.getInstance().currentActivity()
if (currentActivity != null) {
if (currentActivity != null && !downloadEntity.isDownloadByReserveOnlineReminder) {
DialogHelper.showDialog(
context = currentActivity,
title = "温馨提示",
@ -186,7 +200,7 @@ object DownloadObserver {
// 未接入防沉迷系统
val currentActivity = AppManager.getInstance().currentActivity()
if (currentActivity != null) {
if (currentActivity != null && !downloadEntity.isDownloadByReserveOnlineReminder) {
DialogHelper.showDialog(
context = currentActivity,
title = "实名提示",
@ -212,7 +226,9 @@ object DownloadObserver {
downloadManager.cancel(downloadEntity.url)
} else if (DownloadStatus.uncertificated == status) {
// 未实名
RealNameHelper.showRealNameUncertificatedDialog(downloadEntity)
if (!downloadEntity.isDownloadByReserveOnlineReminder) {
RealNameHelper.showRealNameUncertificatedDialog(downloadEntity)
}
// 删除任务
downloadEntity.status = DownloadStatus.cancel
@ -227,11 +243,15 @@ object DownloadObserver {
if (DownloadStatus.done == status) {
if (mDoneDebouncePair?.first != downloadEntity.url) {
mDoneDebouncePair = Pair(downloadEntity.url, System.currentTimeMillis())
// 清理临时变量
downloadEntity.addMetaExtra(Constants.IS_RESERVE_ONLINE_REMINDER, "")
performDownloadCompleteAction(downloadEntity, downloadManager)
} else {
if (mDoneDebouncePair?.second == 0L
|| System.currentTimeMillis() - (mDoneDebouncePair?.second ?: 0) > 500
) {
// 清理临时变量
downloadEntity.addMetaExtra(Constants.IS_RESERVE_ONLINE_REMINDER, "")
performDownloadCompleteAction(downloadEntity, downloadManager)
}
}
@ -352,7 +372,7 @@ object DownloadObserver {
val isAutoInstall = SPUtils.getBoolean(Constants.SP_AUTO_INSTALL, true)
if (downloadType != Constants.VSPACE_32_DOWNLOAD_ONLY && (downloadType == Constants.SIMULATOR_DOWNLOAD || isAutoInstall)) {
if (FileUtils.isEmptyFile(downloadEntity.path)) {
Utils.toast(mApplication, R.string.install_failure_hint)
Utils.toast(mApplication, com.gh.gamecenter.common.R.string.install_failure_hint)
downloadManager.cancel(downloadEntity.url)
} else {
if (PackageUtils.isCanLaunchSetup(mApplication, downloadEntity.path)
@ -474,7 +494,7 @@ object DownloadObserver {
java.lang.Boolean.parseBoolean(downloadEntity.getMetaExtra(Constants.IS_PLATFORM_RECOMMEND))
val exposureEvent = ExposureUtils.logADownloadCompleteExposureEvent(
GameEntity(
id = downloadEntity.gameId,
_id = downloadEntity.gameId,
mName = downloadEntity.name.removeSuffix(Constants.GAME_NAME_DECORATOR),
gameVersion = downloadEntity.versionName ?: "",
isPlatformRecommend = isPlatformRecommend,
@ -486,6 +506,7 @@ object DownloadObserver {
downloadSpeed,
downloadEntity.meta[DownloadEntity.DOWNLOAD_HOST_KEY] ?: "unknown",
downloadEntity.meta[DownloadEntity.DOWNLOAD_PATH_KEY] ?: "unknown",
downloadEntity.meta[NDownloadBridge.REDIRECTED_URL_LIST] ?: "unknown",
type
)
@ -511,7 +532,7 @@ object DownloadObserver {
"space_schema_type",
if (downloadEntity.packageName == VHelper.VSPACE_32BIT_PACKAGENAME) "32位" else "64位"
)
} else if(downloadEntity.gameId == Constants.HALO_FUN_NEW_32_GAME_ID) {
} else if (downloadEntity.gameId == Constants.HALO_FUN_NEW_32_GAME_ID) {
SensorsBridge.trackEvent(
"HaloFunDownloadDone",
"space_schema_type",

View File

@ -7,13 +7,13 @@ import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.gh.common.constant.Config
import com.gh.common.dialog.WechatBindingFailedDialogFragment
import com.gh.gamecenter.R
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.VerifyPhoneActivity
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.avoidcallback.AvoidOnResultManager
import com.gh.gamecenter.common.avoidcallback.Callback
import com.gh.gamecenter.common.callback.CancelListener
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
@ -188,10 +188,10 @@ object ErrorHelper {
403015 -> Utils.toast(context, "已经关注过了")
404001 -> Utils.toast(context, "请求的资源不存在")
403016 -> Utils.toast(context, "标签内容可能包含敏感信息,请修改后再提交")
403018 -> Utils.toast(context, R.string.comment_failed_unable)
403018 -> Utils.toast(context, com.gh.gamecenter.common.R.string.comment_failed_unable)
403070 -> Utils.toast(context, "请勿重复提交~")
403073 -> Utils.toast(context, "标题违规,请重新编辑")
403074 -> Utils.toast(context, "该微信号(${errorEntity.data?.nickname})已绑定")
403074 -> handleErrorWithRepeatWechatBinding(context, errorEntity)
403078 -> Utils.toast(context, "已点赞")
403072 -> Utils.toast(context, R.string.comment_failed_userblocked)
403082 -> Utils.toast(context, "作者已关闭评论")
@ -234,6 +234,10 @@ object ErrorHelper {
}
}
private fun handleErrorWithRepeatWechatBinding(context: Context, errorEntity: ErrorEntity) {
WechatBindingFailedDialogFragment.show(context, errorEntity.data?.userConflict)
}
private fun handleAskFrequentlyError(context: Context, showHighPriorityHint: Boolean) {
if (showHighPriorityHint) {
DialogHelper.showDialog(
@ -261,7 +265,7 @@ object ErrorHelper {
SensorsBridge.trackVerificationDialogShow(
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?:"",
gameType = gameEntity?.categoryChinese ?: "",
articleType = articleType,
verificationType = verificationType
)
@ -292,7 +296,7 @@ object ErrorHelper {
)
}
binding.hintTv.text = errorEntity.data?.text
binding.hintTv.setTextColor(R.color.text_theme.toColor(context))
binding.hintTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
binding.hintTv.setOnClickListener {
errorEntity.data?.toLinkEntity()?.let { entity ->
DirectUtils.directToLinkPage(context, entity, "实名提醒弹窗", "")
@ -361,7 +365,7 @@ object ErrorHelper {
)
}
binding.hintTv.text = errorEntity.data?.text
binding.hintTv.setTextColor(R.color.text_theme.toColor(context))
binding.hintTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
binding.hintTv.setOnClickListener {
errorEntity.data?.toLinkEntity()?.let { entity ->
DirectUtils.directToLinkPage(context, entity, "手机号验证", "")

View File

@ -207,8 +207,8 @@ object GameActivityDownloadHelper {
pluginLocation = PluginLocation.only_game
)
if (downloadEntity != null
&& str != context.getString(R.string.install)
&& str != context.getString(R.string.launch)
&& str != context.getString(com.gh.gamecenter.feature.R.string.install)
&& str != context.getString(com.gh.gamecenter.feature.R.string.launch)
) {
ToastUtils.toast("${gameEntity.name}已加入下载队列")
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
@ -219,22 +219,23 @@ object GameActivityDownloadHelper {
}
} else {
when {
str == context.getString(R.string.download) || str == context.getString(R.string.attempt) -> {
str == context.getString(com.gh.gamecenter.feature.R.string.download) || str == context.getString(
com.gh.gamecenter.feature.R.string.attempt) -> {
handleDownloadStatus(context, gameEntity, apk, entrance, location, traceEvent)
}
str == context.getString(R.string.smooth) -> {
str == context.getString(com.gh.gamecenter.feature.R.string.smooth) -> {
handleSmoothStatus(context, gameEntity, apk, entrance, location, traceEvent)
}
str.contains("") -> {
handlePluginStatus(context, gameEntity, apk, entrance, location, traceEvent)
}
str == context.getString(R.string.install) -> {
str == context.getString(com.gh.gamecenter.feature.R.string.install) -> {
handleInstallStatus(context, gameEntity, apk, downloadEntity)
}
str == context.getString(R.string.launch) -> {
str == context.getString(com.gh.gamecenter.feature.R.string.launch) -> {
handleLaunchStatus(context, gameEntity, apk, entrance, location, traceEvent)
}
str == context.getString(R.string.update) -> {
str == context.getString(com.gh.gamecenter.feature.R.string.update) -> {
handleUpdateStatus(context, gameEntity, apk, entrance, location, traceEvent)
}
else -> {
@ -525,7 +526,7 @@ object GameActivityDownloadHelper {
val path = downloadEntity.path
when {
FileUtils.isEmptyFile(path) -> {
Utils.toast(context, R.string.install_failure_hint)
Utils.toast(context, com.gh.gamecenter.common.R.string.install_failure_hint)
DownloadManager.getInstance().cancel(downloadEntity.url)
gameEntity.getEntryMap().remove(apkEntity.getPlatform())
}

View File

@ -8,7 +8,6 @@ import com.gh.common.simulator.SimulatorGameManager.findDownloadEntityByUrl
import com.gh.common.simulator.SimulatorGameManager.isNewSimulatorInstalled
import com.gh.common.simulator.SimulatorGameManager.isSimulatorGame
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.isLocalDownloadInDualDownloadMode
import com.gh.gamecenter.common.utils.isVGameDownloadInDualDownloadMode
import com.gh.gamecenter.core.AppExecutor.lightWeightIoExecutor
@ -66,7 +65,7 @@ object GameUtils {
)
uiExecutor.execute {
downloadBtn.text = status
if (context.getString(R.string.pluggable) == status) {
if (context.getString(com.gh.gamecenter.feature.R.string.pluggable) == status) {
downloadBtn.buttonStyle = DownloadButton.ButtonStyle.PLUGIN
var pluginDesc = gameEntity.pluginDesc
if (pluginDesc.length > 3) pluginDesc = pluginDesc.substring(0, 3)
@ -187,7 +186,7 @@ object GameUtils {
}
if ((isRelatedEmulatorInstalled || isInstalledNewSimulator) && doneCount != 0) {
return context.getString(R.string.launch)
return context.getString(com.gh.gamecenter.feature.R.string.launch)
}
if (performAsVGame) {
@ -209,18 +208,18 @@ object GameUtils {
}
return if (doneCount != 0) {
context.getString(R.string.install)
context.getString(com.gh.gamecenter.feature.R.string.install)
} else if (pluginCount != 0 && !isSimulatorGame(gameEntity)) {
context.getString(R.string.pluggable)
context.getString(com.gh.gamecenter.feature.R.string.pluggable)
} else if (updateCount != 0 && !isSimulatorGame(gameEntity)) {
context.getString(R.string.update)
context.getString(com.gh.gamecenter.feature.R.string.update)
} else if (installCount != 0) {
context.getString(R.string.launch)
context.getString(com.gh.gamecenter.feature.R.string.launch)
} else if ("demo" == gameEntity.downloadStatus) {
context.getString(R.string.attempt)
context.getString(com.gh.gamecenter.feature.R.string.attempt)
} else {
if (performAsVGame) {
context.getString(R.string.smooth)
context.getString(com.gh.gamecenter.feature.R.string.smooth)
} else {
// if (Constants.V_GAME == gameEntity.downloadStatus || Constants.V_GAME_32 == gameEntity.downloadStatus) {
// val gameCategory = gameEntity.getGameCategory()
@ -231,7 +230,7 @@ object GameUtils {
// context.getString(R.string.attempt)
// }
// } else {
context.getString(R.string.download)
context.getString(com.gh.gamecenter.feature.R.string.download)
// }
}
}

View File

@ -26,16 +26,12 @@ object HomeBottomBarHelper {
} catch (ignore: Exception) {
}
val animationCode = HaloApp.getInstance().application.assets
.open("lottie/tab_game.json")
.bufferedReader().use { it.readText() }
return SubjectRecommendEntity(
link = "5de21b5d75e6fa054f784882",
type = "block",
text = "游戏库",
name = "游戏库",
position = 2,
animationCode = animationCode,
default = false,
display = Display()
)

View File

@ -1,9 +1,6 @@
package com.gh.common.util;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Message;
@ -19,10 +16,8 @@ import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 下载完成跳安装,
*/
@ -49,15 +44,15 @@ public class InstallUtils {
@Override
public void handleMessage(Message msg) {
if (msg.what == INSTALL_WHAT && packageManager != null) {
List<String> packageNameList = PackageHelper.INSTANCE.getInstalledPackageNameList(context, 0);
ArrayList<String> list = new ArrayList<>(packageNameList);
if (installMap != null && installMap.size() != 0) {
ArrayList<String> keys = new ArrayList<>();
for (String packageName : installMap.keySet()) {
if (TextUtils.isEmpty(packageName)) continue;
long time = installMap.get(packageName);
if (System.currentTimeMillis() - time >= MAX_TIME) {
keys.add(packageName);
} else if (list.contains(packageName)) {
} else if (PackageUtils.isInstalled(context, packageName)) {
keys.add(packageName);
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntityByPackageName(packageName);
@ -65,7 +60,7 @@ public class InstallUtils {
if (!TextUtils.isEmpty(installVersion) && downloadEntity != null &&
installVersion.equals(downloadEntity.getVersionName())) {
if (!downloadEntity.isPluggable() || PackageUtils.isSignedByGh(context, packageName)) {
EventBus.getDefault().post(new EBPackage(EBPackage.TYPE_INSTALLED, packageName, installVersion));
EventBus.getDefault().post(new EBPackage(EBPackage.TYPE_INSTALLED, packageName, installVersion, false));
}
}
}
@ -80,9 +75,9 @@ public class InstallUtils {
long time = uninstallMap.get(packageName);
if (System.currentTimeMillis() - time >= MAX_TIME) {
keys.add(packageName);
} else if (!list.contains(packageName)) {
} else if (!PackageUtils.isInstalled(context, packageName)) {
keys.add(packageName);
EventBus.getDefault().post(new EBPackage("卸载", packageName, ""));
EventBus.getDefault().post(new EBPackage("卸载", packageName, "", false));
}
}
for (String key : keys) {
@ -105,6 +100,8 @@ public class InstallUtils {
}
public void addInstall(String packageName) {
if (TextUtils.isEmpty(packageName)) return;
if (installMap == null) {
installMap = Collections.synchronizedMap(new HashMap<String, Long>());
}

View File

@ -2,7 +2,6 @@ package com.gh.common.util;
import android.app.Dialog;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.graphics.Color;
import android.text.Html;
import android.text.Spanned;
@ -182,28 +181,28 @@ public class LibaoUtils {
break;
case "coming":
libaoBtn.setText(R.string.libao_coming);
libaoBtn.setBackgroundResource(R.drawable.button_round_gray_light);
libaoBtn.setTextColor(context.getResources().getColor(R.color.text_tertiary));
libaoBtn.setBackgroundResource(com.gh.gamecenter.feature.R.drawable.button_round_gray_light);
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_tertiary));
break;
case "used_up":
libaoBtn.setText(R.string.libao_used_up);
libaoBtn.setBackgroundResource(R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(R.color.text_theme));
libaoBtn.setBackgroundResource(com.gh.gamecenter.feature.R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_theme));
break;
case "finish":
libaoBtn.setText(R.string.libao_finish);
libaoBtn.setText(com.gh.gamecenter.feature.R.string.libao_finish);
libaoBtn.setBackgroundResource(R.drawable.button_border_round_gray);
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.button_gray));
break;
case "linged":
libaoBtn.setText(R.string.libao_linged);
libaoBtn.setBackgroundResource(R.drawable.button_round_gray_light);
libaoBtn.setTextColor(context.getResources().getColor(R.color.text_tertiary));
libaoBtn.setText(com.gh.gamecenter.feature.R.string.libao_linged);
libaoBtn.setBackgroundResource(com.gh.gamecenter.feature.R.drawable.button_round_gray_light);
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_tertiary));
break;
case "taoed":
libaoBtn.setText(R.string.libao_taoed);
libaoBtn.setBackgroundResource(R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(R.color.text_theme));
libaoBtn.setText(com.gh.gamecenter.feature.R.string.libao_taoed);
libaoBtn.setBackgroundResource(com.gh.gamecenter.feature.R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_theme));
break;
case "copy":
libaoBtn.setText(R.string.libao_copy);
@ -212,19 +211,19 @@ public class LibaoUtils {
case "repeatLing":
case "repeatLinged":
libaoBtn.setText(R.string.libao_repeat_ling);
libaoBtn.setBackgroundResource(R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(R.color.text_theme));
libaoBtn.setBackgroundResource(com.gh.gamecenter.feature.R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_theme));
break;
case "repeatTao":
case "repeatTaoed":
libaoBtn.setText(R.string.libao_repeat_tao);
libaoBtn.setBackgroundResource(R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(R.color.text_theme));
libaoBtn.setBackgroundResource(com.gh.gamecenter.feature.R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_theme));
break;
case "unshelve":
libaoBtn.setBackgroundResource(R.drawable.button_border_round_gray);
libaoBtn.setText(R.string.libao_unshelve);
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.button_gray));
break;
case "check":
libaoBtn.setText(R.string.libao_check);
@ -233,7 +232,7 @@ public class LibaoUtils {
default:
libaoBtn.setBackgroundResource(R.drawable.button_border_round_gray);
libaoBtn.setText("异常");
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.button_gray));
break;
}
}
@ -321,13 +320,13 @@ public class LibaoUtils {
// 类型为复制的,不需要登录也可以直接复制
if ("copy".equals(libaoEntity.getReceiveMethod())) {
if ("finish".equals(libaoEntity.getStatus())) {
libaoBtn.setText(R.string.libao_finish);
libaoBtn.setText(com.gh.gamecenter.feature.R.string.libao_finish);
libaoBtn.setBackgroundResource(R.drawable.button_border_round_gray);
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
libaoBtn.setTextColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.button_gray));
libaoBtn.setOnClickListener(v -> ToastUtils.toast("兑换码领取已结束"));
} else {
libaoBtn.setText(R.string.libao_copy);
libaoBtn.setTextColor(ExtensionsKt.toColor(R.color.white, context));
libaoBtn.setTextColor(ExtensionsKt.toColor(com.gh.gamecenter.common.R.color.white, context));
libaoBtn.setBackgroundResource(R.drawable.button_normal_round_style);
libaoBtn.setOnClickListener(v -> {
LogUtils.uploadReceiveGift(
@ -682,7 +681,7 @@ public class LibaoUtils {
}
if (libaoBtn != null) {
libaoBtn.setText(R.string.libao_linged);
libaoBtn.setText(com.gh.gamecenter.feature.R.string.libao_linged);
libaoBtn.setBackgroundResource(R.drawable.libao_linged_style);
libaoBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.libao_linged_selector));
}

View File

@ -79,32 +79,6 @@ public class MessageShareUtils {
private String[] mArrLabel = {"微信好友", "朋友圈", "QQ好友", "QQ空间", "保存"};
private int[] arrLogo = {
R.drawable.share_wechat_logo,
R.drawable.share_wechatmoments_logo,
R.drawable.share_qq_logo,
R.drawable.share_qzone_logo,
R.drawable.share_save
};
public enum ShareWay {
qq("qq"),
qqZone("qq空间"),
weibo("微博"),
wechat("微信"),
wechatMoments("朋友圈");
private String name;
ShareWay(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
//QQ或者QQ空间分享回调处理
public IUiListener QqShareListener = new IUiListener() {
@Override
@ -139,7 +113,7 @@ public class MessageShareUtils {
@Override
public void onCancel() {
Utils.toast(mContext, R.string.share_cancel_hint);
Utils.toast(mContext, com.gh.gamecenter.common.R.string.share_cancel_hint);
if (isFromInviteFriends) {
IntegralLogHelper.INSTANCE.logInviteResult("取消", shareWay.getName());
}
@ -151,6 +125,31 @@ public class MessageShareUtils {
}
};
public enum ShareWay {
qq("qq"),
qqZone("qq空间"),
weibo("微博"),
wechat("微信"),
wechatMoments("朋友圈");
private String name;
ShareWay(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
private int[] arrLogo = {
com.gh.gamecenter.common.R.drawable.share_wechat_logo,
com.gh.gamecenter.common.R.drawable.share_wechatmoments_logo,
com.gh.gamecenter.common.R.drawable.share_qq_logo,
com.gh.gamecenter.common.R.drawable.share_qzone_logo,
com.gh.gamecenter.common.R.drawable.share_save
};
// 适配快传成绩单分享
private int contentSize;
private int paddTop;
@ -334,7 +333,7 @@ public class MessageShareUtils {
Utils.toast(mContext, "分享跳转中...");
if (!mIWXAPI.isWXAppInstalled() && !PermissionHelper.isGetInstalledListPermissionDisabled(mContext)) {
Utils.toast(mContext, mContext.getString(R.string.share_no_wechat_hint));
Utils.toast(mContext, mContext.getString(com.gh.gamecenter.common.R.string.share_no_wechat_hint));
return;
}
@ -399,7 +398,7 @@ public class MessageShareUtils {
Utils.toast(mContext, "分享跳转中...");
if (!mIWXAPI.isWXAppInstalled() && !PermissionHelper.isGetInstalledListPermissionDisabled(mContext)) {
Utils.toast(mContext, mContext.getString(R.string.share_no_wechat_hint));
Utils.toast(mContext, mContext.getString(com.gh.gamecenter.common.R.string.share_no_wechat_hint));
return;
}
@ -435,7 +434,7 @@ public class MessageShareUtils {
Utils.toast(mContext, "分享跳转中...");
if (!mIWXAPI.isWXAppInstalled() && !PermissionHelper.isGetInstalledListPermissionDisabled(mContext)) {
Utils.toast(mContext, mContext.getString(R.string.share_no_wechat_hint));
Utils.toast(mContext, mContext.getString(com.gh.gamecenter.common.R.string.share_no_wechat_hint));
return;
}
@ -581,7 +580,7 @@ public class MessageShareUtils {
linearLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(mContext, itemSize)));
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setGravity(Gravity.CENTER_HORIZONTAL);
linearLayout.setBackgroundResource(R.drawable.cardview_item_style);
linearLayout.setBackgroundResource(com.gh.gamecenter.common.R.drawable.cardview_item_style);
ImageView shareLogo = new ImageView(mContext);
LinearLayout.LayoutParams logoParams = new LinearLayout.LayoutParams(DisplayUtils.dip2px(mContext, picSize), DisplayUtils.dip2px(mContext, picSize));
@ -593,7 +592,7 @@ public class MessageShareUtils {
layoutParams.setMargins(0, DisplayUtils.dip2px(mContext, 10), 0, 0);
shareLabel.setLayoutParams(layoutParams);
shareLabel.setGravity(Gravity.CENTER);
shareLabel.setTextColor(ContextCompat.getColor(mContext, R.color.text_3a3a3a));
shareLabel.setTextColor(ContextCompat.getColor(mContext, com.gh.gamecenter.common.R.color.text_3a3a3a));
shareLabel.setTextSize(marImg);
linearLayout.addView(shareLogo);

View File

@ -661,12 +661,14 @@ object NewFlatLogUtils {
@JvmStatic
fun logSearchBbs(
searchType: String,
searchKey: String
searchKey: String,
location: String
) {
json {
KEY_EVENT to "search_bbs"
"search_type" to searchType
"key" to searchKey
KEY_LOCATION to location
parseAndPutMeta()()
}.let(::log)
}
@ -678,7 +680,8 @@ object NewFlatLogUtils {
bbsId: String,
sequence: Int,
name: String,
button: String
button: String,
location: String
) {
json {
KEY_EVENT to "search_bbs_click"
@ -688,6 +691,7 @@ object NewFlatLogUtils {
"sequence" to sequence
"name" to name
"button" to button
KEY_LOCATION to location
parseAndPutMeta()()
}.let(::log)
}
@ -695,12 +699,14 @@ object NewFlatLogUtils {
@JvmStatic
fun logSearchUser(
searchType: String,
searchKey: String
searchKey: String,
location: String
) {
json {
KEY_EVENT to "search_user"
"search_type" to searchType
"key" to searchKey
KEY_LOCATION to location
parseAndPutMeta()()
}.let(::log)
}
@ -711,7 +717,8 @@ object NewFlatLogUtils {
searchKey: String,
userId: String,
name: String,
sequence: Int
sequence: Int,
location: String
) {
json {
KEY_EVENT to "search_user_click"
@ -720,6 +727,7 @@ object NewFlatLogUtils {
"user_id" to userId
"name" to name
"sequence" to sequence
KEY_LOCATION to location
parseAndPutMeta()()
}.let(::log)
}
@ -1344,7 +1352,13 @@ object NewFlatLogUtils {
}
// 上传存档弹窗点击事件
fun logCloudArchiveUploadDialogClick(gameId: String, gameName: String, cloudSaveId: String, cloudSaveName: String, isSuccess: Boolean) {
fun logCloudArchiveUploadDialogClick(
gameId: String,
gameName: String,
cloudSaveId: String,
cloudSaveName: String,
isSuccess: Boolean
) {
val json = json {
KEY_EVENT to "cloud_save_upload_dialog_click"
KEY_GAME_ID to gameId

View File

@ -1815,60 +1815,6 @@ object NewLogUtils {
log(json, LOG_STORE_EVENT)
}
//成功预约游戏
@JvmStatic
fun logReserveGameSuccess(wechatConfigEntity: WechatConfigEntity) {
val json = json {
KEY_EVENT to "appointment_wechat_appointment_game"
"wechat_is_bind" to wechatConfigEntity.bind
"wechat_is_follow" to wechatConfigEntity.follow
"wechat_is_remind" to wechatConfigEntity.notice
KEY_TIMESTAMP to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
log(json, "appointment", false)
}
//引导设置微信提醒弹窗事件
@JvmStatic
fun logReserveWechatRemindPopShow(wechatConfigEntity: WechatConfigEntity) {
val json = json {
KEY_EVENT to "appointment_wechat_remind_pop_show"
"wechat_is_bind" to wechatConfigEntity.bind
"wechat_is_follow" to wechatConfigEntity.follow
"wechat_is_remind" to wechatConfigEntity.notice
KEY_TIMESTAMP to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
log(json, "appointment", false)
}
//引导设置微信提醒弹窗点击事件
@JvmStatic
fun logReserveWechatRemindPopClick(wechatConfigEntity: WechatConfigEntity, operationType: String) {
val json = json {
KEY_EVENT to "appointment_wechat_remind_pop_click"
"wechat_is_bind" to wechatConfigEntity.bind
"wechat_is_follow" to wechatConfigEntity.follow
"wechat_is_remind" to wechatConfigEntity.notice
"operation_type" to operationType
KEY_TIMESTAMP to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
log(json, "appointment", false)
}
//预约成功弹窗事件
@JvmStatic
fun logReserveWechatSuccessPopShow() {
val json = json {
KEY_EVENT to "appointment_wechat_success_pop_show"
KEY_TIMESTAMP to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
log(json, "appointment", false)
}
//选择图片上传方式
@JvmStatic
fun logShowGameCollectionCoverTypeDialog() {

View File

@ -105,14 +105,9 @@ object PackageHelper {
get() = _installedPackageApiSwitchStatusLiveData
// 本地已安装包的列表
var localPackageNameSet = hashSetOf<String>()
var localPackageNameSet = setOf<String>()
get() {
return if (field.isEmpty()) {
field = getAllPackageName(HaloApp.getInstance().application)
field
} else {
field
}
return HashSet(cachedInstalledPackageNameList)
}
/**
@ -461,9 +456,10 @@ object PackageHelper {
* 进行包名初始化相关的操作
*/
fun initPackageRelatedData() {
PackageRepository.initData()
refreshLocalPackageList()
refreshPackageNameList()
PackageRepository.initData {
refreshLocalPackageList()
refreshPackageNameList()
}
}
/**
@ -818,7 +814,7 @@ object PackageHelper {
uploadUIDGapLog = false
val uidGap = (android.os.Process.LAST_APPLICATION_UID - lastValidUid) / 100 * 100
SentryHelper.onEvent("UID_GAP", "gap", uidGap.toString())
// SentryHelper.onEvent("UID_GAP", "gap", uidGap.toString())
}
return packageList

View File

@ -4,6 +4,7 @@ import android.app.Activity
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
@ -15,7 +16,6 @@ import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.MD5Utils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.install.InstallService
@ -31,6 +31,15 @@ object PackageInstaller {
private val listeners = mutableListOf<OnInstallListener>()
private val packageInstallerPackageName = arrayOf(
"com.android.packageinstaller",
"com.miui.packageinstaller",
"com.google.android.packageinstaller",
"com.samsung.android.packageinstaller",
"com.lenovo",
"com.zhuoyi"
)
/**
* 为了兼容java代码
*/
@ -274,11 +283,27 @@ object PackageInstaller {
}
installIntent.setDataAndType(uri, "application/vnd.android.package-archive")
}
updateSystemInstallerIfAvailable(context, installIntent)
InstallUtils.getInstance()
.addInstall(PackageUtils.getPackageNameByPath(context, path))
return installIntent
}
/**
* 查找并设置系统安装器作为安装 intent 的包名
*/
private fun updateSystemInstallerIfAvailable(context: Context, intent: Intent) {
for (rf in context.packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)) {
val targetPackageName = packageInstallerPackageName.firstOrNull { rf.activityInfo.packageName.contains(it) }
if (!targetPackageName.isNullOrEmpty()) {
intent.setPackage(targetPackageName)
break
}
}
}
/**
* 卸载应用
*/

View File

@ -225,17 +225,6 @@ public class PackageUtils {
}
} catch (Exception e) {
e.printStackTrace();
if (e instanceof AndroidException) {
// 有些设备会出现 DeadSystemException
SentryHelper.INSTANCE.onEvent(
"GET_META_DATA_ERROR",
"packageName",
packageName,
"exception_digest",
e.getLocalizedMessage()
);
}
}
return null;
}
@ -497,7 +486,6 @@ public class PackageUtils {
}
} catch (Exception e) {
e.printStackTrace();
SentryHelper.INSTANCE.onEvent("GET_PACKAGE_INFO_ERROR", "path", path);
}
return null;
@ -577,8 +565,7 @@ public class PackageUtils {
}
return true;
} catch (Exception e) {
ArrayList<String> allPackageName = getAllPackageName(context);
boolean isInstalled = allPackageName.contains(packageName);
boolean isInstalled = PackageHelper.INSTANCE.getLocalPackageNameSet().contains(packageName);
if (isInstalled) {
// 能进这里说明上面的 try {} 结果有问题,记录一下
@ -641,17 +628,6 @@ public class PackageUtils {
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT).versionName;
} catch (Exception e) {
e.printStackTrace();
if (e instanceof AndroidException) {
// 有些设备会出现 DeadSystemException
SentryHelper.INSTANCE.onEvent(
"GET_VERSION_NAME_ERROR",
"packageName",
packageName,
"exception_digest",
e.getLocalizedMessage()
);
}
}
return null;
}
@ -665,16 +641,6 @@ public class PackageUtils {
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT).versionCode;
} catch (Exception e) {
e.printStackTrace();
if (e instanceof AndroidException) {
// 有些设备会出现 DeadSystemException
SentryHelper.INSTANCE.onEvent(
"GET_VERSION_CODE_ERROR",
"packageName",
packageName,
"exception_digest",
e.getLocalizedMessage()
);
}
}
return 0;
}
@ -689,39 +655,10 @@ public class PackageUtils {
return packageManager.getApplicationIcon(packageName);
} catch (Exception e) {
e.printStackTrace();
if (e instanceof AndroidException) {
// 有些设备会出现 DeadSystemException
SentryHelper.INSTANCE.onEvent(
"GET_ICON_ERROR",
"packageName",
packageName,
"exception_digest",
e.getLocalizedMessage()
);
}
}
return null;
}
/*
* 获取所有已安装的软件的包名(包括系统应用)
*/
public static ArrayList<String> getAllPackageName(Context context) {
ArrayList<String> list = new ArrayList<>();
List<String> packageNameList = PackageHelper.INSTANCE.getInstalledPackageNameList(context, 0);
for (String packageName : packageNameList) {
if (!context.getPackageName().equals(packageName)) {
list.add(packageName);
}
}
return list;
}
public static ArrayList<String> getAllPackageNameIncludeGh(Context context) {
List<String> packageNameList = PackageHelper.INSTANCE.getInstalledPackageNameList(context, 0);
return new ArrayList<>(packageNameList);
}
public static JSONArray getAppList(Context context) {
JSONArray jsonArray = new JSONArray();
try {
@ -751,17 +688,6 @@ public class PackageUtils {
return jsonObject;
} catch (Exception e) {
e.printStackTrace();
if (e instanceof AndroidException) {
// 有些设备会出现 DeadSystemException
SentryHelper.INSTANCE.onEvent(
"GET_APP_BASIC_INFO_BY_PACKAGE_NAME",
"packageName",
packageName,
"exception_digest",
e.getLocalizedMessage()
);
}
return jsonObject;
}
}

View File

@ -130,7 +130,7 @@ object PureModeHelper {
binding.hintTv.buildSpannableString {
addText(guide.linkTextPrefix)
addText(guide.linkText) {
setColor(ColorResId(R.color.text_theme))
setColor(ColorResId(com.gh.gamecenter.common.R.color.text_theme))
onClick(false) {
binding.extraHintIv.performClick()
}

View File

@ -46,7 +46,7 @@ object RecommendPopupHelper {
//判断是否符合包名限制
val nameRule = entity.recommendPackage.nameRule
val packages = entity.recommendPackage.details
val installedPackages = PackageUtils.getAllPackageNameIncludeGh(HaloApp.getInstance())
val installedPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance(), 0)
var isMatchSuccess = true
val checkInstalled: (splitPackages: List<String>) -> Boolean = {
var isInstalled = false

View File

@ -2,22 +2,29 @@ package com.gh.common.util
import android.annotation.SuppressLint
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.gamecenter.common.constant.Constants
import com.gh.common.repository.ReservationRepository
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
import com.gh.gamecenter.common.callback.CancelListener
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.WechatConfigEntity
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.provider.IPushProvider
import com.gh.gamecenter.entity.ReserveReminderEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import okhttp3.RequestBody
import okhttp3.ResponseBody
object ReservationHelper {
@ -38,18 +45,22 @@ object ReservationHelper {
deleteReservation: Boolean,
refreshCallback: EmptyCallback
) {
val retrofit = RetrofitManager.getInstance()
val requestMap = hashMapOf<String, String>()
requestMap["game_id"] = game.id
val retrofit = RetrofitManager.getInstance()
val single = if (deleteReservation) {
retrofit.api
.deleteGameReservation(requestMap.createRequestBody())
retrofit.newApi
.deleteGameReservation(
game.id,
getReserveRequestBody(game, context = HaloApp.getInstance().application)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
} else {
retrofit.api
.cancelGameReservation(requestMap.createRequestBody())
retrofit.newApi
.cancelGameReservation(
game.id,
getReserveRequestBody(game, context = HaloApp.getInstance().application)
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
}
@ -70,71 +81,65 @@ object ReservationHelper {
@JvmStatic
@SuppressLint("CheckResult")
fun reserve(context: Context, game: GameEntity?, sourceEntrance: String = "其他", callback: EmptyCallback) {
val requestMap = hashMapOf<String, String>()
requestMap["game_id"] = game?.id ?: ""
RetrofitManager.getInstance().api
.createNewGameReservation(requestMap.createRequestBody())
.compose(singleToMain())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
RetrofitManager.getInstance().newApi
.createNewGameReservation(game?.id ?: "", getReserveRequestBody(game, context))
.compose(singleToMain())
.subscribe(object : BiResponse<ReserveReminderEntity>() {
override fun onSuccess(data: ReserveReminderEntity) {
SensorsBridge.trackEvent(
"AppointmentGameResult",
"game_name",
game?.name ?: "",
"game_id",
game?.id ?: "",
"game_type",
game?.categoryChinese ?: "",
"result",
"成功",
"source_entrance",
sourceEntrance
"game_name", game?.name ?: "",
"game_id", game?.id ?: "",
"game_type", game?.categoryChinese ?: "",
"result", "成功",
"source_entrance", sourceEntrance,
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId,
"source", game?.exposureEvent?.source?.toString() ?: "",
*game?.customPageTrackData?.toKV() ?: arrayOf()
)
ReservationRepository.addReservationToMemoryAndRefresh(game?.id ?: "")
callback.onCallback()
val wechatConfig = SPUtils.getString(Constants.SP_WECHAT_CONFIG).toObject<WechatConfigEntity>()
wechatConfig?.run {
NewLogUtils.logReserveGameSuccess(wechatConfig)
if (bind && follow && notice) {
NewLogUtils.logReserveWechatSuccessPopShow()
DialogUtils.showReserveOrVoteSuccessDialog(context, true)
} else {
NewLogUtils.logReserveWechatRemindPopShow(wechatConfig)
SensorsBridge.trackEvent("AppointmenWechatRemindDialogShow")
DialogUtils.showReserveOrVoteSuccess2WechatBindDialog(context, true, {
NewLogUtils.logReserveWechatRemindPopClick(wechatConfig, "开启微信提醒")
SensorsBridge.trackEvent("AppointmenWechatRemindDialogClick")
context.startActivity(WebActivity.getBindWechatIntent(context))
SensorsBridge.trackEvent(
"AppointmenWechatRemindConfigPageShow",
"source_entrance",
"设置微信提醒弹窗"
)
}, object : CancelListener {
override fun onCancel() {
NewLogUtils.logReserveWechatRemindPopClick(wechatConfig, "关闭弹窗")
SensorsBridge.trackEvent("AppointmenWechatRemindDialogClick")
}
})
}
checkWechatConfigEntityUpdated(data.wechatConfig)
game?.let {
SensorsBridge.trackAppointmentSuccessDialogShow(
it.id,
it.name ?: "",
it.categoryChinese,
data.wechatConfig.isReminderEnable,
if (data.hasSmsConfig) data.smsConfig.notice else null,
if (data.isEnableAutoDownload) data.wifiAutoDownload else null
)
}
DialogUtils.showReserveReminderDialog(context, game, data)
}
override fun onFailure(exception: Exception) {
SensorsBridge.trackEvent(
"AppointmentGameResult",
"game_name",
game?.name ?: "",
"game_id",
game?.id ?: "",
"game_type",
game?.categoryChinese ?: "",
"result",
"失败",
"source_entrance",
sourceEntrance
"game_name", game?.name ?: "",
"game_id", game?.id ?: "",
"game_type", game?.categoryChinese ?: "",
"result", "失败",
"source_entrance", sourceEntrance,
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId,
"source", game?.exposureEvent?.source?.toString() ?: "",
*game?.customPageTrackData?.toKV() ?: arrayOf()
)
ToastUtils.showToast(exception.message ?: "")
}
@ -157,24 +162,85 @@ object ReservationHelper {
}
@JvmStatic
fun showCancelReservationDialog(context: Context, emptyCallback: EmptyCallback) {
showCancelReservationDialog(context, emptyCallback, null)
fun showCancelReservationDialog(context: Context, game: GameEntity?, emptyCallback: EmptyCallback) {
showCancelReservationDialog(context, game, emptyCallback, null)
}
@JvmStatic
fun showCancelReservationDialog(context: Context, emptyCallback: EmptyCallback, cancelListener: CancelListener?) {
fun showCancelReservationDialog(
context: Context,
game: GameEntity?,
emptyCallback: EmptyCallback,
cancelListener: CancelListener?,
dialogCancelCallback: (() -> Unit)? = null
) {
if (game != null) {
SensorsBridge.trackCancelAppointmentDialogShow(game.id, game.name ?: "", game.categoryChinese)
}
DialogHelper.showDialog(context, "取消预约",
"取消之后你将无法收到游戏上线的通知,确定取消预约吗?",
"确定取消",
"暂不取消", confirmClickCallback = {
if (game != null) {
SensorsBridge.trackCancelAppointmentDialogClick(
game.id,
game.name ?: "",
game.categoryChinese,
"确定取消"
)
}
emptyCallback.onCallback()
}, cancelClickCallback = {
if (game != null) {
SensorsBridge.trackCancelAppointmentDialogClick(
game.id,
game.name ?: "",
game.categoryChinese,
"暂不取消"
)
}
cancelListener?.onCancel()
}, uiModificationCallback = {
it.confirmTv.setTextColor(R.color.secondary_red.toColor(context))
}, extraConfig = DialogHelper.Config(centerContent = true, centerTitle = true)
it.confirmTv.setTextColor(com.gh.gamecenter.common.R.color.secondary_red.toColor(context))
}, extraConfig = DialogHelper.Config(centerContent = true, centerTitle = true),
dialogCancelCallback = {
if (game != null) {
SensorsBridge.trackCancelAppointmentDialogClick(
game.id,
game.name ?: "",
game.categoryChinese,
"关闭弹窗"
)
}
dialogCancelCallback?.invoke()
}
)
}
private fun checkWechatConfigEntityUpdated(newWechatConfig: WechatConfigEntity) {
val wechatConfig = SPUtils.getString(Constants.SP_WECHAT_CONFIG).toObject<WechatConfigEntity>()
if (newWechatConfig.bind != wechatConfig?.bind
|| newWechatConfig.follow != wechatConfig.follow
|| newWechatConfig.notice != wechatConfig.notice
|| newWechatConfig.nickName != wechatConfig.nickName
) {
SPUtils.setString(Constants.SP_WECHAT_CONFIG, newWechatConfig.toJson())
}
}
@JvmStatic
fun getReserveRequestBody(game: GameEntity?, context: Context): RequestBody {
val jPushId =
(ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider)
?.getRegistrationId(context) ?: ""
var mirrorPosition = game?.getMirrorPosition() ?: 0
if (mirrorPosition == -1) {
mirrorPosition = 0
}
val body = hashMapOf(
"jpush_id" to jPushId,
"mirror_type" to mirrorPosition
).toRequestBody()
return body
}
}

View File

@ -27,7 +27,9 @@ import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.ResponseBody
import org.json.JSONArray
import org.json.JSONObject
@ -124,11 +126,12 @@ object UsageStatsHelper {
&& curEvent.className == nextEvent.className
) {
val diff = nextEvent.timeStamp - curEvent.timeStamp
val packageName = curEvent.packageName ?: continue
if (pakAndTime[curEvent.packageName] == null) {
pakAndTime[curEvent.packageName] = diff
if (pakAndTime[packageName] == null) {
pakAndTime[packageName] = diff
} else {
pakAndTime[curEvent.packageName] = pakAndTime[curEvent.packageName]!! + diff
pakAndTime[packageName] = pakAndTime[packageName]!! + diff
}
}
}
@ -175,7 +178,7 @@ object UsageStatsHelper {
return
}
val body = RequestBody.create(MediaType.parse("application/json"), postBody.toString())
val body = postBody.toString().toRequestBody("application/json".toMediaTypeOrNull())
mApi.postUsageStatus(body, UserManager.getInstance().userId)
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {

View File

@ -65,6 +65,7 @@ object ViewPagerFragmentHelper {
const val TYPE_COLUMN = "column" // 游戏专题详情页
const val TYPE_QQ_MINI_GAME_COLUMN = "qq_mini_game_column_detail" // QQ小游戏专题详情页
const val TYPE_WECHAT_GAME_COLUMN = "wechat_game_column_detail" // 微信小游戏专题详情页
const val TYPE_WECHAT_GAME_CPM_COLUMN = "wechat_game_cpm_column_detail" // 微信小游戏CPM专题详情页
const val TYPE_COLUMN_COLLECTION = "column_collection" // 专题合集详情页
const val TYPE_SERVER = "server" // 开服表
const val TYPE_COLUMN_TEST = "column_test_v2" // 新游开测
@ -163,10 +164,11 @@ object ViewPagerFragmentHelper {
className = GameCollectionSquareFragment::class.java.name
}
// 游戏专题详情页/QQ游戏专题详情页
TYPE_COLUMN, TYPE_QQ_MINI_GAME_COLUMN, TYPE_WECHAT_GAME_COLUMN -> {
TYPE_COLUMN, TYPE_QQ_MINI_GAME_COLUMN, TYPE_WECHAT_GAME_COLUMN, TYPE_WECHAT_GAME_CPM_COLUMN -> {
val subjectType = when(entity.type) {
TYPE_QQ_MINI_GAME_COLUMN -> SubjectData.SubjectType.QQ_GAME
TYPE_WECHAT_GAME_COLUMN -> SubjectData.SubjectType.WECHAT_GAME
TYPE_WECHAT_GAME_CPM_COLUMN -> SubjectData.SubjectType.WECHAT_GAME_CPM
else -> SubjectData.SubjectType.NORMAL
}
className = SubjectFragment::class.java.name
@ -174,6 +176,7 @@ object ViewPagerFragmentHelper {
EntranceConsts.KEY_SUBJECT_DATA,
SubjectData(entity.link, entity.text, false, subjectType = subjectType)
)
bundle.putString(EntranceConsts.KEY_SUBJECT_TYPE, "detail")
bundle.putBoolean(EntranceConsts.KEY_SHOW_DOWNLOAD_MENU, !isTabWrapper)
}
// 专题合集详情页
@ -183,6 +186,7 @@ object ViewPagerFragmentHelper {
bundle.putInt(EntranceConsts.KEY_POSITION, 0)
bundle.putString(EntranceConsts.KEY_COLUMNNAME, entity.text)
bundle.putBoolean(EntranceConsts.KEY_IS_COLUMN_COLLECTION, true)
bundle.putString(EntranceConsts.KEY_SUBJECT_TYPE, "tab")
}
// 开服表
TYPE_SERVER -> {

View File

@ -22,7 +22,7 @@ object WechatBindHelper {
fun getWechatConfig(callback: ((WechatConfigEntity) -> Unit)? = null) {
if (!UserManager.getInstance().isLoggedIn) return
RetrofitManager.getInstance()
.api
.newApi
.wechatConfig
.compose(singleToMain())
.subscribe(object : BiResponse<WechatConfigEntity>() {
@ -36,7 +36,7 @@ object WechatBindHelper {
@SuppressLint("CheckResult")
fun bindWechat(wechatLoginInfoMap: Map<String, String>, callback: BiCallback<Boolean, Boolean>) {
RetrofitManager.getInstance()
.api
.newApi
.postBindWechat(wechatLoginInfoMap.createRequestBody())
.compose(singleToMain())
.subscribe(object : BiResponse<ResponseBody>() {

View File

@ -85,12 +85,12 @@ class CategoryFilterView @JvmOverloads constructor(
targetTextView.setTextColor(Color.WHITE)
} else {
targetTextView.background = null
targetTextView.setTextColor(ContextCompat.getColor(targetTextView.context, R.color.text_757575))
targetTextView.setTextColor(ContextCompat.getColor(targetTextView.context, com.gh.gamecenter.common.R.color.text_757575))
}
}
private fun showSelectTypePopupWindow(containerView: View, typeTv: TextView, typeText: String) {
typeTv.setTextColor(R.color.text_theme.toColor(context))
typeTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
typeTv.setDrawableEnd(R.drawable.ic_filter_arrow_up)
val inflater = LayoutInflater.from(typeTv.context)
@ -136,7 +136,7 @@ class CategoryFilterView @JvmOverloads constructor(
}
popupWindow.setOnDismissListener {
typeTv.setTextColor(R.color.text_757575.toColor(context))
typeTv.setTextColor(com.gh.gamecenter.common.R.color.text_757575.toColor(context))
typeTv.setDrawableEnd(R.drawable.ic_filter_arrow_down)
mTypePopupWindow = null
}
@ -148,7 +148,7 @@ class CategoryFilterView @JvmOverloads constructor(
}
private fun showSelectSizePopupWindow(containerView: View, sizeTv: TextView, sizeText: String) {
sizeTv.setTextColor(R.color.text_theme.toColor(context))
sizeTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
sizeTv.setDrawableEnd(R.drawable.ic_filter_arrow_up)
val inflater = LayoutInflater.from(sizeTv.context)
@ -204,7 +204,7 @@ class CategoryFilterView @JvmOverloads constructor(
}
popupWindow.setOnDismissListener {
sizeTv.setTextColor(R.color.text_757575.toColor(context))
sizeTv.setTextColor(com.gh.gamecenter.common.R.color.text_757575.toColor(context))
sizeTv.setDrawableEnd(R.drawable.ic_filter_arrow_down)
mSizePopupWindow = null
}

View File

@ -87,7 +87,7 @@ class ConfigFilterView @JvmOverloads constructor(
SortType.RATING -> updateHighlightedTextView(ratingTv)
SortType.UPDATE -> updateHighlightedTextView(updateTv)
}
mSizeTv.setTextColor(R.color.text_757575.toColor(context))
mSizeTv.setTextColor(com.gh.gamecenter.common.R.color.text_757575.toColor(context))
}
fun setOnConfigSetupListener(onConfigFilterSetupListener: OnConfigFilterSetupListener) {
@ -97,10 +97,10 @@ class ConfigFilterView @JvmOverloads constructor(
private fun toggleHighlightedTextView(targetTextView: TextView, highlightIt: Boolean) {
if (highlightIt) {
targetTextView.background = R.drawable.bg_tag_text.toDrawable()
targetTextView.setTextColor(R.color.text_white.toColor(context))
targetTextView.setTextColor(com.gh.gamecenter.common.R.color.text_white.toColor(context))
} else {
targetTextView.background = null
targetTextView.setTextColor(R.color.text_757575.toColor(context))
targetTextView.setTextColor(com.gh.gamecenter.common.R.color.text_757575.toColor(context))
}
}
@ -112,7 +112,7 @@ class ConfigFilterView @JvmOverloads constructor(
}
private fun showSelectionPopupWindow(containerView: View, sizeTv: TextView, sizeText: String) {
sizeTv.setTextColor(R.color.text_theme.toColor(sizeTv.context))
sizeTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(sizeTv.context))
sizeTv.setDrawableEnd(R.drawable.ic_filter_arrow_up)
val inflater = LayoutInflater.from(sizeTv.context)
@ -171,7 +171,7 @@ class ConfigFilterView @JvmOverloads constructor(
}
popupWindow.setOnDismissListener {
sizeTv.setTextColor(R.color.text_757575.toColor(sizeTv.context))
sizeTv.setTextColor(com.gh.gamecenter.common.R.color.text_757575.toColor(sizeTv.context))
sizeTv.setDrawableEnd(R.drawable.ic_filter_arrow_down)
mPopupWindow = null
}

View File

@ -86,9 +86,9 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
mSelectedSubFilter = filter
mBinding?.subFilterTv?.text = filter
if (filter != mSubFilterList.firstOrNull() && mHighlightSubFilterIfItsNotDefault) {
mBinding?.subFilterTv?.setTextColor(R.color.text_theme.toColor(context))
mBinding?.subFilterTv?.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
} else {
mBinding?.subFilterTv?.setTextColor(R.color.text_757575.toColor(context))
mBinding?.subFilterTv?.setTextColor(com.gh.gamecenter.common.R.color.text_757575.toColor(context))
}
}
@ -98,7 +98,7 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
targetTextView.setTextColor(Color.WHITE)
} else {
targetTextView.background = null
targetTextView.setTextColor(ContextCompat.getColor(targetTextView.context, R.color.text_757575))
targetTextView.setTextColor(ContextCompat.getColor(targetTextView.context, com.gh.gamecenter.common.R.color.text_757575))
}
}
@ -108,7 +108,7 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
subFilterText: String,
selectedCallback: ((String) -> Unit)
) {
subFilterTv.setTextColor(R.color.text_theme.toColor(context))
subFilterTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
subFilterTv.setDrawableEnd(R.drawable.ic_filter_arrow_up)
val inflater = LayoutInflater.from(subFilterTv.context)
@ -213,10 +213,10 @@ class FilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet
if (mSelectedFilter == mFilterList[position]) {
holder.binding.titleTv.background = R.drawable.bg_tag_text.toDrawable(context)
holder.binding.titleTv.setTextColor(R.color.white.toColor(context))
holder.binding.titleTv.setTextColor(com.gh.gamecenter.common.R.color.white.toColor(context))
} else {
holder.binding.titleTv.setBackgroundColor(R.color.ui_surface.toColor(context))
holder.binding.titleTv.setTextColor(R.color.text_777777.toColor(context))
holder.binding.titleTv.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_surface.toColor(context))
holder.binding.titleTv.setTextColor(com.gh.gamecenter.common.R.color.text_777777.toColor(context))
}
holder.binding.titleTv.text = mFilterList[position]

View File

@ -91,7 +91,7 @@ class FlexLinearLayout @JvmOverloads constructor(context: Context, attrs: Attrib
val params = LayoutParams(mLastItemWidth, mItemHeight)
layoutParams = params
setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_game_detail_label_more))
if (DarkModeUtils.isDarkModeOn(context)) setColorFilter(R.color.text_primary.toColor(context))
if (DarkModeUtils.isDarkModeOn(context)) setColorFilter(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
background = createNormalBackgroundDrawable()
scaleType = ImageView.ScaleType.CENTER
}
@ -114,7 +114,7 @@ class FlexLinearLayout @JvmOverloads constructor(context: Context, attrs: Attrib
setPadding(mPadding, 0, mPadding, 0)
layoutParams = params
setTextColor(if (tag.isTop) "#${tag.color}".hexStringToIntColor() else R.color.text_primary.toColor(context))
setTextColor(if (tag.isTop) "#${tag.color}".hexStringToIntColor() else com.gh.gamecenter.common.R.color.text_primary.toColor(context))
background = if (tag.isTop) createTopBackgroundDrawable(tag) else createNormalBackgroundDrawable()
setOnClickListener {
onClickListener?.onItemClickListener(tag, position)

View File

@ -11,7 +11,6 @@ import android.widget.LinearLayout
import android.widget.TextView
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.R
import com.gh.gamecenter.feature.entity.TagStyleEntity
import kotlin.math.ceil
@ -80,7 +79,7 @@ class GameTagFlexLinearLayout @JvmOverloads constructor(context: Context, attrs:
includeFontPadding = false
textSize = mTextSize
gravity = Gravity.CENTER
setTextColor(R.color.text_tertiary.toColor(context))
setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
val params = LayoutParams(LayoutParams.WRAP_CONTENT, mItemHeight)
params.setMargins(0, 0, mMargin, 0)

View File

@ -251,7 +251,7 @@ class ImageContainerView : LinearLayout {
when (data?.status) {
"pending" -> {
visibility = View.VISIBLE
text = R.string.pending_status.toResString()
text = com.gh.gamecenter.feature.R.string.pending_status.toResString()
}
"fail" -> {

View File

@ -6,7 +6,6 @@ import android.util.AttributeSet
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.view.children
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.visibleIf
@ -49,11 +48,11 @@ class SingleCardTagContainerView @JvmOverloads constructor(
tvTag.text = "$DELIMITER$tag"
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
tvTag.setTextAppearance(R.style.TextCaption2)
tvTag.setTextAppearance(com.gh.gamecenter.common.R.style.TextCaption2)
} else {
tvTag.setTextAppearance(context, R.style.TextCaption2)
tvTag.setTextAppearance(context, com.gh.gamecenter.common.R.style.TextCaption2)
}
tvTag.setTextColor(R.color.text_tertiary.toColor(context))
tvTag.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
addView(tvTag)
}
}

View File

@ -156,15 +156,15 @@ object XapkDialogHelper {
.append(" ")
binding.alternativeCancelTv.visibility = View.VISIBLE
binding.alternativeCancelTv.text = spannableString
binding.alternativeCancelTv.setTextColor(R.color.text_secondary.toColor(context))
binding.alternativeCancelTv.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(context))
binding.alternativeCancelTv.setDrawableEnd(R.drawable.ic_right_arrow_xapk)
binding.alternativeCancelTv.setOnClickListener {
doFeedback(context, downloadEntity)
}
binding.hintTv.text = "开启权限后请务必重启光环助手,再进行安装"
binding.hintTv.setTextColor(R.color.text_theme.toColor(context))
binding.hintTv.setTextAppearance(R.style.TextCaption1)
binding.hintTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
binding.hintTv.setTextAppearance(com.gh.gamecenter.common.R.style.TextCaption1)
binding.hintTv.visibility = View.VISIBLE
binding.hintTv.updateLayoutParams<ConstraintLayout.LayoutParams> {
topMargin = 8F.dip2px()

View File

@ -1,5 +1,7 @@
package com.gh.download;
import static com.gh.gamecenter.common.constant.Constants.IS_RESERVE_ONLINE_REMINDER;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
@ -413,6 +415,12 @@ public class DownloadManager implements DownloadStatusListener {
downloadEntity.setCustomPageTrackData(trackJson);
}
// 是否时预约上线提醒时,开启的自动下载(如果是这种情况开启的自动下载,则下载过程中的验证弹窗全部不显示)
boolean wifiAutoDownload = gameEntity.getWifiAutoDownload();
if (wifiAutoDownload) {
// 注意,这只是临时变量,用户在下载过程中,判断当前任务是否是预约上线触发的下载,下载完成后,请及时清理此字段
ExtensionsKt.addMetaExtra(downloadEntity, IS_RESERVE_ONLINE_REMINDER, IS_RESERVE_ONLINE_REMINDER);
}
if (isSubscribe) {
DownloadManager.getInstance().subscribe(downloadEntity);
} else {

View File

@ -34,7 +34,9 @@ import com.lightgame.utils.Utils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONException
import org.json.JSONObject
import java.util.*
@ -216,7 +218,7 @@ object PackageObserver {
try {
jsonObject.put("game_id", gameId)
jsonObject.put("package", packageName)
val rBody = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString())
val rBody = jsonObject.toString().toRequestBody("application/json".toMediaTypeOrNull())
RetrofitManager.getInstance().api
.postPlayedGame(UserManager.getInstance().userId, rBody)
.subscribeOn(Schedulers.io())

View File

@ -94,8 +94,8 @@ object ExoCacheManager {
response =
OkHttpClient.Builder().connectTimeout(5, TimeUnit.SECONDS).readTimeout(5, TimeUnit.SECONDS).build()
.newCall(request).execute()
if (response!!.isSuccessful && response.body() != null) {
val length = response.body()!!.contentLength()
if (response!!.isSuccessful && response.body != null) {
val length = response.body!!.contentLength()
contentLength = if (length == 0L) -1L else length
}
} catch (e: Exception) {

View File

@ -53,6 +53,7 @@ class DownloadDialog : BaseDraggableDialogFragment() {
private var mAdapter: DownloadDialogAdapter? = null
private var mTraceEvent: ExposureEvent? = null
private var mPlatformListAutoDownload: Boolean = true
private var mPlatformList: List<GamePlatform>? = null
private var mParentBundle: Bundle? = null
@ -99,10 +100,15 @@ class DownloadDialog : BaseDraggableDialogFragment() {
super.onCreate(savedInstanceState)
mParentBundle = requireActivity().intent.extras?.getBundle(ToolBarActivity.NORMAL_FRAGMENT_BUNDLE)
mPlatformList = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mParentBundle?.getParcelableArrayList(EntranceConsts.KEY_PLATFORMS, GamePlatform::class.java)
mPlatformListAutoDownload = mParentBundle?.getBoolean(EntranceConsts.KEY_PLATFORMS_AUTO_DOWNLOAD, true) ?: true
mPlatformList = if (mPlatformListAutoDownload) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mParentBundle?.getParcelableArrayList(EntranceConsts.KEY_PLATFORMS, GamePlatform::class.java)
} else {
mParentBundle?.getParcelableArrayList(EntranceConsts.KEY_PLATFORMS)
}
} else {
mParentBundle?.getParcelableArrayList(EntranceConsts.KEY_PLATFORMS)
emptyList()
}
mGameEntity = requireArguments().getParcelable(GameEntity::class.java.simpleName)!!
mEntrance = requireArguments().getString(EntranceConsts.KEY_ENTRANCE) ?: ""
@ -223,6 +229,7 @@ class DownloadDialog : BaseDraggableDialogFragment() {
mParentBundle?.putString(EntranceConsts.KEY_PLATFORM, "")
mParentBundle?.putString(EntranceConsts.KEY_PACKAGENAME, "")
}
mParentBundle?.putBoolean(EntranceConsts.KEY_PLATFORMS_AUTO_DOWNLOAD, false)
}, 200)
}

View File

@ -136,11 +136,11 @@ class DownloadDialogAdapter(
rightLink.text = links?.getOrNull(1)?.title ?: ""
leftLink.background = GradientDrawable().apply {
cornerRadius = 8F.dip2px().toFloat()
setStroke(0.5F.dip2px(), R.color.ui_divider.toColor(mContext))
setStroke(0.5F.dip2px(), com.gh.gamecenter.common.R.color.ui_divider.toColor(mContext))
}
rightLink.background = GradientDrawable().apply {
cornerRadius = 8F.dip2px().toFloat()
setStroke(0.5F.dip2px(), R.color.ui_divider.toColor(mContext))
setStroke(0.5F.dip2px(), com.gh.gamecenter.common.R.color.ui_divider.toColor(mContext))
}
}
}

View File

@ -67,10 +67,10 @@ class DownloadDialogInstalledItemViewHolder(val binding: DownloadDialogInstalled
binding.collection.text = if (apkCollection != null) {
if (apkCollection.showPluggableHint) {
binding.collectionPluggableHint.visibility = View.VISIBLE
binding.collection.setTextColor(R.color.text_05CBA3.toColor(binding.collection.context))
binding.collection.setTextColor(com.gh.gamecenter.common.R.color.text_05CBA3.toColor(binding.collection.context))
gameEntity.pluginDesc + "此版本"
} else {
binding.collection.setTextColor(R.color.text_instance.toColor(binding.collection.context))
binding.collection.setTextColor(com.gh.gamecenter.common.R.color.text_instance.toColor(binding.collection.context))
"查看合集"
}
} else "查看详情"

View File

@ -256,7 +256,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
?: return@setOnClickListener
if (FileUtils.isEmptyFile(downloadEntity.path)) {
Utils.toast(it.context, R.string.install_failure_hint)
Utils.toast(it.context, com.gh.gamecenter.common.R.string.install_failure_hint)
DownloadManager.getInstance().cancel(apkEntity.url)
} else {
if (PackageUtils.isCanPluggable(apkEntity)) {

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