Compare commits

..

122 Commits

Author SHA1 Message Date
5935654b2d feat: 更新 LGLibrary 的依赖 id
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-22 16:28:32 +08:00
e1d41ba73a fix: 正式环境-下拉推送-0318测试-客户端 https://jira.shanqu.cc/browse/GHZS-4986 2024-03-22 10:21:36 +08:00
4f1e60a6de Merge branch 'chen/202403/fix-GHZS-5002-3' into 'feat/GHZS-3956'
fix: GHZS-5002 https://jira.shanqu.cc/browse/GHZS-3956

See merge request halo/android/assistant-android!1583
2024-03-21 11:13:09 +08:00
8ff1eabd65 fix: GHZS-5002 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-21 11:11:58 +08:00
15ee93345a Merge branch 'chen/202403/fix-GHZS-5002-2' into 'feat/GHZS-3956'
fix:GHZS-5002 https://jira.shanqu.cc/browse/GHZS-3956

See merge request halo/android/assistant-android!1582
2024-03-21 09:14:56 +08:00
411e9f2737 fix:GHZS-5002 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-21 09:13:41 +08:00
1ac99bb4b7 Merge branch 'chen/202403/fix-GHZS-5002' into 'feat/GHZS-3956'
fix:GHZS-5002 https://jira.shanqu.cc/browse/GHZS-3956

See merge request halo/android/assistant-android!1581
2024-03-20 18:03:21 +08:00
71714ce538 fix:GHZS-5002 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 18:01:15 +08:00
9ff5e672ae fix: APP内容配置重构-埋点-0306测试—客户端(0320测试) https://jira.shanqu.cc/browse/GHZS-4870 2024-03-20 14:45:03 +08:00
a42097fcfe fix: APP内容配置重构-埋点-0306测试—客户端(0319测试) https://jira.shanqu.cc/browse/GHZS-4870 2024-03-20 14:45:03 +08:00
2b9f38255d fix: 修复文章详情页闪退问题 2024-03-20 14:45:03 +08:00
61ec6898e0 fix: APP内容配置重构-埋点-0306测试—客户端(0318测试) https://jira.shanqu.cc/browse/GHZS-4870 2024-03-20 14:45:03 +08:00
619dc13836 fix: 底部tab-0314测试-客户端 https://jira.shanqu.cc/browse/GHZS-4976 2024-03-20 14:45:03 +08:00
efa9af802c fix: 底部tab-0314测试-客户端 https://jira.shanqu.cc/browse/GHZS-4976 2024-03-20 14:45:03 +08:00
f93618b043 fix: 多tab导航页-0315测试-客户端 https://jira.shanqu.cc/browse/GHZS-4979 2024-03-20 14:45:03 +08:00
297c7ec801 fix: APP内容配置重构-埋点-0306测试—客户端(0313测试、0314测试) https://jira.shanqu.cc/browse/GHZS-4870 2024-03-20 14:45:03 +08:00
981ef696c2 fix:GHZS-4985 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:45:03 +08:00
9c3ea77aad fix:折叠滑动大图卡片之间间距调整 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:45:03 +08:00
a6299aabf0 fix:GHZS-4978 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:45:03 +08:00
a48f1c75a8 修复自定义页面切换浅色模式时,组件没有跟着一起变 2024-03-20 14:45:03 +08:00
db5a00627f fix:GHZS-4950,GHZS-4951,GHZS-4948 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:45:03 +08:00
bb5270e525 fix:GHZS-4948 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:45:03 +08:00
409556bff1 fix: 多tab导航页-0312测试-客户端 https://jira.shanqu.cc/browse/GHZS-4933 2024-03-20 14:45:03 +08:00
72262283f0 fix: 右下悬浮窗-0312-客户端 https://jira.shanqu.cc/browse/GHZS-4932 2024-03-20 14:45:03 +08:00
5832af2a7b fix: 底部tab-0312测试-客户端 https://jira.shanqu.cc/browse/GHZS-4934 2024-03-20 14:45:03 +08:00
12eadca85f fix: APP内容配置重构-埋点-0306测试—客户端 https://jira.shanqu.cc/browse/GHZS-4870 2024-03-20 14:45:03 +08:00
7523a22832 fix: 修复首页首次选中默认 item 时的跳跃问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
10f0b944e6 fix:GHZS-4928,GHZS-4926,GHZS-4914 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
5203851e3f fix:GHZS-4857,GHZS-4720,GHZS-4856,GHZS-4890,GHZS-4892,GHZS-4891 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
cdfed6359e fix: 自定义页面轮播发现页卡片加载游戏改为使用LiveData实现 2024-03-20 14:43:33 +08:00
44a2f311d4 feat: rebase on dev 2024-03-20 14:43:33 +08:00
b91b96e7d8 fix: 右下悬浮窗-0306测试-客户端(5) https://jira.shanqu.cc/browse/GHZS-4857 2024-03-20 14:43:33 +08:00
45edab2f4e fix:GHZS-4861 通用内容合集-0306测试-客户端 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
abe9a07011 fix: 弹窗-0307UI测试-客户端 https://jira.shanqu.cc/browse/GHZS-4874 2024-03-20 14:43:33 +08:00
147030fadd fix:GHZS-4732,GHZS-4712,GHZS-4860,GHZS-4857,GHZS-4836,GHZS-4832,GHZS-4720,GHZS-4856 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
c6c20e776c feat: 插件化区域-0306UI测试 https://jira.shanqu.cc/browse/GHZS-4866
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
bcd335c02f feat: 插件化区域-0306UI测试 https://jira.shanqu.cc/browse/GHZS-4866
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
04cc2d3c41 feat: 环境选择弹窗添加渠道选择功能
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
af46d1f6e2 feat: APP内容配置重构-附属需求:自定义页面 https://jira.shanqu.cc/browse/GHZS-4087 2024-03-20 14:43:33 +08:00
9a47ca6da4 fix: 青少年模式-0305优化及修复-客户端 https://jira.shanqu.cc/browse/GHZS-4854 2024-03-20 14:43:33 +08:00
440fb6d09a fix: 规范代码格式 2024-03-20 14:43:33 +08:00
efa9ace3a0 fix: APP内容配置重构-客户端-页面:自定义页面-02/06测试-客户端(2) https://jira.shanqu.cc/browse/GHZS-4758 2024-03-20 14:43:33 +08:00
f0b9b2344e fix: 插件化区域-0229UI测试 https://jira.shanqu.cc/browse/GHZS-4830
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
225d4fe565 GHZS-4742 右下悬浮窗-0204测试-客户端 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
a12a0f0b39 fix:GHZS-4840,GHZS-4822,GHZS-4824,GHZS-4829,GHZS-4831,GHZS-4833,GHZS-4832,GHZS-4765,GHZS-4764,GHZS-4838,GHZS-4837,GHZS-4836,GHZS-4823,GHZS-4720 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
c3662b7d20 fix: 修复OffsetLinearLayoutManager没有计算item的margin问题 2024-03-20 14:43:33 +08:00
a1b410b335 refactor: 重新实现首页选中底部 tab 的相关功能 2024-03-20 14:43:33 +08:00
3e4a14b795 fix: 搜索栏-0301UI测试-客户端 https://jira.shanqu.cc/browse/GHZS-4839 2024-03-20 14:43:33 +08:00
ce3476c171 fix: 处理合并问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
f42b810ef3 fix:APP内容配置重构-客户端-组件:游戏专题-光环游戏-0228测试-客户端 专题合集-0228测试-客户端 APP内容配置重构-客户端-组件:游戏专题-光环游戏-0201测试—客户端 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
3302571009 feat: 底部tab-0228优化-客户端 https://jira.shanqu.cc/browse/GHZS-4828 2024-03-20 14:43:33 +08:00
6fc9993a96 fix: 搜索栏-0228-客户端 https://jira.shanqu.cc/browse/GHZS-4827 2024-03-20 14:43:33 +08:00
0bc2f241dc fix: 修复游戏单广场引导图位置错误的问题,修复游戏单热搜榜、安利墙页面状态栏显示问题 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
60f0da33ef fix:自定义页面测试bug https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
47e9115994 fix: 修复多Tab导航页切换深色模式异常 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
ed6f256af2 feat: APP内容配置重构-埋点—客户端1 (对接自定义页面外层字段,补充下拉推送曝光)https://jira.shanqu.cc/browse/GHZS-4397 2024-03-20 14:43:33 +08:00
4cf90c51ef fix:专题合集-0219测试-客户端 游戏专题-0202UI测试—客户端 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:33 +08:00
4645abe6a1 Resolve GHZS-4397 "Chen/202402/ track2" 2024-03-20 14:43:33 +08:00
715075d067 fix: 弹窗-0223测试 https://jira.shanqu.cc/browse/GHZS-4798
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
6e0b7baed0 fix: 首次启动跳转-0222测试-客户端 https://jira.shanqu.cc/browse/GHZS-4788
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
4b3620c2c1 fix: 插件化区域-测试 https://jira.shanqu.cc/browse/GHZS-4056 2024-03-20 14:43:33 +08:00
a2ed406ffd fix: 多tab导航页-0220测试-客户端 https://jira.shanqu.cc/browse/GHZS-4783 2024-03-20 14:43:33 +08:00
ca7b966eed fix: 多tab导航页-0218测试-客户端 https://jira.shanqu.cc/browse/GHZS-4769
fix: 底部tab-0218测试-客户端 https://jira.shanqu.cc/browse/GHZS-4772
fix: 下拉推送-0218测试-客户端 https://jira.shanqu.cc/browse/GHZS-4771
2024-03-20 14:43:33 +08:00
12055e42a8 fix: 处理不规范入参问题,修复插件化通知浮窗不能正常弹出的问题
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:33 +08:00
b2c64c77c7 fix: 下拉推送-0208测试-客户端 https://jira.shanqu.cc/browse/GHZS-4768 2024-03-20 14:43:33 +08:00
58db23a1e8 fix: APP内容配置重构-组件:游戏单合集-0206测试-客户端(1(1)) https://jira.shanqu.cc/browse/GHZS-4755 2024-03-20 14:43:32 +08:00
9c261635d1 fix: 搜索栏-0206-客户端 https://jira.shanqu.cc/browse/GHZS-4759 2024-03-20 14:43:32 +08:00
3ce23d2ccd fix: 优化首页下拉推送背景渐变效果,修复自定义页面部分组件与下拉推送的滑动冲突问题 2024-03-20 14:43:32 +08:00
83b167cf00 修复新游开测crash 2024-03-20 14:43:32 +08:00
c6ba186b88 fix:GHZS-4732,GHZS-4730,GHZS-4735,GHZS-4738,GHZS-4739 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:32 +08:00
4fd6089459 fix: 底部tab-0131测试-客户端 https://jira.shanqu.cc/browse/GHZS-4708 2024-03-20 14:43:32 +08:00
694ac87365 fix:APP内容配置重构-客户端-组件:游戏专题-光环游戏-0201测试—客户端 https://jira.shanqu.cc/projects/GHZS/issues/GHZS-4720?filter=myopenissues 2024-03-20 14:43:32 +08:00
7979cd2edc fix: 修复下拉推送闪退问题 2024-03-20 14:43:32 +08:00
2191aa917b fix:GHZS-4715,GHZS-4696,GHZS-4668,GHZS-4713,GHZS-4712,GHZS-4665 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:32 +08:00
a228023380 fix:GHZS-4696,GHZS-4684,GHZS-4685,GHZS-4688,GHZS-4668 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:32 +08:00
4156caea7f fix: APP内容配置重构-客户端-页面:多tab导航页-0130测试-客户端 https://jira.shanqu.cc/browse/GHZS-4701 2024-03-20 14:43:32 +08:00
61d1009ef1 fix: 首次启动跳转-0131测试 https://jira.shanqu.cc/browse/GHZS-4706 2024-03-20 14:43:32 +08:00
32e964baac fix: APP内容配置重构-客户端-页面:多tab导航页-0130测试-客户端 https://jira.shanqu.cc/browse/GHZS-4701 2024-03-20 14:43:32 +08:00
d5ca958eab fix: APP内容配置重构-其他组件:下拉推送—客户端 (修复下拉推送背景圆角出现锯齿的问题) https://jira.shanqu.cc/browse/GHZS-4070 2024-03-20 14:43:32 +08:00
3ce300cb97 fix: 处理合并冲突 2024-03-20 14:43:32 +08:00
53750ff350 fix:GHZS-4683,GHZS-4687,GHZS-4680,GHZS-4671 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:32 +08:00
50c0e187f9 优化轮播图轮播逻辑:页面滚动或者轮播图不可见时,停止轮播 GHZS-3956 2024-03-20 14:43:32 +08:00
21707c2e91 fix:自定义页面测试bug:GHZS-4647,GHZS-4643,GHZS-4605 https://jira.shanqu.cc/projects/GHZS/issues/GHZS-4647?filter=myopenissues 2024-03-20 14:43:32 +08:00
9aeab8e3ff fix: APP内容配置重构-页面:多tab导航页—客户端(修复切换深色模式出现的界面异常) https://jira.shanqu.cc/browse/GHZS-4080 2024-03-20 14:43:32 +08:00
f317db999f fix: APP内容配置重构-底部tab—客户端(修改通用跳转命名,底部tab部分页面改为懒加载) https://jira.shanqu.cc/browse/GHZS-4025 2024-03-20 14:43:32 +08:00
004d16eea4 feat: APP内容配置重构-埋点—客户端2(补充曝光数据1) https://jira.shanqu.cc/browse/GHZS-4559 2024-03-20 14:43:32 +08:00
1156c1cfce fix:长列表式,点击换一批crash 2024-03-20 14:43:32 +08:00
bcd3d92037 fix:参数缺失 2024-03-20 14:43:32 +08:00
e57acc2803 fix:APP内容配置重构-客户端-组件:专题合集-轮播图-01/24测试-客户端 https://jira.shanqu.cc/projects/GHZS/issues/GHZS-4653?filter=myopenissues 2024-03-20 14:43:32 +08:00
012756ec38 fix: APP内容配置重构-刷新轮换—客户端(修复刷新轮换游戏全部被屏蔽时显示错误页数的问题) https://jira.shanqu.cc/browse/GHZS-4257 2024-03-20 14:43:32 +08:00
c2bbd62156 feat: APP内容配置重构-埋点—客户端2 https://jira.shanqu.cc/browse/GHZS-4559 2024-03-20 14:43:32 +08:00
01d878efdb fix:APP内容配置重构-客户端-组件:游戏专题-光环游戏-0120测试—客户端 https://jira.shanqu.cc/projects/GHZS/issues/GHZS-4608?filter=myopenissues 2024-03-20 14:43:32 +08:00
2a479524f3 fix: 修复首页闪退问题 https://jira.shanqu.cc/browse/GHZS-3956 2024-03-20 14:43:32 +08:00
dbafff1319 feat: APP内容配置重构-附属需求:弹窗顺序 https://jira.shanqu.cc/browse/GHZS-4086 2024-03-20 14:43:32 +08:00
665e838ce5 feat: APP内容配置重构-附属需求:首次启动跳转 https://jira.shanqu.cc/browse/GHZS-4085 2024-03-20 14:43:32 +08:00
7ec9bf08e2 feat: APP内容配置重构-附属需求:弹窗顺序 https://jira.shanqu.cc/browse/GHZS-4086 2024-03-20 14:43:32 +08:00
20d1b86842 fix:APP内容配置重构-客户端-组件:游戏专题-QQ小游戏-0120测试-客户端 https://jira.shanqu.cc/browse/GHZS-4607 2024-03-20 14:43:32 +08:00
958c710e3f fix: APP内容配置重构-换一批—客户端(修复点击换一批后功能失效的问题) https://jira.shanqu.cc/browse/GHZS-4256 2024-03-20 14:43:32 +08:00
8d5649d5f4 feat:自定义页面曝光埋点:https://jira.shanqu.cc/projects/GHZS/issues/GHZS-4397?filter=myopenissues 2024-03-20 14:43:32 +08:00
6d82f9a063 feat: APP内容配置重构-自定义页面下载按钮—客户端 https://jira.shanqu.cc/browse/GHZS-4255 2024-03-20 14:43:32 +08:00
4626e19fa9 fix: 补充自定义页面轮播发现页卡片获取游戏逻辑 https://jira.shanqu.cc/browse/GHZS-4596 2024-03-20 14:43:32 +08:00
302648102d fix: 0119测试-客户端(2) https://jira.shanqu.cc/browse/GHZS-4596 2024-03-20 14:43:32 +08:00
fa26df21d7 feat:APP内容配置重构-客户端-页面:自定义页面-01/19测试-客户端 https://jira.shanqu.cc/browse/GHZS-4601 2024-03-20 14:43:32 +08:00
5ebb14df92 feat: APP内容配置重构-附属需求:弹窗顺序 https://jira.shanqu.cc/browse/GHZS-4086 2024-03-20 14:43:32 +08:00
8acccbc58e fix: APP内容配置重构-其他组件:搜索栏—客户端(修复点击搜索栏无法跳转的问题) https://jira.shanqu.cc/browse/GHZS-4073 2024-03-20 14:43:32 +08:00
d535c80c4a fix: APP内容配置重构-其他组件:下拉推送—客户端 (修复下拉推送UI显示问题) https://jira.shanqu.cc/browse/GHZS-4070 2024-03-20 14:43:32 +08:00
d7ff16dd2b fix:修复折叠滑动大图,图标矩阵crash https://jira.shanqu.cc/browse/GHZS-4076 2024-03-20 14:43:32 +08:00
ad21859190 fix:光环APP】APP内容配置重构-客户端-页面:自定义页面:修复crash https://jira.shanqu.cc/browse/GHZS-4076 2024-03-20 14:43:32 +08:00
edddcc35b2 fix: 修复懒加载问题 2024-03-20 14:43:32 +08:00
7915f63e96 fix: APP内容配置重构-底部tab—客户端(关闭ViewPager2离屏加载,设置缓存数量) https://jira.shanqu.cc/browse/GHZS-4025 2024-03-20 14:43:32 +08:00
f076e918f9 fix: APP内容配置重构-底部tab—客户端(修复视频Tab显示问题) https://jira.shanqu.cc/browse/GHZS-4025 2024-03-20 14:43:32 +08:00
481e5db87a fix: APP内容配置重构-其他组件:下拉推送—客户端(修复首页为自定义页面时下拉推送搜索栏没有更新背景的问题) https://jira.shanqu.cc/browse/GHZS-4070 2024-03-20 14:43:32 +08:00
a4e2506f69 feat:【光环APP】APP内容配置重构-客户端-页面:自定义页面 https://jira.shanqu.cc/browse/GHZS-4076 2024-03-20 14:43:32 +08:00
7e581f4754 feat:APP内容配置重构-页面:自定义页面—客户端 https://jira.shanqu.cc/projects/GHZS/issues/GHZS-4077?filter=myopenissues 2024-03-20 14:43:32 +08:00
33c98c78b3 ci 2024-03-20 14:43:32 +08:00
bdf0d51578 feat: APP内容配置重构-换一批—客户端 https://jira.shanqu.cc/browse/GHZS-4256
feat: APP内容配置重构-刷新轮换—客户端 https://jira.shanqu.cc/browse/GHZS-4257
feat: APP内容配置重构-其他组件:搜索栏—客户端 https://jira.shanqu.cc/browse/GHZS-4073
feat: APP内容配置重构-页面:多tab导航页—客户端 https://jira.shanqu.cc/browse/GHZS-4080
feat: APP内容配置重构-其他组件:下拉推送—客户端 https://jira.shanqu.cc/browse/GHZS-4070
feat: APP内容配置重构-页面:多tab导航页—客户端 https://jira.shanqu.cc/browse/GHZS-4080
feat: APP内容配置重构-底部tab—客户端 https://jira.shanqu.cc/browse/GHZS-4025
2024-03-20 14:43:32 +08:00
812fae2288 对接通用内容合集数据
处理折叠滑动大图气泡动画
2024-03-20 14:43:32 +08:00
524bdfbd6b feat:APP内容配置重构-页面:自定义页面—客户端... 2024-03-20 14:43:32 +08:00
a974c48eb8 feat: APP内容配置重构-附属需求:弹窗顺序 https://jira.shanqu.cc/browse/GHZS-4086 2024-03-20 14:43:32 +08:00
f4bc1848ed fix: 处理代码冲突 2024-03-20 14:43:32 +08:00
0118079b28 feat: 移除无用的游戏名后缀字段
Signed-off-by: chenjuntao <chenjuntao@ghzhushou.com>
2024-03-20 14:43:32 +08:00
65b9c75bcd feat: 移除 GameEntity 无用的字段和方法,移除 Config 的一键修复相关功能 https://jira.shanqu.cc/browse/GHZS-4274 2024-03-20 14:43:32 +08:00
412 changed files with 9112 additions and 6603 deletions

View File

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

3
.gitmodules vendored
View File

@ -5,6 +5,9 @@
[submodule "vspace-bridge"]
path = vspace-bridge
url = ../../../cwzs/android/vspace-bridge.git
[submodule "module_common/src/debug/assets/assistant-android-mock"]
path = module_common/src/debug/assets/assistant-android-mock
url = ../../../halo/android/assistant-android-mock.git
[submodule "ndownload"]
path = ndownload
url = ../../../android/ndownload.git

View File

@ -345,6 +345,8 @@ dependencies {
})
implementation "com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:$gsyVideo"
// implementation "androidx.work:work-runtime:${workManager}"
implementation "com.llew.huawei:verifier:${verifier}"
teaImplementation "com.bytedance.applog:RangersAppLog-Lite-cn:${bytedanceApplog}"
@ -357,6 +359,8 @@ dependencies {
implementation "com.lg:easyfloat:${easyFloat}"
implementation "io.github.florent37:shapeofview:${shapeOfView}"
implementation "com.lg:apksig:${apksig}"
implementation "com.lg:gid:${gid}"
@ -408,13 +412,6 @@ dependencies {
exclude group: 'androidx.swiperefreshlayout'
}
internalImplementation(project(':module_internal_test'))
// 根据BUILD_PUSH_TYPE决定使用哪个推送SDK目前默认使用阿里云推送
def pushProject = findProperty('BUILD_PUSH_TYPE') == 'jg'
? project(':feature:jg_push') : project(':feature:acloud_push')
implementation(pushProject) {
exclude group: 'androidx.swiperefreshlayout'
}
}
File propFile = file('sign.properties')
@ -485,13 +482,6 @@ andResGuard {
// 打开这个开关会合并所有哈希值相同的资源,但请不要过度依赖这个功能去除去冗余资源
mergeDuplicatedRes = true
whiteList = [
"R.xml.jpush*",
"R.drawable.jpush*",
"R.layout.jpush*",
"R.layout.push*",
"R.string.jg*",
"R.style.MyDialogStyle",
"R.style.JPushTheme",
"R.drawable.icon",
"R.drawable.ic_bar_back",
"R.drawable.toolbar_search_icon",

View File

@ -8,7 +8,7 @@ import com.gh.gamecenter.core.provider.IFlavorProvider
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.TimeUtils
import com.halo.assistant.HaloApp
import com.tencent.vasdolly.helper.ChannelReaderUtil
import com.leon.channel.helper.ChannelReaderUtil
class FlavorProviderImp : IFlavorProvider {

View File

@ -12,7 +12,7 @@ import com.gh.gamecenter.core.utils.TimeUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.halo.assistant.HaloApp
import com.kwai.monitor.payload.TurboHelper
import com.tencent.vasdolly.helper.ChannelReaderUtil
import com.leon.channel.helper.ChannelReaderUtil
class FlavorProviderImp : IFlavorProvider {

View File

@ -11,14 +11,6 @@
<package android:name="com.lg.vspace" />
</queries>
<!-- 华为/荣耀角标 -->
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE "/>
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
<!-- vivo角标 -->
<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<!-- 允许应用程序访问网络连接 -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- 允许应用程序写入外部存储如SD卡上写文件 -->
@ -126,12 +118,10 @@
android:label="@string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_config"
android:preserveLegacyExternalStorage="true"
android:requestLegacyExternalStorage="true"
android:resizeableActivity="true"
android:theme="@style/AppCompatTheme.APP"
tools:replace="android:name,android:allowBackup"
tools:targetApi="r">
tools:targetApi="n">
<meta-data
android:name="EasyGoClient"
@ -323,6 +313,14 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.answer.edit.AnswerEditActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.InfoActivity"
android:screenOrientation="portrait" />
@ -331,6 +329,10 @@
android:name=".qa.questions.invite.QuestionsInviteActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.myqa.MyAskActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.questions.edit.QuestionEditActivity"
android:screenOrientation="portrait" />
@ -368,6 +370,10 @@
android:name="com.gh.gamecenter.qa.article.edit.ArticleEditActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.article.MyArticleActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.article.draft.ArticleDraftActivity"
android:screenOrientation="portrait" />
@ -406,6 +412,10 @@
android:name="com.gh.gamecenter.history.HistoryActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.personalhome.rating.RatingActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.gamedetail.rating.logs.CommentLogsActivity"
android:screenOrientation="portrait" />
@ -478,6 +488,9 @@
android:name=".gamedetail.fuli.kaifu.ServersSubscribedGameListActivity"
android:screenOrientation="portrait" />
<activity
android:name=".qa.answer.draft.AnswerDraftActivity"
android:screenOrientation="portrait" />
<activity
android:name=".gamedetail.rating.RatingFoldActivity"
android:screenOrientation="portrait" />
@ -489,6 +502,10 @@
android:name=".video.poster.PosterEditActivity"
android:screenOrientation="portrait" />
<activity
android:name=".video.poster.PosterClipActivity"
android:screenOrientation="portrait" />
<activity
android:name=".forum.detail.ForumDetailActivity"
android:screenOrientation="portrait" />

View File

@ -6,6 +6,8 @@
<link rel="stylesheet" type="text/css" href="normalize.css">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="video-js.min.css">
<!-- <link rel="stylesheet" href="https://static-web.ghzs.com/website-static/lib/video-js.min.css">--> <!--在web页面播放视频-->
<!--<link rel="stylesheet" type="text/css" href="https://resource.ghzs.com/css/halo_app.css">-->
</head>
<body style="overflow-x: hidden; word-break: break-all;">
@ -13,5 +15,8 @@
<script type="text/javascript" src="zepto.min.js"></script>
<script type="text/javascript" src="rich_editor.js"></script>
<script type="text/javascript" src="video.min.js"></script>
<!--<script src="https://static-web.ghzs.com/website-static/lib/video.min.js"></script>--> <!--在web页面播放视频-->
<!--<script type="text/javascript" src="content.js"></script>-->
<!--<script type="text/javascript" src="https://resource.ghzs.com/js/halo_app.js"></script>-->
</body>
</html>

View File

@ -34,18 +34,18 @@ try {
var script = document.createElement("script")
document.body.appendChild(script)
if (isDebug) {
script.src = "https://dev-and-static.ghzs66.com/web/js/halo.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
script.src = "https://resource.ghzs.com/js/halo_app_test.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
} else {
script.src = "https://and-static.ghzs66.com/web/js/halo.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
script.src = "https://resource.ghzs.com/js/halo.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
}
var style = document.createElement("link")
style.rel = "stylesheet"
style.type = "text/css"
if (isDebug) {
style.href = "https://dev-and-static.ghzs66.com/web/css/halo.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
style.href = "https://resource.ghzs.com/css/halo_app_test.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
} else {
style.href = "https://and-static.ghzs66.com/web/css/halo.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
style.href = "https://resource.ghzs.com/css/halo.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
}
document.head.appendChild(style)

View File

@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.SharedPreferences
import android.os.Message
import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
@ -193,8 +192,7 @@ object AdDelegateHelper {
/**
* 热启动是否需要显示开屏广告
*/
private fun shouldShowStartUpAdWhenHotLaunch() =
mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK && mSplashAd?.hotStartThirdPartyAd != null
private fun shouldShowStartUpAdWhenHotLaunch() = mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK
/**
* 是否需要显示下载管理广告
@ -388,10 +386,8 @@ object AdDelegateHelper {
}
}
val thirdPartyAd = if (isHotLaunch) mSplashAd?.hotStartThirdPartyAd else mSplashAd?.thirdPartyAd
// 第三方广告的数据为空,按加载失败处理
if (mSplashAd == null || thirdPartyAd == null) {
if (mSplashAd == null || mSplashAd?.thirdPartyAd == null) {
sdkSplashCallback.invoke(false)
return
}
@ -402,14 +398,14 @@ object AdDelegateHelper {
((mSplashAd?.displayRule?.timeout ?: 3.5F) * 1000).toInt()
}
if (thirdPartyAd.sourceName == AD_SDK_BEIZI) {
if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_BEIZI) {
sdkStartAdContainer.visibility = View.VISIBLE
requestBeiziSplashAd(sdkStartAdContainer, adsViewGroup, adViewWidthInPx, adViewHeightInPx, timeout.toLong(), sdkSplashCallback)
} else if (thirdPartyAd.sourceName == AD_SDK_CSJ) {
} else if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_CSJ) {
sdkStartAdContainer.visibility = View.VISIBLE
requestCsjSplashAd(
activity,
thirdPartyAd.slotId,
mSplashAd?.thirdPartyAd?.slotId ?: "unknown",
adViewWidthInPx,
adViewHeightInPx,
adViewWidthInDp,
@ -577,17 +573,6 @@ object AdDelegateHelper {
(if (linkEntity.type != null) linkEntity.type else "")!!,
(if (linkEntity.link != null) linkEntity.link else "")!!
)
SensorsBridge.trackEvent(
"SplashAdOwnSkip",
"splash_ad_id",
ad.id,
"link_type",
linkEntity.type ?: "",
"link_id",
linkEntity.link ?: "",
"link_text",
linkEntity.text ?: ""
)
}
val sources: MutableList<ExposureSource> = ArrayList()
sources.add(ExposureSource("开屏广告", ad.id))
@ -595,19 +580,7 @@ object AdDelegateHelper {
ExposureManager.log(event)
if (ad.button) {
jumpDetailBtn.setOnClickListener { v: View ->
val linkEntity = ad.jump
directToLinkPage(v.context, linkEntity, "(启动广告)", "", event)
SensorsBridge.trackEvent(
"SplashAdOwnClick",
"splash_ad_id",
ad.id,
"link_type",
linkEntity.type ?: "",
"link_id",
linkEntity.link ?: "",
"link_text",
linkEntity.text ?: ""
)
directToLinkPage(v.context, ad.jump, "(启动广告)", "", event)
v.postDelayed({
handler.removeMessages(MainActivity.COUNTDOWN_AD)
hideCallback.invoke()
@ -619,10 +592,7 @@ object AdDelegateHelper {
LogUtils.logStartAd("start_ads", ad)
}
SPUtils.setLong(Constants.SP_LAST_SPLASH_AD_SHOW_TIME, System.currentTimeMillis())
val msg = Message.obtain()
msg.what = MainActivity.COUNTDOWN_AD
msg.obj = ad
handler.sendMessageDelayed(msg, 1000)
handler.sendEmptyMessageDelayed(MainActivity.COUNTDOWN_AD, 1000)
}
/**

View File

@ -12,13 +12,13 @@ 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
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.core.utils.MD5Utils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.common.entity.ErrorEntity
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.entity.ForumDetailEntity
import com.gh.gamecenter.entity.LocalVideoEntity
import com.gh.gamecenter.entity.QuoteCountEntity
@ -28,6 +28,7 @@ import com.gh.gamecenter.retrofit.service.ApiService
import com.gh.gamecenter.video.upload.OnUploadListener
import com.gh.gamecenter.video.upload.UploadManager
import com.google.gson.JsonObject
import com.lightgame.download.FileUtils
import com.lightgame.utils.Utils
import com.zhihu.matisse.Matisse
import com.zhihu.matisse.internal.utils.PathUtils
@ -61,6 +62,7 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
val TITLE_MIN_LENGTH = 6
val MIN_TEXT_LENGTH = 6
val MAX_TEXT_LENGTH = 10000
val FILE_HOST = "file:///"
var id = ""//视频标记
var videoId = ""//更改封面视频id
val quoteCountEntity = QuoteCountEntity()//数据上报用
@ -127,13 +129,15 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
}
val map = LinkedHashMap<String, String>()
for (key in imageUrlMap.keys) {
val localFileUri = FILE_HOST + key.decodeURI()
// 文件格式为 HEIC 时,使用经 OSS 转码的图片作为预览图片
if (FileUtils.getFileMimeType(getApplication(), key.decodeURI())?.lowercase(Locale.CHINA)?.contains("heic") == true) {
val transformedImgUrl = ImageUtils.getIdealImageUrl(imageUrlMap[key], 5000) ?: ""
val transformedImgUrl = ImageUtils.getTransformedUrl(imageUrlMap[key], 5000) ?: ""
map[MD5Utils.getUrlMD5(key)] = transformedImgUrl
mapImages[transformedImgUrl.decodeURI()] = imageUrlMap[key] ?: ""
} else {
map[MD5Utils.getUrlMD5(key)] = imageUrlMap[key] ?: ""
map[MD5Utils.getUrlMD5(key)] = localFileUri
mapImages[TextUtils.htmlEncode(key).decodeURI()] = imageUrlMap[key] ?: ""
}
}

View File

@ -4,7 +4,6 @@ import android.app.Activity
import android.app.Application
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.ad.AdDelegateHelper
import com.gh.common.util.FloatingBackViewManager
import com.gh.common.xapk.XapkInstaller
@ -15,9 +14,7 @@ import com.gh.gamecenter.SplashAdActivity
import com.gh.gamecenter.SplashScreenActivity
import com.gh.gamecenter.authorization.AuthorizationActivity
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.PackageFlavorHelper
import com.gh.gamecenter.core.provider.IPushProvider
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
@ -84,10 +81,6 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
}
XapkInstaller.updateCurrentInstallStatus()
// 清除桌面角标
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
pushProvider?.cleanBadgeNumber(activity.applicationContext)
}
override fun onActivityPaused(activity: Activity) {

View File

@ -45,6 +45,7 @@ import com.gh.gamecenter.login.user.LoginTag
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.login.user.UserRepository
import com.gh.gamecenter.login.utils.LoginHelper
import com.gh.gamecenter.login.utils.QuickLoginHelper
import com.gh.gamecenter.login.view.LoginActivity
import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
import com.gh.gamecenter.setting.SettingBridge
@ -129,12 +130,12 @@ class DefaultJsApi(
@JavascriptInterface
fun login(msg: Any) {
// if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
// QuickLoginHelper.startLogin(context, "浏览器")
// } else {
if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
QuickLoginHelper.startLogin(context, "浏览器")
} else {
val intent = LoginActivity.getIntent(context, "浏览器")
context.startActivity(intent)
// }
}
}
@JavascriptInterface
@ -328,11 +329,6 @@ class DefaultJsApi(
return HaloApp.getInstance().gid
}
@JavascriptInterface
fun getOaid(msg: Any): String {
return HaloApp.getInstance().oaid
}
@JavascriptInterface
fun showIncompatibleVersionDialog(msg: Any) {
DialogHelper.showUpgradeDialog(context)

View File

@ -2,16 +2,17 @@ package com.gh.common
import com.gh.common.exposure.ExposureManager
import com.gh.common.filter.RegionSettingHelper
import com.gh.common.util.AdHelper
import com.gh.common.videolog.VideoRecordUtils
import com.gh.download.DownloadDataHelper
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.doOnMainProcessOnly
import com.gh.gamecenter.common.utils.tryCatchInRelease
import com.gh.gamecenter.core.runOnUiThread
import com.gh.gamecenter.entity.TimeEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import io.reactivex.schedulers.Schedulers
import kotlin.concurrent.fixedRateTimer
@ -25,6 +26,7 @@ object FixedRateJobHelper {
private const val DOWNLOAD_HEARTBEAT_PERIOD: Long = 60 * 1000L
private const val DOWNLOAD_HEARTBEAT_SHEET_PERIOD: Long = 15 * 1000L
private const val STARTUP_AD: Long = 30 * 60 * 1000L
private var mExecuteCount: Int = 0
@ -32,56 +34,58 @@ object FixedRateJobHelper {
@JvmStatic
fun begin() {
// 时间检查每15秒检查一次
fixedRateTimer("Global-Fixed-Rate-Timer", initialDelay = 100, period = CHECKER_PERIOD) {
val elapsedTime = mExecuteCount * CHECKER_PERIOD
// 时间校对10分钟一次
if (elapsedTime % TIME_PERIOD == 0L) {
RetrofitManager.getInstance().api.time
.subscribeOn(Schedulers.io())
.subscribe(object : Response<TimeEntity>() {
override fun onResponse(response: TimeEntity?) {
val serverTime = response?.time
serverTime?.let {
timeDeltaBetweenServerAndClient = it * 1000 - System.currentTimeMillis()
doOnMainProcessOnly {
// 时间检查每15秒检查一次
fixedRateTimer("Global-Fixed-Rate-Timer", initialDelay = 100, period = CHECKER_PERIOD) {
val elapsedTime = mExecuteCount * CHECKER_PERIOD
// 时间校对10分钟一次
if (elapsedTime % TIME_PERIOD == 0L) {
RetrofitManager.getInstance().api.time
.subscribeOn(Schedulers.io())
.subscribe(object : Response<TimeEntity>() {
override fun onResponse(response: TimeEntity?) {
val serverTime = response?.time
serverTime?.let {
timeDeltaBetweenServerAndClient = it * 1000 - System.currentTimeMillis()
}
}
}
})
}
// 提交曝光数据
if (elapsedTime % EXPOSURE_PERIOD == 0L) {
ExposureManager.commitSavedExposureEvents(true)
}
// 分片检测下载进度
if (elapsedTime % DOWNLOAD_HEARTBEAT_SHEET_PERIOD == 0L) {
tryCatchInRelease {
val upload = (mExecuteCount * CHECKER_PERIOD) % DOWNLOAD_HEARTBEAT_PERIOD == 0L
DownloadDataHelper.uploadDownloadHeartbeat(upload)
})
}
}
// 提交普通 loghub 数据
if (elapsedTime % LOGHUB_PERIOD == 0L) {
runOnUiThread {
LoghubUtils.commitSavedLoghubEvents(true)
// 提交曝光数据
if (elapsedTime % EXPOSURE_PERIOD == 0L) {
ExposureManager.commitSavedExposureEvents(true)
}
}
// 更新游戏屏蔽信息
if (elapsedTime % REGION_SETTING_PERIOD == 0L) {
if (HaloApp.getInstance().isRunningForeground) {
RegionSettingHelper.getRegionSetting()
// 分片检测下载进度
if (elapsedTime % DOWNLOAD_HEARTBEAT_SHEET_PERIOD == 0L) {
tryCatchInRelease {
val upload = (mExecuteCount * CHECKER_PERIOD) % DOWNLOAD_HEARTBEAT_PERIOD == 0L
DownloadDataHelper.uploadDownloadHeartbeat(upload)
}
}
}
// 提交视频浏览记录数据
if (elapsedTime % VIDEO_RECORD_PERIOD == 0L) {
VideoRecordUtils.commitVideoRecord()
}
// 提交普通 loghub 数据
if (elapsedTime % LOGHUB_PERIOD == 0L) {
runOnUiThread {
LoghubUtils.commitSavedLoghubEvents(true)
}
}
mExecuteCount++
// 更新游戏屏蔽信息
if (elapsedTime % REGION_SETTING_PERIOD == 0L) {
if (HaloApp.getInstance().isRunningForeground) {
RegionSettingHelper.getRegionSetting()
}
}
// 提交视频浏览记录数据
if (elapsedTime % VIDEO_RECORD_PERIOD == 0L) {
VideoRecordUtils.commitVideoRecord()
}
mExecuteCount++
}
}
}
}

View File

@ -18,15 +18,7 @@ class LandPageAddressHandler : DownloadChainHandler() {
}
DialogUtils.showLandPageAddressDialog(context, gameEntity) {// 跳转第三方落地页
if (gameEntity.isLandPageAddressDialogShowOnly()) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity, asVGame)
} else {
processEndCallback?.invoke(asVGame, null)
}
} else {
DirectUtils.directToExternalBrowser(context, gameEntity.landPageAddressDialog!!.link!!)
}
DirectUtils.directToExternalBrowser(context, gameEntity.landPageAddressDialog!!.link!!)
}
}
} else {

View File

@ -57,7 +57,8 @@ public class Config {
public static final String WEIBO_APPKEY = BuildConfig.WEIBO_APPKEY;
public static final String QUICK_LOGIN_APPID = BuildConfig.QUICK_LOGIN_APPID;
public static final String QUICK_LOGIN_APPKEY = BuildConfig.QUICK_LOGIN_APPKEY;
public static final String URL_ARTICLE = "www.ghzs666.com/article/"; // ghzs/ghzs666 统一
// http://www.ghzs666.com/article/${articleId}.html
public static final String URL_ARTICLE = "http://www.ghzs666.com/article/"; // ghzs/ghzs666 统一
private static final String SETTINGS_KEY = "settingsKey";
@ -94,7 +95,8 @@ public class Config {
getPreferences().edit().putString(SETTINGS_KEY, GsonUtils.toJson(settingsEntity)).apply();
mSettingsEntity = settingsEntity;
PackageHelper.refreshList();
// 加载完设置后刷新下
PackageHelper.initList();
}
@Nullable

View File

@ -52,8 +52,6 @@ import com.gh.gamecenter.WebActivity;
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;
@ -71,14 +69,13 @@ import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.vspace.VHelper;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Utils;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import kotlin.collections.CollectionsKt;
/**
* Created by khy on 12/02/18.
*/
@ -135,7 +132,7 @@ public class BindingAdapters {
case DOWNLOADING_PLUGIN:
case DOWNLOADING_NORMAL:
Intent intent = DownloadManagerActivity.getDownloadMangerIntent(v.getContext(),
gameEntity.getApk().isEmpty() ? "" : gameEntity.getApk().get(0).getUrl(), entrance);
gameEntity.getApk().get(0).getUrl(), entrance);
v.getContext().startActivity(intent);
break;
case NONE:
@ -221,7 +218,7 @@ public class BindingAdapters {
if (gameEntity.getApk().size() == 1) {
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().isEmpty() ? "" : gameEntity.getApk().get(0).getUrl());
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().get(0).getUrl());
if (downloadEntity != null) {
File file = new File(downloadEntity.getPath());
if (!file.exists()) {
@ -459,9 +456,9 @@ public class BindingAdapters {
ToastUtils.toast(context.getString(R.string.unsupported_browser_install_hint));
}
String buttonText = progressBar.getText();
ApkEntity apkEntity = CollectionsKt.firstOrNull(gameEntity.getApk());
String msg = FileUtils.isCanDownload(progressBar.getContext(), apkEntity == null ? "" : apkEntity.getSize());
if (apkEntity != null && TextUtils.isEmpty(msg)) {
ApkEntity apkEntity = gameEntity.getApk().get(0);
String msg = FileUtils.isCanDownload(progressBar.getContext(), apkEntity.getSize());
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(progressBar.getContext(),
apkEntity,
gameEntity,

View File

@ -23,7 +23,6 @@ class GameOffServiceDialogFragment : BaseDialogFragment() {
private var mDialog: GameEntity.Dialog? = null
private var mBinding: DialogGameOffServiceBinding? = null
private var mCallback: (() -> Unit)? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -45,7 +44,6 @@ class GameOffServiceDialogFragment : BaseDialogFragment() {
titleTv.text = title
contentTv.text = HtmlCompat.fromHtml(content, HtmlCompat.FROM_HTML_MODE_LEGACY)
okTv.setOnClickListener {
mCallback?.invoke()
dismissAllowingStateLoss()
}
@ -66,6 +64,7 @@ class GameOffServiceDialogFragment : BaseDialogFragment() {
siteTv.text = site.text
siteTv.paintFlags = siteTv.paintFlags or Paint.UNDERLINE_TEXT_FLAG
siteTv.setOnClickListener {
// MtaHelper.onEvent("游戏下载状态按钮", getKey(), site.text)
DirectUtils.directToWebView(requireContext(), site.url, "(关闭下载弹窗)")
dismissAllowingStateLoss()
}
@ -84,13 +83,11 @@ class GameOffServiceDialogFragment : BaseDialogFragment() {
const val KEY_DIALOG = "dialog"
@JvmStatic
fun getInstance(dialog: GameEntity.Dialog, callback: (() -> Unit)? = null) =
GameOffServiceDialogFragment().apply {
arguments = Bundle().apply {
putParcelable(KEY_DIALOG, dialog)
}
mCallback = callback
fun getInstance(dialog: GameEntity.Dialog) = GameOffServiceDialogFragment().apply {
arguments = Bundle().apply {
putParcelable(KEY_DIALOG, dialog)
}
}
}
}

View File

@ -1,68 +0,0 @@
package com.gh.common.dialog
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Environment
import android.provider.Settings
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import com.gh.gamecenter.common.databinding.DialogAlertDefaultBinding
import com.lightgame.dialog.BaseDialogFragment
@RequiresApi(Build.VERSION_CODES.R)
class ManagerAllFilesPermissionDialogFragment : BaseDialogFragment() {
private val mBinding by lazy { DialogAlertDefaultBinding.inflate(layoutInflater) }
private var mCallBack: (() -> Unit)? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return mBinding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mBinding.run {
titleTv.text = "请求权限"
titleTv.gravity = Gravity.CENTER
contentTv.text = "需要所有文件访问权限,请打开权限设置页面"
confirmTv.setOnClickListener {
val intent = Intent().apply {
action = Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
data = Uri.fromParts("package", requireContext().packageName, null)
}
requireActivity().startActivityForResult(intent, REQUEST_CODE)
}
cancelTv.setOnClickListener {
dismissAllowingStateLoss()
}
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_CODE && Environment.isExternalStorageManager()) {
mCallBack?.invoke()
dismissAllowingStateLoss()
}
}
companion object {
const val REQUEST_CODE = 1000
@JvmStatic
fun show(activity: AppCompatActivity, callback: () -> Unit) {
ManagerAllFilesPermissionDialogFragment().apply {
mCallBack = callback
}.show(
activity.supportFragmentManager,
ManagerAllFilesPermissionDialogFragment::class.java.name
)
}
}
}

View File

@ -19,7 +19,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.DirectUtils
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
@ -60,7 +59,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
private val mDuration = 3000
private var mDisposable: Disposable? = null
private var mAdapter: PackageCheckAdapter? = null
private var mAllInstalledPackages = PackageHelper.getInstalledPackages(HaloApp.getInstance().application, 0)
private var mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
var gameEntity: GameEntity? = null
var callBack: ConfirmListener? = null
@ -326,7 +325,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
override fun onResume() {
super.onResume()
mAllInstalledPackages = PackageHelper.getInstalledPackages(HaloApp.getInstance().application, 0)
mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
gameEntity?.packageDialog?.let {
if (isAllPackageInstalled(mAllInstalledPackages, it)) {
callBack?.onConfirm()
@ -364,7 +363,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(busFour: EBPackage) {
if (busFour.isInstalledOrUninstalled()) {
mAllInstalledPackages = PackageHelper.getInstalledPackages(HaloApp.getInstance().application, 0)
mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
mAdapter?.notifyDataSetChanged()
}
}
@ -417,7 +416,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
return
}
val allInstalledPackages = PackageHelper.getInstalledPackages(HaloApp.getInstance().application, 0)
val allInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
if (isAllPackageInstalled(allInstalledPackages, packageDialogEntity)) {
callBack.onConfirm()
return

View File

@ -27,7 +27,7 @@ object ExposureUtils {
): ExposureEvent {
val gameEntity = entity.copy()
gameEntity.id = if (entity.id.contains(DownloadEntity.GAME_ID_DIVIDER)) {
entity.id.split(DownloadEntity.GAME_ID_DIVIDER).toTypedArray().firstOrNull() ?: ""
entity.id.split(DownloadEntity.GAME_ID_DIVIDER).toTypedArray()[0]
} else {
entity.id
}

View File

@ -0,0 +1,89 @@
package com.gh.common.prioritychain
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IFloatingWindowProvider
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
import com.gh.gamecenter.floatingwindow.FloatingWindowEntity
import com.gh.gamecenter.fragment.WelcomeDialogFragment
import com.lightgame.utils.Utils
class FloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
private var mFragment: BaseLazyFragment? = null
private var mRecyclerView: RecyclerView? = null
private var mWindowList: ArrayList<FloatingWindowEntity>? = null
fun setData(windowList: ArrayList<FloatingWindowEntity>?) {
mWindowList = windowList
if (mFragment != null) {
doPreProcess()
}
}
fun setView(
fragment: BaseLazyFragment,
recyclerView: RecyclerView
) {
mFragment = fragment
mRecyclerView = recyclerView
if (mWindowList != null) {
doPreProcess()
}
}
private fun doPreProcess() {
Utils.log(TAG, "FloatingWindowHandler preProcess windowSize is -> ${mWindowList?.size}")
if (getStatus() == STATUS_PENDING) {
if (!mWindowList.isNullOrEmpty()) {
updateStatus(STATUS_VALID)
process()
} else {
processNext()
}
} else {
if (!mWindowList.isNullOrEmpty()) {
updateStatus(STATUS_VALID)
} else {
updateStatus(STATUS_INVALID)
}
}
}
override fun onProcess(): Boolean {
when (getStatus()) {
STATUS_VALID -> {
val floatingWindowProvider =
ARouter.getInstance().build(RouteConsts.provider.floatingwindow)
.navigation() as? IFloatingWindowProvider<WelcomeDialogEntity>
// 强校验所有条件均通过才能显示
if (floatingWindowProvider == null || mFragment == null || mFragment?.isAdded == false || mRecyclerView == null) {
processNext()
return false
}
floatingWindowProvider.showFloatingWindowOnly(
mFragment!!,
mRecyclerView!!,
mWindowList!!,
) {
val welcomeDialog = WelcomeDialogFragment.getInstance(it, true, mFragment)
welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
}
}
STATUS_INVALID -> {
processNext()
}
}
return false
}
}

View File

@ -1,6 +1,8 @@
package com.gh.common.prioritychain
import android.graphics.Bitmap
import androidx.fragment.app.FragmentActivity
import com.gh.gamecenter.common.callback.BiCallback
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
@ -19,19 +21,20 @@ class WelcomeDialogHandler(priority: Int) : PriorityChainHandler(priority) {
// 判断启动本次应用是否已经弹窗,不是的话弹启动弹窗
if (HaloApp.get(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false) == null) {
HaloApp.put(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false)
val idealUrl = ImageUtils.getIdealImageUrl(this.welcomeDialogEntity!!.icon, 0, true) ?: ""
ImageUtils.prefetchToDiskCache(idealUrl) { isSuccess ->
if (isSuccess) {
ImageUtils.getBitmap(this.welcomeDialogEntity!!.icon, object : BiCallback<Bitmap, Boolean> {
override fun onFirst(first: Bitmap) {
if (getStatus() == STATUS_PENDING) {
updateStatus(STATUS_VALID)
process()
} else {
updateStatus(STATUS_VALID)
}
} else {
}
override fun onSecond(second: Boolean) {
processNext()
}
}
})
} else {
processNext()
}

View File

@ -22,6 +22,34 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directToQqConversation(context, qq)
}
override fun directToCommodityDetail(context: Context, commodityId: String) {
DirectUtils.directToCommodityDetail(context, commodityId)
}
override fun directToEnergyRecord(context: Context) {
DirectUtils.directToEnergyRecord(context)
}
override fun directToEnergyRulePage(context: Context) {
DirectUtils.directToEnergyRulePage(context)
}
override fun directToInviteFriends(context: Context) {
DirectUtils.directToInviteFriends(context)
}
override fun directToExchangeRulePage(context: Context) {
DirectUtils.directToExchangeRulePage(context)
}
override fun directToExchangeCommodityPage(context: Context) {
DirectUtils.directToExchangeCommodityPage(context)
}
override fun directToLotteryParadisePage(context: Context) {
DirectUtils.directToLotteryParadisePage(context)
}
override fun directDouyin(context: Context, userId: String) {
DirectUtils.directDouyin(context, userId)
}
@ -69,6 +97,26 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directToAmway(context, fixedTopAmwayCommentId, entrance, path)
}
override fun directToOrderCenter(context: Context) {
DirectUtils.directToOrderCenter(context)
}
override fun directToOrderDetail(context: Context, orderId: String) {
DirectUtils.directToOrderDetail(context, orderId)
}
override fun directToEnergyRecord(context: Context, position: Int) {
DirectUtils.directToEnergyRecord(context, position)
}
override fun directToMyPrizePage(context: Context) {
DirectUtils.directToMyPrizePage(context)
}
override fun directToWinOrderDetail(context: Context, orderId: String, activityId: String) {
DirectUtils.directToWinOrderDetail(context, orderId, activityId)
}
override fun directToQGame(context: Context) {
return DirectUtils.directToQGameHome(context)
}

View File

@ -3,16 +3,14 @@ package com.gh.common.provider
import android.content.Context
import android.content.pm.PackageInfo
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.PackageHelper
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
import com.gh.gamecenter.core.utils.ProcessUtil
@Route(path = RouteConsts.provider.packageUtils, name = "PackageUtils暴露服务")
class PackageUtilsProviderImpl : IPackageUtilsProvider {
override fun obtainProcessName(): String? {
return ProcessUtil.getCurrentProcessName()
override fun obtainProcessName(context: Context): String? {
return PackageUtils.obtainProcessName(context)
}
override fun getGhVersionName(): String {
@ -24,7 +22,7 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
}
override fun getInstalledPackages(context: Context, flag: Int): List<PackageInfo> {
return PackageHelper.getInstalledPackages(context, flag)
return PackageUtils.getInstalledPackages(context, flag)
}
override fun getApkSignatureByPackageName(context: Context, packageName: String): Array<String> {
@ -39,10 +37,6 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
return PackageUtils.isSignedByGh(context, packageName)
}
override fun isInstalledWithLauncherIcon(context: Context, packageName: String): Boolean {
return PackageUtils.isInstalled(context, packageName)
}
override fun getInstalledTime(context: Context, packageName: String): Long {
return PackageUtils.getInstalledTime(context, packageName)
}

View File

@ -20,14 +20,15 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor.uiExecutor
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.entity.TrackableEntity
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.SimulatorEntity
import com.gh.gamecenter.entity.TrackableEntity
import com.gh.ndownload.NDataChanger
import com.halo.assistant.HaloApp
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import com.lightgame.download.FileUtils
import com.lightgame.utils.Utils
import java.lang.ref.WeakReference
import java.text.DecimalFormat
@ -166,160 +167,162 @@ class SimulatorDownloadManager private constructor() {
this.gameName = gameName
this.gameType = gameCategoryChinese
PermissionHelper.checkGetInstalledAppsListBeforeAction(context) { _ ->
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
//当没有安装新版本模拟器时候 判断是否隐藏
if (simulator?.active == false && !isInstalledNewSimulator) {
showNoneEmulatorDialog(context)
return@checkGetInstalledAppsListBeforeAction
}
var isInstalled = PackageUtils.isInstalledFromAllPackage(
context,
simulator?.apk?.packageName
)
//模拟器管理界面还是用之前的逻辑
if (isInstalledNewSimulator && location != SimulatorLocation.SIMULATOR_MANAGE) {
isInstalled = isInstalledNewSimulator
}
PermissionHelper.checkGetInstalledAppsListBeforeAction(context, object : EmptyCallback {
override fun onCallback() {
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
//当没有安装新版本模拟器时候 判断是否隐藏
if (simulator?.active == false && !isInstalledNewSimulator) {
showNoneEmulatorDialog(context)
return
}
var isInstalled = PackageUtils.isInstalledFromAllPackage(
context,
simulator?.apk?.packageName
)
//模拟器管理界面还是用之前的逻辑
if (isInstalledNewSimulator && location != SimulatorLocation.SIMULATOR_MANAGE) {
isInstalled = isInstalledNewSimulator
}
// val versionFromInstalledApp = PackageUtils.getVersionNameByPackageName(simulator?.apk?.packageName)
val shouldShowUpdate =
PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
val showAlertTag = SPUtils.getString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, "") //当天是否弹过
val todayIsShow = showAlertTag == TimeUtils.getToday()
downloadType = if (shouldShowUpdate && isInstalled) "update" else "download"
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE) {
return@checkGetInstalledAppsListBeforeAction
}
if (downloadType == "download" && isInstalled) {
return@checkGetInstalledAppsListBeforeAction
}
val title = if (shouldShowUpdate && isInstalled) "更新模拟器" else "安装模拟器"
val message =
if (shouldShowUpdate && isInstalled) "检测到模拟器存在更高版本,是否前往更新" else "模拟器游戏需要先下载安装对应的模拟器,才可以运行"
val positiveText =
if (shouldShowUpdate && isInstalled) "更新(${simulator?.apk?.size}" else "下载(${simulator?.apk?.size}"
val negativeText = if (shouldShowUpdate && isInstalled) "下次再说" else "取消"
val trackableEntity = TrackableEntity(
"模拟器下载",
key = if (shouldShowUpdate && isInstalled) "更新弹窗" else "下载弹窗",
logShowEvent = true
)
if (shouldShowUpdate && isInstalled) {
NewFlatLogUtils.logSimulatorUpdateAlertShow()
}
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
val shouldShowUpdate =
PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
val showAlertTag = SPUtils.getString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, "") //当天是否弹过
val todayIsShow = showAlertTag == TimeUtils.getToday()
downloadType = if (shouldShowUpdate && isInstalled) "update" else "download"
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE) {
return
}
if (downloadType == "download" && isInstalled) {
return
}
val title = if (shouldShowUpdate && isInstalled) "更新模拟器" else "安装模拟器"
val message =
if (shouldShowUpdate && isInstalled) "检测到模拟器存在更高版本,是否前往更新" else "模拟器游戏需要先下载安装对应的模拟器,才可以运行"
val positiveText =
if (shouldShowUpdate && isInstalled) "更新(${simulator?.apk?.size}" else "下载(${simulator?.apk?.size}"
val negativeText = if (shouldShowUpdate && isInstalled) "下次再说" else "取消"
val trackableEntity = TrackableEntity(
"模拟器下载",
key = if (shouldShowUpdate && isInstalled) "更新弹窗" else "下载弹窗",
logShowEvent = true
)
} else {
SensorsBridge.trackSimulatorInstallDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
DialogHelper.showDialog(
context,
title,
message,
positiveText,
negativeText,
trackMtaEvent = true,
cancelClickCallback = {
if (shouldShowUpdate && isInstalled) {
cancelCallback?.invoke()
NewFlatLogUtils.logSimulatorUpdateAlertClick("取消")
MtaHelper.onEvent(trackableEntity.event, trackableEntity.key, "点击下次再说")
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = negativeText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = negativeText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
confirmClickCallback = {
showDownloadingDialog(context, simulator, gameId, gameName, gameCategoryChinese)
NewFlatLogUtils.logSimulatorUpdateAlertClick("更新")
MtaHelper.onEvent(
trackableEntity.event,
trackableEntity.key,
if (shouldShowUpdate && isInstalled) "点击更新" else "点击下载"
if (shouldShowUpdate && isInstalled) {
NewFlatLogUtils.logSimulatorUpdateAlertShow()
}
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = positiveText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
} else {
SensorsBridge.trackSimulatorInstallDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
DialogHelper.showDialog(
context,
title,
message,
positiveText,
negativeText,
trackMtaEvent = true,
cancelClickCallback = {
if (shouldShowUpdate && isInstalled) {
cancelCallback?.invoke()
NewFlatLogUtils.logSimulatorUpdateAlertClick("取消")
MtaHelper.onEvent(trackableEntity.event, trackableEntity.key, "点击下次再说")
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = negativeText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = negativeText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
confirmClickCallback = {
showDownloadingDialog(context, simulator, gameId, gameName, gameCategoryChinese)
NewFlatLogUtils.logSimulatorUpdateAlertClick("更新")
MtaHelper.onEvent(
trackableEntity.event,
trackableEntity.key,
if (shouldShowUpdate && isInstalled) "点击更新" else "点击下载"
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = positiveText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
touchOutsideCallback = {
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
mtaEvent = trackableEntity.event, mtaKey = trackableEntity.key,
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
if (downloadType == "update" && location != SimulatorLocation.SIMULATOR_MANAGE) {
SPUtils.setString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, TimeUtils.getToday())
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = positiveText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = positiveText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
touchOutsideCallback = {
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
mtaEvent = trackableEntity.event, mtaKey = trackableEntity.key,
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
if (downloadType == "update" && location != SimulatorLocation.SIMULATOR_MANAGE) {
SPUtils.setString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, TimeUtils.getToday())
}
}
}
})
}
fun showDownloadingDialog(

View File

@ -8,6 +8,7 @@ import android.graphics.Bitmap
import android.net.Uri
import android.text.TextUtils
import com.gh.common.constant.Config
import com.gh.gamecenter.feature.utils.ApkActiveUtils
import com.gh.common.util.LogUtils
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
@ -23,13 +24,13 @@ import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.core.utils.UrlFilterUtils
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.SimulatorGameRecordEntity
import com.gh.gamecenter.feature.utils.ApkActiveUtils
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.room.AppDatabase
import com.halo.assistant.HaloApp
import com.lightgame.download.DownloadDao
import com.lightgame.download.DownloadEntity
import com.lightgame.download.FileUtils
import com.lightgame.utils.AppManager
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
@ -38,6 +39,7 @@ import okhttp3.ResponseBody
import org.json.JSONArray
import java.io.ByteArrayOutputStream
import java.io.File
import java.util.*
object SimulatorGameManager {
@ -183,8 +185,8 @@ object SimulatorGameManager {
val intent = Intent()
intent.data = Uri.fromFile(File(downloadEntity.path))
if (gameEntity.simulatorType == "FBA" || gameEntity.simulatorType == "FBN") {
val apkEntity = gameEntity.getApk().firstOrNull()
intent.putExtra("rom_name", apkEntity?.packageName ?: "")
val apkEntity = gameEntity.getApk()[0]
intent.putExtra("rom_name", apkEntity.packageName)
}
intent.putExtra("default_path", downloadEntity.path.substring(0, downloadEntity.path.lastIndexOf('/')))
intent.putExtra("game_type", gameEntity.simulatorType)

View File

@ -1,11 +1,17 @@
package com.gh.common.util;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.core.utils.CurrentActivityHolder;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.login.utils.QuickLoginHelper;
import com.gh.gamecenter.login.view.LoginActivity;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.login.user.UserManager;
import com.lightgame.utils.Utils;
@ -22,15 +28,15 @@ public class CheckLoginUtils {
LogUtils.login("dialog", null, entrance);
LogUtils.login("activity", null, entrance);
// if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
// startQuickLogin(context, entrance);
// } else {
// 有可能App未启动
Bundle bundle = new Bundle();
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
bundle.putString(EntranceConsts.KEY_TO, LoginActivity.class.getName());
EntranceUtils.jumpActivity(context, bundle);
// }
if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
startQuickLogin(context, entrance);
} else {
// 有可能App未启动
Bundle bundle = new Bundle();
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
bundle.putString(EntranceConsts.KEY_TO, LoginActivity.class.getName());
EntranceUtils.jumpActivity(context, bundle);
}
} else {
if (listener != null) {
listener.onLogin();
@ -38,16 +44,16 @@ public class CheckLoginUtils {
}
}
// private static void startQuickLogin(Context context, String entrance) {
// // 需要确保传入的 context 不为 application
// if (!(context instanceof Activity)) {
// context = CurrentActivityHolder.getCurrentActivity();
// }
//
// if (context != null) {
// QuickLoginHelper.startLogin(context, entrance);
// }
// }
private static void startQuickLogin(Context context, String entrance) {
// 需要确保传入的 context 不为 application
if (!(context instanceof Activity)) {
context = CurrentActivityHolder.getCurrentActivity();
}
if (context != null) {
QuickLoginHelper.startLogin(context, entrance);
}
}
public static void checkLogin(final Context context, Bundle nextToBundle, boolean isTriggerNextStep, String entrance, OnLoginListener listener) {
if (!isLogin()) {

View File

@ -533,7 +533,7 @@ public class CommentUtils {
} else {
ImageUtils.display(holder.commentUserBadgeIv, "");
}
ImageUtils.display(holder.commentUserIconDv, userInfo.getIcon());
ImageUtils.displayIcon(holder.commentUserIconDv, userInfo.getIcon());
} else {
if (entity.getMe() != null && entity.getMe().isContentOwner()) {
holder.commentAuthorTv.setVisibility(View.VISIBLE);
@ -549,7 +549,7 @@ public class CommentUtils {
if (TextUtils.isEmpty(entity.getUser().getIcon())) {
ImageUtils.display(holder.commentUserIconDv, R.drawable.user_default_icon_comment);
} else {
ImageUtils.display(holder.commentUserIconDv, entity.getUser().getIcon());
ImageUtils.displayIcon(holder.commentUserIconDv, entity.getUser().getIcon());
}
}
}

View File

@ -125,7 +125,9 @@ public class DataUtils {
HaloApp.getInstance().setGid(gid);
// 更新广告配置
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
ExtensionsKt.doOnMainProcessOnly(HaloApp.getInstance(), () -> {
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
});
getDeviceCertification(gid);
@ -145,8 +147,11 @@ public class DataUtils {
@Override
public void onFailure(String s) {
MtaHelper.onEventWithBasicDeviceInfo("开发辅助", "GID 获取异常", s);
// 更新广告配置
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
ExtensionsKt.doOnMainProcessOnly(HaloApp.getInstance(), () -> {
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
});
}
});
}

View File

@ -12,6 +12,9 @@ import com.gh.common.repository.ReservationRepository;
import com.gh.common.simulator.SimulatorGameManager;
import com.gh.common.xapk.XapkInstaller;
import com.gh.common.xapk.XapkUnzipStatus;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.PluginLocation;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.DetailViewHolder;
@ -19,9 +22,6 @@ import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.PluginLocation;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.vspace.VHelper;
import com.lightgame.download.DownloadEntity;
@ -259,7 +259,7 @@ public class DetailDownloadUtils {
if (showDualDownloadButton && viewHolder.getLocalDownloadSizeTv() != null) {
viewHolder.getLocalDownloadSizeTv().setVisibility(View.GONE);
String size = viewHolder.getGameEntity().getApk().isEmpty() ? "" : viewHolder.getGameEntity().getApk().get(0).getSize();
String size = viewHolder.getGameEntity().getApk().get(0).getSize();
if (size != null) {
String sizeWithoutDigit = size.replaceAll("(?<=\\d)\\.[0-9]+(?!\\d)", "");
viewHolder.getLocalDownloadSizeTv().setText(sizeWithoutDigit);
@ -442,7 +442,7 @@ public class DetailDownloadUtils {
}
private static String getDownloadSizeText(DetailViewHolder viewHolder) {
return String.format("%s", viewHolder.getGameEntity().getApk().isEmpty() ? "" : viewHolder.getGameEntity().getApk().get(0).getSize());
return String.format("%s", viewHolder.getGameEntity().getApk().get(0).getSize());
}
private static void updateVStyleDownloadButton(DetailViewHolder viewHolder,

View File

@ -82,7 +82,6 @@ import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function0;
public class DialogUtils {
@ -579,15 +578,11 @@ public class DialogUtils {
dialog.dismiss();
});
ApkEntity apkEntity = CollectionsKt.firstOrNull(gameEntity.getApk());
String size = apkEntity == null ? "" : apkEntity.getSize();
if ("show&download".equals(gameEntity.getOverseasAddressDialog().getStatus())) {
if (apkEntity != null) {
apkEntity.setUrl(gameEntity.getOverseasAddressDialog().getLink());
}
gameEntity.getApk().get(0).setUrl(gameEntity.getOverseasAddressDialog().getLink());
}
binding.urlTv.setText(gameEntity.getOverseasAddressDialog().getLink());
binding.downloadBtn.setText("下载(" + size + "");
binding.downloadBtn.setText("下载(" + gameEntity.getApk().get(0).getSize() + "");
binding.downloadBtn.setOnClickListener(v -> {
dismissByTouchInside.set(true);
SensorsBridge.trackOverseasAddressDialogClick(
@ -636,12 +631,7 @@ public class DialogUtils {
binding.closeIv.setOnClickListener(v -> dialog.dismiss());
binding.urlTv.setText(gameEntity.getLandPageAddressDialog().getLink());
String downloadText = gameEntity.isLandPageAddressDialogShowOnly()
? "下载(" + gameEntity.getApk().get(0).getSize() + ""
: context.getString(R.string.dialog_land_page_address_confirm);
binding.downloadBtn.setText(downloadText);
binding.downloadBtn.setText(context.getString(R.string.dialog_land_page_address_confirm));
binding.downloadBtn.setOnClickListener(v -> {
listener.onConfirm();
dialog.dismiss();

View File

@ -1625,6 +1625,211 @@ object DirectUtils {
jumpActivityCompat(context, newBundle)
}
/**
* 跳转至商品详情
*/
@JvmStatic
fun directToCommodityDetail(context: Context, commodityId: String) {
var url: String = if (EnvHelper.isDevEnv) {
Constants.COMMODITY_DETAIL_ADDRESS_DEV
} else {
Constants.COMMODITY_DETAIL_ADDRESS
}
url = String.format(
Locale.CHINA,
"%s&shopid=%s&timestamp=%d",
url,
commodityId,
(Date().time / 1000 / 1000.toFloat()).roundToInt()
)
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至光能记录默认跳到光能记录第一个Tab
*/
@JvmStatic
fun directToEnergyRecord(context: Context) {
directToEnergyRecord(context, 0)
}
@JvmStatic
fun directToEnergyRecord(context: Context, position: Int) {
var url: String = if (EnvHelper.isDevEnv) {
Constants.ENERGY_RECORD_ADDRESS_DEV
} else {
Constants.ENERGY_RECORD_ADDRESS
}
url = String.format(
Locale.CHINA,
"%s&position=%s&timestamp=%d",
url,
position,
(Date().time / 1000 / 1000.toFloat()).roundToInt()
)
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至订单中心
*/
@JvmStatic
fun directToOrderCenter(context: Context) {
val url: String = if (EnvHelper.isDevEnv) {
Constants.ORDER_CENTER_ADDRESS_DEV
} else {
Constants.ORDER_CENTER_ADDRESS
}
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至订单详情
*/
@JvmStatic
fun directToOrderDetail(context: Context, orderId: String) {
var url: String = if (EnvHelper.isDevEnv) {
Constants.ORDER_DETAIL_ADDRESS_DEV
} else {
Constants.ORDER_DETAIL_ADDRESS
}
url = String.format(
Locale.CHINA,
"%s&order_id=%s&timestamp=%d",
url,
orderId,
(Date().time / 1000 / 1000.toFloat()).roundToInt()
)
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至邀请好友
*/
@JvmStatic
fun directToInviteFriends(context: Context) {
val url: String = if (EnvHelper.isDevEnv) {
Constants.INVITE_FRIENDS_ADDRESS_DEV
} else {
Constants.INVITE_FRIENDS_ADDRESS
}
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至等级页面
*/
@JvmStatic
fun directToLevelPage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.LEVEL_ADDRESS
} else {
Constants.LEVEL_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s?timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至兑换规则
*/
@JvmStatic
fun directToExchangeRulePage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.EXCHANGE_RULE_ADDRESS
} else {
Constants.EXCHANGE_RULE_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至光能规则
*/
@JvmStatic
fun directToEnergyRulePage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.ENERGY_RULE_ADDRESS
} else {
Constants.ENERGY_RULE_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至兑换商品
*/
@JvmStatic
fun directToExchangeCommodityPage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.EXCHANGE_COMMODITY_ADDRESS
} else {
Constants.EXCHANGE_COMMODITY_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至抽奖乐园
*/
@JvmStatic
fun directToLotteryParadisePage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.LOTTERY_PARADISE_ADDRESS
} else {
Constants.LOTTERY_PARADISE_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至我的奖品
*/
@JvmStatic
fun directToMyPrizePage(context: Context) {
var url: String = if (isPublishEnv()) {
Constants.MY_PRIZE_ADDRESS
} else {
Constants.MY_PRIZE_ADDRESS_DEV
}
url = String.format(Locale.CHINA, "%s&timestamp=%d", url, (Date().time / 1000 / 1000.toFloat()).roundToInt())
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至中奖订单详情
*/
@JvmStatic
fun directToWinOrderDetail(context: Context, orderId: String, activityId: String) {
var url: String = if (isPublishEnv()) {
Constants.WIN_ORDER_DETAIL_ADDRESS
} else {
Constants.WIN_ORDER_DETAIL_ADDRESS_DEV
}
url = String.format(
Locale.CHINA,
"%s&order_id=%s&activity_id=%s&timestamp=%d",
url,
orderId,
activityId,
(Date().time / 1000 / 1000.toFloat()).roundToInt()
)
directToFullScreenWebPage(context, url, true)
}
/**
* 跳转至地址信息

View File

@ -46,6 +46,7 @@ import com.gh.vspace.VHelper
import com.lightgame.download.DownloadConfig
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import com.lightgame.download.FileUtils
import com.lightgame.utils.Utils
import java.io.File
import java.util.concurrent.LinkedBlockingQueue
@ -1059,7 +1060,7 @@ object DownloadItemUtils {
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
return
}
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().firstOrNull()?.url)
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk()[0].url)
if (downloadEntity != null) {
val file = File(downloadEntity.path)
if (!file.exists()) {
@ -1153,7 +1154,7 @@ object DownloadItemUtils {
) {
if (gameEntity.getApk().isEmpty()) return
val msg = FileUtils.isCanDownload(context, gameEntity.getApk().firstOrNull()?.size ?: "")
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size ?: "")
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(
context,
@ -1191,7 +1192,7 @@ object DownloadItemUtils {
isSubscribe: Boolean,
traceEvent: ExposureEvent?
) {
val msg = FileUtils.isCanDownload(context, gameEntity.getApk().firstOrNull()?.size ?: "")
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size ?: "")
if (TextUtils.isEmpty(msg)) {
DownloadManager.createDownload(context, gameEntity, false, entrance, location, isSubscribe, traceEvent)
ToastUtils.toast(gameEntity.name + "已加入下载队列")
@ -1218,7 +1219,7 @@ object DownloadItemUtils {
adapter: RecyclerView.Adapter<out RecyclerView.ViewHolder?>?,
refreshCallback: EmptyCallback?
) {
val apkEntity = gameEntity.getApk().firstOrNull()
val apkEntity = gameEntity.getApk()[0]
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
if (downloadEntity != null) {
val path = downloadEntity.path
@ -1226,7 +1227,7 @@ object DownloadItemUtils {
FileUtils.isEmptyFile(path) -> {
Utils.toast(context, R.string.install_failure_hint)
DownloadManager.getInstance().cancel(downloadEntity.url)
gameEntity.getEntryMap().remove(apkEntity?.getPlatform())
gameEntity.getEntryMap().remove(apkEntity.getPlatform())
adapter?.notifyItemChanged(position)
refreshCallback?.onCallback()
}

View File

@ -32,10 +32,7 @@ import com.gh.gamecenter.help.HelpAndFeedbackBridge
import com.gh.gamecenter.pkg.PkgHelper
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadConfig
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import com.lightgame.download.*
import com.lightgame.utils.AppManager
import com.lightgame.utils.Utils
import org.greenrobot.eventbus.EventBus

View File

@ -41,6 +41,7 @@ import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.teenagermode.TeenagerModeActivity
import com.gh.vspace.VHelper
import com.lightgame.download.DownloadEntity
import com.lightgame.download.FileUtils
import com.lightgame.utils.Utils
import java.io.File
@ -384,7 +385,7 @@ object GameActivityDownloadHelper {
return
}
val simulatorDownloadEntity =
SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().firstOrNull()?.url)
SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk()[0].url)
if (simulatorDownloadEntity != null) {
val file = File(simulatorDownloadEntity.path)
if (!file.exists()) {
@ -431,7 +432,7 @@ object GameActivityDownloadHelper {
return when {
gameEntity.getApk().isEmpty() -> null
gameEntity.getApk().size == 1 -> gameEntity.getApk().firstOrNull()
gameEntity.getApk().size == 1 -> gameEntity.getApk()[0]
// 找出对应平台版本Apk且移除掉其他平台版本Apk
isRemoveOther -> {

View File

@ -2,15 +2,20 @@ package com.gh.common.util;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.core.AppExecutor;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.R;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.feature.entity.TagStyleEntity;
@ -70,6 +75,11 @@ public class GameViewUtils {
// 新的游戏标签样式 version>=4.0.0
private static TextView getNewGameTagView(Context context, TagStyleEntity tagEntity, int rightMargin) {
// 参数不全,用旧样式实现
if (TextUtils.isEmpty(tagEntity.getBackground())) {
return getGameTagView(context, tagEntity.getName(), rightMargin, "type", tagEntity);
}
TextView tag = new TextView(context);
updateTagStyle(context, tag, tagEntity, rightMargin);
return tag;
@ -98,6 +108,57 @@ public class GameViewUtils {
textView.setBackground(DrawableView.getServerDrawable(ExtensionsKt.hexStringToIntColor("#" + tagEntity.getBackground(), Color.WHITE)));
}
private static TextView getGameTagView(Context context, String tagStr, int rightMargin, String tagType, TagStyleEntity tagEntity) {
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lparams.rightMargin = rightMargin;
TextView tag = new TextView(context);
tag.setTextSize(TypedValue.COMPLEX_UNIT_SP, 9);
tag.setSingleLine(true);
tag.setText(tagStr);
if ("官方版".equals(tagStr) || "已关注".equals(tagStr)) {
tag.setBackgroundResource(R.drawable.border_green_bg);
tag.setTextColor(ContextCompat.getColor(context, R.color.tag_green));
} else {
String colorStr;
if (!TextUtils.isEmpty(tagType) && "type".equals(tagType) && tagEntity != null) { // 游戏标签
colorStr = "#" + tagEntity.getColor();
GradientDrawable gradientDrawable = new GradientDrawable();
if ("border".equals(tagEntity.getStyle())) {
gradientDrawable.setColor(Color.TRANSPARENT);
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
tag.setTextColor(ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
} else {
gradientDrawable.setColor(ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
tag.setTextColor(Color.WHITE);
}
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(3F));
tag.setBackgroundDrawable(gradientDrawable);
} else {
colorStr = TagUtils.getInstance(context).getColor(tagStr);
if (colorStr == null) {
return null;
}
int color = ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE);
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setColor(Color.TRANSPARENT);
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), color);
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(3F));
tag.setBackgroundDrawable(gradientDrawable);
tag.setTextColor(color);
}
}
tag.setLayoutParams(lparams);
tag.setPadding(DisplayUtils.dip2px(context, 4),
0,
DisplayUtils.dip2px(context, 4),
DisplayUtils.dip2px(context, 1));
return tag;
}
public static String getGameTestDate(long testTime) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);

View File

@ -35,6 +35,8 @@ object HomeBottomBarHelper {
text = "游戏库",
name = "游戏库",
position = 2,
iconSelect = "https://resource.ghzs.com/image/game/library/entrance/5e183202913fbd002c75f247.png",
iconUnselect = "https://resource.ghzs.com/image/game/library/entrance/5e1831fd913fbd003024641e.png",
animationCode = animationCode,
default = false,
display = Display()

View File

@ -50,7 +50,7 @@ public class InstallUtils {
public void handleMessage(Message msg) {
if (msg.what == INSTALL_WHAT && packageManager != null) {
ArrayList<String> list = new ArrayList<>();
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = PackageUtils.getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
list.add(packageInfo.packageName);

View File

@ -768,7 +768,7 @@ public class LibaoUtils {
}
public static boolean isAppInstalled(Context context, String packageName) {
List<PackageInfo> pinfo = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
List<PackageInfo> pinfo = PackageUtils.getInstalledPackages(context, 0);
if (pinfo != null) {
for (int i = 0; i < pinfo.size(); i++) {
String pn = pinfo.get(i).packageName;

View File

@ -566,7 +566,7 @@ public class MessageShareUtils {
String path;
// 安卓11无法访问Android/data目录
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath() + "/ShareImg/";
path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/ShareImg/";
} else {
path = context.getExternalCacheDir().getPath() + "/ShareImg/";
}

View File

@ -2,53 +2,23 @@ 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.content.pm.PermissionInfo
import android.os.Build
import android.provider.Settings
import com.gh.common.constant.Config
import com.gh.gamecenter.common.utils.PermissionHelper.isGetInstalledListPermissionDisabled
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.feature.entity.SettingsEntity
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import kotlin.collections.ArrayList
import kotlin.collections.HashSet
object PackageHelper {
private const val TAG = "PackageHelper"
private const val SP_GET_INSTALLED_API_AGREED = "get_installed_api_agreed"
private const val UNKNOWN = -1
private const val UNSUPPORTED = 0
private const val SUPPORTED = 1
private var lastInstalledPackageListTime = 0L
private var installedPackageList: List<PackageInfo> = arrayListOf()
private var isGetInstalledPackagesApiAgreed = false
private var isGetInstalledListPermissionSupported = UNKNOWN // 设备是否支持禁用获取已安装应用列表。-1 代表支持情况未知0 代表不支持, 1 代表支持
// 评论黑名单包名列表,避免用户安装了 Xposed Installer 这样的工具,也能在包含该安装包的游戏详情页评论
private var _commentPackageNameBlackList = arrayListOf<String>()
val commentPackageNameBlackList: ArrayList<String> = _commentPackageNameBlackList
var commentPackageNameBlackList = arrayListOf<String>()
// 关闭下载的包列表
private var _downloadPackageNameBlackList = arrayListOf<String>()
val downloadPackageNameBlackList: ArrayList<String> = _downloadPackageNameBlackList
var downloadPackageNameBlackList = arrayListOf<String>()
// 本地已安装的包去掉关闭下载的包后的列表
private var _validLocalPackageNameSet = hashSetOf<String>()
val validLocalPackageNameSet: HashSet<String> = _validLocalPackageNameSet
var validLocalPackageNameSet = hashSetOf<String>()
// 游戏包名匹配列表
private var _relatedPackageList = arrayListOf<SettingsEntity.GameWithPackages>()
val relatedPackageList: ArrayList<SettingsEntity.GameWithPackages> = _relatedPackageList
var relatedPackageList = arrayListOf<SettingsEntity.GameWithPackages>()
// 本地已安装包的列表
var localPackageNameSet = hashSetOf<String>()
@ -68,26 +38,33 @@ object PackageHelper {
}
@JvmStatic
fun refreshList() {
Config.getSettings()?.gameCommentBlackList?.let { _commentPackageNameBlackList = ArrayList(it) }
Config.getSettings()?.gameDownloadBlackList?.let { _downloadPackageNameBlackList = ArrayList(it) }
Config.getSettings()?.gamePackageMatch?.let { _relatedPackageList = ArrayList(it) }
fun initList() {
Config.getSettings()?.gameCommentBlackList?.let {
commentPackageNameBlackList = ArrayList(it)
}
Config.getSettings()?.gameDownloadBlackList?.let {
downloadPackageNameBlackList = ArrayList(it)
}
Config.getSettings()?.gamePackageMatch?.let {
relatedPackageList = ArrayList(it)
}
Config.getSettings()?.gameDownloadBlackList
updateValidPackageNameList()
}
private fun updateValidPackageNameList() {
_validLocalPackageNameSet =
validLocalPackageNameSet =
localPackageNameSet.filterNot { p -> downloadPackageNameBlackList.contains(p) }.toHashSet()
}
/**
/*
* 获取所有已安装的软件的包名、版本(非系统应用)
*/
private fun getAllPackageName(context: Context): HashSet<String> {
val set = HashSet<String>()
return try {
val packageInfos = getInstalledPackages(context, 0)
val packageInfos = PackageUtils.getInstalledPackages(context, 0)
for (packageInfo in packageInfos) {
if (packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
if (context.packageName != packageInfo.packageName) {
@ -102,154 +79,4 @@ object PackageHelper {
}
}
/**
* 弃用已安装列表缓存
*/
fun dumpInstalledListCache() {
lastInstalledPackageListTime = 0
}
/**
* 用户是否已经允许了调用获取已安装应用列表接口
* 优先用内存的值,没有再从 SP 中获取并更新
*/
fun isGetInstalledPackagesApiAgreed(): Boolean {
return isGetInstalledPackagesApiAgreed
|| (SPUtils.getBoolean(SP_GET_INSTALLED_API_AGREED).also { isGetInstalledPackagesApiAgreed = it })
}
/**
* 同意使用已安装应用列表 API
*/
fun agreeOnGetInstalledPackagesApi() {
isGetInstalledPackagesApiAgreed = true
SPUtils.setBoolean(SP_GET_INSTALLED_API_AGREED, true)
}
/**
* 获取已安装应用列表
*/
fun getInstalledPackages(context: Context?, flags: Int): List<PackageInfo> {
Utils.log(TAG, "即将获取已安装应用列表")
// Utils.log(TAG, "即将获取已安装应用列表" + Thread.currentThread().getStackTrace().contentToString().replace( ',', '\n' ))
// 用户未同意使用已安装应用列表 API返回空列表
if (!isGetInstalledPackagesApiAgreed()) {
Utils.log(TAG, "用户未同意使用已安装应用列表 API返回空列表")
return installedPackageList
}
// 简单 debounce 过于频繁的获取已安装应用列表调用
if (System.currentTimeMillis() - lastInstalledPackageListTime < 3000 && installedPackageList.isNotEmpty()) {
Utils.log(TAG, "使用了缓存的已安装应用列表")
return installedPackageList
}
var shouldGetNewInstalledPackagedList = false
// 当前设备是否支持限制获取已安装应用列表的功能
if (isSupportGetInstalledAppsPermission(context!!)) {
Utils.log(TAG, "当前设备支持限制获取已安装应用列表的功能")
// 当前设备是否支持禁用了获取已安装应用列表
if (!isGetInstalledListPermissionDisabled(context)) {
Utils.log(TAG, "当前设备没有限制获取已安装应用列表的功能")
shouldGetNewInstalledPackagedList = true
} else {
Utils.log(TAG, "当前设备已限制获取已安装应用列表的功能")
}
} else {
Utils.log(TAG, "当前设备不支持限制获取已安装应用列表的功能")
shouldGetNewInstalledPackagedList = true
}
if (shouldGetNewInstalledPackagedList) {
lastInstalledPackageListTime = System.currentTimeMillis()
installedPackageList = getInstalledPackagesInternal(context, flags)
}
return installedPackageList
}
/**
* 是否支持动态获取已安装应用列表权限
*/
fun isSupportGetInstalledAppsPermission(context: Context): Boolean {
// 若存在缓存,直接返回缓存结果。
if (isGetInstalledListPermissionSupported != UNKNOWN) {
return isGetInstalledListPermissionSupported != UNSUPPORTED
}
try {
// 根据官方提供的方法来判定是否支持限制获取已安装应用列表
val flag =
Settings.Secure.getInt(context.contentResolver, "oem_installed_apps_runtime_permission_enable", 0)
if (flag == 1) {
isGetInstalledListPermissionSupported = SUPPORTED
return true
}
// 部分未升级的手机没有上面配置项,有定义下面危险权限也认为是支持设备软件列表管控
val packageManager = context.packageManager
val permissionInfo = packageManager.getPermissionInfo("com.android.permission.GET_INSTALLED_APPS", 0)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
if (permissionInfo.protection == PermissionInfo.PROTECTION_DANGEROUS) {
isGetInstalledListPermissionSupported = SUPPORTED
return true
} else {
isGetInstalledListPermissionSupported = UNSUPPORTED
return false
}
} else {
isGetInstalledListPermissionSupported = UNSUPPORTED
return false
}
} catch (e: PackageManager.NameNotFoundException) {
isGetInstalledListPermissionSupported = UNSUPPORTED
return false
}
}
/**
* 在5.1系统手机使用PackageManager获取已安装应用容易发生Package manager has died异常
* https://stackoverflow.com/questions/13235793/transactiontoolargeeception-when-trying-tÏo-get-a-list-of-applications-installed/30062632#30062632
*/
private fun getInstalledPackagesInternal(context: Context, flags: Int): List<PackageInfo> {
Utils.log(TAG, "调用系统 API 获取已安装应用列表")
val pm = context.packageManager
try {
return pm.getInstalledPackages(flags)
} catch (ignored: java.lang.Exception) {
//we don't care why it didn't succeed. We'll do it using an alternative way instead
}
// use fallback:
val process: Process
val result: MutableList<PackageInfo> = java.util.ArrayList()
var bufferedReader: BufferedReader? = null
try {
process = Runtime.getRuntime().exec("pm list packages")
bufferedReader = BufferedReader(InputStreamReader(process.inputStream))
var line: String
while ((bufferedReader.readLine().also { line = it }) != null) {
val packageName = line.substring(line.indexOf(':') + 1)
val packageInfo = pm.getPackageInfo(packageName, flags)
result.add(packageInfo)
}
process.waitFor()
} catch (e: java.lang.Exception) {
e.printStackTrace()
if (e is InterruptedException) {
Thread.currentThread().interrupt()
}
} finally {
if (bufferedReader != null) try {
bufferedReader.close()
} catch (e: IOException) {
e.printStackTrace()
}
}
return result
}
}

View File

@ -24,6 +24,7 @@ import com.gh.gamecenter.vpn.VpnHelper
import com.gh.vspace.VHelper
import com.halo.assistant.HaloApp
import com.lightgame.download.DownloadEntity
import com.lightgame.download.FileUtils
import com.lightgame.utils.Utils
import java.io.File

View File

@ -25,10 +25,12 @@ import androidx.webkit.WebViewCompat;
import com.android.apksig.ApkVerifier;
import com.android.apksig.internal.apk.ApkSigningBlockUtilsLite;
import com.g00fy2.versioncompare.Version;
import com.gh.common.filter.RegionSettingHelper;
import com.gh.common.xapk.XapkInstaller;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.PackageFlavorHelper;
import com.gh.gamecenter.common.utils.PermissionHelper;
import com.gh.gamecenter.core.utils.MD5Utils;
import com.gh.gamecenter.core.utils.SentryHelper;
@ -67,8 +69,16 @@ import java.util.zip.ZipFile;
public class PackageUtils {
private static long mLastInstalledPackageListTime = 0L;
private static List<PackageInfo> mInstalledPackageList = null;
public static final String publicKey = "OpenSSLRSAPublicKey{modulus=a8c4bb5748fec8d5c35db1a7a182d41ba4721a91131a417330af79ef4ddb43f9fa0ff4907b0a613bfe152de0ed8fc1b2e6f94a908aa98a5f7adc1ce814ba7ec919d75d9910bdfd8649b4789da6a90ffb61f0d23ac4f828a78fcd0d6f6120c1c43c1f87f7498a89eb40ca8e32dfc2f9d5c10d612b95192870223674e241e53305abf320d7eed76ded398778576e4db7b17b3bc6a792f13de5e43a6a5fae4276c73e6990ce97f68dff0ec16fc9594f175c8d49cd0d7877340d9de60942ca0efc737e50b6c295dfe0713e4532b4e810e1ea11b702b4a27753e41559cbceb247e7f044ec4e3ab2e8bccd8b9fd71286e63307550bcde86deee95adb8133076269135b,publicExponent=10001}";
private static final String TAG = "PackageUtils";
// 设备是否支持禁用获取已安装应用列表。-1 代表支持情况未知0 代表不支持, 1 代表支持
private static int mIsSupportGetInstalledListPermission = -1;
public static String getInstallPackageInfoSourceDir(String packageName) {
try {
return HaloApp.getInstance().getApplication().getPackageManager().getPackageInfo(packageName,
@ -283,13 +293,11 @@ public class PackageUtils {
/*
* 判断是否为光环签名
* 判断是否是插件包
*/
public static boolean isSignedByGh(Context context, String packageName) {
String signature = getApkSignatureByPackageName(context, packageName)[0];
// 判断当前已安装应用是否为光环签名。若签名列表为空,直接判断为光环签名
return signature == null || SignatureRepository.isSignEmpty() || SignatureRepository.isSignMatched(signature);
return publicKey.equals(signature);
}
/*
@ -446,7 +454,7 @@ public class PackageUtils {
}
// 判断当前已安装应用是否为光环签名
if (isSignedByGh(context, packageName)) {
if (publicKey.equals(getApkSignatureByPackageName(context, packageName)[0])) {
return true;
}
@ -670,7 +678,7 @@ public class PackageUtils {
*/
public static ArrayList<String> getAllPackageName(Context context) {
ArrayList<String> list = new ArrayList<>();
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
if (!context.getPackageName().equals(packageInfo.packageName)) {
@ -683,7 +691,7 @@ public class PackageUtils {
public static ArrayList<String> getAllPackageNameIncludeGh(Context context) {
ArrayList<String> list = new ArrayList<>();
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
list.add(packageInfo.packageName);
@ -697,9 +705,11 @@ public class PackageUtils {
*/
public static ArrayList<String> getAllPackageNameIncludeSystemApps(Context context) {
ArrayList<String> list = new ArrayList<>();
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
list.add(packageInfo.packageName);
if (!context.getPackageName().equals(packageInfo.packageName)) {
list.add(packageInfo.packageName);
}
}
return list;
}
@ -708,7 +718,7 @@ public class PackageUtils {
JSONArray jsonArray = new JSONArray();
try {
PackageManager pm = context.getPackageManager();
List<PackageInfo> packageInfos = PackageHelper.INSTANCE.getInstalledPackages(context, 0);
List<PackageInfo> packageInfos = getInstalledPackages(context, 0);
for (PackageInfo packageInfo : packageInfos) {
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
JSONObject jsonObject = new JSONObject();
@ -749,6 +759,7 @@ public class PackageUtils {
}
}
/**
* 启动应用
* 请使用 PackageLauncher.launchApp()
@ -768,6 +779,22 @@ public class PackageUtils {
}
}
/*
* 根据包名,获取软件名称
*/
public static String getNameByPackageName(Context context, String packageName) {
try {
PackageManager pm = context.getApplicationContext().getPackageManager();
ApplicationInfo applicationInfo = pm.getApplicationInfo(
packageName, 0);
return applicationInfo.loadLabel(pm).toString();
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return null;
}
/**
* todo 统一判断
* <p>
@ -862,6 +889,37 @@ public class PackageUtils {
&& !PackageUtils.isSignedByGh(HaloApp.getInstance().getApplication(), apkEntity.getPackageName());
}
/**
* 获取调用者的进程名
*
* @param context 调用者的上下文
* @return 进程名
*/
public static String obtainProcessName(Context context) {
if (PackageFlavorHelper.IS_TEST_FLAVOR) {
try {
final int pid = android.os.Process.myPid();
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> listTaskInfo = am.getRunningAppProcesses();
if (listTaskInfo != null && !listTaskInfo.isEmpty()) {
for (ActivityManager.RunningAppProcessInfo info : listTaskInfo) {
if (info != null && info.pid == pid) {
return info.processName;
}
}
}
} catch (Exception e) {
// 遇到异常了让这次调用正常执行
e.printStackTrace();
return BuildConfig.APPLICATION_ID;
}
} else {
return null;
}
return null;
}
/**
* 应用是否在前台运行
*/
@ -886,8 +944,8 @@ public class PackageUtils {
String packageName = context.getApplicationContext().getPackageName();
for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) {
// The name of the process that this object is associated with.
if (appProcess.processName.equals(packageName)
&& appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
if (appProcess.processName.equals(packageName) && appProcess.importance
== ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
return true;
}
}
@ -898,6 +956,132 @@ public class PackageUtils {
return false;
}
/**
* 弃用已安装列表缓存
*/
public static void dumpInstalledListCache() {
mLastInstalledPackageListTime = 0;
}
public static List<PackageInfo> getInstalledPackages(Context context, int flags) {
Utils.log(TAG, "即将获取已安装应用列表");
// 简单 debounce 掉过于频繁的调用获取已安装列表调用
if (System.currentTimeMillis() - mLastInstalledPackageListTime < 1000
&& mInstalledPackageList != null
&& mInstalledPackageList.size() > 0) {
Utils.log(TAG, "使用了缓存的已安装应用列表");
return new ArrayList<>(mInstalledPackageList);
}
// 是否需要调用系统 API 获取最新的已安装应用列表
boolean shouldGetNewInstalledPackagedList = false;
// 当前设备是否支持限制获取已安装应用列表的功能
if (isSupportGetInstalledAppsPermission(context)) {
Utils.log(TAG, "当前设备支持限制获取已安装应用列表的功能");
// 当前设备是否支持禁用了获取已安装应用列表
if (!PermissionHelper.isGetInstalledListPermissionDisabled(context)) {
Utils.log(TAG, "当前设备没有限制获取已安装应用列表的功能");
shouldGetNewInstalledPackagedList = true;
} else {
Utils.log(TAG, "当前设备已限制获取已安装应用列表的功能");
}
} else {
Utils.log(TAG, "当前设备不支持限制获取已安装应用列表的功能");
shouldGetNewInstalledPackagedList = true;
}
if (shouldGetNewInstalledPackagedList) {
mLastInstalledPackageListTime = System.currentTimeMillis();
mInstalledPackageList = getInstalledPackagesInternal(context, flags);
}
if (mInstalledPackageList == null) {
mInstalledPackageList = new ArrayList<>();
}
return mInstalledPackageList;
}
public static boolean isSupportGetInstalledAppsPermission(Context context) {
// 若存在缓存,直接返回缓存结果。为 0 代表不支持,为 1 代表支持
if (mIsSupportGetInstalledListPermission != -1) {
return mIsSupportGetInstalledListPermission != 0;
}
try {
// 根据官方提供的方法来判定是否支持限制获取已安装应用列表
int flag = Settings.Secure.getInt(context.getContentResolver(), "oem_installed_apps_runtime_permission_enable", 0);
if (flag == 1) {
mIsSupportGetInstalledListPermission = 1;
return true;
}
// 部分未升级的手机没有上面配置项,有定义下面危险权限也认为是支持设备软件列表管控
PackageManager packageManager = context.getPackageManager();
PermissionInfo permissionInfo = packageManager.getPermissionInfo("com.android.permission.GET_INSTALLED_APPS", 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
if (permissionInfo.getProtection() == PermissionInfo.PROTECTION_DANGEROUS) {
mIsSupportGetInstalledListPermission = 1;
return true;
} else {
mIsSupportGetInstalledListPermission = 0;
return false;
}
} else {
mIsSupportGetInstalledListPermission = 0;
return false;
}
} catch (NameNotFoundException e) {
mIsSupportGetInstalledListPermission = 0;
return false;
}
}
/**
* 在5.1系统手机使用PackageManager获取已安装应用容易发生Package manager has died异常
* https://stackoverflow.com/questions/13235793/transactiontoolargeeception-when-trying-tÏo-get-a-list-of-applications-installed/30062632#30062632
*/
private static List<PackageInfo> getInstalledPackagesInternal(Context context, int flags) {
Utils.log(TAG, "调用系统 API 获取已安装应用列表");
final PackageManager pm = context.getPackageManager();
try {
return pm.getInstalledPackages(flags);
} catch (Exception ignored) {
//we don't care why it didn't succeed. We'll do it using an alternative way instead
}
// use fallback:
Process process;
List<PackageInfo> result = new ArrayList<>();
BufferedReader bufferedReader = null;
try {
process = Runtime.getRuntime().exec("pm list packages");
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null) {
final String packageName = line.substring(line.indexOf(':') + 1);
final PackageInfo packageInfo = pm.getPackageInfo(packageName, flags);
result.add(packageInfo);
}
process.waitFor();
} catch (Exception e) {
e.printStackTrace();
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
} finally {
if (bufferedReader != null)
try {
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
public static String getWebviewPath(Context context) {
final PackageInfo webViewPackageInfo = WebViewCompat.getCurrentWebViewPackage(context);
return webViewPackageInfo != null ? webViewPackageInfo.applicationInfo.sourceDir : null;

View File

@ -1,7 +1,7 @@
package com.gh.common.util
import com.gh.common.dialog.DeviceRemindDialog
import com.gh.gamecenter.common.constant.Constants
import com.gh.common.dialog.DeviceRemindDialog
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.TimeUtils
@ -39,7 +39,7 @@ object RecommendPopupHelper {
//判断是否符合安装包大小限制
val minSize = entity.recommendPackage.minSize
val sizeStr = gameEntity.getApk().firstOrNull()?.size ?: continue
val sizeStr = gameEntity.getApk()[0].size ?: continue
val size = sizeStr.substring(0, sizeStr.length - 2).toFloat()
if (size < minSize) continue

View File

@ -1,65 +0,0 @@
package com.gh.common.util
import android.annotation.SuppressLint
import com.gh.gamecenter.common.entity.SignatureEntity
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.core.utils.MD5Utils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.retrofit.RetrofitManager
/**
* 存储光环网游使用的签名
*/
object SignatureRepository {
private const val SP_SIGN_DIGEST_LIST = "sign_digest_list"
private var signDigestList: ArrayList<String>? = null
@SuppressLint("CheckResult")
fun init() {
RetrofitManager.getInstance()
.newApi
.ghSignature
.compose(singleToMain())
.subscribe(object : BiResponse<ArrayList<SignatureEntity>>() {
override fun onSuccess(data: ArrayList<SignatureEntity>) {
signDigestList = ArrayList()
for (i in data) {
signDigestList?.add(i.signMd5)
}
SPUtils.setString(SP_SIGN_DIGEST_LIST, signDigestList?.toJson() ?: "")
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
signDigestList = SPUtils.getString(SP_SIGN_DIGEST_LIST).toObject()
}
})
}
/**
* 签名列表是否为空
*/
@JvmStatic
fun isSignEmpty(): Boolean {
return signDigestList.isNullOrEmpty()
}
/**
* 签名是否匹配已知的签名
*/
@JvmStatic
fun isSignMatched(sign: String): Boolean {
val signDigest = MD5Utils.getContentMD5(sign)
return signDigestList?.contains(signDigest) == true
}
}

View File

@ -0,0 +1,94 @@
package com.gh.common.util;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.collection.ArrayMap;
import com.gh.gamecenter.entity.TagEntity;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import retrofit2.HttpException;
public class TagUtils {
private static TagUtils mInstance;
private Context context;
private ArrayMap<String, String> colorMap;
private boolean isUpdate = false;
private TagUtils(Context con) {
this.context = con.getApplicationContext();
initTag();
}
public static TagUtils getInstance(Context context) {
if (mInstance == null) {
mInstance = new TagUtils(context);
}
return mInstance;
}
private void initTag() {
colorMap = new ArrayMap<>();
SharedPreferences sharedPreferences = context.getSharedPreferences("gh_tag", Context.MODE_PRIVATE);
Set<String> set = sharedPreferences.getStringSet("tag", null);
if (set == null) {
getTag();
} else {
for (String str : set) {
String[] platform = str.split("=");
colorMap.put(platform[0], platform[1]);
}
}
}
public String getColor(String tag) {
String color = colorMap.get(tag);
if (color == null) {
getTag();
}
return color;
}
public void getTag() {
if (isUpdate) {
return;
}
isUpdate = true;
RetrofitManager.getInstance().getApi().getTags()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<TagEntity>>() {
@Override
public void onResponse(List<TagEntity> response) {
Set<String> tagSet = new HashSet<>();
for (TagEntity tagEntity : response) {
tagSet.add(tagEntity.getName() + "=" + tagEntity.getColor());
}
SharedPreferences sp = context.getSharedPreferences("gh_tag", Context.MODE_PRIVATE);
sp.edit().putStringSet("tag", tagSet).apply();
initTag();
isUpdate = false;
}
@Override
public void onFailure(HttpException e) {
isUpdate = false;
}
});
}
}

View File

@ -0,0 +1,248 @@
package com.gh.common.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import androidx.annotation.StringRes;
import androidx.core.content.ContextCompat;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.R;
public class DownloadProgressBar extends ProgressBar {
public static final int MAX_LENGTH = 1000;
public static final int DOWNLOAD_NORMAL_STYLE = 0;
public static final int DOWNLOAD_IMAGE_STYLE = 2;
public enum DownloadType {
NORMAL,
NONE,
NONE_WITH_HINT,
PLUGIN,
LAUNCH_OR_OPEN,
INSTALL_NORMAL,
INSTALL_PLUGIN,
DOWNLOADING_NORMAL,
DOWNLOADING_PLUGIN,
RESERVABLE,
RESERVED,
H5_GAME,
UPDATING,
TEENAGER_MODEL,
SPECIAL_DOWNLOAD,
XAPK_UNZIPPING,
XAPK_SUCCESS,
XAPK_FAILURE,
}
private PorterDuffXfermode mDuffXFerMode = new PorterDuffXfermode(PorterDuff.Mode.SRC_IN);
private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
// 仅用于测量文字是否超出范围,不用于画文字
private TextPaint mFakeTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
private DownloadType mDownloadType;
private String mText;
private int mDownloadStyle;
private int mDefaultColor;
private int mTextSize;
private boolean mShowDownloadPercent = false;
private Rect mTextBound = new Rect();
public DownloadProgressBar(Context context) {
super(context);
}
public DownloadProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs != null) {
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.DownloadProgressBar);
mDownloadStyle = ta.getInteger(R.styleable.DownloadProgressBar_downloadStyle, DOWNLOAD_NORMAL_STYLE);
mTextSize = ta.getDimensionPixelSize(R.styleable.DownloadProgressBar_textSize, DisplayUtils.sp2px(getContext(), 14));
mShowDownloadPercent = ta.getBoolean(R.styleable.DownloadProgressBar_showDownloadPercent, false);
ta.recycle();
}
setMax(MAX_LENGTH);
setProgressDrawable(getResources().getDrawable(R.drawable.game_item_btn_download_style));
}
Bitmap srcBitmap;
Canvas srcCanvas;
RectF rectF;
private void create() {
srcBitmap = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(), Bitmap.Config.ARGB_8888);
srcCanvas = new Canvas(srcBitmap);
rectF = new RectF(0, 0, getProgress() * getWidth() / MAX_LENGTH, getMeasuredHeight());
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (TextUtils.isEmpty(mText)) return;
mPaint.setColor(mDefaultColor == 0 ? ContextCompat.getColor(getContext(), R.color.text_theme) : mDefaultColor); // 初始化颜色
mPaint.setTextSize(mTextSize);
mFakeTextPaint.setTextSize(mTextSize);
mFakeTextPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mFakeTextPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setXfermode(null);
create();
Paint.FontMetricsInt fontMetrics = mPaint.getFontMetricsInt();
int baseline = (getHeight() - fontMetrics.bottom - fontMetrics.top) / 2;
mPaint.setTextAlign(Paint.Align.CENTER);
canvas.getClipBounds(mTextBound); //The dimensions of your canvas
int width = mTextBound.width() - 20; //10 to keep some space on the right for the "..."
String txt = TextUtils.ellipsize(mText, mFakeTextPaint, width, TextUtils.TruncateAt.END).toString();
srcCanvas.drawText(txt, getWidth() / 2, baseline, mPaint);
mPaint.setXfermode(mDuffXFerMode);
if (getProgress() != 0) {
int color = Color.WHITE;
if (DOWNLOAD_IMAGE_STYLE == mDownloadStyle) {
color = Color.BLACK;
}
mPaint.setColor(color); // 反向颜色
}
srcCanvas.drawRect(rectF, mPaint);
canvas.drawBitmap(srcBitmap, 0, 0, null);
}
public void setText(String text) {
mText = text;
invalidate();
}
public String getText() {
if (mText != null && mText.contains("%")) {
return getResources().getString(R.string.downloading);
}
return mText;
}
public void setText(@StringRes int res) {
if (mShowDownloadPercent && res == R.string.downloading) {
setText(getProgressPercent());
} else {
setText(getResources().getString(res));
}
}
public void setDownloadStyle(int downloadStyle) {
this.mDownloadStyle = downloadStyle;
}
@Override
public synchronized void setProgress(int progress) {
super.setProgress(progress);
if (getResources().getString(R.string.downloading).equals(mText)) {
setText(getProgressPercent());
}
}
private String getProgressPercent() {
return getProgress() / 10 + "%";
}
public void setDownloadType(DownloadType downloadType) {
switch (downloadType) {
case NORMAL:
case NONE_WITH_HINT:
case INSTALL_NORMAL:
case H5_GAME:
if (mDownloadStyle == DOWNLOAD_IMAGE_STYLE) {
setProgressDrawable(getResources().getDrawable(R.drawable.text_white_background));
mDefaultColor = Color.BLACK;
} else {
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
mDefaultColor = Color.WHITE;
}
setProgress(0);
break;
case PLUGIN:
case INSTALL_PLUGIN:
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_pluggable_style));
mDefaultColor = Color.WHITE;
setProgress(0);
break;
case NONE:
setProgressDrawable(getResources().getDrawable(R.drawable.button_round_gray_light));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.text_tertiary);
setProgress(0);
break;
case LAUNCH_OR_OPEN:
if (mDownloadStyle == DOWNLOAD_IMAGE_STYLE) {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_open_image_style));
mDefaultColor = Color.WHITE;
} else {
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
mDefaultColor = Color.WHITE;
}
setProgress(0);
break;
case DOWNLOADING_NORMAL:
if (mDownloadStyle == DOWNLOAD_IMAGE_STYLE) {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_image_style));
mDefaultColor = Color.WHITE;
} else {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.text_theme);
}
break;
case DOWNLOADING_PLUGIN:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.text_theme);
break;
case RESERVABLE:
setProgressDrawable(getResources().getDrawable(R.drawable.button_reserve));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.white);
break;
case UPDATING:
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_updating_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.white);
break;
case RESERVED:
setProgressDrawable(getResources().getDrawable(R.drawable.button_round_gray_light));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.text_tertiary);
break;
case XAPK_FAILURE:
case XAPK_SUCCESS:
case XAPK_UNZIPPING:
setProgressDrawable(getResources().getDrawable(R.drawable.progressbar_xapk_detail_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.white);
break;
case TEENAGER_MODEL:
case SPECIAL_DOWNLOAD:
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.white);
break;
}
mDownloadType = downloadType;
}
public DownloadType getDownloadType() {
return mDownloadType;
}
}

View File

@ -8,19 +8,19 @@ import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import com.facebook.drawee.drawable.ScalingUtils
import com.facebook.drawee.view.SimpleDraweeView
import com.gh.common.util.DirectUtils
import com.gh.common.util.*
import com.gh.gamecenter.ImageViewerActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.debounceActionWithInterval
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.core.utils.TopCutProcess
import com.gh.gamecenter.databinding.ItemCommunityImageBinding
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.feature.entity.AnswerEntity
import com.gh.gamecenter.feature.entity.CommunityVideoEntity
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel
class ImageContainerView : LinearLayout {
@ -159,10 +159,10 @@ class ImageContainerView : LinearLayout {
binding.root.setOnClickListener {
debounceActionWithInterval(it.id, 1000) {
if (mAnswerEntity == null) return@debounceActionWithInterval
val videoEntity = mAnswerEntity!!.getPassVideos().firstOrNull()
val videoEntity = mAnswerEntity!!.getPassVideos()[0]
DirectUtils.directToVideoDetail(
context,
videoEntity?.id ?: "",
videoEntity.id,
VideoDetailContainerViewModel.Location.VIDEO_HOT.value,
showComment = false,
entrance = mEntrance,

View File

@ -4,12 +4,8 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Environment
import android.provider.Settings
import androidx.appcompat.app.AppCompatActivity
import com.gh.common.constant.Config
import com.gh.common.dialog.ManagerAllFilesPermissionDialogFragment
import com.gh.common.util.*
import com.gh.common.util.DirectUtils
import com.gh.common.util.DownloadNotificationHelper
import com.gh.common.util.PackageInstaller
@ -19,7 +15,6 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.core.utils.SentryHelper
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.xapk.XApkUnZipper
@ -27,7 +22,10 @@ import com.gh.gamecenter.xapk.core.XApkFile
import com.gh.gamecenter.xapk.core.XApkUnZipCallback
import com.gh.gamecenter.xapk.core.XApkUnZipEntry
import com.gh.gamecenter.xapk.core.XApkUnZipOutputFactory
import com.gh.gamecenter.xapk.io.*
import com.gh.gamecenter.xapk.io.NonSplitApksOutput
import com.gh.gamecenter.xapk.io.OBBFileOutput
import com.gh.gamecenter.xapk.io.SplitApksOutput
import com.gh.gamecenter.xapk.io.XApkFileOutput
import com.gh.gamecenter.xapk.pi.IPackageInstaller
import com.gh.ndownload.NDataChanger
import com.halo.assistant.HaloApp
@ -114,36 +112,17 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
return
}
if (checkPermission(downloadEntity, showUnzipToast)) {
DownloadManager.getInstance().getDownloadEntitySnapshot(downloadEntity.url, downloadEntity.gameId)
?.let {
unzipXapkFile(it)
if (showUnzipToast) {
Utils.toast(mContext, "解压过程请勿退出光环助手!")
}
}
}
} else {
throwExceptionInDebug("如果是Apk包请使用PackageInstaller进行安装")
PackageInstaller.install(mContext, downloadEntity)
}
}
private fun checkPermission(downloadEntity: DownloadEntity, showUnzipToast: Boolean = false): Boolean {
// 安卓11以上系统需要开启所有文件访问权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
&& !Environment.isExternalStorageManager()) {
CurrentActivityHolder.getCurrentActivity()?.let {
ManagerAllFilesPermissionDialogFragment.show(it as AppCompatActivity) {
unzipXapkFile(downloadEntity)
DownloadManager.getInstance().getDownloadEntitySnapshot(downloadEntity.url, downloadEntity.gameId)
?.let {
unzipXapkFile(it)
if (showUnzipToast) {
Utils.toast(mContext, "解压过程请勿退出光环助手!")
}
}
}
return false
} else {
throwExceptionInDebug("如果是Apk包请使用PackageInstaller进行安装")
PackageInstaller.install(mContext, downloadEntity)
}
return true
}
private fun unzipXapkFile(downloadEntity: DownloadEntity) {

View File

@ -2,11 +2,15 @@ package com.gh.common.xapk
import android.os.Build
import android.os.Environment
import com.gh.gamecenter.common.utils.debounceActionWithInterval
import com.gh.gamecenter.common.utils.getExtension
import com.gh.gamecenter.common.utils.throwException
import com.gh.gamecenter.common.utils.throwExceptionInDebug
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.MD5Utils
import com.halo.assistant.HaloApp
import com.lightgame.download.DownloadEntity
import com.lightgame.download.FileUtils
import com.lightgame.utils.Utils
import net.lingala.zip4j.progress.ProgressMonitor
import java.io.File

View File

@ -25,44 +25,36 @@ import com.gh.gamecenter.feature.entity.CustomPageTrackData;
import com.gh.gamecenter.feature.entity.TagStyleEntity;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.common.exposure.ExposureUtils;
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
import com.gh.common.history.HistoryHelper;
import com.gh.common.simulator.SimulatorGameManager;
import com.gh.common.util.DataCollectionUtils;
import com.gh.gamecenter.common.utils.DeviceUtils;
import com.gh.common.util.DialogUtils;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.common.util.HomePluggableHelper;
import com.gh.common.util.LunchType;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.common.base.GlobalActivityManager;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.common.utils.DeviceUtils;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.FileUtils;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.AppExecutor;
import com.gh.gamecenter.core.utils.AppDebugConfig;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.core.utils.SentryHelper;
import com.gh.gamecenter.download.DownloadedGameIdAndPackageNameDao;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.entity.HomePluggableFilterEntity;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.feature.entity.ApkEntity;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.entity.HomePluggableFilterEntity;
import com.gh.gamecenter.feature.entity.PluginLocation;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.packagehelper.PackageRepository;
import com.gh.vspace.VHelper;
import com.gh.ndownload.NDataChanger;
import com.gh.ndownload.NDownloadBridge;
import com.gh.ndownload.NDownloadService;
import com.gh.vspace.VHelper;
import com.halo.assistant.HaloApp;
import com.lightgame.download.ConnectionUtils;
import com.lightgame.download.DataWatcher;
@ -71,6 +63,7 @@ import com.lightgame.download.DownloadDao;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
import com.lightgame.download.DownloadStatusListener;
import com.lightgame.download.FileUtils;
import com.lightgame.download.HttpDnsManager;
import com.lightgame.utils.Utils;
@ -256,9 +249,7 @@ public class DownloadManager implements DownloadStatusListener {
String location,
boolean isSubscribe,
@Nullable ExposureEvent traceEvent) {
if (!gameEntity.getApk().isEmpty()) {
createDownload(context, gameEntity.getApk().get(0), gameEntity, asVGame, gameEntity.isDualBtnModeEnabled(), entrance, location, isSubscribe, traceEvent);
}
createDownload(context, gameEntity.getApk().get(0), gameEntity, asVGame, gameEntity.isDualBtnModeEnabled(), entrance, location, isSubscribe, traceEvent);
}
/**

View File

@ -3,9 +3,7 @@ package com.gh.download
import android.annotation.SuppressLint
import android.text.TextUtils
import com.gh.common.util.*
import com.gh.common.util.DataCollectionUtils
import com.gh.common.util.PackageInstaller
import com.gh.common.util.PackageUtils
import com.gh.gamecenter.feature.utils.ConcernUtils
import com.gh.common.xapk.XapkInstaller
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.common.constant.Constants
@ -20,7 +18,6 @@ import com.gh.gamecenter.core.utils.ThirdPartyPackageHelper
import com.gh.gamecenter.core.utils.UrlFilterUtils
import com.gh.gamecenter.entity.GameDigestEntity
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.feature.utils.ConcernUtils
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.manager.PackagesManager
import com.gh.gamecenter.packagehelper.PackageRepository

View File

@ -27,13 +27,21 @@ object ExoCacheManager {
if (NetworkUtils.isWifiConnected(HaloApp.getInstance().application)) {
10 * 1024 * 1024L
} else {
10 * 1024 * 1024L
when (NetworkUtils.getMobileNetworkType(HaloApp.getInstance().application)) {
"5G", "4G" -> 10 * 1024 * 1024L
"3G" -> 5 * 1024 * 1024L
else -> 0L
}
}
} else {
if (NetworkUtils.isWifiConnected(HaloApp.getInstance().application)) {
50 * 1024 * 1024L
} else {
20 * 1024 * 1024L
when (NetworkUtils.getMobileNetworkType(HaloApp.getInstance().application)) {
"5G", "4G" -> 20 * 1024 * 1024L
"3G" -> 5 * 1024 * 1024L
else -> 0L
}
}
}
}

View File

@ -113,16 +113,16 @@ class DownloadDialogAdapter(
holder.binding.run {
links?.let {
leftLink.setOnClickListener { view ->
it.firstOrNull()?.let { link -> clickListener.onClick(view, link) }
clickListener.onClick(view, links[0])
}
rightLink.setOnClickListener { view ->
it.getOrNull(1)?.let { link -> clickListener.onClick(view, link) }
clickListener.onClick(view, links[1])
}
}
leftLink.visibleIf(!links.isNullOrEmpty())
rightLink.visibleIf((links?.size ?: 0) > 1)
leftLink.text = links?.firstOrNull()?.title ?: ""
rightLink.text = links?.getOrNull(1)?.title ?: ""
rightLink.visibleIf(links?.size ?: 0 > 1)
leftLink.text = if (links.isNullOrEmpty()) "" else links[0].title
rightLink.text = if (links?.size ?: 0 > 1) links?.get(1)?.title else ""
leftLink.background = GradientDrawable().apply {
cornerRadius = 8F.dip2px().toFloat()
setStroke(0.5F.dip2px(), R.color.ui_divider.toColor(mContext))

View File

@ -28,6 +28,7 @@ import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.manager.PackagesManager
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import com.lightgame.download.FileUtils
import com.lightgame.utils.AppManager
import com.lightgame.utils.Utils

View File

@ -28,10 +28,10 @@ import org.json.JSONObject
import java.io.File
import java.net.URLEncoder
import java.util.*
import kotlin.collections.ArrayList
object BrowserInstallHelper {
// 随便选的 32321 居然在部分 vivo 手机上被占用,喷了
private const val PORT = 40705
private const val RESERVE_PORT = 40706
@ -40,12 +40,15 @@ object BrowserInstallHelper {
private val mContext by lazy { HaloApp.getInstance().application }
private var mUseReservePort = false
private var mValidInstalledPackageList: ArrayList<String> = arrayListOf()
private var mValidConditionMatchedCache: Boolean? = null
private val mAllInstalledPackageList: ArrayList<String> by lazy {
PackageUtils.getAllPackageNameIncludeSystemApps(HaloApp.getInstance().applicationContext).apply {
add(HaloApp.getInstance().applicationContext.packageName)
}
}
private fun getServer(port: Int): DownloadServer {
val server = DownloadServer(port)
for (packageName in getAllInstalledPackageList()) {
for (packageName in mAllInstalledPackageList) {
if (packageName.contains("com.freeme") || packageName.contains("com.zhuoyi")) {
server.isBuggyDevice = true
break
@ -54,23 +57,6 @@ object BrowserInstallHelper {
return server
}
private fun getAllInstalledPackageList(): ArrayList<String> {
when {
mValidInstalledPackageList.isNotEmpty() -> {
return mValidInstalledPackageList
}
else -> {
val allInstalledPackageList = PackageUtils.getAllPackageNameIncludeSystemApps(mContext)
if (allInstalledPackageList.isNotEmpty()) {
mValidInstalledPackageList = allInstalledPackageList
}
return mValidInstalledPackageList
}
}
}
fun downloadFile(filePath: String) {
if (!::mServer.isInitialized) mServer = if (mUseReservePort) getServer(RESERVE_PORT) else getServer(PORT)
if (!mServer.isAlive && !startServer()) {
@ -94,7 +80,7 @@ object BrowserInstallHelper {
Base64.encodeToString(URLEncoder.encode(downloadUrl).trim().toByteArray(), Base64.NO_WRAP)
DirectUtils.directToExternalBrowser(
mContext,
"https://down-and.ghzs6.com/redirect?location=base64($encodedString)"
"https://down-and.ghzs.com/redirect?location=base64($encodedString)"
)
} else {
DirectUtils.directToExternalBrowser(mContext, downloadUrl)
@ -251,43 +237,32 @@ object BrowserInstallHelper {
* 是否满足开启浏览器安装的条件
*/
private fun isConditionMatched(settingsEntity: NewSettingsEntity): Boolean {
if (mValidConditionMatchedCache != null) {
return mValidConditionMatchedCache!!
}
val packageList = getAllInstalledPackageList()
if (packageList.isEmpty()) return false
settingsEntity.installModel?.whiteList?.let {
for (packageName in it) {
if (packageList.contains(packageName)) {
mValidConditionMatchedCache = false
break
if (mAllInstalledPackageList.contains(packageName)) {
return false
}
}
}
settingsEntity.installModel?.packages?.let {
for (packageName in it) {
if (packageList.contains(packageName)) {
mValidConditionMatchedCache = true
break
if (mAllInstalledPackageList.contains(packageName)) {
return true
}
}
}
// 匹配部分字符串即可
settingsEntity.installModel?.regexPackages?.let {
for (packageNamePieces in it) {
for (installedPackageName in packageList) {
for (installedPackageName in mAllInstalledPackageList) {
if (installedPackageName.contains(packageNamePieces)) {
mValidConditionMatchedCache = true
break
return true
}
}
}
}
return mValidConditionMatchedCache ?: false
return false
}
fun onApkInstalled(path: String?) {

View File

@ -1,12 +1,12 @@
package com.gh.download.server
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.FileUtils
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.common.utils.getMetaExtra
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.download.DownloadManager
import com.halo.assistant.HaloApp
import com.lightgame.download.FileUtils
import fi.iki.elonen.NanoHTTPD
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers

View File

@ -4,7 +4,7 @@ import com.lg.download.*
import com.lg.ndownload.DownloadConfig
import com.lg.ndownload.DownloadDbManager
import com.lg.ndownload.DownloadQueue
import com.gh.gamecenter.common.utils.FileUtils
import com.lightgame.download.FileUtils
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors

View File

@ -46,7 +46,7 @@ import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.ImageUtils.getIdealImageUrl
import com.gh.gamecenter.common.utils.ImageUtils.getTransformedUrl
import com.gh.gamecenter.common.view.DraggableBigImageView
import com.gh.gamecenter.common.view.Gh_RelativeLayout
import com.gh.gamecenter.core.runOnIoThread
@ -831,7 +831,7 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
&& !NetworkUtils.isWifiOr4GConnected(this@ImageViewerActivity)
&& !thumbnailImageUrl.contains(".gif")
) {
compressedStandardImageUrl = getIdealImageUrl(thumbnailImageUrl, mLimitWidth)
compressedStandardImageUrl = getTransformedUrl(thumbnailImageUrl, mLimitWidth)
thumbnailImageUrl = compressedStandardImageUrl ?: ""
}
val finalUrl = compressedStandardImageUrl

View File

@ -70,7 +70,6 @@ import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
import com.gh.gamecenter.common.constant.CommonConsts;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.entity.SuggestType;
import com.gh.gamecenter.common.eventbus.EBNetworkState;
import com.gh.gamecenter.common.eventbus.EBReuse;
@ -79,7 +78,6 @@ import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.FileUtils;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.common.utils.ShareUtils;
@ -98,6 +96,7 @@ import com.gh.gamecenter.feature.utils.PlatformUtils;
import com.gh.gamecenter.home.custom.model.CustomPageShareRepository;
import com.gh.gamecenter.home.skip.PackageSkipActivity;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.login.utils.QuickLoginHelper;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.packagehelper.PackageViewModel;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -113,6 +112,7 @@ import com.google.gson.reflect.TypeToken;
import com.halo.assistant.HaloApp;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Utils;
import com.sina.weibo.sdk.auth.AuthInfo;
import com.sina.weibo.sdk.openapi.IWBAPI;
@ -171,8 +171,6 @@ public class MainActivity extends BaseActivity {
mMainWrapperViewModel = new ViewModelProvider(this, new MainWrapperViewModel.Factory(HaloApp.getInstance()))
.get(MainWrapperViewModel.class);
DisplayUtils.updateGlobalScreen(this);
super.onCreate(savedInstanceState);
setStatusBarColor(Color.TRANSPARENT);
@ -318,7 +316,8 @@ public class MainActivity extends BaseActivity {
mMainWrapperViewModel.requestAllDialogData();
// QuickLoginHelper.getPhoneInfo();
// TODO 去掉一键登录?
QuickLoginHelper.getPhoneInfo();
// TODO 搞清楚为什么这里要获取微信相关配置
WechatBindHelper.getWechatConfig(null);
@ -538,21 +537,6 @@ public class MainActivity extends BaseActivity {
if (COUNTDOWN_MAX_COUNT < mCountdownCount) {
AdDelegateHelper.INSTANCE.setShowingSplashAd(false);
hideSplashAd();
if (msg.obj instanceof StartupAdEntity) {
StartupAdEntity ad = (StartupAdEntity) msg.obj;
LinkEntity linkEntity = ad.getJump();
SensorsBridge.trackEvent(
"SplashAdOwnSkip",
"splash_ad_id",
ad.getId(),
"link_type",
linkEntity.getType(),
"link_id",
linkEntity.getLink(),
"link_text",
linkEntity.getText());
}
} else {
TextView jumpBtn = findViewById(R.id.jumpBtn);
jumpBtn.setText(String.format(Locale.CHINA, "跳过 %d", COUNTDOWN_MAX_COUNT - mCountdownCount));
@ -695,18 +679,15 @@ public class MainActivity extends BaseActivity {
try {
GameEntity gameEntity = GsonUtils.getGson().fromJson(json, new TypeToken<GameEntity>() {
}.getType());
if (gameEntity != null) {
String apkUrl = gameEntity.getApk().isEmpty() ? "" : gameEntity.getApk().get(0).getUrl();
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apkUrl);
if (downloadEntity != null) {
File file = new File(downloadEntity.getPath());
if (!file.exists()) {
ToastUtils.showToast("文件已被删除,无法启动");
return;
}
SimulatorGameManager.launchSimulatorGame(downloadEntity, gameEntity);
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().get(0).getUrl());
if (downloadEntity != null) {
File file = new File(downloadEntity.getPath());
if (!file.exists()) {
ToastUtils.showToast("文件已被删除,无法启动");
return;
}
SimulatorGameManager.launchSimulatorGame(downloadEntity, gameEntity);
}
} catch (JsonSyntaxException exception) {
exception.printStackTrace();

View File

@ -111,7 +111,7 @@ public class ShareCardActivity extends ToolBarActivity {
String qrBody;
if (!TextUtils.isEmpty(newsId)) {
qrBody = "https://www.ghzs666.com/article/" + newsId + ".html?source=appshare200";
qrBody = "http://www.ghzs666.com/article/" + newsId + ".html?source=appshare200";
} else {
qrBody = "https://www.ghzs.com/?source=appshare200";
}

View File

@ -166,7 +166,7 @@ public class ShareCardPicActivity extends ToolBarActivity {
String qrBody;
if (!TextUtils.isEmpty(newsId)) {
qrBody = "https://www.ghzs666.com/article/" + newsId + ".html?source=appshare200";
qrBody = "http://www.ghzs666.com/article/" + newsId + ".html?source=appshare200";
} else {
qrBody = "https://www.ghzs.com/?source=appshare200";
}

View File

@ -1,7 +1,6 @@
package com.gh.gamecenter;
import static com.gh.gamecenter.common.constant.EntranceConsts.ENTRANCE_BROWSER;
import static com.gh.gamecenter.common.constant.EntranceConsts.ENTRANCE_PUSH;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_ANSWER;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_ARTICLE;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_CATEGORY;
@ -130,10 +129,6 @@ public class SkipActivity extends BaseActivity {
String qaId = uri.getQueryParameter("qa_id");
String qaContentId = uri.getQueryParameter(EntranceConsts.KEY_QA_CONTENT_ID);
String qaTitle = uri.getQueryParameter(EntranceConsts.KEY_QA_TITLE);
String isFromPushString = uri.getQueryParameter(EntranceConsts.KEY_IS_FROM_PUSH);
boolean isFromPush = !TextUtils.isEmpty(isFromPushString) && isFromPushString.equals("true");
String entrance = isFromPush ? ENTRANCE_PUSH : ENTRANCE_BROWSER;
String pathName = isFromPush ? ENTRANCE_PUSH : "浏览器";
if (host != null) {
Intent intent;
@ -146,40 +141,40 @@ public class SkipActivity extends BaseActivity {
createShortcut(uri);
return;
case HOST_ARTICLE:
DirectUtils.directToArticle(this, path, entrance);
DirectUtils.directToArticle(this, path, ENTRANCE_BROWSER);
break;
case HOST_GAME:
DirectUtils.directToGameDetail(this, path, "", entrance, "true".equals(uri.getQueryParameter("auto_download")), to, null);
DirectUtils.directToGameDetail(this, path, "", ENTRANCE_BROWSER, "true".equals(uri.getQueryParameter("auto_download")), to, null);
break;
case HOST_COLUMN:
DirectUtils.directToSubject(this, path, uri.getQueryParameter(KEY_NAME), entrance, null, false);
DirectUtils.directToSubject(this, path, uri.getQueryParameter(KEY_NAME), ENTRANCE_BROWSER, null, false);
break;
case HOST_SUGGESTION:
if (!TextUtils.isEmpty(qaId)) {
DirectUtils.directToQa(this, qaTitle, qaId);
} else {
// 插件反馈跳转到意见反馈分类页
DirectUtils.directToFeedback(this, content, isQaFeedback, qaContentId, true, false, entrance);
DirectUtils.directToFeedback(this, content, isQaFeedback, qaContentId, true, false, EntranceConsts.ENTRANCE_BROWSER);
}
break;
case HOST_DOWNLOAD:
DirectUtils.directToDownloadManagerAndStartUpdate(this, path, uri.getQueryParameter(KEY_PACKAGENAME), entrance);
DirectUtils.directToDownloadManagerAndStartUpdate(this, path, uri.getQueryParameter(KEY_PACKAGENAME), ENTRANCE_BROWSER);
break;
case HOST_ANSWER:
DirectUtils.directToAnswerDetail(this, path, entrance, pathName);
DirectUtils.directToAnswerDetail(this, path, ENTRANCE_BROWSER, "浏览器");
break;
case HOST_QUESTION:
DirectUtils.directToQuestionDetail(this, path, entrance, pathName, "");
DirectUtils.directToQuestionDetail(this, path, ENTRANCE_BROWSER, "浏览器", "");
break;
case HOST_TOOLBOX:
DirectUtils.directToToolbox(this, uri.getQueryParameter("gameId"), uri.getQueryParameter("toolboxUrl"), entrance);
DirectUtils.directToToolbox(this, uri.getQueryParameter("gameId"), uri.getQueryParameter("toolboxUrl"), ENTRANCE_BROWSER);
break;
case HOST_COMMUNITY:
DirectUtils.directToHomeCommunityTab(this);
break;
// 社区文章格式一
case "community.article":
DirectUtils.directToCommunityArticle(this, uri.getQueryParameter("articleId"), uri.getQueryParameter("communityId"), entrance, pathName, "");
DirectUtils.directToCommunityArticle(this, uri.getQueryParameter("articleId"), uri.getQueryParameter("communityId"), ENTRANCE_BROWSER, "浏览器", "");
break;
// 社区文章格式二
case "communities":
@ -200,13 +195,13 @@ public class SkipActivity extends BaseActivity {
}
}
if ("articles".equals(type)) {
DirectUtils.directToCommunityArticle(this, typeId, communityId, entrance, pathName, "");
DirectUtils.directToCommunityArticle(this, typeId, communityId, ENTRANCE_BROWSER, "浏览器", "");
break;
}
break;
case HOST_VIDEO:
DirectUtils.directToVideoDetail(this, path, VideoDetailContainerViewModel.Location.HOTTEST_GAME_VIDEO.getValue(),
false, id, entrance, pathName, TextUtils.isEmpty(referer) ? "" : referer, "");
false, id, ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer, "");
break;
case HOST_UPLOAD_VIDEO://跳转上传视频
String titleParameter = uri.getQueryParameter("title");
@ -220,13 +215,13 @@ public class SkipActivity extends BaseActivity {
VideoLinkEntity linkEntity = new VideoLinkEntity(title, categoryId, link, tagActivityId, tagActivityName);
SimpleGameEntity simpleGameEntity = new SimpleGameEntity(gameId != null ? gameId : "", gameName != null ? gameName : "", "", "");
Bundle nextToBundle = VideoManagerActivity.getVideoManagerBundle(linkEntity, simpleGameEntity, entrance, "");
CheckLoginUtils.checkLogin(this, nextToBundle, true, entrance, () ->
DirectUtils.directToVideoManager(SkipActivity.this, linkEntity, simpleGameEntity, entrance, pathName));
Bundle nextToBundle = VideoManagerActivity.getVideoManagerBundle(linkEntity, simpleGameEntity, EntranceConsts.ENTRANCE_BROWSER, "");
CheckLoginUtils.checkLogin(this, nextToBundle, true, EntranceConsts.ENTRANCE_BROWSER, () ->
DirectUtils.directToVideoManager(SkipActivity.this, linkEntity, simpleGameEntity, EntranceConsts.ENTRANCE_BROWSER, "浏览器"));
break;
case HOST_VIDEO_SINGLE:
DirectUtils.directToVideoDetail(this, path, VideoDetailContainerViewModel.Location.SINGLE_VIDEO.getValue(),
false, "", entrance, pathName, TextUtils.isEmpty(referer) ? "" : referer, "");
false, "", ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer, "");
break;
case HOST_VIDEO_MORE:
gameId = uri.getQueryParameter("gameId");
@ -243,7 +238,7 @@ public class SkipActivity extends BaseActivity {
location = path;
}
DirectUtils.directToLegacyVideoDetail(this, path, location,
false, TextUtils.isEmpty(gameId) ? "" : gameId, entrance, pathName, TextUtils.isEmpty(referer) ? "" : referer,
false, TextUtils.isEmpty(gameId) ? "" : gameId, ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer,
TextUtils.isEmpty(type) ? "" : type, TextUtils.isEmpty(act) ? "" : act, TextUtils.isEmpty(paginationType) ? "page" : paginationType, TextUtils.isEmpty(fieldId) ? "" : fieldId,
TextUtils.isEmpty(sectionName) ? "" : sectionName, false, "");
break;
@ -251,10 +246,10 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directToHomeVideoTab(this);
break;
case HOST_VIDEO_STREAMING_DESC:
DirectUtils.directToGameDetailVideoStreaming(this, path, entrance);
DirectUtils.directToGameDetailVideoStreaming(this, path, ENTRANCE_BROWSER);
break;
case HOST_VIDEO_COLLECTION:
DirectUtils.directToGameVideo(this, path, entrance, pathName);
DirectUtils.directToGameVideo(this, path, ENTRANCE_BROWSER, "浏览器");
break;
case HOST_QQ:
bundle = new Bundle();
@ -283,32 +278,32 @@ public class SkipActivity extends BaseActivity {
EntranceUtils.jumpActivityCompat(this, bundle);
break;
case EntranceConsts.HOST_VIDEO_DETAIL:
DirectUtils.directToVideoDetail(this, path, entrance, "", "");
DirectUtils.directToVideoDetail(this, path, ENTRANCE_BROWSER, "", "");
break;
case HOST_LIBAO:
DirectUtils.directToGiftDetail(this, path, entrance);
DirectUtils.directToGiftDetail(this, path, ENTRANCE_BROWSER);
break;
case HOST_USERHOME:
String position = uri.getQueryParameter("position");
String subTypeString = uri.getQueryParameter("sub_type");
String subGameType = uri.getQueryParameter("sub_game_type");
DirectUtils.directToHomeActivity(this, path, subTypeString, subGameType, TextUtils.isEmpty(position) ? -1 : Integer.parseInt(position), entrance, pathName);
DirectUtils.directToHomeActivity(this, path, subTypeString, subGameType, TextUtils.isEmpty(position) ? -1 : Integer.parseInt(position), ENTRANCE_BROWSER, "浏览器");
break;
case HOST_COMMUNITY_COLUMN:
CommunityEntity community = new CommunityEntity();
community.setId(uri.getQueryParameter("community_id"));
community.setName(uri.getQueryParameter("community_name"));
String columnId = uri.getQueryParameter("column_id");
DirectUtils.directToCommunityColumn(this, community, columnId, entrance, "");
DirectUtils.directToCommunityColumn(this, community, columnId, ENTRANCE_BROWSER, "");
break;
case HOST_CATEGORY:
title = uri.getQueryParameter("title");
DirectUtils.directCategoryDirectory(this, path, title, entrance, pathName);
DirectUtils.directCategoryDirectory(this, path, title, ENTRANCE_BROWSER, "浏览器");
break;
case HOST_COLUMN_COLLECTION:
DirectUtils.directToColumnCollection(this, path, -1, entrance, "", "", "", "", null,false);
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "", "", "", "", null,false);
break;
case EntranceConsts.HOST_BLOCK:
name = uri.getQueryParameter("name");
@ -320,11 +315,11 @@ public class SkipActivity extends BaseActivity {
break;
case EntranceConsts.HOST_SERVER_BLOCK:
DirectUtils.directToGameServers(this, entrance, pathName, null);
DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器", null);
break;
case EntranceConsts.HOST_AMWAY_BLOCK:
DirectUtils.directToAmway(this, null, entrance, pathName);
DirectUtils.directToAmway(this, null, ENTRANCE_BROWSER, "浏览器");
break;
case EntranceConsts.HOST_HELP:
@ -337,11 +332,11 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directToQaCollection(this, name, path);
break;
case EntranceConsts.HOST_GAME_UPLOAD:
DirectUtils.directGameUpload(this, entrance, pathName);
DirectUtils.directGameUpload(this, ENTRANCE_BROWSER, "浏览器");
break;
case EntranceConsts.HOST_GAME_ZONE:
String zoneUrl = uri.getQueryParameter("url");
DirectUtils.directGameZone(this, path, zoneUrl, entrance);
DirectUtils.directGameZone(this, path, zoneUrl, ENTRANCE_BROWSER);
break;
case EntranceConsts.HOST_LINK:
try {
@ -350,7 +345,7 @@ public class SkipActivity extends BaseActivity {
byte[] linkData = Base64.decode(dataString, Base64.DEFAULT);
String linkDataString = new String(linkData, "UTF-8");
LinkEntity le = GsonUtils.INSTANCE.getGson().fromJson(linkDataString, LinkEntity.class);
DirectUtils.directToLinkPage(this, le, entrance, "", "");
DirectUtils.directToLinkPage(this, le, ENTRANCE_BROWSER, "", "");
}
} catch (Exception e) {
e.printStackTrace();
@ -365,7 +360,7 @@ public class SkipActivity extends BaseActivity {
this,
uri.getQueryParameter(EntranceConsts.KEY_GAME_ID),
uri.getQueryParameter(EntranceConsts.KEY_GAME_NAME),
entrance);
EntranceConsts.ENTRANCE_BROWSER);
break;
case EntranceConsts.HOST_GAME_CALENDAR:
DirectUtils.directToGameServerCalendar(this, uri.getQueryParameter(EntranceConsts.KEY_GAME_ID), 0);
@ -375,26 +370,26 @@ public class SkipActivity extends BaseActivity {
break;
case EntranceConsts.HOST_FORUM_DETAIL:
String sectionId = uri.getQueryParameter("section_id");
DirectUtils.directForumDetailSection(this, id, sectionId, entrance);
DirectUtils.directForumDetailSection(this, id, sectionId, ENTRANCE_BROWSER);
break;
case EntranceConsts.HOST_GAME_RATING_DETAIL:
DirectUtils.directToGameRatingDetail(this, uri.getQueryParameter(EntranceConsts.KEY_GAME_ID), uri.getQueryParameter(EntranceConsts.KEY_COMMENT_ID), entrance);
DirectUtils.directToGameRatingDetail(this, uri.getQueryParameter(EntranceConsts.KEY_GAME_ID), uri.getQueryParameter(EntranceConsts.KEY_COMMENT_ID), ENTRANCE_BROWSER);
break;
case EntranceConsts.HOST_FORUM:
DirectUtils.directToHomeCommunityTab(this);
break;
case EntranceConsts.HOST_HELP_AND_FEEDBACK:
if ("vgame".equals(suggestionType)) {
DirectUtils.directToHelpAndFeedback(this, content, isQaFeedback, qaContentId, false, true, entrance);
DirectUtils.directToHelpAndFeedback(this, content, isQaFeedback, qaContentId, false, true, EntranceConsts.ENTRANCE_BROWSER);
} else {
DirectUtils.directToHelpAndFeedback(this, content, isQaFeedback, qaContentId, true, false, entrance);
DirectUtils.directToHelpAndFeedback(this, content, isQaFeedback, qaContentId, true, false, EntranceConsts.ENTRANCE_BROWSER);
}
break;
case HOST_GAME_COLLECTION_DETAIL:
DirectUtils.directToGameCollectionDetail(this, path, entrance, "", null);
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "", null);
break;
case HOST_GAME_COLLECTION_SQUARE:
DirectUtils.directToGameCollectionSquare(this, entrance, "", "", "", "", "", null);
DirectUtils.directToGameCollectionSquare(this, ENTRANCE_BROWSER, "", "", "", "", "", null);
break;
case HOST_QQ_GAME:
String extJson = uri.getQueryParameter("ext");

View File

@ -197,7 +197,15 @@ class SplashScreenActivity : BaseActivity() {
// 尝试获取安装应用列表权限并启动首页(不在乎结果)
private fun requestGetInstallListPermissionAndLaunchMainActivity() {
launchMainActivity()
if (PackageUtils.isSupportGetInstalledAppsPermission(this)
&& PermissionHelper.isGetInstalledListPermissionDisabled(this)
) {
PermissionHelper.requestGetInstalledAppsListPermission(this, true) {
launchMainActivity()
}
} else {
launchMainActivity()
}
}
// 删除更新后的光环助手包
@ -285,6 +293,7 @@ class SplashScreenActivity : BaseActivity() {
if (today != time) {
// 获取版本代码、名称
PlatformUtils.getInstance(applicationContext).getPlatform()
TagUtils.getInstance(applicationContext).getTag()
}
// 更新本地时间

View File

@ -269,9 +269,9 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.inviteFriends) {
IntegralLogHelper.INSTANCE.logInviteResult("成功", "微博");
}
if (ShareUtils.additionalParams != null && (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video)) {
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
com.gh.gamecenter.common.utils.NewLogUtils.logShareResult(ShareUtils.additionalParams, true);
SensorsBridge.trackArticleShareResult(
ShareUtils.additionalParams.getCustomerType(),
@ -319,9 +319,9 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
com.gh.gamecenter.common.utils.NewLogUtils.logShareResult(ShareUtils.additionalParams, false);
}
if(ShareUtils.additionalParams != null && (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video
if(ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video
|| ShareUtils.shareEntrance == ShareUtils.ShareEntrance.communityArticle
|| ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal))
|| ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal)
{
SensorsBridge.trackArticleShareResult(
ShareUtils.additionalParams.getCustomerType(),

View File

@ -18,18 +18,17 @@ import android.widget.TextView;
import androidx.collection.ArrayMap;
import androidx.core.content.ContextCompat;
import com.gh.common.util.PackageHelper;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.KcSelectGameViewHolder;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.BitmapUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.core.utils.TimeUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.KcSelectGameViewHolder;
import com.gh.gamecenter.core.utils.ToastUtils;
import com.gh.gamecenter.databinding.KcGameSelectItemBinding;
import com.gh.gamecenter.feature.entity.InstallGameEntity;
import com.gh.gamecenter.common.retrofit.Response;
import com.lightgame.adapter.BaseRecyclerAdapter;
import com.lightgame.utils.RuntimeUtils;
@ -86,7 +85,6 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
Observable.create(emitter -> {
// 扫描和获取apk数据 分步操作 尽量避免 StackoverflowError
FindAllAPKPath(Environment.getExternalStorageDirectory());
FindAllAPKPath(mContext.getFilesDir());
LoadApkData();
emitter.onComplete();
})
@ -189,7 +187,7 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
}
private int doType(String packageName) {
List<PackageInfo> pakageinfos = PackageHelper.INSTANCE.getInstalledPackages(mContext, 0);
List<PackageInfo> pakageinfos = PackageUtils.getInstalledPackages(mContext, 0);
for (PackageInfo pi : pakageinfos) {
if ((pi.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
String pi_packageName = pi.packageName;

View File

@ -205,7 +205,7 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
GameEntity gameEntity = mLibaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitleAndAdLabel(gameEntity, holder.binding.gameSubtitleTv, null, null, false, null, false, null);
} else {
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null, null);
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null, mLibaoEntity.getGame().getIconFloat());
}
holder.binding.libaodetailName.setText(mLibaoEntity.getName());
if (TextUtils.isEmpty(mLibaoEntity.getPlatform())) {

View File

@ -297,7 +297,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
if (mConcernEntity.getGame() != null) {
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGame().getIcon(), mConcernEntity.getGame().getIconSubscript(), mConcernEntity.getGame().getIconFloat());
} else {
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGameIcon(), null, null);
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGameIcon(), null, mConcernEntity.getGame().getIconFloat());
}
viewHolder.binding.newsDigestTitle.setText(mConcernEntity.getGameName());
NewsUtils.setNewsPublishOn(viewHolder.binding.newsDigestTime, mConcernEntity.getTime());

View File

@ -47,6 +47,7 @@ import com.gh.gamecenter.teenagermode.TeenagerModeActivity.Companion.getIntent
import com.gh.vspace.VHelper
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import com.lightgame.download.FileUtils
import org.greenrobot.eventbus.EventBus
import java.io.File
@ -176,15 +177,6 @@ class DetailViewHolder(
private val mGameEntity: GameEntity = mViewHolder.gameEntity
private var mDownloadEntity: DownloadEntity? = null
private fun showLandPageAddressDialogIfNeeded() {
if (mGameEntity.isLandPageAddressDialog() && !mGameEntity.isLandPageAddressDialogShowOnly()) {
// 第三方落地页为开启状态并且展示状态不为“仅显示弹窗”,需要在点击确认后显示弹窗
DialogUtils.showLandPageAddressDialog(mViewHolder.context, mGameEntity) {
DirectUtils.directToExternalBrowser(mViewHolder.context, mGameEntity.landPageAddressDialog!!.link!!)
}
}
}
override fun onClick(v: View) {
v.tag = null
@ -253,17 +245,13 @@ class DetailViewHolder(
val offStatus = mGameEntity.downloadOffStatus
if (offStatus != null && "off" != offStatus) {
if ("dialog" == offStatus) {
showOffServiceDialog(mGameEntity.downloadOffDialog) {
showLandPageAddressDialogIfNeeded()
}
showOffServiceDialog(mGameEntity.downloadOffDialog)
} else if ("toast" == offStatus) {
EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_RATING))
ToastUtils.toast("该游戏因故暂不提供下载,具体详情可在相关评论中查看,敬请谅解~")
showLandPageAddressDialogIfNeeded()
}
} else {
ToastUtils.toast("该游戏已关闭下载")
showLandPageAddressDialogIfNeeded()
}
}
@ -290,7 +278,7 @@ class DetailViewHolder(
NewSimulatorGameManager.showUpdateNewsSimulator(mViewHolder.context, mGameEntity, null)
return
}
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(mGameEntity.getApk().firstOrNull()?.url)
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(mGameEntity.getApk()[0].url)
if (downloadEntity != null) {
val file = File(downloadEntity.path)
if (!file.exists()) {
@ -343,7 +331,7 @@ class DetailViewHolder(
gameName = mGameEntity.name ?: "",
action = "主动安装"
)
val url = mGameEntity.getApk().firstOrNull()?.url
val (_, _, _, url) = mGameEntity.getApk()[0]
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(url)
if (mGameEntity.simulator != null) {
val isInstalled = PackageUtils.isInstalledFromAllPackage(
@ -465,10 +453,7 @@ class DetailViewHolder(
}
}
ButtonStyle.UPDATING -> {
ToastUtils.toast("正在加急更新版本,敬请后续留意")
showLandPageAddressDialogIfNeeded()
}
ButtonStyle.UPDATING -> ToastUtils.toast("正在加急更新版本,敬请后续留意")
ButtonStyle.TEENAGER_MODE -> {
SensorsBridge.trackAdolescentModeDialogShow(
mGameEntity.id,
@ -538,7 +523,7 @@ class DetailViewHolder(
else -> if (mGameEntity.getApk().isNotEmpty()) {
val intent = DownloadManagerActivity.getDownloadMangerIntent(
mViewHolder.context,
mGameEntity.getApk().firstOrNull()?.url,
mGameEntity.getApk()[0].url,
StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])")
)
mViewHolder.context.startActivity(intent)
@ -546,8 +531,8 @@ class DetailViewHolder(
}
}
private fun showOffServiceDialog(dialog: GameEntity.Dialog?, callback: () -> Unit) {
val dialogFragment = GameOffServiceDialogFragment.getInstance(dialog!!, callback)
private fun showOffServiceDialog(dialog: GameEntity.Dialog?) {
val dialogFragment = GameOffServiceDialogFragment.getInstance(dialog!!)
dialogFragment.show((mViewHolder.context as FragmentActivity).supportFragmentManager, "off_service_dialog")
}
@ -560,8 +545,8 @@ class DetailViewHolder(
ToastUtils.toast("暂时无法下载,请稍后再试")
return
}
val apkEntity = mGameEntity.getApk().firstOrNull()
val msg = FileUtils.isCanDownload(mViewHolder.context, apkEntity?.size ?: "")
val apkEntity = mGameEntity.getApk()[0]
val msg = FileUtils.isCanDownload(mViewHolder.context, apkEntity.size)
if (TextUtils.isEmpty(msg)) {
val btnContainsUpdateText = mViewHolder.context.getString(R.string.update_v) == buttonText
|| buttonText.contains(mViewHolder.context.getString(R.string.update))

View File

@ -34,6 +34,6 @@ class GameImageViewHolder(var binding: GameImageItemBinding) : BaseRecyclerViewH
binding.gameImageIcon.hierarchy.roundingParams = roundingParams
}
ImageUtils.displayWithAdaptiveHeight(binding.gameImageIcon, entity.image, width)
ImageUtils.display(binding.gameImageIcon, entity.image, width)
}
}

View File

@ -89,7 +89,7 @@ class AuthorizationActivity : ToolBarActivity() {
}
private fun initData() {
if (mToken.isNotEmpty() || isFinishing) return
if (mToken.isNotEmpty()) return
val loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
mViewModel.getAccessToken(listOf(mContent), {
mToken = it

View File

@ -21,8 +21,8 @@ import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.PageSwitchDataHelper
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.databinding.CategoryGameItemBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.game.GameItemViewHolder
@ -178,7 +178,7 @@ class CategoryV2ListAdapter(
trackEvent.put("game_status", gameEntity.category)
trackEvent.put(
"inclusion_size",
gameEntity.getApk().firstOrNull()?.size ?: ""
if (gameEntity.getApk().size == 1) gameEntity.getApk()[0].size ?: "" else ""
)
} catch (e: JSONException) {
e.printStackTrace()

View File

@ -23,6 +23,7 @@ import com.gh.gamecenter.entity.ArchiveEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.vspace.VArchiveHelper
import com.halo.assistant.HaloApp
import com.lightgame.download.FileUtils
import org.greenrobot.eventbus.EventBus
class MyArchiveOptionDialogFragment(

View File

@ -12,26 +12,21 @@ import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.common.util.NewsUtils;
import com.gh.gamecenter.core.utils.NumberUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.NewsImage1ViewHolder;
import com.gh.gamecenter.adapter.viewholder.NewsImage2ViewHolder;
import com.gh.gamecenter.adapter.viewholder.NewsImage3ViewHolder;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.NumberUtils;
import com.gh.gamecenter.databinding.NewsImage1ItemBinding;
import com.gh.gamecenter.databinding.NewsImage2ItemBinding;
import com.gh.gamecenter.databinding.NewsImage3ItemBinding;
@ -39,6 +34,7 @@ import com.gh.gamecenter.databinding.PopupHistoryOptionBinding;
import com.gh.gamecenter.feature.entity.NewsEntity;
import com.gh.gamecenter.history.ManageOption;
import com.gh.gamecenter.manager.VisitManager;
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.RetrofitManager;
import org.json.JSONException;
@ -47,9 +43,12 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Locale;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import kotlin.collections.CollectionsKt;
/**
* Created by khy on 18/07/17.
@ -213,7 +212,7 @@ public class ArticleAdapter extends ListAdapter<NewsEntity> {
final NewsEntity newsEntity = mEntityList.get(position);
viewHolder.setClickData(newsEntity);
if (newsEntity.getThumbnail() != null && newsEntity.getThumbnail().getUrl() != null) {
ImageUtils.display(viewHolder.binding.newsImage1Thumb, CollectionsKt.firstOrNull(newsEntity.getThumbnail().getUrl()));
ImageUtils.display(viewHolder.binding.newsImage1Thumb, newsEntity.getThumbnail().getUrl().get(0));
} else {
ImageUtils.display(viewHolder.binding.newsImage1Thumb, R.drawable.message_image_placeholder);
}
@ -270,11 +269,9 @@ public class ArticleAdapter extends ListAdapter<NewsEntity> {
viewHolder.binding.newsImage2Title.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
viewHolder.binding.newsImage2Title.setTextColor(ContextCompat.getColor(mContext, R.color.hint));
}
if (newsEntity.getThumbnail() != null && newsEntity.getThumbnail().getUrl() != null) {
ImageUtils.display(viewHolder.binding.newsImage2Thumb1, CollectionsKt.getOrNull(newsEntity.getThumbnail().getUrl(), 0));
ImageUtils.display(viewHolder.binding.newsImage2Thumb2, CollectionsKt.getOrNull(newsEntity.getThumbnail().getUrl(), 1));
ImageUtils.display(viewHolder.binding.newsImage2Thumb3, CollectionsKt.getOrNull(newsEntity.getThumbnail().getUrl(), 2));
}
ImageUtils.display(viewHolder.binding.newsImage2Thumb1, newsEntity.getThumbnail().getUrl().get(0));
ImageUtils.display(viewHolder.binding.newsImage2Thumb2, newsEntity.getThumbnail().getUrl().get(1));
ImageUtils.display(viewHolder.binding.newsImage2Thumb3, newsEntity.getThumbnail().getUrl().get(2));
int views = newsEntity.getViews();
if (views == 0) {
viewHolder.binding.newsImage2Read.setVisibility(View.GONE);
@ -300,10 +297,8 @@ public class ArticleAdapter extends ListAdapter<NewsEntity> {
viewHolder.binding.selectIv.setVisibility(mCurrentOption == ManageOption.OPTION_MANAGER ? View.GONE : View.VISIBLE);
viewHolder.binding.selectIv.setChecked(selectItems.contains(newsEntity.getId()));
if (newsEntity.getThumbnail() != null && newsEntity.getThumbnail().getUrl() != null) {
ImageUtils.displayWithAdaptiveHeight(viewHolder.binding.newsImage3Thumb, CollectionsKt.firstOrNull(newsEntity.getThumbnail().getUrl()),
mContext.getResources().getDisplayMetrics().widthPixels - DisplayUtils.dip2px(mContext, 40));
}
ImageUtils.display(viewHolder.binding.newsImage3Thumb, newsEntity.getThumbnail().getUrl().get(0),
mContext.getResources().getDisplayMetrics().widthPixels - DisplayUtils.dip2px(mContext, 40));
int views = newsEntity.getViews();
if (views == 0) {
viewHolder.binding.newsImage3Read.setVisibility(View.GONE);

View File

@ -17,8 +17,8 @@ import com.gh.gamecenter.common.utils.toRequestBody
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
import com.gh.gamecenter.entity.InterestedGameEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.entity.InterestedGameEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import io.reactivex.Observable
@ -78,7 +78,7 @@ class DiscoveryViewModel(application: Application) : ListViewModel<GameEntity, D
itemDataList.add(
DiscoveryItemData(
cardPosition = 2,
interestImageCardLabel = mDiscoveryGameCardLabelMap["卡片二"]?.firstOrNull()
interestImageCardLabel = mDiscoveryGameCardLabelMap["卡片二"]?.get(0)
)
)
insertCount++

View File

@ -28,7 +28,6 @@ import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.entity.IconFloat;
import com.gh.gamecenter.common.utils.DialogHelper;
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.NetworkUtils;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
@ -45,6 +44,7 @@ import com.lightgame.adapter.BaseRecyclerAdapter;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;

View File

@ -153,7 +153,7 @@ class NewInstalledGameFragment : ToolbarFragment() {
reuseNoneData.reuseNoneDataDescTv.text = " 及时获悉游戏最新的更新消息"
reuseNoneData.reuseResetLoadTv.text = "去开启"
reuseNoneData.reuseResetLoadTv.setOnClickListener {
PermissionHelper.showGetInstalledAppsListPermissionDialogAndRequestPermission(requireActivity()) {
PermissionHelper.requestGetInstalledAppsListPermission(requireActivity()) {
updateNoDataView()
PackageRepository.initData()
}

View File

@ -389,21 +389,70 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
updateBtn.putWidgetBusinessName("下载管理")
updateBtn.putObject(update)
updateBtn.setOnClickListener {
val str: String = updateBtn.text
val str: String = updateBtn.text.toString()
if ("更新" == str || str.contains("")) {
// 这里用 CurrentActivity 不用 view.context 的原因是
// view.context 在 5.0 以下设备会使用 TintContextWrapper 包一层导致类型转换异常
if ("更新" == str && update.isLandPageAddressDialog()) {// 第三方落地页跳转直接展示跳转弹窗
DialogUtils.showLandPageAddressDialog(it.context, update.transformGameEntity()) {// 跳转第三方落地页
if (update.isLandPageAddressDialogShowOnly()) {
updateOrPluggable(updateBtn, update, downloadEntity, pluginDesc)
} else {
DirectUtils.directToExternalBrowser(it.context, update.landPageAddressDialog!!.link!!)
}
DirectUtils.directToExternalBrowser(it.context, update.landPageAddressDialog!!.link!!)
}
return@setOnClickListener
}
updateOrPluggable(updateBtn, update, downloadEntity, pluginDesc)
(CurrentActivityHolder.getCurrentActivity() as? FragmentActivity)?.checkStoragePermissionBeforeAction(
gameId = update.id,
gameName = update.name ?: "",
gameType = update.categoryChinese,
gameFormat = update.format,
) {
DialogUtils.checkDownload(
updateBtn.context,
update.size,
update.id,
update.name ?: "",
update.categoryChinese
) { isSubscribe: Boolean ->
if (str.contains("")) {
if (update.pluggableCollection != null) {
DownloadDialog.showDownloadDialog(
updateBtn.context,
update.transformGameEntity(),
update.exposureEvent,
mViewModel.entrance,
pluginDesc + "化:" + update.name
)
return@checkDownload
} else {
updateBtn.text = "0%"
updateBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN
updateBtn.progress = 0
}
} else {
updateBtn.text = "0%"
updateBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_NORMAL
updateBtn.progress = 0
}
// 如果历史下载 downloadEntity 不为空,且版本与当前需要更新的不一致,先移除旧任务再执行更新
if ((downloadEntity?.isVGameDownloadInDualDownloadMode() == true
|| downloadEntity?.isLocalDownloadInDualDownloadMode() == true)
&& (update.version != downloadEntity.versionName)
) {
DownloadManager.getInstance().cancel(downloadEntity.url ?: "")
}
mViewModel.update(update, isSubscribe)
mViewModel.refreshList()
EventBus.getDefault()
.post(
EBSkip(
DownloadManagerActivity.TAG,
DownloadManagerActivity.INDEX_DOWNLOAD
)
)
}
}
} else if (updateBtn.context.getString(R.string.launch) == str) {
PackageLauncher.launchApp(updateBtn.context, packageName = update.packageName)
} else if (updateBtn.context.getString(R.string.resume) == str) {
@ -440,68 +489,6 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
}
}
private fun updateOrPluggable(
updateBtn: DownloadButton,
update: GameUpdateEntity,
downloadEntity: DownloadEntity?,
pluginDesc: String
) {
val str: String = updateBtn.text
(CurrentActivityHolder.getCurrentActivity() as? FragmentActivity)?.checkStoragePermissionBeforeAction(
gameId = update.id,
gameName = update.name ?: "",
gameType = update.categoryChinese,
gameFormat = update.format,
) {
DialogUtils.checkDownload(
updateBtn.context,
update.size,
update.id,
update.name ?: "",
update.categoryChinese
) { isSubscribe: Boolean ->
if (str.contains("")) {
if (update.pluggableCollection != null) {
DownloadDialog.showDownloadDialog(
updateBtn.context,
update.transformGameEntity(),
update.exposureEvent,
mViewModel.entrance,
pluginDesc + "化:" + update.name
)
return@checkDownload
} else {
updateBtn.text = "0%"
updateBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN
updateBtn.progress = 0
}
} else {
updateBtn.text = "0%"
updateBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_NORMAL
updateBtn.progress = 0
}
// 如果历史下载 downloadEntity 不为空,且版本与当前需要更新的不一致,先移除旧任务再执行更新
if ((downloadEntity?.isVGameDownloadInDualDownloadMode() == true
|| downloadEntity?.isLocalDownloadInDualDownloadMode() == true)
&& (update.version != downloadEntity.versionName)
) {
DownloadManager.getInstance().cancel(downloadEntity.url ?: "")
}
mViewModel.update(update, isSubscribe)
mViewModel.refreshList()
EventBus.getDefault()
.post(
EBSkip(
DownloadManagerActivity.TAG,
DownloadManagerActivity.INDEX_DOWNLOAD
)
)
}
}
}
private fun generateExposureEvent(updateEntity: GameUpdateEntity) {
updateEntity.exposureEvent =
createEvent(updateEntity.transformGameEntity(), mExposureSource)

View File

@ -4,6 +4,7 @@ import android.view.View
import com.gh.common.exposure.ExposureListener
import com.gh.common.util.DirectUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.LazyFragment
import com.gh.gamecenter.common.constant.EntranceConsts
@ -11,10 +12,12 @@ import com.gh.gamecenter.common.eventbus.EBReuse
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.EmptyCallback
import com.gh.gamecenter.databinding.FragmentGameUpdatableBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.packagehelper.PackageRepository
import com.gh.gamecenter.packagehelper.PackageViewModel
import com.gh.gamecenter.wrapper.MainWrapperFragment
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import org.greenrobot.eventbus.Subscribe
@ -37,6 +40,7 @@ class UpdatableGameFragment : LazyFragment() {
}
}
override fun getRealLayoutId() = R.layout.fragment_game_updatable
override fun onRealLayoutInflated(inflatedView: View) {
mBinding = FragmentGameUpdatableBinding.bind(inflatedView)
@ -100,14 +104,15 @@ class UpdatableGameFragment : LazyFragment() {
noDataContainer.reuseNoneDataDescTv.text = "及时获悉游戏最新的更新消息"
noDataContainer.reuseResetLoadTv.text = "去开启"
noDataContainer.reuseResetLoadTv.setOnClickListener {
PermissionHelper.showGetInstalledAppsListPermissionDialogAndRequestPermission(
requireActivity()
) { isGranted ->
if (isGranted) {
updateNoDataView()
PackageRepository.initData()
}
}
PermissionHelper.requestGetInstalledAppsListPermission(
requireActivity(),
false,
object : EmptyCallback {
override fun onCallback() {
updateNoDataView()
PackageRepository.initData()
}
})
}
} else {
noDataContainer.reuseNoneDataIv.visibility = View.VISIBLE

View File

@ -13,8 +13,6 @@ class AdConfig(
val displayRule: DisplayRule,
@SerializedName("third_party_ads")
val thirdPartyAd: ThirdPartyAd? = null,
@SerializedName("third_party_ads_1")
val hotStartThirdPartyAd: ThirdPartyAd? = null, // 热启动开屏广告
@SerializedName("owner_ads")
val ownerAd: OwnerAdEntity? = null,
) {

View File

@ -36,8 +36,6 @@ data class CommonCollectionEntity(
@Parcelize
data class CommonCollectionContentEntity(
@SerializedName("_id")
private val _id: String? = null,
val title: String = "",
val style: String = "",
val image: String = "",
@ -47,8 +45,4 @@ data class CommonCollectionContentEntity(
var addedContent1: String? = "",
@SerializedName("added_content_2")
var addedContent2: String? = "",
) : Parcelable {
val id: String
get() = _id ?: ""
}
) : Parcelable

View File

@ -2,10 +2,12 @@ package com.gh.gamecenter.entity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.IconFloat
import com.gh.gamecenter.feature.entity.*
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.entity.*
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.IgnoredOnParcel
import java.util.*
import kotlin.collections.ArrayList
data class GameUpdateEntity(
@SerializedName("game_id")
@ -74,8 +76,9 @@ data class GameUpdateEntity(
/**
* 是否为 mod 游戏,根据是否有 mod 标签来判断,不受镜像、游戏屏蔽影响
*/
val isModdedGame: Boolean
get() = tagStyle.any { it.name.lowercase(Locale.getDefault()) == "mod" }
val isModdedGame by lazy {
tagStyle.any { it.name.lowercase(Locale.getDefault()) == "mod" }
}
fun isShowPlugin(location: PluginLocation): Boolean {
@ -92,11 +95,6 @@ data class GameUpdateEntity(
return landPageAddressDialog?.let { it.status == "on" } ?: false
}
/**
* 第三方落地页的状态是否为“仅显示弹窗”
*/
fun isLandPageAddressDialogShowOnly(): Boolean = landPageAddressDialog?.showOnly == true
fun transformGameEntity(): GameEntity {
val gameEntity = GameEntity()
gameEntity.id = id

View File

@ -8,8 +8,6 @@ data class PullDownPush(
val id: String = "",
@SerializedName("pop_switch")
val popSwitch: String = "",
@SerializedName("put_away_switch")
val putAwaySwitch: String = "", // 自动收起never永不、video_finished视频播放完毕视频必填、nn秒后5-15秒后
val description: String = "",
@SerializedName("img_url")
val imgUrl: String = "",

View File

@ -9,7 +9,7 @@ class StartupAdEntity(
var id: String,
val desc: String,
val button: Boolean,
val jump: LinkEntity = LinkEntity(),
val jump: LinkEntity,
val img: String = "",
// 显示规则: none无, each每一次打开, everyday每一天一次, once一次
val rule: String = "",

View File

@ -134,11 +134,9 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadRefresh() {
super.onLoadRefresh()
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
}
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
// Fixhttps://sentry.shanqu.cc/organizations/lightgame/issues/288994/?project=22&query=LazyListFragment&statsPeriod=14d
// Fragment在内存泄露的情况下调用requireView()会触发崩溃这里替换为getView()方法
// TODO 解决Fragment内存泄露的问题
@ -147,11 +145,9 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadDone() {
super.onLoadDone()
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
}
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
view?.setBackgroundColor(Color.TRANSPARENT)
mBaseHandler.postDelayed(Runnable {
tryCatchInRelease {
@ -163,31 +159,25 @@ class ForumArticleAskListFragment : LazyListFragment<AnswerEntity, ForumArticleA
override fun onLoadError() {
super.onLoadError()
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.VISIBLE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
}
mBinding.nestedScrollNoConnection.root.visibility = View.VISIBLE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.GONE
view?.setBackgroundColor(Color.TRANSPARENT)
}
override fun onLoadEmpty() {
super.onLoadEmpty()
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.VISIBLE
mBinding.nestedScrollDataException.root.visibility = View.GONE
}
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.VISIBLE
mBinding.nestedScrollDataException.root.visibility = View.GONE
view?.setBackgroundColor(Color.TRANSPARENT)
}
override fun loadNotFound() {
super.loadNotFound()
if (::mBinding.isInitialized) {
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.VISIBLE
}
mBinding.nestedScrollNoConnection.root.visibility = View.GONE
mBinding.nestedScrollNoneData.root.visibility = View.GONE
mBinding.nestedScrollDataException.root.visibility = View.VISIBLE
}
override fun hideRefreshingLayout() {

View File

@ -25,8 +25,6 @@ import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
import io.reactivex.disposables.Disposable
import java.util.*
import android.os.Handler
import android.os.Looper
class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
StandardGSYVideoPlayer(context, attrs) {
@ -51,8 +49,6 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
private var mStartTrackRunnable: Runnable? = null
private var mStopTrackRunnable: Runnable? = null
private val mTrackHandler = Handler(Looper.getMainLooper())
override fun getLayoutId(): Int {
return R.layout.layout_article_item_video
}
@ -269,7 +265,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
&& currentState != CURRENT_STATE_PLAYING_BUFFERING_START) {// 上报开始视频播放埋点
// 视频停止播放后再恢复播放的间隔时间未超过3秒则取消上报结束视频播放埋点
mStopTrackRunnable?.let { runnable ->
mTrackHandler.removeCallbacks(runnable)
handler.removeCallbacks(runnable)
}
mVideoEntity?.let {
@ -290,7 +286,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
mStartTrackRunnable = it
}
// 埋点要求视频播放3秒后再上报埋点
mTrackHandler.postDelayed(startTrackRunnable, 3000)
handler.postDelayed(startTrackRunnable, 3000)
}
} else if (currentState != state
&& (state == CURRENT_STATE_AUTO_COMPLETE
@ -300,7 +296,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
) {// 上报结束视频播放埋点
// 从开始播放视频到停止播放视频的间隔时间没有超过3秒则取消上报开始视频播放埋点
this.mStartTrackRunnable?.let {
mTrackHandler.removeCallbacks(it)
handler.removeCallbacks(it)
mStartTrackRunnable = null
} ?: let {
mVideoEntity?.let {
@ -321,7 +317,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
this.mStopTrackRunnable = it
}
// 埋点要求停止视频播放3秒后再上报埋点
mTrackHandler.postDelayed(stopTrackRunnable, 3000)
handler.postDelayed(stopTrackRunnable, 3000)
}
}
}
@ -413,7 +409,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
val shareUrl = if (isPublishEnv()) {
"https://m.ghzs666.com/video/${it.id}"
} else {
"https://dev-and-static.ghzs66.com/page/video_play/video/video.html?video=${it.id}"
"https://resource.ghzs.com/page/video_play/video/video.html?video=${it.id}"
}
val additionalParams = AdditionalParamsEntity().apply {
contentType = "视频帖"

View File

@ -8,24 +8,23 @@ import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.common.dialog.ApplyModeratorDialogFragment
import com.gh.common.util.DirectUtils
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.common.avoidcallback.AvoidOnResultManager
import com.gh.gamecenter.common.avoidcallback.Callback
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
import com.gh.common.dialog.ApplyModeratorDialogFragment
import com.gh.common.util.*
import com.gh.gamecenter.R
import com.gh.gamecenter.ShellActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.core.utils.ClickUtils
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.databinding.FragmentApplyModeratorBinding
import com.gh.gamecenter.entity.ApplyModeratorStatusEntity
import com.gh.gamecenter.entity.ApplyModeratorTaskEntity
import com.gh.gamecenter.forum.detail.ForumDetailActivity
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
import com.gh.gamecenter.core.utils.ToastUtils
import com.lightgame.utils.AppManager
import com.lightgame.utils.Utils
@ -176,19 +175,19 @@ class ApplyModeratorFragment : ToolbarFragment() {
private fun checkStatus(status: ApplyModeratorStatusEntity) {
if (mDataList.size > 0) {
if (status.condition.etiquette) {
mDataList.firstOrNull()?.finishedTask = true
mDataList[0].finishedTask = true
mAdapter?.notifyItemChanged(0)
}
if (status.condition.idCard) {
mDataList.getOrNull(1)?.finishedTask = true
mDataList[1].finishedTask = true
mAdapter?.notifyItemChanged(1)
}
if (status.condition.activity) {
mDataList.getOrNull(2)?.finishedTask = true
mDataList[2].finishedTask = true
mAdapter?.notifyItemChanged(2)
}
if (status.condition.choiceness) {
mDataList.getOrNull(3)?.finishedTask = true
mDataList[3].finishedTask = true
mAdapter?.notifyItemChanged(3)
}
var allFinished = true

View File

@ -45,12 +45,6 @@ class UpdateDialogFragment : BaseDialogFragment() {
private var mIsDisplayingDownloadingStyle = false // 是否正在显示更新中样式
private val mDataWatcher = object : DataWatcher() {
override fun onDataInit(downloadEntity: DownloadEntity) {
super.onDataInit(downloadEntity)
onDataChanged(downloadEntity)
}
override fun onDataChanged(downloadEntity: DownloadEntity) {
if (downloadEntity.name.contains("光环助手")) {
if (mIsDisplayingDownloadingStyle) {
@ -80,11 +74,13 @@ class UpdateDialogFragment : BaseDialogFragment() {
return
}
DownloadManager.getInstance().addObserver(mDataWatcher)
mUpdateEntity = arguments?.getParcelable(UPDATE_ENTITY)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
showUpdateHintStyle(requireContext(), mUpdateEntity!!, true)
showUpdateHintStyle(requireContext(), mUpdateEntity!!)
return mBinding.root
}
@ -113,14 +109,8 @@ class UpdateDialogFragment : BaseDialogFragment() {
mDismissCallback?.onCallback()
}
override fun onStart() {
super.onStart()
DownloadManager.getInstance().addObserver(mDataWatcher)
}
override fun onStop() {
super.onStop()
override fun onDestroyView() {
super.onDestroyView()
DownloadManager.getInstance().removeObserver(mDataWatcher)
}
@ -130,9 +120,7 @@ class UpdateDialogFragment : BaseDialogFragment() {
* @param context 上下文
* @param updateEntity 更新实体
*/
private fun showUpdateHintStyle(context: Context,
updateEntity: AppEntity,
invokeByViewCreated: Boolean) {
private fun showUpdateHintStyle(context: Context, updateEntity: AppEntity) {
mIsDisplayingDownloadingStyle = false
val updateHintBinding = mBinding.updateHintContainerView
@ -212,15 +200,12 @@ class UpdateDialogFragment : BaseDialogFragment() {
)
}
if (invokeByViewCreated) {
SensorsBridge.trackVersionUpdateDialogShow(
keyDialogReminderTime = mUpdateEntity?.alert,
keyDialogClose = if (mUpdateEntity?.isForce == true) "关闭且强退" else "仅关闭"
)
DataLogUtils.uploadUpgradeLog(context, "notice") //上传更新通知弹窗数据
}
SensorsBridge.trackVersionUpdateDialogShow(
keyDialogReminderTime = mUpdateEntity?.alert,
keyDialogClose = if (mUpdateEntity?.isForce == true) "关闭且强退" else "仅关闭"
)
DataLogUtils.uploadUpgradeLog(context, "notice") //上传更新通知弹窗数据
}
/**
@ -309,8 +294,13 @@ class UpdateDialogFragment : BaseDialogFragment() {
if (DownloadStatus.done == downloadEntity.status) {
DownloadManager.getInstance().cancel(downloadEntity.url, false, true, false)
tryWithDefaultCatch {
showUpdateHintStyle(requireContext(), updateEntity, false)
try {
dismiss()
} catch (ignored: IllegalArgumentException) {
// do nothing
}
if (updateEntity.isForce) {
AppExecutor.uiExecutor.executeWithDelay({ UpdateHelper.exitApp() }, 1000L)
}
} else if (DownloadStatus.neterror == downloadEntity.status) {
ToastUtils.toast("网络错误,请稍后重试")

View File

@ -1,26 +1,37 @@
package com.gh.gamecenter.fragment
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.app.Dialog
import android.content.DialogInterface
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Bundle
import android.preference.PreferenceManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.Window
import android.view.animation.PathInterpolator
import android.widget.RelativeLayout
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.common.util.DirectUtils
import com.gh.common.util.LogUtils
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.tryWithDefaultCatch
import com.gh.gamecenter.common.view.WrapContentDraweeView
import com.gh.gamecenter.core.provider.IFloatingWindowProvider
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.addListener
import com.gh.gamecenter.databinding.DialogWelcomeBinding
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
import com.halo.assistant.HaloApp
@ -33,6 +44,12 @@ class WelcomeDialogFragment : BaseDialogFragment() {
private var mDismissListener: (() -> Unit)? = null
private var mShowEnterAnimation: Boolean = false
private var mShowExitAnimation: Boolean = false
// 触发此 dialogFragment 的 fragment可能为空
private var mTriggerFragment: BaseLazyFragment? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -50,6 +67,11 @@ class WelcomeDialogFragment : BaseDialogFragment() {
dialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setContentView(root)
if (mShowEnterAnimation) {
dialog.window?.setDimAmount(0F)
} else {
dialog.window?.setDimAmount(0.5F)
}
dialog.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
return dialog
}
@ -71,6 +93,22 @@ class WelcomeDialogFragment : BaseDialogFragment() {
mWelcomeEntity?.let {
DirectUtils.directToLinkPage(requireContext(), it, EntranceConsts.ENTRANCE_WELCOME, "", "首页弹窗")
if (mShowEnterAnimation) {
val floatingWindowProvider =
ARouter.getInstance().build(RouteConsts.provider.floatingwindow)
.navigation() as? IFloatingWindowProvider<WelcomeDialogEntity>
floatingWindowProvider?.logWindowClicked(
action = "点击弹窗跳转页面",
windowId = mWelcomeEntity?.floatingWindowId ?: "",
source = "首页",
gameId = "",
gameName = "",
linkId = mWelcomeEntity?.link ?: "",
linkType = mWelcomeEntity?.type ?: "",
linkText = mWelcomeEntity?.text ?: ""
)
}
}
dismissAllowingStateLoss()
@ -85,6 +123,10 @@ class WelcomeDialogFragment : BaseDialogFragment() {
} else {
mBinding.ivClose.visibility = View.VISIBLE
}
if (mShowEnterAnimation) {
performAnimation(true)
}
}
mBinding.ivOpeningCover.registerLoadingCallback(null)
@ -92,11 +134,33 @@ class WelcomeDialogFragment : BaseDialogFragment() {
})
mBinding.ivCloseBackup.setOnClickListener {
dismissAllowingStateLoss()
val floatingWindowProvider =
ARouter.getInstance().build(RouteConsts.provider.floatingwindow)
.navigation() as? IFloatingWindowProvider<WelcomeDialogEntity>
// 来源 fragment 是否不可见
if (mTriggerFragment?.isCurrentlyVisible() == false) {
mShowExitAnimation = false
} else {
floatingWindowProvider?.showHiddenWindow(requireActivity())
}
if (mShowExitAnimation) {
dismissWithAnimation()
} else {
dismissAllowingStateLoss()
}
}
mBinding.ivClose.setOnClickListener { mBinding.ivCloseBackup.performClick() }
ImageUtils.displayWithoutMemoryCache(mBinding.ivOpeningCover, mWelcomeEntity?.icon)
// 弹起启动弹窗时,把右下角悬浮窗置为隐藏
val floatingWindowProvider =
ARouter.getInstance().build(RouteConsts.provider.floatingwindow)
.navigation() as? IFloatingWindowProvider<WelcomeDialogEntity>
floatingWindowProvider?.hideWindow(requireActivity())
return mBinding.root
}
@ -116,14 +180,132 @@ class WelcomeDialogFragment : BaseDialogFragment() {
mDismissListener = dismissListener
}
/**
* 显示动画
* @param isEnterAnimation 是否为进入动画
*/
private fun performAnimation(isEnterAnimation: Boolean) {
// 贝塞尔曲线需要 Android 版本大于 Android 5.0
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
val screenWidth = DisplayUtils.getScreenWidth(requireActivity())
val screenHeight = DisplayUtils.getScreenHeight(requireActivity())
val statusBarHeight = DisplayUtils.getStatusBarHeight(requireContext().resources)
// 最大宽度为 300dp
val maxWidth = 300F
val initialWidth = 1F
val containerWidth = mBinding.container.width
val containerHeight = containerWidth / mBinding.ivOpeningCover.aspectRatio + 54F.dip2px()
val location = IntArray(2)
mBinding.container.getLocationOnScreen(location)
val xOffsetToTheScreen = location[0]
// 由于显示的时机问题mBinding.container.getLocationOnScreen(location) 获取到的纵座标不一定是真实在屏幕的高度,这里手动计算
val yOffsetToTheScreen = (screenHeight - containerHeight) / 2 + statusBarHeight
val scaleRatio = initialWidth / maxWidth
// 获取动画原点的 X, Y 座标,由于 scale 会变化,所以需要结合 scale 进行计算
val initialX = (screenWidth - 40F.dip2px() - xOffsetToTheScreen) - (containerWidth * (1 - scaleRatio)) / 2
val initialY =
(screenHeight - 156F.dip2px() - yOffsetToTheScreen) - (containerHeight * (1 - scaleRatio)) / 2 + statusBarHeight
val startX = if (isEnterAnimation) initialX else 0F
val startY = if (isEnterAnimation) initialY else 0F
val startScale = if (isEnterAnimation) scaleRatio else 1F
val endScale = if (isEnterAnimation) 1F else scaleRatio
val endX = if (isEnterAnimation) 0F else initialX
val endY = if (isEnterAnimation) 0F else initialY
val enteringTranslationXInterpolator = PathInterpolator(0.4F, 1.6F, 0.4F, 1.24F)
val enteringTranslationYInterpolator = PathInterpolator(0.4F, 1.8F, 0.4F, 1.24F)
val exitingTranslationXInterpolator = PathInterpolator(0.6F, -0.24F, 0.6F, -0.6F)
val exitingTranslationYInterpolator = PathInterpolator(0.6F, -0.24F, 0.6F, -0.2F)
val enteringScaleInterpolator = PathInterpolator(0.61F, 1F, 0.88F, 1F)
val exitingScaleInterpolator = PathInterpolator(0.12F, 0F, 0.39F, 0F)
val translationXAnimator =
ObjectAnimator.ofFloat(mBinding.container, "translationX", startX, endX).apply {
interpolator =
if (isEnterAnimation) enteringTranslationXInterpolator else exitingTranslationXInterpolator
}
val translationYAnimator =
ObjectAnimator.ofFloat(mBinding.container, "translationY", startY, endY).apply {
interpolator =
if (isEnterAnimation) enteringTranslationYInterpolator else exitingTranslationYInterpolator
}
val scaleXAnimator = ObjectAnimator.ofFloat(mBinding.container, "scaleX", startScale, endScale).apply {
addUpdateListener {
val dimAmount = it.animatedValue as Float / 2
dialog?.window?.setDimAmount(dimAmount)
// 避免与原有悬浮窗重叠,退出动画执行到 95% 进度后隐藏
if (!isEnterAnimation && (it.animatedValue as Float) < 0.05F) {
mBinding.container.visibility = View.GONE
} else {
mBinding.container.visibility = View.VISIBLE
}
}
}
val scaleYAnimator = ObjectAnimator.ofFloat(mBinding.container, "scaleY", startScale, endScale)
val scaleAnimatorSet = AnimatorSet().apply {
playTogether(scaleXAnimator, scaleYAnimator)
interpolator = if (isEnterAnimation) enteringScaleInterpolator else exitingScaleInterpolator
}
mBinding.root.pivotX = mBinding.root.width / 2F
mBinding.root.pivotY = mBinding.root.height / 2F
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val translationAnimatorSet = AnimatorSet().apply {
playTogether(translationXAnimator, translationYAnimator)
}
AnimatorSet().apply {
playTogether(
scaleAnimatorSet,
translationAnimatorSet
)
addListener(
onStart = {
mBinding.container.isClickable = false
mBinding.ivOpeningCover.isClickable = false
mBinding.ivClose.isClickable = false
},
onEnd = {
if (!isEnterAnimation) {
dismissAllowingStateLoss()
}
mBinding.container.isClickable = true
mBinding.ivOpeningCover.isClickable = true
mBinding.ivClose.isClickable = true
}
)
duration = ANIMATION_DURATION
}.start()
}
}
private fun dismissWithAnimation() {
performAnimation(false)
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
// 首页弹窗记录 id
val sp = PreferenceManager.getDefaultSharedPreferences(context?.applicationContext)
// 仅不显示进入动画的首页弹窗记录 id
if (!mShowEnterAnimation) {
val sp = PreferenceManager.getDefaultSharedPreferences(context?.applicationContext)
SPUtils.setString(sp, Constants.SP_LAST_OPENING_ID, mWelcomeEntity?.id)
SPUtils.setLong(sp, Constants.SP_LAST_OPENING_TIME, mWelcomeEntity?.time ?: 0L)
SPUtils.setString(sp, Constants.SP_LAST_OPENING_ID, mWelcomeEntity?.id)
SPUtils.setLong(sp, Constants.SP_LAST_OPENING_TIME, mWelcomeEntity?.time ?: 0L)
}
mDismissListener?.invoke()
LogUtils.uploadWelcomeDialog(
@ -138,8 +320,14 @@ class WelcomeDialogFragment : BaseDialogFragment() {
companion object {
const val TAG = "welcome_dialog"
const val ANIMATION_DURATION = 800L
@JvmStatic
fun getInstance(welcomeEntity: WelcomeDialogEntity?) = WelcomeDialogFragment().apply {
fun getInstance(
welcomeEntity: WelcomeDialogEntity?,
withAnimation: Boolean = false,
triggerFragment: BaseLazyFragment? = null
) = WelcomeDialogFragment().apply {
arguments = Bundle()
arguments?.putParcelable(TAG, welcomeEntity)
LogUtils.uploadWelcomeDialog(
@ -150,6 +338,21 @@ class WelcomeDialogFragment : BaseDialogFragment() {
welcomeEntity?.text
)
mTriggerFragment = triggerFragment
// 低于 Android 5.0 禁用动画,因为贝塞尔曲线需要 5.0+ 支持
mShowEnterAnimation = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
false
} else {
withAnimation
}
mShowExitAnimation = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
false
} else {
withAnimation || welcomeEntity?.shouldShowExitAnimation == true
}
SensorsBridge.trackEvent("HomeDialogShow")
}
}

View File

@ -29,6 +29,7 @@ import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMMON_CONTE
class CustomCommonCollectionDetailAdapter(
context: Context,
val layout: Int,
var collectionStyle: String,
val mViewModel: CustomCommonCollectionDetailViewModel,
val mLocation: String,
@ -50,8 +51,8 @@ class CustomCommonCollectionDetailAdapter(
return if (viewType == ItemViewType.ITEM_BODY) {
when (collectionStyle) {
"1-1" -> CommonCollectionDetailOneItemViewHolder(parent.toBinding())
"1-2" -> if (mViewModel.getLayout() == COMMON_CONTENT_COLLECTION_LAYOUT_HORIZONTAL_SLIDE_BANNER
|| mViewModel.getLayout() == COMMON_CONTENT_COLLECTION_LAYOUT_DOUBLE_ROW_BANNER
"1-2" -> if (layout == COMMON_CONTENT_COLLECTION_LAYOUT_HORIZONTAL_SLIDE_BANNER ||
layout == COMMON_CONTENT_COLLECTION_LAYOUT_DOUBLE_ROW_BANNER
) {
CommonCollectionDetailTwoItemHorizontalViewHolder(parent.toBinding())
} else {

View File

@ -60,6 +60,7 @@ class CustomCommonCollectionDetailFragment : LazyListFragment<LinkEntity, Custom
requireArguments().getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
mAdapter = CustomCommonCollectionDetailAdapter(
requireContext(),
mLayout,
mCollectionStyle,
mViewModel,
mLocation,
@ -73,7 +74,7 @@ class CustomCommonCollectionDetailFragment : LazyListFragment<LinkEntity, Custom
override fun provideListViewModel(): CustomCommonCollectionDetailViewModel {
val collectionId = arguments?.getString(EntranceConsts.KEY_COLLECTION_ID) ?: ""
mViewModel = viewModelProvider(CustomCommonCollectionDetailViewModel.Factory(collectionId, mLayout))
mViewModel = viewModelProvider(CustomCommonCollectionDetailViewModel.Factory(collectionId))
return mViewModel
}

View File

@ -13,25 +13,16 @@ import io.reactivex.Observable
class CustomCommonCollectionDetailViewModel(
application: Application,
private val mCollectionId: String,
cachedLayout: Int,
private val mCollectionId: String
) : ListViewModel<CommonCollectionContentEntity, CommonCollectionContentEntity>(application) {
var finalLayout = cachedLayout
val commonCollectionLiveData = MutableLiveData<CommonCollectionEntity>()
fun getLayout() : Int {
return finalLayout
}
override fun provideDataObservable(page: Int): Observable<MutableList<CommonCollectionContentEntity>>? {
return if (page == 1) {
RetrofitManager.getInstance().api
.getCommonCollectionDetail(mCollectionId)
.map {
if (it.layout != -1) {
finalLayout = it.layout
}
commonCollectionLiveData.postValue(it)
it.collectionList
}
@ -45,10 +36,10 @@ class CustomCommonCollectionDetailViewModel(
mResultLiveData.addSource(mListLiveData) { mResultLiveData.postValue(it) }
}
class Factory(private val collectionId: String, private val layout: Int) : ViewModelProvider.NewInstanceFactory() {
class Factory(private val collectionId: String) : ViewModelProvider.NewInstanceFactory() {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return CustomCommonCollectionDetailViewModel(HaloApp.getInstance().application, collectionId, layout) as T
return CustomCommonCollectionDetailViewModel(HaloApp.getInstance().application, collectionId) as T
}
}
}

View File

@ -9,7 +9,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.gh.common.filter.RegionSettingHelper
import com.gh.common.util.ErrorHelper
import com.gh.common.util.*
import com.gh.gamecenter.R
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.Constants
@ -22,12 +22,10 @@ import com.gh.gamecenter.common.utils.observableToMain
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toNewSimpleCount
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.feature.entity.CommentEntity
import com.gh.gamecenter.entity.GamesCollectionDetailEntity
import com.gh.gamecenter.eventbus.EBUserFollow
import com.gh.gamecenter.feature.entity.CommentEntity
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.qa.article.detail.CommentItemData
import com.gh.gamecenter.qa.comment.base.BaseCommentViewModel
@ -121,8 +119,8 @@ open class GameCollectionDetailViewModel(
add(CommentItemData(gameEmpty = true))
} else {
val gameLastIndex = games!!.size - 1
if (mResultLiveData.value?.firstOrNull()?.game != null
&& mResultLiveData.value?.getOrNull(gameLastIndex)?.game != null
if (mResultLiveData.value?.get(0)?.game != null
&& mResultLiveData.value?.get(gameLastIndex)?.game != null
) {
for (i in 0..gameLastIndex) {
add(mResultLiveData.value!![i])

View File

@ -16,9 +16,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.PagerSnapHelper
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.gh.common.exposure.IExposable
import com.gh.common.util.CheckLoginUtils
import com.gh.common.util.DirectUtils
import com.gh.common.exposure.*
import com.gh.common.util.*
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
@ -29,6 +28,7 @@ import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.entity.ExposureEntity
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.ImageUtils.display
import com.gh.gamecenter.common.view.ScrollEventListener
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.DisplayUtils
@ -436,8 +436,8 @@ class GameCollectionSquareAdapter(
binding.run {
val context = root.context
poster.setTag(ImageUtils.TAG_TARGET_WIDTH, mPosterWidth)
ImageUtils.display(poster, gamesCollectionEntity.cover)
ImageUtils.display(userIv, gamesCollectionEntity.user?.icon)
display(poster, gamesCollectionEntity.cover)
display(userIv, gamesCollectionEntity.user?.icon)
titleTv.text = gamesCollectionEntity.title
gamesCollectionEntity.games?.take(3)?.forEachIndexed { index, game ->
when (index) {
@ -490,7 +490,7 @@ class GameCollectionSquareAdapter(
playedGamesContainer.visibleIf(CheckLoginUtils.isLogin() && gamesCollectionEntity.count?.game != 0)
adLabelTv.goneIf(!gamesCollectionEntity.adIconActive)
iconIvOne.setOnClickListener {
val game = gamesCollectionEntity.games?.firstOrNull()
val game = gamesCollectionEntity.games?.get(0)
NewLogUtils.logClickGameCollectionGameIcon(
gamesCollectionEntity.title,
gamesCollectionEntity.id,

View File

@ -285,114 +285,95 @@ class GameDetailFragment : BaseLazyFragment(), IScrollable {
linkType = contentCardEntity.type ?: "",
linkId = contentCardEntity.id
)
val dialog = contentCardEntity.dialog
if (dialog != null) {// 展示内容卡片提示弹窗
DialogHelper.showDialog(
context = requireContext(),
title = dialog.title ?: "",
content = dialog.body ?: "",
confirmText = requireContext().getString(R.string.confirm),
cancelText = requireContext().getString(R.string.cancel),
confirmClickCallback = {
jumpToContentCardLink(contentCardEntity)
}
)
} else {
jumpToContentCardLink(contentCardEntity)
}
}
private fun jumpToContentCardLink(contentCardEntity: ContentCardEntity) {
val path = "游戏详情->内容卡片"
when (contentCardEntity.type) {
"func_server" -> {
if (contentCardEntity.server != null) {
requireContext().startActivity(
ServersCalendarActivity.getIntent(
requireContext(),
mViewModel.game!!, contentCardEntity.server!!,
mNewGameDetailEntity?.me
)
)
}
}
"func_libao" -> {
mBodyBinding.gamedetailVp.currentItem = 0
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
val fragment = mFragmentsList[0]
if (fragment is DescFragment && fragment.isAdded) {
fragment.scrollToLibao()
}
}
"func_related_version" -> {
mBodyBinding.gamedetailVp.currentItem = 0
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
val fragment = mFragmentsList[0]
if (fragment is DescFragment && fragment.isAdded) {
fragment.scrollToRelatedVersion()
}
}
"func_zone" -> {
val gameDetailEntity = mViewModel.gameDetailLiveData.value?.data
if (contentCardEntity.zoneTab && gameDetailEntity?.zone != null && gameDetailEntity.zone!!.style == "link") {
requireContext().startActivity(
WebActivity.getIntent(
requireContext(),
gameDetailEntity.zone!!.link,
true
)
)
}
}
"func_bbs" -> {
val funcBbs = contentCardEntity.funcBbs
funcBbs?.let {
DirectUtils.directForumDetail(requireContext(), it.link, path)
}
}
"func_tool_kit" -> {
if (contentCardEntity.toolkit.isNotEmpty()) {
contentCardEntity.toolkit.safelyGetInRelease(0)?.let {
val url = it.url
if (url != null && url.contains(Config.URL_ARTICLE)) {
val newsId = url.substring(url.lastIndexOf("/") + 1, url.length - 5) // 5: ".html"
val intent = NewsDetailActivity.getIntentById(requireContext(), newsId, path)
requireContext().startActivity(intent)
} else {
requireContext().startActivity(
WebActivity.getWebByCollectionTools(
requireContext(),
it,
false
)
val path = "游戏详情->内容卡片"
when (contentCardEntity.type) {
"func_server" -> {
if (contentCardEntity.server != null) {
requireContext().startActivity(
ServersCalendarActivity.getIntent(
requireContext(),
mViewModel.game!!, contentCardEntity.server!!,
mNewGameDetailEntity?.me
)
)
}
}
"func_libao" -> {
mBodyBinding.gamedetailVp.currentItem = 0
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
val fragment = mFragmentsList[0]
if (fragment is DescFragment && fragment.isAdded) {
fragment.scrollToLibao()
}
}
"func_related_version" -> {
mBodyBinding.gamedetailVp.currentItem = 0
mBodyBinding.gamedetailAppbar.setExpanded(false, true)
val fragment = mFragmentsList[0]
if (fragment is DescFragment && fragment.isAdded) {
fragment.scrollToRelatedVersion()
}
}
"func_zone" -> {
val gameDetailEntity = mViewModel.gameDetailLiveData.value?.data
if (contentCardEntity.zoneTab && gameDetailEntity?.zone != null && gameDetailEntity.zone!!.style == "link") {
requireContext().startActivity(
WebActivity.getIntent(
requireContext(),
gameDetailEntity.zone!!.link,
true
)
)
}
}
"func_bbs" -> {
val funcBbs = contentCardEntity.funcBbs
funcBbs?.let {
DirectUtils.directForumDetail(requireContext(), it.link, path)
}
}
"func_tool_kit" -> {
if (contentCardEntity.toolkit.isNotEmpty()) {
contentCardEntity.toolkit.safelyGetInRelease(0)?.let {
val url = it.url
if (url != null && url.contains(Config.URL_ARTICLE)) {
val newsId = url.substring(url.lastIndexOf("/") + 1, url.length - 5) // 5: ".html"
val intent = NewsDetailActivity.getIntentById(requireContext(), newsId, path)
requireContext().startActivity(intent)
} else {
requireContext().startActivity(
WebActivity.getWebByCollectionTools(
requireContext(),
it,
false
)
)
}
}
}
}
}
else -> DirectUtils.directToLinkPage(
requireContext(),
contentCardEntity.toLinkEntity(),
mEntrance,
path,
ExposureEvent.createEvent(
null,
listOf(
ExposureSource("游戏详情", mGameEntity?.id ?: ""),
ExposureSource("内容卡片", contentCardEntity.id)
)
),
"游戏详情页-内容卡片"
)
else -> DirectUtils.directToLinkPage(
requireContext(),
contentCardEntity.toLinkEntity(),
mEntrance,
path,
ExposureEvent.createEvent(
null,
listOf(
ExposureSource("游戏详情", mGameEntity?.id ?: ""),
ExposureSource("内容卡片", contentCardEntity.id)
)
),
"游戏详情页-内容卡片"
)
}
}
}
override fun getLayoutId(): Int = 0
override fun getInflatedLayout(): View {
@ -443,13 +424,12 @@ class GameDetailFragment : BaseLazyFragment(), IScrollable {
.load(R.layout.fragment_gamedetail_skeleton)
.show()
val gameId = args.getString(EntranceConsts.KEY_GAMEID) ?: ""
val factory = GameDetailViewModel.Factory(
HaloApp.getInstance().application,
gameId,
args.getString(EntranceConsts.KEY_GAMEID),
args.getParcelable(GameEntity.TAG)
)
mViewModel = viewModelProviderFromParent(factory, gameId)
mViewModel = viewModelProviderFromParent(factory)
mPackageViewModel = viewModelProvider(PackageViewModel.Factory())
mUserViewModel = viewModelProvider(UserViewModel.Factory(HaloApp.getInstance().application))
@ -804,7 +784,7 @@ class GameDetailFragment : BaseLazyFragment(), IScrollable {
}
SensorsBridge.trackEventWithExposureSource(
"GameDetailPageShow",
mTraceEvent?.source ?: listOf(ExposureSource(mEntrance)),
mTraceEvent?.source,
"game_id", mGameEntity?.id ?: "",
"game_name", mGameEntity?.name ?: "",
"download_status", mGameEntity?.downloadStatusChinese ?: "",

View File

@ -15,7 +15,6 @@ import com.gh.common.util.CheckLoginUtils
import com.gh.gamecenter.feature.utils.ConcernUtils
import com.gh.common.util.LibaoUtils
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.livedata.NonStickyMutableLiveData
import com.gh.gamecenter.common.mvvm.Resource
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.Response
@ -31,7 +30,10 @@ import com.gh.gamecenter.feature.entity.LibaoStatusEntity
import com.gh.gamecenter.feature.entity.SimpleGame
import com.gh.gamecenter.feature.utils.ApkActiveUtils
import com.gh.gamecenter.feature.utils.ContentBlockedHelper
import com.gh.gamecenter.gamedetail.entity.*
import com.gh.gamecenter.gamedetail.entity.BigEvent
import com.gh.gamecenter.gamedetail.entity.CustomColumn
import com.gh.gamecenter.gamedetail.entity.DetailEntity
import com.gh.gamecenter.gamedetail.entity.NewGameDetailEntity
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp

View File

@ -123,7 +123,7 @@ class DescFragment: LazyFragment(), IScrollable {
val gameDetailFactory =
GameDetailViewModel.Factory(HaloApp.getInstance().application, mGameEntity?.id, mGameEntity)
val gameDetailViewModel: GameDetailViewModel = viewModelProviderFromParent(gameDetailFactory, mGameEntity?.id ?: "")
val gameDetailViewModel: GameDetailViewModel = viewModelProviderFromParent(gameDetailFactory)
mNewDetailEntity = gameDetailViewModel.gameDetailLiveData.value?.data
val factory = DescViewModel.Factory(HaloApp.getInstance().application, mGameEntity)
@ -143,7 +143,7 @@ class DescFragment: LazyFragment(), IScrollable {
gameDetail.data!!.detailEntity.forEach { entity ->
if (entity.video != null && activity !is VideoDetailActivity) {
DirectUtils.directToVideoDetail(
requireContext(), entity.video?.firstOrNull()?.videoId ?: "", entity.video?.firstOrNull()?.videoId, path = "游戏详情-介绍视频"
requireContext(), entity.video!![0].videoId, entity.video!![0].videoId, path = "游戏详情-介绍视频"
)
return@forEach
}

View File

@ -218,7 +218,7 @@ class DescViewModel(
params["suggestion_type"] = "游戏求更新"
params["game_id"] = game?.id ?: ""
params["message"] =
"求更新:${game?.name}(${game?.getApk()?.firstOrNull()?.packageName}, ${game?.getApk()?.firstOrNull()?.version})"
"求更新:${game?.name}(${game?.getApk()?.get(0)?.packageName}, ${game?.getApk()?.get(0)?.version})"
val requestBody = params.createRequestBody()
RetrofitManager.getInstance().api.postSuggestion(requestBody)
.subscribeOn(Schedulers.io())

View File

@ -142,16 +142,11 @@ class GameDetailInfoItemAdapter(
holder.binding.infoTv.layoutParams = (holder.binding.infoTv.layoutParams as MarginLayoutParams).apply {
rightMargin = if (!holder.binding.actionTv.isVisible && !holder.binding.action2Tv.isVisible) 0 else 8F.dip2px()
}
if (gameInfoItemData.title == "权限及用途"
|| gameInfoItemData.title == "隐私政策"
|| gameInfoItemData.title == "ICP备案号") {
if (gameInfoItemData.title == "权限及用途" || gameInfoItemData.title == "隐私政策") {
holder.binding.infoTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme))
}
holder.binding.root.setOnClickListener {
when (gameInfoItemData.title) {
"ICP备案号" -> {
DirectUtils.directToExternalBrowser(context, context.getString(R.string.icp_url))
}
"权限及用途" -> {
GamePermissionDialogFragment.show(context as AppCompatActivity, mViewModel.game, gameInfo)
}

View File

@ -20,7 +20,6 @@ import com.gh.gamecenter.core.utils.MtaHelper
import com.gh.gamecenter.databinding.DialogGameDetailMoreBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.gamedetail.GameDetailViewModel
import com.halo.assistant.HaloApp
class GameDetailMoreDialog : BaseDraggableDialogFragment() {
@ -30,15 +29,7 @@ class GameDetailMoreDialog : BaseDraggableDialogFragment() {
private var mGameEntity: GameEntity? = null
private var mShowConcernIcon = false
private var mIsConcerned = false
private val mViewModel: GameDetailViewModel by lazy {
viewModelProviderFromParent(
GameDetailViewModel.Factory(
HaloApp.getInstance().application,
mGameEntity?.id,
mGameEntity
), mGameEntity?.id ?: ""
)
}
private val mViewModel: GameDetailViewModel by lazy { viewModelProviderFromParent() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

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