Compare commits

...

310 Commits
v3.5 ... v3.6.2

Author SHA1 Message Date
3e512634c6 tinkerBase:3.6.2 2019-03-04 09:51:55 +08:00
7045354808 修复推送系统通道内容乱码问题 2019-02-28 23:25:22 +08:00
dbcc97a250 修复版本说明弹窗圆角 2019-02-28 19:28:20 +08:00
050081b7b1 修复版本说明弹窗大小 修改求版本文案 2019-02-28 18:04:57 +08:00
993d1e7635 UI调整 2019-02-28 10:07:48 +08:00
a86a3c1f71 修复了游戏详情下载按钮文字过多导致超出可是范围的问题 2019-02-27 17:54:41 +08:00
b0a192ad9a 修复了未登录时游戏动态的热门推荐区域不显示的问题 2019-02-27 17:31:51 +08:00
ea7b478c6b Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-02-27 16:23:01 +08:00
b673383f59 修复文章详情引用评论隐藏后没有显示"该内容已被隐藏"问题 2019-02-27 16:22:27 +08:00
06ae366b74 修复隐藏入口后一键修复无法即时更新页面问题 2019-02-27 16:20:57 +08:00
6b9cf7094e 修复关注页面刷新不及时的问题 2019-02-27 15:45:38 +08:00
5ae22bd2bc 修复了用户没有登录也能看到消息中心推送的问题 2019-02-27 10:40:46 +08:00
e951551531 修复了答案详情点击更多会闪退的问题 2019-02-27 10:39:50 +08:00
272e5fb6cc 调整专栏阅读日志的默认值 2019-02-26 14:49:42 +08:00
7dc17d09c1 记录专栏的阅读位置信息 2019-02-26 14:29:39 +08:00
cfacbe739d 修复一些空指针异常 2019-02-26 10:10:29 +08:00
0a72226ba5 下载平台面板增加翻页提示 2019-02-25 10:56:25 +08:00
5f22a14643 整理部分代码 2019-02-24 15:14:42 +08:00
5562e38c2f Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-02-24 11:16:58 +08:00
f9027f7a61 消息中心样式修改 2019-02-24 11:16:46 +08:00
6d0e437ad4 完成 MTA 统计需求 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/456 2019-02-23 11:40:19 +08:00
3abc53d3b3 完成首页游戏替换功能 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/447 2019-02-23 10:33:55 +08:00
d0e4c2c3ab 补充注释 2019-02-22 15:39:09 +08:00
5be50c1638 修复数据统计缺失社区ID的问题 2019-02-22 15:38:31 +08:00
7c525aec79 推送功能优化 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/451 2019-02-22 15:35:11 +08:00
63d5edf892 光环前端需求汇总(2019年2月第4周)(2.3.6.7)https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/452 2019-02-22 15:32:34 +08:00
c9f2cf178a 去掉推送通知的本地过滤 2019-02-22 10:14:37 +08:00
fc98de3bc0 更换广点通接入帐号 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/454 2019-02-22 09:59:36 +08:00
dd8360f5e8 游戏下载面板增加公告(补充) 2019-02-21 11:13:06 +08:00
bc9b815b47 DownloadDialog 去除单例 2019-02-20 14:41:15 +08:00
2a93995221 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-02-20 10:32:15 +08:00
0e93f6521c 版本升为3.6.2 2019-02-20 10:32:09 +08:00
b3a6d0ce94 修复横排专题的曝光出现内容错乱的问题 2019-02-19 18:11:38 +08:00
de60d05190 插件游戏求版本功能完善 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/450#note_17274 2019-02-19 15:42:22 +08:00
2a2ce9a490 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-02-19 11:32:42 +08:00
639644e3c3 游戏下载面板增加公告功能 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/449#note_17186 2019-02-19 11:30:52 +08:00
2378e6e94e 基本完成首页游戏替换功能(本地测试通过,暂未与后台调试) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/447 2019-02-18 15:33:12 +08:00
87d9feae70 修改 Gson 的对象化实现,避免类型擦除 2019-02-18 15:27:49 +08:00
4a93d129bb 游戏下载面板增加公告 2019-02-16 15:46:15 +08:00
39e5e2e9f9 渠道包功能开关控制规则优化(未测试) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/448 2019-02-15 16:07:30 +08:00
8a5f777c65 社区和文章评论被删除的默认文案颜色修改 2019-02-14 10:48:53 +08:00
22c693e042 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-02-13 18:25:13 +08:00
36d04f5841 意见反馈修改 光环前端需求汇总(2019年2月第3周)(8.9.10.11) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/445#note_17027 2019-02-13 18:25:05 +08:00
409123337d 统一游戏动态和我的关注页面的游戏推荐样式 2019-02-13 17:32:06 +08:00
b180a210cb Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-02-13 15:38:40 +08:00
32dfdc4d08 更改草稿刷新逻辑 光环前端需求汇总(2019年2月第3周)(3) 2019-02-13 15:38:35 +08:00
4d46888995 修复更新非活跃状态的页面造成的闪退问题 2019-02-13 14:27:31 +08:00
69db836231 修复问题详情和答案详情页面会丢失部分阅读时长统计的问题 2019-02-12 17:46:54 +08:00
f82b9ad308 修复进入有视频的游戏详情时会造成手机被静音的问题 2019-02-12 15:14:46 +08:00
3ac91b1216 修复重复初始化七陌客服SDK造成后台产生空的聊天条目的问题 2019-02-11 15:36:05 +08:00
8d4b3e0851 修复更新非活跃状态的页面造成的闪退问题 2019-02-11 10:39:11 +08:00
67d8f46217 反馈图标大小自适应 2019-01-30 17:18:57 +08:00
f357136936 update CHANGELOG
3.6.1 Tinker Base
2019-01-30 15:48:00 +08:00
9d622d2be9 消息中心标黄内容复制后去除前后空格 2019-01-30 09:46:52 +08:00
800525227d update MessageSpannableTextView 2019-01-29 18:25:09 +08:00
c9dec9a31e 草稿刷新时定位到列表顶部 2019-01-29 16:23:57 +08:00
2ae4fda6e8 优化ListViewModel 2019-01-28 19:26:02 +08:00
609702715f Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-28 17:59:06 +08:00
ec7e138208 光环助手V3.6.1 RELEASE(20190128-1200)测试问题汇总(2.4) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/443 2019-01-28 17:58:25 +08:00
bfd64a8bce 修复开服表曝光的提交问题 2019-01-28 17:12:15 +08:00
5571b6481f Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-28 11:31:25 +08:00
6d6574988c 光环助手V3.6.1 RELEASE(20190125-1850)测试问题汇总(4.5.9.10.13) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/442#note_16676 2019-01-28 11:31:13 +08:00
af8d075bf2 修复了下载插件化应用时的卡顿问题 2019-01-26 17:44:12 +08:00
b7db66e90b 专题答案列表显示发布时间 2019-01-26 11:32:20 +08:00
13ac4658d9 通过微信分享前先检测用户是否安装微信 2019-01-25 18:22:02 +08:00
8ad3420822 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-25 15:40:16 +08:00
f842ced67e 更换反馈图标 添加渠道号 2019-01-25 15:39:48 +08:00
e0081e56df Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-25 14:22:52 +08:00
3202764f22 屏蔽安卓 5.0 以下设备的视频播放功能 2019-01-25 14:22:39 +08:00
f477876359 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-25 14:08:26 +08:00
86ffcb92f8 admin api host -> 3.6.1
1月25补充优化
2019-01-25 14:08:18 +08:00
a2088e5cd9 修复问题详情页面的答案没有显示发布时间的问题 2019-01-25 09:58:38 +08:00
6e1247f393 消息客服跳转过滤无链接数据 2019-01-24 18:19:27 +08:00
c33faa4918 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-24 15:39:57 +08:00
d0aeb1c411 修改反馈文案
修复插件化完成后更新不及时问题
2019-01-24 15:39:33 +08:00
485924527e 避免发送无用的关注请求 2019-01-24 15:19:15 +08:00
ca1bfda326 更换反馈图标 2019-01-23 18:31:27 +08:00
c7c786d662 修改社区搜索路径关键字 2019-01-23 17:47:02 +08:00
acf9fe308c 光环助手V3.6.1数据统计需求(光环数据后台) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/440 2019-01-23 16:59:53 +08:00
3b32231709 修复嵌套 recyclerview 因为焦点获取而触发莫名位移的问题 2019-01-23 16:43:18 +08:00
9dae198af2 修复曝光下载完成事件里 payload 没有游戏 id 的问题 2019-01-23 14:50:53 +08:00
29bfd5bb93 处理空指针异常 2019-01-23 11:49:51 +08:00
8da51d7f5a 回答数量限制弹窗优化
优化消息中心标黄判断
2019-01-23 11:30:42 +08:00
91964a0ffc Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-22 19:17:26 +08:00
479ef20859 dev api host -> 3.6.1
光环助手V3.6.1-消息中心优化(测试未通过)  https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/435
2019-01-22 19:17:08 +08:00
f458b7dcb8 将MTA的[游戏详情]计算事件换成普通事件[游戏详情_新] 2019-01-22 18:24:31 +08:00
2d25ff7836 开服表添加曝光统计 2019-01-22 18:13:46 +08:00
57dd5d0584 关注游戏区分自动和手动 2019-01-22 18:13:18 +08:00
757efec05e 回答卡片增加回答发布时间 2019-01-22 18:12:21 +08:00
4979045be2 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-21 17:00:59 +08:00
f59af60f70 游戏详情增加社区跳转提示 2019-01-21 17:00:04 +08:00
60bc2a02f4 修复一些闪退问题 2019-01-21 16:21:34 +08:00
996be3906e versionCode->60 versionName->3.6.1 2019-01-21 15:55:50 +08:00
14a054bdbc 游戏详情 增加加载骨架 2019-01-21 15:50:36 +08:00
07a9fd6273 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-21 14:43:21 +08:00
a067f7bc43 礼包详情/专题详情 增加加载骨架 2019-01-21 14:43:11 +08:00
a5eefbb6f4 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-21 10:57:35 +08:00
8d9f83c432 处理值转换异常 2019-01-21 10:57:24 +08:00
ae0df36a89 处理非空异常 2019-01-21 10:56:44 +08:00
72539671a1 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-21 10:31:43 +08:00
94277a4aeb 游戏分类增加加载骨架 2019-01-21 10:31:25 +08:00
e276d148cf 统一文本输入框的超出字数逻辑 2019-01-20 18:34:34 +08:00
a7152034e8 修复上传弹窗重复显示问题 2019-01-20 16:54:16 +08:00
4a5e9da34a 可以由后台控制关闭资讯相关的功能 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/434 2019-01-20 14:23:29 +08:00
1422365cc5 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-20 10:17:36 +08:00
7f55ff6340 根据包名过滤下载按钮状态 2019-01-20 10:17:23 +08:00
4722626fb7 添加百度信息流激活统计请求 2019-01-17 17:07:08 +08:00
39d87ad98d 图片加载支持 gif 2019-01-17 17:06:20 +08:00
85333b9eed 更新七陌客服 SDK 2019-01-17 16:03:58 +08:00
c99ae6db3e 修复游戏列表下载状态异常问题 2019-01-17 15:25:48 +08:00
c5be98adc2 修复手机没有图片选择应用时调用会崩溃的问题 2019-01-16 19:08:18 +08:00
5321aa2e9f Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-16 19:00:50 +08:00
345707ef42 光环前端需求汇总(2019年1月第3周)1.9.11 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/432 2019-01-16 18:35:22 +08:00
6a9d05d916 修复部分以 .html 结尾的下载链接无法下载的问题 2019-01-16 15:45:40 +08:00
faf2a89706 修复了 GID 初始化顺序不一造成的闪退问题 2019-01-15 11:29:57 +08:00
ada51f90f1 修复了一个数组越界造成的闪退问题 2019-01-15 10:08:18 +08:00
53962116d5 修复了我的游戏中同包名游戏显示错误前缀以及安装包名刷新不及时的问题 2019-01-10 15:26:15 +08:00
3ea52745b3 如果已安装的是光环助手的游戏包那么对应的已安装列表只会存在一条已安装信息 2019-01-10 09:53:21 +08:00
a8f2289b27 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-01-09 18:16:31 +08:00
6dd56b5d16 光环前端需求汇总(2019年1月第2周)(1.3.4.5.6.7) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/428#note_15724 2019-01-09 18:15:45 +08:00
eb739cf6cb 修复了插件化弹窗安装状态更新不及时的问题 2019-01-09 17:08:18 +08:00
4853cd9047 修复了文章详情 gif 图片会闪烁的问题 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/424 2019-01-07 12:03:40 +08:00
4e0f14aeed 首页 tab 添加水波纹效果 2019-01-05 18:01:28 +08:00
5e37dac0f6 处理空指针异常 2019-01-05 10:06:01 +08:00
22bfa9051a 修复由于列表重用机制导致的游戏名字长度异常问题 2019-01-04 14:23:32 +08:00
0a1dca3aa3 修复游戏详情大家都在玩列表会显示下载'暂无'字样的游戏的问题 2019-01-04 10:55:15 +08:00
0b20896330 3.6封包 2018-12-29 19:00:46 +08:00
3b934578dd 修改游戏列表样式 2018-12-29 17:51:34 +08:00
c42e1a76bf 3.6封包 2018-12-29 09:21:23 +08:00
d3f2395d9c 捕抓删包异常 2018-12-28 20:41:01 +08:00
b5ba1e877f 将时间敏感的SP写入操作从 apply 换成 commit 2018-12-28 20:17:57 +08:00
eba27d8969 微调游戏列表间距 2018-12-28 18:32:01 +08:00
fe1d4d3406 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-28 17:41:34 +08:00
28418b0d49 update .gitignore 2018-12-28 17:41:16 +08:00
f35396c0e3 修复了关注页面,存在红点且为首次加载时重复加载的问题 2018-12-28 17:33:32 +08:00
67cc464607 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-28 15:57:51 +08:00
b0fa0392b7 调整首页游戏间距
我回答过的问题,最后答案都被隐藏了,在问题详情不要显示 [我来回答] 按钮
2018-12-28 15:57:38 +08:00
0fc4fddfe7 处理部分错误错误码 2018-12-28 11:42:27 +08:00
f092966c88 赞同列表弹窗的宽度改为80%屏幕宽度 2018-12-28 11:29:11 +08:00
0e1cb515ab 游戏列表摘要文案显示为灰色 2018-12-28 10:37:38 +08:00
35115d0581 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-27 18:19:43 +08:00
b1d1fc0e36 修复问答-关注切换社区关注用户可能多次调用刷新数据的问题 2018-12-27 18:19:30 +08:00
91f84cdd5c Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-27 18:08:42 +08:00
ad2c155e54 光环助手V3.6 RELEASE(20181227-1530)测试问题汇总 https://gitlab.ghzhushou.com/pm/issues-Inbox/issues/838 2018-12-27 18:08:30 +08:00
fc4b383292 修复问答-关注切换社区关注用户可能多次调用刷新数据的问题,微调 UI 2018-12-27 18:08:09 +08:00
1a868d3f12 修复问答-关注切换社区关注用户可能多次调用刷新数据的问题 2018-12-27 17:53:34 +08:00
e4dd96e21a Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-27 15:12:18 +08:00
8705f8d2e2 横向游戏列表游戏名加粗
游戏搜索显示游戏标签
版主修改历史优化
2018-12-27 15:12:10 +08:00
65fab5e990 修复关注页面赞同折叠的显示问题 2018-12-27 11:18:49 +08:00
1d92b070eb 将 listViewModel 里更新加载状态的方法由 postValue 换成 setValue 以避免快速多次调用触发分页问题 2018-12-27 10:27:23 +08:00
d72102784e Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-26 20:01:57 +08:00
d7351bf93e 修复了问答关注推荐用户界面即时关注了新用户依旧存在的问题 2018-12-26 20:01:47 +08:00
6bf40ca237 修复同一个包存在多个更新的问题
修复已安装列表出现下载按钮问题
版主修改标签增加默认标签
2018-12-26 17:34:44 +08:00
4be93781b2 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-26 14:26:04 +08:00
13fc6b8453 版主历史版本增加初始内容(未修改),修改app更新逻辑 2018-12-26 14:25:56 +08:00
34cbbdffb9 修复一个重复调用列表 onRefresh 造成的显示问题 2018-12-26 12:04:41 +08:00
e45eadb6e3 3.6 (20181225-1850) 问题汇总 (6,7,12,13,14) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/420 2018-12-26 10:51:56 +08:00
7bf2ef1007 修复点赞数量为零的情况,社区投票 已开通的toast文案修改 2018-12-26 10:33:25 +08:00
23c46cc4b2 修改邀请错误文案 2018-12-25 15:20:53 +08:00
259adbf145 光环助手V3.6 RELEASE(20181224-1145)测试问题汇总(前端)(2,3,6,10,11,13,14) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/419 2018-12-25 15:12:00 +08:00
95acc64e42 光环助手V3.6 RELEASE(20181224-1145)测试问题汇总(前端)(7.8.16)https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/419 2018-12-25 15:02:10 +08:00
974d4fcefa 修复查看礼包闪退问题 2018-12-24 15:22:49 +08:00
298733b192 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-24 11:22:34 +08:00
2ec4c75049 实现下拉刷新更新轮播图(首页-游戏,首页-问答) 2018-12-24 11:22:25 +08:00
bfac5398fc 优化曝光模块代码 2018-12-24 10:43:53 +08:00
d029b1692a 优化曝光模块代码 2018-12-23 16:19:55 +08:00
d7006f25f7 光环助手V3.6 DEV(20181220-1000)测试问题汇总(前端)(10.11.12.14.30.36) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/417#note_14957 2018-12-23 14:30:00 +08:00
ef56910da0 修复曝光事件里 gid 可能为空的问题 2018-12-23 10:20:11 +08:00
dbf73a0385 修复发现页面闪退问题 2018-12-22 18:03:19 +08:00
41b8cae6bd 光环助手V3.6 DEV(20181220-1000)测试问题汇总(前端)(23.24.26.27.28.38) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/417 2018-12-22 17:52:39 +08:00
0bea685ce1 优化信息流推荐关注 2018-12-21 18:09:59 +08:00
acd39aa969 完成光环助手V3.6 DEV(20181220-1000)测试问题汇总(前端) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/417 的 4、5、7、6、8、17、18 2018-12-21 17:22:32 +08:00
fd59e71714 光环助手V3.6 DEV(20181220-1000)测试问题汇总(前端)(9.25.31.33.34.35.37) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/417 2018-12-21 17:03:05 +08:00
47c37a1a7e 优化信息流 推荐关注,admin api 升为v3d6 2018-12-21 10:58:58 +08:00
774f9bac80 修复问答-推荐 重复刷新问题 2018-12-21 10:36:16 +08:00
316eb738ec Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-20 17:32:26 +08:00
af493d9dfb 登录事件触发地点修改,优化信息流推荐关注 2018-12-20 17:32:05 +08:00
3d626abbc2 修复自动搜索不显示广告的问题 2018-12-20 15:40:38 +08:00
a392f7f8d8 修復初始化闪退问题 2018-12-20 11:42:01 +08:00
8f8f4c645a 发现页面分割线,改为0.5dp 2018-12-19 16:54:54 +08:00
1cae62fb99 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
# Conflicts:
#	app/src/main/res/layout/fragment_discover.xml
2018-12-19 16:38:50 +08:00
6db72fa7e7 光环助手V3.6 DEV(20181213-1500)测试问题汇总(UI) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/415 2018-12-19 16:34:10 +08:00
6ee300c70e 将问答顶部几个 tab 的宽度变成自适应 2018-12-19 15:43:43 +08:00
0f16790535 基本完成广告入口需求 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/412 2018-12-19 14:55:36 +08:00
524742b8ea 光环助手V3.6 DEV(20181213-1500)测试问题汇总(前端)(9.10.16.17.24)https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/413 2018-12-18 19:41:31 +08:00
8c08bbea6a Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-18 16:02:36 +08:00
d6c2bd6634 修复反馈闪退问题 2018-12-18 16:02:21 +08:00
4aeb42dee9 精简部分无用代码 2018-12-18 14:26:34 +08:00
0de7f40958 修复 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/413 的 3、4、5、6、19(2)、20、22、25 点 2018-12-18 14:25:51 +08:00
07fd8d986e 捕抓异常 2018-12-18 14:23:16 +08:00
c821923cd0 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-17 17:10:47 +08:00
6ce247d8d1 更改引导图 部分登录入口统计修改 2018-12-17 17:10:34 +08:00
473d8c43df Merge branch 'fix_background_service' into 'dev'
尝试解决 https://gitlab.ghzhushou.com/halo/assistant-android/issues/7

See merge request !2
2018-12-17 16:22:11 +08:00
e082b321eb 尝试解决 https://gitlab.ghzhushou.com/halo/assistant-android/issues/7
1. 当设备满足系统版本为 8.0+ 且应用在后台运行时,使用 startForegroundService() 启动 DownloadService ,否则使用原来的 startService() 启动 DownloadService

2. 当应用从后台切换回前台并且 DownloadService 是前台服务时,手动调用 Service.stopForeground() 来去掉前台服务标记
2018-12-17 16:18:05 +08:00
fd236857d4 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailActivity.kt
2018-12-14 17:35:27 +08:00
9290934ec3 光环助手V3.6数据统计需求(登录入口统计) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/407 2018-12-14 17:20:39 +08:00
b6d9118d05 修复一个在华为设备上注册过多 broadcast receiver 会崩溃的问题 2018-12-14 11:50:38 +08:00
544d21613a 增加腾讯广告用户分群 SDK 2018-12-14 10:56:32 +08:00
68a7720ea9 补充开服表 MTA 事件 2018-12-13 18:00:03 +08:00
01a537c0f6 修复打包失败问题(使用javax包下的内容导致) 2018-12-13 17:21:40 +08:00
11bd2a5831 versionName->3.6
versionCode->50
2018-12-13 16:26:08 +08:00
d615a07f27 基本完成 3.6 MTA 统计需求 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/408 2018-12-13 10:56:40 +08:00
ef941a7651 微调菜单UI 2018-12-13 09:42:56 +08:00
928ed40dd4 社区上报阅读数据增加相关字段 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/406#note_14390 2018-12-12 17:17:36 +08:00
03f3f174c3 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-12 16:24:13 +08:00
6a1a38fb5e 问答-推荐增加推荐关注完成 2018-12-12 16:23:59 +08:00
9f4ca9a3bb Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-12 15:06:58 +08:00
670786cc2d 完善点赞引导和关注引导 2018-12-12 15:06:52 +08:00
cc3b4ba7e9 禁言状态提醒从 toast 改为 dialog 2018-12-12 10:55:19 +08:00
b8d5246230 当引用的评论被隐藏 内容显示未该内容已被删除 2018-12-11 16:46:12 +08:00
37665acd3c Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-11 15:03:59 +08:00
5aef4d649a 优化版主管理问题详情权限问题 2018-12-11 15:03:46 +08:00
90c050590a 搜索列表添加曝光统计 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/405 2018-12-11 14:33:50 +08:00
3115152f32 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-11 10:52:26 +08:00
923562ad8e 礼包增加查看状态,客服私信增加问题类型,社区推荐轮播图大小设为按比例缩放 2018-12-11 10:52:01 +08:00
1b2b9b3b91 更换显示游戏"新服"的字段,消息推送点击标记已读 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/402 2018-12-11 10:12:08 +08:00
8412044b88 增加检查登录的 extensions 2018-12-11 10:10:24 +08:00
ceb2384eb8 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java
2018-12-10 16:18:45 +08:00
1244efd015 基本完成社区版主权限答案部分 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/395 2018-12-10 16:17:24 +08:00
1cc572f774 版主修改历史/详情 对接数据接口,app更新对比改用VersionCode 2018-12-10 16:16:20 +08:00
f43c9e5d67 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-09 17:40:56 +08:00
22387e8e60 光环助手V3.6优化需求汇总(20181206)(1.2.5.7.8.9.10.13.21.22)https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/402#note_14212 2018-12-09 17:40:47 +08:00
9284af351a Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-08 15:44:51 +08:00
07cbd3c031 捕获写入曝光数据库的异常 2018-12-08 15:44:36 +08:00
1d03d171e0 发送游戏页面增加定位权限申请(避免在某些设备上没有权限闪退 2018-12-08 15:42:46 +08:00
1abb783f4c Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-07 16:07:55 +08:00
d37c809973 版主隐藏问题对接数据接口 2018-12-07 16:07:43 +08:00
0feffda7f3 完成 V3.6 部分优化 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/402 2018-12-07 16:06:54 +08:00
b5bfbfaff6 基本完成社区关注 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/391 补充部分 2018-12-06 18:05:09 +08:00
25a4171631 更新 GID 库 2018-12-06 18:04:13 +08:00
8622aa787a 版主修改问题对接数据接口 2018-12-06 17:42:23 +08:00
dd44a34e18 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-06 11:55:25 +08:00
da91e7de1d 优化版主问题标签 2018-12-06 11:55:16 +08:00
c32798cbb0 捕抓异常,避免闪退 2018-12-06 10:15:11 +08:00
a03754d02b Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-05 18:08:58 +08:00
a9351b29ab 问答推荐增加“推荐关注”(尚未对接网络数据) 2018-12-05 18:08:51 +08:00
84a27b504d 基本完成 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/400 答案详情引导修改 2018-12-05 17:59:57 +08:00
91e2432b48 微调问答关注页面 UI 2018-12-05 15:54:46 +08:00
505da678f0 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-05 14:19:53 +08:00
e0b44bf41c 整理app更新相关/礼包详情代码 2018-12-05 14:19:44 +08:00
f856ff5957 微调回答详情点赞动画特效 2018-12-05 10:21:48 +08:00
65fdb90ccb 回答详情添加动画效果,具体触发逻辑还得等后台确定接口 2018-12-05 10:12:34 +08:00
82372dc33b Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-04 17:53:32 +08:00
14fb79b90c 更改过滤已隐藏包的逻辑 2018-12-04 17:53:19 +08:00
050c7f9d86 处理非空异常 2018-12-04 17:03:08 +08:00
6efd3a3239 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-03 15:36:12 +08:00
f1c0888309 修复对获取服务器时间这个接口的解析问题 2018-12-03 15:35:58 +08:00
1e9ade68f7 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-03 15:07:45 +08:00
58a0fd8fdb 修复游戏详情截图尺寸不对问题 2018-12-03 15:07:35 +08:00
cd523bd552 修复对获取服务器时间这个接口的解析问题 2018-12-03 14:59:16 +08:00
22f68d098c Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-12-03 11:17:18 +08:00
5d3657938d 删除tinker_version_name(由于app推送更新方式变更,不再需要tinker_version_name) 2018-12-03 11:16:26 +08:00
f2002ff1ce 修复初始化问题 2018-12-03 10:51:08 +08:00
49600213b7 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/qa/AskViewModel.kt
2018-11-30 18:18:17 +08:00
4d87edb1fd 删除部分无用代码 完成部分todo 2018-11-30 18:16:18 +08:00
b536f263f2 修复一个初始化异常问题 2018-11-30 16:36:10 +08:00
65c1300c63 去掉用不到的 iosched 2018-11-30 10:43:45 +08:00
f1cc12eea3 微调代码结构 2018-11-30 10:34:48 +08:00
0c5dd84c27 略微调整代码结构 2018-11-30 10:21:23 +08:00
df8753e1c4 优化管理员修改问题,修复资讯中心三张图片的Item无法显示问题 2018-11-29 17:21:54 +08:00
eb9dba3bc7 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-11-28 18:41:00 +08:00
86247e4a61 回退问答-推荐访问路径 增加问题历史和历史详情 2018-11-28 18:40:45 +08:00
fc46584735 修复初始化问题 2018-11-28 18:25:06 +08:00
dab87d46fa 修复初始化问题 2018-11-28 18:07:10 +08:00
1968f4b7f3 将应用初始化的操作移动到子线程,缩短启动速度 2018-11-28 17:41:11 +08:00
3b1556f931 将 annotationProcessor 换成 kapt
(文档 https://kotlinlang.org/docs/reference/kapt.html#using-in-gradle 说 kapt 可以完全替换掉 annotationProcessor,尝试去掉来确定 butterknife 偶发找不到 id 是不是这个造成的)
2018-11-28 16:33:41 +08:00
249332848c 修正问答统计访问路径(问答-推荐),修改编辑问题-标签选择 2018-11-27 19:02:54 +08:00
26058934cd 完善打特殊包的脚本 2018-11-26 17:12:11 +08:00
11298d26e7 更新 proguard 规则以适配新的 LogHub 依赖 2018-11-26 14:37:00 +08:00
394d558707 修复用户使用 AppOps 绕过外部存储权限授予限制,使游戏下载到内部存储 '/data/user/...' ,造成游戏无法安装/安装崩溃的问题 2018-11-26 11:39:21 +08:00
058d55ea82 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-11-26 10:31:49 +08:00
903109f8d5 增加打特殊包的脚本 2018-11-26 10:31:30 +08:00
4876abb0ed 更新 gid 依赖,修复崩溃问题 2018-11-26 10:27:07 +08:00
f75490aec2 捕获获取安装包信息的异常 2018-11-26 10:26:17 +08:00
b2e3ae684d 删除strings.xml重复参数 2018-11-25 18:36:14 +08:00
5b4f5e0ef8 下载状态相关字符串抽离到 Strings.xml 2018-11-25 18:25:27 +08:00
5fb6f7dbb2 默认隐藏游戏列表排序数值 2018-11-23 17:13:06 +08:00
c8e32fd968 更改游戏列表开服标签的实现方式 2018-11-22 19:17:18 +08:00
15f4f58164 整理社区选择‘投票中’代码 2018-11-22 15:52:26 +08:00
291410cc1c Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-11-22 15:24:32 +08:00
dd9d6cc452 光环助手V3.6-问答社区优化需求汇总[社区投票优化] https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/394 2018-11-22 15:24:22 +08:00
8866d7f71e 修复 9.0 部分设备没有读写权限会崩溃的问题 2018-11-21 17:34:15 +08:00
83bcd89c0c 微调问答邀请列表的 UI 2018-11-21 16:58:08 +08:00
0a2160e18a 修复在部分无法获取 IMEI 的机器上无法加载网络数据的问题 2018-11-21 16:57:25 +08:00
acab1d89aa 光环助手V3.6-问答社区优化需求汇总(Bug汇总) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/394 2018-11-21 15:53:20 +08:00
42176d334e 统一游戏列表样式,删除无用代码 2018-11-20 17:18:57 +08:00
5db3563400 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-11-19 17:41:49 +08:00
50f26101cb 首页游戏增加预览样式以及调整部分首页游戏样式 2018-11-19 17:41:30 +08:00
20915963f8 基本完成社区首页新增的[关注]时间线功能 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/391 2018-11-19 15:07:27 +08:00
e0fce2c2bf Merge branch 'install_helper' into dev 2018-11-15 11:08:28 +08:00
069340ecd1 修改包名 2018-11-15 11:07:48 +08:00
ca5a34e09d 删除部分todo 2018-11-15 10:41:10 +08:00
08fe5e8f83 PackageViewModel 增加重试功能 2018-11-14 16:30:31 +08:00
12623fd383 PackageRepository 添加光环助手更新逻辑 2018-11-14 11:33:25 +08:00
d52bd00ab9 删除无用代码 2018-11-14 10:12:06 +08:00
11963ef040 InstallManager相关的应用全部整合到PackagesManager 2018-11-13 18:26:27 +08:00
03ce6f80a1 下载管理-游戏更新接入PackageViewModel
重构PackageManager相关
2018-11-13 16:30:30 +08:00
42ea33612d 更新 logHubHelper ,支持无网发送失败时有网重试 2018-11-13 10:13:57 +08:00
1cc0c51390 重构本地已安装的相关数据(更新/插件化/已安装的游戏列表)
已对接:首页插件化区域,我的游戏页面
2018-11-12 16:52:26 +08:00
62740ffcb6 tinkerVersionName->3.5.1 2018-11-08 14:48:33 +08:00
727616c764 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/kaifu/KaiFuVpFragment.java
2018-11-08 11:33:44 +08:00
1b6fd03ba3 修复开服表存在置顶项进入直接点击下一开服会一直滚动到底部的问题 2018-11-08 11:26:54 +08:00
53bb1dee01 修复总开复表存在热门开服点击下一节直接跳到底部问题 2018-11-08 11:26:40 +08:00
467950ae2c 优化首页游戏以及板块页面交互问题 2018-11-07 18:14:37 +08:00
5248ad3b6a 选择社区列表增加“上拉加载”状态 2018-11-06 17:44:55 +08:00
3e41af7f41 社区推荐修改默认刷新文案 2018-11-06 15:08:01 +08:00
c01a9c1140 横向游戏列表加上礼包图标, 问题推荐增加默认刷新文案 2018-11-06 14:50:22 +08:00
36def0a511 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2018-11-06 10:09:29 +08:00
077f768d09 光环助手V3.5 RELEASE(20181101-1540)(2.4.5.6.7.8.9.12)测试问题汇总 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/387 2018-11-06 10:09:12 +08:00
c2eafeb9a4 修复一些空指针异常问题 2018-11-02 09:42:29 +08:00
541 changed files with 16515 additions and 9795 deletions

3
.gitignore vendored
View File

@ -7,4 +7,5 @@ local.properties
captures/
build/
release-app/
scripts/apk-channel/
scripts/apk-channel/
app/src/test/java/com/gh/gamecenter

View File

@ -1,4 +1,10 @@
### Ver 3.1
# 版本升级备忘
### Ver 2.5
* 此处写本次更新所做的业务和代码修改
### Ver 2.6
* xx
### Ver 3.0
* 升级账号系统(登录流程/用户信息相关/用户账号相关操作(评论,礼包...))
@ -10,8 +16,23 @@
* 游戏下载平台面板修改(加快弹出速度,不再读取本地平台图片)
* 接入bugly(tinker)
### Ver 2.6
* xx
### VER 3.1
### VER 3.2
### VER 3.3
### VER 3.4
### VER 3.5
### Ver 2.5
* 此处写本次更新所做的业务和代码修改
### Ver 3.6
* 首页游戏增加预览骨架,游戏ITEM样式微调和开服标签
* 首页问答增加关注页面
* 重构游戏更新管理(游戏更新/插件化/已安装的游戏),具体细节参考PackageRepository & PackageViewModel
* 重构APP更新管理(已VersionVode为更新基准,小版本更新改为光环后台控制)
- 删除TINKER_VERISON_NAME
- tinker打包方式变更(以小版本作为Base包,防止与数据后台小版本更新发生冲突)
* 社区增加版主功能(版主可以对存在的相关内容进行修改/隐藏操作,内容包括问题/回答/回答评论)
* 社区互动引导优化(问答推荐增加`推荐关注`,回答详情增加一些交互动效)
### Ver 3.6.1
* 可以后台控制关闭资讯功能
* 版块、分类、专题详情、游戏详情、礼包详情增加预览骨架
* 下载按钮状态可以通过接口屏蔽相应的包

View File

@ -68,7 +68,6 @@ android {
buildConfigField "String", "WEIBO_APPKEY", "\"${WEIBO_APPKEY}\""
buildConfigField "String", "MTA_APPKEY", "\"${MTA_APPKEY}\""
buildConfigField "String", "TD_APPID", "\"${TD_APPID}\""
buildConfigField "String", "PATCH_VERSION_NAME", "\"${PATCH_VERSION_NAME}\""
}
@ -92,7 +91,7 @@ android {
signingConfig signingConfigs.debug
buildConfigField "String", "EXPOSURE_REPO", "\"test\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E1\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E2\""
}
release {
debuggable false
@ -102,7 +101,7 @@ android {
signingConfig signingConfigs.release
buildConfigField "String", "EXPOSURE_REPO", "\"exposure\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E1\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E2\""
}
}
@ -188,6 +187,8 @@ dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leakcanary}"
debugImplementation "com.facebook.stetho:stetho:${stetho}"
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stetho}"
@ -218,12 +219,11 @@ dependencies {
implementation "com.j256.ormlite:ormlite-core:${ormlite}"
implementation "com.jakewharton:butterknife:${butterKnife}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterKnife}"
kapt "com.jakewharton:butterknife-compiler:${butterKnife}"
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
implementation "org.greenrobot:eventbus:${eventbus}"
annotationProcessor "org.greenrobot:eventbus-annotation-processor:${eventbusApt}"
kapt "org.greenrobot:eventbus-annotation-processor:${eventbusApt}"
implementation "io.reactivex.rxjava2:rxjava:${rxJava2}"
implementation "io.reactivex.rxjava2:rxandroid:${rxAndroid2}"
@ -269,6 +269,11 @@ dependencies {
implementation "cn.jzvd:jiaozivideoplayer:${jiaoziVideoView}"
implementation "com.danikula:videocache:${videoCache}"
implementation "com.llew.huawei:verifier:1.0.6"
implementation 'com.ethanhua:skeleton:1.1.1'
implementation 'io.supercharge:shimmerlayout:2.1.0'
implementation project(':libraries:gid')
implementation project(':libraries:LGLibrary')
implementation project(':libraries:MTA')
@ -276,7 +281,6 @@ dependencies {
implementation project(':libraries:TalkingData')
implementation project(':libraries:UmengPush')
implementation project(':libraries:WechatShare')
implementation project(':libraries:iosched')
implementation project(':libraries:LogHub')
implementation project(':libraries:im')
}

Binary file not shown.

View File

@ -197,4 +197,29 @@
-keep @android.support.annotation.Keep class *
-keepclassmembers class ** {
@android.support.annotation.Keep *;
}
}
-keep class com.gh.loghub.** { *; }
### greenDAO 3
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
public static java.lang.String TABLENAME;
}
-keep class **$Properties
-keep class org.greenrobot.greendao.** { *; }
# If you do not use SQLCipher:
-dontwarn org.greenrobot.greendao.database.**
# If you do not use RxJava:
-dontwarn rx.**
-dontwarn org.greenrobot.greendao.rx.**
-dontwarn org.greenrobot.greendao.**
### fastJson
-dontwarn com.alibaba.fastjson.**
-keep class com.alibaba.fastjson.** { *; }
-keepattributes Signature
-keepattributes Annotation
### 广点通
-dontwarn com.qq.gdt.action.**
-keep class com.qq.gdt.action.** {*;}

View File

@ -107,10 +107,7 @@
android:name = "com.gh.gamecenter.ConcernActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.subject.refactor.SubjectActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.PluginActivity"
android:name = "com.gh.gamecenter.subject.SubjectActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.NewsSearchActivity"
@ -329,7 +326,7 @@
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.personalhome.fans.FollowersActivity"
android:name = "com.gh.gamecenter.personalhome.followers.FollowersActivity"
android:screenOrientation = "portrait" />
<activity
@ -363,8 +360,18 @@
<activity
android:name = "com.gh.gamecenter.qa.draft.CommunityDraftWrapperActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity"
android:windowSoftInputMode = "stateVisible"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.qa.questions.edit.manager.HistoryDetailActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.qa.questions.edit.manager.HistoryActivity"
android:screenOrientation = "portrait" />
<activity
@ -391,10 +398,6 @@
</intent-filter >
</activity >
<activity
android:name = ".CommonActivity"
android:screenOrientation = "portrait" />
<provider
android:name = "android.support.v4.content.FileProvider"
android:authorities = "${applicationId}"

View File

@ -1,7 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="normalize.css">
<link rel="stylesheet" type="text/css" href="style.css">

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -75,7 +75,7 @@ public class AppUncaughtHandler implements UncaughtExceptionHandler {
// 保存log到本地
public static void saveLocalLog(Context context, Throwable ex) {
String errorMsg = Log.getStackTraceString(ex);
Config.setExceptionMsg(context, errorMsg);
Config.setExceptionMsg(errorMsg);
// 保存到本地
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault());

View File

@ -165,7 +165,8 @@ public abstract class BaseActivity extends BaseToolBarActivity implements EasyPe
, StringUtils.buildString("", manufacturer, " - ", model, "")
, "知道了", "重新登录"
, null
, () -> startActivity(LoginActivity.getIntent(BaseActivity.this))
, () -> startActivity(LoginActivity.getIntent(BaseActivity.this,
"你的账号已在另外一台设备登录多设备-重新登录"))
);
mBaseHandler.postDelayed(() -> mIsExistLogoutDialog = false, 5000);
} catch (JSONException e) {

View File

@ -101,6 +101,12 @@ public abstract class BaseToolBarActivity extends BaseAppCompatActivity implemen
return mToolbar.getMenu().findItem(res);
}
public void clearMenu() {
if (mToolbar != null) {
mToolbar.getMenu().clear();
}
}
public Menu getMenu() {
return mToolbar.getMenu();
}

View File

@ -7,7 +7,7 @@ import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.GameDetailActivity;
import com.gh.gamecenter.NewsDetailActivity;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.subject.refactor.SubjectActivity;
import com.gh.gamecenter.subject.SubjectActivity;
import com.umeng.message.UmengNotificationClickHandler;
import com.umeng.message.entity.UMessage;

View File

@ -15,45 +15,47 @@ import android.view.View
import com.gh.common.notifier.Notifier
import com.gh.common.util.DataUtils
import com.gh.common.util.EntranceUtils
import com.gh.common.util.PackageUtils
import com.gh.common.util.StringUtils
import com.gh.gamecenter.BuildConfig
import com.gh.common.util.toObject
import com.gh.gamecenter.R
import com.gh.gamecenter.entity.PushEntity
import com.gh.gamecenter.entity.PushMessageEntity
import com.gh.gamecenter.entity.PushMessageUnreadEntity
import com.gh.gamecenter.entity.PushNotificationEntity
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.message.MessageUnreadRepository
import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity
import com.gh.gamecenter.receiver.UmengMessageReceiver
import com.gh.gamecenter.receiver.UmengMessageReceiver.Companion.TYPE_CLICK
import com.gh.gamecenter.receiver.UmengMessageReceiver.Companion.TYPE_REMOVE
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.google.gson.Gson
import com.halo.assistant.HaloApp
import com.umeng.message.UmengMessageService
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import okhttp3.MediaType
import okhttp3.RequestBody
import okhttp3.ResponseBody
import org.android.agoo.common.AgooConstants
import org.json.JSONObject
import retrofit2.HttpException
import java.util.*
class GHUmengNotificationService : UmengMessageService() {
companion object {
const val ACTION_UMENG = "com.gh.gamecenter.UMENG"
const val MESSAGE_FROM_SYSTEM = "message_from_system"
const val HALO_MESSAGE_DIALOG = "HALO_MESSAGE_DIALOG"
const val HALO_MESSAGE_CENTER = "HALO_MESSAGE_CENTER"
const val ANSWER = "answer"
const val FOLLOW_QUESTION = "follow_question"
const val NOTIFICATION_ID = 2015
const val DISPLAY_TYPE_NOTIFICATION = "notification"
const val DISPLAY_TYPE_CUSTOM = "custom"
const val MESSAGE_ID = "message_id"
const val PUSH_ID = "push_id"
}
val notificationTags = arrayOf("GH_UMENG_TAG_1", "GH_UMENG_TAG_2", "GH_UMENG_TAG_3")
@ -64,7 +66,7 @@ class GHUmengNotificationService : UmengMessageService() {
val isMessageFromSystem = intent.getBooleanExtra(MESSAGE_FROM_SYSTEM, false)
try {
val pushData = gson.fromJson(message, PushEntity::class.java)
val pushData = message.toObject<PushEntity>()
pushData?.let { handlePushData(context, it, message, isMessageFromSystem) }
} catch (e: Exception) {
e.printStackTrace()
@ -77,10 +79,10 @@ class GHUmengNotificationService : UmengMessageService() {
if (pushData.displayType == DISPLAY_TYPE_NOTIFICATION) {
// 其它类型的透传信息
// 显示到通知栏
val msg = gson.fromJson(message, PushNotificationEntity::class.java)
val msg = message.toObject<PushNotificationEntity>()
val data = msg?.extra?.data
// 系统推送,直接处理跳转
// 系统推送(非自定义信息),直接处理跳转
if (isMessageFromSystem) {
val intent = Intent()
intent.setClass(context, UmengMessageReceiver::class.java)
@ -91,43 +93,49 @@ class GHUmengNotificationService : UmengMessageService() {
return
}
// 判断是否过滤该消息
if (validatePush(data?.condition)) {
val clickIntent = Intent()
val removeIntent = Intent()
clickIntent.setClass(context, UmengMessageReceiver::class.java)
clickIntent.putExtra(EntranceUtils.KEY_DATA, data?.link)
clickIntent.putExtra(EntranceUtils.KEY_MESSAGE, message)
clickIntent.putExtra(EntranceUtils.KEY_TYPE, TYPE_CLICK)
removeIntent.setClass(context, UmengMessageReceiver::class.java)
removeIntent.putExtra(EntranceUtils.KEY_TYPE, TYPE_REMOVE)
removeIntent.putExtra(EntranceUtils.KEY_MESSAGE, message)
val clickPendingIntent = PendingIntent.getBroadcast(context, System.currentTimeMillis().toInt(),
clickIntent, PendingIntent.FLAG_UPDATE_CURRENT)
val deletePendingIntent = PendingIntent.getBroadcast(context, System.currentTimeMillis().toInt() + 1,
removeIntent, PendingIntent.FLAG_UPDATE_CURRENT)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel("Halo_Push", "Halo_Push", NotificationManager.IMPORTANCE_DEFAULT)
notificationManager.createNotificationChannel(channel)
}
val notification = NotificationCompat.Builder(context, "Halo_Push")
.setSmallIcon(R.drawable.ic_notification)
.setTicker(pushData.body?.ticker)
.setContentTitle(pushData.body?.title)
.setContentText(pushData.body?.text)
.setContentIntent(clickPendingIntent)
.setDeleteIntent(deletePendingIntent)
.build()
notification.flags = notification.flags or Notification.FLAG_AUTO_CANCEL
notificationManager.notify(getNotificationTag(context), NOTIFICATION_ID, notification)
// 用户未登录的情况下不生成消息中心通知,避免用户掉登录了还收到跳转至消息中心的通知
if (data != null
&& data.link?.target == "system"
&& !UserManager.getInstance().isLoggedIn) {
return
}
val clickIntent = Intent()
val removeIntent = Intent()
clickIntent.setClass(context, UmengMessageReceiver::class.java)
clickIntent.putExtra(EntranceUtils.KEY_DATA, data?.link)
clickIntent.putExtra(EntranceUtils.KEY_MESSAGE, message)
clickIntent.putExtra(MESSAGE_ID, msg?.msgId)
clickIntent.putExtra(PUSH_ID, data?.pushId)
clickIntent.putExtra(EntranceUtils.KEY_TYPE, TYPE_CLICK)
removeIntent.setClass(context, UmengMessageReceiver::class.java)
removeIntent.putExtra(EntranceUtils.KEY_TYPE, TYPE_REMOVE)
removeIntent.putExtra(EntranceUtils.KEY_MESSAGE, message)
val clickPendingIntent = PendingIntent.getBroadcast(context, System.currentTimeMillis().toInt(),
clickIntent, PendingIntent.FLAG_UPDATE_CURRENT)
val deletePendingIntent = PendingIntent.getBroadcast(context, System.currentTimeMillis().toInt() + 1,
removeIntent, PendingIntent.FLAG_UPDATE_CURRENT)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel("Halo_Push", "Halo_Push", NotificationManager.IMPORTANCE_DEFAULT)
notificationManager.createNotificationChannel(channel)
}
val notification = NotificationCompat.Builder(context, "Halo_Push")
.setSmallIcon(R.drawable.ic_notification)
.setTicker(pushData.body?.ticker)
.setContentTitle(pushData.body?.title)
.setContentText(pushData.body?.text)
.setContentIntent(clickPendingIntent)
.setDeleteIntent(deletePendingIntent)
.build()
notification.flags = notification.flags or Notification.FLAG_AUTO_CANCEL
notificationManager.notify(getNotificationTag(context), NOTIFICATION_ID, notification)
} else {
if (HALO_MESSAGE_DIALOG == pushData.body?.custom) {
// 回答了问题或者关注了问题的消息
@ -159,6 +167,24 @@ class GHUmengNotificationService : UmengMessageService() {
DataUtils.onMtaEvent(context, "消息弹窗",
type, "Does not contains any parameter.")
// 标记已读
val jsonObject = JSONObject()
jsonObject.put("type", type)
val body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString())
RetrofitManager.getInstance(application).api.postMessageRead(UserManager.getInstance().userId, data?.id, body)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<ResponseBody>() {
override fun onResponse(response: ResponseBody?) {
super.onResponse(response)
MessageUnreadRepository.loadMessageUnreadData()
}
override fun onFailure(e: HttpException?) {
e?.printStackTrace()
}
})
Notifier.hide()
})
.show(false)
@ -173,37 +199,6 @@ class GHUmengNotificationService : UmengMessageService() {
}
}
private fun validatePush(condition: PushNotificationEntity.Data.Condition?): Boolean {
if (condition == null) return true
// 校验渠道是否匹配
condition.ghzs?.channel?.let {
if (it.isNotEmpty() && it != HaloApp.getInstance().channel) {
return false
}
}
// 校验光环版本版本是否匹配
condition.ghzs?.version?.let {
if (it.isNotEmpty() && !BuildConfig.VERSION_NAME.contains(it)) {
return false
}
}
// 校验已安装的应用里是否存在条件的包名
if (condition.packageName.isNotEmpty()) {
val installedPackageList = PackageUtils.getAllPackageName(HaloApp.getInstance().application)
for (packageName in installedPackageList) {
if (condition.packageName == packageName) {
return true
}
}
return false
}
return true
}
/**
* 规则:最多三条消息,以旧换新
*

View File

@ -43,6 +43,8 @@ import static com.gh.common.util.EntranceUtils.KEY_ENTRANCE;
public abstract class BaseFragment<T> extends Fragment implements OnRequestCallBackListener<T>,
View.OnClickListener, OnListClickListener, OnTitleClickListener {
public static final int RESULT_REFRESH = 9528;
protected View mCachedView;
protected boolean isEverPause;
@ -130,10 +132,10 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
initView(mCachedView);
}
//TODO 尴尬,必须的有subscribe才能register
// 必须的有subscribe才能register
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onDummyEvent(EBMiPush push) {
//
}
@Nullable

View File

@ -17,5 +17,9 @@ object AppExecutor {
override fun execute(command: Runnable) {
mainThreadHandler.post(command)
}
fun executeWithDelay(command: Runnable, delay: Long) {
mainThreadHandler.postDelayed(command, delay)
}
}
}

View File

@ -1,5 +1,6 @@
package com.gh.common
import android.annotation.SuppressLint
import android.preference.PreferenceManager
import com.gh.base.GHUmengNotificationService
import com.gh.common.constant.Config
@ -77,6 +78,7 @@ object PushManager {
})
}
@SuppressLint("CheckResult")
@JvmStatic
fun getAndSetAlias() {
if (deviceToken.isNullOrEmpty()) {

View File

@ -13,6 +13,8 @@ import java.util.concurrent.Executors
*/
class TimeElapsedHelper(val fragment: Fragment?, val activity: Activity?) {
constructor() : this(null, null)
constructor(fragment: Fragment) : this(fragment, null)
constructor(activity: Activity) : this(null, activity)
@ -21,6 +23,9 @@ class TimeElapsedHelper(val fragment: Fragment?, val activity: Activity?) {
var elapsedTime: Int = 0
var timeout: Int = 0
var timeoutCallback: TimeoutCallback? = null
init {
activity?.application?.registerActivityLifecycleCallbacks(object : Application.ActivityLifecycleCallbacks {
override fun onActivityStarted(a: Activity?) {
@ -76,12 +81,19 @@ class TimeElapsedHelper(val fragment: Fragment?, val activity: Activity?) {
}, false)
}
private fun resumeCounting() {
fun resumeCounting() {
isWorking = true
TimeElapsedThreadHolder.threadService.execute {
while (isWorking) {
try {
elapsedTime++
if (timeout != 0 && timeout == elapsedTime) {
timeoutCallback?.run {
AppExecutor.uiExecutor.execute {
onTimeout()
}
}
}
Thread.sleep(1000)
} catch (e: Exception) {
e.printStackTrace()
@ -90,7 +102,7 @@ class TimeElapsedHelper(val fragment: Fragment?, val activity: Activity?) {
}
}
private fun pauseCounting() {
fun pauseCounting() {
isWorking = false
}
@ -98,4 +110,8 @@ class TimeElapsedHelper(val fragment: Fragment?, val activity: Activity?) {
object TimeElapsedThreadHolder {
val threadService = Executors.newSingleThreadExecutor()
}
interface TimeoutCallback {
fun onTimeout()
}

View File

@ -1,12 +1,13 @@
package com.gh.common.constant;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.gh.common.util.GsonUtils;
import com.gh.common.util.PackageHelper;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.SettingsEntity;
@ -42,45 +43,46 @@ public class Config {
public static final String UMENG_APPKEY = BuildConfig.UMENG_APPKEY;
public static final String UMENG_MESSAGE_SECRET = BuildConfig.UMENG_MESSAGE_SECRET;
public static final String BUGLY_APPID = BuildConfig.BUGLY_APPID;
public static final String PATCH_VERSION_NAME = BuildConfig.PATCH_VERSION_NAME; // 补丁包版本 对应关于->版本号 使用PackageUtils.getPatchVersionName()
// http://www.ghzs666.com/article/${articleId}.html
public static final String URL_ARTICLE = "http://www.ghzs666.com/article/"; // TODO ghzs/ghzs666 统一
public static final String URL_ARTICLE = "http://www.ghzs666.com/article/"; // ghzs/ghzs666 统一
public static final String PATCHES = "patches";
private static String SETTINGS_KEY = "settingsKey";
private static SettingsEntity mSettingsEntity;
public static final String FIX_DOWNLOAD_KEY = "isFixDownload";
public static final String FIX_PLUGIN_KEY = "isFixPlugin";
public static final String FIX_ARTICLE_KEY = "isFixArticle";
public static final String FIX_COMMUNITY_KEY = "isFixCommunity";
public static boolean isShow() {
if (PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication())
.getBoolean("isFixDownload", false)) return true;
if (getPreferences().getBoolean(FIX_DOWNLOAD_KEY, false)) return true;
if (!isExistDownloadFilter()) return false;
for (SettingsEntity.Download entity : getSettings().getDownload()) {
if ("all".equals(entity.getGame())) {
if (entity.isPluginfy() && "normal".equals(entity.getPolicy()) && filterTime(entity.getTime())) {
if (entity.getPluginfy() && "normal".equals(entity.getPolicy()) && filterTime(entity.getTime())) {
return true;
}
}
}
return false;
}
public static String getExceptionMsg(Context context) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
return sp.getString("errMsg", null);
public static String getExceptionMsg() {
return getPreferences().getString("errMsg", null);
}
public static void setExceptionMsg(Context context, String errMsg) {
PreferenceManager.getDefaultSharedPreferences(context).edit().putString("errMsg", errMsg).apply();
public static void setExceptionMsg(String errMsg) {
getPreferences().edit().putString("errMsg", errMsg).apply();
}
public static boolean isShowDownload(String gameId) {
if (PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication())
.getBoolean("isFixDownload", false)) return true;
if (getPreferences().getBoolean(FIX_DOWNLOAD_KEY, false)) return true;
if (TextUtils.isEmpty(gameId) || !isExistDownloadFilter())
return false;
@ -109,13 +111,20 @@ public class Config {
for (SettingsEntity.Download entity : getSettings().getDownload()) {
if (gameId.equals(entity.getGame())) {
if (entity.isPluginfy() && filterTime(entity.getTime())) {
if (entity.getPluginfy() && filterTime(entity.getTime())) {
return true;
} else {
return false;
}
} else if ("all".equals(entity.getGame())) {
if (entity.isPluginfy() && filterTime(entity.getTime())) {
}
SharedPreferences preferences = getPreferences();
boolean isFixPlugin = preferences.getBoolean(FIX_PLUGIN_KEY, false);
if (isFixPlugin) return true;
if ("all".equals(entity.getGame())) {
if (entity.getPluginfy() && filterTime(entity.getTime())) {
preferences.edit().putBoolean(FIX_PLUGIN_KEY, true).apply();
return true;
}
}
@ -130,7 +139,7 @@ public class Config {
for (SettingsEntity.Download entity : getSettings().getDownload()) {
if ("all".equals(entity.getGame())) {
if (entity.isPluginfy() && filterTime(entity.getTime())) {
if (entity.getPluginfy() && filterTime(entity.getTime())) {
return true;
}
}
@ -152,19 +161,20 @@ public class Config {
}
public static void setSettings(SettingsEntity settingsEntity) {
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication()).edit();
edit.putString(SETTINGS_KEY, GsonUtils.getInstance().toJson(settingsEntity)).apply();
getPreferences().edit().putString(SETTINGS_KEY, GsonUtils.toJson(settingsEntity)).apply();
mSettingsEntity = settingsEntity;
// 加载完设置后刷新下
PackageHelper.initList();
}
@Nullable
public static SettingsEntity getSettings() {
if (mSettingsEntity == null) {
try {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication());
String json = sp.getString(SETTINGS_KEY, null);
String json = getPreferences().getString(SETTINGS_KEY, null);
if (!TextUtils.isEmpty(json)) {
mSettingsEntity = GsonUtils.getInstance().fromJsonBean(json, SettingsEntity.class);
mSettingsEntity = GsonUtils.fromJson(json, SettingsEntity.class);
}
} catch (Exception e) {
e.printStackTrace();
@ -194,4 +204,27 @@ public class Config {
}
}
public static SharedPreferences getPreferences() {
return PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication());
}
public static boolean isExistHideFunction() {
SharedPreferences preferences = getPreferences();
if (!preferences.getBoolean(FIX_DOWNLOAD_KEY, false)) return true;
if (!preferences.getBoolean(FIX_PLUGIN_KEY, false)) return true;
if (!preferences.getBoolean(FIX_COMMUNITY_KEY, false)) return true;
if (!preferences.getBoolean(FIX_ARTICLE_KEY, false)) return true;
return false;
}
public static void fixHideFunction() {
SharedPreferences preferences = PreferenceManager.
getDefaultSharedPreferences(HaloApp.getInstance().getApplication());
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(Config.FIX_DOWNLOAD_KEY, true);
editor.putBoolean(Config.FIX_ARTICLE_KEY, true);
editor.putBoolean(Config.FIX_COMMUNITY_KEY, true);
editor.putBoolean(Config.FIX_PLUGIN_KEY, true);
editor.apply();
}
}

View File

@ -26,6 +26,7 @@ public class ItemViewType {
public static final int GAME_PLUGIN = 18; // 游戏插件模块
public static final int ASK_REFRESH = 19; // 问答精选 刷新
public static final int ITEM_EMPTY = 20;
public static final int ASK_CONCERN = 21; // 问答精选 关注
/**
* 普通列表

View File

@ -27,6 +27,7 @@ import com.gh.common.util.KaiFuUtils;
import com.gh.common.util.NewsUtils;
import com.gh.common.util.NumberUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.PlatformUtils;
import com.gh.common.util.StringUtils;
import com.gh.common.view.DownloadDialog;
import com.gh.common.view.DownloadProgressBar;
@ -41,7 +42,7 @@ import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.KaiFuCalendarEntity;
import com.gh.gamecenter.entity.PluginLocation;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.PackagesManager;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Utils;
@ -344,7 +345,7 @@ public class BindingAdapters {
case neterror:
case waiting:
progressBar.setText(R.string.downloading);
if (downloadEntity.isPluggable() && PackageManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
if (downloadEntity.isPluggable() && PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
progressBar.setDownloadType(DownloadProgressBar.DownloadType.DOWNLOADING_PLUGIN);
} else {
progressBar.setDownloadType(DownloadProgressBar.DownloadType.DOWNLOADING_NORMAL);
@ -353,7 +354,7 @@ public class BindingAdapters {
case done:
progressBar.setText(R.string.install);
if (downloadEntity.isPluggable()
&& PackageManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
&& PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
progressBar.setDownloadType(DownloadProgressBar.DownloadType.INSTALL_PLUGIN);
} else {
progressBar.setDownloadType(DownloadProgressBar.DownloadType.INSTALL_NORMAL);
@ -479,4 +480,16 @@ public class BindingAdapters {
layout.setRefreshing(false);
}
}
@BindingAdapter({"setGameName", "isShowPlatform"})
public static void setGameName(TextView view, GameEntity game, boolean isShowPlatform) {
if (isShowPlatform && game.getApk().size() > 0) {
view.setText(String.format("%s - %s", game.getName(),
PlatformUtils.getInstance(view.getContext()).getPlatformName(
game.getApk().get(0).getPlatform())));
} else {
view.setText(game.getName());
}
}
}

View File

@ -2,6 +2,7 @@ package com.gh.common.exposure
import android.arch.persistence.room.TypeConverter
import com.gh.common.exposure.meta.Meta
import com.gh.common.util.GsonUtils
import com.google.gson.Gson
import java.util.*
import kotlin.collections.ArrayList
@ -10,27 +11,27 @@ class ExposureConverters {
@TypeConverter
fun convertPayload2String(any: ExposureEntity): String {
return Gson().toJson(any)
return GsonUtils.toJson(any)
}
@TypeConverter
fun convertString2Payload(string: String): ExposureEntity {
return Gson().fromJson(string, ExposureEntity::class.java)
return GsonUtils.fromJson(string, ExposureEntity::class.java)
}
@TypeConverter
fun convertSource2String(sourceList: List<ExposureSource>): String {
return Gson().toJson(sourceList)
return GsonUtils.toJson(sourceList)
}
@TypeConverter
fun convertString2Source(sourceList: String): List<ExposureSource> {
return ArrayList(Arrays.asList(Gson().fromJson(sourceList, Array<ExposureSource>::class.java))) as List<ExposureSource>
return ArrayList(Arrays.asList(GsonUtils.fromJson(sourceList, Array<ExposureSource>::class.java))) as List<ExposureSource>
}
@TypeConverter
fun convertETrace2String(sourceList: List<ExposureEvent>?): String {
return Gson().toJson(sourceList)
return GsonUtils.toJson(sourceList)
}
@TypeConverter
@ -50,12 +51,12 @@ class ExposureConverters {
@TypeConverter
fun convertMeta2String(any: Meta): String {
return Gson().toJson(any)
return GsonUtils.toJson(any)
}
@TypeConverter
fun convertString2Meta(string: String): Meta {
return Gson().fromJson(string, Meta::class.java)
return GsonUtils.fromJson(string, Meta::class.java)
}
}

View File

@ -15,7 +15,7 @@ import java.util.*
@Parcelize
@Entity(tableName = "exposureEvent")
data class ExposureEvent(
val payload: ExposureEntity,
var payload: ExposureEntity,
val source: List<ExposureSource>,
var eTrace: List<ExposureEvent>? = arrayListOf(),
val event: ExposureType,
@ -26,7 +26,7 @@ data class ExposureEvent(
companion object {
fun createEvent(gameEntity: GameEntity?, source: List<ExposureSource>, eTrace: List<ExposureEvent>?, event: ExposureType): ExposureEvent {
return ExposureEvent(
ExposureEntity(gameId = gameEntity?.id,
payload = ExposureEntity(gameId = gameEntity?.id,
gameName = gameEntity?.name,
sequence = gameEntity?.sequence,
platform = gameEntity?.platform,

View File

@ -4,7 +4,6 @@ import android.arch.persistence.room.*
@Dao
interface ExposureEventDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertMany(eventList: List<ExposureEvent>)

View File

@ -8,9 +8,6 @@ import io.reactivex.functions.Consumer
/**
* Exposure Event Listener for RecyclerView
*
* TODO 1. Pull down refresh change in first page without scroll down action
* TODO 2. Item change not triggered by user scroll action (vm data change etc.)
*/
class ExposureListener(var fragment: Fragment, var exposable: IExposable) : RecyclerView.OnScrollListener() {
@ -58,8 +55,8 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
try {
exposable.getEventByPosition(pos)?.let { eventList.add(it) }
exposable.getEventListByPosition(pos)?.let { eventList.addAll(it) }
} catch (e: Exception) {
e.printStackTrace()
} catch (ignore: Exception) {
// Just ignore the error.
}
}

View File

@ -1,20 +1,24 @@
package com.gh.common.exposure
import android.app.Application
import com.aliyun.sls.android.sdk.LogException
import com.aliyun.sls.android.sdk.model.LogGroup
import com.gh.common.exposure.meta.MetaUtil
import com.gh.common.exposure.time.TimeUtil
import com.gh.gamecenter.BuildConfig
import com.gh.loghub.LgLOG
import com.gh.loghub.LoghubHelper
import com.google.gson.Gson
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import java.util.concurrent.Executors
import kotlin.concurrent.fixedRateTimer
/**
* ExposureManager tool to commit logs to aliyun loghub
* TODO handle logs that failed to be committed multiple times
* A handful tool for committing logs to aliyun loghub.
*
* 如何简单地统计列表中每个 item 的曝光事件?
*
* 1. Adapter 实现 IExposable 接口,在 BindView 阶段更新 ExposureEventExposureEvent 供 getEventByPosition(pos) 方法获取用
* 2. 构建一个 ExposureListener 并作为入参添加至 recyclerview 的 Scroll 回调中
* 3. 没了
*/
object ExposureManager {
@ -22,122 +26,101 @@ object ExposureManager {
private const val PROJECT = "ghzs"
private const val STORE_SIZE = 100
private const val STORE_FORCE_UPLOAD_PERIOD = 300 * 1000L
private const val LOG_STORE = BuildConfig.EXPOSURE_REPO
private var LOG_STORE = BuildConfig.EXPOSURE_REPO
private val loghubHelper = LoghubHelper.getInstance()
private var loghubHelper = LoghubHelper.getInstance()
private lateinit var db: ExposureEventDao
private val storeSet = hashSetOf<ExposureEvent>()
private val storeOpThread = Executors.newSingleThreadExecutor()
private val gson = Gson()
private val exposureCache = FixedSizeLinkedHashSet<String>(20)
// exposureCache 用来过滤掉具有相同 id 的曝光事件,避免重复发送事件
private val exposureCache = FixedSizeLinkedHashSet<String>(100)
private val exposureSet = hashSetOf<ExposureEvent>()
private val exposureDao by lazy { ExposureDatabase.buildDatabase(HaloApp.getInstance().application).logHubEventDao() }
private val exposureExecutor = Executors.newSingleThreadExecutor()
/**
* Must be called early to init object then real use (for example in Application)
*/
@JvmStatic
fun init(application: Application) {
MetaUtil.init(application)
fun init() {
TimeUtil.init()
loghubHelper.init(ENDPOINT, PROJECT, LOG_STORE) { TimeUtil.currentTimeMillis() }
db = ExposureDatabase.buildDatabase(application).logHubEventDao()
loghubHelper.init(HaloApp.getInstance().application, ENDPOINT, PROJECT, LOG_STORE) { TimeUtil.currentTimeMillis() }
storeOpThread.execute {
val eventList = db.getAll()
storeSet.addAll(eventList)
exposureExecutor.execute {
val eventList = exposureDao.getAll()
exposureSet.addAll(eventList)
}
fixedRateTimer(name = "ExposureManager-Store-Checker", initialDelay = 500, period = STORE_FORCE_UPLOAD_PERIOD) {
checkAndUploadFromDatabase(true)
commitSavedExposureEvent(true)
}
}
/**
* Log an Event
* Log a single exposure event.
*/
fun log(event: ExposureEvent, uploadImmediately: Boolean = false) {
when (uploadImmediately) {
false -> store(event)
true -> upload(event)
}
}
/**
* Log Many Events
*/
fun log(eventList: List<ExposureEvent>, uploadImmediately: Boolean = false) {
when (uploadImmediately) {
false -> store(eventList)
true -> upload(eventList)
}
}
/**
* Store an Event to storeSet, upload when storeSet size exceeds STORE_SIZE
*/
private fun store(event: ExposureEvent) {
storeOpThread.execute {
fun log(event: ExposureEvent) {
exposureExecutor.execute {
if (!exposureCache.contains(event.id)) {
storeSet.add(event)
db.insert(event)
exposureCache.add(event.id)
// Catch `android.database.sqlite.SQLiteFullException: database or disk is full` exception.
try {
exposureSet.add(event)
exposureDao.insert(event)
exposureCache.add(event.id)
} catch (e: Exception) {
e.printStackTrace()
}
} else {
Utils.log("Exposure", "遇到重复曝光事件,自动过滤 ${event.id} - ${event.payload.gameName}")
}
checkAndUploadFromDatabase()
}
}
/**
* Store Many Events to storeSet, upload when storeSet size exceeds STORE_SIZE
* Log a collection of exposure event.
*/
private fun store(eventList: List<ExposureEvent>) {
storeOpThread.execute {
fun log(eventList: List<ExposureEvent>) {
exposureExecutor.execute {
for (event in eventList) {
if (!exposureCache.contains(event.id)) {
storeSet.add(event)
db.insert(event)
exposureCache.add(event.id)
// Catch `android.database.sqlite.SQLiteFullException: database or disk is full` exception.
try {
exposureSet.add(event)
exposureDao.insert(event)
exposureCache.add(event.id)
} catch (e: Exception) {
e.printStackTrace()
}
} else {
Utils.log("Exposure", "遇到重复曝光事件,自动过滤 ${event.id} - ${event.payload.gameName}")
}
}
commitSavedExposureEvent()
}
}
/**
* Upload an Event
*/
private fun upload(event: ExposureEvent) {
storeOpThread.execute {
loghubHelper.uploadLogGroup(buildLogGroup(event))
private fun commitSavedExposureEvent(force: Boolean = false) {
exposureExecutor.execute {
if (exposureSet.size < STORE_SIZE && !force || exposureSet.size == 0) return@execute
val exposureList = exposureSet.toList()
// uploadLogGroup 是一个异步方法LoghubHelper 里面实现了重传功能,所以这里交给它就好了
loghubHelper.uploadLogGroup(buildLogGroup(exposureList))
Utils.log("Exposure", "提交了${exposureList.size}条曝光记录")
exposureSet.removeAll(exposureList)
exposureDao.deleteMany(exposureList)
}
}
/**
* Upload Many Events
*/
private fun upload(eventList: List<ExposureEvent>) {
storeOpThread.execute {
loghubHelper.uploadLogGroup(buildLogGroup(eventList))
}
private fun eliminateMultipleBrackets(jsonWithMultipleBracket: String): String {
return jsonWithMultipleBracket.replace("[[", "[").replace("]]", "]")
}
/**
* Upload Events From Store, and removed them
*/
private fun checkAndUploadFromDatabase(isForceUpload: Boolean = false) {
storeOpThread.execute {
if (storeSet.size < STORE_SIZE && !isForceUpload || storeSet.size == 0) return@execute
val uploaded = storeSet.toList()
try {
loghubHelper.uploadLogGroup(buildLogGroup(uploaded))
} catch (exception: LogException) {
// Return to insure no logs lost because of online commit failure
return@execute
}
storeSet.removeAll(uploaded)
db.deleteMany(uploaded)
}
private fun buildLogGroup(eventList: List<ExposureEvent>): LogGroup {
val logGroup = LogGroup("sls android", "no ip")
eventList.forEach { logGroup.PutLog(buildLog(it)) }
return logGroup
}
private fun buildLog(event: ExposureEvent): LgLOG {
@ -154,30 +137,6 @@ object ExposureManager {
return log
}
private fun eliminateMultipleBrackets(jsonWithMultipleBracket: String): String {
return jsonWithMultipleBracket.replace("[[", "[").replace("]]", "]")
}
private fun buildLogGroup(event: ExposureEvent): LogGroup {
val logGroup = LogGroup("sls android", "no ip")
logGroup.PutLog(buildLog(event))
return logGroup
}
private fun buildLogGroup(eventList: List<ExposureEvent>): LogGroup {
val logGroup = LogGroup("sls android", "no ip")
eventList.forEach { event ->
logGroup.PutLog(buildLog(event))
}
return logGroup
}
internal class FixedSizeLinkedHashSet<T>(var maxSize: Int) : LinkedHashSet<T>() {
override fun add(element: T): Boolean {
if (size == maxSize) {

View File

@ -1,15 +1,16 @@
package com.gh.common.exposure
import com.gh.common.util.toObject
import com.gh.gamecenter.entity.GameEntity
import com.google.gson.Gson
import java.util.*
object ExposureUtils {
val gson = Gson()
@JvmStatic
fun logADownloadExposureEvent(entity: GameEntity, platform: String?, traceEvent: ExposureEvent?, downloadType: DownloadType): ExposureEvent {
fun logADownloadExposureEvent(entity: GameEntity,
platform: String?,
traceEvent: ExposureEvent?,
downloadType: DownloadType): ExposureEvent {
val gameEntity = entity.clone()
gameEntity.platform = platform
gameEntity.downloadType = downloadType.toString()
@ -17,21 +18,24 @@ object ExposureUtils {
source = traceEvent?.source ?: ArrayList(),
eTrace = ExposureTraceUtils.appendTrace(traceEvent),
event = ExposureType.DOWNLOAD)
ExposureManager.log(exposureEvent, false)
ExposureManager.log(exposureEvent)
return exposureEvent
}
@JvmStatic
fun logADownloadCompleteExposureEvent(entity: GameEntity, platform: String?, trace: String?, downloadType: DownloadType) {
fun logADownloadCompleteExposureEvent(entity: GameEntity,
platform: String?,
trace: String?,
downloadType: DownloadType) {
val gameEntity = entity.clone()
gameEntity.platform = platform
gameEntity.downloadCompleteType = downloadType.toString()
val traceEvent = gson.fromJson(trace, ExposureEvent::class.java)
val traceEvent = trace?.toObject<ExposureEvent>()
val exposureEvent = ExposureEvent.createEvent(gameEntity = gameEntity,
source = traceEvent?.source ?: ArrayList(),
eTrace = ExposureTraceUtils.appendTrace(traceEvent),
event = ExposureType.DOWNLOAD_COMPLETE)
ExposureManager.log(exposureEvent, false)
ExposureManager.log(exposureEvent)
}
enum class DownloadType {

View File

@ -1,7 +1,11 @@
package com.gh.common.exposure
/**
* 统计曝光的列表的 adapter 需要实现这个接口
*/
interface IExposable {
fun getEventByPosition(pos: Int): ExposureEvent?
// 部分列表的 item 内嵌套了 recyclerview 这里获取这个 item 所携带的所有事件
fun getEventListByPosition(pos: Int): List<ExposureEvent>?
}

View File

@ -15,7 +15,6 @@ data class Meta(
val android_sdk: Int? = -1,
val android_version: String? = "",
val network: String? = "",
val ip: String? = "",
val os: String? = "",
val gid: String? = "",
val channel: String? = "",

View File

@ -18,18 +18,26 @@ import java.io.File
object MetaUtil {
private lateinit var application: Application
private val application: Application = HaloApp.getInstance().application
private var channel = ""
private var m: Meta? = null
fun init(application: Application) {
MetaUtil.application = application
}
fun refreshMeta() {
m = Meta(getMac(), getIMEI(), getModel(), getManufacturer(), getAndroidId(), getAndroidSDK(),
getAndroidVersion(), getNetwork(), getIP(), getOS(), HaloApp.getInstance().gid, getChannel(), BuildConfig.VERSION_NAME, UserManager.getInstance().userId, BuildConfig.EXPOSURE_VERSION)
m = Meta(mac = getMac(),
imei = getIMEI(),
model = getModel(),
manufacturer = getManufacturer(),
android_id = getAndroidId(),
android_sdk = getAndroidSDK(),
android_version = getAndroidVersion(),
network = getNetwork(),
os = getOS(),
gid = HaloApp.getInstance().gid,
channel = getChannel(),
appVersion = BuildConfig.VERSION_NAME,
userId = UserManager.getInstance().userId,
exposureVersion = BuildConfig.EXPOSURE_VERSION)
}
fun getMeta(): Meta {
@ -141,16 +149,16 @@ object MetaUtil {
val telephonyManager = application.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
if (telephonyManager.simState != TelephonyManager.SIM_STATE_READY) return "unknown"
when (telephonyManager.networkType) {
// Unknown
// Unknown
TelephonyManager.NETWORK_TYPE_UNKNOWN -> "Cellular - Unknown"
// Cellular Data2G
// Cellular Data2G
TelephonyManager.NETWORK_TYPE_EDGE, TelephonyManager.NETWORK_TYPE_GPRS, TelephonyManager.NETWORK_TYPE_CDMA,
TelephonyManager.NETWORK_TYPE_IDEN, TelephonyManager.NETWORK_TYPE_1xRTT -> "Cellular - 2G"
// Cellular Data3G
// Cellular Data3G
TelephonyManager.NETWORK_TYPE_UMTS, TelephonyManager.NETWORK_TYPE_HSDPA, TelephonyManager.NETWORK_TYPE_HSPA,
TelephonyManager.NETWORK_TYPE_HSPAP, TelephonyManager.NETWORK_TYPE_HSUPA, TelephonyManager.NETWORK_TYPE_EVDO_0,
TelephonyManager.NETWORK_TYPE_EVDO_A, TelephonyManager.NETWORK_TYPE_EVDO_B -> "Cellular - 3G"
// Cellular Data4G
// Cellular Data4G
TelephonyManager.NETWORK_TYPE_LTE -> "Cellular - 4G"
else -> "Cellular - Unknown Generation"
}
@ -161,10 +169,6 @@ object MetaUtil {
}
fun getIP(): String {
return "unknown"
}
fun getOS(): String {
return "android"
}

View File

@ -1,5 +1,7 @@
package com.gh.common.exposure.time
import com.gh.gamecenter.entity.TimeEntity
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import io.reactivex.schedulers.Schedulers
@ -17,11 +19,12 @@ class Corrector {
fixedRateTimer("TimeUtil-Corrector-Checker", initialDelay = 0, period = TIME_CORRECTOR_ADJUST_PERIOD) {
RetrofitManager.getInstance(HaloApp.getInstance().application).api.time
.subscribeOn(Schedulers.io())
.subscribe({
val serverTime = java.lang.Long.parseLong(it.string())
delta = serverTime * 1000 - System.currentTimeMillis()
}, Throwable::printStackTrace)
.subscribe(object : Response<TimeEntity>() {
override fun onResponse(response: TimeEntity?) {
val serverTime = response?.time
serverTime?.let { delta = it * 1000 - System.currentTimeMillis() }
}
})
}
}
}

View File

@ -4,6 +4,10 @@ object TimeUtil {
private lateinit var corrector: Corrector
fun init() {
corrector = Corrector()
}
fun currentTimeMillis(): Long {
return corrector.delta + System.currentTimeMillis()
}
@ -16,11 +20,4 @@ object TimeUtil {
}
}
/**
* Must be called early then real use (for example in Application)
*/
fun init() {
corrector = Corrector()
}
}

View File

@ -5,16 +5,19 @@ import android.app.NotificationManager
import android.content.Context
import com.gh.base.CurrentActivityHolder
import com.gh.common.util.SPUtils
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.MessageActivity
import com.gh.gamecenter.SuggestSelectActivity
import com.gh.gamecenter.manager.UserManager
import com.halo.assistant.HaloApp
import com.m7.imkfsdk.KfStartHelper
import com.m7.imkfsdk.utils.Utils
import com.moor.imkf.ChatListener
import com.moor.imkf.IMChat
import com.moor.imkf.IMChatManager
import com.moor.imkf.IMMessage
import com.moor.imkf.utils.MoorUtils
object ImManager {
@ -25,10 +28,17 @@ object ImManager {
var shouldShowFloatingWindow = false
var shouldShowFloatingWindowDot = false
// 记录当前用户 ID 避免重复初始化
var currentUserId = ""
@JvmStatic
fun attachIm() {
try {
if (UserManager.getInstance().userInfoEntity != null) {
if (UserManager.getInstance().userInfoEntity != null &&
currentUserId != UserManager.getInstance().userId) {
currentUserId = UserManager.getInstance().userId
MoorUtils.init(HaloApp.getInstance().application)
Utils.init(HaloApp.getInstance().application)
IMChatManager.getInstance().init(
HaloApp.getInstance().application,
ImReceiver.UNIQUE_BROADCAST_ACTION,
@ -67,7 +77,8 @@ object ImManager {
chatHelper.initSdkChat(
ImReceiver.UNIQUE_BROADCAST_ACTION,
IM_KEY,
UserManager.getInstance().userInfoEntity.name + "(" + UserManager.getInstance().userId + ")",
UserManager.getInstance().userInfoEntity.name + "(" + UserManager.getInstance().userId + ")"
+ "[" + BuildConfig.VERSION_NAME + "]",
UserManager.getInstance().userId)
} catch (e: Exception) {
e.printStackTrace()

View File

@ -12,8 +12,8 @@ import android.support.v4.app.NotificationCompat
import com.gh.base.CurrentActivityHolder
import com.gh.gamecenter.R
import com.m7.imkfsdk.chat.ChatActivity
import com.m7.imkfsdk.utils.Utils
import com.moor.imkf.IMChatManager
import com.moor.imkf.utils.Utils
class ImReceiver : BroadcastReceiver() {

View File

@ -32,7 +32,7 @@ class Notifier private constructor() {
@JvmStatic
fun tagNotifierAsShowed(content: String) {
val viewedNotifierCollection = SPUtils.getString(SP_VIEWED_NOTIFIER)
if (viewedNotifierCollection.length > 1000) {
if (viewedNotifierCollection.length > 3000) {
SPUtils.setString(SP_VIEWED_NOTIFIER, content)
} else {
SPUtils.setString(SP_VIEWED_NOTIFIER, viewedNotifierCollection + content)

View File

@ -201,12 +201,16 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
showAnimatorSet.cancel()
hideAnimatorSet.cancel()
removeAllListeners(expandAnimator,
shrinkAnimator,
translateUpAnimator,
translateDownAnimator,
translateToLeftAnimator,
translateToRightAnimator)
try {
removeAllListeners(expandAnimator,
shrinkAnimator,
translateUpAnimator,
translateDownAnimator,
translateToLeftAnimator,
translateToRightAnimator)
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun removeAllListeners(vararg ts: Animator) {
@ -227,7 +231,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
postDelayed({ shrink() }, duration)
}
fun shrink() {
private fun shrink() {
shrinkAnimator.doOnEnd { hide() }
shrinkAnimator.start()
}

View File

@ -1,5 +1,6 @@
package com.gh.common.repository
import com.gh.common.util.ApkActiveUtils
import com.gh.common.util.RandomUtils
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.retrofit.RetrofitManager
@ -17,6 +18,7 @@ object RemenkapaiRepository {
RetrofitManager.getInstance(getApplication()).api.remenkapai
.map { gameList -> filterEntityWithoutApk(gameList) }
.map { pickRandomSizeEntity(size) }
.map(ApkActiveUtils.filterMapperList)
} else {
Observable.create { emitter -> emitter.onNext(pickRandomSizeEntity(size)) }
}
@ -26,6 +28,8 @@ object RemenkapaiRepository {
* 选择随机数量的热门卡牌
*/
private fun pickRandomSizeEntity(size: Int): List<GameEntity> {
if (size > remenkapaiList.size) return remenkapaiList
val randomGameList = arrayListOf<GameEntity>()
val randomArray = RandomUtils.getRandomArray(size, remenkapaiList.size)
for (i in randomArray) {

View File

@ -0,0 +1,37 @@
package com.gh.common.util
import com.gh.common.constant.Config
import com.gh.gamecenter.entity.SettingsEntity
object AdHelper {
// 搜索为空/求版本/意见反馈-功能收录/发现
const val LOCATION_SEARCH_EMPTY = "search_empty"
const val LOCATION_GAME_REQUEST_VERSION = "game_request_version"
const val LOCATION_SUGGESTION_FUNCTION = "suggestion_function"
const val LOCATION_DISCOVER = "discover"
fun getAd(location: String): SettingsEntity.AD? {
val adList = Config.getSettings()?.adList ?: return null
for (ad in adList) {
if (ad.location == location) return ad
}
return null
}
fun getDiscoverAds(): List<SettingsEntity.AD> {
val adList = Config.getSettings()?.adList ?: return listOf()
val discoverAdList = arrayListOf<SettingsEntity.AD>()
for (ad in adList) {
if (ad.location == LOCATION_DISCOVER) {
discoverAdList.add(ad)
}
}
return discoverAdList
}
}

View File

@ -1,31 +1,52 @@
package com.gh.common.util;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.PackagesManager;
import com.lightgame.utils.Utils;
import java.util.List;
import io.reactivex.functions.Function;
/**
* Created by khy on 10/05/17.
*/
public class ApkActiveUtils {
// 过滤隐藏apk包
public static void filterHideApk(GameEntity gameEntity) {
if (gameEntity == null || gameEntity.getApk() == null
|| gameEntity.getApk().size() == 0) return;
List<ApkEntity> apkList = gameEntity.getApk();
for (int i = 0; i < apkList.size(); i++) {
ApkEntity apkEntity = apkList.get(i);
String packageName = apkEntity.getPackageName();
String id = gameEntity.getId();
if (!apkEntity.isActive() && !PackageManager.INSTANCE.isCanPluggable(id, packageName)) {
apkList.remove(i);
i--;
try {
if (gameEntity == null || gameEntity.getOriginalApk().size() == 0) return;
List<ApkEntity> apkList = gameEntity.getOriginalApk();
for (int i = 0; i < apkList.size(); i++) {
ApkEntity apkEntity = apkList.get(i);
String packageName = apkEntity.getPackageName();
String id = gameEntity.getId();
if (!apkEntity.isActive() && !PackagesManager.INSTANCE.isCanPluggable(id, packageName)) {
apkList.remove(i);
i--;
}
}
} catch (Exception e) {
if (BuildConfig.DEBUG) {
Utils.log("filter hide game apk throws exception:" + e.toString());
}
}
}
// 过滤隐藏apk包
public static Function<List<GameEntity>, List<GameEntity>> filterMapperList = list -> {
for (GameEntity gameEntity : list) {
ApkActiveUtils.filterHideApk(gameEntity);
}
return list;
};
// 过滤隐藏apk包
public static Function<GameEntity, GameEntity> filterMapper = list -> {
ApkActiveUtils.filterHideApk(list);
return list;
};
}

View File

@ -18,73 +18,76 @@ public class AskErrorResponseUtils {
if (e == null) return;
int code = e.code();
try {
if (code == 403) {
if (code == 403 || code == 401) {
JSONObject object = new JSONObject(e.response().errorBody().string());
int errorCode = object.getInt("code");
switch (errorCode) {
case 403001:
Utils.toast(context, "标签名称太长了");
break;
case 403002:
Utils.toast(context, "已经被邀请了");
break;
case 403003:
Utils.toast(context, "每天最多只能邀请10次");
break;
case 403004:
Utils.toast(context, "客户端提供的ID无效空/无效ID");
break;
case 403005:
Utils.toast(context, "已经回答过了(限制频率)");
break;
case 403006:
Utils.toast(context, "图片数量达到限制点");
break;
case 403007:
Utils.toast(context, "不合法的用户");
break;
case 403008:
Utils.toast(context, "已投票");
break;
case 403009:
Utils.toast(context, "已经收藏过了");
break;
case 403010:
Utils.toast(context, "无效的标签栏");
break;
case 403011:
Utils.toast(context, "标题内容过长");
break;
case 403012:
Utils.toast(context, "描述内容过长");
break;
case 403013:
Utils.toast(context, "无效的标签");
break;
case 403014:
Utils.toast(context, "标签数量太多了");
break;
case 403015:
Utils.toast(context, "已经关注过了");
break;
default:
Utils.toast(context, "网络错误");
break;
}
} else if (code == 401) {
JSONObject object = new JSONObject(e.response().errorBody().string());
int errorCode = object.getInt("code");
if (errorCode == 404001) {
Utils.toast(context, "请求的资源不存在");
}
errorResponseControl(context, object);
} else {
Utils.toast(context, "网络错误");
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
public static void errorResponseControl(Context context, JSONObject jsonObject) {
int errorCode = 0;
try {
errorCode = jsonObject.getInt("code");
switch (errorCode) {
case 403001:
Utils.toast(context, "标签名称太长了");
break;
case 403002:
Utils.toast(context, "已经被邀请了");
break;
case 403003:
Utils.toast(context, "每天最多可以邀请10次");
break;
case 403004:
Utils.toast(context, "客户端提供的ID无效空/无效ID");
break;
case 403005:
Utils.toast(context, "已经回答过了(限制频率)");
break;
case 403006:
Utils.toast(context, "图片数量达到限制点");
break;
case 403007:
Utils.toast(context, "不合法的用户");
break;
case 403008:
Utils.toast(context, "已投票");
break;
case 403009:
Utils.toast(context, "已经收藏过了");
break;
case 403010:
Utils.toast(context, "无效的标签栏");
break;
case 403011:
Utils.toast(context, "标题内容过长");
break;
case 403012:
Utils.toast(context, "描述内容过长");
break;
case 403013:
Utils.toast(context, "无效的标签");
break;
case 403014:
Utils.toast(context, "标签数量太多了");
break;
case 403015:
Utils.toast(context, "已经关注过了");
break;
case 404001:
Utils.toast(context, "请求的资源不存在");
break;
default:
Utils.toast(context, "网络错误");
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -14,15 +14,17 @@ import com.lightgame.utils.Utils;
public class CheckLoginUtils {
public static void checkLogin(final Context context, OnLoginListener listener) {
if (TextUtils.isEmpty(UserManager.getInstance().getToken())) {
Utils.toast(context, "需要登录");
LogUtils.login(context, "dialog", null);
LogUtils.login(context, "activity", null);
Intent intent = LoginActivity.getIntent(context);
public static void checkLogin(final Context context, String entrance, OnLoginListener listener) {
if (!isLogin()) {
if (listener != null) Utils.toast(context, "需要登录");
LogUtils.login("dialog", null, entrance);
LogUtils.login("activity", null, entrance);
Intent intent = LoginActivity.getIntent(context, entrance);
context.startActivity(intent);
} else {
listener.onLogin();
if (listener != null) {
listener.onLogin();
}
}
}

View File

@ -1,22 +1,23 @@
package com.gh.common.util
import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.support.v4.content.ContextCompat
import android.text.TextUtils
import android.view.Window
import android.widget.LinearLayout
import android.widget.TextView
import com.gh.common.util.CommentUtils.copyText
import com.gh.gamecenter.CommentDetailActivity
import com.gh.gamecenter.MessageDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.OnCommentCallBackListener
import com.gh.gamecenter.entity.CommentEntity
import com.gh.gamecenter.entity.MeEntity
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.lightgame.utils.Utils
import com.tencent.bugly.beta.tinker.TinkerManager.getApplication
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
import org.json.JSONException
import org.json.JSONObject
import retrofit2.HttpException
object CommentHelper {
@ -42,12 +43,10 @@ object CommentHelper {
dialogOptions.add("查看对话")
}
val dialog: Dialog
dialog = createOptionsSelectDialog(context, dialogOptions) {
DialogUtils.showListDialog(context, dialogOptions, null) {
when (it) {
"回复" -> {
CheckLoginUtils.checkLogin(context) {
context.ifLogin("社区文章详情-评论-回复") {
if (listener != null) {
listener.onCommentCallback(commentEntity)
} else if (!TextUtils.isEmpty(commentEntity.id)) {
@ -60,7 +59,7 @@ object CommentHelper {
"复制" -> copyText(commentEntity.content, context)
"举报" -> CheckLoginUtils.checkLogin(context) {
"举报" -> context.ifLogin("社区文章详情-评论-举报") {
showReportTypeDialog(context) { reportType ->
PostCommentUtils.reportCommunityArticleComment(context, communityId, articleId, commentEntity.id, reportType,
object : PostCommentUtils.PostCommentListener {
@ -85,8 +84,6 @@ object CommentHelper {
}
}
}
dialog.show();
}
@JvmStatic
@ -105,16 +102,24 @@ object CommentHelper {
dialogOptions.add("复制")
dialogOptions.add("举报")
commentEntity.me?.let {
if (it.isModerator && (
it.moderatorPermissions.contains(MeEntity.HIDE_ANSWER_COMMENT)
|| it.moderatorPermissions.contains(MeEntity.TOP_ANSWER_COMMENT))) {
dialogOptions.add("管理")
}
}
if (commentEntity.parentUser != null && showConversation) {
dialogOptions.add("查看对话")
}
val dialog: Dialog
dialog = createOptionsSelectDialog(context, dialogOptions) {
DialogUtils.showListDialog(context, dialogOptions, null) {
when (it) {
"管理" -> showControlDialog(context, answerId, commentEntity, commentEntity.me!!)
"回复" -> {
CheckLoginUtils.checkLogin(context) {
context.ifLogin("回答详情-评论-回复") {
if (listener != null) {
listener.onCommentCallback(commentEntity)
} else if (!TextUtils.isEmpty(commentEntity.id)) {
@ -127,7 +132,7 @@ object CommentHelper {
"复制" -> copyText(commentEntity.content, context)
"举报" -> CheckLoginUtils.checkLogin(context) {
"举报" -> context.ifLogin("回答详情-评论-举报") {
showReportTypeDialog(context) { reportType ->
PostCommentUtils.postAnswerReportData(context, commentEntity.id, answerId, reportType,
object : PostCommentUtils.PostCommentListener {
@ -152,58 +157,141 @@ object CommentHelper {
}
}
}
}
dialog.show();
private fun showControlDialog(context: Context, answerId: String, comment: CommentEntity, me: MeEntity) {
val dialogOptions = arrayListOf<String>()
val highlight = "置顶评论"
val hide = "隐藏评论"
if (me.moderatorPermissions.contains(MeEntity.TOP_ANSWER_COMMENT)) {
dialogOptions.add(highlight)
}
if (me.moderatorPermissions.contains(MeEntity.HIDE_ANSWER_COMMENT)) {
dialogOptions.add(hide)
}
val content = if (me.moderatorLevel == MeEntity.MODERATOR_LEVEL_PRIMARY) {
"你的操作将提交给小编审核,确定提交吗?"
} else {
"你的操作将立即生效,确定提交吗?(你的管理权限为:高级)"
}
val disabledOptions = arrayListOf<String>()
if (comment.priority != 0) {
disabledOptions.add(highlight)
}
comment.me?.let {
if (it.isAnswerCommented) {
disabledOptions.add(highlight)
}
}
DialogUtils.showListDialog(context, dialogOptions, disabledOptions) {
when (it) {
highlight -> {
if (comment.priority != 0) {
Utils.toast(context, "评论已经置顶")
return@showListDialog
}
comment.me?.let { me ->
if (me.isAnswerCommented) {
Utils.toast(context, "不能置顶自己的评论")
return@showListDialog
}
}
DialogUtils.showAlertDialog(context, highlight, content,
"确定", "取消",
{
RetrofitManager.getInstance(context).api
.highlightAnswerComment(answerId, comment.id)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(object : Response<ResponseBody>() {
override fun onResponse(response: ResponseBody?) {
if (me.moderatorLevel == MeEntity.MODERATOR_LEVEL_PRIMARY) {
Utils.toast(context, "提交成功")
} else {
Utils.toast(context, "置顶成功,请刷新列表")
}
}
override fun onFailure(e: HttpException?) {
super.onFailure(e)
e?.let { httpException ->
if (httpException.code() == 403) {
val string = e.response().errorBody()?.string()
val errorJson = JSONObject(string)
val errorCode = errorJson.getInt("code")
if (errorCode == 403059) {
Utils.toast(getApplication(), "权限错误,请刷新后重试")
return
} else {
Utils.toast(getApplication(), e.message())
}
}
}
}
})
}, null)
}
hide -> {
DialogUtils.showAlertDialog(context, hide, content,
"确定", "取消",
{
RetrofitManager.getInstance(context).api
.hideAnswerComment(answerId, comment.id)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(object : Response<ResponseBody>() {
override fun onResponse(response: ResponseBody?) {
if (me.moderatorLevel == MeEntity.MODERATOR_LEVEL_PRIMARY) {
Utils.toast(context, "提交成功")
} else {
Utils.toast(context, "隐藏成功,请刷新列表")
}
}
override fun onFailure(e: HttpException?) {
super.onFailure(e)
e?.let { httpException ->
if (httpException.code() == 403) {
val string = e.response().errorBody()?.string()
val errorJson = JSONObject(string)
val errorCode = errorJson.getInt("code")
if (errorCode == 403059) {
Utils.toast(getApplication(), "权限错误,请刷新后重试")
return
} else {
Utils.toast(getApplication(), e.message())
}
}
}
}
})
}, null)
}
}
}
}
private fun showReportTypeDialog(context: Context, reportCallback: (reportType: String) -> Unit) {
val reportTypes = arrayListOf("垃圾广告营销", "恶意攻击谩骂", "淫秽色情信息", "违法有害信息", "其它")
val dialog = createOptionsSelectDialog(context, reportTypes) {
DialogUtils.showListDialog(context, reportTypes, null) { text ->
val jsonObject = JSONObject()
try {
jsonObject.put("reason", it)
jsonObject.put("reason", text)
reportCallback.invoke(jsonObject.toString())
} catch (e: JSONException) {
e.printStackTrace()
}
}
dialog.show()
}
private fun createOptionsSelectDialog(
context: Context,
dialogOptions: ArrayList<String>,
clickCallback: (text: String) -> Unit): Dialog {
val dialog = Dialog(context)
val container = LinearLayout(context)
container.orientation = LinearLayout.VERTICAL
container.setBackgroundColor(Color.WHITE)
container.setPadding(0, DisplayUtils.dip2px(context, 12f), 0, DisplayUtils.dip2px(context, 12f))
for (s in dialogOptions) {
val reportTv = TextView(context)
reportTv.text = s
reportTv.textSize = 17f
reportTv.setTextColor(ContextCompat.getColor(context, R.color.title))
reportTv.setBackgroundResource(R.drawable.textview_white_style)
val widthPixels = context.resources.displayMetrics.widthPixels
reportTv.layoutParams = LinearLayout.LayoutParams(widthPixels * 9 / 10,
LinearLayout.LayoutParams.WRAP_CONTENT)
reportTv.setPadding(DisplayUtils.dip2px(context, 20f), DisplayUtils.dip2px(context, 12f),
0, DisplayUtils.dip2px(context, 12f))
container.addView(reportTv)
reportTv.setOnClickListener {
dialog.cancel()
clickCallback.invoke(reportTv.text.toString())
}
}
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setContentView(container)
return dialog
}
}

View File

@ -80,7 +80,10 @@ public class CommentUtils {
}
}
public static void showGameCommentOptions(final Context context, final RatingComment comment, final String gameId) {
public static void showGameCommentOptions(final Context context,
final RatingComment comment,
final String gameId,
final String entrance) {
final Dialog dialog = new Dialog(context);
@ -115,7 +118,7 @@ public class CommentUtils {
copyText(comment.getContent(), context);
break;
case "举报":
CheckLoginUtils.checkLogin(context, () -> showGameCommentReportDialog(gameId, comment, context));
CheckLoginUtils.checkLogin(context, entrance, () -> showGameCommentReportDialog(gameId, comment, context));
break;
}
});
@ -183,9 +186,12 @@ public class CommentUtils {
}
public static void showReportDialog(final CommentEntity commentEntity, final Context context, final boolean showConversation,
final OnCommentCallBackListener listener, final String newsId) {
public static void showReportDialog(final CommentEntity commentEntity,
final Context context,
final boolean showConversation,
final OnCommentCallBackListener listener,
final String newsId,
final String patch) {
final Dialog dialog = new Dialog(context);
LinearLayout container = new LinearLayout(context);
@ -225,7 +231,7 @@ public class CommentUtils {
dialog.cancel();
switch (reportTv.getText().toString()) {
case "回复":
CheckLoginUtils.checkLogin(context, () -> {
CheckLoginUtils.checkLogin(context, patch + "-回复", () -> {
if (listener != null) {
listener.onCommentCallback(commentEntity);
} else if (!TextUtils.isEmpty(newsId)) {
@ -239,7 +245,8 @@ public class CommentUtils {
copyText(commentEntity.getContent(), context);
break;
case "举报":
CheckLoginUtils.checkLogin(context, () -> showReportTypeDialog(commentEntity, context));
CheckLoginUtils.checkLogin(context, patch + "-举报",
() -> showReportTypeDialog(commentEntity, context));
break;
case "查看对话":
@ -442,64 +449,68 @@ public class CommentUtils {
}
public static void postVote(final Context context, final CommentEntity commentEntity,
final TextView commentLikeCountTv, final ImageView commentLikeIv, final OnVoteListener listener) {
CheckLoginUtils.checkLogin(context, () -> {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme)) {
Utils.toast(context, "已经点过赞啦!");
return;
}
commentEntity.setVote(commentEntity.getVote() + 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.theme));
commentLikeIv.setImageResource(R.drawable.vote_icon_select);
commentLikeCountTv.setText(String.valueOf(commentEntity.getVote()));
commentLikeCountTv.setVisibility(View.VISIBLE);
final TextView commentLikeCountTv, final ImageView commentLikeIv,
final OnVoteListener listener) {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme)) {
Utils.toast(context, "已经点过赞啦!");
return;
}
commentEntity.setVote(commentEntity.getVote() + 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.theme));
commentLikeIv.setImageResource(R.drawable.vote_icon_select);
commentLikeCountTv.setText(String.valueOf(commentEntity.getVote()));
commentLikeCountTv.setVisibility(View.VISIBLE);
PostCommentUtils.addCommentVote(context, commentEntity.getId(),
new PostCommentUtils.PostCommentListener() {
@Override
public void postSuccess(JSONObject response) {
if (listener != null) {
listener.onVote();
}
PostCommentUtils.addCommentVote(context, commentEntity.getId(),
new PostCommentUtils.PostCommentListener() {
@Override
public void postSuccess(JSONObject response) {
if (listener != null) {
listener.onVote();
}
}
@Override
public void postFailed(Throwable e) {
commentEntity.setVote(commentEntity.getVote() - 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
commentLikeIv.setImageResource(R.drawable.vote_icon_unselect);
commentLikeCountTv.setText(String.valueOf(commentEntity.getVote()));
if (commentEntity.getVote() == 0) {
commentLikeCountTv.setVisibility(View.GONE);
} else {
commentLikeCountTv.setVisibility(View.VISIBLE);
}
@Override
public void postFailed(Throwable e) {
commentEntity.setVote(commentEntity.getVote() - 1);
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
commentLikeIv.setImageResource(R.drawable.vote_icon_unselect);
commentLikeCountTv.setText(String.valueOf(commentEntity.getVote()));
if (commentEntity.getVote() == 0) {
commentLikeCountTv.setVisibility(View.GONE);
} else {
commentLikeCountTv.setVisibility(View.VISIBLE);
}
if (e instanceof HttpException) {
HttpException exception = (HttpException) e;
if (exception.code() == 403) {
try {
String detail = new JSONObject(exception.response().errorBody().string()).getString("detail");
if ("voted".equals(detail)) {
Utils.toast(context, "已经点过赞啦!");
}
} catch (Exception ex) {
ex.printStackTrace();
if (e instanceof HttpException) {
HttpException exception = (HttpException) e;
if (exception.code() == 403) {
try {
String detail = new JSONObject(exception.response().errorBody().string()).getString("detail");
if ("voted".equals(detail)) {
Utils.toast(context, "已经点过赞啦!");
}
return;
} catch (Exception ex) {
ex.printStackTrace();
}
return;
}
Utils.toast(context, "网络异常,点赞失败");
}
});
});
Utils.toast(context, "网络异常,点赞失败");
}
});
}
public static void postVoteToAnswerComment(final Context context, String answerId, String articleId,
String articleCommunityId, final CommentEntity commentEntity,
final TextView commentLikeCountTv, final ImageView commentLikeIv, final OnVoteListener listener) {
CheckLoginUtils.checkLogin(context, () -> {
String entrance = "回答详情-评论-点赞";
if (TextUtils.isEmpty(articleId)) {
entrance = "社区文章详情-评论-点赞";
}
CheckLoginUtils.checkLogin(context, entrance, () -> {
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.theme)) {
Utils.toast(context, "已经点过赞啦!");
return;

View File

@ -142,12 +142,11 @@ object CompressImageUtils {
}
fun getImageSetting(): SettingsEntity.Image {
var settings = Config.getSettings()
val settings = Config.getSettings()
if (settings == null && settings?.image != null) {
return settings.image
return settings.image!!
}
settings = SettingsEntity()
val image = settings.Image()
val image = SettingsEntity.Image()
image.processLimitSize = compressLimitSize
image.size = defaultCompressBorder
image.ratio = defaultRatio

View File

@ -1,6 +1,7 @@
package com.gh.common.util
import android.content.Context
import android.text.TextUtils
import com.gh.gamecenter.eventbus.EBConcernChanged
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.retrofit.Response
@ -20,9 +21,14 @@ import retrofit2.HttpException
*/
object ConcernUtils {
fun postConcernGameId(context: Context, gameId: String, listener: onConcernListener?) {
RetrofitManager.getInstance(context).getApi()
.postConcern(UserManager.getInstance().userId, gameId)
fun postConcernGameId(context: Context, gameId: String, listener: onConcernListener?, autoConcern: Boolean = false) {
val mode = if (autoConcern) "auto" else "manual"
val userId = UserManager.getInstance().userId
if (TextUtils.isEmpty(userId)) return
RetrofitManager.getInstance(context).api
.postConcern(UserManager.getInstance().userId, gameId, mode)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<ResponseBody>() {
@ -40,7 +46,7 @@ object ConcernUtils {
}
fun deleteConcernData(context: Context, gameId: String, listener: onConcernListener?) {
RetrofitManager.getInstance(context).getApi()
RetrofitManager.getInstance(context).api
.deleteConcern(UserManager.getInstance().userId, gameId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@ -61,7 +67,7 @@ object ConcernUtils {
fun updateConcernData(context: Context, data: JSONArray) {
val body = RequestBody.create(MediaType.parse("application/json"),
data.toString())
RetrofitManager.getInstance(context).getApi()
RetrofitManager.getInstance(context).api
.putConcern(UserManager.getInstance().userId, body)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
@ -73,7 +79,7 @@ object ConcernUtils {
}
fun deleteConcernQuestions(context: Context, questionsId: String, listener: onConcernListener?) {
RetrofitManager.getInstance(context).getApi()
RetrofitManager.getInstance(context).api
.deleteConcernQuestions(UserManager.getInstance().userId, questionsId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@ -92,7 +98,7 @@ object ConcernUtils {
}
fun postConcernQuestions(context: Context, questionsId: String, listener: onConcernListener?) {
RetrofitManager.getInstance(context).getApi()
RetrofitManager.getInstance(context).api
.postConcernQuestions(UserManager.getInstance().userId, questionsId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@ -6,7 +6,7 @@ import android.os.Build;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.NewsDetailEntity;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.PackagesManager;
import com.lightgame.download.DownloadEntity;
import org.json.JSONArray;
@ -118,7 +118,7 @@ public class DataCollectionUtils {
Map<String, Object> map = new HashMap<>();
map.put("type", Build.MODEL);
map.put("system", Build.VERSION.SDK_INT + "=" + Build.VERSION.RELEASE);
map.put("install", PackageManager.INSTANCE.getInstalledList());
map.put("install", PackagesManager.INSTANCE.getInstalledList());
DataCollectionManager.upsert(context, "user", map);
}

View File

@ -38,7 +38,7 @@ public class DataLogUtils {
// 上传日志
public static void uploadLog(Context context, String topic, Map<String, Object> map) {
String version = PackageUtils.getPatchVersionName();
String version = PackageUtils.getVersionName();
String user = Installation.getUUID(context);
String channel = HaloApp.getInstance().getChannel();
map.put("version", version);

View File

@ -82,12 +82,11 @@ public class DataUtils {
StatConfig.init(context);
StatConfig.setInstallChannel(channel);
StatConfig.setAntoActivityLifecycleStat(true);
StatConfig.setAppVersion(PackageUtils.getPatchVersionName());
StatConfig.setAppVersion(PackageUtils.getVersionName());
// 开启收集服务
StatService.startStatService(context, Config.MTA_APPKEY, com.tencent.stat.common.StatConstants.VERSION);
StatService.registerActivityLifecycleCallbacks(context);
} catch (MtaSDkException e) {
e.printStackTrace();
}
@ -100,7 +99,7 @@ public class DataUtils {
strategy.setEnableANRCrashMonitor(false);
strategy.setEnableNativeCrashMonitor(false);
strategy.setAppChannel(channel);
strategy.setAppVersion(PackageUtils.getPatchVersionName());
strategy.setAppVersion(PackageUtils.getVersionName());
CrashReport.initCrashReport(context, Config.BUGLY_APPID, false, strategy);

View File

@ -9,7 +9,7 @@ import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.DetailViewHolder;
import com.gh.gamecenter.entity.PluginLocation;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.PackagesManager;
import com.lightgame.download.DownloadEntity;
/**
@ -73,7 +73,7 @@ public class DetailDownloadUtils {
case downloading:
case pause:
viewHolder.mDownloadPb.setText(R.string.downloading);
if (downloadEntity.isPluggable() && PackageManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
if (downloadEntity.isPluggable() && PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.DOWNLOADING_PLUGIN);
} else {
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.DOWNLOADING_NORMAL);
@ -84,7 +84,7 @@ public class DetailDownloadUtils {
case waiting:
case subscribe:
viewHolder.mDownloadPb.setText(R.string.waiting);
if (downloadEntity.isPluggable() && PackageManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
if (downloadEntity.isPluggable() && PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.DOWNLOADING_PLUGIN);
} else {
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.DOWNLOADING_NORMAL);
@ -93,7 +93,7 @@ public class DetailDownloadUtils {
case done:
viewHolder.mDownloadPb.setText(R.string.install);
if (downloadEntity.isPluggable()
&& PackageManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
&& PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.INSTALL_PLUGIN);
} else {
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.INSTALL_NORMAL);

View File

@ -4,8 +4,9 @@ import android.content.Context
import android.os.Environment
import android.preference.PreferenceManager
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.entity.TimeEntity
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.retrofit.StringResponse
import com.halo.assistant.HaloApp
import com.lightgame.utils.Util_System_Phone_State
import com.lightgame.utils.Utils
@ -13,7 +14,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import java.io.File
object DeviceTokenUtils {
const val DEVICE_ID = "uuid"
@ -26,18 +26,13 @@ object DeviceTokenUtils {
RetrofitManager.getInstance(context).api.time
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : StringResponse() {
override fun onResponse(response: String) {
if (response.matches("^[0-9]{10}$".toRegex())) {
try {
val editor = sp.edit()
editor.putLong("server_time", java.lang.Long.parseLong(response))
editor.putLong("client_time", System.currentTimeMillis() / 1000)
editor.apply()
} catch (e: NumberFormatException) {
e.printStackTrace()
}
.subscribe(object : Response<TimeEntity>() {
override fun onResponse(response: TimeEntity?) {
val editor = sp.edit()
response?.time?.let {
editor.putLong("server_time", it)
editor.putLong("client_time", System.currentTimeMillis() / 1000)
editor.apply()
}
}
})
@ -51,18 +46,18 @@ object DeviceTokenUtils {
if (values.isNotEmpty()) {
for (value in values) {
if (value.key.contains("isNewFirstLaunchV")) {
lunchType = LunchType.update
lunchType = LunchType.UPDATE
break
}
}
}
// 再次重装
if (lunchType == null && !getDeviceId().isNullOrEmpty()) {
lunchType = LunchType.again
lunchType = LunchType.AGAIN
}
// 首次安装
if (lunchType == null) {
lunchType = LunchType.first
lunchType = LunchType.FIRST
}
// 保存deviceId
var deviceId = Util_System_Phone_State.getDeviceId(HaloApp.getInstance().application)
@ -133,7 +128,7 @@ object DeviceTokenUtils {
}
enum class LunchType {
first,
update,
again
FIRST,
UPDATE,
AGAIN
}

View File

@ -128,6 +128,20 @@ public class DeviceUtils {
return builder.toString();
}
public static String getUserAgent() {
String userAgent = "";
userAgent = System.getProperty("http.agent");
StringBuffer sb = new StringBuffer();
for (int i = 0, length = userAgent.length(); i < length; i++) {
char c = userAgent.charAt(i);
if (c <= '\u001f' || c >= '\u007f') {
sb.append(String.format("\\u%04x", (int) c));
} else {
sb.append(c);
}
}
return sb.toString();
}
public static String getIPAddress(Context context) {
NetworkInfo info = ((ConnectivityManager) context

View File

@ -7,6 +7,7 @@ import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Handler;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
@ -328,7 +329,6 @@ public class DialogUtils {
}
public static void showWarningDialog(Context context, String title, CharSequence msg, final ConfirmListener listener) {
//TODO fix this
if (!(context instanceof Activity)) {
return;
}
@ -781,6 +781,62 @@ public class DialogUtils {
dialog.show();
}
public static void showListDialog(Context context,
List<String> selectionList,
DialogInterface.OnClickListener onClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
String[] selectionArray = new String[selectionList.size()];
selectionArray = selectionList.toArray(selectionArray);
builder.setItems(selectionArray, onClickListener);
AlertDialog dialog = builder.create();
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.show();
}
/**
* @param options 供以显示的选项
* @param disabledOptions 显示为灰色的选项(是 options 的子集)
*/
public static void showListDialog(Context context,
List<String> options,
List<String> disabledOptions,
OptionCallback callback) {
Dialog dialog = new Dialog(context);
LinearLayout container = new LinearLayout(context);
container.setOrientation(LinearLayout.VERTICAL);
container.setBackgroundColor(Color.WHITE);
container.setPadding(0, DisplayUtils.dip2px(context, 12f), 0, DisplayUtils.dip2px(context, 12f));
for (String option : options) {
TextView reportTv = new TextView(context);
reportTv.setText(option);
reportTv.setTextSize(17f);
if (disabledOptions != null && disabledOptions.contains(option)) {
reportTv.setTextColor(ContextCompat.getColor(context, R.color.btn_gray));
} else {
reportTv.setTextColor(ContextCompat.getColor(context, R.color.title));
reportTv.setBackgroundResource(R.drawable.textview_white_style);
}
int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
reportTv.setLayoutParams(new LinearLayout.LayoutParams(widthPixels * 9 / 10,
LinearLayout.LayoutParams.WRAP_CONTENT));
reportTv.setPadding(DisplayUtils.dip2px(context, 20f), DisplayUtils.dip2px(context, 12f),
0, DisplayUtils.dip2px(context, 12f));
container.addView(reportTv);
reportTv.setOnClickListener(v -> {
dialog.cancel();
callback.onClicked(reportTv.getText().toString());
});
}
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(container);
dialog.show();
}
public interface ConfirmListener {
void onConfirm();
}
@ -789,6 +845,9 @@ public class DialogUtils {
void onCancel();
}
public interface OptionCallback {
void onClicked(String text);
}
public interface CheckDownloadCallBack {
void onResponse(boolean isSubscribe);

View File

@ -22,7 +22,7 @@ import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity
import com.gh.gamecenter.qa.column.detail.AskColumnDetailActivity
import com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity
import com.gh.gamecenter.qa.subject.CommunitySubjectActivity
import com.gh.gamecenter.subject.refactor.SubjectActivity
import com.gh.gamecenter.subject.SubjectActivity
import com.gh.gamecenter.suggest.SuggestType
import com.lightgame.utils.Util_System_ClipboardManager
import com.lightgame.utils.Utils
@ -92,6 +92,8 @@ object DirectUtils {
"web" -> directToWebView(context, url = linkEntity.link!!, entrance = entrance)
"qq" -> directToQqConversation(context, linkEntity.link)
else -> DialogUtils.showLowVersionDialog(context)
}
}
@ -175,7 +177,6 @@ object DirectUtils {
bundle.putString(KEY_GAMEID, gameId)
bundle.putString(KEY_PACKAGENAME, packageName)
bundle.putInt(BaseFragment_TabLayout.PAGE_INDEX, INDEX_UPDATE)
bundle.putBoolean(KEY_AUTO_UPDATE, true)
EntranceUtils.jumpActivity(context, bundle)
}

View File

@ -21,6 +21,7 @@ object DownloadHelper {
RetrofitManager.getInstance(HaloApp.getInstance().application)
.api
.getGameDigest(gameId)
.map(ApkActiveUtils.filterMapper)
.subscribeOn(Schedulers.io())
.subscribe(object : Response<GameEntity>() {
override fun onResponse(response: GameEntity?) {

View File

@ -22,7 +22,7 @@ import com.gh.gamecenter.adapter.viewholder.GameViewHolder;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.PluginLocation;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.PackagesManager;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
@ -69,7 +69,7 @@ public class DownloadItemUtils {
// adapter.notifyItemChanged(index);
// }
} else {
if (!queue.contains(platform)) {
if (!queue.contains(platform) && !TextUtils.isEmpty(platform)) {
queue.offer(platform);
if (AppDebugConfig.IS_DEBUG) {
AppDebugConfig.logMethodWithParams(DownloadItemUtils.class, queue.size(), gameEntity.getBrief(), downloadEntity.getPlatform(), index);
@ -159,6 +159,7 @@ public class DownloadItemUtils {
// 更新插件的条目有多个apk包
private static void updatePluginItem(Context context, GameViewHolder holder, GameEntity gameEntity,
boolean isShowPlatform, PluginLocation pluginLocation) {
GameUtils.setDownloadBtnStatus(context, gameEntity, holder.gameDownloadBtn, pluginLocation);
ArrayMap<String, DownloadEntity> entryMap = gameEntity.getEntryMap();
if (entryMap != null && !entryMap.isEmpty()) {
@ -177,8 +178,6 @@ public class DownloadItemUtils {
}
}
GameUtils.setDownloadBtnStatus(context, gameEntity, holder.gameDownloadBtn, pluginLocation);
holder.gameDes.setVisibility(View.VISIBLE);
holder.gameProgressbar.setVisibility(View.GONE);
holder.gameInfo.setVisibility(View.GONE);
@ -258,10 +257,10 @@ public class DownloadItemUtils {
holder.gameDownloadPercentage.setText(R.string.hundred_percent);
if (isNormal) {
holder.gameDownloadBtn.setText("安装");
holder.gameDownloadBtn.setText(R.string.install);
holder.gameDownloadBtn.setTextColor(Color.WHITE);
if (downloadEntity.isPluggable()
&& PackageManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
&& PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
} else {
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
@ -316,43 +315,34 @@ public class DownloadItemUtils {
final String entrance,
final String location,
@Nullable final ExposureEvent traceEvent) {
String str = downloadBtn.getText().toString();
switch (str) {
case "下载":
DialogUtils.checkDownload(context, gameEntity.getApk().get(0).getSize(),
isSubscribe -> download(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
break;
case "插件化":
if (entrance.contains("我的游戏")) {
DataUtils.onMtaEvent(context, "我的游戏_启动", "插件化", gameEntity.getName());
}
DialogUtils.checkDownload(context, gameEntity.getApk().get(0).getSize(),
isSubscribe -> plugin(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
break;
case "安装":
install(context, gameEntity, position, adapter);
break;
case "启动":
if (entrance.contains("我的游戏")) {
DataUtils.onMtaEvent(context, "我的游戏_启动", "启动", gameEntity.getName());
}
DataUtils.onGameLaunchEvent(context, gameEntity.getName(), gameEntity.getApk().get(0).getPlatform(), location);
PackageUtils.launchApplicationByPackageName(context, gameEntity.getApk().get(0).getPackageName());
break;
case "等待中":
case "下载中":
context.startActivity(
DownloadManagerActivity.getDownloadMangerIntent(context, gameEntity.getApk().get(0).getUrl(), entrance + "+(" + location.split(":")[0] + ")"));
break;
case "更新":
if (entrance.contains("我的游戏")) {
DataUtils.onMtaEvent(context, "我的游戏_启动", "更新", gameEntity.getName());
}
DialogUtils.checkDownload(context, gameEntity.getApk().get(0).getSize(),
isSubscribe -> update(context, gameEntity, entrance, location, isSubscribe, traceEvent));
break;
if (str.equals(context.getString(R.string.download))) {
DialogUtils.checkDownload(context, gameEntity.getApk().get(0).getSize(),
isSubscribe -> download(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
} else if (str.equals(context.getString(R.string.pluggable))) {
if (entrance.contains("我的游戏")) {
DataUtils.onMtaEvent(context, "我的游戏_启动", "插件化", gameEntity.getName());
}
DialogUtils.checkDownload(context, gameEntity.getApk().get(0).getSize(),
isSubscribe -> plugin(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
} else if (str.equals(context.getString(R.string.install))) {
install(context, gameEntity, position, adapter);
} else if (str.equals(context.getString(R.string.launch))) {
if (entrance.contains("我的游戏")) {
DataUtils.onMtaEvent(context, "我的游戏_启动", "启动", gameEntity.getName());
}
DataUtils.onGameLaunchEvent(context, gameEntity.getName(), gameEntity.getApk().get(0).getPlatform(), location);
PackageUtils.launchApplicationByPackageName(context, gameEntity.getApk().get(0).getPackageName());
} else if (str.equals(context.getString(R.string.waiting))
|| str.equals(context.getString(R.string.downloading))) {
context.startActivity(DownloadManagerActivity.getDownloadMangerIntent(context,
gameEntity.getApk().get(0).getUrl(), entrance + "+(" + location.split(":")[0] + ")"));
} else if (str.equals(context.getString(R.string.update))) {
if (entrance.contains("我的游戏")) {
DataUtils.onMtaEvent(context, "我的游戏_启动", "更新", gameEntity.getName());
}
DialogUtils.checkDownload(context, gameEntity.getApk().get(0).getSize(),
isSubscribe -> update(context, gameEntity, entrance, location, isSubscribe, traceEvent));
}
}

View File

@ -82,7 +82,7 @@ public class EntranceUtils {
public static final String KEY_MESSAGE_TYPE = "messageType";
public static final String KEY_QUESTIONS_SEARCH_KEY = "questionsSearchKey";
public static final String KEY_SHOW_ANSWER_COMMENT = "showAnswerComment";
public static final String KEY_RECOMMENDS_ANSWER = "isRecommendsAnswer";
public static final String KEY_RECOMMENDS_CONTENTS = "isRecommendsContents";
public static final String KEY_VERSION_UPDATE = "versionUpdate";
public static final String KEY_CHECK_QUESTION_CONCERN = "check_question_concern";
public static final String KEY_DRAFT_ID = "draft_id";
@ -103,13 +103,15 @@ public class EntranceUtils {
public static final String KEY_QUESTION_TAG = "question_tag";
public static final String KEY_COLUMN_ID = "column_id";
public static final String KEY_AUTO_DOWNLOAD = "auto_download";
public static final String KEY_AUTO_UPDATE = "auto_update";
public static final String KEY_HIDE_SUGGEST_HINT = "hide_suggest_hint";
public static final String KEY_COMMUNITY_ARTICLE_ID = "communityArticleId";
public static final String KEY_ARTICLE_COMMENT_ID = "articleCommentId";
public static final String KEY_DEVICE_NAME = "deviceName";
public static final String KEY_SHOW_ARTICLE_COMMENT = "showArticleComment";
public static final String KEY_RATING_STAR_COUNT = "ratingStarCount";
public static final String KEY_QUESTION_MODERATOR_PATCH = "questionModeratorPatch";
public static final String KEY_SKIP_GAME_COMMENT = "skipGameComment";
public static final String KEY_OPEN_PLATFORM_WINDOW = "openPlatformWindow";
public static void jumpActivity(Context context, Bundle bundle) {

View File

@ -0,0 +1,103 @@
package com.gh.common.util
import android.content.Context
import com.gh.gamecenter.R
import com.gh.gamecenter.entity.ErrorEntity
import com.lightgame.utils.Utils
/**
* 这个类用来管理一些错误像弹窗、TOAST 什么的
*/
object ErrorHelper {
/***
* 禁言错误,
*403050 评论回答
*403051 评论资讯文章
*403055 评论社区文章
*403048 发表回答
*403053 发表社区文章
*403049 发布问题
*403046 编辑回答
*403045 编辑答案
*403057 游戏评论
*403054 更新社区文章
*403047 回答点赞
*/
/**
* [important] 用来标识有同样错误码可以触发两种处理时,为 true 时选择重要的
*/
fun handleError(context: Context, errorString: String?, important: Boolean = false) {
val errorEntity = errorString?.toObject<ErrorEntity>()
if (errorEntity == null) {
Utils.toast(context, R.string.post_failure_hint)
return
}
if (!errorEntity.toast.isNullOrEmpty()) {
Utils.toast(context, errorEntity.toast)
return
}
when (errorEntity.code) {
403050,
403051,
403055,
403048,
403053,
403049,
403046,
403045,
403057,
403054,
403047 -> handleErrorWithBannedDialog(context, errorEntity)
403001 -> Utils.toast(context, "标签名称太长了")
403002 -> Utils.toast(context, "已经被邀请了")
403003 -> Utils.toast(context, "每天最多可以邀请10次")
403004 -> Utils.toast(context, "客户端提供的ID无效空/无效ID")
403005 -> Utils.toast(context, "已经回答过了(限制频率)")
403006 -> Utils.toast(context, "图片数量达到限制点")
403007 -> Utils.toast(context, "不合法的用户")
403008 -> Utils.toast(context, "已投票")
403009 -> Utils.toast(context, "已经收藏过了")
403010 -> Utils.toast(context, "无效的标签栏")
403011 -> Utils.toast(context, "标题内容过长")
403012 -> Utils.toast(context, "描述内容过长")
403013 -> Utils.toast(context, "无效的标签")
403014 -> Utils.toast(context, "标签数量太多了")
403015 -> Utils.toast(context, "已经关注过了")
404001 -> Utils.toast(context, "请求的资源不存在")
403018 -> Utils.toast(context, R.string.comment_failed_unable)
403020 -> if (important!!) {
DialogUtils.showAlertDialog(context,
"限制提醒",
"提问过于频繁,请先休息一下哦",
"知道了", null, null, null)
} else {
Utils.toast(context, R.string.comment_failed_toofrequent)
}
403021 -> Utils.toast(context, R.string.comment_failed_illegal)
else -> Utils.toast(context, R.string.post_failure_hint)
}
}
private fun handleErrorWithBannedDialog(context: Context, errorEntity: ErrorEntity) {
val bannedType = if (errorEntity.data?.alwaysBlock!!) {
""
} else {
"(非永久)"
}
DialogUtils.showAlertDialog(context,
"提示",
"你因违反《问答版块规则》,已被禁言$bannedType如有疑问请联系客服QQ3467475980",
"关闭", null, null, null)
}
}

View File

@ -1,14 +1,12 @@
package com.gh.common.util
import android.app.Activity
import android.app.Application
import android.arch.lifecycle.ViewModel
import android.arch.lifecycle.ViewModelProvider
import android.arch.lifecycle.ViewModelProviders
import android.os.Bundle
import android.arch.lifecycle.*
import android.content.Context
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import android.support.v4.view.ViewPager
import android.view.View
import com.google.gson.reflect.TypeToken
/**
* 创建以 activity 为观察者上下文的 viewModel
@ -50,31 +48,54 @@ fun ViewPager.addOnPageChangeListener(onSelected: ((position: Int) -> Unit)? = n
addOnPageChangeListener(listener)
}
fun Application.ActivityLifecycleCallbacks(callBack: () -> Unit) {
val listener = object : Application.ActivityLifecycleCallbacks {
override fun onActivityStarted(activity: Activity?) {
/**
* LiveData Extensions
*/
fun <T> LiveData<T?>.observeNonNull(owner: LifecycleOwner, callback: (T) -> Unit) {
observe(owner, Observer { value ->
if (value != null) {
callback(value)
}
})
}
override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {
}
/**
* Login related extensions
*/
fun Fragment.ifLogin(entrance: String, action: (() -> Unit)? = null) {
requireContext().ifLogin(entrance, action)
}
override fun onActivityStopped(activity: Activity?) {
}
fun Context.ifLogin(entrance: String, action: (() -> Unit)? = null) {
CheckLoginUtils.checkLogin(this, entrance, action)
}
override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
}
override fun onActivityPaused(activity: Activity?) {
}
override fun onActivityResumed(activity: Activity?) {
}
override fun onActivityDestroyed(activity: Activity?) {
}
/**
* Gson related extensions.
*/
inline fun <reified T : Any> String.toObject(): T? {
return try {
GsonUtils.gson.fromJson(this, object : TypeToken<T>() {}.type)
} catch (e: Exception) {
e.printStackTrace()
null
}
registerActivityLifecycleCallbacks(listener)
}
inline fun <reified T : Any> T.toJson(): String {
return GsonUtils.toJson(this)
}
/**
* 快速点击两下
*/
fun fastDoubleClickAction(id: Int, interval: Long = 300, action: (() -> Unit)? = null) {
if (ClickUtils.isFastDoubleClick(id, interval)) {
action?.invoke()
}
}
fun View.fastDoubleClickAction(interval: Long, action: (() -> Unit)? = null) {
fastDoubleClickAction(id, interval, action)
}

View File

@ -0,0 +1,113 @@
package com.gh.common.util
import android.content.Context
import android.text.TextUtils
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import io.reactivex.schedulers.Schedulers
/**
* 首页补充游戏库辅助类
*/
object GameRepositoryHelper {
private const val KEY_GAME_REPOSITORY = "game_repository"
// TODO 会有多线程操作问题(在此列表获取补充游戏数据时进行下拉刷新修改此列表)
var gameCollectionList: List<SubjectEntity> = arrayListOf()
init {
loadSavedRepository()
}
/**
* 获取游戏补充库
*/
@JvmStatic
fun getGameRepository(context: Context) {
// Test only
// RetrofitManager.getInstance(context)
// .api
// .remenkapai
// .subscribeOn(Schedulers.io())
// .subscribe(object : Response<List<GameEntity>>() {
// override fun onResponse(response: List<GameEntity>?) {
// val subjectEntityList = arrayListOf<SubjectEntity>()
// val subjectEntity = SubjectEntity(id = "5ac46cca2924bc2870438d28")
// subjectEntity.data = ArrayList(response)
// subjectEntityList.add(subjectEntity)
// updateGameRepository(subjectEntityList)
// }
// })
RetrofitManager.getInstance(context)
.api
.reserveColumns
.subscribeOn(Schedulers.io())
.subscribe(object : Response<List<SubjectEntity>>() {
override fun onResponse(response: List<SubjectEntity>?) {
super.onResponse(response)
updateGameRepository(response)
}
})
}
/**
* 刷新内存中的游戏库(即从 SP 中再读一次)
*/
@JvmStatic
fun refreshGameRepository() = loadSavedRepository()
private fun loadSavedRepository() {
gameCollectionList = SPUtils.getString(KEY_GAME_REPOSITORY).toObject() ?: arrayListOf()
}
fun updateGameRepository(subjects: List<SubjectEntity>?) {
if (subjects == null) return
SPUtils.setString(KEY_GAME_REPOSITORY, subjects.toJson())
gameCollectionList = subjects
}
/**
* 从补充游戏库相应的专题中取出一个与其它游戏都不相同的游戏,为空时即为游戏用完或不存在该相应专题
* @param collectionId 补充游戏库相应专题 ID
* @param gameIdList 该专题里已经包含的游戏 ID 列表
*/
fun getOneUniqueGame(collectionId: String?, gameIdList: List<String>): GameEntity? {
collectionId?.let {
val collection = gameCollectionList.find { it.id == collectionId }
// Test only
// val collection = gameCollectionList.find { it.id == "5ac46cca2924bc2870438d28" }
collection?.let {
val game = collection.data?.find { game -> findUniqueGame(game, gameIdList) }
game?.let {
collection.data?.remove(game)
return game
}
}
}
return null
}
private fun findUniqueGame(game: GameEntity, gameIdList: List<String>): Boolean {
for (apk in game.getApk()) {
// 检查本地是否已安装该游戏,已过滤那部分框架服务的包名
if (PackageHelper.validLocalPackageNameSet.contains(apk.packageName)) {
return false
}
}
return !gameIdList.contains(game.id) && !TextUtils.isEmpty(game.id)
}
}

View File

@ -6,14 +6,15 @@ import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.widget.TextView;
import com.gh.common.constant.Config;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameCollectionEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.entity.PluginLocation;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.entity.SettingsEntity;
import com.gh.gamecenter.manager.PackagesManager;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
@ -71,15 +72,18 @@ public class GameUtils {
int installCount = 0; // 已安装数量
DownloadEntity downloadEntity;
Object gh_id;
apkFor:
for (ApkEntity apkEntity : gameEntity.getApk()) {
// 去除下载合集判断
boolean isCollection = false;
for (GameCollectionEntity collectionEntity : gameEntity.getCollection()) {
if (collectionEntity.getPackage().contains(apkEntity.getPackageName()))
isCollection = true;
// filter by packageName
SettingsEntity settings = Config.getSettings();
if (settings != null && gameEntity.getApk().size() > 1) {
for (String pkgName : settings.getGameDownloadBlackList()) {
if (pkgName.equals(apkEntity.getPackageName())) {
continue apkFor;
}
}
}
if (isCollection) continue;
downloadEntity = DownloadManager.getInstance(context).getDownloadEntityByUrl(apkEntity.getUrl());
if (downloadEntity != null) {
@ -91,10 +95,10 @@ public class GameUtils {
updateCount++;
}
}
if (PackageManager.INSTANCE.isCanUpdate(gameEntity.getId(), apkEntity.getPackageName())) {
if (PackagesManager.INSTANCE.isCanUpdate(gameEntity.getId(), apkEntity.getPackageName())) {
updateCount++;
}
if (PackageManager.INSTANCE.isInstalled(apkEntity.getPackageName())) {
if (PackagesManager.INSTANCE.isInstalled(apkEntity.getPackageName())) {
gh_id = PackageUtils.getMetaData(context, apkEntity.getPackageName(), "gh_id");
if (gameEntity.getTag() != null && gameEntity.getTag().size() != 0
&& !TextUtils.isEmpty(apkEntity.getGhVersion())
@ -107,19 +111,19 @@ public class GameUtils {
}
}
if (doneCount != 0) {
return "安装";
return context.getString(R.string.install);
} else if (pluginCount != 0) {
return "插件化";
return context.getString(R.string.pluggable);
} else if (updateCount != 0) {
return "更新";
return context.getString(R.string.update);
} else if (installCount != 0) {
if (gameEntity.getApk().size() == 1) {
return "启动";
return context.getString(R.string.launch);
} else {
return "打开";
return context.getString(R.string.open);
}
} else {
return "下载";
return context.getString(R.string.download);
}
}

View File

@ -41,7 +41,7 @@ public class GameViewUtils {
if (i == size - 1) {
view = getGameTagView(context, tag.get(i), 0, tagType, tagStyle.size() > i ? tagStyle.get(i) : null);
} else {
view = getGameTagView(context, tag.get(i), DisplayUtils.dip2px(context, 6), tagType, tagStyle.size() > i ? tagStyle.get(i) : null);
view = getGameTagView(context, tag.get(i), DisplayUtils.dip2px(context, 5), tagType, tagStyle.size() > i ? tagStyle.get(i) : null);
}
if (view != null) {
labelLayout.addView(view);
@ -58,7 +58,7 @@ public class GameViewUtils {
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lparams.rightMargin = rightMargin;
TextView tag = new TextView(context);
tag.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
tag.setTextSize(TypedValue.COMPLEX_UNIT_SP, 9);
tag.setSingleLine(true);
tag.setText(tagStr);
if ("官方版".equals(tagStr) || "已关注".equals(tagStr)) {
@ -80,6 +80,7 @@ public class GameViewUtils {
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
tag.setTextColor(Color.WHITE);
}
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(1.5F));
tag.setBackgroundDrawable(gradientDrawable);
} else {
colorStr = TagUtils.getInstance(context).getColor(tagStr);
@ -90,14 +91,15 @@ public class GameViewUtils {
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setColor(Color.TRANSPARENT);
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 0.6f), color);
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(1.5F));
tag.setBackgroundDrawable(gradientDrawable);
tag.setTextColor(color);
}
}
tag.setLayoutParams(lparams);
tag.setPadding(DisplayUtils.dip2px(context, 3),
tag.setPadding(DisplayUtils.dip2px(context, 4),
0,
DisplayUtils.dip2px(context, 3),
DisplayUtils.dip2px(context, 4),
DisplayUtils.dip2px(context, 1));
return tag;
}

View File

@ -0,0 +1,51 @@
package com.gh.common.util
import android.app.Application
import android.text.TextUtils
import com.lightgame.utils.Utils
import com.qq.gdt.action.GDTAction
import org.json.JSONObject
/**
* 广点通辅助类 [https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/403]
*/
object GdtHelper {
const val NETWORK_TYPE = "NETWORK_TYPE"
const val PAGE_TYPE = "PAGE_TYPE"
const val CONTENT_TYPE = "CONTENT_TYPE"
const val CONTENT_ID = "CONTENT_ID"
const val KEYWORD = "KEYWORD"
const val GAME_ID = "GAME_ID"
const val SCORE = "SCORE"
const val PLATFORM = "PLATFORM"
fun init(application: Application) {
GDTAction.init(application, "1108222478", "0b2bb2b971c8221be45a8454f05a0b1f")
}
fun logAction(type: String) {
GDTAction.logAction(type)
Utils.log("GDT", type)
}
fun logAction(type: String, vararg kv: String?) {
try {
val actionParam = JSONObject()
for (i in kv.indices) {
if (i % 2 != 0) {
val key = kv[i - 1]
val value = kv[i]
if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
actionParam.put(key, value)
}
}
}
Utils.log("GDT", "$type + [${kv.joinToString(" , ")}]")
GDTAction.logAction(type, actionParam)
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@ -56,7 +56,7 @@ public class GetLoginDataUtils {
+ "follow_app_official_microblog," + "invitation_write"; // weiboCode
private GetLoginDataUtils(Context context) {
mContext = context.getApplicationContext();
mContext = context;
mTencent = Tencent.createInstance(Config.TENCENT_APPID, mContext); //初始化QQ分享
mIWXAPI = WXAPIFactory.createWXAPI(mContext, Config.WECHAT_APPID, true); //初始化微信分享
@ -68,7 +68,7 @@ public class GetLoginDataUtils {
public static GetLoginDataUtils getInstance(Context context) {
if (instance == null) {
instance = new GetLoginDataUtils(context);
instance = new GetLoginDataUtils(context.getApplicationContext());
}
return instance;
}
@ -172,7 +172,7 @@ public class GetLoginDataUtils {
}
}
public void WCLofinCallBack(JSONObject content) {
public void WCLoginCallBack(JSONObject content) {
if (mLoginListener != null) {
mLoginListener.OnLoginData(content, LoginTag.wechat);
}

View File

@ -1,45 +1,27 @@
package com.gh.common.util
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
/**
* Created by khy on 11/10/17.
*/
class GsonUtils private constructor() {
val mGson: Gson = Gson()
object GsonUtils {
val gson: Gson = Gson()
companion object {
@JvmStatic
fun getInstance(): GsonUtils {
return Inner.anotherSingle
}
private object Inner {
val anotherSingle = GsonUtils()
}
@JvmStatic
fun <T> fromJson(json: String, t: Class<T>): T {
return gson.fromJson(json, t)
}
fun <T> fromJsonBean(json: String, t: Class<T>): T {
return mGson.fromJson(json, t)
// @JvmStatic
// fun <T> fromJsonList(json: String): List<T> {
// val type = object : TypeToken<List<T>>() {}.type
// return gson.fromJson(json, type)
// }
@JvmStatic
fun toJson(any: Any?): String {
return gson.toJson(any)
}
fun <T> fromJsonList(json: String, t: Class<T>): T {
val type = object : TypeToken<List<T>>() {}.type
return mGson.fromJson(json, type)
}
fun toJson(any: Any): String {
return mGson.toJson(any)
}
}
// Use Kotlin Extension to do the same trick.
inline fun <reified T : Any> String.fromObject(): T {
return GsonUtils.getInstance().mGson.fromJson(this, T::class.java)
}
inline fun <reified T : Any> T.toJson(): String {
return GsonUtils.getInstance().mGson.toJson(this)
}

View File

@ -231,12 +231,23 @@ object ImageUtils {
*/
@JvmStatic
fun display(view: SimpleDraweeView?, url: String?) {
val width = view?.layoutParams?.width
if (width != null && width > 0) {
view.setImageURI(getTransformLimitUrl(url, width, view.context))
} else {
view?.post {
view.setImageURI(getTransformLimitUrl(url, view.width, view.context))
url?.let {
// 图片是以 gif 结尾的就
if (it.endsWith(".gif")) {
val controller = Fresco.newDraweeControllerBuilder()
.setUri(url)
.setAutoPlayAnimations(true)
.build()
view?.controller = controller
} else {
val width = view?.layoutParams?.width
if (width != null && width > 0) {
view.setImageURI(getTransformLimitUrl(url, width, view.context))
} else {
view?.post {
view.setImageURI(getTransformLimitUrl(url, view.width, view.context))
}
}
}
}
}

View File

@ -3,7 +3,6 @@ package com.gh.common.util;
import android.app.Dialog;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
@ -11,20 +10,18 @@ import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.LibaoDetailActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.LibaoDetailAdapter;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBUISwitch;
import com.gh.gamecenter.geetest.GeetestListener;
import com.gh.gamecenter.geetest.GeetestUtils;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
@ -36,6 +33,7 @@ import org.greenrobot.eventbus.EventBus;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
@ -216,6 +214,10 @@ public class LibaoUtils {
libaoBtn.setText(R.string.libao_unshelve);
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
break;
case "check":
libaoBtn.setText(R.string.libao_check);
libaoBtn.setBackgroundResource(R.drawable.button_normal_style);
break;
default:
libaoBtn.setBackgroundResource(R.drawable.button_border_gray);
libaoBtn.setText("异常");
@ -229,77 +231,166 @@ public class LibaoUtils {
String status = libaoEntity.getStatus();
setLiBaoBtnStatus(libaoBtn, status, context);
libaoBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CheckLoginUtils.checkLogin(context, () -> {
// 领取限制
if ("领取".equals(libaoBtn.getText().toString()) || "淘号".equals(libaoBtn.getText().toString())) {
if (isInstallRequired && !isAppInstalled(context, libaoEntity.getPackageName())) {
String platform;
if (TextUtils.isEmpty(libaoEntity.getPlatform())) {
platform = "";
} else {
platform = PlatformUtils.getInstance(context)
.getPlatformName(libaoEntity.getPlatform()) + "";
}
libaoBtn.setOnClickListener(v -> {
String btnStatus = libaoBtn.getText().toString();
CheckLoginUtils.checkLogin(context, "礼包详情-[" + btnStatus + "]", () -> {
// 领取限制
String dialogContent = context.getString(R.string.ling_rules_dialog, libaoEntity.getGame().getName(), platform);
DialogUtils.showWarningDialog(context, "条件不符",
Html.fromHtml(dialogContent), "关闭", "立即安装"
, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
adapter.openDownload();
}
}, null);
if ("领取".equals(btnStatus) || "淘号".equals(btnStatus)) {
if (isInstallRequired && !isAppInstalled(context, libaoEntity.getPackageName())) {
String platform;
if (TextUtils.isEmpty(libaoEntity.getPlatform())) {
platform = "";
} else {
platform = PlatformUtils.getInstance(context)
.getPlatformName(libaoEntity.getPlatform());
}
boolean isExistPlatform = false;
ArrayList<ApkEntity> apk = adapter.getGameEntity().getApk();
for (ApkEntity apkEntity : apk) {
if (TextUtils.isEmpty(libaoEntity.getPlatform())) break;
if (libaoEntity.getPlatform().equals(apkEntity.getPlatform())) {
isExistPlatform = true;
break;
}
}
String dialogContent = context.getString(R.string.ling_rules_dialog, libaoEntity.getGame().getName(), platform);
boolean finalIsExistPlatform = isExistPlatform;
DialogUtils.showWarningDialog(context, "条件不符",
Html.fromHtml(dialogContent), isExistPlatform ? "关闭" : null,
isExistPlatform ? "立即安装" : "关闭",
() -> {
if (finalIsExistPlatform) {
adapter.openDownload(libaoEntity.getPlatform());
}
}, null);
return;
}
}
switch (btnStatus) {
case "未开始":
Utils.toast(context, "还没到开始领取时间");
break;
case "查看":
if (!TextUtils.isEmpty(libaoEntity.getDes())) {
DialogUtils.showAlertDialog(v.getContext(), "使用说明",
Html.fromHtml(libaoEntity.getDes()), "关闭", null, null, null);
}
break;
case "再领一个":
case "领取":
if ("repeatLing".equals(status)) {
DialogUtils.showWarningDialog(context, "礼包刷新提醒"
, "礼包每天0点刷新换新区或者换新角色需要继续领取礼包的童鞋请于明天0点之后回来即可[再领一个]"
, null, "知道了", null, null);
} else {
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, null, entrance);
}
break;
case "再淘一个":
case "淘号":
if ("repeatTao".equals(status)) {
Utils.toast(context, "没到重复淘号时间, 礼包每天0点刷新");
return;
}
}
final Dialog loadingDialog = DialogUtils.showWaitDialog(context, "淘号中...");
postLibaoTao(context, libaoEntity.getId(), new PostLibaoListener() {
@Override
public void postSucced(Object response) {
switch (libaoBtn.getText().toString()) {
case "未开始":
Utils.toast(context, "还没到开始领取时间");
break;
case "查看":
Intent intent = LibaoDetailActivity.getIntent(context, libaoEntity, entrance);
context.startActivity(intent);
break;
case "再领一个":
case "领取":
if ("repeatLing".equals(status)) {
DialogUtils.showWarningDialog(context, "礼包刷新提醒"
, "礼包每天0点刷新换新区或者换新角色需要继续领取礼包的童鞋请于明天0点之后回来即可[再领一个]"
, null, "知道了", null, null);
} else {
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, null, entrance);
}
break;
case "再淘一个":
case "淘号":
if ("repeatTao".equals(status)) {
Utils.toast(context, "没到重复淘号时间, 礼包每天0点刷新");
return;
}
final Dialog loadingDialog = DialogUtils.showWaitDialog(context, "淘号中...");
postLibaoTao(context, libaoEntity.getId(), new PostLibaoListener() {
@Override
public void postSucced(Object response) {
if (loadingDialog != null) loadingDialog.dismiss();
if (loadingDialog != null) loadingDialog.dismiss();
JSONObject responseBody = (JSONObject) response;
String libaoCode = null;
try {
libaoCode = responseBody.getString("code");
} catch (JSONException e) {
e.printStackTrace();
}
JSONObject responseBody = (JSONObject) response;
String libaoCode = null;
if (TextUtils.isEmpty(libaoCode)) {
try {
libaoCode = responseBody.getString("code");
String detail = responseBody.getString("detail");
switch (detail) {
case "maintaining":
Utils.toast(context, "网络状态异常,请稍后再试");
break;
case "fail to compete":
Utils.toast(context, "淘号失败,稍后重试");
break;
default:
Utils.toast(context, "淘号异常");
break;
}
} catch (JSONException e) {
e.printStackTrace();
}
return;
}
if (TextUtils.isEmpty(libaoCode)) {
Utils.toast(context, "淘号成功");
libaoEntity.setStatus("taoed");
EventBus.getDefault().post(new EBReuse("libaoChanged"));
adapter.initLibaoCode(new UserDataLibaoEntity(libaoCode, "tao", Utils.getTime(context)));
final String finalLibaoCode = libaoCode;
DialogUtils.showWarningDialog(context, "淘号成功"
, Html.fromHtml(context.getString(R.string.taoed_dialog, libaoCode))
, "关闭", " 复制礼包码"
, () -> {
copyLink(finalLibaoCode, context);
if (isInstallRequired) {
libaoBtn.postDelayed(() -> {
Spanned msg = Html.fromHtml(
context.getString(R.string.taoed_copy_dialog
, finalLibaoCode));
lunningAppDialog(context
, msg, libaoEntity);
}, 300);
}
}, null);
}
@Override
public void postFailed(Throwable error) {
Utils.log("---" + error.toString());
if (loadingDialog != null) loadingDialog.dismiss();
if (error instanceof HttpException) {
HttpException exception = (HttpException) error;
if (exception.code() == 403) {
try {
String detail = responseBody.getString("detail");
JSONObject errorJson = new JSONObject(exception.response().errorBody().string());
String detail = errorJson.getString("detail");
// Utils.toast(context, "返回::" + detail);
switch (detail) {
case "coming":
Utils.toast(context, "礼包领取时间未开始");
break;
case "finish":
Utils.toast(context, "礼包领取时间已结束");
break;
case "fetched":
Utils.toast(context, "你今天已领过这个礼包了, 不能再淘号");
libaoBtn.setText("已淘号");
libaoBtn.setBackgroundResource(R.drawable.libao_taoed_style);
libaoBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.libao_taoed_selector));
libaoEntity.setStatus("taoed");
break;
case "try tao":
case "used up":
DialogUtils.showHintDialog(context, "礼包已领光"
, "手速不够快,礼包已经被抢光了,十分抱歉", "知道了");
break;
case "maintaining":
Utils.toast(context, "网络状态异常,请稍后再试");
break;
@ -307,108 +398,25 @@ public class LibaoUtils {
Utils.toast(context, "淘号失败,稍后重试");
break;
default:
Utils.toast(context, "淘号异常");
Utils.toast(context, "操作失败");
break;
}
} catch (JSONException e) {
e.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
Utils.toast(context, "礼包处理异常" + ex.toString());
}
return;
} else if (exception.code() == 401) {
return;
}
Utils.toast(context, "淘号成功");
libaoEntity.setStatus("taoed");
EventBus.getDefault().post(new EBReuse("libaoChanged"));
adapter.initLibaoCode(new UserDataLibaoEntity(libaoCode, "tao", Utils.getTime(context)));
final String finalLibaoCode = libaoCode;
DialogUtils.showWarningDialog(context, "淘号成功"
, Html.fromHtml(context.getString(R.string.taoed_dialog, libaoCode))
, "关闭", " 复制礼包码"
, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
copyLink(finalLibaoCode, context);
if (isInstallRequired) {
libaoBtn.postDelayed(new Runnable() {
@Override
public void run() {
Spanned msg = Html.fromHtml(
context.getString(R.string.taoed_copy_dialog
, finalLibaoCode));
lunningAppDialog(context
, msg, libaoEntity);
}
}, 300);
}
}
}, null);
}
@Override
public void postFailed(Throwable error) {
Utils.log("---" + error.toString());
if (loadingDialog != null) loadingDialog.dismiss();
if (error instanceof HttpException) {
HttpException exception = (HttpException) error;
if (exception.code() == 403) {
try {
JSONObject errorJson = new JSONObject(exception.response().errorBody().string());
String detail = errorJson.getString("detail");
// Utils.toast(context, "返回::" + detail);
switch (detail) {
case "coming":
Utils.toast(context, "礼包领取时间未开始");
break;
case "finish":
Utils.toast(context, "礼包领取时间已结束");
break;
case "fetched":
Utils.toast(context, "你今天已领过这个礼包了, 不能再淘号");
libaoBtn.setText("已淘号");
libaoBtn.setBackgroundResource(R.drawable.libao_taoed_style);
libaoBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.libao_taoed_selector));
libaoEntity.setStatus("taoed");
break;
case "try tao":
case "used up":
DialogUtils.showHintDialog(context, "礼包已领光"
, "手速不够快,礼包已经被抢光了,十分抱歉", "知道了");
break;
case "maintaining":
Utils.toast(context, "网络状态异常,请稍后再试");
break;
case "fail to compete":
Utils.toast(context, "淘号失败,稍后重试");
break;
default:
Utils.toast(context, "操作失败");
break;
}
} catch (Exception ex) {
ex.printStackTrace();
Utils.toast(context, "礼包处理异常" + ex.toString());
}
return;
} else if (exception.code() == 401) {
return;
}
}
Utils.toast(context, "发生异常");
}
});
break;
}
});
}
Utils.toast(context, "发生异常");
}
});
break;
}
});
});
}
@ -450,20 +458,14 @@ public class LibaoUtils {
final String finalLibaoCode = libaoCode;
DialogUtils.showWarningDialog(context, "领取成功", Html.fromHtml(context.getString(R.string.linged_dialog, libaoCode))
, "关闭", " 复制礼包码"
, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
copyLink(finalLibaoCode, context);
if (isInstallRequired) {
libaoBtn.postDelayed(new Runnable() {
@Override
public void run() {
Spanned msg = Html.fromHtml(context.getString(R.string.linged_copy_dialog, finalLibaoCode));
lunningAppDialog(context
, msg, libaoEntity);
}
}, 300);
}
, () -> {
copyLink(finalLibaoCode, context);
if (isInstallRequired) {
libaoBtn.postDelayed(() -> {
Spanned msg = Html.fromHtml(context.getString(R.string.linged_copy_dialog, finalLibaoCode));
lunningAppDialog(context
, msg, libaoEntity);
}, 300);
}
}, null);
}
@ -524,12 +526,8 @@ public class LibaoUtils {
return;
} else if (exception.code() == 412) {
// 需要验证
GeetestUtils.getInstance().showDialog(context, new GeetestListener() {
@Override
public void onVerified(String captcha) {
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, captcha, entrance);
}
});
GeetestUtils.getInstance().showDialog(context, captcha ->
libaoLing(context, libaoBtn, libaoEntity, adapter, isInstallRequired, captcha, entrance));
return;
} else if (exception.code() == 401) {
return;
@ -557,17 +555,14 @@ public class LibaoUtils {
public static void lunningAppDialog(final Context context, Spanned msg, final LibaoEntity libaoEntity) {
DialogUtils.showWarningDialog(context, "复制成功", msg
, "关闭", "启动游戏"
, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
if (LibaoUtils.isAppInstalled(context, libaoEntity.getPackageName())) {
PackageUtils.launchApplicationByPackageName(context, libaoEntity.getPackageName());
} else {
Utils.toast(context, "请安装游戏:" + libaoEntity.getGame().getName()
+ PlatformUtils.getInstance(context).getPlatformName(libaoEntity.getPlatform()) + "");
}
, () -> {
if (LibaoUtils.isAppInstalled(context, libaoEntity.getPackageName())) {
PackageUtils.launchApplicationByPackageName(context, libaoEntity.getPackageName());
} else {
Utils.toast(context, "请安装游戏:" + libaoEntity.getGame().getName()
+ PlatformUtils.getInstance(context).getPlatformName(libaoEntity.getPlatform()) + "");
}
}, null);
}

View File

@ -6,7 +6,9 @@ import android.os.Build;
import android.provider.Settings;
import android.text.TextUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.CommunityEntity;
import com.gh.gamecenter.entity.SpecialColumn;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.loghub.LogHubUtils;
@ -22,8 +24,12 @@ import org.json.JSONObject;
*/
public class LogUtils {
public static void uploadCommunityArticle(String tracers, String articleId, String articleTitle,
int readTime, CommunityEntity community) {
public static void uploadCommunityArticle(String tracers,
String articleId,
String articleTitle,
int readTime,
CommunityEntity community,
SpecialColumn specialColumn) {
JSONObject object = new JSONObject();
try {
object.put("subject", "community_article");
@ -33,11 +39,22 @@ public class LogUtils {
object.put("article_name", articleTitle);
object.put("tracers", tracers);
object.put("read", readTime);
JSONObject columnObject = new JSONObject();
if (specialColumn != null) {
columnObject.put("type", specialColumn.getType());
columnObject.put("name", specialColumn.getName());
columnObject.put("tab", specialColumn.getTab());
} else {
columnObject.put("type", "");
columnObject.put("name", "");
columnObject.put("tab", "");
}
object.put("special_column", columnObject);
} catch (JSONException e) {
e.printStackTrace();
}
upload(HaloApp.getInstance().getApplication(), object);
upload(object);
}
public static void uploadDevice(LunchType launchType) {
@ -47,54 +64,84 @@ public class LogUtils {
object.put("subject", "halo_device");
object.put("launch_time", Utils.getTime(application));
object.put("launch_type", launchType.name());
object.put("network", DeviceUtils.getNetwork(application));
object.put("device_model", android.os.Build.MODEL);
object.put("manufacture", Build.MANUFACTURER);
object.put("device_system", android.os.Build.VERSION.RELEASE);
} catch (JSONException e) {
e.printStackTrace();
}
upload(application, object);
upload(object);
}
public static void uploadAnswerReadTime(String tracers, int readTime, String answerId, Questions questions) {
public static void uploadAnswerReadTime(String tracers,
int readTime,
String answerId,
Questions questions,
String communityId,
String CommunityName,
SpecialColumn specialColumn) {
JSONObject object = new JSONObject();
try {
object.put("subject", "answer");
object.put("community_id", UserManager.getInstance().getCommunity().getId());
object.put("community_name", UserManager.getInstance().getCommunity().getName());
object.put("community_id", communityId);
object.put("community_name", CommunityName);
object.put("question_id", questions.getId());
object.put("question_name", questions.getTitle());
object.put("tracers", tracers);
object.put("answer_id", answerId);
object.put("read", readTime);
JSONObject columnObject = new JSONObject();
if (specialColumn != null) {
columnObject.put("type", specialColumn.getType());
columnObject.put("name", specialColumn.getName());
columnObject.put("tab", specialColumn.getTab());
} else {
columnObject.put("type", "");
columnObject.put("name", "");
columnObject.put("tab", "");
}
object.put("special_column", columnObject);
} catch (JSONException e) {
e.printStackTrace();
}
upload(HaloApp.getInstance().getApplication(), object);
upload(object);
}
public static void uploadQuestionReadTime(String tracers, int readTime, Questions questions) {
public static void uploadQuestionReadTime(String tracers,
int readTime,
Questions questions,
String communityId,
String communityName,
SpecialColumn specialColumn) {
JSONObject object = new JSONObject();
try {
object.put("subject", "question");
object.put("community_id", UserManager.getInstance().getCommunity().getId());
object.put("community_name", UserManager.getInstance().getCommunity().getName());
object.put("community_id", communityId);
object.put("community_name", communityName);
object.put("question_id", questions.getId());
object.put("question_name", questions.getTitle());
object.put("tracers", tracers);
object.put("read", readTime);
JSONObject columnObject = new JSONObject();
if (specialColumn != null) {
columnObject.put("type", specialColumn.getType());
columnObject.put("name", specialColumn.getName());
columnObject.put("tab", specialColumn.getTab());
} else {
columnObject.put("type", "");
columnObject.put("name", "");
columnObject.put("tab", "");
}
object.put("special_column", columnObject);
} catch (JSONException e) {
e.printStackTrace();
}
upload(HaloApp.getInstance().getApplication(), object);
upload(object);
}
public static void uploadSearch(Context context, String searchKey) {
if (TextUtils.isEmpty(searchKey) || context == null) return;
public static void uploadSearch(String searchKey) {
if (TextUtils.isEmpty(searchKey)) return;
JSONObject object = new JSONObject();
try {
@ -106,12 +153,11 @@ public class LogUtils {
e.printStackTrace();
}
upload(context, object);
upload(object);
}
public static void communityRefresh(Context context, int dataCount, boolean manualRefresh) {
if (context == null) return;
public static void communityRefresh(int dataCount, boolean manualRefresh) {
JSONObject object = new JSONObject();
try {
object.put("subject", "community_refresh");
@ -119,46 +165,44 @@ public class LogUtils {
object.put("refresh_type", "recommend");
object.put("refresh_way", manualRefresh ? "manual" : "auto");
object.put("data_count", dataCount);
object.put("user_id", UserManager.getInstance().getUserId());
object.put("network", DeviceUtils.getNetwork(context));
object.put("version", PackageUtils.getPatchVersionName());
object.put("channel", HaloApp.getInstance().getChannel());
object.put("android_id", Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID));
object.put("imei", Util_System_Phone_State.getDeviceId(context));
object.put("device_system", android.os.Build.VERSION.RELEASE);
object.put("device_model", android.os.Build.MODEL);
object.put("time", Utils.getTime(context));
} catch (JSONException e) {
e.printStackTrace();
}
upload(context, object);
upload(object);
}
public static void login(Context context, String loginStep, String loginType) {
if (context == null) return;
public static void login(String loginStep, String loginType, String entrance) {
JSONObject object = new JSONObject();
try {
object.put("entrance", entrance);
object.put("subject", "login");
object.put("step", loginStep);
object.put("login_type", loginType);
object.put("network", DeviceUtils.getNetwork(context));
} catch (JSONException e) {
e.printStackTrace();
}
upload(context, object);
upload(object);
}
private static void upload(Context context, JSONObject object) {
if (context == null) return;
private static void upload(JSONObject object) {
if (BuildConfig.DEBUG) {
Utils.log("LogUtils->" + object.toString());
}
Context context = HaloApp.getInstance().getApplication();
try {
object.put("version", PackageUtils.getPatchVersionName());
object.put("version", PackageUtils.getVersionName());
object.put("channel", HaloApp.getInstance().getChannel());
object.put("android_id", Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID));
object.put("imei", Util_System_Phone_State.getDeviceId(context));
object.put("time", Utils.getTime(context));
object.put("network", DeviceUtils.getNetwork(context));
object.put("user_id", UserManager.getInstance().getUserId());
object.put("device_system", android.os.Build.VERSION.RELEASE);
object.put("device_model", android.os.Build.MODEL);
object.put("imei", Util_System_Phone_State.getImei(HaloApp.getInstance().getApplication()));
object.put("G_ID", UserManager.getInstance().getDeviceId());
} catch (JSONException e) {
e.printStackTrace();
}

View File

@ -106,6 +106,10 @@ public class LoginUtils {
});
}
/**
* 请用 ErrorHelper.handleError 替代本方法
*/
@Deprecated
public static void userPostErrorToast(String errorString, Context context, boolean isQuestion) {
if (TextUtils.isEmpty(errorString)) {
Utils.toast(context, R.string.post_failure_hint);
@ -159,7 +163,7 @@ public class LoginUtils {
Utils.toast(context, R.string.post_failure_hint);
break;
}
} catch (JSONException e) {
} catch (Exception e) {
Utils.toast(context, R.string.post_failure_hint);
e.printStackTrace();
}

View File

@ -255,6 +255,11 @@ public class MessageShareUtils {
private void wechatSahre() {
Utils.toast(mContext, "分享跳转中...");
if (!PackageHelper.INSTANCE.getLocalPackageNameSet().contains("com.tencent.mm")) {
Utils.toast(mContext, "没安装微信,分享失败");
return;
}
//官方分享
// WXImageObject imgObj = new WXImageObject();
// imgObj.setImagePath(mContext.getExternalCacheDir().getPath() + "/ShareImg/" + picName);
@ -286,6 +291,11 @@ public class MessageShareUtils {
private void wechatMomentsSahre() {
Utils.toast(mContext, "分享跳转中...");
if (!PackageHelper.INSTANCE.getLocalPackageNameSet().contains("com.tencent.mm")) {
Utils.toast(mContext, "没安装微信,分享失败");
return;
}
WXImageObject imgObj = new WXImageObject();
imgObj.setImagePath(mContext.getExternalCacheDir().getPath() + "/ShareImg/" + picName);
WXMediaMessage msg = new WXMediaMessage();

View File

@ -5,6 +5,7 @@ import android.text.TextUtils
import com.gh.gamecenter.BuildConfig
import com.halo.assistant.HaloApp
import com.lightgame.utils.Util_System_Phone_State
import com.lightgame.utils.Utils
import com.tencent.stat.StatService
import java.util.*
@ -13,6 +14,12 @@ object MtaHelper {
@JvmStatic
fun onEvent(eventId: String, vararg kv: String?) {
val prop = Properties()
if (kv.size == 1) {
prop.setProperty(kv[0], "")
StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
}
for (i in kv.indices) {
if (i % 2 != 0) {
val key = kv[i - 1]
@ -22,9 +29,29 @@ object MtaHelper {
}
}
}
Utils.log("MTA","$eventId + [${kv.joinToString(" , ")}]")
StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
}
@JvmStatic
fun onEventWithTime(eventId: String, time: Int, vararg kv: String?) {
val prop = Properties()
for (i in kv.indices) {
if (i % 2 != 0 || i != 0) {
val key = kv[i - 1]
val value = kv[i]
if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
prop.setProperty(key, value)
}
}
}
if (prop.size == 0) return
Utils.log("MTA","$eventId + [${kv.joinToString(" , ")}] + last $time seconds")
StatService.trackCustomKVTimeIntervalEvent(HaloApp.getInstance().application, time, eventId, prop)
}
/**
* 这个方法除了记录传进来的入参还会附带一些基本的设备信息
*/
@ -47,8 +74,11 @@ object MtaHelper {
prop.setProperty("机型", Build.MODEL)
prop.setProperty("厂商", Build.MANUFACTURER)
prop.setProperty("Android版本", Build.VERSION.RELEASE)
prop.setProperty("GID", HaloApp.getInstance().gid)
if (!TextUtils.isEmpty(HaloApp.getInstance().gid)) {
prop.setProperty("GID", HaloApp.getInstance().gid)
}
Utils.log("MTA","$eventId + [${kv.joinToString(" , ")}]")
StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
}

View File

@ -52,6 +52,12 @@ public class NetworkUtils {
return false;
}
public static boolean isWifiOr4GOr3GConnected(Context context) {
String network = DeviceUtils.getNetwork(context);
return "WIFI".equals(network) || "4G".equals(network) || "3G".equals(network);
}
/**
* 判断MOBILE网络是否可用
*

View File

@ -2,45 +2,80 @@ package com.gh.common.util
import android.content.Context
import android.content.pm.ApplicationInfo
import com.gh.common.AppExecutor
import com.gh.common.constant.Config
import com.gh.gamecenter.entity.SettingsEntity
import com.halo.assistant.HaloApp
object PackageHelper {
// 黑名单包名,用于区分像 Xposed Installer 那些工具的包名
var excludePackageNameList = arrayListOf<String>()
// 评论黑名单包名列表,避免用户安装了 Xposed Installer 这样的工具,也能在包含该安装包的游戏详情页评论
var commentPackageNameBlackList = arrayListOf<String>()
// 关闭下载的包列表
var downloadPackageNameBlackList = arrayListOf<String>()
// 本地已安装的包去掉关闭下载的包后的列表
var validLocalPackageNameSet = hashSetOf<String>()
// 游戏包名匹配列表
var relatedPackageList = arrayListOf<SettingsEntity.GameWithPackages>()
// 本地已安装包的列表
var localPackageNameSet = hashSetOf<String>()
get() {
return if (field.isEmpty()) {
field = getAllPackageName(HaloApp.getInstance().application)
field
} else {
field
}
}
@JvmStatic
fun refreshLocalPackageList() {
AppExecutor.ioExecutor.execute {
localPackageNameSet = getAllPackageName(HaloApp.getInstance().application)
}
localPackageNameSet = getAllPackageName(HaloApp.getInstance().application)
updateValidPackageNameList()
}
@JvmStatic
fun initExcludePackageName() {
fun initList() {
Config.getSettings()?.gameCommentBlackList?.let {
excludePackageNameList = ArrayList(it)
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 = localPackageNameSet.filterNot { p -> downloadPackageNameBlackList.contains(p) }.toHashSet()
}
/*
* 获取所有已安装的软件的包名、版本(非系统应用)
*/
private fun getAllPackageName(context: Context): HashSet<String> {
val list = HashSet<String>()
val packageInfos = context.applicationContext.packageManager.getInstalledPackages(0)
for (packageInfo in packageInfos) {
if (packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
if (context.packageName != packageInfo.packageName) {
list.add(packageInfo.packageName)
val set = HashSet<String>()
return try {
val packageInfos = context.applicationContext.packageManager.getInstalledPackages(0)
for (packageInfo in packageInfos) {
if (packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
if (context.packageName != packageInfo.packageName) {
set.add(packageInfo.packageName)
}
}
}
set
} catch (e: Exception) {
e.printStackTrace()
set
}
return list
}
}

View File

@ -15,7 +15,6 @@ import android.support.v4.content.FileProvider;
import android.text.TextUtils;
import com.g00fy2.versioncompare.Version;
import com.gh.common.constant.Config;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
@ -49,12 +48,14 @@ public class PackageUtils {
for (ApkEntity apkEntity : gameEntity.getApk()) {
// 判断是否gh_version是否存在
String gh_version = (String) PackageUtils.getMetaData(context, apkEntity.getPackageName(), "gh_version");
if (gh_version != null && apkEntity.getGhVersion() != null) {
Object gh_id = PackageUtils.getMetaData(context, apkEntity.getPackageName(), "gh_id");
if (gh_version != null && apkEntity.getGhVersion() != null && gh_id != null) {
// 确定这是一个插件游戏
if (!isAPluginGame) isAPluginGame = true;
gh_version = gh_version.substring(2);
if (Long.parseLong(gh_version) < Long.parseLong(apkEntity.getGhVersion()) && apkEntity.getForce()) {
if (Long.parseLong(gh_version) < Long.parseLong(apkEntity.getGhVersion()) && apkEntity.getForce()
&& gh_id.equals(gameEntity.getId())) {
GameUpdateEntity updateEntity = new GameUpdateEntity();
updateEntity.setId(gameEntity.getId());
updateEntity.setName(gameEntity.getName());
@ -181,15 +182,15 @@ public class PackageUtils {
* 启动安装应用程序
*/
public static void launchSetup(final Context context, final String path) {
if (isCanLaunchSetup(context, path)) {
context.startActivity(PackageUtils.getInstallIntent(context, path));
} else {
DialogUtils.showPluginDialog(context, new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
context.startActivity(PackageUtils.getUninstallIntent(context, path));
}
});
try {
if (isCanLaunchSetup(context, path)) {
context.startActivity(PackageUtils.getInstallIntent(context, path));
} else {
DialogUtils.showPluginDialog(context,
() -> context.startActivity(PackageUtils.getUninstallIntent(context, path)));
}
} catch (Exception e) {
Utils.toast(context, e.getMessage());
}
}
@ -202,7 +203,7 @@ public class PackageUtils {
if (TextUtils.isEmpty(packageName)) {
return true;
}
boolean isContain = com.gh.gamecenter.manager.PackageManager.INSTANCE.isInstalled(packageName);
boolean isContain = com.gh.gamecenter.manager.PackagesManager.INSTANCE.isInstalled(packageName);
if (!isContain) {
return true;
}
@ -292,16 +293,6 @@ public class PackageUtils {
return 0;
}
/**
* 数据统计或反馈用PatchVersionName
* 判断助手是否是第一次启动或版本更新提交的版本号用AppVersionName{@link PackageUtils#getVersionName()}
*
* @return 补丁包版本号
*/
public static String getPatchVersionName() {
return Config.PATCH_VERSION_NAME;
}
/*
* 返回光环助手的版本信息
*/
@ -312,15 +303,8 @@ public class PackageUtils {
/*
* 返回光环助手的版本code
*/
public static String getVersionCode(Context context) {
try {
PackageInfo pkgInfo = context.getApplicationContext().getPackageManager().getPackageInfo(
context.getPackageName(), 0);
return String.valueOf(pkgInfo.versionCode);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return null;
public static int getVersionCode() {
return BuildConfig.VERSION_CODE;
}
/*

View File

@ -236,7 +236,10 @@ public class PlatformUtils {
if (TextUtils.isEmpty(platformName)) {
getPlatform();
}
return platformName;
if (!TextUtils.isEmpty(platformName)) {
return platformName;
}
return platform;
}
public void getPlatform() {

View File

@ -0,0 +1,20 @@
package com.gh.common.util
import android.app.ActivityManager
import android.content.Context
object ServiceUtils {
fun isServiceRunningInForeground(context: Context, serviceClass: Class<*>): Boolean {
val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
for (service in manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.name == service.service.className) {
if (service.foreground) {
return true
}
}
}
return false
}
}

View File

@ -251,6 +251,12 @@ public class ShareUtils {
//微信好友分享
private void wechatShare() {
Utils.toast(mContext, R.string.share_skip);
if (!PackageHelper.INSTANCE.getLocalPackageNameSet().contains("com.tencent.mm")) {
Utils.toast(mContext, "没安装微信,分享失败");
return;
}
WXWebpageObject webpage = new WXWebpageObject();
WXMediaMessage msg = new WXMediaMessage(webpage);
webpage.webpageUrl = shareUrl;
@ -387,6 +393,12 @@ public class ShareUtils {
//微信朋友圈分享
private void wechatMomentsShare() {
Utils.toast(mContext, R.string.share_skip);
if (!PackageHelper.INSTANCE.getLocalPackageNameSet().contains("com.tencent.mm")) {
Utils.toast(mContext, "没安装微信,分享失败");
return;
}
WXWebpageObject webpage = new WXWebpageObject();
WXMediaMessage msg = new WXMediaMessage(webpage);

View File

@ -1,84 +0,0 @@
package com.gh.common.util;
import android.app.Activity;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
/**
* 用于解决因为沉浸式状态栏(自定义)时键盘不遮挡输入框
*/
public class SoftInputHidWidgetUtils {
private View mChildOfContent;
private int usableHeightPrevious;
private FrameLayout.LayoutParams frameLayoutParams;
private int contentHeight;
private boolean isfirst = true;
private int statusBarHeight;
public static void assistActivity(Activity activity) {
if (Build.VERSION.SDK_INT >= 19) {
new SoftInputHidWidgetUtils(activity);
}
}
private SoftInputHidWidgetUtils(Activity activity) {
statusBarHeight = getStatusBarHeight(activity);
FrameLayout content = (FrameLayout)activity.findViewById(android.R.id.content);
mChildOfContent = content.getChildAt(0);
//界面出现变动都会调用这个监听事件
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
if (isfirst) {
contentHeight = mChildOfContent.getHeight();//兼容华为等机型
isfirst = false;
}
possiblyResizeChildOfContent();
}
});
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
}
//重新调整跟布局的高度
private void possiblyResizeChildOfContent() {
int usableHeightNow = computeUsableHeight();
//当前可见高度和上一次可见高度不一致 布局变动
if (usableHeightNow != usableHeightPrevious) {
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
if (heightDifference > (usableHeightSansKeyboard / 4)) {
// keyboard probably just became visible
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference + statusBarHeight;
} else {
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
}
} else {
frameLayoutParams.height = contentHeight;
}
mChildOfContent.requestLayout();
usableHeightPrevious = usableHeightNow;
}
}
/**
* 获取改变之后界面的可用高度(可以为开发者显示内容的高度)
* @return
*/
private int computeUsableHeight() {
Rect r = new Rect();
mChildOfContent.getWindowVisibleDisplayFrame(r);//获取到的rect就是界面除去标题栏、除去软键盘挡住部分所剩下的域
return (r.bottom - r.top);
}
public static int getStatusBarHeight(Activity activity) {
//获取状态栏的高度
int resourceId = activity.getResources().getIdentifier("status_bar_height", "dimen", "android");
return activity.getResources().getDimensionPixelSize(resourceId);
}
}

View File

@ -54,4 +54,22 @@ object SPUtils {
fun getBoolean(key: String): Boolean {
return sp.getBoolean(key, false)
}
@JvmStatic
fun getBoolean(key: String, defaultValue: Boolean): Boolean {
return sp.getBoolean(key, defaultValue)
}
@JvmStatic
fun setString(sp: SharedPreferences, key: String, value: String? = null) {
try {
val commitStatus = sp.edit().putString(key, value).commit()
if (!commitStatus) {
sp.edit().putString(key, value).apply()
}
} catch (e: Exception) {
e.printStackTrace()
sp.edit().putString(key, value).apply()
}
}
}

View File

@ -0,0 +1,39 @@
package com.gh.common.util
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
import com.gh.gamecenter.R
object TextHelper {
@JvmStatic
fun limitTheLengthOfEditText(editText: EditText, length: Int, exceedCallback: ExceedTextLengthLimitCallback? = null) {
editText.addTextChangedListener(object :TextWatcher {
override fun afterTextChanged(s: Editable?) {
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
val tvCount = editText.text.toString().length
if (tvCount > length) {
val str = editText.text.toString().substring(0, length)
editText.setText(str)
editText.setSelection(str.length)
if (!ClickUtils.isFastDoubleClick(R.id.userinfo_nickname_et, 2000)) {
exceedCallback?.onExceed()
}
}
}
})
}
interface ExceedTextLengthLimitCallback {
fun onExceed()
}
}

View File

@ -0,0 +1,20 @@
package com.gh.common.util
/**
* 第三方安装包(即安装包里没有 gh-id的辅助类
*/
object ThirdPartyPackageHelper {
private const val PREFIX = "third_party_package"
@JvmStatic
fun saveGameId(packageName: String, gameId: String) {
SPUtils.setString(PREFIX + packageName, gameId)
}
@JvmStatic
fun getGameId(packageName: String): String {
return SPUtils.getString(PREFIX + packageName, "")!!
}
}

View File

@ -1,37 +1,48 @@
package com.gh.common.view;
import android.app.Dialog;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.gh.common.constant.Config;
import com.gh.common.exposure.ExposureEvent;
import com.gh.common.util.ClickUtils;
import com.gh.common.util.DirectUtils;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.PlatformUtils;
import com.gh.common.util.SPUtils;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.OnCollectionCallBackListener;
import com.gh.gamecenter.adapter.PlatformPagerAdapter;
import com.gh.gamecenter.databinding.ImprintContentItemBinding;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.ApkLink;
import com.gh.gamecenter.entity.GameCollectionEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LinkEntity;
import com.gh.gamecenter.entity.SettingsEntity;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.PackagesManager;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
@ -56,21 +67,35 @@ import java.util.concurrent.ConcurrentHashMap;
* @des 弹出游戏版本下载按钮,点击并添加到下载任务中
*/
public class DownloadDialog implements OnCollectionCallBackListener {
private static DownloadDialog instance;
private Context mContext;
private boolean isShow;
private PopupWindow popupWindow;
private List<ApkEntity> gameApk;
private GameEntity gameEntity;
private ViewPager viewPager;
private PlatformPagerAdapter adapter;
private ViewPager collectionViewPager;
private LinearLayout dialog_ll_collection_hint;
private LinearLayout dialog_ll_hint;
private LinearLayout dialog_ll_collection;
private ViewPager collectionViewPager;
private View mDialogMorePlatformHint;
private List<ApkEntity> gameApk;
private GameEntity gameEntity;
private PlatformPagerAdapter adapter;
private PlatformPagerAdapter collectionAdapter;
private ExposureEvent traceEvent;
private static final String DOWNLOAD_PLATFORM_HINT = "download_platform_hint";
private String entrance;
private String location;
private String mAutoDownloadPlatform;
private final int row = 3;
private final int column = 3;
private boolean isLoadPlatform;
private DataWatcher dataWatcher = new DataWatcher() {
@Override
public void onDataChanged(DownloadEntity downloadEntity) {
@ -85,39 +110,31 @@ public class DownloadDialog implements OnCollectionCallBackListener {
}
}
};
private LinearLayout dialog_ll_collection_hint;
private String entrance;
private String location;
private ExposureEvent traceEvent;
private final int row = 3;
private final int column = 3;
private boolean isLoadPlatform;
private DownloadDialog() {
isShow = false;
private DownloadDialog(Context context) {
mContext = context;
}
public static DownloadDialog getInstance(Context context) {
if (instance == null) {
instance = new DownloadDialog();
}
instance.mContext = context; // 每次创建context重新赋值, Dialog持有context问题
return instance;
return new DownloadDialog(context);
}
// 自动下载并翻到相应页面
public void showPopupWindowAutoDownload(View view, GameEntity gameEntity, String autoDownloadPlatform,
String entrance, String location, ExposureEvent traceEvent) {
mAutoDownloadPlatform = autoDownloadPlatform;
showPopupWindow(view, gameEntity, entrance, location, traceEvent);
}
public void showPopupWindow(View view, GameEntity gameEntity, String entrance, String location) {
showPopupWindow(view, gameEntity, entrance, location, null);
}
public void showPopupWindow(View view, GameEntity gameEntity, String entrance, String location, @Nullable ExposureEvent traceEvent) {
if (isShow && (popupWindow == null || !popupWindow.isShowing())) {
isShow = false;
}
if (isShow) {
public void showPopupWindow(View view, GameEntity gameEntity, String entrance, String location,
@Nullable ExposureEvent traceEvent) {
if (ClickUtils.isFastDoubleClick()) {
return;
}
isShow = true;
this.gameEntity = gameEntity;
this.entrance = entrance;
@ -138,14 +155,39 @@ public class DownloadDialog implements OnCollectionCallBackListener {
// 一个自定义的布局,作为显示的内容
View contentView = View.inflate(mContext, R.layout.game_download_dialog, null);
TextView title = (TextView) contentView.findViewById(R.id.dialog_title);
TextView title = contentView.findViewById(R.id.dialog_title);
title.setText(gameEntity.getName());
viewPager = (ViewPager) contentView.findViewById(R.id.dialog_viewPager);
dialog_ll_hint = (LinearLayout) contentView.findViewById(R.id.dialog_ll_hint);
dialog_ll_collection = (LinearLayout) contentView.findViewById(R.id.dialog_ll_collection);
dialog_ll_collection_hint = (LinearLayout) contentView.findViewById(R.id.dialog_ll_collection_hint);
collectionViewPager = (ViewPager) contentView.findViewById(R.id.dialog_collection_viewPager);
viewPager = contentView.findViewById(R.id.dialog_viewPager);
dialog_ll_hint = contentView.findViewById(R.id.dialog_ll_hint);
dialog_ll_collection = contentView.findViewById(R.id.dialog_ll_collection);
dialog_ll_collection_hint = contentView.findViewById(R.id.dialog_ll_collection_hint);
collectionViewPager = contentView.findViewById(R.id.dialog_collection_viewPager);
mDialogMorePlatformHint = contentView.findViewById(R.id.dialog_more_platform_hit);
TextView dialogAd = contentView.findViewById(R.id.dialog_ad);
TextView dialogAdMirror = contentView.findViewById(R.id.dialog_ad_mirror);
mDialogMorePlatformHint.setOnClickListener(v -> {
mDialogMorePlatformHint.setVisibility(View.GONE);
SPUtils.setBoolean(DOWNLOAD_PLATFORM_HINT, false);
});
LinkEntity downloadAd = gameEntity.getDownloadAd();
if (downloadAd != null) {
dialogAd.setVisibility(View.VISIBLE);
dialogAd.setText(downloadAd.getTitle());
dialogAdMirror.setVisibility(View.INVISIBLE);
dialogAdMirror.setText(downloadAd.getTitle());
dialogAd.setOnClickListener(v -> {
if ("imprint".equals(downloadAd.getType())) {
showImprintDialog(downloadAd.getTitle());
} else {
DirectUtils.directToLinkPage(
mContext,
downloadAd,
entrance, "下载多平台弹窗");
}
});
}
isLoadPlatform = false;
@ -156,32 +198,20 @@ public class DownloadDialog implements OnCollectionCallBackListener {
popupWindow = new PopupWindow(contentView, LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT, true);
contentView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
}
});
contentView.setOnClickListener(v -> popupWindow.dismiss());
contentView.setFocusable(true);
contentView.setFocusableInTouchMode(true);
contentView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
&& popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
}
return false;
contentView.setOnKeyListener((v, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
&& popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
}
return false;
});
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
isShow = false;
EventBus.getDefault().unregister(DownloadDialog.this);
DownloadManager.getInstance(mContext).removeObserver(dataWatcher);
}
popupWindow.setOnDismissListener(() -> {
EventBus.getDefault().unregister(DownloadDialog.this);
DownloadManager.getInstance(mContext).removeObserver(dataWatcher);
});
popupWindow.setTouchable(true);
@ -200,6 +230,51 @@ public class DownloadDialog implements OnCollectionCallBackListener {
DownloadManager.getInstance(mContext).addObserver(dataWatcher);
}
private void showImprintDialog(String titleName) {
Dialog dialog = new Dialog(mContext, R.style.full_dialog);
View inflate = LayoutInflater.from(mContext).inflate(R.layout.imprint_dialog, null);
dialog.setContentView(inflate);
dialog.show();
Window window = dialog.getWindow();
WindowManager.LayoutParams params;
if (window != null) {
params = window.getAttributes();
params.width = (int) (mContext.getResources().getDisplayMetrics().widthPixels * 0.9);
window.setAttributes(params);
window.setBackgroundDrawableResource(R.drawable.full_dialog_background);
}
inflate.findViewById(R.id.imprint_close).setOnClickListener(v -> dialog.dismiss());
LinearLayout content = inflate.findViewById(R.id.imprint_content);
((TextView) inflate.findViewById(R.id.imprint_title)).setText(titleName);
View head = LayoutInflater.from(mContext).inflate(R.layout.imprint_content_item, null);
content.addView(head, LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(30));
LimitHeightLinearLayout imprintContainer = inflate.findViewById(R.id.imprint_container);
imprintContainer.setLimitHeight((int) (mContext.getResources().getDisplayMetrics().heightPixels * 0.8));
ArrayList<ApkEntity> list = gameEntity.getApk();
SettingsEntity settings = Config.getSettings();
for (int i = 0; i < list.size(); i++) {
ApkEntity apk = gameEntity.getApk().get(i);
if (settings != null && settings.getGameDownloadBlackList().contains(apk.getPackageName())) {
continue;
}
View item = LayoutInflater.from(mContext).inflate(R.layout.imprint_content_item, null);
ImprintContentItemBinding bind = DataBindingUtil.bind(item);
bind.setApk(apk);
bind.setPlatformName(PlatformUtils.getInstance(mContext).getPlatformName(apk.getPlatform()));
content.addView(item, LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(40));
}
// close line
View view = new View(mContext);
view.setBackgroundColor(mContext.getResources().getColor(R.color.text_5d5d5d));
view.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(1)));
content.addView(view);
}
private void sortApk() {
for (ApkEntity apkEntity : gameApk) {
GameCollectionEntity apkCollection = apkEntity.getApkCollection();
@ -241,12 +316,12 @@ public class DownloadDialog implements OnCollectionCallBackListener {
String packageName = apkEntity.getPackageName();
DownloadEntity downloadEntity = DownloadManager.getInstance(mContext).getDownloadEntityByUrl(apkEntity.getUrl());
if (downloadEntity == null) {
if (!TextUtils.isEmpty(packageName) && PackageManager.INSTANCE.isInstalled(packageName)) {
if (!TextUtils.isEmpty(packageName) && PackagesManager.INSTANCE.isInstalled(packageName)) {
gh_id = PackageUtils.getMetaData(mContext, packageName, "gh_id");
if (gh_id == null || gh_id.equals(gameEntity.getId())) {
if (!PackageUtils.isSignature(mContext, packageName)) {
return 8;
} else if (PackageManager.INSTANCE.isCanUpdate(gameEntity.getId(), packageName)) {
} else if (PackagesManager.INSTANCE.isCanUpdate(gameEntity.getId(), packageName)) {
return 5;
} else {
return 2;
@ -380,6 +455,13 @@ public class DownloadDialog implements OnCollectionCallBackListener {
int size = (int) Math.ceil(apkList.size() / (double) (row * column));
addHintPoint(dialog_ll_hint, size);
if (size >= 2) {
boolean isShowPlatformHint = SPUtils.getBoolean(DOWNLOAD_PLATFORM_HINT, true);
if (isShowPlatformHint) {
mDialogMorePlatformHint.setVisibility(View.VISIBLE);
}
}
int count = apkList.size();
int vpHeight;
if (count <= 3) {
@ -397,10 +479,34 @@ public class DownloadDialog implements OnCollectionCallBackListener {
if (viewPager != null) {
currentItem = viewPager.getCurrentItem();
}
if (!TextUtils.isEmpty(mAutoDownloadPlatform)) {
for (int i = 0; i < apkList.size(); i++) {
ApkEntity apkEntity = apkList.get(i);
if (mAutoDownloadPlatform.equals(apkEntity.getPlatform())) {
currentItem = (i / 9);
break;
}
GameCollectionEntity apkCollection = apkEntity.getApkCollection();
if (apkCollection != null) {
List<ApkEntity> saveApkEntity = apkCollection.getSaveApkEntity();
if (saveApkEntity != null) {
for (ApkEntity entity : saveApkEntity) {
if (mAutoDownloadPlatform.equals(entity.getPlatform())) {
currentItem = (i / 9);
break;
}
}
}
}
}
}
Utils.log("currentItem = " + currentItem);
adapter = new PlatformPagerAdapter(mContext, this, gameEntity, apkList, entrance, location, traceEvent);
adapter = new PlatformPagerAdapter(mContext, this,
gameEntity, apkList, mAutoDownloadPlatform, entrance, location, traceEvent);
viewPager.setAdapter(adapter);
viewPager.setCurrentItem(currentItem);
if (currentItem != 0) setDownloadOvalHint(dialog_ll_hint, currentItem);
}
private void addHintPoint(LinearLayout linearLayout, int size) {
@ -467,7 +573,8 @@ public class DownloadDialog implements OnCollectionCallBackListener {
public void showCollection(GameCollectionEntity gameCollectionEntity) {
dialog_ll_collection.setVisibility(View.VISIBLE);
int count = gameCollectionEntity.getSaveApkEntity().size();
List<ApkEntity> saveApkList = gameCollectionEntity.getSaveApkEntity();
int count = saveApkList.size();
int vpHeight;
if (count <= 3) {
vpHeight = 82;
@ -482,14 +589,31 @@ public class DownloadDialog implements OnCollectionCallBackListener {
collectionViewPager.setLayoutParams(layoutParams);
dialog_ll_collection_hint.removeAllViews();
int size = (int) Math.ceil(gameCollectionEntity.getSaveApkEntity().size() / (double) (row * column));
int size = (int) Math.ceil(count / (double) (row * column));
addHintPoint(dialog_ll_collection_hint, size);
collectionAdapter = new PlatformPagerAdapter(
mContext, null, gameEntity, gameCollectionEntity.getSaveApkEntity(), entrance, location, traceEvent);
mContext, null, gameEntity, saveApkList,
mAutoDownloadPlatform, entrance, location, traceEvent);
collectionViewPager.setAdapter(collectionAdapter);
collectionViewPager.addOnPageChangeListener(new MyPageChangeListener(dialog_ll_collection_hint));
int currentItem = 0;
if (!TextUtils.isEmpty(mAutoDownloadPlatform)) {
for (int i = 0; i < saveApkList.size(); i++) {
ApkEntity apkEntity = saveApkList.get(i);
if (mAutoDownloadPlatform.equals(apkEntity.getPlatform())) {
currentItem = (i / 9);
break;
}
}
}
if (currentItem != 0) {
collectionViewPager.setCurrentItem(currentItem);
setDownloadOvalHint(dialog_ll_collection_hint, currentItem);
}
mAutoDownloadPlatform = null;
}
// 隐藏合集
@ -514,15 +638,7 @@ public class DownloadDialog implements OnCollectionCallBackListener {
@Override
public void onPageSelected(int position) {
for (int i = 0, size = linearLayout.getChildCount(); i < size; i++) {
if (i == position % size) {
((ImageView) linearLayout.getChildAt(i))
.setImageResource(R.drawable.download_oval_hint_up);
} else {
((ImageView) linearLayout.getChildAt(i))
.setImageResource(R.drawable.oval_hint_gray_bg);
}
}
setDownloadOvalHint(linearLayout, position);
}
@Override
@ -531,4 +647,16 @@ public class DownloadDialog implements OnCollectionCallBackListener {
}
}
private void setDownloadOvalHint(LinearLayout linearLayout, int position) {
for (int i = 0, size = linearLayout.getChildCount(); i < size; i++) {
if (i == position % size) {
((ImageView) linearLayout.getChildAt(i))
.setImageResource(R.drawable.download_oval_hint_up);
} else {
((ImageView) linearLayout.getChildAt(i))
.setImageResource(R.drawable.oval_hint_gray_bg);
}
}
}
}

View File

@ -8,9 +8,11 @@ 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.support.annotation.StringRes;
import android.support.v4.content.ContextCompat;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.ProgressBar;
@ -37,6 +39,8 @@ public class DownloadProgressBar extends ProgressBar {
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;
@ -46,6 +50,8 @@ public class DownloadProgressBar extends ProgressBar {
private int mDefaultColor;
private int mTextSize;
private Rect mTextBound = new Rect();
public DownloadProgressBar(Context context) {
super(context);
}
@ -79,6 +85,9 @@ public class DownloadProgressBar extends ProgressBar {
mPaint.setColor(mDefaultColor == 0 ? ContextCompat.getColor(getContext(), R.color.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();
@ -87,7 +96,11 @@ public class DownloadProgressBar extends ProgressBar {
int baseline = (getHeight() - fontMetrics.bottom - fontMetrics.top) / 2;
mPaint.setTextAlign(Paint.Align.CENTER);
srcCanvas.drawText(mText, getWidth() / 2, baseline, mPaint);
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 && getProgress() != MAX_LENGTH) {
mPaint.setColor(DOWNLOAD_IMAGE_STYLE == mDownloadStyle ? Color.BLACK : Color.WHITE); // 反向颜色

View File

@ -0,0 +1,23 @@
package com.gh.common.view
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import com.gh.common.util.DisplayUtils
object DrawableView {
@JvmStatic
fun getServerDrawable(colorCode: String): Drawable {
return getServerDrawable(Color.parseColor(colorCode))
}
@JvmStatic
fun getServerDrawable(colorCode: Int): Drawable {
val drawable = GradientDrawable()
drawable.setColor(colorCode)
drawable.cornerRadius = DisplayUtils.dip2px(2F).toFloat()
return drawable
}
}

View File

@ -0,0 +1,59 @@
package com.gh.common.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.gh.common.util.DisplayUtils;
import com.gh.gamecenter.R;
/**
* Created by khy on 2/04/18.
*/
public class LimitHeightLinearLayout extends LinearLayout {
private int mLimitHeight;
public LimitHeightLinearLayout(Context context) {
super(context);
}
public LimitHeightLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs != null) {
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.LimitHeightScrollView);
mLimitHeight = ta.getDimensionPixelSize(R.styleable.LimitHeightScrollView_maxHeight, DisplayUtils.dip2px(getContext(), 240));
ta.recycle();
} else {
mLimitHeight = DisplayUtils.dip2px(getContext(), 240);
}
}
public LimitHeightLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
if (heightMode == MeasureSpec.EXACTLY
|| heightMode == MeasureSpec.AT_MOST
|| heightMode == MeasureSpec.UNSPECIFIED) {
heightSize = heightSize <= mLimitHeight ? heightSize
: mLimitHeight;
}
int maxHeightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize,
heightMode);
super.onMeasure(widthMeasureSpec, maxHeightMeasureSpec);
}
public void setLimitHeight(int limitHeight) {
mLimitHeight = limitHeight;
requestLayout();
}
}

View File

@ -1,62 +0,0 @@
//package com.gh.common.view;
//
//import android.content.Context;
//import android.support.v7.widget.LinearLayoutManager;
//import android.support.v7.widget.RecyclerView;
//import android.view.View;
//import android.view.ViewGroup;
//
///**
// * Created by khy on 2017/3/30.
// */
//public class MeasureLinearLayoutManager extends LinearLayoutManager {
// int height;
// private int[] mMeasuredDimension = new int[1];
//
// public MeasureLinearLayoutManager(Context context) {
// super(context);
// }
//
// @Override
// public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state,
// int widthSpec, int heightSpec) {
// super.onMeasure(recycler, state, widthSpec, heightSpec);
// height = 0;
//
// try {
// for (int i = 0; i < getItemCount(); i++) {
// measureScrapChild(recycler, i,
// View.MeasureSpec.makeMeasureSpec(i, View.MeasureSpec.UNSPECIFIED),
// View.MeasureSpec.makeMeasureSpec(i, View.MeasureSpec.UNSPECIFIED),
// mMeasuredDimension);
// height = height + mMeasuredDimension[0];
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// }
//
// private void measureScrapChild(RecyclerView.Recycler recycler, int position, int widthSpec,
// int heightSpec, int[] measuredDimension) throws Exception {
// View view = recycler.getViewForPosition(position);
// if (view.getVisibility() == View.GONE) {
// measuredDimension[0] = 0;
// return;
// }
// super.measureChildWithMargins(view, 0, 0);
// RecyclerView.LayoutParams p = (RecyclerView.LayoutParams) view.getLayoutParams();
// int childHeightSpec = ViewGroup.getChildMeasureSpec(
// heightSpec,
// getPaddingTop() + getPaddingBottom() + getDecoratedTop(view) + getDecoratedBottom(view),
// p.height);
//
// view.measure(0, childHeightSpec);
// measuredDimension[0] = getDecoratedMeasuredHeight(view) + p.bottomMargin + p.topMargin;
// recycler.recycleView(view);
// }
//
// public int getRvHeight() {
// return height;
// }
//}

View File

@ -0,0 +1,136 @@
package com.gh.common.view;
import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.ClickableSpan;
import android.util.AttributeSet;
import android.view.View;
import com.gh.gamecenter.R;
import java.util.ArrayList;
import java.util.List;
public class MessageSpannableTextView extends android.support.v7.widget.AppCompatTextView {
private OnSpannableClickListener mSpannableClickListener;
private final String mStartMarkKey = "{{";
private final String mEndMarkKey = "}}";
private List<MarkData> mMarkList;
public MessageSpannableTextView(Context context) {
super(context);
}
public MessageSpannableTextView(Context context, AttributeSet attrs) {
super(context, attrs);
mMarkList = new ArrayList<>();
}
@Override
public void setText(CharSequence text, BufferType type) {
if (TextUtils.isEmpty(text) ||
!text.toString().contains(mStartMarkKey) && !text.toString().contains(mEndMarkKey)) {
super.setText(text, type);
return;
}
mMarkList.clear();
String sText = text.toString();
String[] split = sText.split("\\}\\}");
StringBuilder builder = new StringBuilder();
for (int i = 0; i < split.length; i++) {
String s = split[i];
int p = s.lastIndexOf(mStartMarkKey);
if (p != -1) {
MarkData markData = new MarkData();
String substring = s.substring(p);
String content = s.replace(substring, "");
builder.append(content);
markData.setStart(builder.length() + 1);
String key = substring.replace(mStartMarkKey, " ") + " ";
builder.append(key);
markData.setEnd(builder.length() - 1);
markData.setKey(key);
mMarkList.add(markData);
System.out.println(substring);
System.out.println(s);
} else {
builder.append(s);
if (i != split.length - 1 || sText.substring(sText.length() - 2, sText.length()).equals("}}")) {
builder.append("}}");
}
}
}
SpannableStringBuilder msp = new SpannableStringBuilder(builder);
for (MarkData markData : mMarkList) {
msp.setSpan(new ClickableSpan() {
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(getContext().getResources().getColor(R.color.tag_orange));
ds.setUnderlineText(true);
}
@Override
public void onClick(View widget) {
if (mSpannableClickListener != null) {
mSpannableClickListener.onClick(markData.getKey().trim());
}
}
}, markData.getStart(), markData.getEnd(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
setMovementMethod(CustomLinkMovementMethod.getInstance());
super.setText(msp, type);
}
public void setOnSpannableClickListener(OnSpannableClickListener spannableClickListener) {
this.mSpannableClickListener = spannableClickListener;
}
public interface OnSpannableClickListener {
void onClick(String spannableText);
}
class MarkData {
private int start;
private int end;
private String key;
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getEnd() {
return end;
}
public void setEnd(int end) {
this.end = end;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}

View File

@ -3,18 +3,13 @@ package com.gh.common.view
import android.content.Context
import android.content.pm.ActivityInfo
import android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
import android.media.AudioManager
import android.os.Build
import android.os.Handler
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.util.AttributeSet
import android.view.View
import android.widget.ImageView
import cn.jzvd.JZDataSource
import cn.jzvd.JZUtils
import cn.jzvd.Jzvd
import cn.jzvd.JzvdStd
import cn.jzvd.*
import com.gh.common.observer.MuteCallback
import com.gh.common.observer.VolumeObserver
import com.gh.common.util.DialogUtils
@ -60,12 +55,12 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
if (v.id == R.id.start || v.id == R.id.thumb) {
if (Jzvd.CURRENT_STATE_PLAYING != currentState) {
if ((currentScreen == SCREEN_WINDOW_NORMAL || currentScreen == SCREEN_WINDOW_LIST)) {
MtaHelper.onEvent("游戏详情", "视频_点击播放", gameName)
MtaHelper.onEvent("游戏详情_新", "视频_点击播放", gameName)
} else {
MtaHelper.onEvent("游戏详情", "视频全屏_点击播放", gameName)
MtaHelper.onEvent("游戏详情_新", "视频全屏_点击播放", gameName)
}
} else {
MtaHelper.onEvent("游戏详情", "视频_点击暂停", gameName)
MtaHelper.onEvent("游戏详情_新", "视频_点击暂停", gameName)
}
if (showAlertDialogForTheFistTime
@ -86,7 +81,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
Jzvd.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
JZUtils.setRequestedOrientation(context, Jzvd.FULLSCREEN_ORIENTATION)
}
MtaHelper.onEvent("游戏详情", "视频全屏_点击旋转", gameName)
MtaHelper.onEvent("游戏详情_新", "视频全屏_点击旋转", gameName)
}
R.id.mute -> {
toggleMute()
@ -101,6 +96,10 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
private fun toggleMute() {
HaloApp.getInstance().isMute = !HaloApp.getInstance().isMute
updateMuteStatus()
}
private fun updateMuteStatus() {
if (HaloApp.getInstance().isMute) {
mute()
} else {
@ -124,26 +123,22 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
private fun mute() {
muteIv.setImageResource(R.drawable.ic_volume_off)
// 安卓 6.0 以上 toggle 静音接口,以下将声音置为 0% 或 60%
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_MUTE, 0)
} else {
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0)
try {
JZMediaManager.instance()?.jzMediaInterface?.setVolume(0f, 0f)
} catch (e: Exception) {
e.printStackTrace()
}
MtaHelper.onEvent("游戏详情", "视频_点击静音", gameName)
MtaHelper.onEvent("游戏详情_新", "视频_点击静音", gameName)
}
private fun unmute() {
muteIv.setImageResource(R.drawable.ic_volume_on)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_UNMUTE, 0)
} else {
mAudioManager.setStreamVolume(
AudioManager.STREAM_MUSIC,
60 * mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
0)
try {
JZMediaManager.instance()?.jzMediaInterface?.setVolume(1.0f, 1.0f)
} catch (e: Exception) {
e.printStackTrace()
}
MtaHelper.onEvent("游戏详情", "视频_解除静音", gameName)
MtaHelper.onEvent("游戏详情_新", "视频_解除静音", gameName)
}
override fun onStatePlaying() {
@ -154,6 +149,11 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
}
}
override fun onStatePrepared() {
super.onStatePrepared()
updateMuteStatus()
}
override fun onClickUiToggle() {
// 仅在全屏状态下才会 toggle 播放信息
if (currentScreen == Jzvd.SCREEN_WINDOW_FULLSCREEN) {
@ -204,11 +204,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
rotateIv.visibility = View.GONE
// 将右下角的按钮变成静音与否
if (HaloApp.getInstance().isMute) {
mute()
} else {
unmute()
}
updateMuteStatus()
} else {
progressBar.visibility = View.VISIBLE
totalTimeTextView.visibility = View.VISIBLE
@ -257,7 +253,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
if (currentScreen == SCREEN_WINDOW_NORMAL || currentScreen == SCREEN_WINDOW_LIST) {
progressBar.visibility = View.INVISIBLE
totalTimeTextView.visibility = View.INVISIBLE
MtaHelper.onEvent("游戏详情", "视频全屏_点击后退", gameName)
MtaHelper.onEvent("游戏详情_新", "视频全屏_点击后退", gameName)
} else {
progressBar.visibility = View.VISIBLE
totalTimeTextView.visibility = View.VISIBLE
@ -267,7 +263,7 @@ class PlayerView @JvmOverloads constructor(context: Context, attrs: AttributeSet
override fun startWindowFullscreen() {
super.startWindowFullscreen()
unmute()
MtaHelper.onEvent("游戏详情", "视频_点击进入全屏", gameName)
MtaHelper.onEvent("游戏详情_新", "视频_点击进入全屏", gameName)
}
override fun startDismissControlViewTimer() {

View File

@ -398,7 +398,11 @@ public class RichEditor extends WebView {
private void load(String trigger) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
evaluateJavascript(trigger, null);
try {
evaluateJavascript(trigger, null);
} catch (IllegalStateException ignore) {
loadUrl(trigger);
}
} else {
loadUrl(trigger);
}

View File

@ -1277,7 +1277,7 @@ public class SwipeLayout extends FrameLayout {
}
if (currentDragEdge == DragEdge.Left) {
// if (xvel > minVelocity) open(); //TODO 打开侧滑不受侧滑速度限制
// if (xvel > minVelocity) open(); // 打开侧滑不受侧滑速度限制
// else
if (xvel < -minVelocity) close();
else {

View File

@ -18,7 +18,7 @@ public class VerticalItemDecoration extends RecyclerView.ItemDecoration {
private int mIntervalLR;
private boolean mIsShowIntervalTop;
public VerticalItemDecoration(Context context, int interval, boolean isShowIntervalTop) {
public VerticalItemDecoration(Context context, float interval, boolean isShowIntervalTop) {
paint = new Paint();
paint.setColor(ContextCompat.getColor(context, R.color.background));
mInterval = DisplayUtils.dip2px(context, interval);
@ -33,6 +33,14 @@ public class VerticalItemDecoration extends RecyclerView.ItemDecoration {
mIntervalLR = DisplayUtils.dip2px(context, intervalLR);
}
// cutting
public VerticalItemDecoration(Context context, boolean isShowIntervalTop) {
paint = new Paint();
paint.setColor(ContextCompat.getColor(context, R.color.bg_ededed));
mInterval = (int) context.getResources().getDimension(R.dimen.cutting_line);
mIsShowIntervalTop = isShowIntervalTop;
}
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
int left = parent.getPaddingLeft();
@ -45,7 +53,7 @@ public class VerticalItemDecoration extends RecyclerView.ItemDecoration {
int bottom = top + mInterval;
if (i == 0 && mIsShowIntervalTop) {
c.drawRect(left + mIntervalLR, 0, right - mIntervalLR, bottom, paint);
c.drawRect(left + mIntervalLR, 0, right - mIntervalLR, mInterval, paint);
} else {
c.drawRect(left + mIntervalLR, top, right - mIntervalLR, bottom, paint);
}

View File

@ -3,6 +3,7 @@ package com.gh.download;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@ -15,13 +16,15 @@ import com.gh.common.exposure.ExposureEvent;
import com.gh.common.util.AppDebugConfig;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.GdtHelper;
import com.gh.common.util.MD5Utils;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.PackagesManager;
import com.google.gson.Gson;
import com.halo.assistant.HaloApp;
import com.lightgame.config.CommonDebug;
import com.lightgame.download.ConnectionUtils;
import com.lightgame.download.DataChanger;
@ -35,6 +38,7 @@ import com.lightgame.download.DownloadStatusListener;
import com.lightgame.download.DownloadStatusManager;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Utils;
import com.qq.gdt.action.ActionType;
import org.greenrobot.eventbus.EventBus;
@ -232,7 +236,7 @@ public class DownloadManager implements DownloadStatusListener {
downloadEntity.setVersionName(apkEntity.getVersion());
int installed = 0;
for (ApkEntity apk : gameEntity.getApk()) {
if (PackageManager.INSTANCE.isInstalled(apk.getPackageName())) {
if (PackagesManager.INSTANCE.isInstalled(apk.getPackageName())) {
installed++;
}
}
@ -259,6 +263,9 @@ public class DownloadManager implements DownloadStatusListener {
// 收集下载数据
DataCollectionUtils.uploadDownload(context, downloadEntity, "开始");
GdtHelper.INSTANCE.logAction(ActionType.DOWNLOAD_APP,
GdtHelper.GAME_ID, downloadEntity.getGameId(),
GdtHelper.PLATFORM, downloadEntity.getPlatform());
}
/**
@ -274,7 +281,7 @@ public class DownloadManager implements DownloadStatusListener {
downloadEntity.setStatus(DownloadStatus.done);
DataChanger.INSTANCE.notifyDataChanged(downloadEntity);
} else if (!isTaskDownloading(url)) {
mContext.startService(getIntent(downloadEntity, DownloadStatus.add));
startDownloadService(downloadEntity, DownloadStatus.add);
}
put(url, System.currentTimeMillis());
putStatus(url, DownloadStatus.downloading);
@ -295,7 +302,7 @@ public class DownloadManager implements DownloadStatusListener {
downloadEntity.setStatus(DownloadStatus.done);
DataChanger.INSTANCE.notifyDataChanged(downloadEntity);
} else if (!isTaskDownloading(url)) {
mContext.startService(getIntent(downloadEntity, DownloadStatus.subscribe));
startDownloadService(downloadEntity, DownloadStatus.subscribe);
}
put(url, System.currentTimeMillis());
putStatus(url, DownloadStatus.subscribe);
@ -469,7 +476,7 @@ public class DownloadManager implements DownloadStatusListener {
}
if (entry != null) {
entry.setStatus(DownloadStatus.cancel);
mContext.startService(getIntent(entry, DownloadStatus.cancel));
startDownloadService(entry, DownloadStatus.cancel);
Utils.log(DownloadManager.class.getSimpleName(), "cancel");
}
}
@ -513,7 +520,7 @@ public class DownloadManager implements DownloadStatusListener {
checkDownloadEntryRecordValidate(url);
DownloadEntity entry = DataChanger.INSTANCE.getDownloadEntries().get(url);
if (entry != null) {
mContext.startService(getIntent(entry, DownloadStatus.pause));
startDownloadService(entry, DownloadStatus.pause);
put(url, System.currentTimeMillis());
statusMap.put(url, DownloadStatus.pause);
}
@ -541,10 +548,8 @@ public class DownloadManager implements DownloadStatusListener {
}
// 开启下载服务
mContext.startService(new Intent(mContext, DownloadService.class));
startDownloadServiceInBackground();
DownloadNotification.showDownloadingNotification(mContext);
}
public void addObserver(DataWatcher dataWatcher) {
@ -556,6 +561,22 @@ public class DownloadManager implements DownloadStatusListener {
Utils.log(DownloadManager.class.getSimpleName(), "removeObserver");
DataChanger.INSTANCE.deleteObserver(dataWatcher);
}
public void startDownloadServiceInBackground() {
mContext.startService(new Intent(mContext, DownloadService.class));
}
public void startDownloadService(DownloadEntity downloadEntity, DownloadStatus status) {
Intent serviceIntent = getIntent(downloadEntity, status);
// 当满足系统版本大于 8.0 、应用在后台运行时以前台服务开启
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& !HaloApp.getInstance().isRunningForeground) {
serviceIntent.putExtra(DownloadService.KEY_SERVICE_ACTION, DownloadService.START_FOREGROUND);
mContext.startForegroundService(serviceIntent);
} else {
mContext.startService(serviceIntent);
}
}
//
// public void removeObservers() {
// Utils.log(DownloadManager.class.getSimpleName(), "removeObserver");

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter;
import android.Manifest;
import android.animation.Animator;
import android.app.Activity;
import android.content.Context;
@ -52,6 +53,7 @@ import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
import pub.devrel.easypermissions.EasyPermissions;
import static com.gh.gamecenter.KcSelectGameActivity.SEND_OVER_REQUEST;
@ -127,6 +129,8 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
private Handler handler = new MyHandler(this);
private String[] mPermissions = {Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION};
@NonNull
public static Intent getIntent(Context context, boolean showConnHintDialog) {
Intent intent = new Intent(context, ChooseReceiverActivity.class);
@ -148,6 +152,15 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
mToolbarContainer = findViewById(R.id.normal_toolbar_container);
sp = PreferenceManager.getDefaultSharedPreferences(this);
// 检查权限
EasyPermissions.requestPermissions(this, "传输文件需要定位权限", 0x9527, mPermissions);
}
@Override
public void onPermissionsGranted(int requestCode, List<String> perms) {
super.onPermissionsGranted(requestCode, perms);
conUserIconTag = 1;
mRadarView.setSearching(true);
@ -177,6 +190,13 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
}
}
@Override
public void onPermissionsDenied(int requestCode, List<String> perms) {
super.onPermissionsDenied(requestCode, perms);
toast("请授予定位权限");
finish();
}
@Override
public int provideNavigationIcon() {
return R.drawable.ic_filereceive_back;
@ -292,7 +312,7 @@ public class ChooseReceiverActivity extends BaseActivity implements View.OnClick
// "\n2.点击首页左上角,进入下载管理 \n3.点击“零流量传送”,再点击“我要接收”",
// "确定");
// TODO 是否需要关闭扫描??
// 是否需要关闭扫描??
startActivity(ShareGhActivity.getIntent(this));
} //1.连接网络

View File

@ -13,11 +13,6 @@ public class CleanApkActivity extends NormalActivity {
@NonNull
public static Intent getIntent(Context context) {
// Intent intent = new Intent(context, CleanApkActivity.class);
// return new IntentFactory.Builder(context)
// .setActivity(CleanApkActivity.class)
// .setFragment(ApkCleanerFragment.class).build();
return getTargetIntent(context, CleanApkActivity.class, ApkCleanerFragment.class);
}

View File

@ -1,38 +0,0 @@
package com.gh.gamecenter;
import android.view.MenuItem;
import com.gh.base.BaseToolBarActivity;
import com.gh.gamecenter.normal.ToolbarController;
public class CommonActivity extends BaseToolBarActivity implements ToolbarController {
@Override
protected int getLayoutId() {
return R.layout.layout_wrapper_activity_toolbar;
}
@Override
protected boolean onNavigationIconClicked() {
onBackPressed();
return true;
}
@Override
public void setNavigationTitle(int res) {
}
@Override
public void setToolbarMenu(int res) {
}
@Deprecated
@Override
public MenuItem getMenuItem(int res) {
return null;
}
}

View File

@ -17,9 +17,6 @@ public class ConcernActivity extends NormalActivity {
public static Intent getIntent(Context context, String entrance) {
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
// return new IntentFactory.Builder(context)
// .setActivity(ConcernActivity.class)
// .setFragment(MyConcernFragment.class).setArgs(args).build();
return getTargetIntent(context, ConcernActivity.class, MyConcernFragment.class, args);
}

View File

@ -27,9 +27,6 @@ public class DownloadManagerActivity extends NormalActivity {
}
public static Intent getDownloadMangerIntent(Context context, String url, String entrance) {
// Intent intent = new Intent(context, DownloadManagerActivity.class);
// intent.putExtra(EntranceUtils.KEY_URL, url);
// intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_URL, url);
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
@ -37,53 +34,20 @@ public class DownloadManagerActivity extends NormalActivity {
}
public static Intent getDownloadMangerIntent(Context context, int position, String entrance) {
// Intent intent = new Intent(context, DownloadManagerActivity.class);
// intent.putExtra(EntranceUtils.KEY_URL, url);
// intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
bundle.putInt(BaseFragment_TabLayout.PAGE_INDEX, position);
return getTargetIntent(context, DownloadManagerActivity.class, DownloadFragment.class, bundle);
}
// public static void startDownloadManagerActivity(Context context, String url, String entrance) {
// Intent intent = new Intent(context, DownloadManagerActivity.class);
// intent.putExtra(EntranceUtils.KEY_URL, url);
// intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// context.startActivity(intent);
// }
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_downloadmanager;
// }
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//
// setNavigationTitle(getString(R.string.title_downloadmanager));
//
// startDownloadFragment();
// }
//
// private void startDownloadFragment() {
// int currentItem = getIntent().getIntExtra(EntranceUtils.KEY_CURRENTITEM, 0);
// Bundle data = getIntent().getBundleExtra(EntranceUtils.KEY_DATA);
// if (data != null) {
// currentItem = data.getInt(EntranceUtils.KEY_CURRENTITEM, 0);
// }
//
// getSupportFragmentManager().beginTransaction().replace(
// R.id.layout_fragment_content, DownloadFragment.newInstance(currentItem)).commitAllowingStateLoss();
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// startDownloadFragment();
// setIntent(intent);
// }
/**
* 根据packageName检查是否可以更新/插件化 如果可以则自动下载
*/
public static Intent getDownloadMangerIntent(Context context, String packageName, int position, String entrance) {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
bundle.putInt(BaseFragment_TabLayout.PAGE_INDEX, position);
bundle.putString(EntranceUtils.KEY_PACKAGENAME, packageName);
return getTargetIntent(context, DownloadManagerActivity.class, DownloadFragment.class, bundle);
}
}

View File

@ -34,8 +34,6 @@ public class GameDetailActivity extends NormalActivity {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
bundle.putParcelable(GameEntity.TAG, gameEntity);
// context.startActivity(new IntentFactory.Builder(context).setActivity(GameDetailActivity.class)
// .setFragment(GameDetailFragment.class).setArgs(bundle).build());
context.startActivity(getTargetIntent(context, GameDetailActivity.class, GameDetailFragment.class, bundle));
}
@ -46,8 +44,6 @@ public class GameDetailActivity extends NormalActivity {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_GAMEID, gameId);
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
// context.startActivity(new IntentFactory.Builder(context).setActivity(GameDetailActivity.class)
// .setFragment(GameDetailFragment.class).setArgs(bundle).build());
context.startActivity(getTargetIntent(context, GameDetailActivity.class, GameDetailFragment.class, bundle));
}
@ -57,8 +53,20 @@ public class GameDetailActivity extends NormalActivity {
public static void startGameDetailActivity(Context context, GameEntity gameEntity, String entrance, ExposureEvent traceEvent) {
DataUtils.onMtaEvent(context, "详情页面", "游戏详情", gameEntity != null ? gameEntity.getName() : "");
if (gameEntity != null
&& traceEvent != null
&& gameEntity.getId() != null
&& !gameEntity.getId().equals(traceEvent.getPayload().getGameId())) {
// 当游戏 ID 跟曝光 traceEvent 的游戏ID 不一样的时候更新 traceEvent 的游戏ID
ExposureEvent forNewPayload = ExposureEvent.Companion.createEvent(gameEntity,
traceEvent.getSource(),
ExposureTraceUtils.INSTANCE.appendTrace(traceEvent),
ExposureType.EXPOSURE);
traceEvent.setPayload(forNewPayload.getPayload());
}
ExposureEvent clickEvent = ExposureEvent.Companion.createEvent(gameEntity, traceEvent.getSource(), ExposureTraceUtils.INSTANCE.appendTrace(traceEvent), ExposureType.CLICK);
ExposureManager.INSTANCE.log(clickEvent, false);
ExposureManager.INSTANCE.log(clickEvent);
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
bundle.putParcelable(GameEntity.TAG, gameEntity);
@ -71,8 +79,18 @@ public class GameDetailActivity extends NormalActivity {
*/
public static void startGameDetailActivity(Context context, String gameId, String entrance, ExposureEvent traceEvent) {
if (traceEvent != null
&& !gameId.equals(traceEvent.getPayload().getGameId())) {
// 当游戏 ID 跟曝光 traceEvent 的游戏ID 不一样的时候更新 traceEvent 的游戏ID
ExposureEvent forNewPayload = ExposureEvent.Companion.createEvent(new GameEntity(gameId),
traceEvent.getSource(),
ExposureTraceUtils.INSTANCE.appendTrace(traceEvent),
ExposureType.EXPOSURE);
traceEvent.setPayload(forNewPayload.getPayload());
}
ExposureEvent clickEvent = ExposureEvent.Companion.createEvent(new GameEntity(gameId), traceEvent.getSource(), ExposureTraceUtils.INSTANCE.appendTrace(traceEvent), ExposureType.CLICK);
ExposureManager.INSTANCE.log(clickEvent, false);
ExposureManager.INSTANCE.log(clickEvent);
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_GAMEID, gameId);
@ -81,6 +99,28 @@ public class GameDetailActivity extends NormalActivity {
context.startActivity(getTargetIntent(context, GameDetailActivity.class, GameDetailFragment.class, bundle));
}
/**
* 启动游戏详情页面
*/
public static void startGameDetailCommentActivity(Context context, String gameId, String entrance) {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_GAMEID, gameId);
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
bundle.putBoolean(EntranceUtils.KEY_SKIP_GAME_COMMENT, true);
context.startActivity(getTargetIntent(context, GameDetailActivity.class, GameDetailFragment.class, bundle));
}
/**
* 如果存在多个游戏平台则打开
*/
public static void startGameDetailActivityByVote(Context context, String gameId, String entrance) {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_GAMEID, gameId);
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
bundle.putBoolean(EntranceUtils.KEY_OPEN_PLATFORM_WINDOW, true);
context.startActivity(getTargetIntent(context, GameDetailActivity.class, GameDetailFragment.class, bundle));
}
@Override
public void onBackPressed() {
if (Jzvd.backPress()) {

View File

@ -17,19 +17,11 @@ public class GameNewsActivity extends NormalActivity {
@NonNull
public static Intent getIntent(Context context, String gameName, String gameId, String entrance) {
// Intent intent = new Intent(context, GameNewsActivity.class);
// intent.putExtra(EntranceUtils.KEY_GAMENAME, gameName);
// intent.putExtra(EntranceUtils.KEY_GAMEID, gameId);
// intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
// return intent;
final Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_GAMENAME, gameName);
args.putString(EntranceUtils.KEY_GAMEID, gameId);
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
// return new IntentFactory.Builder(context)
// .setActivity(GameNewsActivity.class)
// .setFragment(GameNewsSearchFragment.class).setArgs(args).build();
return getTargetIntent(context, GameNewsActivity.class, GameNewsSearchFragment.class, args);
}

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -22,9 +23,10 @@ import com.gh.download.DownloadManager;
import com.gh.gamecenter.adapter.InstallFragmentAdapter;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.eventbus.EBDownloadStatus;
import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.manager.PackagesManager;
import com.gh.gamecenter.packagehelper.PackageViewModel;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadEntity;
@ -55,7 +57,8 @@ public class InstallActivity extends BaseActivity implements InstallFragmentAdap
TextView mNoDataSkipHint;
@BindView(reuse_nodata_skip_tv_btn)
TextView mNoDataSkipBtn;
private PackageViewModel mPackageViewModel;
private InstallFragmentAdapter mAdapter;
private boolean isEverpause = false;
@ -67,10 +70,12 @@ public class InstallActivity extends BaseActivity implements InstallFragmentAdap
if (locationList != null && locationList.size() != 0) {
GameEntity gameEntity;
for (int location : locationList) {
gameEntity = mAdapter.getGameList().get(location);
if (gameEntity != null) {
DownloadItemUtils.processDate(InstallActivity.this, gameEntity,
downloadEntity, mAdapter, location);
if (location < mAdapter.getGameList().size()) {
gameEntity = mAdapter.getGameList().get(location);
if (gameEntity != null) {
DownloadItemUtils.processDate(InstallActivity.this, gameEntity,
downloadEntity, mAdapter, location);
}
}
}
}
@ -100,19 +105,20 @@ public class InstallActivity extends BaseActivity implements InstallFragmentAdap
mNoDataSkip.setVisibility(View.GONE);
mNoDataSkipHint.setText("暂无游戏");
mNoDataSkipBtn.setText("查看精品推荐");
mNoDataSkipBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 0));
finish();
}
mNoDataSkipBtn.setOnClickListener(v -> {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 0));
finish();
});
mInstallRv.setLayoutManager(new LinearLayoutManager(this));
((DefaultItemAnimator) mInstallRv.getItemAnimator()).setSupportsChangeAnimations(false);
mAdapter = new InstallFragmentAdapter(this);
mInstallRv.addItemDecoration(new VerticalItemDecoration(this, 1, true));
mInstallRv.addItemDecoration(new VerticalItemDecoration(this, true));
mInstallRv.setAdapter(mAdapter);
mPackageViewModel = ViewModelProviders.of(this, new PackageViewModel.Factory()).get(PackageViewModel.class);
mPackageViewModel.getGameInstalledLiveData().observe(this,
gameInstalls -> mAdapter.initData(PackagesManager.filterSameApk(gameInstalls)));
}
@Override
@ -170,17 +176,6 @@ public class InstallActivity extends BaseActivity implements InstallFragmentAdap
}
}
//安装、卸载事件
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBPackage busFour) {
if ("安装".equals(busFour.getType()) || "卸载".equals(busFour.getType())) {
mInstallRv.setVisibility(View.VISIBLE);
mNoDataSkip.setVisibility(View.GONE);
mAdapter = new InstallFragmentAdapter(this);
mInstallRv.setAdapter(mAdapter);
}
}
//下载被删除事件
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBDownloadStatus status) {

View File

@ -18,9 +18,6 @@ public class KaiFuActivity extends NormalActivity {
public static Intent getIntent(Context context, String entrance) {
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
// return new IntentFactory.Builder(context)
// .setActivity(KaiFuActivity.class)
// .setFragment(KaiFuWrapperFragment.class).setArgs(args).build();
return getTargetIntent(context, KaiFuActivity.class, KaiFuWrapperFragment.class, args);
}

View File

@ -4,7 +4,6 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
@ -14,13 +13,15 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ethanhua.skeleton.Skeleton;
import com.ethanhua.skeleton.ViewSkeletonScreen;
import com.gh.base.BaseActivity;
import com.gh.base.OnRequestCallBackListener;
import com.gh.common.util.ApkActiveUtils;
import com.gh.common.util.DetailDownloadUtils;
import com.gh.common.util.DeviceTokenUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.LibaoUtils;
import com.gh.common.util.DeviceTokenUtils;
import com.gh.common.view.DownloadProgressBar;
import com.gh.common.view.VerticalItemDecoration;
import com.gh.download.DownloadManager;
@ -76,6 +77,10 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
LinearLayout mNoneData;
@BindView(R.id.detail_progressbar)
DownloadProgressBar mDownloadPb;
@BindView(R.id.list_skeleton)
View mListSkeleton;
private ViewSkeletonScreen mSkeleton;
private LibaoDetailAdapter mAdapter;
@ -91,38 +96,35 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
protected String mDownloadAddWord;
protected String mDownloadOffText;
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 0) {
long time = Utils.getTime(LibaoDetailActivity.this) - 5; // -5 防止获取服务器时间延迟发生的计算错误()
Calendar calendar = Calendar.getInstance();
Date date = new Date(time * 1000);
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 24);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.MILLISECOND, 0);
@Override
protected void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 0) {
long time = Utils.getTime(LibaoDetailActivity.this) - 5; // -5 防止获取服务器时间延迟发生的计算错误()
Calendar calendar = Calendar.getInstance();
Date date = new Date(time * 1000);
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 24);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.MILLISECOND, 0);
long targetTime = calendar.getTimeInMillis();
long delayedTime = targetTime - time * 1000;
Utils.log("=========delayedTime::" + delayedTime);
if (BuildConfig.DEBUG) {
toast("领取时间剩余: " + (delayedTime / 1000) + "");
}
handler.sendEmptyMessageDelayed(1, delayedTime);
} else if (msg.what == 1) {
String beforeStatus = mLibaoEntity.getBeforeStatus();
if ("ling".equals(beforeStatus)) {
mLibaoEntity.setStatus("repeatLinged"); // 可以重复领取
} else {
mLibaoEntity.setStatus("repeatTaoed"); // 可以重复领取
}
mAdapter.notifyItemChanged(0);
long targetTime = calendar.getTimeInMillis();
long delayedTime = targetTime - time * 1000;
if (BuildConfig.DEBUG) {
toast("领取时间剩余: " + (delayedTime / 1000) + "");
}
mBaseHandler.sendEmptyMessageDelayed(1, delayedTime);
} else if (msg.what == 1) {
String beforeStatus = mLibaoEntity.getBeforeStatus();
if ("ling".equals(beforeStatus)) {
mLibaoEntity.setStatus("repeatLinged"); // 可以重复领取
} else {
mLibaoEntity.setStatus("repeatTaoed"); // 可以重复领取
}
mAdapter.notifyItemChanged(0);
}
};
}
private DataWatcher dataWatcher = new DataWatcher() {
@Override
@ -150,7 +152,6 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
@NonNull
public static Intent getIntent(Context context, LibaoEntity libaoEntity, String entrance) {
Intent intent = new Intent(context, LibaoDetailActivity.class);
// intent.putExtra(LibaoEntity.TAG, libaoEntity);
HaloApp.put(LibaoEntity.TAG, libaoEntity);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
return intent;
@ -167,7 +168,6 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// outState.putParcelable(LibaoEntity.TAG, mAdapter.getLibaoEntity());
HaloApp.put(LibaoEntity.TAG, mAdapter.getLibaoEntity());
}
@ -176,11 +176,11 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
super.onCreate(savedInstanceState);
mName = getString(R.string.libao_detail);
setNavigationTitle(mName);
// mLibaoEntity = getIntent().getParcelableExtra(LibaoEntity.TAG);
mLibaoEntity = (LibaoEntity) HaloApp.get(LibaoEntity.TAG, false);
mIsScroll = true;
mSkeleton = Skeleton.bind(mListSkeleton).shimmer(false).load(R.layout.activity_libaodetail_skeleton).show();
mAdapter = new LibaoDetailAdapter(this, this, this, mLibaoEntity, mDownloadPb, mEntrance);
mLibaoDetailRv.setLayoutManager(new LinearLayoutManager(this) {
@Override
@ -191,18 +191,11 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
mLibaoDetailRv.addItemDecoration(new VerticalItemDecoration(this, 8, true));
mLibaoDetailRv.setAdapter(mAdapter);
mNoConnection.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mNoConnection.setVisibility(View.GONE);
mLlLoading.setVisibility(View.VISIBLE);
handler.postDelayed(new Runnable() {
@Override
public void run() {
getGameDigest();
}
}, 1000);
}
mNoConnection.setOnClickListener(v -> {
mSkeleton.show();
mNoConnection.setVisibility(View.GONE);
mLlLoading.setVisibility(View.VISIBLE);
mBaseHandler.postDelayed(() -> getGameDigest(), 1000);
});
if (mLibaoEntity == null) {
@ -277,7 +270,7 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
("ling".equals(beforeStatus) || "tao".equals(beforeStatus))) { //检查是否到了重复领取时间
mListStatus = mLibaoEntity.getStatus();
if (isCanLing()) {
handler.sendEmptyMessage(1);
mBaseHandler.sendEmptyMessage(1);
} else {
if ("ling".equals(beforeStatus)) {
mLibaoEntity.setStatus("repeatLing"); // 预备重复领取
@ -287,7 +280,7 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
mAdapter.notifyItemChanged(0);
DeviceTokenUtils.syncServerTime(LibaoDetailActivity.this);
handler.sendEmptyMessageDelayed(0, 5000);
mBaseHandler.sendEmptyMessageDelayed(0, 5000);
}
}
}
@ -353,6 +346,7 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
if (mLibaoEntity.getGame() == null) return;
String gameId = mLibaoEntity.getGame().getId();
RetrofitManager.getInstance(this).getApi().getGameNewsDigest(gameId)
.map(ApkActiveUtils.filterMapper)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<GameEntity>() {
@ -385,12 +379,6 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
mIsScroll = isScroll;
}
@Override
protected void onDestroy() {
super.onDestroy();
handler.removeCallbacksAndMessages(null);
}
@Override
public boolean handleBackPressed() {
// 重置领取状态
@ -428,6 +416,8 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
checkLibaoStatus();
}
mSkeleton.hide();
}
@Override
@ -445,6 +435,8 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
mLlLoading.setVisibility(View.GONE);
mLibaoDetailRv.setPadding(0, 0, 0, 0);
mNoConnection.setVisibility(View.VISIBLE);
mSkeleton.hide();
}
@Override
@ -459,13 +451,15 @@ public class LibaoDetailActivity extends BaseActivity implements LibaoDetailAdap
} else {
mNoneDataTv.setText("天了噜~页面不见了");
}
mSkeleton.hide();
}
// 领取/淘号失败,根据返回的时间重新倒数
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBUISwitch swith) {
if (LibaoUtils.REFRESH_LIBAO_TIME.equals(swith.getFrom())) {
handler.sendEmptyMessageDelayed(1, swith.getPosition());
mBaseHandler.sendEmptyMessageDelayed(1, swith.getPosition());
}
}

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