Compare commits

...

493 Commits

Author SHA1 Message Date
f5b1fff4ed 3.6.6 tinker base 2019-08-09 14:10:56 +08:00
0c00164113 升级数据库版本号 2019-08-09 12:00:56 +08:00
c1a910e2cb 当游戏详情的自定义栏目的基本信息内容大于80也显示展开按钮 2019-08-08 18:29:56 +08:00
4578984a75 修复不用安装游戏也能安装的问题 2019-08-08 18:10:44 +08:00
c8714c0c16 调整游戏详情自定义栏目的标签显示逻辑 2019-08-08 17:46:57 +08:00
28b1a3b7de Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-08-08 17:06:17 +08:00
f35cf6fa99 删除无用的下载监听(横向游戏列表没有下载按钮) 2019-08-08 17:05:59 +08:00
265b9b7ec1 调整游戏详情自定义栏目的展开逻辑 2019-08-08 14:37:22 +08:00
561d5026c9 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-08-08 11:46:38 +08:00
932b39ea09 插件化区域游戏显示的标签从“插件标签”改为“游戏标签” 2019-08-08 11:45:57 +08:00
bfb7e6aa71 fix build issue 2019-08-08 09:10:41 +08:00
13e2694dc0 完成封包测试优化汇总(2) https://gitlab.ghzs.com/pm/halo-app-issues/issues/601 2019-08-07 18:06:42 +08:00
325dd07b4d update CHANGELOG.md 2019-08-07 16:50:17 +08:00
ca197ae2ab Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-08-07 16:48:49 +08:00
8542f3aec6 update CHANGELOG.md 2019-08-07 16:48:35 +08:00
7b23d7a1a3 移除旧游戏详情插件信息/基本信息部分代码 2019-08-07 14:54:15 +08:00
55901c219a 游戏详情去掉基本信息栏目 2019-08-07 14:20:45 +08:00
973f6d2f20 修复V3.6.6-最后优化补充(20, 21, 22) https://gitlab.ghzs.com/pm/halo-app-issues/issues/599 2019-08-06 17:08:27 +08:00
42b05160d8 游戏搜索结果隐藏底部提示文案 2019-08-05 17:38:07 +08:00
729c48b8ad 修复社区专题的跳转问题 2019-08-05 10:45:01 +08:00
4a2d201ac2 更改游戏详情顶部标签的读取字段 2019-08-02 18:06:14 +08:00
22051ab626 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-08-02 14:58:21 +08:00
8188d8495b 修改游戏搜索广告位默认文案 2019-08-02 14:58:04 +08:00
6d3e613214 状态栏通知和系统客服支持跳转至社区专题 2019-08-02 14:25:46 +08:00
b8c2b73874 修复隐私弹窗内容过长导致按钮显示不全的问题 2019-08-01 17:16:56 +08:00
de14cc95ef 修复光环助手V3.6.6-最后优化补充(14, 15) https://gitlab.ghzs.com/pm/halo-app-issues/issues/599 2019-08-01 15:30:37 +08:00
a56814a3aa 修复游戏详情自定义栏目不设置标题设置正文但又有几个标签时显示会错乱的问题 2019-08-01 11:50:03 +08:00
689f1e3b68 修改提交重复/相似问题的弹窗交互 2019-08-01 10:30:16 +08:00
1d280ed079 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-31 17:59:31 +08:00
4a4118958d UserManager singleton add double checked locking pattern 2019-07-31 17:59:18 +08:00
c0010e7bdb 移除游戏详情的插件介绍模块 2019-07-31 17:23:01 +08:00
b03ba1df9d 修复下载弹窗的机型判断问题 2019-07-31 16:51:18 +08:00
5b28be29ac Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-31 16:42:14 +08:00
3ca7b7c9bd 社区相关UI更改 2019-07-31 16:41:44 +08:00
40e5a42212 修复游戏详情标签在 MuMu 模拟器上滑动出现多彩细线的问题 2019-07-31 14:47:43 +08:00
481e2d7925 修复浏览历史没有的游戏没有礼包按钮的问题 2019-07-31 14:03:18 +08:00
6c46d4b090 调整下载弹窗的弹出规则 2019-07-31 11:24:10 +08:00
9e5b8b5f29 优化首次启动 2019-07-31 10:55:31 +08:00
27f0354db5 更换引导图 2019-07-31 10:32:58 +08:00
eb68fe86e6 修改游戏名称颜色 2019-07-31 10:21:24 +08:00
cf4514614a 首次启动去除自动跳转至首页 2019-07-31 10:14:45 +08:00
f26bc062e1 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-07-30 22:56:41 +08:00
9f848594a1 增加申请权限的地方 2019-07-30 22:56:18 +08:00
4cb92f5d8c 编辑框实现逻辑回退到3.6.5 2019-07-30 22:28:34 +08:00
692fec5518 光环助手V3.6.6-最后测试汇总(1.2.10.13)https://gitlab.ghzs.com/pm/halo-app-issues/issues/598 2019-07-30 22:13:24 +08:00
1f978c3039 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-30 20:56:50 +08:00
72ca4958c1 光环助手V3.6.6 RELEASE(20190730-1600)测试问题汇总(前端)(7.8.11.12.17)https://gitlab.ghzs.com/pm/halo-app-issues/issues/597#note_25856 2019-07-30 20:56:43 +08:00
7ef693c6d8 修复闪退问题 2019-07-30 20:44:14 +08:00
32319affb7 完成3.6.6 RELEASE(20190730-1600)测试问题汇总(6,10,15,16,18~22) https://gitlab.ghzs.com/pm/halo-app-issues/issues/597 2019-07-30 20:25:12 +08:00
04458270d3 我的游戏优化 2019-07-30 19:32:25 +08:00
a4e2f4b90f 完成光环助手V3.6.6-权限相关测试汇总 https://gitlab.ghzs.com/pm/halo-app-issues/issues/596 2019-07-30 15:57:21 +08:00
bd390decf4 分类详情自动定位到选中分类位置
文章编辑不限制RichEditor高度
2019-07-30 15:40:00 +08:00
548430e4a8 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-30 11:04:54 +08:00
b29f80942f 光环助手V3.6.6 RELEASE(20190726-1930)测试问题汇总(前端)(8.9.13.22.23.25.26) https://gitlab.ghzs.com/pm/halo-app-issues/issues/594 2019-07-30 11:04:41 +08:00
5be275f8b0 修复自定义栏目的一些问题 2019-07-30 10:13:59 +08:00
1f84195cc9 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-30 09:21:16 +08:00
8204faef7d 修改列表中专题标题的颜色 2019-07-30 09:21:04 +08:00
0a889f4549 修复3.6.6 RELEASE(20190726-1930)测试问题汇总(2, 3, 10, 17, 21, 27) https://gitlab.ghzs.com/pm/halo-app-issues/issues/594 2019-07-29 19:39:41 +08:00
c9edf04a45 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-29 18:27:30 +08:00
5fc5d1f68f 修改游戏列表游戏名字颜色
删除无用代码
2019-07-29 18:27:20 +08:00
b7ae9d82ff 修复一些预约和游戏详情的问题 2019-07-29 18:12:18 +08:00
498c626227 修复V3.6.6 RELEASE(20190723-1830)测试问题汇总(21~23,25~26) https://gitlab.ghzs.com/pm/halo-app-issues/issues/592 2019-07-29 16:12:02 +08:00
24be8be4b2 修复游戏详情介绍模块下的评论内容显示异常问题 2019-07-29 15:43:57 +08:00
7700d3af79 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-29 15:31:51 +08:00
95dd96f7f9 修改游戏详情社区入口提示UI
修改社区搜索UI
2019-07-29 15:31:39 +08:00
2f89ba9707 完成3.6.6数据统计需求(MTA) https://gitlab.ghzs.com/pm/halo-app-issues/issues/579 的补充部分 2019-07-29 15:23:12 +08:00
1460e8cad3 修改游戏详情UI以及更换引导图 2019-07-29 10:00:38 +08:00
9e68a37205 fix build bug 2019-07-26 19:39:39 +08:00
d9591a826a fix bug 2019-07-26 18:46:48 +08:00
843ae23911 修复游戏标签详情以及分类详情下载相同包名不同游戏下载进度更新异常问题 2019-07-26 18:27:22 +08:00
bf1559f3bd 社区顶部tab栏“问题”改“全部” UI 2019-07-26 18:09:39 +08:00
9baf63ded5 问答社区首页增加推荐入口 2019-07-26 16:09:57 +08:00
5a5a4eccf0 https://gitlab.ghzs.com/pm/halo-app-issues/issues/589 (1.2.3.4.6.8.9.13.14.16.17.19.20) 2019-07-26 15:42:46 +08:00
d82270d8e9 评论禁言弹窗 2019-07-26 11:19:24 +08:00
39fd038fde 避免在启动按钮出现进度条 2019-07-25 17:02:17 +08:00
0e6192487e 修复FilterManager插入数据库失败问题 2019-07-25 16:41:05 +08:00
dee19c5961 https://gitlab.ghzs.com/pm/halo-app-issues/issues/588
(1.2.3.4.6.9.10.11.17.18)
2019-07-25 16:06:58 +08:00
e18a66dd68 修改 我的关注/我的游戏/总开服表/游戏搜索 UI 2019-07-24 16:55:25 +08:00
8c7efc7bb4 修改首页游戏/专题(多行Tab)/标签详情UI 2019-07-24 11:41:37 +08:00
5c88db4bc4 Fix Dialog BadTokenException 2019-07-23 11:19:54 +08:00
ccce9759d6 修复个人主页评分回复数量无法显示问题 2019-07-22 17:07:23 +08:00
857541665a 调整默认搜索UI 2019-07-22 14:33:05 +08:00
1737f4ffdc 修改开服表样式 2019-07-22 10:08:37 +08:00
85c839ffc8 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-20 18:23:18 +08:00
37168298ff 修复列表刷新问题 2019-07-20 18:23:11 +08:00
65c004e8cc 修复社区推荐位的一些问题 2019-07-20 17:58:45 +08:00
a87f642473 完成光环助手V3.6.6数据统计需求(MTA)补充部分 https://gitlab.ghzs.com/pm/halo-app-issues/issues/579 2019-07-20 17:16:12 +08:00
69a8f94607 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-07-20 16:23:54 +08:00
52438c682b 调整预约按钮样式 2019-07-20 16:23:45 +08:00
c9ea7e3b79 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-20 16:06:35 +08:00
d4289efbc6 问答社区优化汇总-后台(2, 4)https://gitlab.ghzs.com/pm/halo-app-issues/issues/572 2019-07-20 16:06:27 +08:00
d9b65705ad 完成光环助手V3.6.6 DEV(20190719-0915)测试问题汇总(3,5~7,12,15~19) https://gitlab.ghzs.com/pm/halo-app-issues/issues/585 2019-07-20 15:32:59 +08:00
5b35524f8d Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-20 11:43:10 +08:00
540274d8f5 光环助手V3.6.6 DEV(20190717)游戏评分相关(1.2.8.9.10.12.13.16.17) https://gitlab.ghzs.com/pm/halo-app-issues/issues/582 2019-07-20 11:43:03 +08:00
e4794c60f8 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-07-19 18:29:04 +08:00
95676ee4bd 修复预约弹窗和游戏详情的一些显示问题 2019-07-19 18:28:33 +08:00
42b8a9d5f9 游戏评分相关popupWindow自适应显示方向 2019-07-19 18:27:20 +08:00
a027cb16af Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-19 15:35:27 +08:00
5b75bd4c61 光环助手V3.6.6-新增 隐私政策 说明(一、1 二、三)https://gitlab.ghzs.com/pm/halo-app-issues/issues/577 2019-07-19 15:35:16 +08:00
3d90f9ee34 修复预约的一些问题 2019-07-19 11:59:30 +08:00
52543c828e 移除我的游戏的右滑分享 2019-07-18 18:12:19 +08:00
ed9c780e2d 修复点击下载按钮触发两次点击的问题 2019-07-18 17:50:16 +08:00
904b74be5b data后台数据统计 https://gitlab.ghzs.com/pm/halo-app-issues/issues/580 2019-07-18 16:19:37 +08:00
629fa23237 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-18 15:04:29 +08:00
9f6d441ad1 社区搜索样式修改以及最热模块增加问题内容 2019-07-18 15:04:20 +08:00
b0a99ced20 完成光环助手V3.6.6-用户注销账号功能 https://gitlab.ghzs.com/pm/halo-app-issues/issues/578 2019-07-17 17:46:13 +08:00
101874fd29 完成光环助手V3.6.6数据统计需求(MTA) https://gitlab.ghzs.com/pm/halo-app-issues/issues/579 2019-07-17 17:36:48 +08:00
3bae1a1af7 更新 GID 模块 2019-07-17 14:59:56 +08:00
b6f1138922 将上报推广激活数据延迟至获取到 IMEI 后发送 2019-07-17 11:57:01 +08:00
c90cc405b5 将触发申请权限的条件限制为仅第一次打开 2019-07-16 18:23:16 +08:00
c73690e546 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-16 17:42:51 +08:00
5b4ddcae1f 优化问题提交 2019-07-16 17:42:41 +08:00
1244d838ec 将权限申请添加到具体触发的位置 2019-07-16 17:39:52 +08:00
6c5da2d787 .properties 编码问题 2019-07-16 16:42:03 +08:00
9f2225de3d 修复编译问题 2019-07-16 16:19:54 +08:00
69c809a2c0 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-16 15:44:38 +08:00
ba27bd8a4c 问题提交增加相似/重复处理 2019-07-16 15:44:29 +08:00
1da1c6f86d 发现页面移除快传选项,移除定位权限 2019-07-16 14:51:17 +08:00
012eb42c8a 修复游戏详情标题过长会遮盖菜单按钮的问题 2019-07-16 14:16:10 +08:00
186a5f8d08 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-07-16 11:54:35 +08:00
522dac5c6b 修复搜索列表页面预约游戏点击无效的问题 2019-07-16 11:54:25 +08:00
32c2ab67fb Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-16 10:38:17 +08:00
54e0cdee75 开服表增加合并展开方案(实现方式修改) 2019-07-16 10:38:06 +08:00
d5a23f5239 完成游戏详情功能优化的UI调整 https://gitlab.ghzs.com/pm/halo-app-issues/issues/558 2019-07-16 10:18:08 +08:00
bbd035d7b1 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-16 10:07:20 +08:00
140c048b71 开服表增加合并展开方案 2019-07-16 10:07:06 +08:00
d0306f311a 大致完成游戏详情功能优化的UI调整(缺右上角的几个图标) https://gitlab.ghzs.com/pm/halo-app-issues/issues/558 2019-07-15 18:17:28 +08:00
0c918bd826 默认渠道(GH_TEST)开启JS调试 2019-07-15 16:00:15 +08:00
b2064c3758 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-15 15:45:37 +08:00
11e276a977 编辑器根据当前环境自动引用远程JS/CSS(正式/测试) 2019-07-15 15:45:20 +08:00
14ee8921cf 将社区顶部tab栏"问题"改"全部" https://gitlab.ghzs.com/pm/halo-app-issues/issues/574 2019-07-15 15:21:10 +08:00
2dcc4e974d 兼容社区文章跳转格式 2019-07-15 15:19:05 +08:00
5b639d78cf 删除无用配置 2019-07-15 11:48:22 +08:00
35c4fa1209 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-12 18:31:42 +08:00
8a13d6a60b Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-12 18:30:27 +08:00
b94c742100 调整详情页介绍Tab中游戏介绍的显示样式 2019-07-12 18:28:02 +08:00
967f281210 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-12 18:25:42 +08:00
1dba6f438f 社区文字编辑适配软键盘 2019-07-12 18:25:31 +08:00
fb464aefaa 删掉七陌客服的语音功能 2019-07-12 17:53:22 +08:00
35b6db66b3 去掉读取通讯录、蓝牙和读取用户账户的权限注册 2019-07-12 17:34:14 +08:00
396862fc0a 修改账号被挤掉提示弹窗内容 2019-07-12 16:48:45 +08:00
b6ab058cb4 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-12 16:33:15 +08:00
fb4d1df210 完善选择社区 2019-07-12 16:33:06 +08:00
ffaa32be29 完成问答社区优化汇总-前端(9, 10) https://gitlab.ghzs.com/pm/halo-app-issues/issues/573 2019-07-12 15:09:42 +08:00
18af7c51c8 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-12 11:17:40 +08:00
e45b46e8a5 文章撰写页面编写正文内容时自动调整高度 2019-07-12 11:17:23 +08:00
4419463c01 完成"全部文章"页面 2019-07-12 10:53:15 +08:00
51115e070b 问答社区首页增加推荐入口(全部文章尚未完全接入) https://gitlab.ghzs.com/pm/halo-app-issues/issues/568 2019-07-11 18:26:10 +08:00
783889f050 修复编译问题 2019-07-11 17:47:45 +08:00
547229d017 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-11 17:23:30 +08:00
ad05198be1 社区选择改版初步完成(等待后台接口完成) 2019-07-11 17:23:20 +08:00
f93f31784e 修复详情页更新内容区域的展开问题 2019-07-11 16:10:23 +08:00
05d4109f0b 编辑器 JS 和 CSS 引用切换至测试环境 2019-07-11 14:17:19 +08:00
9ea377b72b 自动打包开启编辑器网页调试 2019-07-11 10:37:36 +08:00
a4eec37467 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-07-10 18:17:29 +08:00
14d6c9d6f4 调整筛选大小控件的项样式 2019-07-10 18:17:20 +08:00
4707112837 优化游戏详情列表代码 2019-07-10 18:16:14 +08:00
d4f78631d9 修复包名相同、游戏ID不同的列表下载进度更新不准确问题(目前只做了SubjectAdapter,待产品需求出来再全局修改) 2019-07-10 17:33:05 +08:00
dc5c2971c8 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-10 15:39:06 +08:00
07f1180ccd 解决分享由于持有activity实例造成的内存泄露 2019-07-10 15:38:37 +08:00
e483540d3d 去掉详情页各模块间的分割线 2019-07-10 10:31:07 +08:00
362518959b 修复详情页自定义栏目展开异常的问题 2019-07-09 19:56:50 +08:00
7b1ac0f70c 修复详情页自定义栏目不显示展开按钮的问题 2019-07-09 18:26:32 +08:00
fc18da47da 将游戏分类详情页面样式换成与标签详情一致(旧代码待完成需求再删除) https://gitlab.ghzs.com/pm/halo-app-issues/issues/566 2019-07-09 17:09:02 +08:00
6d14af968f 当下载过程中用户强制退出APP(直接杀死进程)再重新打开app时,下载状态会从下载中/等待中变成连接Wi-Fi自动下载 2019-07-09 16:14:20 +08:00
2cff450fa4 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-08 18:28:10 +08:00
069b82518d 修复游戏专题接口请求异常问题 2019-07-08 18:27:58 +08:00
91663c4733 接入今日头条 SDK 2019-07-08 17:13:28 +08:00
d7cf91ec5c 游戏专题优化 2019-07-08 14:20:02 +08:00
4854c15f8c Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-08 11:27:44 +08:00
248e63ba04 图片压缩出现OOM/压缩失败时直接返回原图 2019-07-08 11:27:20 +08:00
fc19ce037e 基本完成游戏详情功能优化的逻辑(UI待出图再调整) https://gitlab.ghzs.com/pm/halo-app-issues/issues/558 2019-07-08 11:19:04 +08:00
020b67764b 初步对接详情页自定义栏目 2019-07-05 18:28:03 +08:00
32d25e5490 大致完成对旧游戏详情页面模块的位置变更 2019-07-05 16:57:27 +08:00
d8cd68025e Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-05 09:57:59 +08:00
38a8b190fe 游戏详情 关联关注定位至【动态】Tab 2019-07-05 09:56:32 +08:00
3788e8ce20 修复游戏详情的视频播放统计问题 2019-07-04 10:53:26 +08:00
b02a6377ab 修复新闻详情内容显示不全问题 2019-07-03 17:56:14 +08:00
ac550094df 游戏搜索默认页面增加跳转至标签详情 2019-07-03 14:57:29 +08:00
2ea75c1664 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-03 11:18:08 +08:00
cf07f12cad 更新QQ分享 卡片QQ分享/QQ空间分享未安装QQ时需要显示安装弹窗 2019-07-03 11:17:56 +08:00
fb00833d3f 修复二级分类数量刚好为 7 时不显示展开按钮的问题 2019-07-03 09:33:02 +08:00
91046c350c 光环前端需求汇总(2019年6月第4周)(1.3.4.8) https://gitlab.ghzs.com/pm/halo-app-issues/issues/560 2019-07-02 15:30:13 +08:00
3b2c294323 Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev 2019-07-02 10:59:54 +08:00
4507c7e581 专题详情修改 2019-07-02 10:59:31 +08:00
6d02fb22a2 完成光环前端需求汇总(6月第4周)(7,9,10) https://gitlab.ghzs.com/pm/halo-app-issues/issues/560 2019-07-02 10:52:33 +08:00
e926f2ca77 调整 WorkManager 调用 2019-07-02 10:24:42 +08:00
77267add3b 优化大小选择控件的 API 2019-07-02 10:23:22 +08:00
460a4eed57 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-07-02 10:07:29 +08:00
84ea2cd1af 专题详情增加多行类型 2019-07-02 10:07:06 +08:00
68e1b9b700 修复闪退问题 2019-07-01 18:28:51 +08:00
361d260964 优化后台下载逻辑,提高下载稳定性 2019-07-01 17:03:38 +08:00
3a66d778ed 修复标签详情页下载状态更新错乱的问题 2019-06-28 18:10:08 +08:00
dbf5fcda58 处理内存泄漏 2019-06-28 11:14:43 +08:00
a5309f2c9e Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-28 09:54:55 +08:00
13b81fa3e8 专题新增横向行样式 2019-06-28 09:54:47 +08:00
8c60267997 调整标签详情页UI 2019-06-27 18:07:52 +08:00
839efd6e32 处理数组越界异常 2019-06-27 16:45:10 +08:00
54c2788e0a 完成光环助手V3.6.6-游戏标签详情功能(https://gitlab.ghzs.com/pm/halo-app-issues/issues/550) 2019-06-27 16:23:33 +08:00
1439e598fc 整理游戏专题代码(页面传递参数不清晰问题) 2019-06-27 11:43:20 +08:00
7a9e6bdb97 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-27 11:17:55 +08:00
3b58aead33 修复专题 TabLayout 模式下显示异常问题 2019-06-27 11:17:48 +08:00
69d379d07b 微调标签详情页页面 2019-06-26 18:28:02 +08:00
cc9d5765d5 完成光环助手V3.6.6-游戏标签详情逻辑 (https://gitlab.ghzs.com/pm/halo-app-issues/issues/550) UI 待微调 2019-06-26 17:50:31 +08:00
aa9cf8b193 修改VersionCode 2019-06-26 11:24:27 +08:00
b8afc028de Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-26 11:23:18 +08:00
e7a594003f 修复ExpendTextView收缩状态无法显示Span样式问题 2019-06-26 11:23:03 +08:00
5605df96dc 更新 leakCanary 2019-06-26 09:47:14 +08:00
c499c19e5b 游戏搜索添加部分搜索历史 2019-06-25 17:15:36 +08:00
106f3e932e 评分编辑 字数限制 2019-06-25 10:32:19 +08:00
04b5005218 增加评分修改记录支持修改内容样式(暂时无法'...全文'兼容) 2019-06-25 10:18:31 +08:00
32442985c5 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-24 14:40:14 +08:00
1ce6946507 增加评分修改记录(修改内容样式暂时无法支持-HTML) 2019-06-24 14:40:04 +08:00
a1a3481939 优化 BiResponse 2019-06-24 10:59:43 +08:00
2db5b5665c 处理闪退问题 2019-06-24 10:29:11 +08:00
a184d018da 增加游戏评论规(免责声明) 2019-06-23 11:29:19 +08:00
233c3f728a Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-23 10:02:10 +08:00
1102d22919 编辑评分增加获取设备别名 2019-06-23 10:02:01 +08:00
6c903ea25e 升级版本号至 3.6.6,正式环境也切换到 3.6.6 的接口 2019-06-22 16:57:24 +08:00
602bc61b89 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-22 16:27:54 +08:00
42201b3d28 修复阅读答案、社区文章时会先闪现输入光标的问题 2019-06-22 16:27:45 +08:00
a8889c16eb Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-21 18:07:24 +08:00
edaab18894 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-21 18:05:33 +08:00
d300e74fbd 支持修改游戏评分 2019-06-21 18:05:25 +08:00
1a804b2096 启用 kapt 增量编译提高编译速度 2019-06-21 17:59:36 +08:00
8c7f1ad596 完成游戏下载弹窗&游戏详情弹窗系统(https://gitlab.ghzs.com/pm/halo-app-issues/issues/548、https://gitlab.ghzs.com/pm/halo-app-issues/issues/549) 2019-06-21 17:17:21 +08:00
b59548d339 游戏评论 跳转部分弹窗(更多,排序) 2019-06-21 15:23:54 +08:00
181caf6dfa Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-21 11:41:13 +08:00
2eafb6b31f 个人主页增加评分相关 2019-06-21 11:40:56 +08:00
742f497833 完成光环助手V3.6.6-游戏预约功能 (https://gitlab.ghzs.com/pm/halo-app-issues/issues/542) 2019-06-20 14:49:35 +08:00
5119bdf545 游戏评论 页面数据同步 适配'我的评论'模块 2019-06-20 10:04:55 +08:00
ce44d3b2a7 游戏详情-评论增加'我的评论'模块 2019-06-20 09:48:48 +08:00
bf7ed2cd7d Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-20 09:35:22 +08:00
1e287c61fb 更换图标 2019-06-20 09:35:14 +08:00
d3e42aa876 基本完成预约流程,细节待完善 2019-06-19 18:29:20 +08:00
58e3629c32 游戏详情-评论增加 过滤/排序 功能 2019-06-19 18:18:27 +08:00
990f395b4d 修复富文本编辑框插入文章和插入回答闪退问题 2019-06-19 09:23:17 +08:00
b8500b4345 删掉预约测试代码 2019-06-18 18:32:05 +08:00
b52960c47f 初步对接预约接口 2019-06-18 18:15:46 +08:00
50ad63735f 更新混淆规则 2019-06-18 11:24:17 +08:00
89bc3d37f8 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-17 19:12:29 +08:00
9cfb820036 全局修改LoadingView 2019-06-17 19:12:16 +08:00
365abc3c1e 删除无用文件 2019-06-17 17:46:22 +08:00
7a1555e8c0 完成前端需求汇总201906第二周(7,8,9,11,14,15) https://gitlab.ghzs.com/pm/halo-app-issues/issues/547 2019-06-17 17:43:24 +08:00
6345bb55d2 全局替换文案 举报->投诉 2019-06-17 17:32:43 +08:00
b48a274707 调整快传相关代码目录 2019-06-17 17:21:46 +08:00
55e9bd681e 页面微调,下载管理移除免流量传送,免流量传送改为独立页面 2019-06-17 17:15:56 +08:00
aec9ec8294 autoscrollviewpager以源码方式引入
原因:项目已经多年无人维护且现在无法支持androidX
2019-06-17 16:05:19 +08:00
4229888cc9 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-17 15:46:07 +08:00
103b8d32f5 首页工具栏我的关注换成消息中心以及整理未读消息代码 2019-06-17 15:45:43 +08:00
303c98be96 优化浏览记录页面代码 2019-06-17 09:56:01 +08:00
c84da4c061 修复下拉刷新骨架的显示问题 2019-06-17 09:55:31 +08:00
3a4d466907 优化曝光上报逻辑 2019-06-16 16:32:30 +08:00
e7143d8da4 修复一些闪退问题 2019-06-16 15:05:19 +08:00
99fc35e632 完成简单的预约游戏弹窗样式 2019-06-16 14:18:48 +08:00
95cc8a1484 完成游戏搜索结果交互 2019-06-14 15:37:28 +08:00
c139d6bb8a fix merge bug 2019-06-13 17:47:12 +08:00
3d0b5bb8b6 merge 2019-06-13 16:12:40 +08:00
552ab8e8c4 merge 2019-06-13 16:08:28 +08:00
596e2e9673 完成搜索默认页面 2019-06-13 15:21:53 +08:00
66c7dc6539 修复更新 androidX 后选择标签的显示问题 2019-06-13 11:49:20 +08:00
2585098c20 将 PercentLayout 替换为 ConstraintLayout 2019-06-13 11:35:04 +08:00
1f5f51da68 统一 androidX 依赖版本 2019-06-13 10:49:41 +08:00
25e119202a 统一依赖版本 2019-06-13 10:48:57 +08:00
7b421d0b3a 移除无用的 legacy support 2019-06-12 18:24:07 +08:00
0066135f12 从 git 上移除部分无用文件 2019-06-12 18:12:31 +08:00
b930d3fa54 将 android support library 更新至 androidX (部分手尾仍需后续处理) 2019-06-12 17:58:15 +08:00
129a549110 Merge branch 'xiechanghong' into 'dev'
Xiechanghong

See merge request !7
2019-06-11 10:15:52 +08:00
22883dc195 Merge remote-tracking branch 'origin/xiechanghong' into xiechanghong 2019-06-10 18:52:08 +08:00
516299ee55 给分类页面,资讯中心,礼包中心,资讯文章详情,游戏详情-动态页面加上缺省图
规范格式

规范格式
2019-06-10 18:50:14 +08:00
a9835ba032 规范格式 2019-06-10 18:42:51 +08:00
dda154a927 给分类页面,资讯中心,礼包中心,资讯文章详情,游戏详情-动态页面加上缺省图
规范格式
2019-06-10 18:25:08 +08:00
cd5856778c 修复了保存图片但是系统图库没有显示的问题 2019-06-10 16:28:03 +08:00
d7db950878 尝试修复在 Android 8.0 及以后设备在执行后台任务时的偶发闪退问题 2019-06-10 14:59:25 +08:00
62f184f6ea 修复一些闪退问题 2019-06-10 10:03:18 +08:00
ab0d341bca 整理代码 2019-06-09 14:31:51 +08:00
1b27f481ba 调整文件位置 2019-06-06 17:31:05 +08:00
b68f9be8dd 微调代码 2019-06-06 17:21:02 +08:00
e9b0dbdfb6 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-06 17:17:28 +08:00
0b21dca0a4 实现游戏详情评论页面与评论详情的数据同步(回答数/点赞) 2019-06-06 17:17:10 +08:00
5e5d84cb65 添加 GID 获取失败重试 2019-06-06 15:49:24 +08:00
c2661d0586 完成前端需求汇总(2019年6月第1周) (8~11) https://gitlab.ghzs.com/pm/halo-app-issues/issues/538 2019-06-06 15:34:51 +08:00
032348e3fd 将测试环境的接口切换至 3.6.6 2019-06-06 15:31:52 +08:00
840a682665 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-05 17:57:27 +08:00
04807a5653 光环前端需求汇总(2019年6月第1周)(4.5.12.13.14.15.16) https://gitlab.ghzs.com/pm/halo-app-issues/issues/538#note_22426 2019-06-05 17:56:40 +08:00
5ebea3f3dd 修复提交应用列表不及时的问题 2019-06-05 17:20:51 +08:00
49ca3835c0 修复游戏图标为 gif 时下载会闪烁的问题 2019-06-05 17:19:33 +08:00
566307105e Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-05 15:44:03 +08:00
e8e75408cc 多设备登录同一帐号,取消toast操作 2019-06-05 15:43:31 +08:00
b52aa38552 将获取 GID 失败的信息发送到 MTA 2019-06-05 10:45:09 +08:00
8d55b251c3 3.6.5 tinker-base 2019-06-04 09:35:25 +08:00
386c7b19c1 versionName:3.6.5 versionCode:91
该版本为过度版本(修复3.6.4的bug)
2019-06-03 17:48:46 +08:00
eaaa168ee1 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-06-03 17:46:12 +08:00
d9f5811d86 默认关闭tinker更新弹窗 2019-06-03 16:18:31 +08:00
27d3470abc 修复使用错误上下文的问题 2019-06-03 14:31:54 +08:00
36f7427613 Merge branch '3.6.5' into 'dev'
修复 3.6.4 遗留问题

See merge request !6
2019-06-03 14:30:23 +08:00
929c117ddb 修复使用错误上下文的问题 2019-06-03 10:26:48 +08:00
7d6d77fae5 修复激活数据链接出错的问题 2019-06-03 10:22:20 +08:00
2297461d91 修复数组越界问题 2019-06-03 10:22:12 +08:00
a26a3bebad 修复 jenkins 打包时间时区不对的问题 2019-06-03 10:22:04 +08:00
4a673de424 修复激活数据链接出错的问题 2019-06-03 10:11:29 +08:00
a837c2ccd4 修复数组越界问题 2019-05-31 18:30:11 +08:00
10ee3132fd 修复 jenkins 打包时间时区不对的问题 2019-05-31 09:57:17 +08:00
783fbecb00 3.6.4 封包 2019-05-30 16:11:01 +08:00
de1b5ba2f3 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-30 15:49:21 +08:00
9a9e288c44 3.6.4 封包 2019-05-30 15:37:51 +08:00
424b48f631 更改远端 JS 和 CSS 至正式环境 2019-05-30 15:21:38 +08:00
86d1cd4e12 微调编译脚本 2019-05-30 15:01:02 +08:00
e700ff4744 微调编译脚本 2019-05-30 14:43:56 +08:00
34729c8c28 添加 jenkins 编译脚本 2019-05-30 14:26:54 +08:00
5a08611fdd 测试包在设置关于里显示编译时间 2019-05-30 11:51:57 +08:00
a73da1d6e4 修复游戏评论详情从弹窗回退后无法即时调起软键盘问题 2019-05-29 18:37:14 +08:00
28b8c20756 修复分类展开部分标签会丢失的问题 2019-05-29 14:41:47 +08:00
6941821b71 矫正网页资源的时间戳 2019-05-29 14:15:18 +08:00
3c2244701c 关闭 webview 调试 2019-05-29 14:07:21 +08:00
38dc873e2e Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-29 10:58:51 +08:00
c24ffb2489 修复插入数据造成浏览记录出现多个空格的问题 2019-05-29 10:58:34 +08:00
929864be30 优化游戏评论详情点赞刷新问题 2019-05-28 18:22:10 +08:00
bd87163a9b 显示/隐藏图片是无需回调(RE.callback()) 2019-05-28 17:52:23 +08:00
785c740668 修复图片名存在特殊字符无法显示的问题 2019-05-28 17:35:16 +08:00
25aa16f774 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-28 16:38:05 +08:00
9ec89c0dc1 光环助手V3.6.4测试遗留问题(2.3.5.15.16.17) https://gitlab.ghzs.com/pm/halo-app-issues/issues/536#note_22029 2019-05-28 16:37:25 +08:00
3e5bd2b087 修复我的提问、回答和文章页面分页的顺序变动问题 2019-05-28 15:31:56 +08:00
9de6cff13b 浏览记录的文章和答案过滤掉插入的内容 2019-05-27 17:53:19 +08:00
6b98bc9fca 修复了答案上下滑动可能出现页面偏移的问题 2019-05-27 17:52:39 +08:00
cdf9b0a071 去掉测试 toast 2019-05-26 15:14:49 +08:00
ff57e9c759 merge 2019-05-24 22:48:33 +08:00
b253113843 光环助手V3.6.4 RELEASE(20190524-2130)测试问题汇总(1.2.3.4.11) https://gitlab.ghzs.com/pm/halo-app-issues/issues/534 2019-05-24 22:47:32 +08:00
b7305337bf 修复浏览记录的游戏名字以及推送点击记录的问题 2019-05-24 22:10:34 +08:00
455e2ad723 处理文章隐藏时的弹两个 toast 的问题 2019-05-24 21:16:18 +08:00
8cf87b991b 推送辅助提示变更 2019-05-24 21:12:20 +08:00
ae0b289c3e 光环助手V3.6.4 RELEASE(20190524-1230)(1.2.3.4.5.6.7.8.9.10.11.12.14.15.16)测试问题汇总 https://gitlab.ghzs.com/pm/halo-app-issues/issues/533 2019-05-24 21:06:37 +08:00
9404c3349a 修复游戏评论详情重复点赞toast异常问题 2019-05-24 17:37:53 +08:00
28afbb8d35 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-24 17:16:18 +08:00
5b24443121 富文本编辑器添加样式之前将内容字符进行htmlEncode,防止JS端JSON解释失败 2019-05-24 17:15:37 +08:00
1f9aacbbbd 去掉多余的 toast 2019-05-24 16:52:32 +08:00
d194b33a5d 富文本编辑器初始化代码放置到assets目录,通过本地的rich_editor.js 访问远端的JS和CSS代码
目的:修复低版本内核浏览器的事件无法回调到原生android端问题
2019-05-24 16:02:13 +08:00
55010f0ef7 关闭rich_editor.js log 2019-05-24 14:21:10 +08:00
49fab9ed04 游戏详情判断是否安装该游戏时进行包名过滤 2019-05-24 11:44:04 +08:00
1cd1b578ec merge 2019-05-24 11:27:28 +08:00
184c56aac5 光环助手V3.6.4 DEV(20190517-1020)测试问题汇总(游戏评分)(补充) 2019-05-24 11:25:26 +08:00
7c39037472 修复记录安装新应用时记录了错误应用名的问题 2019-05-24 11:12:13 +08:00
786a803793 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-24 10:58:52 +08:00
273f0e185d 修复关闭插件功能资讯和专题相关操作失效问题
修改游戏评分引用区域样式
2019-05-24 10:58:46 +08:00
eebc2c3940 统一已开通社区的列表排序 2019-05-24 10:25:05 +08:00
3a964d629e Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-24 09:49:57 +08:00
ff041f705e 光环助手V3.6.4 DEV(20190521-1900)测试问题汇总(前端)(2.3.4.5(1).19.20.21) https://gitlab.ghzs.com/pm/halo-app-issues/issues/530#note_21778 2019-05-24 09:49:41 +08:00
af62fc9a68 替换关闭评论图标 2019-05-23 18:20:44 +08:00
6ff415cc0d 完成光环助手应用数据上报功能 https://gitlab.ghzs.com/pm/halo-app-issues/issues/531 2019-05-23 18:04:53 +08:00
41de94e6f5 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-23 16:58:36 +08:00
60d91ca04e 光环助手V3.6.4 DEV(20190521-1900)测试问题汇总(编辑器)(1.5.6.7.9.10.12.13.15.16.17.18) https://gitlab.ghzs.com/pm/halo-app-issues/issues/529 2019-05-23 16:58:29 +08:00
19004b2073 完成V3.6.4DEV(20190521-1900)测试问题汇总(6,7,8,9,10,12,14,16,17,22) https://gitlab.ghzs.com/pm/halo-app-issues/issues/530 2019-05-23 16:42:01 +08:00
70b536e6bd 修复社区编辑器插入自定义样式问题(上次兼容性修改遗留) 2019-05-23 14:36:45 +08:00
5009678587 本地JS与远程同步 2019-05-23 11:07:55 +08:00
a7a01bbe16 修复社区编辑框不兼容个别机型问题(VIVO x7 5.1.1) 2019-05-23 11:04:57 +08:00
9b2ce51c87 更换引导图 2019-05-22 16:46:36 +08:00
c735d4e717 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-22 16:26:10 +08:00
6fb4dac45d update CHANGELOG 2019-05-22 16:26:02 +08:00
3d49258b84 优化代码结构 2019-05-22 16:15:41 +08:00
c23aa12d09 优化编辑回答的接口异常处理 2019-05-22 16:08:58 +08:00
6f6ddf9fbd 更换引导图 2019-05-22 10:33:59 +08:00
63837b5c31 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-21 16:28:31 +08:00
27e245c241 我的关注不能点击关联关注进行关注操作 2019-05-21 16:28:24 +08:00
7775494ade 完成3.6.4 DEV(20190517-1020)测试问题汇总的(3,4,7,8,9,10,11,17,18) https://gitlab.ghzs.com/pm/halo-app-issues/issues/525 2019-05-21 16:12:06 +08:00
a3ce139b86 曝光增加 ROM 字段 2019-05-21 16:11:03 +08:00
ad470f10f4 光环助手V3.6.4 DEV(20190517-1020)测试问题汇总(编辑器)(1.2.3.4.5.6.8.9) https://gitlab.ghzs.com/pm/halo-app-issues/issues/527 2019-05-21 16:06:20 +08:00
302d12083b 光环助手V3.6.4 DEV(20190517-1020)测试问题汇总(游戏评分)(1.4.5.6.7.8.9.10.11) https://gitlab.ghzs.com/pm/halo-app-issues/issues/526 2019-05-21 11:17:29 +08:00
d40dd15af4 撰写回答页面添加我来回答遮罩 2019-05-20 15:28:18 +08:00
440eb8a07b 完成DEV(20190515-1900)测试问题汇总(1,2,3,16,17,18) https://gitlab.ghzs.com/pm/halo-app-issues/issues/524 2019-05-20 11:47:17 +08:00
361b861d5f 修复部分(关注/收藏)按钮,登录后不能即时刷新问题 2019-05-20 11:24:20 +08:00
b518b2961a Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-17 18:24:38 +08:00
bfae4e1501 光环助手V3.6.4 DEV(20190515-1900)测试问题汇总(前端)(10.14.15) https://gitlab.ghzs.com/pm/halo-app-issues/issues/524#note_21505 2019-05-17 18:24:32 +08:00
d3e13dd8c6 完成需求 MTA 补充需求 2019-05-17 17:27:42 +08:00
073c35ca08 浏览记录去掉游戏名称后缀 2019-05-17 17:27:19 +08:00
99b4373561 处理闪退问题 2019-05-17 17:26:51 +08:00
52dcea477e 评分相关间距调整 2019-05-17 17:03:53 +08:00
6abb8d715b Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-17 16:36:53 +08:00
51016b0704 社区编辑框插入链接样式时先将当前blockquote标签换成p标签再插入 2019-05-17 16:36:47 +08:00
d14c150070 完成需求'所有游戏名字处理成“名称+后缀”的格式的' https://gitlab.ghzs.com/pm/halo-app-issues/issues/521 2019-05-17 16:28:32 +08:00
f59f8a3e5b 完成光环前端需求汇总(2019年5月第3周)(1,3,11,12,13) https://gitlab.ghzs.com/pm/halo-app-issues/issues/522 2019-05-17 15:02:56 +08:00
965be0b5cd Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-17 14:40:46 +08:00
716900fc5d 社区编辑框增加长按选择回调 2019-05-17 14:40:31 +08:00
14280d802e 更改回答详情和文章详情底部按钮图标 2019-05-17 11:32:03 +08:00
39924857e5 我的游戏页面进行包名过滤处理 2019-05-17 10:51:47 +08:00
c88bda6615 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-16 18:37:47 +08:00
ecb80ca70d 光环助手V3.6.4 DEV(20190513-1900)编辑器相关(1.3.4.6.7.8.9.11.17) https://gitlab.ghzs.com/pm/halo-app-issues/issues/519#note_21413 2019-05-16 18:37:38 +08:00
51b03b78ce 在插入内容的 div 里添加 class 帮助后端生成摘要时去掉不需要的内容 2019-05-16 18:20:28 +08:00
a7fd029ed2 反馈提交的字段修改 2019-05-16 16:01:31 +08:00
5beb29ad09 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-16 15:03:57 +08:00
e7dc2ca810 光环前端需求汇总(2019年5月第3周)(5.6.7.9) https://gitlab.ghzs.com/pm/halo-app-issues/issues/522#note_21366 2019-05-16 15:03:45 +08:00
b5ce0db1ff 将 JS 和 CSS 的引用改为远端 2019-05-16 10:22:41 +08:00
c8b52902e9 评分相关的POST请求进行错误处理 2019-05-16 09:36:28 +08:00
dbc4e0ac26 历史搜索清空图标自适应宽高 2019-05-15 18:18:22 +08:00
a0d2860970 修改游戏搜索历史页面样式 2019-05-15 18:06:37 +08:00
77c1a05a4a 修改资讯中心标签样式 2019-05-15 17:59:23 +08:00
aeee2e049d 回答/文章 插入链接的默认图片换成网络图片 2019-05-15 17:13:21 +08:00
525b184ad4 游戏评论详情增加下载相关逻辑 2019-05-15 16:14:05 +08:00
76e0fe9f9a 光环助手V3.6.4 DEV(20190513-1900)游戏评分相关(2.4.5.6.8.9.12.13.16.18.19.20.21) https://gitlab.ghzs.com/pm/halo-app-issues/issues/520 2019-05-15 15:14:30 +08:00
06ddef114c Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-14 14:48:52 +08:00
32cdcc1304 光环助手V3.6.4 DEV(20190509-1900)测试问题汇总(前端)(3.4.5)https://gitlab.ghzs.com/pm/halo-app-issues/issues/516#note_21124 2019-05-14 14:48:40 +08:00
4a2b414b59 社区选择列表增加关联置顶 2019-05-14 11:29:04 +08:00
937497aec9 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-13 18:18:15 +08:00
38d2c189e8 游戏详情标签样式由后台控制 2019-05-13 18:18:02 +08:00
57aeacf3f5 完成光环前端需求汇总(2019年4月第3周)(1,4,5) https://gitlab.ghzs.com/pm/halo-app-issues/issues/495 2019-05-13 16:53:47 +08:00
fe4036b768 完成光环助手V3.6.4数据统计需求(光环数据后台) https://gitlab.ghzs.com/pm/halo-app-issues/issues/509 2019-05-13 15:43:41 +08:00
5dd479c492 完成光环助手V3.6.4数据统计需求(光环数据后台) https://gitlab.ghzs.com/pm/halo-app-issues/issues/509 2019-05-13 15:15:27 +08:00
5f1ff1fc6f Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-13 14:22:44 +08:00
b08fb1f170 光环前端需求汇总(2019年4月第5周)(3.6.9.10.13) https://gitlab.ghzs.com/pm/halo-app-issues/issues/512#note_21125 2019-05-13 14:20:57 +08:00
e2f6180d6d 完成光环助手V3.6.4数据统计需求(MTA) https://gitlab.ghzs.com/pm/halo-app-issues/issues/510 2019-05-13 11:00:02 +08:00
90d19ea381 补充下载进度超过 100% 的错误回调 2019-05-13 10:58:48 +08:00
13738f08eb 复用 Gson 对象 2019-05-13 10:00:08 +08:00
1b76184946 光环前端需求汇总(2019年4月第4周)(1.3.4.5.6.7.11.13) https://gitlab.ghzs.com/pm/halo-app-issues/issues/501#note_21126 2019-05-12 18:34:50 +08:00
711431f7c9 光环前端需求汇总(2019年4月第4周)(1.3.4.5.6.7.11.13) https://gitlab.ghzs.com/pm/halo-app-issues/issues/501#note_21126 2019-05-12 18:31:42 +08:00
4ea3f7ccf0 完成光环前端需求汇总(2019年4月第5周)的(2, 4, 5, 11, 12) https://gitlab.ghzs.com/pm/halo-app-issues/issues/512 2019-05-12 17:20:44 +08:00
80cd86ea29 优化游戏评论详情刷新问题 2019-05-10 17:05:56 +08:00
f87bb6cd06 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-10 16:41:10 +08:00
ea726a22bd 游戏评论相关优化 2019-05-10 16:41:02 +08:00
7e3afe7d70 Merge branch 'xiechanghong' into 'dev'
UI 变更

See merge request !5
2019-05-10 15:45:50 +08:00
8131c58fbf 规范化代码格式 2019-05-10 15:33:51 +08:00
674e32a096 优化上一版的代码问题 2019-05-10 11:52:40 +08:00
f5d42a3e01 优化上一版的代码问题 2019-05-09 20:48:05 +08:00
a079a03adc 首页猜你喜欢列表增加隐藏包过滤 2019-05-09 17:59:28 +08:00
8485f94133 优化内容:①文本输入框达到字数上限之后,继续输入内容直接出现Toast提示,不会把最后面的内容删掉,且光标停留在当前位置②如果发生闪退,再次打开光环时会提示立即反馈,这时如果玩家提交成功,会再次出现联系客服弹窗,点击"联系客服" 即直接跳转打开客服QQ对话页面 2019-05-09 17:01:59 +08:00
5d60a8f03b Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java
2019-05-09 16:52:16 +08:00
ec4319b74a 增加游戏评论相关的消息中心操作 2019-05-09 16:50:15 +08:00
41c3f9d073 更改游戏浏览记录的数据库结构 (从上几个测试版覆盖安装将清空所有浏览记录) 2019-05-09 14:04:05 +08:00
c27990b395 完成回答详情/社区文章详情增加反对功能 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/505 2019-05-08 18:43:10 +08:00
2e9a823ee1 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-08 17:42:01 +08:00
590afccae7 游戏详情-评论 增加小编评论 2019-05-08 17:41:53 +08:00
7a82780826 接入新的版主权限管理 2019-05-08 17:26:57 +08:00
c75e363a06 添加浏览记录图标 2019-05-08 17:12:24 +08:00
573b7b61cf Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	app/src/main/java/com/gh/common/util/Extensions.kt
2019-05-08 17:11:51 +08:00
9f9e1bc9fd 游戏评论/游戏评论详情完成'举报/复制'操作 2019-05-08 16:37:36 +08:00
34e11b1569 Merge remote-tracking branch 'origin/dev' into dev 2019-05-08 16:05:40 +08:00
cc7b77a8ad Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-08 11:50:42 +08:00
ed3a75ddc0 游戏评论详情页面用baseList实现 2019-05-08 11:50:26 +08:00
983c01df57 增加清除 HTML 标签的 extension 方法 2019-05-08 10:55:39 +08:00
9d95b7aa6b 修复首页游戏替换下拉刷新时会出现为确保页面游戏唯一而隐藏掉需要的游戏的问题 2019-05-08 10:06:19 +08:00
5319cb8679 回答详情页面增加反对功能(文章详情未完成) 2019-05-07 18:16:33 +08:00
b4b1a63c22 处理空指针异常 2019-05-07 09:52:03 +08:00
2dfd57de80 DataUtils 初始化同步执行 2019-05-06 18:22:56 +08:00
cbc8876656 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-06 15:39:46 +08:00
4e6b8bf6b3 优化游戏评论回复操作 2019-05-06 15:39:33 +08:00
da92826f6a 清理回答详情页面的无用代码 2019-05-06 11:13:44 +08:00
f1a4e429f3 修复回答详情预加载也会产生阅读时长的问题 2019-05-06 09:29:18 +08:00
3cd248a2c5 基本完成我的光环增加浏览记录需求 https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/500#note_20735 2019-05-05 17:53:22 +08:00
7f5dd97359 统一游戏评论item数据设置 2019-05-05 17:37:12 +08:00
c0ee431d1f Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-05-05 15:12:53 +08:00
f56de73eb6 完成游戏评论详情(回复)相关页面展示/分页/跳转/点赞操作 2019-05-05 15:12:36 +08:00
a0b5cd00d5 修复一个数组越界问题 2019-05-05 09:45:36 +08:00
66b5f3d896 调整回答详情页面的结构,增加回答详情的浏览记录 2019-05-04 16:48:19 +08:00
a4346a6f34 游戏评分评论详情页面(未完待续...) 2019-05-04 16:32:26 +08:00
83894f6530 修改游戏评分样式
增加游戏评分评论详情页面
2019-04-30 18:30:03 +08:00
9b776bb029 我的关注增加关联关注 2019-04-30 10:48:16 +08:00
ea72fb09e0 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-04-29 10:58:11 +08:00
b2b390cf8b community keep position when update search 2019-04-29 10:57:46 +08:00
926abe248f Merge branch '3.6.3-log-fixd' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-04-29 09:30:58 +08:00
95468cf83e 更新百度推广激活接口 2019-04-28 17:38:16 +08:00
259b93eb25 修复错误的 MTA 事件命名 2019-04-28 16:49:01 +08:00
f59646643f 修复关闭评论页面软键盘没有隐藏的问题 2019-04-28 14:32:31 +08:00
7130417e60 增加记录推送点击事件失败重试 2019-04-28 11:28:50 +08:00
458a9f2a63 更新 API 至 3.6.4 2019-04-28 11:27:03 +08:00
0f85497f75 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-04-27 17:06:56 +08:00
3c0c6afd43 整理代码 2019-04-27 17:06:45 +08:00
345cdb41bc 完成首页游戏替换功能(第二期)https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/498 2019-04-26 18:12:47 +08:00
b78fa40eff 修复在小内存设备上加载本地应用图标会内存不够然后闪退的问题 2019-04-26 16:18:44 +08:00
193831ae7e VersionName:3.6.4 VersionCode:90 2019-04-26 15:43:21 +08:00
bcb9dc3ba8 修复 loghub 启动日志都变成都变成升级安装的问题 2019-04-25 11:57:59 +08:00
7903cdc44a Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-04-23 16:55:49 +08:00
a66c1ea50b 编辑框插入链接样式对以前版本隐藏 2019-04-23 16:55:33 +08:00
978e8f160b 修复 loghub 启动日志都变成都变成升级安装的问题 2019-04-23 14:52:08 +08:00
a49351a146 更改通用库 submodule 的远程地址 2019-04-22 16:27:04 +08:00
07d9b416a3 消息中心和系统推送添加跳转类型 2019-04-22 10:49:26 +08:00
f9edb69370 编辑插入回答/文章支持分享链接插入 2019-04-19 16:47:15 +08:00
deac313ba3 文章/回答详情处理链接跳转 2019-04-19 15:01:42 +08:00
b149f9acf2 Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev 2019-04-19 09:59:35 +08:00
7c96ba090e 编辑框增加插入链接(文章,回答,游戏) 2019-04-19 09:59:18 +08:00
11ab908848 避免上传图片时闪退 2019-04-18 14:28:24 +08:00
3d2978b2e5 增加下载失败弹窗 2019-04-18 11:01:08 +08:00
7ad3a7ae92 下载进度超过100%的情况处理 2019-04-17 18:15:41 +08:00
9042488a65 把选择社区排序的操作放回主线程避免线程冲突造成闪退 2019-04-17 09:54:30 +08:00
b08e13f05a 捕抓发起网络重试请求时的各种异常 2019-04-17 09:53:20 +08:00
6271fd4998 编辑框增加插入文章 2019-04-16 16:08:09 +08:00
4d747a3df3 Merge branch 'dev-logo' into 'dev'
logo 添加多种尺寸

See merge request !4
2019-04-15 19:10:19 +08:00
5ce057d40e logo 添加多种尺寸 2019-04-15 19:01:55 +08:00
1e2e8f932f 编辑框增加插入游戏和插入回答页面 2019-04-15 18:03:45 +08:00
5accb9c1f1 Merge branch 'answer_animation' into 'dev'
答案详情页优化变更

See merge request !3
2019-04-15 11:52:08 +08:00
5b102d65c7 完成了光环前端需求汇总(2019年4月第2周)的(4,5,6,8) https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/490 2019-04-15 11:51:04 +08:00
c609ddd721 修复了图片后有文字时不能删除图片的问题 2019-04-12 14:38:39 +08:00
0c3783d127 避免重复发送答案阅读事件 2019-04-12 14:24:17 +08:00
f702ab6115 修复回答图片后有文字不能删除的问题 2019-04-11 17:54:00 +08:00
7dd760e0fb 尝试将回答详情的上下滚动改以 viewpager 实现 2019-04-09 18:08:58 +08:00
c6f3b5998c tinkerBase 3.6.3 2019-04-08 19:11:47 +08:00
1070 changed files with 26546 additions and 15578 deletions

2
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "libraries/LGLibrary"]
path = libraries/LGLibrary
url = git@gitlab.ghzhushou.com:client/client-common.git
url = git@gitlab.ghzs.com:android/common-library.git
branch = master

View File

@ -42,4 +42,48 @@
* 首页不显示已安装的游戏
* 插件求版本功能增加内部跳转
* 下载面板增加公告和版本说明功能
* 接入腾讯`广点通`(广告)
* 接入腾讯`广点通`(广告)
### ver 3.6.3
* 社区搜索修改
- 增加 `文章/用户` 模块
- 增加 `搜索置顶` 功能
* 回答详情/社区文章详情修改
- 支持文案样式(加粗/斜体/删除线)和段落样式(引用/标题)
- 支持关闭评论功能
- 回答详情新增上下切换回答
* 社区编辑框(回答/文章)修改
- 支持批量插入图片(使用知乎Matisse实现)
- 新增插入特殊样式,文案样式(加粗/斜体/删除线)和段落样式(引用/标题)
* 编辑框部分 JS/CSS 使用远程文件
### ver 3.6.4
* 增加浏览记录(回答/文章/资讯/游戏)
* 回答/社区文章 增加反对功能
* 社区编辑框增加插入文章/回答/游戏
- 低版本兼容方案: 插入的样式默认隐藏,只有在3.6.4及以上才会显示
* 游戏详情评分模块增加`小编评论`区域以及样式修改
* 游戏评分增加回复功能
### var 3.6.5
* 以补丁方式向外推出并没有增加需求只是单纯的修BUG
### var 3.6.6
* 游戏详情:
- 支持修改评分
- 评分列表增加排序/过滤功能
- 增加弹出系统
* 社区相关:
- 选择社区页面重做
- 首页社区推荐增加推荐入口
- 首页社区问题模块改版,名称改为全部,去除问题分类(统一为问题列表),增加社区文章列表
* 游戏搜索默认页面改版
* 权限系统更改,不授权也可以进去App,申请权限细分到功能(用到某个功能时才需要强制授予权限)
* 增加隐私系统
* 增加游戏预约功能
* 增加标签详情模块
* 进入今日头条广告SDK
* 图片上传压缩机制优化
- 支持从后台修改上传配置(本该在早些版本实现,由于代码问题无法引用后台配置)
- 对压缩失败是进行catch(由于后台对宽高配置放宽,很容易发生OOM),失败后直接上传原图(这步可能会出现问题)
* 游戏相关UI修改

View File

@ -1,7 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'org.jetbrains.kotlin.android.extensions'
apply plugin: 'kotlin-android' // kotlin
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
// apkChannelPackage
@ -38,14 +37,8 @@ android {
}
}
/**
* 只支持两种架构减少apk大小有疑问请参考
* https://developer.android.com/ndk/guides/abis.html
* http://allenfeng.com/2016/11/06/what-you-should-know-about-android-abi-and-so/
* 为了性能考虑armeabi可以考虑替换成armeabi-v7a[需要先收集用户设备情况]
*/
ndk {
abiFilters "armeabi", "x86"
abiFilters "armeabi-v7a", "x86"
}
// 由于app只针对中文用户所以仅保留zh资源其他删掉
@ -69,6 +62,11 @@ android {
buildConfigField "String", "MTA_APPKEY", "\"${MTA_APPKEY}\""
buildConfigField "String", "TD_APPID", "\"${TD_APPID}\""
/**
* Build Time 供区分 jenkins 打包时间用
*/
buildConfigField "long", "BUILD_TIME", "0"
}
// gradle 2.2以上默认同时启用v1和v2优先用于Android N
@ -91,7 +89,7 @@ android {
signingConfig signingConfigs.debug
buildConfigField "String", "EXPOSURE_REPO", "\"test\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E2\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E3\""
}
release {
debuggable false
@ -101,7 +99,7 @@ android {
signingConfig signingConfigs.release
buildConfigField "String", "EXPOSURE_REPO", "\"exposure\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E2\""
buildConfigField "String", "EXPOSURE_VERSION", "\"E3\""
}
}
@ -115,10 +113,7 @@ android {
publish {
dimension "nonsense"
buildConfigField "String", "API_HOST", "\"${API_HOST}\""
buildConfigField "String", "USER_HOST", "\"${USER_HOST}\""
buildConfigField "String", "COMMENT_HOST", "\"${COMMENT_HOST}\""
buildConfigField "String", "LIBAO_HOST", "\"${LIBAO_HOST}\""
buildConfigField "String", "MESSAGE_HOST", "\"${MESSAGE_HOST}\""
buildConfigField "String", "DATA_HOST", "\"${DATA_HOST}\""
buildConfigField "String", "UMENG_APPKEY", "\"${UMENG_APPKEY}\""
@ -129,7 +124,6 @@ android {
buildConfigField "String", "MEIZUPUSH_APPKEY", "\"${MEIZUPUSH_APPKEY}\""
buildConfigField "String", "BUGLY_APPID", "\"${BUGLY_APPID}\""
}
// internal test dev host
internal {
@ -137,10 +131,7 @@ android {
versionNameSuffix "-debug"
buildConfigField "String", "API_HOST", "\"${DEV_API_HOST}\""
buildConfigField "String", "USER_HOST", "\"${DEV_USER_HOST}\""
buildConfigField "String", "COMMENT_HOST", "\"${DEV_COMMENT_HOST}\""
buildConfigField "String", "LIBAO_HOST", "\"${DEV_LIBAO_HOST}\""
buildConfigField "String", "MESSAGE_HOST", "\"${DEV_MESSAGE_HOST}\""
buildConfigField "String", "DATA_HOST", "\"${DEV_DATA_HOST}\""
buildConfigField "String", "UMENG_APPKEY", "\"${DEBUG_UMENG_APPKEY}\""
@ -153,11 +144,6 @@ android {
buildConfigField "String", "BUGLY_APPID", "\"${DEBUG_BUGLY_APPID}\""
}
}
// productFlavors.all { flavor ->
// flavor.manifestPlaceholders = [CHANNEL_VALUE: name]//命令 gradlew assembleRelease
// }
}
// apkChannelPackage
@ -194,14 +180,24 @@ dependencies {
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stetho}"
debugImplementation "com.squareup.okhttp3:logging-interceptor:${okHttp}"
implementation "com.android.support:multidex:${multidex}"
implementation "com.android.support:design:${androidSupport}"
implementation "com.android.support:support-v4:${androidSupport}"
implementation "com.android.support:appcompat-v7:${androidSupport}"
implementation "com.android.support:cardview-v7:${androidSupport}"
implementation "com.android.support:support-annotations:${androidSupport}"
implementation "com.android.support:percent:${androidSupport}"
implementation "com.android.support.constraint:constraint-layout:${constraintLayout}"
implementation "androidx.core:core:${core}"
implementation "androidx.fragment:fragment:${fragment}"
implementation "androidx.multidex:multidex:${multiDex}"
implementation "androidx.appcompat:appcompat:${appCompat}"
implementation "androidx.cardview:cardview:${cardView}"
implementation "androidx.annotation:annotation:${annotation}"
implementation "androidx.constraintlayout:constraintlayout:${constraintLayout}"
implementation "androidx.recyclerview:recyclerview:${recyclerView}"
implementation "androidx.lifecycle:lifecycle-runtime:${lifeCycle}"
implementation "androidx.lifecycle:lifecycle-extensions:${lifeCycle}"
kapt "androidx.lifecycle:lifecycle-compiler:${lifeCycle}"
implementation "androidx.room:room-runtime:${room}"
implementation "androidx.room:room-rxjava2:${room}"
kapt "androidx.room:room-compiler:${room}"
kapt "androidx.databinding:databinding-compiler:${databinding}"
implementation "com.google.android.material:material:${material}"
implementation "com.kyleduo.switchbutton:library:${switchButton}"
implementation "com.facebook.fresco:fresco:${fresco}"
@ -233,9 +229,6 @@ dependencies {
implementation "com.google.zxing:android-core:${zxing}"
implementation "com.daimajia.swipelayout:library:${swipeLayout}"
implementation("cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:${autoScrollViewPager}") {
exclude module: 'support-v4'
}
implementation "com.sina.weibo.sdk:core:${weiboSDK}"
@ -243,17 +236,10 @@ dependencies {
implementation "com.tencent.bugly:crashreport_upgrade:${buglyTinkerSupport}"
implementation "pub.devrel:easypermissions:${easypermissions}"
// mvvm
implementation "android.arch.lifecycle:runtime:${archLifecycleVersion}"
kapt "android.arch.lifecycle:compiler:${archLifecycleVersion}"
implementation "android.arch.lifecycle:extensions:${archLifecycleVersion}"
implementation "android.arch.persistence.room:runtime:${archRoomVersion}"
kapt "android.arch.persistence.room:compiler:${archRoomVersion}"
implementation 'com.google.android:flexbox:0.2.2'
implementation 'com.google.android:flexbox:1.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
kapt 'com.android.databinding:compiler:3.1.3'
implementation 'com.contrarywind:Android-PickerView:4.1.3'
@ -269,13 +255,17 @@ dependencies {
implementation "cn.jzvd:jiaozivideoplayer:${jiaoziVideoView}"
implementation "com.danikula:videocache:${videoCache}"
implementation "android.arch.work:work-runtime:${workManager}"
implementation "com.llew.huawei:verifier:1.0.6"
implementation "com.github.tbruyelle:rxpermissions:${rxPermissions}"
implementation 'com.ethanhua:skeleton:1.1.1'
implementation 'io.supercharge:shimmerlayout:2.1.0'
implementation "com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.3.1"
implementation 'com.walkud.rom.checker:RomChecker:1.0.0'
implementation project(':libraries:gid')
implementation project(':libraries:LGLibrary')
implementation project(':libraries:MTA')
implementation project(':libraries:QQShare')

BIN
app/libs/applog-release.aar Normal file

Binary file not shown.

BIN
app/libs/gid-1.0.jar Normal file

Binary file not shown.

View File

@ -194,9 +194,9 @@
-ignorewarnings
-keep @android.support.annotation.Keep class *
-keep @androidx.annotation.Keep class *
-keepclassmembers class ** {
@android.support.annotation.Keep *;
@androidx.annotation.Keep *;
}
-keep class com.gh.loghub.** { *; }
@ -222,4 +222,7 @@
### 广点通
-dontwarn com.qq.gdt.action.**
-keep class com.qq.gdt.action.** {*;}
-keep class com.qq.gdt.action.** {*;}
### AndroidX
-keep class androidx.core.app.CoreComponentFactory { *; }

View File

@ -21,20 +21,8 @@
<uses-permission android:name = "android.permission.GET_TASKS" />
<!-- 允许访问振动设备 -->
<uses-permission android:name = "android.permission.VIBRATE" />
<!-- 允许应用程序通过WiFi或移动基站获取粗略的位置信息 -->
<uses-permission android:name = "android.permission.ACCESS_COARSE_LOCATION" />
<!-- 允许应用程序通过GPS获取精确的位置信息 -->
<uses-permission android:name = "android.permission.ACCESS_FINE_LOCATION" />
<!-- 允许应用程序改变Wi-Fi连接状态 -->
<uses-permission android:name = "android.permission.CHANGE_WIFI_STATE" />
<!-- 允许应用程序管理AccountManager中的账户列表 -->
<uses-permission android:name = "android.permission.MANAGE_ACCOUNTS" />
<!-- 允许应用程序访问GMail账户列表 -->
<uses-permission android:name = "android.permission.GET_ACCOUNTS" />
<!-- 允许应用程序连接配对过的蓝牙设备 -->
<uses-permission android:name = "android.permission.BLUETOOTH" />
<!-- 允许应用程序管理蓝牙,搜索和配对新的蓝牙设备 -->
<uses-permission android:name = "android.permission.BLUETOOTH_ADMIN" />
<!-- 允许应用程序打开系统窗口,显示其他应用程序 -->
<uses-permission android:name = "android.permission.SYSTEM_ALERT_WINDOW" />
<!-- 修改系统设置的权限 -->
@ -44,6 +32,9 @@
<uses-permission android:name = "android.permission.READ_LOGS" />
<uses-permission android:name = "android.permission.REQUEST_INSTALL_PACKAGES" />
<!-- 去掉 SDK 一些流氓权限 -->
<uses-permission android:name = "android.permission.READ_CONTACTS" tools:node = "remove"/>
<supports-screens
android:anyDensity = "true"
android:largeScreens = "true"
@ -55,7 +46,7 @@
<application
android:name = "com.halo.assistant.TinkerApp"
android:allowBackup = "true"
android:icon = "@drawable/logo"
android:icon = "@mipmap/logo"
android:label = "@string/app_name"
android:resizeableActivity = "true"
android:theme = "@style/AppCompatTheme.APP"
@ -143,19 +134,19 @@
android:name = "com.gh.gamecenter.CleanApkActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.KcSelectGameActivity"
android:name = "com.gh.gamecenter.kuaichuan.view.KcSelectGameActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.ChooseReceiverActivity"
android:name = "com.gh.gamecenter.kuaichuan.view.ChooseReceiverActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.ReceiverWaitingActivity"
android:name = "com.gh.gamecenter.kuaichuan.view.ReceiverWaitingActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.FileSenderActivity"
android:name = "com.gh.gamecenter.kuaichuan.view.FileSenderActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.FileReceiverActivity"
android:name = "com.gh.gamecenter.kuaichuan.view.FileReceiverActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.SelectUserIconActivity"
@ -166,6 +157,9 @@
<activity
android:name = "com.gh.gamecenter.CommentDetailActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.mygame.MyGameActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.GameDetailActivity"
android:configChanges = "orientation|screenSize|keyboardHidden"
@ -190,10 +184,6 @@
android:screenOrientation = "portrait"
android:windowSoftInputMode = "stateHidden" />
<activity
android:name = "com.gh.gamecenter.InstallActivity"
android:screenOrientation = "portrait" />
<activity
android:name = ".category.CategoryDirectoryActivity"
android:screenOrientation = "portrait" />
@ -358,8 +348,8 @@
<activity
android:name = "com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity"
android:windowSoftInputMode = "stateVisible"
android:screenOrientation = "portrait" />
android:screenOrientation = "portrait"
android:windowSoftInputMode = "stateVisible" />
<activity
android:name = "com.gh.gamecenter.qa.questions.edit.manager.HistoryDetailActivity"
@ -369,6 +359,45 @@
android:name = "com.gh.gamecenter.qa.questions.edit.manager.HistoryActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.qa.editor.InsertAnswerWrapperActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.qa.editor.GameActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.qa.editor.InsertArticleWrapperActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.gamedetail.rating.RatingReplyActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.history.HistoryActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.kuaichuan.view.FileShareActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.personalhome.rating.RatingActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.gamedetail.rating.logs.CommentLogsActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.tag.TagsActivity"
android:screenOrientation = "portrait" />
<activity android:name = "com.gh.gamecenter.qa.article.SimpleArticleListActivity"
android:screenOrientation = "portrait" />
<activity
android:name = "com.gh.gamecenter.qa.comment.CommentActivity"
android:screenOrientation = "portrait"
@ -394,16 +423,15 @@
</activity >
<activity
android:name="${applicationId}.wxapi.WXEntryActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="true"
android:launchMode="singleTop"
android:screenOrientation = "portrait" >
</activity>
android:name = "${applicationId}.wxapi.WXEntryActivity"
android:exported = "true"
android:label = "@string/app_name"
android:launchMode = "singleTop"
android:screenOrientation = "portrait"
android:theme = "@android:style/Theme.Translucent.NoTitleBar" ></activity >
<provider
android:name = "android.support.v4.content.FileProvider"
android:name = "androidx.core.content.FileProvider"
android:authorities = "${applicationId}"
android:exported = "false"
android:grantUriPermissions = "true" >

View File

@ -1,28 +1,163 @@
function requestContentFocus() {
$('#editor').focus();
$("#editor").focus();
}
function setupWhenContentEditable() {
var editor = $('#editor');
if (!editor[0].hasAttribute('contenteditable')) {
return;
var editor = $("#editor");
if (!editor[0].hasAttribute("contenteditable")) {
return;
}
// paste
editor.on("paste", function(e) {
e.preventDefault();
var text = (e.originalEvent || e).clipboardData.getData("text/plain");
text = text.replace(/\n/g, "<br>");
if ("" != text) {
document.execCommand("insertHTML", false, text);
} else {
window.onPasteListener.onPaste();
}
});
// paste 回调只会获取粘贴之前的光标位置,需要自己手动加上粘贴文本的长度,并保证粘贴的是纯文本
editor.on('paste', function(e) {
e.preventDefault();
var text = (e.originalEvent || e).clipboardData.getData('text/plain');
text = text.replace(/\n/g, '<br>');
if("" != text) {
document.execCommand("insertHTML", false, text);
} else {
window.onPasteListener.onPaste();
}
});
requestContentFocus();
requestContentFocus();
}
$(document).ready(function() {
setupWhenContentEditable();
function getStyle(dom, name) {
return window.getComputedStyle(dom)[name];
}
function customLinkgo(self) {
var datas = self.dataset.datas;
console.log(datas)
window.OnLinkClickListener.onClick(datas);
}
var typeClassList = [
"community_article-container",
"answer-container",
"game-container"
];
function removeDomByParent(curDom) {
if (curDom.parentElement) {
curDom.parentElement.removeChild(curDom);
}
}
window.addEventListener("load", function() {
var EditorDom = document.querySelector("#editor");
setupWhenContentEditable();
document.addEventListener("keydown", function(e) {
var event = e || window.event;
if (event.keyCode === 8) {
var s = document.getSelection();
var r = s.getRangeAt(0);
if (r.startOffset === r.endOffset && r.endOffset === 0) {
var preDOM = s.focusNode.previousElementSibling;
if (
preDOM &&
preDOM instanceof Element &&
preDOM.nodeName === "IMG" &&
getStyle(preDOM, "display") === "block"
) {
preDOM.parentElement.removeChild(preDOM);
}
}
var customDom = s.focusNode;
if (customDom) {
if (
r.startContainer.nodeName.toLowerCase() === "blockquote" &&
r.startOffset === 0
) {
RE.formatBlock();
e.preventDefault();
} else if (
customDom.nodeName === "#text" &&
customDom.previousElementSibling &&
typeClassList.indexOf(customDom.previousElementSibling.className) >
-1 &&
r.startOffset === 1
) {
var needDeleteDom = customDom.previousElementSibling;
needDeleteDom.insertAdjacentElement(
"afterend",
document.createElement("br")
);
} else if (
customDom instanceof Element &&
customDom.childNodes[s.focusOffset] &&
customDom.childNodes[s.focusOffset].previousElementSibling &&
typeClassList.indexOf(
customDom.childNodes[s.focusOffset].previousElementSibling.className
) > -1
) {
customDom =
customDom.childNodes[s.focusOffset].previousElementSibling;
customDom.parentElement.removeChild(customDom);
}
}
}
});
document.addEventListener("keyup", function(e) {
var event = e || window.event;
if (event.keyCode === 13) {
var s = document.getSelection();
var curDom = s.focusNode;
var preDom = curDom.previousElementSibling;
if (
curDom.nodeName.toLowerCase() === "blockquote" &&
preDom.nodeName.toLowerCase() === "blockquote"
) {
if (
preDom.childNodes.length > 1 ||
(preDom.childNodes.length === 1 &&
preDom.childNodes[0].tagName !== "BR")
) {
curDom.style.marginTop = 0;
preDom.style.marginBottom = 0;
} else if (
(curDom.childNodes.length === 0 ||
(curDom.childNodes.length === 1 &&
curDom.childNodes[0].tagName === "BR")) &&
(preDom.childNodes.length === 0 ||
(preDom.childNodes.length === 1 &&
preDom.childNodes[0].tagName === "BR"))
) {
removeDomByParent(curDom);
var startQuoteDom = preDom.previousElementSibling;
startQuoteDom && startQuoteDom.nodeName.toLowerCase() === "blockquote"
? (startQuoteDom.style.marginBottom = "10px")
: null;
var range = document.createRange();
range.selectNode(preDom);
s.removeAllRanges();
s.addRange(range);
RE.formatBlock();
}
}
}
});
document.addEventListener("selectionchange", function(e) {
var event = e || window.event;
var targetDom = event.target.activeElement;
if (targetDom.id === "editor" && targetDom.lastElementChild) {
if (typeClassList.indexOf(targetDom.lastElementChild.className) > -1) {
var brDom = document.createElement("br");
EditorDom.appendChild(brDom);
}
}
});
});

View File

@ -4,14 +4,13 @@
<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">
<link rel="stylesheet" type="text/css" href="https://resource.ghzs.com/css/halo_app.css">
<!--<link rel="stylesheet" type="text/css" href="https://resource.ghzs.com/css/halo_app.css">-->
</head>
<body>
<div id="editor" contenteditable="true"></div>
<div id="editor" contenteditable="false"></div>
<script type="text/javascript" src="zepto.min.js"></script>
<script type="text/javascript" src="rich_editor.js"></script>
<script type="text/javascript" src="content.js"></script>
<script type="text/javascript" src="https://resource.ghzs.com/js/halo_app.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/vanilla-lazyload/10.15.0/lazyload.min.js"></script>-->
<!--<script type="text/javascript" src="content.js"></script>-->
<!--<script type="text/javascript" src="https://resource.ghzs.com/js/halo_app.js"></script>-->
</body>
</html>

View File

@ -16,15 +16,6 @@
// alert("")
// link block
// var html = "<div style = \"background:#f5f5f5;padding:10px;\", contenteditable=\"false\", spellcheck=\"false\" >\n" +
// "<font style = \"display: inline-block;white-space: nowrap;max-width: 100%;overflow: hidden; text-overflow:ellipsis;\" size = \"4\" >In HTML and XHTML, the blockquote element defines</font>\n" +
// "<br>\n" +
// "<font style = \"display: inline-block;white-space: nowrap;max-width: 100%;overflow: hidden; text-overflow:ellipsis;\", size = \"3\" >In HTML and XHTML, the blockquote element defines</font>\n" +
// "</div>" +
// "<br>\n"
// document.execCommand('insertHTML', false, html);
var RE = {};
RE.currentSelection = {
@ -33,6 +24,32 @@ RE.currentSelection = {
"endContainer": 0,
"endOffset": 0};
var isDebug = false;
try {
isDebug = window.NativeCallBack.isNativeBuildDebug()
} catch(error) {
}
// 引用远端的JS 和 CSS
var script = document.createElement("script")
document.body.appendChild(script)
if (isDebug) {
script.src = "https://resource.ghzs.com/js/halo_app_test.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
} else {
script.src = "https://resource.ghzs.com/js/halo.js" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
}
var style = document.createElement("link")
style.rel = "stylesheet"
style.type = "text/css"
if (isDebug) {
style.href = "https://resource.ghzs.com/css/halo_app_test.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000)
} else {
style.href = "https://resource.ghzs.com/css/halo.css" + "?timestamp=" + Math.round(new Date().getTime() / 1000 / 1000)
}
document.head.appendChild(style)
RE.editor = document.getElementById('editor');
document.addEventListener("selectionchange", function() { RE.backuprange(); });
@ -207,10 +224,14 @@ RE.insertImage = function(url) {
// 替换成缩略图
RE.replaceTbImage = function(imgRuleFlag, gifRuleFlag) {
var imgs = document.getElementsByTagName("img");
var index = 0
for (var i = 0; i < imgs.length; i++) {
var img = imgs[i];
var imageClassName = img.className;
// console.log(imageClassName)
if (imageClassName == "image-link") continue;
if(img.src.indexOf("?") > 0) continue;
// console.log(i)
var tbImg
if(img.src.indexOf(".gif") > 0) {
tbImg = img.src + gifRuleFlag
@ -221,7 +242,7 @@ RE.replaceTbImage = function(imgRuleFlag, gifRuleFlag) {
img.style.cssText = "max-width: 60%; display:block; margin:15px auto; height: auto;"
img.src = tbImg;
if (i == 0) {
if (index == 0) {
var bigImg = document.createElement('img');
bigImg.src = "file:///android_asset/web_load_dfimg_icon.png";
bigImg.style.cssText = "max-width: 20%; margin:15px 0 0 0; height: auto;"
@ -237,6 +258,7 @@ RE.replaceTbImage = function(imgRuleFlag, gifRuleFlag) {
}
}
index ++;
}
}
@ -245,6 +267,8 @@ RE.replaceAllDfImage = function(imgRuleFlag, gifRuleFlag) {
var imgs = document.getElementsByTagName("img");
for (var i = 0; i < imgs.length; i++) {
var img = imgs[i];
var imageClassName = img.className;
if (imageClassName == "image-link") continue;
if(img.src.indexOf("web_load_dfimg_icon") > 0) {
img.parentNode.removeChild(img.parentNode.childNodes[0]);
i--;
@ -269,6 +293,8 @@ RE.hideShowBigPic = function() {
var j = 0;
for (var i = 0; i < imgs.length; i++) {
var img = imgs[i];
var imageClassName = img.className;
if (imageClassName == "image-link") continue;
if(img.src.indexOf(",thumbnail") > 0 && img.src.indexOf(".gif") == -1) {
j++;
}
@ -278,6 +304,8 @@ RE.hideShowBigPic = function() {
var imgs = document.getElementsByTagName("img");
for (var i = 0; i < imgs.length; i++) {
var img = imgs[i];
var imageClassName = img.className;
if (imageClassName == "image-link") continue;
if(img.src.indexOf("web_load_dfimg_icon") > 0) {
img.parentNode.removeChild(img.parentNode.childNodes[0]);
break;
@ -290,6 +318,8 @@ RE.replaceDfImageByUrl = function(imgUrl, imgRuleFlag, gifRuleFlag) {
var imgs = document.getElementsByTagName("img");
for (var i = 0; i < imgs.length; i++) {
var img = imgs[i];
var imageClassName = img.className;
if (imageClassName == "image-link") continue;
if (img.src.indexOf(imgUrl) != -1) {
img.style.cssText = "max-width: 100%; display:block; margin:8px auto; height: auto;"
if(img.src.indexOf(".gif") > 0) {
@ -306,6 +336,8 @@ RE.ImageClickListener = function() {
var imgs = document.getElementsByTagName("img");
for (var i = 0; i < imgs.length; i++) {
var img = imgs[i];
var imageClassName = img.className;
if (imageClassName == "image-link") continue;
window.imagelistener.imageArr(img.src);
img.onclick = function() {
window.imagelistener.imageClick(this.src);
@ -358,12 +390,16 @@ RE.backuprange = function(){
}
RE.restorerange = function(){
var selection = window.getSelection();
selection.removeAllRanges();
var range = document.createRange();
range.setStart(RE.currentSelection.startContainer, RE.currentSelection.startOffset);
range.setEnd(RE.currentSelection.endContainer, RE.currentSelection.endOffset);
selection.addRange(range);
try {
var selection = window.getSelection();
selection.removeAllRanges();
var range = document.createRange();
range.setStart(RE.currentSelection.startContainer, RE.currentSelection.startOffset);
range.setEnd(RE.currentSelection.endContainer, RE.currentSelection.endOffset);
selection.addRange(range);
} catch(error) {
}
}
RE.enabledEditingItems = function(e) {
@ -433,8 +469,88 @@ RE.removeFormat = function() {
document.execCommand('removeFormat', false, null);
}
RE.insertCustomStyleLink = function(data) {
var entity = JSON.parse(data)
var html = "<br/><div class='"+ entity.type +"-container'>\n" +
" <a class='"+ entity.type +"' href=\"javascript:void(0);\" contenteditable=\"false\" onclick=\"customLinkgo(this)\" data-datas='"+ data +"'>\n" +
" <div class='flex-container'>\n" +
" <div class='gh-internal-content img-left'>\n" +
" <img class = \"image-link\" src='"+ entity.icon +"' />\n" +
" </div>\n" +
" <div class='gh-internal-content content-right'>\n" +
" <p class='content-title'>"+ entity.title +"</p>\n" +
" <p class='contents'>"+ entity.brief +"</p>\n" +
" </div>\n" +
" </div>\n" +
" </a>\n" +
" </div><br/>"
var tags = "", gameHtml = ""
if (entity.tags != null) {
for (var i = 0; i < entity.tags.length; i++) {
tags += "<label>"+ entity.tags[i]+"</label>"
}
gameHtml = "<br/><div class='"+ entity.type +"-container'>\n" +
" <a class='"+ entity.type +"' href=\"javascript:void(0);\" contenteditable=\"false\" onclick=\"customLinkgo(this)\" data-datas='"+ data +"'>\n" +
" <div class='flex-container'>\n" +
" <div class='gh-internal-content img-left'>\n" +
" <img class='image-link' src='"+ entity.icon +"' />\n" +
" </div>\n" +
" <div class='gh-internal-content content-right'>\n" +
" <p class='content-title'>"+ entity.title +"</p>\n" +
" <p class='tags'>"+ tags +"</p>\n" +
" </div>\n" +
" </div>\n" +
" </a></div><br/>"
}
switch(entity.type) {
case "answer":
document.execCommand("insertHTML",false, html);
break
case "community_article":
document.execCommand("insertHTML",false, html);
break
case "game":
document.execCommand("insertHTML",false, gameHtml);
break
}
RE.callback();
}
RE.showLinkStyle = function() {
var answerElement = document.getElementsByClassName("answer-container");
for (var i=0;i<answerElement.length;i+=1){
answerElement[i].style.display = 'inline';
}
var articleElement = document.getElementsByClassName("community_article-container");
for (var i=0;i<articleElement.length;i+=1){
articleElement[i].style.display = 'inline';
}
var gameElement = document.getElementsByClassName("game-container");
for (var i=0;i<gameElement.length;i+=1){
gameElement[i].style.display = 'inline';
}
}
RE.hideLinkStyle = function() {
var answerElement = document.getElementsByClassName("answer-container");
for (var i=0;i<answerElement.length;i+=1){
answerElement[i].style.display = 'none';
}
var articleElement = document.getElementsByClassName("community_article-container");
for (var i=0;i<articleElement.length;i+=1){
articleElement[i].style.display = 'none';
}
var gameElement = document.getElementsByClassName("game-container");
for (var i=0;i<gameElement.length;i+=1){
gameElement[i].style.display = 'none';
}
}
// Event Listeners
RE.editor.addEventListener("input", RE.callback);
RE.editor.addEventListener("keyup", function(e) {
var KEY_LEFT = 37, KEY_RIGHT = 39;
if (e.which == KEY_LEFT || e.which == KEY_RIGHT) {
@ -442,11 +558,34 @@ RE.editor.addEventListener("keyup", function(e) {
}
RE.sendElementNameToNative()
});
RE.editor.addEventListener("click", function(e) {
RE.enabledEditingItems
RE.sendElementNameToNative()
var s = document.getSelection()
var isNeedRemoveR = RE.recursion(e.target)
if (isNeedRemoveR && s.rangeCount) {
s.removeAllRanges()
}
});
document.addEventListener("selectionchange", function(e) {
RE.sendElementNameToNative()
});
RE.recursion = function(dom) {
var parenDom = dom.parentElement
if (parenDom && parenDom instanceof Element &&
typeClassList.indexOf(parenDom.className) > -1) {
return parenDom
} else if(parenDom && parenDom instanceof Element &&
typeClassList.indexOf(parenDom.className) === -1 && parenDom.nodeName !== 'BODY') {
return RE.recursion(parenDom)
} else {
return null
}
}
// 返回组件标签 多个标签以"空格"划分
RE.sendElementNameToNative = function() {
if (window.getSelection) {
@ -467,6 +606,7 @@ RE.sendElementNameToNative = function() {
}
elements = elements + " " + parentElement.localName + " "
}
// console.log(elements)
window.OnCursorChangeListener.onElements(elements);
}
}

View File

@ -1,53 +0,0 @@
package com.gc.materialdesign.views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
public class CustomView extends RelativeLayout {
final static String MATERIALDESIGNXML = "http://schemas.android.com/apk/res-auto";
final static String ANDROIDXML = "http://schemas.android.com/apk/res/android";
final int disabledBackgroundColor = Color.parseColor("#E2E2E2");
// Indicate if user touched this view the last time
public boolean isLastTouch = false;
int beforeBackground;
boolean animation = false;
public CustomView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (enabled)
setBackgroundColor(beforeBackground);
else
setBackgroundColor(disabledBackgroundColor);
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (animation)
invalidate();
}
@Override
protected void onAnimationStart() {
super.onAnimationStart();
animation = true;
}
@Override
protected void onAnimationEnd() {
super.onAnimationEnd();
animation = false;
}
}

View File

@ -1,174 +0,0 @@
package com.gc.materialdesign.views;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
public class ProgressBarCircularIndeterminate extends CustomView {
final static String ANDROIDXML = "http://schemas.android.com/apk/res/android";
int backgroundColor = Color.parseColor("#1E88E5");
float radius1 = 0;
float radius2 = 0;
int cont = 0;
boolean firstAnimationOver = false;
int arcD = 1;
int arcO = 0;
float rotateAngle = 0;
int limite = 0;
public ProgressBarCircularIndeterminate(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs) {
setMinimumHeight(Utils.dpToPx(32, getResources()));
setMinimumWidth(Utils.dpToPx(32, getResources()));
// Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML, "background", -1);
if (bacgroundColor != -1) {
setBackgroundColor(ContextCompat.getColor(getContext(), bacgroundColor));
} else {
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1) {
setBackgroundColor(background);
} else {
setBackgroundColor(Color.parseColor("#1E88E5"));
}
}
setMinimumHeight(Utils.dpToPx(3, getResources()));
}
// Set color of background
public void setBackgroundColor(int color) {
super.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
if (isEnabled()) {
beforeBackground = backgroundColor;
}
this.backgroundColor = color;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!firstAnimationOver) {
drawFirstAnimation(canvas);
}
if (cont > 0) {
drawSecondAnimation(canvas);
}
invalidate();
}
/**
* Draw first animation of view
*
* @param canvas
*/
private void drawFirstAnimation(Canvas canvas) {
if (radius1 < getWidth() / 2) {
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(makePressColor());
radius1 = (radius1 >= getWidth() / 2) ? (float) getWidth() / 2 : radius1 + 1;
canvas.drawCircle(getWidth() / 2, getHeight() / 2, radius1, paint);
} else {
Bitmap bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
Canvas temp = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(makePressColor());
temp.drawCircle(getWidth() / 2, getHeight() / 2, getHeight() / 2, paint);
Paint transparentPaint = new Paint();
transparentPaint.setAntiAlias(true);
transparentPaint.setColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(
PorterDuff.Mode.CLEAR));
if (cont >= 50) {
radius2 = (radius2 >= getWidth() / 2) ? (float) getWidth() / 2 : radius2 + 1;
} else {
radius2 = (radius2 >= getWidth() / 2 - Utils.dpToPx(4, getResources())) ?
(float) getWidth() / 2 - Utils.dpToPx(4, getResources()) : radius2 + 1;
}
temp.drawCircle(getWidth() / 2, getHeight() / 2, radius2, transparentPaint);
canvas.drawBitmap(bitmap, 0, 0, new Paint());
if (radius2 >= getWidth() / 2 - Utils.dpToPx(4, getResources())) {
cont++;
}
if (radius2 >= getWidth() / 2) {
firstAnimationOver = true;
}
}
}
/**
* Draw second animation of view
*
* @param canvas
*/
private void drawSecondAnimation(Canvas canvas) {
if (arcO == limite) {
arcD += 6;
}
if (arcD >= 290 || arcO > limite) {
arcO += 6;
arcD -= 6;
}
if (arcO > limite + 290) {
limite = arcO;
arcO = limite;
arcD = 1;
}
rotateAngle += 4;
canvas.rotate(rotateAngle, getWidth() / 2, getHeight() / 2);
Bitmap bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
Canvas temp = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(backgroundColor);
// temp.drawARGB(0, 0, 0, 255);
temp.drawArc(new RectF(0, 0, getWidth(), getHeight()), arcO, arcD, true, paint);
Paint transparentPaint = new Paint();
transparentPaint.setAntiAlias(true);
transparentPaint.setColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
temp.drawCircle(getWidth() / 2, getHeight() / 2, (getWidth() / 2)
- Utils.dpToPx(4, getResources()), transparentPaint);
canvas.drawBitmap(bitmap, 0, 0, new Paint());
}
/**
* Make a dark color to ripple effect
*
* @return
*/
protected int makePressColor() {
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
// r = (r+90 > 245) ? 245 : r+90;
// g = (g+90 > 245) ? 245 : g+90;
// b = (b+90 > 245) ? 245 : b+90;
return Color.argb(128, r, g, b);
}
}

View File

@ -1,34 +0,0 @@
package com.gc.materialdesign.views;
import android.content.res.Resources;
import android.util.TypedValue;
import android.view.View;
public class Utils {
/**
* Convert Dp to Pixel
*/
public static int dpToPx(float dp, Resources resources) {
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
return (int) px;
}
public static int getRelativeTop(View myView) {
// if (myView.getParent() == myView.getRootView())
if (myView.getId() == android.R.id.content)
return myView.getTop();
else
return myView.getTop() + getRelativeTop((View) myView.getParent());
}
public static int getRelativeLeft(View myView) {
// if (myView.getParent() == myView.getRootView())
if (myView.getId() == android.R.id.content)
return myView.getLeft();
else
return myView.getLeft() + getRelativeLeft((View) myView.getParent());
}
}

View File

@ -1,21 +1,24 @@
package com.gh.base;
import android.app.Activity;
import android.arch.lifecycle.Lifecycle;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.Window;
import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import com.gh.common.constant.Constants;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.RunningUtils;
import com.gh.common.util.ShareUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.LoginActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.SuggestionActivity;
@ -43,6 +46,7 @@ import static com.gh.common.util.EntranceUtils.KEY_ENTRANCE;
public abstract class BaseActivity extends BaseToolBarActivity implements EasyPermissions.PermissionCallbacks {
@NonNull
protected String mEntrance;
private boolean mIsPause;
@ -101,6 +105,13 @@ public abstract class BaseActivity extends BaseToolBarActivity implements EasyPe
EventBus.getDefault().register(this);
ButterKnife.bind(this);
mEntrance = getIntent().getStringExtra(KEY_ENTRANCE);
if (TextUtils.isEmpty(mEntrance)) {
mEntrance = Constants.ENTRANCE_UNKNOWN;
}
if (BuildConfig.DEBUG) {
Utils.log("ACTIVITY_ENTRANCE -> " + mEntrance);
}
}
@Override
@ -159,10 +170,9 @@ public abstract class BaseActivity extends BaseToolBarActivity implements EasyPe
try {
JSONObject object = new JSONObject(showDialog.getPath());
JSONObject device = object.getJSONObject("device");
String manufacturer = device.getString("manufacturer");
String model = device.getString("model");
DialogUtils.showAlertDialog(this, "你的账号已在另外一台设备登录"
, StringUtils.buildString("", manufacturer, " - ", model, "")
, StringUtils.buildString("", model, "")
, "知道了", "重新登录"
, null
, () -> startActivity(LoginActivity.getIntent(BaseActivity.this,

View File

@ -2,10 +2,10 @@ package com.gh.base;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import androidx.annotation.Nullable;
import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import android.view.View;
import com.gh.base.adapter.FragmentAdapter;

View File

@ -1,6 +1,6 @@
package com.gh.base;
import android.support.v7.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import butterknife.ButterKnife;

View File

@ -1,8 +1,10 @@
package com.gh.base
import android.annotation.SuppressLint
import android.app.Activity
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.view.View
@ -10,6 +12,13 @@ import android.webkit.JavascriptInterface
import butterknife.OnClick
import com.gh.common.view.RichEditor
import com.gh.gamecenter.R
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.qa.editor.GameActivity
import com.gh.gamecenter.qa.editor.InsertAnswerWrapperActivity
import com.gh.gamecenter.qa.editor.InsertArticleWrapperActivity
import com.gh.gamecenter.qa.entity.AnswerEntity
import com.gh.gamecenter.qa.entity.ArticleEntity
import com.gh.gamecenter.qa.entity.EditorInsertEntity
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import com.lightgame.view.CheckableImageView
@ -35,20 +44,47 @@ abstract class BaseRichEditorActivity : BaseActivity() {
private val mEditorLinkContainer by bindView<View>(R.id.editor_link_container)
private val mEditorInsertDetail by bindView<View>(R.id.editor_insert_detail)
private var mCurrentParagraphStyle = ""
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode != Activity.RESULT_OK) return
var insertData: EditorInsertEntity? = null
when (requestCode) {
INSERT_ANSWER_CODE -> {
val answer = data?.getParcelableExtra<AnswerEntity>(AnswerEntity::class.java.simpleName)
if (answer != null) insertData = EditorInsertEntity.transform(answer)
}
INSERT_ARTICLE_CODE -> {
val article = data?.getParcelableExtra<ArticleEntity>(ArticleEntity::class.java.simpleName)
if (article != null) insertData = EditorInsertEntity.transform(article)
}
INSERT_GAME_CODE -> {
val game = data?.getParcelableExtra<GameEntity>(GameEntity::class.java.simpleName)
if (game != null) insertData = EditorInsertEntity.transform(game)
}
}
mRichEditor.insertCustomStyleLink(insertData)
}
@SuppressLint("AddJavascriptInterface")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mRichEditor.setPadding(20, 15, 20, 15)
// 防止个别手机在Js里无法获取粘贴内容
mRichEditor.addJavascriptInterface(OnPasteListener(), "onPasteListener")
mRichEditor.addJavascriptInterface(OnCursorChangeListener(), "OnCursorChangeListener")
mRichEditor.setInputEnabled(true)
}
@OnClick(R.id.editor_image, R.id.editor_font, R.id.editor_link, R.id.editor_paragraph,
R.id.editor_font_bold, R.id.editor_font_italic, R.id.editor_font_strikethrough,
R.id.editor_paragraph_h1, R.id.editor_paragraph_h2, R.id.editor_paragraph_h3,
R.id.editor_paragraph_h4, R.id.editor_font_container, R.id.editor_paragraph_container,
R.id.editor_paragraph_quote)
R.id.editor_paragraph_quote, R.id.editor_link_answer, R.id.editor_link_article,
R.id.editor_link_game)
fun onRichClick(view: View) {
when (view.id) {
R.id.editor_font -> {
@ -130,6 +166,15 @@ abstract class BaseRichEditorActivity : BaseActivity() {
}
mEditorParagraphQuote.isChecked = !mEditorParagraphQuote.isChecked
}
R.id.editor_link_answer -> {
startActivityForResult(InsertAnswerWrapperActivity.getIntent(this), INSERT_ANSWER_CODE)
}
R.id.editor_link_article -> {
startActivityForResult(InsertArticleWrapperActivity.getIntent(this), INSERT_ARTICLE_CODE)
}
R.id.editor_link_game -> {
startActivityForResult(GameActivity.getIntent(this), INSERT_GAME_CODE)
}
}
}
@ -141,6 +186,12 @@ abstract class BaseRichEditorActivity : BaseActivity() {
Utils.log(mRichEditor.html)
Utils.log("-----------------------")
mCurrentParagraphStyle = when {
elements.contains(ELEMENT_PARAGRAPH_QUOTE) -> ELEMENT_PARAGRAPH_QUOTE
elements.contains(ELEMENT_PARAGRAPH_P) -> ELEMENT_PARAGRAPH_P
else -> ""
}
mBaseHandler.post {
mEditorFontBold.isChecked = elements.contains(ELEMENT_NAME_BOLD)
mEditorFontItalic.isChecked = elements.contains(ELEMENT_NAME_ITALIC)
@ -176,6 +227,10 @@ abstract class BaseRichEditorActivity : BaseActivity() {
const val ELEMENT_PARAGRAPH_H2 = " h2 "
const val ELEMENT_PARAGRAPH_H3 = " h3 "
const val ELEMENT_PARAGRAPH_H4 = " h4 "
const val ELEMENT_PARAGRAPH_P = " p "
const val ELEMENT_PARAGRAPH_QUOTE = " blockquote "
const val INSERT_ANSWER_CODE = 411
const val INSERT_ARTICLE_CODE = 412
const val INSERT_GAME_CODE = 413
}
}

View File

@ -1,16 +1,17 @@
package com.gh.base;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import com.gh.common.util.DisplayUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.normal.ToolbarController;
@ -67,6 +68,13 @@ public abstract class BaseToolBarActivity extends BaseAppCompatActivity implemen
setNavigationTitle(getString(res));
}
/**
* 重写此方法以将标题靠左显示
*/
public boolean showToolbarAtLeft() {
return false;
}
@Override
public void setToolbarMenu(int res) {
if (mToolbar == null) return;
@ -89,9 +97,25 @@ public abstract class BaseToolBarActivity extends BaseAppCompatActivity implemen
ViewGroup.LayoutParams layoutParams = mTitleTv.getLayoutParams();
if (layoutParams instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layoutParams;
params.setMargins(DisplayUtils.dip2px(90), 0, DisplayUtils.dip2px(90), 0);
if (showToolbarAtLeft()) {
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
params.setMargins(DisplayUtils.dip2px(55), 0, DisplayUtils.dip2px(48 * menu.size()), 0);
} else {
params.setMargins(DisplayUtils.dip2px(90), 0, DisplayUtils.dip2px(90), 0);
}
mTitleTv.setLayoutParams(params);
}
} else {
if (showToolbarAtLeft()) {
ViewGroup.LayoutParams layoutParams = mTitleTv.getLayoutParams();
if (layoutParams instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layoutParams;
params.addRule(RelativeLayout.CENTER_VERTICAL);
params.setMargins(DisplayUtils.dip2px(55), 0, DisplayUtils.dip2px(48 * menu.size()), 0);
mTitleTv.setLayoutParams(params);
}
}
}
}

View File

@ -9,12 +9,12 @@ import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.preference.PreferenceManager
import android.support.v4.app.NotificationCompat
import android.text.TextUtils
import android.view.View
import androidx.core.app.NotificationCompat
import com.gh.common.notifier.Notifier
import com.gh.common.util.DataUtils
import com.gh.common.util.EntranceUtils
import com.gh.common.util.MtaHelper
import com.gh.common.util.StringUtils
import com.gh.common.util.toObject
import com.gh.gamecenter.R
@ -55,6 +55,7 @@ class GHUmengNotificationService : UmengMessageService() {
const val DISPLAY_TYPE_NOTIFICATION = "notification"
const val DISPLAY_TYPE_CUSTOM = "custom"
const val MESSAGE_ID = "message_id"
const val NOTIFICATION_MESSAGE_ID = "notification_message_id" // 通知中心消息 ID
const val PUSH_ID = "push_id"
}
@ -89,6 +90,7 @@ class GHUmengNotificationService : UmengMessageService() {
intent.putExtra(EntranceUtils.KEY_DATA, data?.link)
intent.putExtra(EntranceUtils.KEY_TYPE, UmengMessageReceiver.DIRECT_ONLY)
intent.putExtra(EntranceUtils.KEY_MESSAGE, message)
intent.putExtra(NOTIFICATION_MESSAGE_ID, data?.messageId)
context.sendBroadcast(intent)
return
}
@ -108,6 +110,7 @@ class GHUmengNotificationService : UmengMessageService() {
clickIntent.putExtra(EntranceUtils.KEY_MESSAGE, message)
clickIntent.putExtra(MESSAGE_ID, msg?.msgId)
clickIntent.putExtra(PUSH_ID, data?.pushId)
clickIntent.putExtra(NOTIFICATION_MESSAGE_ID, data?.messageId)
clickIntent.putExtra(EntranceUtils.KEY_TYPE, TYPE_CLICK)
removeIntent.setClass(context, UmengMessageReceiver::class.java)
@ -158,19 +161,20 @@ class GHUmengNotificationService : UmengMessageService() {
.setText(displayText)
.setDuration(5000)
.setIcon(data?.userEntity?.icon)
.setOnClickListener(View.OnClickListener { _ ->
.setOnClickListener(View.OnClickListener {
val bundle = Bundle()
bundle.putString(EntranceUtils.KEY_ANSWER_ID, data?.answer?.id)
bundle.putString(EntranceUtils.KEY_ENTRANCE, EntranceUtils.ENTRANCE_UMENG)
bundle.putString(EntranceUtils.KEY_TO, AnswerDetailActivity::class.java.name)
EntranceUtils.jumpActivity(context, bundle)
DataUtils.onMtaEvent(context, "消息弹窗", type, "Does not contains any parameter.")
MtaHelper.onEvent("消息弹窗", 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())
@ -184,7 +188,6 @@ class GHUmengNotificationService : UmengMessageService() {
e?.printStackTrace()
}
})
Notifier.hide()
})
.show(false)

View File

@ -2,7 +2,11 @@ package com.gh.base;
/**
* Created by Administrator on 2016/9/8.
*
* 逐步移除
*/
@Deprecated
public interface OnRequestCallBackListener<T> {
void loadDone();

View File

@ -1,9 +1,9 @@
package com.gh.base.adapter;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;

View File

@ -1,8 +1,8 @@
package com.gh.base.adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import java.util.List;

View File

@ -1,11 +1,11 @@
package com.gh.base.fragment;
import android.app.Dialog;
import android.arch.lifecycle.Lifecycle;
import androidx.lifecycle.Lifecycle;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v4.app.DialogFragment;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.fragment.app.DialogFragment;
import android.view.KeyEvent;
import com.gh.common.util.ClickUtils;

View File

@ -2,9 +2,9 @@ package com.gh.base.fragment;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;

View File

@ -1,22 +1,26 @@
package com.gh.base.fragment;
import android.arch.lifecycle.Lifecycle;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
import com.gh.base.OnListClickListener;
import com.gh.base.OnRequestCallBackListener;
import com.gh.common.constant.Constants;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.eventbus.EBMiPush;
import com.lightgame.OnTitleClickListener;
import com.lightgame.utils.RuntimeUtils;
@ -49,6 +53,7 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
protected boolean isEverPause;
@NonNull
protected String mEntrance;
protected final Handler mBaseHandler = new BaseFragment.BaseHandler(this);
@ -118,6 +123,14 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
mEntrance = getArguments().getString(KEY_ENTRANCE);
}
if (TextUtils.isEmpty(mEntrance)) {
mEntrance = Constants.ENTRANCE_UNKNOWN;
}
if (BuildConfig.DEBUG) {
Utils.log("FRAGMENT_ENTRANCE -> " + mEntrance);
}
isEverPause = false;
EventBus.getDefault().register(this);
@ -236,4 +249,10 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
}
}
// 为 fragment 附加 bundle (setArgument())
public BaseFragment with(Bundle bundle) {
this.setArguments(bundle);
return this;
}
}

View File

@ -2,11 +2,11 @@ package com.gh.base.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import android.view.View;
import com.gh.base.adapter.FragmentAdapter;

View File

@ -11,12 +11,12 @@ package com.gh.base.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import androidx.annotation.IdRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.view.View;
import com.gh.gamecenter.normal.NormalFragment;

View File

@ -10,9 +10,9 @@
package com.gh.base.fragment;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import androidx.annotation.IdRes;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;

View File

@ -1,13 +1,15 @@
package com.gh.base.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
import com.gh.gamecenter.R;
/**
@ -43,9 +45,9 @@ public class WaitingDialogFragment extends BaseDialogFragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.set_wait_dialog, null);
message = (TextView) view.findViewById(R.id.set_wait_message);
message = view.findViewById(R.id.set_wait_message);
message.setText(getArguments().getString(KEY_MSG));
return view;
}
@ -77,6 +79,12 @@ public class WaitingDialogFragment extends BaseDialogFragment {
return super.onBack();
}
@Override
public void dismiss() {
mBackListener = null;
super.dismiss();
}
public static class WaitingDialogData {
private String msg;

View File

@ -22,4 +22,12 @@ object AppExecutor {
mainThreadHandler.postDelayed(command, delay)
}
}
}
fun runOnIoThread(f: () -> Unit) {
AppExecutor.ioExecutor.execute(f)
}
fun runOnUiThread(f: () -> Unit) {
AppExecutor.uiExecutor.execute(f)
}

View File

@ -6,10 +6,11 @@ import com.gh.base.GHUmengNotificationService
import com.gh.common.constant.Config
import com.gh.common.exposure.meta.MetaUtil
import com.gh.common.util.edit
import com.gh.common.util.toJson
import com.gh.common.util.toObject
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.entity.AliasEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.google.gson.Gson
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import com.umeng.commonsdk.UMConfigure
@ -25,7 +26,6 @@ import org.json.JSONObject
object PushManager {
var gson = Gson()
var deviceToken: String? = ""
var previousAlias: AliasEntity? = null
var application = HaloApp.getInstance().application
@ -53,7 +53,7 @@ object PushManager {
registerDevice()
val aliasInSp = PreferenceManager.getDefaultSharedPreferences(application).getString(SP_PUSH_ALIAS, "")
previousAlias = gson.fromJson(aliasInSp, AliasEntity::class.java)
previousAlias = aliasInSp?.toObject()
if (previousAlias == null) {
getAndSetAlias()
@ -114,7 +114,7 @@ object PushManager {
previousAlias = alias
PreferenceManager.getDefaultSharedPreferences(application).edit {
putString(SP_PUSH_ALIAS, gson.toJson(previousAlias))
putString(SP_PUSH_ALIAS, previousAlias?.toJson())
}
pushAgent.setAlias(alias.alias, alias.aliasType) { b, s ->

View File

@ -3,8 +3,8 @@ package com.gh.common
import android.app.Activity
import android.app.Application
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import com.halo.assistant.HaloApp
import java.util.concurrent.Executors
@ -61,19 +61,19 @@ class TimeElapsedHelper(val fragment: Fragment?, val activity: Activity?) {
fragment?.fragmentManager?.registerFragmentLifecycleCallbacks(
object : FragmentManager.FragmentLifecycleCallbacks() {
override fun onFragmentResumed(fm: FragmentManager?, f: Fragment?) {
override fun onFragmentResumed(fm: FragmentManager, f: Fragment) {
if (f === fragment) {
resumeCounting()
}
}
override fun onFragmentPaused(fm: FragmentManager?, f: Fragment?) {
override fun onFragmentPaused(fm: FragmentManager, f: Fragment) {
if (f === fragment) {
pauseCounting()
}
}
override fun onFragmentViewDestroyed(fm: FragmentManager?, f: Fragment?) {
override fun onFragmentViewDestroyed(fm: FragmentManager, f: Fragment) {
if (f === fragment) {
fragment.fragmentManager?.unregisterFragmentLifecycleCallbacks(this)
}

View File

@ -0,0 +1,11 @@
package com.gh.common.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Synchronize {
}

View File

@ -3,11 +3,12 @@ package com.gh.common.constant;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import com.gh.common.util.GsonUtils;
import com.gh.common.util.PackageHelper;
import com.gh.common.util.SPUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.SettingsEntity;
@ -19,17 +20,12 @@ import java.util.List;
public class Config {
public static final String API_HOST = BuildConfig.API_HOST;
public static final String USER_HOST = BuildConfig.USER_HOST;
public static final String COMMENT_HOST = BuildConfig.COMMENT_HOST;
public static final String DATA_HOST = BuildConfig.DATA_HOST;
public static final String LIBAO_HOST = BuildConfig.LIBAO_HOST;
public static final String MESSAGE_HOST = BuildConfig.MESSAGE_HOST;
/**
* 需要配置的请使用{@link PreferenceManager#getDefaultSharedPreferences(Context)}
*/
// @Deprecated
// public static final String PREFERENCE = "ghzhushou";
// Third-Party confs
public static final String WECHAT_APPID = BuildConfig.WECHAT_APPID;
@ -47,6 +43,8 @@ public class Config {
public static final String URL_ARTICLE = "http://www.ghzs666.com/article/"; // ghzs/ghzs666 统一
public static final String PATCHES = "patches";
public static final String DEFAULT_CHANNEL = "GH_TEST";
private static String SETTINGS_KEY = "settingsKey";
private static SettingsEntity mSettingsEntity;
@ -77,7 +75,7 @@ public class Config {
}
public static void setExceptionMsg(String errMsg) {
getPreferences().edit().putString("errMsg", errMsg).apply();
SPUtils.setString(getPreferences(), "errMsg", errMsg); //先用apply(),保存不了再用commit() 9.0机型保存不了信息
}
public static boolean isShowDownload(String gameId) {
@ -144,6 +142,7 @@ public class Config {
for (SettingsEntity.Download entity : getSettings().getDownload()) {
if ("all".equals(entity.getGame())) {
if (entity.getPluginfy() && filterTime(entity.getTime())) {
preferences.edit().putBoolean(FIX_PLUGIN_KEY, true).apply();
return true;
}
}

View File

@ -47,4 +47,7 @@ public class Constants {
//评论 cd间隔
public static final int COMMENT_CD = 60 * 1000;
public static final String[] REPORT_LIST = new String[]{"垃圾广告营销", "恶意攻击谩骂", "淫秽色情信息", "违法有害信息", "其它"};
public static final String ENTRANCE_UNKNOWN = "(unknown)";
}

View File

@ -27,13 +27,13 @@ public class ItemViewType {
public static final int ASK_REFRESH = 19; // 问答精选 刷新
public static final int ITEM_EMPTY = 20;
public static final int ASK_CONCERN = 21; // 问答精选 关注
public static final int RATING_ITEM = 22; // 问答精选 关注
/**
* 普通列表
*/
public static final int ITEM_BODY = 100;
public static final int ITEM_FOOTER = 101;
public static final int ITEM_TOP = 102;
public static final int ITEM_HEADER = 102;
}

View File

@ -1,9 +1,6 @@
package com.gh.common.databind;
import android.content.Intent;
import android.databinding.BindingAdapter;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@ -12,6 +9,10 @@ import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.databinding.BindingAdapter;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.OnViewClickListener;
import com.gh.common.constant.Config;
@ -20,10 +21,10 @@ import com.gh.common.exposure.ExposureUtils;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.DownloadDialogHelper;
import com.gh.common.util.GameUtils;
import com.gh.common.util.GameViewUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.KaiFuUtils;
import com.gh.common.util.NewsUtils;
import com.gh.common.util.NumberUtils;
import com.gh.common.util.PackageUtils;
@ -64,12 +65,16 @@ public class BindingAdapters {
ImageUtils.displayIcon(view, imageUrl);
}
@BindingAdapter("imageUrl")
public static void loadImage(SimpleDraweeView view, String imageUrl) {
ImageUtils.display(view, imageUrl);
}
@BindingAdapter("setTextSize")
public static void setTextSize(TextView view, int number) {
view.setTextSize(number);
}
@BindingAdapter({"addDetailKaiFuView", "addDetailKaiFuViewListener", "isReadyPatch"})
public static void addDetailKaiFuView(LinearLayout view, List<KaiFuCalendarEntity> list
, OnViewClickListener listener, Boolean isReadyPatch) {
@ -300,6 +305,7 @@ public class BindingAdapters {
}
}
// 大图下的进度条
@BindingAdapter({"downloadButton", "traceEvent"})
public static void setDownloadButton(DownloadProgressBar progressBar, GameEntity gameEntity, ExposureEvent traceEvent) {
// 判断是否显示按钮
@ -385,8 +391,15 @@ public class BindingAdapters {
case NORMAL:
case PLUGIN:
if (gameEntity.getApk().size() == 1) {
DialogUtils.checkDownload(v.getContext(), gameEntity.getApk().get(0).getSize(),
isSubscribe -> download(progressBar, gameEntity, traceEvent, isSubscribe));
ApkEntity apk = gameEntity.getApk().get(0);
DownloadDialogHelper.findAvailableDialogAndShow(
v.getContext(),
gameEntity,
apk,
() -> {
DialogUtils.checkDownload(v.getContext(), apk.getSize(),
isSubscribe -> download(progressBar, gameEntity, traceEvent, isSubscribe));
});
} else {
DownloadDialog.getInstance(v.getContext()).showPopupWindow(v, gameEntity,
"(我的光环:我的游戏)", "我的光环-我的游戏:" + gameEntity.getName(), traceEvent);
@ -457,8 +470,8 @@ public class BindingAdapters {
View testView = LayoutInflater.from(layout.getContext()).inflate(R.layout.game_test_label, null);
TextView testType = testView.findViewById(R.id.test_type);
TextView testTime = testView.findViewById(R.id.test_time);
String type = gameEntity.getTest().getType();
KaiFuUtils.setKaiFuType(testType, type);
testType.setText(gameEntity.getTest().getType());
testType.setBackgroundColor(ContextCompat.getColor(layout.getContext(), R.color.tag_yellow));
if (gameEntity.getTest().getStart() == 0) {
testTime.setVisibility(View.GONE);

View File

@ -0,0 +1,181 @@
package com.gh.common.dialog
import android.annotation.SuppressLint
import android.app.Application
import android.os.Bundle
import android.text.Html
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.TextView
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData
import butterknife.BindView
import butterknife.ButterKnife
import butterknife.OnClick
import com.gh.common.constant.Config
import com.gh.common.repository.ReservationRepository
import com.gh.common.util.*
import com.gh.gamecenter.R
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.retrofit.BiResponse
import com.gh.gamecenter.retrofit.RetrofitManager
import com.lightgame.dialog.BaseDialogFragment
import com.lightgame.utils.Utils
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
class ReserveDialogFragment : BaseDialogFragment() {
@BindView(R.id.reserve_hint_tv)
lateinit var reserveHintTv: TextView
@BindView(R.id.reserve_content_tv)
lateinit var reserveContentTv: TextView
@BindView(R.id.reserve_completed_content_tv)
lateinit var reserveCompletedContentTv: TextView
@BindView(R.id.mobile_et)
lateinit var mobileEt: EditText
@BindView(R.id.reserve_container)
lateinit var reserveContainer: View
@BindView(R.id.reserve_completed_container)
lateinit var reserveCompletedContainer: View
@BindView(R.id.customizable_btn)
lateinit var customizableBtn: TextView
private lateinit var mViewModel: ReserveViewModel
private var mSuccessCallback: SuccessCallback? = null
private var mGameId: String = ""
private var mGameName: String = ""
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mViewModel = viewModelProvider()
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.dialog_reserve_game, null)
}
@Suppress("DEPRECATION")
@SuppressLint("SetTextI18n")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
ButterKnife.bind(this, view)
val reserveContent = "游戏上线,您将<font color='#ff4147'>免费</font>收到短信提醒"
reserveContentTv.text = Html.fromHtml(reserveContent)
mobileEt.setText(UserManager.getInstance().userInfoEntity.mobile)
mobileEt.setSelection(mobileEt.text.length)
mViewModel.reservation.observeNonNull(this) {
if (it.success) {
showSuccessDialog(it.withMobile)
mSuccessCallback?.onSuccess()
}
}
dialog.setCanceledOnTouchOutside(true)
}
private fun showSuccessDialog(withMobile: Boolean) {
reserveHintTv.text = "游戏预约成功"
reserveContainer.visibility = View.GONE
reserveCompletedContainer.visibility = View.VISIBLE
val reservation = Config.getSettings()?.appointment
val dialogConfig = if (withMobile) reservation?.withMobile else reservation?.withoutMobile
reserveCompletedContentTv.text = Html.fromHtml(dialogConfig?.htmlContent)
if (dialogConfig?.text.isNullOrEmpty()
|| dialogConfig?.toLinkEntity()?.link.isNullOrEmpty()) {
customizableBtn.visibility = View.GONE
} else {
customizableBtn.text = dialogConfig?.text
customizableBtn.setOnClickListener {
DirectUtils.directToLinkPage(
requireContext(),
dialogConfig!!.toLinkEntity(),
"(游戏预约)",
"")
dismissAllowingStateLoss()
}
}
}
@OnClick(R.id.reserve_with_mobile_btn,
R.id.reserve_without_mobile_btn,
R.id.close_btn,
R.id.customizable_btn)
fun onClick(view: View) {
when (view.id) {
R.id.reserve_without_mobile_btn -> {
mViewModel.reserve(gameId = mGameId, gameName = mGameName)
}
R.id.reserve_with_mobile_btn -> {
val mobile = mobileEt.text.toString()
if (mobile.length < 11 || !mobile.startsWith("1")) {
Utils.toast(context, "手机号格式错误,请检查并重新输入")
return
}
mViewModel.reserve(gameId = mGameId, gameName = mGameName, mobile = mobile)
}
R.id.close_btn -> {
dismissAllowingStateLoss()
}
}
}
companion object {
@JvmStatic
fun getInstance(gameEntity: GameEntity, successCallback: SuccessCallback) = ReserveDialogFragment().apply {
this.mGameId = gameEntity.id
this.mGameName = gameEntity.name ?: ""
this.mSuccessCallback = successCallback
}
}
interface SuccessCallback {
fun onSuccess()
}
}
class ReserveViewModel(application: Application) : AndroidViewModel(application) {
val reservation = MutableLiveData<Reservation>()
@SuppressLint("CheckResult")
fun reserve(gameId: String, gameName: String, mobile: String = "") {
val requestMap = hashMapOf<String, String>()
requestMap["game_id"] = gameId
if (mobile.isNotEmpty()) {
requestMap["mobile"] = mobile
}
RetrofitManager.getInstance(getApplication()).api
.createNewGameReservation(requestMap.createRequestBody())
.subscribeOn(Schedulers.io())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
reservation.postValue(Reservation(success = true, withMobile = mobile.isNotEmpty()))
ReservationRepository.addReservationToMemoryAndRefresh(gameId)
MtaHelper.onEvent("预约游戏", "预约", gameName)
}
override fun onFailure(exception: Exception) {
Utils.toast(getApplication(), exception.message)
}
})
}
class Reservation(var success: Boolean = false, var withMobile: Boolean = false)
}

View File

@ -1,9 +1,8 @@
package com.gh.common.exposure
import android.arch.persistence.room.TypeConverter
import androidx.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
@ -36,7 +35,7 @@ class ExposureConverters {
@TypeConverter
fun convertStringToETrace(sourceList: String): List<ExposureEvent> {
return ArrayList(Arrays.asList(Gson().fromJson(sourceList, Array<ExposureEvent>::class.java))) as List<ExposureEvent>
return ArrayList(Arrays.asList(GsonUtils.fromJson(sourceList, Array<ExposureEvent>::class.java))) as List<ExposureEvent>
}
@TypeConverter

View File

@ -1,9 +1,9 @@
package com.gh.common.exposure
import android.arch.persistence.room.Database
import android.arch.persistence.room.Room
import android.arch.persistence.room.RoomDatabase
import android.arch.persistence.room.TypeConverters
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import android.content.Context
@TypeConverters(ExposureConverters::class)

View File

@ -1,7 +1,7 @@
package com.gh.common.exposure
import android.os.Parcelable
import android.support.annotation.Keep
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize

View File

@ -1,9 +1,9 @@
package com.gh.common.exposure
import android.arch.persistence.room.Entity
import android.arch.persistence.room.PrimaryKey
import androidx.room.Entity
import androidx.room.PrimaryKey
import android.os.Parcelable
import android.support.annotation.Keep
import androidx.annotation.Keep
import com.gh.common.exposure.meta.Meta
import com.gh.common.exposure.meta.MetaUtil
import com.gh.common.exposure.time.TimeUtil

View File

@ -1,6 +1,6 @@
package com.gh.common.exposure
import android.arch.persistence.room.*
import androidx.room.*
@Dao
interface ExposureEventDao {

View File

@ -1,9 +1,9 @@
package com.gh.common.exposure
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import io.reactivex.functions.Consumer
/**
@ -18,11 +18,11 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
init {
fragment.fragmentManager?.registerFragmentLifecycleCallbacks(
object : FragmentManager.FragmentLifecycleCallbacks() {
override fun onFragmentResumed(fm: FragmentManager?, f: Fragment?) {
override fun onFragmentResumed(fm: FragmentManager, f: Fragment) {
throttleBus = ExposureThrottleBus(Consumer { commitExposure(it) }, Consumer(Throwable::printStackTrace))
}
override fun onFragmentPaused(fm: FragmentManager?, f: Fragment?) {
override fun onFragmentPaused(fm: FragmentManager, f: Fragment) {
visibleState?.let { commitExposure(it) }
throttleBus?.clear()
}

View File

@ -2,10 +2,10 @@ package com.gh.common.exposure
import com.aliyun.sls.android.sdk.model.LogGroup
import com.gh.common.exposure.time.TimeUtil
import com.gh.common.util.toJson
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
@ -30,8 +30,6 @@ object ExposureManager {
private val loghubHelper = LoghubHelper.getInstance()
private val gson = Gson()
// exposureCache 用来过滤掉具有相同 id 的曝光事件,避免重复发送事件
private val exposureCache = FixedSizeLinkedHashSet<String>(100)
private val exposureSet = hashSetOf<ExposureEvent>()
@ -97,9 +95,9 @@ object ExposureManager {
}
}
private fun commitSavedExposureEvent(force: Boolean = false) {
fun commitSavedExposureEvent(forced: Boolean = false) {
exposureExecutor.execute {
if (exposureSet.size < STORE_SIZE && !force || exposureSet.size == 0) return@execute
if (exposureSet.size < STORE_SIZE && !forced || exposureSet.size == 0) return@execute
val exposureList = exposureSet.toList()
// uploadLogGroup 是一个异步方法LoghubHelper 里面实现了重传功能,所以这里交给它就好了
@ -127,11 +125,13 @@ object ExposureManager {
val log = LgLOG(TimeUtil.currentTime())
log.PutContent("id", event.id)
log.PutContent("payload", gson.toJson(event.payload))
log.PutContent("payload", event.payload.toJson())
log.PutContent("event", event.event.toString())
log.PutContent("source", eliminateMultipleBrackets(gson.toJson(event.source)))
log.PutContent("meta", gson.toJson(event.meta))
log.PutContent("e-traces", if (event.eTrace != null) eliminateMultipleBrackets(gson.toJson(event.eTrace)) else "")
log.PutContent("source", eliminateMultipleBrackets(event.source.toJson()))
log.PutContent("meta", event.meta.toJson())
log.PutContent("e-traces", if (event.eTrace != null) {
eliminateMultipleBrackets(event.eTrace?.toJson() ?: "")
} else "")
log.PutTime(event.time)
return log

View File

@ -1,7 +1,7 @@
package com.gh.common.exposure
import android.os.Parcelable
import android.support.annotation.Keep
import androidx.annotation.Keep
import kotlinx.android.parcel.Parcelize
@Keep

View File

@ -36,6 +36,7 @@ object ExposureUtils {
eTrace = ExposureTraceUtils.appendTrace(traceEvent),
event = ExposureType.DOWNLOAD_COMPLETE)
ExposureManager.log(exposureEvent)
ExposureManager.commitSavedExposureEvent(forced = true)
}
enum class DownloadType {

View File

@ -1,7 +1,7 @@
package com.gh.common.exposure.meta
import android.os.Parcelable
import android.support.annotation.Keep
import androidx.annotation.Keep
import kotlinx.android.parcel.Parcelize
@Keep
@ -20,5 +20,6 @@ data class Meta(
val channel: String? = "",
val appVersion: String? = "",
val userId: String? = "",
val exposureVersion: String? = ""
val exposureVersion: String? = "",
val rom: String? = ""
) : Parcelable

View File

@ -14,6 +14,7 @@ import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.manager.UserManager
import com.halo.assistant.HaloApp
import com.leon.channel.helper.ChannelReaderUtil
import com.walkud.rom.checker.RomIdentifier
import java.io.File
object MetaUtil {
@ -37,7 +38,8 @@ object MetaUtil {
channel = getChannel(),
appVersion = BuildConfig.VERSION_NAME,
userId = UserManager.getInstance().userId,
exposureVersion = BuildConfig.EXPOSURE_VERSION)
exposureVersion = BuildConfig.EXPOSURE_VERSION,
rom = RomIdentifier.getRom().name + "" + RomIdentifier.getRom().versionName)
}
fun getMeta(): Meta {

View File

@ -0,0 +1,52 @@
package com.gh.common.history
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.gh.gamecenter.entity.HistoryGameEntity
import com.gh.gamecenter.entity.NewsEntity
import com.gh.gamecenter.qa.entity.AnswerEntity
import com.gh.gamecenter.qa.entity.ArticleEntity
import com.gh.gamecenter.room.converter.*
import com.gh.gamecenter.room.dao.AnswerHistoryDao
import com.gh.gamecenter.room.dao.ArticleHistoryDao
import com.gh.gamecenter.room.dao.GameDao
import com.gh.gamecenter.room.dao.NewsHistoryDao
import com.halo.assistant.HaloApp
@Database(entities = [AnswerEntity::class, ArticleEntity::class, NewsEntity::class, HistoryGameEntity::class], version = 3, exportSchema = false)
@TypeConverters(*[
CountConverter::class,
CommunityConverter::class,
TimeConverter::class,
AnswerUserConverter::class,
ThumbnailConverter::class,
TagStyleListConverter::class,
StringArrayListConverter::class])
abstract class HistoryDatabase : RoomDatabase() {
abstract fun answerDao(): AnswerHistoryDao
abstract fun articleDao(): ArticleHistoryDao
abstract fun newsDao(): NewsHistoryDao
abstract fun gameDao(): GameDao
companion object {
val MIGRATION_2_3: Migration = object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("Alter TABLE HistoryGameEntity add isLibaoExist INTEGER NOT NULL DEFAULT 0")
}
}
val instance by lazy {
Room.databaseBuilder(HaloApp.getInstance().application, HistoryDatabase::class.java, "USER_TRACK_HISTORY_DATABASE")
.addMigrations(MIGRATION_2_3)
.build()
}
}
}

View File

@ -0,0 +1,108 @@
package com.gh.common.history
import com.gh.common.runOnIoThread
import com.gh.common.util.clearHtmlFormatCompletely
import com.gh.common.util.removeInsertedContent
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.entity.HistoryGameEntity
import com.gh.gamecenter.entity.NewsEntity
import com.gh.gamecenter.qa.entity.AnswerDetailEntity
import com.gh.gamecenter.qa.entity.AnswerEntity
import com.gh.gamecenter.qa.entity.ArticleDetailEntity
import com.gh.gamecenter.qa.entity.ArticleEntity
object HistoryHelper {
fun insertAnswerEntity(answerDetailEntity: AnswerDetailEntity) {
val answerEntity = convertAnswerDetailToAnswer(answerDetailEntity)
runOnIoThread { HistoryDatabase.instance.answerDao().addAnswer(answerEntity) }
}
fun insertArticleEntity(articleDetailEntity: ArticleDetailEntity) {
val articleEntity = convertArticleDetailToArticle(articleDetailEntity)
runOnIoThread { HistoryDatabase.instance.articleDao().addArticle(articleEntity) }
}
fun insertGameEntity(gameEntity: GameEntity) {
val historyGameEntity = convertGameEntityToHistoryGameEntity(gameEntity)
runOnIoThread { HistoryDatabase.instance.gameDao().addGame(historyGameEntity) }
}
private fun convertGameEntityToHistoryGameEntity(gameEntity: GameEntity): HistoryGameEntity {
val historyGame = HistoryGameEntity()
historyGame.orderTag = System.currentTimeMillis()
historyGame.id = gameEntity.id
historyGame.brief = gameEntity.brief
historyGame.des = gameEntity.des
historyGame.icon = gameEntity.icon
historyGame.name = gameEntity.name
historyGame.tagStyle = gameEntity.tagStyle
historyGame.tag = gameEntity.getTag()
historyGame.isLibaoExist = gameEntity.isLibaoExists
return historyGame
}
@JvmStatic
fun insertNewsEntity(newsEntity: NewsEntity) {
newsEntity.orderTag = System.currentTimeMillis()
runOnIoThread { HistoryDatabase.instance.newsDao().addNews(newsEntity) }
}
@JvmStatic
fun deleteNewsEntity(newsId: String) {
runOnIoThread { HistoryDatabase.instance.newsDao().deleteNews(NewsEntity().apply { id = newsId }) }
}
@JvmStatic
fun deleteGameEntity(gameId: String) {
runOnIoThread { HistoryDatabase.instance.gameDao().deleteGame(HistoryGameEntity(id = gameId)) }
}
@JvmStatic
fun deleteArticleEntity(articleId: String) {
runOnIoThread { HistoryDatabase.instance.articleDao().deleteArticle(ArticleEntity(id = articleId)) }
}
@JvmStatic
fun deleteAnswerEntity(answerId: String) {
runOnIoThread { HistoryDatabase.instance.answerDao().deleteAnswer(AnswerEntity().apply { primaryKey = answerId }) }
}
@JvmStatic
fun emptyDatabase() {
runOnIoThread { HistoryDatabase.instance.clearAllTables() }
}
private fun convertArticleDetailToArticle(articleDetailEntity: ArticleDetailEntity): ArticleEntity {
val articleEntity = ArticleEntity()
articleEntity.id = articleDetailEntity.id
articleEntity.brief = articleDetailEntity.content.removeInsertedContent().clearHtmlFormatCompletely().replace(" +".toRegex()," ")
articleEntity.count = articleDetailEntity.count
articleEntity.community = articleDetailEntity.community
articleEntity.time = articleDetailEntity.time
articleEntity.title = articleDetailEntity.title
articleEntity.user = articleDetailEntity.user
articleEntity.orderTag = System.currentTimeMillis()
return articleEntity
}
private fun convertAnswerDetailToAnswer(answerDetailEntity: AnswerDetailEntity): AnswerEntity {
val answerEntity = AnswerEntity()
answerEntity.id = answerDetailEntity.id
answerEntity.primaryKey = answerDetailEntity.id
answerEntity.commentCount = answerDetailEntity.commentCount
answerEntity.questions = answerDetailEntity.question
answerEntity.vote = answerDetailEntity.vote
answerEntity.user = answerDetailEntity.user
answerEntity.orderTag = System.currentTimeMillis()
answerEntity.brief = answerDetailEntity.content.removeInsertedContent().clearHtmlFormatCompletely().replace(" +".toRegex(), " ")
answerEntity.time = answerDetailEntity.time
return answerEntity
}
}

View File

@ -1,7 +1,7 @@
package com.gh.common.im
import android.app.Activity
import android.support.v4.view.ViewCompat
import androidx.core.view.ViewCompat
import android.view.View
import android.view.ViewGroup

View File

@ -3,7 +3,7 @@ package com.gh.common.im
import android.app.Activity
import android.content.Context
import android.os.Build
import android.support.v4.view.ViewCompat
import androidx.core.view.ViewCompat
import android.util.AttributeSet
import android.util.DisplayMetrics
import android.util.TypedValue

View File

@ -5,6 +5,7 @@ import android.app.NotificationManager
import android.content.Context
import com.gh.base.CurrentActivityHolder
import com.gh.common.util.SPUtils
import com.gh.common.util.tryWithDefaultCatch
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.MessageActivity
@ -128,11 +129,13 @@ object ImManager {
fun sendFeedbackMessage(message: String) {
val fromToMessage = IMMessage.createTxtMessage(message)
HaloApp.getInstance().mainExecutor.execute {
IMChat.getInstance().sendMessage(fromToMessage, object : ChatListener {
override fun onProgress(p0: Int) {}
override fun onSuccess() {}
override fun onFailed() {}
})
tryWithDefaultCatch {
IMChat.getInstance().sendMessage(fromToMessage, object : ChatListener {
override fun onProgress(p0: Int) {}
override fun onSuccess() {}
override fun onFailed() {}
})
}
}
}

View File

@ -8,7 +8,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
import android.support.v4.app.NotificationCompat
import androidx.core.app.NotificationCompat
import com.gh.base.CurrentActivityHolder
import com.gh.gamecenter.R
import com.m7.imkfsdk.chat.ChatActivity

View File

@ -1,7 +1,7 @@
package com.gh.common.notifier
import android.app.Activity
import android.support.v4.view.ViewCompat
import androidx.core.view.ViewCompat
import android.view.View
import android.view.ViewGroup
import com.gh.common.util.SPUtils

View File

@ -5,7 +5,6 @@ import android.app.Activity
import android.content.Context
import android.graphics.Path
import android.os.Build
import android.support.v4.view.ViewCompat
import android.text.TextUtils
import android.util.AttributeSet
import android.util.DisplayMetrics
@ -13,6 +12,7 @@ import android.util.Log
import android.util.TypedValue
import android.view.*
import android.widget.FrameLayout
import androidx.core.view.ViewCompat
import com.gh.common.util.ImageUtils
import com.gh.common.util.doOnEnd
import com.gh.common.util.doOnStart

View File

@ -22,7 +22,7 @@ import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ValueAnimator
import android.os.Build
import android.support.annotation.RequiresApi
import androidx.annotation.RequiresApi
import android.view.MotionEvent
import android.view.VelocityTracker
import android.view.View

View File

@ -0,0 +1,72 @@
package com.gh.common.repository
import android.annotation.SuppressLint
import com.gh.common.util.CheckLoginUtils
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.retrofit.BiResponse
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
/**
* 预约游戏仓库,存储了用户已预约的游戏列表
*/
object ReservationRepository {
private var mReservationSet = hashSetOf<String>()
@JvmStatic
fun refreshReservationsIfNeeded() {
if (mReservationSet.isEmpty()) {
refreshReservations()
}
}
fun addReservationToMemoryAndRefresh(gameId: String) {
mReservationSet.add(gameId)
refreshReservations()
}
@JvmStatic
fun removeReservationFromMemoryAndRefresh(gamedId: String) {
mReservationSet.remove(gamedId)
refreshReservations()
}
@SuppressLint("CheckResult")
@JvmStatic
fun refreshReservations() {
if (CheckLoginUtils.isLogin()) {
RetrofitManager.getInstance(HaloApp.getInstance().application).api
.getAllTheGameReservations(UserManager.getInstance().userId, Utils.getTime(HaloApp.getInstance().application))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<List<String>>() {
override fun onSuccess(data: List<String>) {
mReservationSet = HashSet(data)
}
})
}
}
@JvmStatic
fun clearReservations() {
mReservationSet.clear()
}
@JvmStatic
fun thisGameHasBeenReserved(gameId: String): Boolean {
return if (!CheckLoginUtils.isLogin()) false else {
if (mReservationSet.isEmpty()) {
false
} else {
mReservationSet.contains(gameId)
}
}
}
}

View File

@ -0,0 +1,41 @@
package com.gh.common.util
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import com.lightgame.utils.Util_System_Phone_State
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
/**
* 激活信息辅助类
*/
object ActivationHelper {
private const val HAS_SENT_ACTIVATED_INFO = "has_sent_activated_info"
var mHasSentActivatedInfo = SPUtils.getBoolean(HAS_SENT_ACTIVATED_INFO, false)
/**
* 发送激活信息 (用于推广)
*/
@JvmStatic
fun sendActivationInfo() {
// 能获取到 IMEI 并且之前没发送过激活信息才发
if (mHasSentActivatedInfo
&& Util_System_Phone_State.canGetImei(HaloApp.getInstance().application)) {
RetrofitManager.getInstance(HaloApp.getInstance().application)
.api.postActivationInfo()
.subscribeOn(Schedulers.io())
.subscribe(object : Response<ResponseBody>() {
override fun onResponse(response: ResponseBody?) {
super.onResponse(response)
mHasSentActivatedInfo = true
SPUtils.setBoolean(HAS_SENT_ACTIVATED_INFO, true)
}
})
}
}
}

View File

@ -17,7 +17,7 @@
package com.gh.common.util
import android.animation.Animator
import android.support.annotation.RequiresApi
import androidx.annotation.RequiresApi
import android.view.ViewPropertyAnimator
/**

View File

@ -1,93 +0,0 @@
package com.gh.common.util;
import android.content.Context;
import com.lightgame.utils.Utils;
import org.json.JSONObject;
import retrofit2.HttpException;
/**
* Created by khy on 28/12/17.
*/
public class AskErrorResponseUtils {
public static void errorResponseControl(Context context, HttpException e) {
if (e == null) return;
int code = e.code();
try {
if (code == 403 || code == 401) {
JSONObject object = new JSONObject(e.response().errorBody().string());
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

@ -7,6 +7,9 @@ import android.graphics.Matrix;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.media.ExifInterface;
import android.os.Build;
import com.halo.assistant.HaloApp;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
@ -186,15 +189,30 @@ public class BitmapUtils {
/**
* Drawable转Bitmap
* @param isSquare 是否是正方形
*/
public static Bitmap drawableToBitmap(Drawable drawable) {
public static Bitmap drawableToBitmap(Drawable drawable, boolean isSquare) {
if (drawable == null) {
return null;
}
int w,h;
// 取 drawable 的长宽
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
w = drawable.getIntrinsicWidth();
h = drawable.getIntrinsicHeight();
// 在低于 5.1 和运行内存小于 2G 的设备上减小图片大小,避免 OOM128 * 128 又不是不能看
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
|| DeviceUtils.getTotalRamSizeOfDevice(HaloApp.getInstance().getApplication()) < 2000) {
if (isSquare) {
w = w > 128 ? 128 : w;
h = h > 128 ? 128 : h;
} else {
w = w > 128 ? w / 2 : w;
h = h > 128 ? h / 2 : h;
}
}
// 取 drawable 的颜色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;

View File

@ -46,7 +46,7 @@ object CollectionUtils {
try {
val string = e.response()?.errorBody()?.string()
val errorBody = JSONObject(string)
if (errorBody.getInt("detail") == 403009) {
if (errorBody.getInt("code") == 403009) {
listener.onSuccess()
return
}

View File

@ -8,6 +8,7 @@ import com.gh.gamecenter.MessageDetailActivity
import com.gh.gamecenter.adapter.OnCommentCallBackListener
import com.gh.gamecenter.entity.CommentEntity
import com.gh.gamecenter.entity.MeEntity
import com.gh.gamecenter.entity.Permissions
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.lightgame.utils.Utils
@ -63,13 +64,13 @@ object CommentHelper {
}
dialogOptions.add("复制")
dialogOptions.add("举报")
dialogOptions.add("投诉")
commentEntity.me?.let {
if (it.isModerator || (it.moderatorPermissions.contains(MeEntity.HIDE_ANSWER_COMMENT)
|| it.moderatorPermissions.contains(MeEntity.TOP_ANSWER_COMMENT)
|| it.moderatorPermissions.contains(MeEntity.HIDE_COMMUNITY_ARTICLE)
|| it.moderatorPermissions.contains(MeEntity.TOP_COMMUNITY_ARTICLE_COMMENT))) {
if (it.isModerator || (it.moderatorPermissions.hideAnswerComment > Permissions.GUEST
|| it.moderatorPermissions.topAnswerComment > Permissions.GUEST
|| it.moderatorPermissions.hideCommunityArticleComment > Permissions.GUEST
|| it.moderatorPermissions.topCommunityArticleComment > Permissions.GUEST)) {
dialogOptions.add("管理")
}
}
@ -96,20 +97,20 @@ object CommentHelper {
"复制" -> copyText(commentEntity.content, context)
"举报" -> {
context.ifLogin("回答详情-评论-举报") {
"投诉" -> {
context.ifLogin("回答详情-评论-投诉") {
showReportTypeDialog(context) { reportType ->
val commentListener = object : PostCommentUtils.PostCommentListener {
override fun postSuccess(response: JSONObject?) {
Utils.toast(context, "感谢您的举报")
Utils.toast(context, "感谢您的投诉")
}
override fun postFailed(error: Throwable?) {
if (error == null) {
Utils.toast(context, "举报失败,请稍后重试")
Utils.toast(context, "投诉失败,请稍后重试")
} else {
Utils.toast(context, "举报失败,${error.message}")
Utils.toast(context, "投诉失败,${error.message}")
}
}
}
@ -146,20 +147,37 @@ object CommentHelper {
val highlight = "置顶评论"
val hide = "隐藏评论"
if (me.moderatorPermissions.contains(MeEntity.TOP_ANSWER_COMMENT)
|| me.moderatorPermissions.contains(MeEntity.TOP_COMMUNITY_ARTICLE_COMMENT)) {
var canHighlightCommentDirectly = false
var canHideCommentDirectly = false
if (me.moderatorPermissions.topAnswerComment > Permissions.GUEST
|| me.moderatorPermissions.topCommunityArticleComment > Permissions.GUEST) {
dialogOptions.add(highlight)
if (me.moderatorPermissions.topAnswerComment > Permissions.REPORTER
|| me.moderatorPermissions.topCommunityArticleComment > Permissions.REPORTER ) {
canHighlightCommentDirectly = true
}
}
if (me.moderatorPermissions.contains(MeEntity.HIDE_ANSWER_COMMENT)
|| me.moderatorPermissions.contains(MeEntity.HIDE_COMMUNITY_ARTICLE_COMMENT)) {
if (me.moderatorPermissions.hideAnswerComment > Permissions.GUEST
|| me.moderatorPermissions.hideCommunityArticleComment > Permissions.GUEST) {
dialogOptions.add(hide)
if (me.moderatorPermissions.hideAnswerComment > Permissions.REPORTER
|| me.moderatorPermissions.hideCommunityArticleComment > Permissions.REPORTER ) {
canHideCommentDirectly = true
}
}
val content = if (me.moderatorLevel == MeEntity.MODERATOR_LEVEL_PRIMARY) {
"你的操作将提交给小编审核,确定提交吗?"
} else {
val highlightDialogHintContent = if (canHighlightCommentDirectly) {
"你的操作将立即生效,确定提交吗?(你的管理权限为:高级)"
} else {
"你的操作将提交给小编审核,确定提交吗?"
}
val hideDialogHintContent = if (canHideCommentDirectly) {
"你的操作将立即生效,确定提交吗?(你的管理权限为:高级)"
} else {
"你的操作将提交给小编审核,确定提交吗?"
}
val disabledOptions = arrayListOf<String>()
@ -191,10 +209,10 @@ object CommentHelper {
val highlightObserver = object : Response<ResponseBody>() {
override fun onResponse(response: ResponseBody?) {
if (me.moderatorLevel == MeEntity.MODERATOR_LEVEL_PRIMARY) {
Utils.toast(context, "提交成功")
} else {
if (canHighlightCommentDirectly) {
Utils.toast(context, "置顶成功,请刷新列表")
} else {
Utils.toast(context, "提交成功")
}
}
@ -217,7 +235,7 @@ object CommentHelper {
}
if (answerId != null) {
DialogUtils.showAlertDialog(context, highlight, content,
DialogUtils.showAlertDialog(context, highlight, highlightDialogHintContent,
"确定", "取消", {
RetrofitManager.getInstance(context).api
.highlightAnswerComment(answerId, comment.id)
@ -226,7 +244,7 @@ object CommentHelper {
.subscribe(highlightObserver)
}, null)
} else {
DialogUtils.showAlertDialog(context, highlight, content,
DialogUtils.showAlertDialog(context, highlight, highlightDialogHintContent,
"确定", "取消", {
RetrofitManager.getInstance(context).api
.highlightCommunityArticleComment(communityId, articleId, comment.id)
@ -240,10 +258,10 @@ object CommentHelper {
hide -> {
val hideObserver = object : Response<ResponseBody>() {
override fun onResponse(response: ResponseBody?) {
if (me.moderatorLevel == MeEntity.MODERATOR_LEVEL_PRIMARY) {
Utils.toast(context, "提交成功")
} else {
if (canHideCommentDirectly) {
Utils.toast(context, "隐藏成功,请刷新列表")
} else {
Utils.toast(context, "提交成功")
}
}
@ -266,7 +284,7 @@ object CommentHelper {
}
if (answerId != null) {
DialogUtils.showAlertDialog(context, hide, content,
DialogUtils.showAlertDialog(context, hide, hideDialogHintContent,
"确定", "取消", {
RetrofitManager.getInstance(context).api
.hideAnswerComment(answerId, comment.id)
@ -275,7 +293,7 @@ object CommentHelper {
.subscribe(hideObserver)
}, null)
} else {
DialogUtils.showAlertDialog(context, hide, content,
DialogUtils.showAlertDialog(context, hide, hideDialogHintContent,
"确定", "取消", {
RetrofitManager.getInstance(context).api
.hideCommunityArticleComment(communityId, articleId, comment.id)

View File

@ -4,8 +4,7 @@ import android.app.Dialog;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
@ -20,11 +19,8 @@ import com.gh.gamecenter.adapter.OnCommentCallBackListener;
import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.RatingComment;
import com.gh.gamecenter.entity.UserInfoEntity;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.utils.Utils;
import org.json.JSONException;
@ -37,11 +33,6 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.HttpException;
/**
@ -80,111 +71,6 @@ public class CommentUtils {
}
}
public static void showGameCommentOptions(final Context context,
final RatingComment comment,
final String gameId,
final String entrance) {
final Dialog dialog = new Dialog(context);
LinearLayout container = new LinearLayout(context);
container.setOrientation(LinearLayout.VERTICAL);
container.setBackgroundColor(Color.WHITE);
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
List<String> dialogType = new ArrayList<>();
dialogType.add("复制");
dialogType.add("举报");
for (String s : dialogType) {
final TextView reportTv = new TextView(context);
reportTv.setText(s);
reportTv.setTextSize(17);
reportTv.setTextColor(ContextCompat.getColor(context, R.color.title));
reportTv.setBackgroundResource(R.drawable.textview_white_style);
int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
reportTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
LinearLayout.LayoutParams.WRAP_CONTENT));
reportTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
0, DisplayUtils.dip2px(context, 12));
container.addView(reportTv);
reportTv.setOnClickListener(v -> {
dialog.cancel();
switch (reportTv.getText().toString()) {
case "复制":
copyText(comment.getContent(), context);
break;
case "举报":
CheckLoginUtils.checkLogin(context, entrance, () -> showGameCommentReportDialog(gameId, comment, context));
break;
}
});
}
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(container);
dialog.show();
}
private static void showGameCommentReportDialog(final String gameId, final RatingComment comment, final Context context) {
final String[] arrReportType = new String[]{"垃圾广告营销", "恶意攻击谩骂", "淫秽色情信息",
"违法有害信息", "其它"};
int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
final Dialog reportTypeDialog = new Dialog(context);
LinearLayout container = new LinearLayout(context);
container.setOrientation(LinearLayout.VERTICAL);
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
container.setBackgroundColor(Color.WHITE);
for (final String s : arrReportType) {
TextView reportTypeTv = new TextView(context);
reportTypeTv.setText(s);
reportTypeTv.setTextSize(17);
reportTypeTv.setTextColor(ContextCompat.getColor(context, R.color.title));
reportTypeTv.setBackgroundResource(R.drawable.textview_white_style);
reportTypeTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
LinearLayout.LayoutParams.WRAP_CONTENT));
reportTypeTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
0, DisplayUtils.dip2px(context, 12));
container.addView(reportTypeTv);
reportTypeTv.setOnClickListener(v -> {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("reason", s);
} catch (JSONException e) {
e.printStackTrace();
}
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
RetrofitManager.getInstance(context).getApi()
.reportGameComment(gameId, comment.getId(), body)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<ResponseBody>() {
@Override
public void onResponse(@Nullable ResponseBody response) {
Utils.toast(context, "感谢您的举报");
}
@Override
public void onFailure(@Nullable HttpException e) {
Utils.toast(context, "举报失败,请先检查网络设置");
}
});
reportTypeDialog.cancel();
});
}
reportTypeDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
reportTypeDialog.setContentView(container);
reportTypeDialog.show();
}
public static void showReportDialog(final CommentEntity commentEntity,
final Context context,
@ -206,7 +92,7 @@ public class CommentUtils {
}
dialogType.add("复制");
dialogType.add("举报");
dialogType.add("投诉");
if (commentEntity.getParent() != null && showConversation) {
dialogType.add("查看对话");
@ -244,8 +130,8 @@ public class CommentUtils {
case "复制":
copyText(commentEntity.getContent(), context);
break;
case "举报":
CheckLoginUtils.checkLogin(context, patch + "-举报",
case "投诉":
CheckLoginUtils.checkLogin(context, patch + "-投诉",
() -> showReportTypeDialog(commentEntity, context));
break;
@ -263,135 +149,6 @@ public class CommentUtils {
}
// public static void showAnswerCommentOptions(final CommentEntity commentEntity, final Context context,
// final OnCommentCallBackListener listener, final String id,
// boolean showConversation, String answerId, String articleId, String articleCommunityId) {
//
// final Dialog dialog = new Dialog(context);
//
// LinearLayout container = new LinearLayout(context);
// container.setOrientation(LinearLayout.VERTICAL);
// container.setBackgroundColor(Color.WHITE);
// container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
//
// List<String> dialogType = new ArrayList<>();
//
// if (commentEntity.getMe() == null || !commentEntity.getMe().isAnswerCommented()) {
// dialogType.add("回复");
// }
//
// dialogType.add("复制");
// dialogType.add("举报");
//
// if (commentEntity.getParentUser() != null && showConversation) {
// dialogType.add("查看对话");
// }
//
// for (String s : dialogType) {
// final TextView reportTv = new TextView(context);
// reportTv.setText(s);
// reportTv.setTextSize(17);
// reportTv.setTextColor(ContextCompat.getColor(context, R.color.title));
// reportTv.setBackgroundResource(R.drawable.textview_white_style);
// int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
// reportTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
// LinearLayout.LayoutParams.WRAP_CONTENT));
// reportTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
// 0, DisplayUtils.dip2px(context, 12));
// container.addView(reportTv);
//
// reportTv.setOnClickListener(v -> {
// dialog.cancel();
// switch (reportTv.getText().toString()) {
// case "回复":
// CheckLoginUtils.checkLogin(context, () -> {
// if (listener != null) {
// listener.onCommentCallback(commentEntity);
// } else if (!TextUtils.isEmpty(id)) {
// context.startActivity(MessageDetailActivity.getMessageDetailIntent(context, commentEntity, id));
// } else {
// Utils.toast(context, "缺少关键属性");
// }
// });
// break;
// case "复制":
// copyText(commentEntity.getContent(), context);
// break;
// case "举报":
// CheckLoginUtils.checkLogin(context, () -> showAnswerReportDialog(answerId, commentEntity, context));
// break;
// case "查看对话":
// if (TextUtils.isEmpty(articleId)) {
// context.startActivity(CommentDetailActivity.getAnswerCommentIntent(context, commentEntity.getId(), answerId, null));
// } else {
// context.startActivity(CommentDetailActivity.getCommunityArticleCommentIntent(context, articleId, commentEntity.getId(), articleCommunityId, null));
// }
// break;
// }
// });
// }
//
// dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
// dialog.setContentView(container);
// dialog.show();
// }
// private static void showAnswerReportDialog(final String answerId, final CommentEntity commentEntity, final Context context) {
// final String[] arrReportType = new String[]{"垃圾广告营销", "恶意攻击谩骂", "淫秽色情信息",
// "违法有害信息", "其它"};
// int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
//
// final Dialog reportTypeDialog = new Dialog(context);
// LinearLayout container = new LinearLayout(context);
// container.setOrientation(LinearLayout.VERTICAL);
// container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
// container.setBackgroundColor(Color.WHITE);
//
// for (final String s : arrReportType) {
// TextView reportTypeTv = new TextView(context);
// reportTypeTv.setText(s);
// reportTypeTv.setTextSize(17);
// reportTypeTv.setTextColor(ContextCompat.getColor(context, R.color.title));
// reportTypeTv.setBackgroundResource(R.drawable.textview_white_style);
// reportTypeTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
// LinearLayout.LayoutParams.WRAP_CONTENT));
// reportTypeTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
// 0, DisplayUtils.dip2px(context, 12));
// container.addView(reportTypeTv);
//
// reportTypeTv.setOnClickListener(v -> {
// JSONObject jsonObject = new JSONObject();
// try {
// jsonObject.put("reason", s);
// } catch (JSONException e) {
// e.printStackTrace();
// }
//
// PostCommentUtils.postAnswerReportData(context, commentEntity.getId(), answerId, jsonObject.toString(),
// new PostCommentUtils.PostCommentListener() {
// @Override
// public void postSuccess(JSONObject response) {
// Utils.toast(context, "感谢您的举报");
// }
//
// @Override
// public void postFailed(Throwable error) {
// if (error != null) {
// Utils.toast(context, "举报失败" + error.getMessage());
// } else {
// Utils.toast(context, "举报失败,请稍候重试");
// }
// }
// });
// reportTypeDialog.cancel();
// });
// }
//
// reportTypeDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
// reportTypeDialog.setContentView(container);
// reportTypeDialog.show();
// }
private static void showReportTypeDialog(final CommentEntity commentEntity, final Context context) {
final String[] arrReportType = new String[]{"垃圾广告营销", "恶意攻击谩骂", "淫秽色情信息",
"违法有害信息", "其它"};
@ -430,12 +187,12 @@ public class CommentUtils {
new PostCommentUtils.PostCommentListener() {
@Override
public void postSuccess(JSONObject response) {
Utils.toast(context, "感谢您的举报");
Utils.toast(context, "感谢您的投诉");
}
@Override
public void postFailed(Throwable error) {
Utils.toast(context, "举报失败,请检查网络设置");
Utils.toast(context, "投诉失败,请检查网络设置");
}
});
reportTypeDialog.cancel();

View File

@ -0,0 +1,47 @@
package com.gh.common.util
import com.gh.gamecenter.packagehelper.PackageRepository
import com.gh.gamecenter.qa.entity.CommunitySelectEntity
object CommunityHelper {
/**
* 为已开通的社区排序
* 排序规则为将本地存在已安装游戏或已关联游戏的社区置顶
*/
fun sortOpenedCommunity(rawList: List<CommunitySelectEntity>?): ArrayList<CommunitySelectEntity> {
val sortedList = ArrayList<CommunitySelectEntity>()
rawList?.let {
for (game in rawList) {
var thisGameIsInstalled = false
for (installGame in PackageRepository.gameInstalled) {
if (PackageHelper.downloadPackageNameBlackList.contains(installGame.packageName)) {
continue
}
// 判断是否已安装
if (installGame.id == game.game.id) {
thisGameIsInstalled = true
break
}
// 判断是否关联了别游戏
for (relatedGameId in game.game.relation) {
if (installGame.id == relatedGameId) {
thisGameIsInstalled = true
break
}
}
}
// 将已安装的置顶
if (thisGameIsInstalled) {
sortedList.add(0, game)
} else {
sortedList.add(game)
}
}
}
return sortedList
}
}

View File

@ -29,12 +29,12 @@ object CompressImageUtils {
*/
@Throws(Exception::class)
fun compressImageAndSaveToFile(imageFile: File, compressGif: Boolean): File {
// 小于300K直接返回原图
// 小于某一个设定的值时,直接返回原图
if (imageFile.length() < getImageSetting().processLimitSize) {
return imageFile
}
val cacheDir = getImageCacheDir()
val cacheDir = getImageCachePatch()
val parentFile = cacheDir.parentFile
if (!parentFile.exists()) parentFile.mkdirs()
var fileOutputStream: FileOutputStream? = null
@ -55,6 +55,10 @@ object CompressImageUtils {
fileOutputStream = FileOutputStream(cacheDir)
// write the compressed bitmap at the destination specified by destinationPath.
decodeSampledBitmapFromFile(imageFile).compress(formatType, getImageSetting().quality, fileOutputStream)
if (cacheDir.length() == 0L) {
return imageFile //预防压缩失败
}
return cacheDir
} catch (e: Exception) {
e.printStackTrace()
@ -70,7 +74,7 @@ object CompressImageUtils {
return imageFile
}
private fun getImageCacheDir(): File {
private fun getImageCachePatch(): File {
// return File(Environment.getExternalStorageDirectory().absolutePath + "/Pictures/test/" + System.currentTimeMillis() + ".jpg")
// 统一用jpg保存应该没有影响吧
return File(HaloApp.getInstance().application.cacheDir.absolutePath + File.separator + System.currentTimeMillis() + ".jpg")
@ -103,7 +107,6 @@ object CompressImageUtils {
} else {
inSampleSize = if (longSide / compressLimit == 0) 1 else longSide / compressLimit
compressType = CompressType.LIMIT_LONG // 纵向长方形
}
} else if (longSide > compressLimit && shortSide < compressLimit) {
if (scale <= getImageSetting().ratio) {
@ -136,14 +139,18 @@ object CompressImageUtils {
}
}
matrix.setScale(targetMatrixScale, targetMatrixScale)
scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.width, scaledBitmap.height, matrix, true)
try {
scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.width, scaledBitmap.height, matrix, true)
} catch (ignore: OutOfMemoryError) {
}
}
return scaledBitmap
}
fun getImageSetting(): SettingsEntity.Image {
private fun getImageSetting(): SettingsEntity.Image {
val settings = Config.getSettings()
if (settings == null && settings?.image != null) {
if (settings?.image != null) {
return settings.image!!
}
val image = SettingsEntity.Image()

View File

@ -2,7 +2,6 @@ package com.gh.common.util;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import com.facebook.drawee.drawable.ScalingUtils;
@ -93,12 +92,9 @@ public class ConcernContentUtils {
ScalingUtils.ScaleType.CENTER_CROP, list.get(position));
break;
}
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent checkIntent = ViewImageActivity.getViewImageIntent(context, (ArrayList<String>) list, position, entrance);
context.startActivity(checkIntent);
}
imageView.setOnClickListener(v -> {
Intent checkIntent = ViewImageActivity.getViewImageIntent(context, (ArrayList<String>) list, position, entrance);
context.startActivity(checkIntent);
});
return imageView;
}

View File

@ -21,6 +21,9 @@ import retrofit2.HttpException
*/
object ConcernUtils {
/**
* autoConcern:是否自动关注'关联关注'
*/
fun postConcernGameId(context: Context, gameId: String, listener: onConcernListener?, autoConcern: Boolean = false) {
val mode = if (autoConcern) "auto" else "manual"
@ -92,7 +95,13 @@ object ConcernUtils {
override fun onFailure(e: HttpException?) {
super.onFailure(e)
listener?.onError()
AskErrorResponseUtils.errorResponseControl(context, e)
var errorString: String? = null
try {
errorString = e?.response()?.errorBody()?.string()
} catch (e1: Exception) {
e1.printStackTrace()
}
ErrorHelper.handleError(context, errorString, false)
}
})
}
@ -111,7 +120,13 @@ object ConcernUtils {
override fun onFailure(e: HttpException?) {
super.onFailure(e)
listener?.onError()
AskErrorResponseUtils.errorResponseControl(context, e)
var errorString: String? = null
try {
errorString = e?.response()?.errorBody()?.string()
} catch (e1: Exception) {
e1.printStackTrace()
}
ErrorHelper.handleError(context, errorString, false)
}
})
}

View File

@ -27,13 +27,29 @@ import okhttp3.ResponseBody;
public class DataLogUtils {
// 轮播图
public static void uploadLunbotuLog(Context context, String type, String title, String location) {
public static void uploadLunbotuLog(Context context, String type, String text, String index, String source) {
Map<String, Object> map = new HashMap<>();
map.put("location", location);
map.put("index", index);
map.put("type", type);
map.put("title", title);
map.put("form", "click");
uploadLog(context, "lunbotu", map);
map.put("text", text);
map.put("source", source);
uploadLog(context, "slide", map);
}
// 搜索热门标签
public static void uploadHotTagLog(Context context, String tag) {
Map<String, Object> map = new HashMap<>();
map.put("tag", tag);
uploadLog(context, "search-hot-tag", map);
}
// 点击下载按钮或进入游戏详情
public static void uploadGameLog(Context context, String gameId, String gameName, String entrance) {
Map<String, Object> map = new HashMap<>();
map.put("game_id", gameId);
map.put("game_name", gameName);
map.put("entrance", entrance);
uploadLog(context, "game", map);
}
// 上传日志

View File

@ -4,13 +4,19 @@ import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.gh.common.constant.Config;
import com.gh.common.constant.Constants;
import com.gh.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.BuildConfig;
import com.gh.gid.GidCallback;
import com.gh.gid.GidHelper;
import com.halo.assistant.HaloApp;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.Util_System_Phone_State;
import com.lightgame.utils.Utils;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.stat.MtaSDkException;
import com.tencent.stat.StatConfig;
@ -69,7 +75,7 @@ public class DataUtils {
// 设置数据上报策略
// 测试渠道的时候即时上传,方便查看日志
if ("GH_TEST".equals(HaloApp.getInstance().getChannel())) {
if (Config.DEFAULT_CHANNEL.equals(HaloApp.getInstance().getChannel())) {
StatConfig.setStatSendStrategy(StatReportStrategy.INSTANT);
} else {
StatConfig.setStatSendStrategy(StatReportStrategy.PERIOD);
@ -93,7 +99,7 @@ public class DataUtils {
// init bugly
try {
CrashReport.setIsDevelopmentDevice(context, "GH_TEST".equals(channel));
CrashReport.setIsDevelopmentDevice(context, Config.DEFAULT_CHANNEL.equals(channel));
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
strategy.setEnableANRCrashMonitor(false);
@ -117,6 +123,25 @@ public class DataUtils {
MtaHelper.onEvent(eventId, kv);
}
public static void getGid() {
GidHelper.getInstance().registerDevice(new GidCallback() {
@Override
public void onSuccess(String s) {
Utils.log("Gid", s);
PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication()).edit().putString(Constants.DEVICE_KEY, s).apply();
HaloApp.getInstance().setGid(s);
// 避免初始化顺序问题导致 MetaUtil 一直持有空的 gid
MetaUtil.INSTANCE.refreshMeta();
}
@Override
public void onFailure(String s) {
Utils.log(s);
}
});
}
public static void onEvent(Context var0, String var1, String var2) {
TCAgent.onEvent(var0, var1, var2);
Properties prop = new Properties();

View File

@ -4,6 +4,7 @@ import android.text.TextUtils;
import android.view.View;
import com.gh.common.constant.Config;
import com.gh.common.repository.ReservationRepository;
import com.gh.common.view.DownloadProgressBar;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.R;
@ -30,6 +31,17 @@ public class DetailDownloadUtils {
return;
}
if (viewHolder.gameEntity.isReservable()) {
if (!ReservationRepository.thisGameHasBeenReserved(viewHolder.gameEntity.getId())) {
viewHolder.mDownloadPb.setText("预约《" + viewHolder.gameEntity.getName() + "");
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.RESERVABLE);
} else {
viewHolder.mDownloadPb.setText("已预约《" + viewHolder.gameEntity.getName() + "");
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.RESERVED);
}
return;
}
if (viewHolder.gameEntity.getApk().isEmpty()) {
viewHolder.mDownloadPb.setText(TextUtils.isEmpty(viewHolder.downloadOffText) ? "暂无下载" : viewHolder.downloadOffText);
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.NONE);
@ -72,6 +84,7 @@ public class DetailDownloadUtils {
switch (downloadEntity.getStatus()) {
case downloading:
case pause:
case overflow:
viewHolder.mDownloadPb.setText(R.string.downloading);
if (downloadEntity.isPluggable() && PackagesManager.INSTANCE.isInstalled(downloadEntity.getPackageName())) {
viewHolder.mDownloadPb.setDownloadType(DownloadProgressBar.DownloadType.DOWNLOADING_PLUGIN);

View File

@ -1,91 +0,0 @@
/*
* Copyright (C) 2015 Baidu, Inc. All Rights Reserved.
*/
package com.gh.common.util;
import android.content.Context;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Created by sunpengfei on 15/11/4.
*/
public class DexUtils {
private static final int BUF_SIZE = 2048;
public static boolean prepareAssetsDex(Context context, File dexInternalStoragePath, String dex_file) {
BufferedInputStream bis = null;
OutputStream dexWriter = null;
try {
bis = new BufferedInputStream(context.getAssets().open(dex_file));
dexWriter = new BufferedOutputStream(new FileOutputStream(dexInternalStoragePath));
byte[] buf = new byte[BUF_SIZE];
int len;
while ((len = bis.read(buf, 0, BUF_SIZE)) > 0) {
dexWriter.write(buf, 0, len);
}
dexWriter.close();
bis.close();
return true;
} catch (IOException e) {
if (dexWriter != null) {
try {
dexWriter.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
if (bis != null) {
try {
bis.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
return false;
}
}
public static boolean prepareDex(File dexInternalStoragePath, File dex_file) {
BufferedInputStream bis = null;
OutputStream dexWriter = null;
try {
bis = new BufferedInputStream(new FileInputStream(dex_file));
dexWriter = new BufferedOutputStream(new FileOutputStream(dexInternalStoragePath));
byte[] buf = new byte[BUF_SIZE];
int len;
while ((len = bis.read(buf, 0, BUF_SIZE)) > 0) {
dexWriter.write(buf, 0, len);
}
dexWriter.close();
bis.close();
return true;
} catch (IOException e) {
if (dexWriter != null) {
try {
dexWriter.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
if (bis != null) {
try {
bis.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
return false;
}
}
}

View File

@ -4,17 +4,19 @@ import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
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;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
@ -26,11 +28,17 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import com.gh.gamecenter.AboutActivity;
import com.gh.gamecenter.KcSelectGameActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.kuaichuan.WifiMgr;
import com.gh.gamecenter.kuaichuan.view.KcSelectGameActivity;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.AppManager;
import com.lightgame.utils.Utils;
import java.io.File;
@ -43,12 +51,12 @@ import java.util.Map;
public class DialogUtils {
private static boolean isShow = false;
public static Dialog showWaitDialog(Context context, String msg) {
context = checkDialogContext(context);
Dialog dialog = new Dialog(context);
View view = View.inflate(context, R.layout.set_wait_dialog, null);
TextView message = (TextView) view.findViewById(R.id.set_wait_message);
TextView message = view.findViewById(R.id.set_wait_message);
message.setText(msg);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
@ -67,27 +75,23 @@ public class DialogUtils {
WifiMgr.getInstance(activity).disconnectCurrentNetwork(); // 断开当前WiFi
// int heightPixels = getContext().getResources().getDisplayMetrics().heightPixels;
// int widthPixels = getContext().getResources().getDisplayMetrics().widthPixels;
int filesCount = mapList.size();
int filesSize = 0;
int sendTime = 0;
View view = View.inflate(activity, R.layout.dialog_kuaichuan, null);
final LinearLayout mShareLl = (LinearLayout) view.findViewById(R.id.kuaichuan_dialog_ll);
final LinearLayout mShareBottomLl = (LinearLayout) view.findViewById(R.id.kuaichuan_dialog_share_rl);
LinearLayout shareIconLl = (LinearLayout) view.findViewById(R.id.kuaichuan_icon_ll);
ImageView qrCode = (ImageView) view.findViewById(R.id.kuaichuan_qrcode);
TextView dateTv = (TextView) view.findViewById(R.id.kuaichuan_dialog_date);
TextView countTv = (TextView) view.findViewById(R.id.kuaichuan_send_count);
TextView sizeTv = (TextView) view.findViewById(R.id.kuaichuan_send_size);
TextView speedTv = (TextView) view.findViewById(R.id.kuaichuan_send_speed);
TextView timeCount = (TextView) view.findViewById(R.id.kuaichuan_time_count);
TextView timeTv = (TextView) view.findViewById(R.id.kuaichuan_time_tv);
TextView sendCountTv = (TextView) view.findViewById(R.id.dialog_send_tv);
ImageView closeIv = (ImageView) view.findViewById(R.id.kuaichuan_dialog_colse);
// content.setLayoutParams(new LinearLayout.LayoutParams((int)(((float)heightPixels)*0.85), (int)((float)widthPixels*0.81)));
final LinearLayout mShareLl = view.findViewById(R.id.kuaichuan_dialog_ll);
final LinearLayout mShareBottomLl = view.findViewById(R.id.kuaichuan_dialog_share_rl);
LinearLayout shareIconLl = view.findViewById(R.id.kuaichuan_icon_ll);
ImageView qrCode = view.findViewById(R.id.kuaichuan_qrcode);
TextView dateTv = view.findViewById(R.id.kuaichuan_dialog_date);
TextView countTv = view.findViewById(R.id.kuaichuan_send_count);
TextView sizeTv = view.findViewById(R.id.kuaichuan_send_size);
TextView speedTv = view.findViewById(R.id.kuaichuan_send_speed);
TextView timeCount = view.findViewById(R.id.kuaichuan_time_count);
TextView timeTv = view.findViewById(R.id.kuaichuan_time_tv);
TextView sendCountTv = view.findViewById(R.id.dialog_send_tv);
ImageView closeIv = view.findViewById(R.id.kuaichuan_dialog_colse);
final Dialog dialog = new Dialog(activity);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
@ -130,7 +134,7 @@ public class DialogUtils {
ApplicationInfo appInfo = info.applicationInfo;
appInfo.sourceDir = apkPath;
appInfo.publicSourceDir = apkPath;
Bitmap bitmap = BitmapUtils.drawableToBitmap(appInfo.loadIcon(pm));
Bitmap bitmap = BitmapUtils.drawableToBitmap(appInfo.loadIcon(pm), true);
ImageView imageView = new ImageView(activity);
imageView.setLayoutParams(new LinearLayout.LayoutParams(DisplayUtils.dip2px(activity, 25)
@ -189,24 +193,16 @@ public class DialogUtils {
countTv.setText(filesCount + "");
// 延迟操作,等待截图部分绘制完成
handler.postDelayed(new Runnable() {
@Override
public void run() {
mShareLl.setDrawingCacheEnabled(true);
mShareLl.buildDrawingCache();
Bitmap drawingCache = mShareLl.getDrawingCache();
saveBitmap(drawingCache, activity, picName);
MessageShareUtils.getInstance(activity).showShareWindows(activity, mShareBottomLl, drawingCache, picName, 2);
mShareBottomLl.setVisibility(View.VISIBLE);
}
handler.postDelayed(() -> {
mShareLl.setDrawingCacheEnabled(true);
mShareLl.buildDrawingCache();
Bitmap drawingCache = mShareLl.getDrawingCache();
saveBitmap(drawingCache, activity, picName);
MessageShareUtils.getInstance(activity).showShareWindows(activity, mShareBottomLl, drawingCache, picName, 2);
mShareBottomLl.setVisibility(View.VISIBLE);
}, 200);
closeIv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.cancel();
}
});
closeIv.setOnClickListener(v -> dialog.cancel());
}
public static void saveBitmap(Bitmap bm, Activity activity, String picName) {
@ -226,108 +222,81 @@ public class DialogUtils {
}
public static void showInstallHintDialog(Context context, final ConfirmListener cmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context);
View view = View.inflate(context, R.layout.dialog_install_hint, null);
// 标题
TextView alertdialog_title = (TextView) view.findViewById(R.id.installhint_title);
TextView alertdialog_title = view.findViewById(R.id.installhint_title);
alertdialog_title.setText("重要提示");
Spanned content = Html.fromHtml("如果您使用的是" + "<font color=\"#ff0000\">华为</font>" + "" +
"<font color=\"#ff0000\">OPPO</font>" + "手机,安装游戏时请选择“" +
"<font color=\"#ff0000\">继续安装</font>" +
"”(记住不要选择“官方推荐”或“软件商店安装”)");
// 内容
TextView alertdialog_content = (TextView) view.findViewById(R.id.installhint_content);
TextView alertdialog_content = view.findViewById(R.id.installhint_content);
alertdialog_content.setText(content);
// 确定按钮
TextView installhint_confirm = (TextView) view.findViewById(R.id.installhint_confirm);
TextView installhint_confirm = view.findViewById(R.id.installhint_confirm);
installhint_confirm.setText("知道了");
final ImageView installhint_unselect = (ImageView) view.findViewById(R.id.installhint_unselect);
final ImageView installhint_select = (ImageView) view.findViewById(R.id.installhint_select);
final ImageView installhint_unselect = view.findViewById(R.id.installhint_unselect);
final ImageView installhint_select = view.findViewById(R.id.installhint_select);
LinearLayout installhint_unselect_ll = (LinearLayout) view.findViewById(R.id.installhint_unselect_ll);
LinearLayout installhint_unselect_ll = view.findViewById(R.id.installhint_unselect_ll);
installhint_unselect_ll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (installhint_unselect.getVisibility() == View.GONE) {
installhint_unselect.setVisibility(View.VISIBLE);
installhint_select.setVisibility(View.GONE);
} else {
installhint_unselect.setVisibility(View.GONE);
installhint_select.setVisibility(View.VISIBLE);
}
installhint_unselect_ll.setOnClickListener(v -> {
if (installhint_unselect.getVisibility() == View.GONE) {
installhint_unselect.setVisibility(View.VISIBLE);
installhint_select.setVisibility(View.GONE);
} else {
installhint_unselect.setVisibility(View.GONE);
installhint_select.setVisibility(View.VISIBLE);
}
});
installhint_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
if (installhint_select.getVisibility() == View.VISIBLE) {
if (cmListener != null) {
cmListener.onConfirm();
}
installhint_confirm.setOnClickListener(v -> {
dialog.dismiss();
if (installhint_select.getVisibility() == View.VISIBLE) {
if (cmListener != null) {
cmListener.onConfirm();
}
}
});
dialog.setOnDismissListener(new Dialog.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
isShow = false;
}
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.show();
}
public static void showHintDialog(Context context, String title, CharSequence msg, String confirm) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context);
View view = View.inflate(context, R.layout.common_hintdialog, null);
TextView hintdialog_title = (TextView) view.findViewById(R.id.tv_dialog_hint_title);
TextView hintdialog_title = view.findViewById(R.id.tv_dialog_hint_title);
hintdialog_title.setText(title);
// 内容
TextView hintdialog_content = (TextView) view.findViewById(R.id.tv_dialog_hint_content);
TextView hintdialog_content = view.findViewById(R.id.tv_dialog_hint_content);
hintdialog_content.setText(msg);
TextView hintdialog_confirm = (TextView) view.findViewById(R.id.tv_dialog_hint_confirm);
TextView hintdialog_confirm = view.findViewById(R.id.tv_dialog_hint_confirm);
hintdialog_confirm.setText(confirm);
hintdialog_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.cancel();
}
});
hintdialog_confirm.setOnClickListener(v -> dialog.cancel());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.show();
}
public static void showHijackDialog(final Context context) {
showWarningDialog(context, "警告", "您当前网络环境异常,下载地址已被替换(网络劫持),请更换网络环境进行下载。",
new ConfirmListener() {
@Override
public void onConfirm() {
// 跳转wifi管理界面
context.startActivity(IntentUtils.getWifiIntent());
}
});
}
public static void showWarningDialog(Context context, String title, CharSequence msg, final ConfirmListener listener) {
if (!(context instanceof Activity)) {
return;
@ -345,12 +314,7 @@ public class DialogUtils {
public static void showQqSessionDialog(final Context context, final String qq) {
showWarningDialog(context, "警告", "您当前网络环境异常,下载地址可能被运营商恶意替换(网络劫持)" +
"如多次下载失败请联系客服获取正确的下载地址客服QQ" + qq + ""
, "取消", "前往QQ", new ConfirmListener() {
@Override
public void onConfirm() {
DirectUtils.directToQqConversation(context, qq);
}
}, null);
, "取消", "前往QQ", () -> DirectUtils.directToQqConversation(context, qq), null);
}
public static void checkDownload(Context context, String size, CheckDownloadCallBack callBack) {
@ -360,9 +324,16 @@ public class DialogUtils {
} else if (NetworkUtils.isWifiConnected(context) || filter4GorSize(context, size)) {
callBack.onResponse(false);
} else {
MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(context), "出现弹窗提示");
showDownloadDialog(context,
() -> callBack.onResponse(false),
() -> callBack.onResponse(true));
() -> {
callBack.onResponse(false);
MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(context), "立即下载");
},
() -> {
callBack.onResponse(true);
MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(context), "连上WiFi后自动下载");
});
}
}
@ -384,7 +355,9 @@ public class DialogUtils {
}
public static void checkResumeDownload(Context context, CheckDownloadCallBack callBack) {
if (NetworkUtils.isWifiConnected(context)) {
if (!NetworkUtils.isNetworkConnected(context)) {
showNoConnectionDownloadDialog(context, null, () -> callBack.onResponse(true));
} else if (NetworkUtils.isWifiConnected(context)) {
callBack.onResponse(false);
} else {
showResumeDownloadDialog(context, () -> {
@ -437,6 +410,7 @@ public class DialogUtils {
*/
public static Dialog showAlertDialog(Context context, String title, CharSequence message
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
@ -445,30 +419,100 @@ public class DialogUtils {
TextView titleTv = contentView.findViewById(R.id.dialog_title);
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
TextView positiveTv = contentView.findViewById(R.id.dialog_positive);
if (message.toString().contains("红包奖励")) {//将红包奖励四个字标红
String str = message.toString().substring(0, message.toString().indexOf("红包奖励")) + "<font color='#FF0000'>红包奖励</font>";
contentTv.setText(Html.fromHtml(str));
} else {
contentTv.setText(message);
}
titleTv.setText(title);
negativeTv.setText(negative);
positiveTv.setText(positive);
negativeTv.setOnClickListener(view -> {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
});
positiveTv.setOnClickListener(view -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.show();
return dialog;
}
public static Dialog showAlertDialog(Context context, String title, Spanned message
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
TextView positiveTv = contentView.findViewById(R.id.dialog_positive);
contentTv.setText(message);
titleTv.setText(title);
negativeTv.setText(negative);
positiveTv.setText(positive);
negativeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
negativeTv.setOnClickListener(view -> {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
});
positiveTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
positiveTv.setOnClickListener(view -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.show();
return dialog;
}
public static Dialog showDialogWithHtmlContent(Context context, String title, String content
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
TextView positiveTv = contentView.findViewById(R.id.dialog_positive);
contentTv.setText(Html.fromHtml(content));
titleTv.setText(title);
negativeTv.setText(negative);
positiveTv.setText(positive);
negativeTv.setOnClickListener(view -> {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
});
positiveTv.setOnClickListener(view -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
@ -490,6 +534,7 @@ public class DialogUtils {
public static void showCancelAlertDialog(Context context, String title, CharSequence message
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
@ -505,24 +550,18 @@ public class DialogUtils {
negativeTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
positiveTv.setText(positive);
negativeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
negativeTv.setOnClickListener(view -> {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
});
positiveTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
positiveTv.setOnClickListener(view -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
@ -537,7 +576,7 @@ public class DialogUtils {
*/
public static void showCancelListenerDialog(Context context, String title, CharSequence message
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
@ -563,24 +602,18 @@ public class DialogUtils {
}
});
positiveTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
positiveTv.setOnClickListener(view -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
if (clListener != null)
clListener.onCancel();
}
dialog.setOnCancelListener(dialogInterface -> {
if (clListener != null)
clListener.onCancel();
});
dialog.show();
@ -594,6 +627,7 @@ public class DialogUtils {
*/
public static void showPermissionDialog(Context context, String title, CharSequence message
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
@ -609,24 +643,18 @@ public class DialogUtils {
negativeTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
positiveTv.setText(positive);
negativeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
negativeTv.setOnClickListener(view -> {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
});
positiveTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
positiveTv.setOnClickListener(view -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
@ -641,6 +669,7 @@ public class DialogUtils {
*/
public static void showForceDialog(Context context, String title, CharSequence message
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
@ -655,24 +684,18 @@ public class DialogUtils {
negativeTv.setText(negative);
positiveTv.setText(positive);
negativeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
negativeTv.setOnClickListener(view -> {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
});
positiveTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
positiveTv.setOnClickListener(view -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
@ -695,12 +718,9 @@ public class DialogUtils {
AlertDialog alertDialog = new AlertDialog.Builder(context, R.style.GhAlertDialog)
.setTitle("请确定手机号:")
.setMessage(phoneNum)
.setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (cmListener != null) {
cmListener.onConfirm();
}
.setPositiveButton("确认", (dialog, which) -> {
if (cmListener != null) {
cmListener.onConfirm();
}
})
.setNegativeButton("取消", null)
@ -727,6 +747,8 @@ public class DialogUtils {
public static void showSignDialog(Context context, String title, CharSequence message, CharSequence message2
, String positive, final ConfirmListener cmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_sign, null);
@ -756,9 +778,11 @@ public class DialogUtils {
}
public static void showLowVersionDialog(Context context) {
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
final Context activityContext = checkDialogContext(context);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
final Dialog dialog = new Dialog(activityContext, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(activityContext).inflate(R.layout.dialog_alert, null);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
@ -772,7 +796,7 @@ public class DialogUtils {
negativeTv.setOnClickListener(view -> dialog.dismiss());
positiveTv.setOnClickListener(view -> {
context.startActivity(AboutActivity.getIntent(context, true));
activityContext.startActivity(AboutActivity.getIntent(activityContext, true));
dialog.dismiss();
});
@ -795,13 +819,15 @@ public class DialogUtils {
}
/**
* @param options 供以显示的选项
* @param options 供以显示的选项
* @param disabledOptions 显示为灰色的选项(是 options 的子集)
*/
public static void showListDialog(Context context,
List<String> options,
List<String> disabledOptions,
OptionCallback callback) {
context = checkDialogContext(context);
Dialog dialog = new Dialog(context);
LinearLayout container = new LinearLayout(context);
@ -837,6 +863,156 @@ public class DialogUtils {
dialog.show();
}
/**
* 特殊:目前只在提交问题错误返回时弹出
*/
public static Dialog showCommunityDialog(Context context,
String title,
String contentTitle,
String contentDes,
String negative,
String positive,
final CancelListener clListener,
final ConfirmListener cmListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_community, null);
View contentContainer = contentView.findViewById(R.id.content_container);
TextView titleTv = contentView.findViewById(R.id.title);
TextView contentTitleTv = contentView.findViewById(R.id.content_title);
TextView contentDesTv = contentView.findViewById(R.id.content_des);
TextView negativeTv = contentView.findViewById(R.id.negative);
TextView positiveTv = contentView.findViewById(R.id.positive);
titleTv.setText(title);
contentTitleTv.setText(contentTitle);
contentDesTv.setText(contentDes);
if (TextUtils.isEmpty(negative)) {
negativeTv.setVisibility(View.GONE);
} else {
negativeTv.setVisibility(View.VISIBLE);
negativeTv.setText(negative);
}
if (TextUtils.isEmpty(positive)) {
positiveTv.setVisibility(View.GONE);
} else {
positiveTv.setText(positive);
positiveTv.setVisibility(View.VISIBLE);
}
negativeTv.setOnClickListener(view -> {
if (clListener != null) {
clListener.onCancel();
}
dialog.dismiss();
});
positiveTv.setOnClickListener(view -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
contentContainer.setOnClickListener(v -> {
if (cmListener != null) {
cmListener.onConfirm();
}
dialog.dismiss();
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.show();
return dialog;
}
public static void showPrivacyPolicyDialog(Context context, String title, String content, EmptyCallback callback) {
final Context activityContext = checkDialogContext(context);
String privacyPolicyContent;
String privacyPolicyTitle = (TextUtils.isEmpty(title)) ? "个人信息保护指引" : title;
if (TextUtils.isEmpty(content)) {
privacyPolicyContent = "你的个人信息安全对我们来说至关重要。一直以来,光环助手都致力于为每位用户提供更安全的互联网环境" +
"。我们将依据《中华人民共和国网络安全法》、《信息安全技术个人信息安全规范》GB/T 35273-2017" +
"以及其他相关法律法规和技术规范来收集和使用你的个人信息,以帮助我们向你提供更优质的产品和服务。" +
"<br/>1.为帮助你浏览内容、互动交流、注册认证等,我们会收集部分必要的信息" +
"<br/>2.为提供上述服务,我们可能需要获取 IMEI号码、IMSI号码 等信息的读取权限" +
"<br/>3.以上获取个人信息的权限均不会默认开启,只有在运行相关功能或服务时才会明确提示授权,光环助手不会在未经你同意的情况下收集相关信息";
} else {
privacyPolicyContent = content;
}
final Dialog dialog = new Dialog(activityContext, R.style.GhAlertDialog);
View contentView = LayoutInflater.from(activityContext).inflate(R.layout.dialog_privacy_policy, null);
TextView contentTv = contentView.findViewById(R.id.dialog_content);
TextView titleTv = contentView.findViewById(R.id.dialog_title);
TextView positiveTv = contentView.findViewById(R.id.dialog_positive);
TextView skipTv = contentView.findViewById(R.id.dialog_skip);
SpannableStringBuilder skipText = new SpannableStringBuilder("查看完整版的 隐私政策");
skipText.setSpan(new ClickableSpan() {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(ContextCompat.getColor(activityContext, R.color.theme));
ds.setUnderlineText(false);
}
@Override
public void onClick(@NonNull View widget) {
MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "点击隐私政策");
Intent intent = WebActivity.getPrivacyPolicyIntent(activityContext);
activityContext.startActivity(intent);
}
}, skipText.length() - 4, skipText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
skipTv.setText(skipText);
skipTv.setMovementMethod(new LinkMovementMethod());
contentTv.setText(Html.fromHtml(privacyPolicyContent));
titleTv.setText(privacyPolicyTitle);
positiveTv.setText("我知道了");
positiveTv.setOnClickListener(view -> {
dialog.dismiss();
MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "点击我知道了");
});
dialog.setOnDismissListener(d -> {
callback.onCallback();
});
MtaHelper.onEvent("隐私政策弹窗", "隐私政策弹窗", "出现弹窗");
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.show();
}
/**
* @param context may be is application context
* @return activity context
*/
public static Context checkDialogContext(Context context) {
if (context == null) {
throw new NullPointerException("dialog context is null");
}
if (context instanceof Activity) {
return context;
}
return AppManager.getInstance().currentActivity();
}
public interface ConfirmListener {
void onConfirm();
}

View File

@ -5,25 +5,27 @@ import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.text.TextUtils
import com.gh.base.BaseActivity
import com.gh.base.fragment.BaseFragment_TabLayout
import com.gh.common.AppExecutor
import com.gh.common.util.EntranceUtils.*
import com.gh.gamecenter.*
import com.gh.gamecenter.category.CategoryDirectoryActivity
import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
import com.gh.gamecenter.entity.CommunityEntity
import com.gh.gamecenter.entity.LinkEntity
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.eventbus.EBReuse
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.qa.AskFragment
import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity
import com.gh.gamecenter.qa.article.SimpleArticleListActivity
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.SubjectActivity
import com.gh.gamecenter.suggest.SuggestType
import com.gh.gamecenter.tag.TagsActivity
import com.lightgame.utils.Util_System_ClipboardManager
import com.lightgame.utils.Utils
import org.greenrobot.eventbus.EventBus
@ -71,12 +73,12 @@ object DirectUtils {
when (linkEntity.type) {
"article", "news" -> {
NewsUtils.statNewsViews(context, linkEntity.link) // 统计阅读量
context.startActivity(NewsDetailActivity.getIntentById(context, linkEntity.link, entrance))
context.startActivity(NewsDetailActivity.getIntentById(context, linkEntity.link, BaseActivity.mergeEntranceAndPath(entrance, path)))
}
"game" -> GameDetailActivity.startGameDetailActivity(context, linkEntity.link, entrance)
"game" -> GameDetailActivity.startGameDetailActivity(context, linkEntity.link, BaseActivity.mergeEntranceAndPath(entrance, path))
"column" -> SubjectActivity.startSubjectActivity(context, linkEntity.link, linkEntity.text, false, entrance)
"column" -> SubjectActivity.startSubjectActivity(context, linkEntity.link, linkEntity.text, false, BaseActivity.mergeEntranceAndPath(entrance, path))
"question" -> context.startActivity(QuestionsDetailActivity.getIntent(context, linkEntity.link, entrance, path))
@ -86,20 +88,46 @@ object DirectUtils {
"community_article" -> context.startActivity(ArticleDetailActivity.getIntent(context, linkEntity.community!!, linkEntity.link!!, entrance, path))
"community_column" -> context.startActivity(CommunitySubjectActivity.getIntent(context, linkEntity.community!!, linkEntity.link, entrance, path))
"community_column" -> directToCommunityColumn(context, linkEntity.community, linkEntity.link!!, entrance, path)
"community_special_column" -> context.startActivity(AskColumnDetailActivity.getIntentByColumnId(context, linkEntity.link, linkEntity.community!!, entrance, path))
"web" -> directToWebView(context, url = linkEntity.link!!, entrance = entrance)
"web", "inurl" -> directToWebView(context, url = linkEntity.link!!, entrance = BaseActivity.mergeEntranceAndPath(entrance, path))
"qq" -> directToQqConversation(context, linkEntity.link)
"outurl" -> directToExternalBrowser(context, linkEntity.link!!)
"qqqun" -> directToQqGroup(context, linkEntity.link!!)
"tag" -> context.startActivity(TagsActivity.getIntent(context, linkEntity.text!!, entrance, path))
"all_community_article" -> {
context.startActivity(SimpleArticleListActivity.getIntent(
context,
linkEntity.link ?: "",
entrance,
path))
}
"category" -> {
context.startActivity(CategoryDirectoryActivity.getIntent(context, linkEntity.link!!, linkEntity.text!!))
}
"block" -> {
context.startActivity(BlockActivity.getIntent(context, SubjectRecommendEntity(
link = linkEntity.link,
text = linkEntity.text,
name = linkEntity.name,
display = linkEntity.display ?: Display())))
}
else -> DialogUtils.showLowVersionDialog(context)
}
}
/**
* 跳转到文章详情
* 跳转到新闻详情
*/
@JvmStatic
fun directToArticle(context: Context, id: String, entrance: String? = null) {
@ -127,9 +155,10 @@ object DirectUtils {
@JvmStatic
fun directToSubject(context: Context, id: String, subjectName: String? = "", entrance: String? = null) {
val bundle = Bundle()
val subjectData = SubjectData(subjectId = id, subjectName = subjectName, isOrder = false)
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, SubjectActivity::class.java.name)
bundle.putParcelable(EntranceUtils.KEY_SUBJECT_DATA, SubjectData(id, subjectName, false, null, null, null, null))
bundle.putParcelable(EntranceUtils.KEY_SUBJECT_DATA, subjectData)
EntranceUtils.jumpActivity(context, bundle)
}
@ -204,7 +233,7 @@ object DirectUtils {
fun directToWebView(context: Context, url: String, entrance: String? = null) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(EntranceUtils.KEY_TO, WebActivity::class.java.simpleName)
bundle.putString(KEY_TO, WebActivity::class.java.simpleName)
bundle.putString(EntranceUtils.KEY_URL, url)
EntranceUtils.jumpActivity(context, bundle)
}
@ -213,11 +242,17 @@ object DirectUtils {
@JvmStatic
fun directToOfficialNotification(context: Context, entrance: String? = null) {
val bundle = Bundle()
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(EntranceUtils.KEY_TO, MessageKeFuActivity::class.java.simpleName)
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, MessageKeFuActivity::class.java.simpleName)
EntranceUtils.jumpActivity(context, bundle)
}
@JvmStatic
fun directToExternalBrowser(context: Context, url: String) {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
context.startActivity(browserIntent)
}
// 跳转 QQ
@JvmStatic
fun directToQqConversation(context: Context, qqNumber: String? = null) {
@ -265,7 +300,7 @@ object DirectUtils {
fun directToGiftDetail(context: Context, giftId: String, entrance: String? = null) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(EntranceUtils.KEY_TO, LibaoDetailActivity::class.java.simpleName)
bundle.putString(KEY_TO, LibaoDetailActivity::class.java.simpleName)
bundle.putString(EntranceUtils.KEY_ID, giftId)
EntranceUtils.jumpActivity(context, bundle)
}
@ -290,12 +325,27 @@ object DirectUtils {
}
@JvmStatic
fun directToCommunityArticle(context: Context, articleId: String?, communityId: String?, entrance: String?) {
fun directToCommunityArticle(context: Context, articleId: String?, communityId: String?, entrance: String?, path: String?) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(EntranceUtils.KEY_TO, ArticleDetailActivity::class.java.name)
bundle.putString(EntranceUtils.KEY_COMMUNITY_ARTICLE_ID, articleId)
bundle.putParcelable(EntranceUtils.KEY_COMMUNITY_DATA, CommunityEntity(id = communityId!!))
EntranceUtils.jumpActivity(context, bundle)
bundle.putString(KEY_PATH, path)
bundle.putString(KEY_TO, ArticleDetailActivity::class.java.name)
bundle.putString(KEY_COMMUNITY_ARTICLE_ID, articleId)
bundle.putParcelable(KEY_COMMUNITY_DATA, CommunityEntity(id = communityId!!))
jumpActivity(context, bundle)
}
/**
* 跳转到社区专题
*/
@JvmStatic
fun directToCommunityColumn(context: Context, community: CommunityEntity?, subjectId: String, entrance: String?, path: String?) {
val bundle = Bundle()
bundle.putString(KEY_PATH, path)
bundle.putString(KEY_TO, CommunitySubjectActivity::class.java.name)
bundle.putString(KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
bundle.putString(KEY_COLUMN_ID, subjectId)
bundle.putParcelable(KEY_COMMUNITY_DATA, community)
jumpActivity(context, bundle)
}
}

View File

@ -0,0 +1,101 @@
package com.gh.common.util
import android.content.Context
import android.os.Build
import com.gh.gamecenter.entity.ApkEntity
import com.gh.gamecenter.entity.GameEntity
object DownloadDialogHelper {
/**
* [callback] 执行点击关闭以后会执行的代码块,没有弹窗也会执行这个代码块
*/
@JvmStatic
fun findAvailableDialogAndShow(context: Context, gameEntity: GameEntity, apkEntity: ApkEntity, callback: EmptyCallback) {
val dialog = retrieveAvailableDialog(gameEntity, apkEntity)
if (dialog != null) {
showDownloadDialog(context, dialog, callback)
} else {
callback.onCallback()
}
}
private fun retrieveAvailableDialog(gameEntity: GameEntity, apkEntity: ApkEntity): GameEntity.Dialog? {
if (gameEntity.downloadDialog.isNullOrEmpty()) return null
for (dialog in gameEntity.downloadDialog!!) {
// 共有 8 种可能
// 1. 不指定包名、机型和系统版本
if (dialog.rule.packageName.isEmpty()
&& dialog.rule.models.isEmpty()
&& dialog.rule.systemVersions.isEmpty()) {
return dialog
}
// 2. 指定包名不管机型和系统
if (dialog.rule.packageName == apkEntity.packageName
&& dialog.rule.models.isEmpty()
&& dialog.rule.systemVersions.isEmpty()) {
return dialog
}
// 3. 指定机型不管包名和系统
if (dialog.rule.models.contains(Build.MODEL)
&& dialog.rule.packageName.isEmpty()
&& dialog.rule.systemVersions.isEmpty()) {
return dialog
}
// 4. 指定系统不管包名和机型
if (dialog.rule.systemVersions.contains(Build.VERSION.RELEASE)
&& dialog.rule.packageName.isEmpty()
&& dialog.rule.models.isEmpty()) {
return dialog
}
// 5. 指定包名和机型不管系统
if (dialog.rule.packageName == apkEntity.packageName
&& dialog.rule.models.contains(Build.MODEL)
&& dialog.rule.systemVersions.isEmpty()) {
return dialog
}
// 6. 指定包名和系统不管机型
if (dialog.rule.packageName == apkEntity.packageName
&& dialog.rule.systemVersions.contains(Build.VERSION.RELEASE)
&& dialog.rule.models.isEmpty()) {
return dialog
}
// 7. 指定机型和系统不管包名
if (dialog.rule.systemVersions.contains(Build.VERSION.RELEASE)
&& dialog.rule.models.contains(Build.MODEL)
&& dialog.rule.packageName.isEmpty()) {
return dialog
}
// 8.指定包名、机型和系统版本
if (dialog.rule.packageName == apkEntity.packageName
&& dialog.rule.models.contains(Build.MODEL)
&& dialog.rule.systemVersions.contains(Build.VERSION.RELEASE)) {
return dialog
}
}
return null
}
private fun showDownloadDialog(context: Context, dialog: GameEntity.Dialog, callback: EmptyCallback) {
DialogUtils.showDialogWithHtmlContent(
context,
dialog.title,
dialog.content,
"继续下载",
"取消",
{ callback.onCallback() },
null)
}
}

View File

@ -3,17 +3,21 @@ package com.gh.common.util;
import android.content.Context;
import android.graphics.Color;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.collection.ArrayMap;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.common.constant.Config;
import com.gh.common.dialog.ReserveDialogFragment;
import com.gh.common.exposure.ExposureEvent;
import com.gh.common.exposure.ExposureUtils;
import com.gh.common.repository.ReservationRepository;
import com.gh.common.view.DownloadDialog;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.DownloadManagerActivity;
@ -83,7 +87,7 @@ public class DownloadItemUtils {
DownloadManager.getInstance(context).sendMessageDelayed(msg, 3000);
}
}
if (platform.equals(queue.peek())) {
if (platform != null && platform.equals(queue.peek())) {
if (entryMap == null) {
entryMap = new ArrayMap<>();
gameEntity.setEntryMap(entryMap);
@ -96,6 +100,35 @@ public class DownloadItemUtils {
}
}
// 下载按钮显示为查看,并且不提供下载功能
public static void updateItemWithViewOnlyStyle(GameViewHolder holder) {
holder.gameDownloadBtn.setVisibility(View.VISIBLE);
holder.gameDownloadBtn.setText("查看");
holder.gameDownloadBtn.setClickable(false);
}
// 根据预约状态更新下载按钮
public static void updateItemWithReserveStatus(GameViewHolder holder, GameEntity gameEntity) {
if ("download".equals(gameEntity.getReserveStatus())) {
// 已上线
holder.gameDownloadBtn.setVisibility(View.VISIBLE);
holder.gameDownloadBtn.setText("已上线");
holder.gameDownloadBtn.setTextColor(Color.WHITE);
holder.gameDownloadBtn.setBackground(ContextCompat.getDrawable(holder.gameDes.getContext(), R.drawable.game_item_btn_pause_dn));
} else if ("appointment".equals(gameEntity.getReserveStatus())) {
// 已预约
holder.gameDownloadBtn.setVisibility(View.VISIBLE);
holder.gameDownloadBtn.setText("已预约");
holder.gameDownloadBtn.setTextColor(Color.WHITE);
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_pause_dn);
}
if (gameEntity.isLibaoExists()) {
holder.gameLibaoIcon.setVisibility(View.VISIBLE);
} else {
holder.gameLibaoIcon.setVisibility(View.GONE);
}
}
public static void updateItem(Context context, GameEntity gameEntity, GameViewHolder holder,
boolean isShowPlatform) {
updateItem(context, gameEntity, holder, isShowPlatform, PluginLocation.only_game);
@ -117,6 +150,23 @@ public class DownloadItemUtils {
holder.gameLibaoIcon.setVisibility(View.GONE);
}
// 显示预约
if (gameEntity.isReservable()) {
holder.gameDes.setVisibility(View.VISIBLE);
holder.gameProgressbar.setVisibility(View.GONE);
holder.gameInfo.setVisibility(View.GONE);
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.getId())) {
holder.gameDownloadBtn.setText("预约");
holder.gameDownloadBtn.setTextColor(Color.WHITE);
holder.gameDownloadBtn.setBackgroundResource(R.drawable.button_reserve);
} else {
holder.gameDownloadBtn.setText("已预约");
holder.gameDownloadBtn.setTextColor(Color.WHITE);
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_pause_dn);
}
return;
}
if (gameEntity.getApk() == null || gameEntity.getApk().isEmpty()) {
holder.gameDes.setVisibility(View.VISIBLE);
holder.gameProgressbar.setVisibility(View.GONE);
@ -229,7 +279,8 @@ public class DownloadItemUtils {
} else if (status.equals(DownloadStatus.pause)
|| status.equals(DownloadStatus.timeout)
|| status.equals(DownloadStatus.neterror)
|| status.equals(DownloadStatus.subscribe)) {
|| status.equals(DownloadStatus.subscribe)
|| status.equals(DownloadStatus.overflow)) {
holder.gameProgressbar.setProgress((int) (downloadEntity.getPercent() * 10));
if (isShowPlatform && platform != null) {
holder.gameDownloadSpeed.setText(String.format("%s - 暂停", platform));
@ -239,10 +290,10 @@ public class DownloadItemUtils {
holder.gameDownloadPercentage.setText(downloadEntity.getPercent() + "%");
if (isNormal) {
if (status.equals(DownloadStatus.pause)) {
holder.gameDownloadBtn.setText(R.string.downloading);
} else {
if (status.equals(DownloadStatus.waiting)) {
holder.gameDownloadBtn.setText(R.string.waiting);
} else {
holder.gameDownloadBtn.setText(R.string.downloading);
}
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_downloading_style);
holder.gameDownloadBtn.setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style));
@ -289,10 +340,83 @@ public class DownloadItemUtils {
final String location,
final ExposureEvent traceEvent) {
setOnClickListener(context, downloadBtn, gameEntity, position, adapter, entrance, location, traceEvent, null);
}
/**
* @param clickCallback 供那些需要知道点击回调的地方使用
*/
public static void setOnClickListener(final Context context,
final TextView downloadBtn,
final GameEntity gameEntity,
final int position,
final RecyclerView.Adapter<? extends RecyclerView.ViewHolder> adapter,
final String entrance,
final String location,
final ExposureEvent traceEvent,
@Nullable final EmptyCallback clickCallback) {
if (gameEntity.isReservable()) {
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.getId())) {
downloadBtn.setOnClickListener(v -> {
CheckLoginUtils.checkLogin(context, entrance, () -> {
PermissionHelper.checkReadPhoneStatePermissionBeforeAction(context, () -> {
ReserveDialogFragment dialogFragment = ReserveDialogFragment.getInstance(
gameEntity,
() -> adapter.notifyItemChanged(position)
);
dialogFragment.show(((AppCompatActivity) context).getSupportFragmentManager(), "reserve");
});
if (clickCallback != null) {
clickCallback.onCallback();
}
});
});
} else {
downloadBtn.setOnClickListener(v -> {
if ("download".equals(gameEntity.getReserveStatus())) {
ReservationHelper.showDeleteReservationDialog(context, () -> {
ReservationHelper.deleteReservation(gameEntity, () -> {
adapter.notifyItemChanged(position);
});
});
} else {
ReservationHelper.showCancelReservationDialog(context, () -> {
ReservationHelper.cancelReservation(gameEntity, () -> {
adapter.notifyItemChanged(position);
});
});
}
});
}
return;
}
if (gameEntity.getApk().size() == 1) {
downloadBtn.setOnClickListener(v -> onNormalClick(context, downloadBtn, gameEntity, position, adapter, entrance, location, traceEvent));
downloadBtn.setOnClickListener(v -> {
EmptyCallback clickRunnable = () -> {
onNormalClick(context, downloadBtn, gameEntity, position, adapter, entrance, location, traceEvent);
if (clickCallback != null) {
clickCallback.onCallback();
}
};
// 启动不需要请求存储权限
if (downloadBtn.getText().toString().equals(context.getString(R.string.launch))) {
clickRunnable.onCallback();
} else {
PermissionHelper.checkStoragePermissionBeforeAction(context, clickRunnable);
}
});
} else {
downloadBtn.setOnClickListener(v -> DownloadDialog.getInstance(context).showPopupWindow(v, gameEntity, entrance, location, traceEvent));
downloadBtn.setOnClickListener(v -> {
PermissionHelper.checkStoragePermissionBeforeAction(context, () -> {
DownloadDialog.getInstance(context).showPopupWindow(v, gameEntity, entrance, location, traceEvent);
if (clickCallback != null) {
clickCallback.onCallback();
}
});
});
}
}
@ -316,33 +440,44 @@ public class DownloadItemUtils {
final String location,
@Nullable final ExposureEvent traceEvent) {
String str = downloadBtn.getText().toString();
ApkEntity apk = gameEntity.getApk().get(0);
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));
// 先弹下载弹窗(如果需要的话)
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, () -> {
DialogUtils.checkDownload(context, apk.getSize(),
isSubscribe -> download(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
});
DataLogUtils.uploadGameLog(context, gameEntity.getId(), gameEntity.getName(), entrance);
} else if (str.equals(context.getString(R.string.pluggable))) {
if (entrance.contains("我的游戏")) {
DataUtils.onMtaEvent(context, "我的游戏_启动", "插件化", gameEntity.getName());
MtaHelper.onEvent("我的游戏_启动", "插件化", gameEntity.getName());
}
DialogUtils.checkDownload(context, gameEntity.getApk().get(0).getSize(),
isSubscribe -> plugin(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, () -> {
DialogUtils.checkDownload(context, apk.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());
MtaHelper.onEvent("我的游戏_启动", "启动", 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] + ")"));
apk.getUrl(), entrance + "+(" + location.split(":")[0] + ")"));
} else if (str.equals(context.getString(R.string.update))) {
if (entrance.contains("我的游戏")) {
DataUtils.onMtaEvent(context, "我的游戏_启动", "更新", gameEntity.getName());
MtaHelper.onEvent("我的游戏_启动", "更新", gameEntity.getName());
}
DialogUtils.checkDownload(context, gameEntity.getApk().get(0).getSize(),
isSubscribe -> update(context, gameEntity, entrance, location, isSubscribe, traceEvent));
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, () -> {
DialogUtils.checkDownload(context, apk.getSize(),
isSubscribe -> update(context, gameEntity, entrance, location, isSubscribe, traceEvent));
});
}
}

View File

@ -0,0 +1,5 @@
package com.gh.common.util
interface EmptyCallback {
fun onCallback()
}

View File

@ -1,142 +1,143 @@
package com.gh.common.util;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.NormalActivity;
import com.gh.gamecenter.SplashScreenActivity;
import com.gh.gamecenter.normal.NormalFragment;
/**
* @author CsHeng
* @Date 2017/4/25
* @Time 16:39
*/
public class EntranceUtils {
public static final String KEY_TO = "to";
public static final String KEY_NEWSID = "newsId";
public static final String KEY_GAMEID = "gameId";
public static final String KEY_ID = "id";
public static final String KEY_URL = "url";
public static final String KEY_GAMENAME = "gameName";
public static final String HOST_ARTICLE = "article";
public static final String HOST_COMMUNITY_ARTICLE = "community.article";
public static final String HOST_GAME = "game";
public static final String HOST_GAME_DOWNLOAD = "game_download";
public static final String HOST_COLUMN = "column";
public static final String HOST_WEB = "web";
public static final String HOST_QQ = "qq";
public static final String HOST_DOWNLOAD = "download";
public static final String HOST_UPDATE = "update";
public static final String HOST_LIBAO = "libao";
public static final String HOST_COMMUNITY = "community";
public static final String HOST_SUGGESTION = "suggestion";
public static final String HOST_ANSWER = "answer";
public static final String HOST_QUESTION = "question";
public static final String KEY_DATA = "data";
public static final String KEY_MESSAGE = "message";
public static final String KEY_TYPE = "type";
public static final String KEY_LINK = "link";
public static final String KEY_NAME = "name";
public static final String KEY_ENTRANCE = "entrance";
public static final String KEY_TARGET = "target";
public static final String ENTRANCE_BROWSER = "(浏览器)";
public static final String ENTRANCE_WELCOME = "(启动弹窗)";
public static final String ENTRANCE_UMENG = "(友盟推送)";
public static final String ENTRANCE_MIPUSH = "(小米推送)";
public static final String ENTRANCE_DOWNLOAD = "(下载跳转)";
public static final String ENTRANCE_RECOMMEND = "(落地页)";
public static final String ENTRANCE_BLOCK_RECOMMEND = "(推荐入口)";
public static final String KEY_SUGGEST_HINT_TYPE = "suggestHintType";
public static final String KEY_PACKAGENAME = "packageName";
public static final String KEY_PLATFORM = "platform";
public static final String KEY_GAME_NAME = "game_name";
public static final String KEY_VERSION = "version";
public static final String KEY_CONTENT = "content";
public static final String KEY_PLUGIN = "plugin";
public static final String KEY_CURRENTITEM = "currentItem";
public static final String KEY_COMMENTID = "commentId";
public static final String KEY_PATH = "path";
public static final String KEY_OUTER_INFO = "outerInfo";
public static final String KEY_OLDERUSER = "isOldUser";
public static final String KEY_SEARCHKEY = "searchKey";
public static final String KEY_HINT = "hint";
public static final String KEY_GAME_ICON_URL = "gameIconUrl";
public static final String KEY_SHARECONTENT = "shareContent";
public static final String KEY_SUGGESTTYPE = "suggestType";
public static final String KEY_PROLIST = "provinceList";
public static final String KEY_ORDER = "order";
public static final String KEY_TAGTYPE = "tagType";
public static final String KEY_ANSWER_ID = "answerId";
public static final String KEY_ANSWER_CONTENT = "answerContent";
public static final String KEY_QUESTIONS_ID = "questionsId";
public static final String KEY_QUESTIONS_TITLE = "questionsTitle";
public static final String KEY_ANSWER_OPEN_IN_NEW_PAGE = "openInNewPage";
public static final String KEY_QUESTIONS_PATCH = "questionsPatch";
public static final String KEY_INVITE_SEARCH_KEY = "inviteSearchKey";
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_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";
public static final String KEY_KAIFU_LIST = "kaifuList";
public static final String KEY_CATEGORY_ID = "category_id";
public static final String KEY_CATEGORY_TITLE = "category_title";
public static final String KEY_CATEGORY_INIT_TITLE = "category_init_title";
public static final String KEY_BLOCK_DATA = "blockData";
public static final String KEY_ASK_TAG = "askTag";
public static final String KEY_ASK_COLUMN_TAG = "askColumnTag";
public static final String KEY_COMMUNITY_ID = "community_id";
public static final String KEY_COMMUNITY_NAME = "community_name";
public static final String KEY_COMMUNITY_DATA = "communityData";
public static final String KEY_TRACE_EVENT = "trace_event";
public static final String KEY_SUBJECT_DATA = "subjectData";
public static final String KEY_SHOW_SELECT_COMMUNITY = "show_select_community";
public static final String KEY_USER_ID = "user_id";
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_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) {
//TODO 把其他类似的跳转启动逻辑也处理掉
if (RunningUtils.isRunning(context)
&& MainActivity.class.getName().equals(RunningUtils.getBaseActivity(context))) {
// 应用正在运行,前台或后台
String to = bundle.getString(KEY_TO);
if (!TextUtils.isEmpty(to)) {
Class<?> clazz = ClassUtils.forName(to);
if (clazz != null) {
if (NormalFragment.class.isAssignableFrom(clazz)) { // 兼容NormalFragment
NormalActivity.startFragmentNewTask(context, (Class<? extends NormalFragment>) clazz, bundle);
} else {
Intent intent1 = new Intent(context, clazz);
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent1.putExtras(bundle);
context.startActivity(intent1);
}
}
}
} else {
// 应用未在运行
context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
}
}
}
package com.gh.common.util;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.NormalActivity;
import com.gh.gamecenter.SplashScreenActivity;
import com.gh.gamecenter.normal.NormalFragment;
/**
* @author CsHeng
* @Date 2017/4/25
* @Time 16:39
*/
public class EntranceUtils {
public static final String KEY_TO = "to";
public static final String KEY_NEWSID = "newsId";
public static final String KEY_GAMEID = "gameId";
public static final String KEY_ID = "id";
public static final String KEY_URL = "url";
public static final String KEY_GAMENAME = "gameName";
public static final String HOST_ARTICLE = "article";
public static final String HOST_COMMUNITY_ARTICLE = "community_article";
public static final String HOST_COMMUNITY_COLUMN = "community_column";
public static final String HOST_GAME = "game";
public static final String HOST_GAME_DOWNLOAD = "game_download";
public static final String HOST_COLUMN = "column";
public static final String HOST_WEB = "web";
public static final String HOST_QQ = "qq";
public static final String HOST_DOWNLOAD = "download";
public static final String HOST_UPDATE = "update";
public static final String HOST_LIBAO = "libao";
public static final String HOST_COMMUNITY = "community";
public static final String HOST_SUGGESTION = "suggestion";
public static final String HOST_ANSWER = "answer";
public static final String HOST_QUESTION = "question";
public static final String KEY_DATA = "data";
public static final String KEY_MESSAGE = "message";
public static final String KEY_MESSAGE_ID = "message_id";
public static final String KEY_TYPE = "type";
public static final String KEY_LINK = "link";
public static final String KEY_NAME = "name";
public static final String KEY_ENTRANCE = "entrance";
public static final String KEY_TARGET = "target";
public static final String ENTRANCE_BROWSER = "(浏览器)";
public static final String ENTRANCE_WELCOME = "(启动弹窗)";
public static final String ENTRANCE_UMENG = "(友盟推送)";
public static final String ENTRANCE_MIPUSH = "(小米推送)";
public static final String ENTRANCE_DOWNLOAD = "(下载跳转)";
public static final String ENTRANCE_RECOMMEND = "(落地页)";
public static final String ENTRANCE_BLOCK_RECOMMEND = "(推荐入口)";
public static final String KEY_SUGGEST_HINT_TYPE = "suggestHintType";
public static final String KEY_PACKAGENAME = "packageName";
public static final String KEY_PLATFORM = "platform";
public static final String KEY_GAME_NAME = "game_name";
public static final String KEY_VERSION = "version";
public static final String KEY_CONTENT = "content";
public static final String KEY_PLUGIN = "plugin";
public static final String KEY_CURRENTITEM = "currentItem";
public static final String KEY_COMMENTID = "commentId";
public static final String KEY_PATH = "path";
public static final String KEY_OUTER_INFO = "outerInfo";
public static final String KEY_OLDERUSER = "isOldUser";
public static final String KEY_SEARCHKEY = "searchKey";
public static final String KEY_HINT = "hint";
public static final String KEY_GAME_ICON_URL = "gameIconUrl";
public static final String KEY_SHARECONTENT = "shareContent";
public static final String KEY_SUGGESTTYPE = "suggestType";
public static final String KEY_PROLIST = "provinceList";
public static final String KEY_ORDER = "order";
public static final String KEY_TAGTYPE = "tagType";
public static final String KEY_ANSWER_ID = "answerId";
public static final String KEY_ANSWER_CONTENT = "answerContent";
public static final String KEY_QUESTIONS_ID = "questionsId";
public static final String KEY_QUESTIONS_TITLE = "questionsTitle";
public static final String KEY_ANSWER_OPEN_IN_NEW_PAGE = "openInNewPage";
public static final String KEY_QUESTIONS_PATCH = "questionsPatch";
public static final String KEY_INVITE_SEARCH_KEY = "inviteSearchKey";
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_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";
public static final String KEY_KAIFU_LIST = "kaifuList";
public static final String KEY_CATEGORY_ID = "category_id";
public static final String KEY_CATEGORY_TITLE = "category_title";
public static final String KEY_CATEGORY_INIT_TITLE = "category_init_title";
public static final String KEY_BLOCK_DATA = "blockData";
public static final String KEY_ASK_TAG = "askTag";
public static final String KEY_ASK_COLUMN_TAG = "askColumnTag";
public static final String KEY_COMMUNITY_ID = "community_id";
public static final String KEY_COMMUNITY_NAME = "community_name";
public static final String KEY_COMMUNITY_DATA = "communityData";
public static final String KEY_TRACE_EVENT = "trace_event";
public static final String KEY_SUBJECT_DATA = "subjectData";
public static final String KEY_USER_ID = "user_id";
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_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_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 final String KEY_OPEN_KEYBOARD = "openKeyboard";
public static void jumpActivity(Context context, Bundle bundle) {
//TODO 把其他类似的跳转启动逻辑也处理掉
if (RunningUtils.isRunning(context)
&& MainActivity.class.getName().equals(RunningUtils.getBaseActivity(context))) {
// 应用正在运行,前台或后台
String to = bundle.getString(KEY_TO);
if (!TextUtils.isEmpty(to)) {
Class<?> clazz = ClassUtils.forName(to);
if (clazz != null) {
if (NormalFragment.class.isAssignableFrom(clazz)) { // 兼容NormalFragment
NormalActivity.startFragmentNewTask(context, (Class<? extends NormalFragment>) clazz, bundle);
} else {
Intent intent1 = new Intent(context, clazz);
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent1.putExtras(bundle);
context.startActivity(intent1);
}
}
}
} else {
// 应用未在运行
context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
}
}
}

View File

@ -2,7 +2,9 @@ package com.gh.common.util
import android.content.Context
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.entity.ErrorEntity
import com.halo.assistant.fragment.WebFragment
import com.lightgame.utils.Utils
/**
@ -10,6 +12,54 @@ import com.lightgame.utils.Utils
*/
object ErrorHelper {
/**
* 手动匹配处理特定错误码
* [showHighPriorityHint] 用来标识有同样错误码可以触发两种处理时,为 true 时选择重要的
* [customizedHandler] 返回 true 为已处理该错误码false 则交由 [handleError] 处理
*/
fun handleErrorWithCustomizedHandler(context: Context,
errorString: String?,
showHighPriorityHint: Boolean = false,
customizedHandler: (code: Int) -> Boolean) {
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
}
if (customizedHandler(errorEntity.code ?: 0)) {
return
} else {
handleError(context, showHighPriorityHint, errorEntity)
}
}
/**
* [showHighPriorityHint] 用来标识有同样错误码可以触发两种处理时,为 true 时选择重要的
*/
@JvmStatic
fun handleError(context: Context, errorString: String?, showHighPriorityHint: 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
}
handleError(context, showHighPriorityHint, errorEntity)
}
/***
* 禁言错误,
*403050 评论回答
@ -24,23 +74,7 @@ object ErrorHelper {
*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
}
private fun handleError(context: Context, showHighPriorityHint: Boolean = false, errorEntity: ErrorEntity) {
when (errorEntity.code) {
403050,
403051,
@ -50,9 +84,12 @@ object ErrorHelper {
403049,
403046,
403045,
403057,
403054,
403047 -> handleErrorWithBannedDialog(context, errorEntity)
403069,
403047 -> handleErrorWithCommunityBannedDialog(context, errorEntity)
403057,
403068 -> handleErrorWithCommentBannedDialog(context, errorEntity)
403001 -> Utils.toast(context, "标签名称太长了")
403002 -> Utils.toast(context, "已经被邀请了")
@ -70,9 +107,10 @@ object ErrorHelper {
403014 -> Utils.toast(context, "标签数量太多了")
403015 -> Utils.toast(context, "已经关注过了")
404001 -> Utils.toast(context, "请求的资源不存在")
403016 -> Utils.toast(context, "标签内容可能包含敏感信息,请修改后再提交")
403018 -> Utils.toast(context, R.string.comment_failed_unable)
403020 -> if (important!!) {
403020 -> if (showHighPriorityHint) {
DialogUtils.showAlertDialog(context,
"限制提醒",
"提问过于频繁,请先休息一下哦",
@ -83,21 +121,43 @@ object ErrorHelper {
403021 -> Utils.toast(context, R.string.comment_failed_illegal)
403059 -> Utils.toast(context, "权限错误,请刷新后重试")
400802 -> {
// 多设备登录同一帐号,不需要这里处理
}
else -> Utils.toast(context, R.string.post_failure_hint)
}
}
private fun handleErrorWithBannedDialog(context: Context, errorEntity: ErrorEntity) {
private fun handleErrorWithCommentBannedDialog(context: Context, errorEntity: ErrorEntity) {
val bannedType = if (errorEntity.data?.alwaysBlock!!) {
""
} else {
"(非永久)"
}
val dialogContext = DialogUtils.checkDialogContext(context)
DialogUtils.showAlertDialog(dialogContext,
"提示",
"你因违反《光环助手评论规则》,已被禁言,如有疑问$bannedType请联系客服QQ3467475980",
"去看看", "关闭", {
dialogContext.startActivity(WebActivity.getCommentRulesIntent(dialogContext))
}, null)
}
DialogUtils.showAlertDialog(context,
private fun handleErrorWithCommunityBannedDialog(context: Context, errorEntity: ErrorEntity) {
val bannedType = if (errorEntity.data?.alwaysBlock!!) {
""
} else {
"(非永久)"
}
val dialogContext = DialogUtils.checkDialogContext(context)
DialogUtils.showAlertDialog(dialogContext,
"提示",
"你因违反《问答版块规则》,已被禁言$bannedType如有疑问请联系客服QQ3467475980",
"关闭", null, null, null)
"去看看", "关闭", {
dialogContext.startActivity(WebActivity.getCommunityRuleIntent(dialogContext))
}, null)
}
}

View File

@ -1,26 +1,45 @@
package com.gh.common.util
import android.arch.lifecycle.*
import android.content.ClipboardManager
import android.content.Context
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import android.support.v4.view.ViewPager
import android.text.Html
import android.text.Spanned
import android.view.Gravity
import android.view.View
import android.widget.PopupWindow
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.*
import androidx.viewpager.widget.ViewPager
import com.gh.gamecenter.R
import com.google.gson.reflect.TypeToken
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import okhttp3.MediaType
import okhttp3.RequestBody
import java.net.URI
/**
* 创建以 activity 为观察者上下文的 viewModel
*/
inline fun <reified VM : ViewModel> FragmentActivity.viewModelProvider(
provider: ViewModelProvider.Factory
provider: ViewModelProvider.Factory? = null
) =
ViewModelProviders.of(this, provider).get(VM::class.java)
/**
* 创建以 activity 为观察者上下文的 viewModel
*/
inline fun <reified VM : ViewModel> Fragment.viewModelProviderFromParent(
provider: ViewModelProvider.Factory? = null
) =
ViewModelProviders.of(requireActivity(), provider).get(VM::class.java)
/**
* 创建以 fragment 为观察者上下文的 viewModel
*/
inline fun <reified VM : ViewModel> Fragment.viewModelProvider(
provider: ViewModelProvider.Factory
provider: ViewModelProvider.Factory? = null
) =
ViewModelProviders.of(this, provider).get(VM::class.java)
@ -48,6 +67,25 @@ fun ViewPager.addOnPageChangeListener(onSelected: ((position: Int) -> Unit)? = n
addOnPageChangeListener(listener)
}
/**
* View Extensions
*/
fun View.visibleIf(predicate: Boolean) {
visibility = if (predicate) {
View.VISIBLE
} else {
View.INVISIBLE
}
}
fun View.goneIf(predicate: Boolean) {
visibility = if (predicate) {
View.GONE
} else {
View.VISIBLE
}
}
/**
* LiveData Extensions
*/
@ -98,4 +136,135 @@ fun debounceActionWithInterval(id: Int, interval: Long = 300, action: (() -> Uni
fun View.debounceActionWithInterval(interval: Long = 300, action: (() -> Unit)? = null) {
debounceActionWithInterval(this.id, interval, action)
}
/**
* 告诉需要返回 true or false 的外层这个事件已经被消费(即返回 true
*/
inline fun consume(f: () -> Unit): Boolean {
f()
return true
}
/**
* 简化那些不得不写 try catch 的代码块
*/
inline fun tryWithDefaultCatch(action: (() -> Unit)) {
try {
action.invoke()
} catch (e: Throwable) {
e.printStackTrace()
}
}
/**
* String related
*/
fun String.fromHtml(): Spanned {
return Html.fromHtml(this)
}
// 去掉文章/答案的插入内容
fun String.removeInsertedContent(): String {
val textRegex = "(?s)<div class=\"gh-internal-content content-right\".*?</div>"
return this.replace(textRegex.toRegex(), "")
}
// 完全地清除所有 Html 格式
fun String.clearHtmlFormatCompletely(): String {
return Html.fromHtml(this).toString().replace('\n', 32.toChar())
.replace(160.toChar(), 32.toChar()).replace(65532.toChar(), 32.toChar()).trim { it <= ' ' }
}
// 如果该字符串长度超过固定长度的话,从头开始截取固定长度并返回
fun String.subStringIfPossible(length: Int): String {
return if (this.length > length) {
this.substring(0, length)
} else {
this
}
}
fun String.copyTextAndToast(toastText: String = "复制成功") {
val application = HaloApp.getInstance().application
val cmb = application.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
cmb.text = this
Utils.toast(application, toastText)
}
fun Map<String, String>.createRequestBody(): RequestBody {
val json = GsonUtils.toJson(this)
return RequestBody.create(MediaType.parse("application/json"), json)
}
// 对在浏览器(WebView)显示的路径进行转码
fun String.decodeURI(): String {
return URI(null, null, this, null).rawPath
}
/**
* 根据手机的分辨率从 dip(像素) 的单位 转成为 px
*/
fun Float.dip2px(): Int {
val scale = HaloApp.getInstance().application.resources.displayMetrics.density
return (this * scale + 0.5f).toInt()
}
/**
* PopupWindow 自动适配方向
*/
fun PopupWindow.showAutoOrientation(anchorView: View) {
val windowPos = IntArray(2)
val anchorLoc = IntArray(2)
// 获取锚点View在屏幕上的左上角坐标位置
anchorView.getLocationOnScreen(anchorLoc)
val anchorHeight = anchorView.height
// 获取屏幕的高宽
val screenHeight = anchorView.context.resources.displayMetrics.heightPixels
val screenWidth = anchorView.context.resources.displayMetrics.widthPixels
// 测量contentView
contentView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
// 计算contentView的高宽
val windowHeight = contentView.measuredHeight
val windowWidth = contentView.measuredWidth
// 判断需要向上弹出还是向下弹出显示
val isNeedShowUp = screenHeight - anchorLoc[1] - anchorHeight < windowHeight
if (isNeedShowUp) {
windowPos[0] = screenWidth - windowWidth
windowPos[1] = anchorLoc[1] - windowHeight
} else {
windowPos[0] = screenWidth - windowWidth
windowPos[1] = anchorLoc[1] + anchorHeight
}
animationStyle = R.style.popwindow_option_anim_style
showAtLocation(anchorView, Gravity.TOP or Gravity.START, windowPos[0], windowPos[1])
}
/**
* 权限相关
*/
fun Fragment.checkReadPhoneStateAndStoragePermissionBeforeAction(action: (() -> Unit)) {
PermissionHelper.checkReadPhoneStateAndStoragePermissionBeforeAction(requireContext(), object : EmptyCallback {
override fun onCallback() {
action.invoke()
}
})
}
fun Fragment.checkReadPhoneStatePermissionBeforeAction(action: (() -> Unit)) {
PermissionHelper.checkReadPhoneStatePermissionBeforeAction(requireContext(), object : EmptyCallback {
override fun onCallback() {
action.invoke()
}
})
}
fun Fragment.checkStoragePermissionBeforeAction(action: (() -> Unit)) {
PermissionHelper.checkStoragePermissionBeforeAction(requireContext(), object : EmptyCallback {
override fun onCallback() {
action.invoke()
}
})
}

View File

@ -66,11 +66,11 @@ object GameRepositoryHelper {
* @param collectionId 补充游戏库相应专题 ID
* @param gameIdList 该专题里已经包含的游戏 ID 列表
*/
fun getOneUniqueGame(collectionId: String?, gameIdList: List<String>): GameEntity? {
fun getOneUniqueGame(collectionId: String?, gameIdList: HashSet<String>): GameEntity? {
collectionId?.let {
val collection = gameCollectionList.find { it.id == collectionId }
collection?.let {
val game = collection.data?.find { game -> findUniqueGame(game, gameIdList) }
val game = collection.data?.find { game -> isThisGameUnique(game, gameIdList) }
game?.let {
collection.data?.remove(game)
// 产品说要记录补充专题的曝光数,所以这个游戏附带了所在专题的名字
@ -82,7 +82,12 @@ object GameRepositoryHelper {
return null
}
private fun findUniqueGame(game: GameEntity, gameIdList: List<String>): Boolean {
private fun isThisGameUnique(game: GameEntity, gameIdList: HashSet<String>): Boolean {
// 若该补充游戏已经存在关联关系,判定为非唯一
for (relatedId in game.relatedGameIds!!) {
gameIdList.contains(relatedId)
return false
}
for (apk in game.getApk()) {
// 检查本地是否已安装该游戏,已过滤那部分框架服务的包名
if (PackageHelper.validLocalPackageNameSet.contains(apk.packageName)) {

View File

@ -2,7 +2,7 @@ package com.gh.common.util;
import android.content.Context;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.widget.TextView;
@ -55,7 +55,7 @@ public class GameUtils {
if ("插件化".equals(status)) {
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_plugin_style);
} else if ("打开".equals(status) || "启动".equals(status)) {
downloadBtn.setBackgroundResource(R.drawable.detail_downloading_normal_style);
downloadBtn.setBackgroundResource(R.drawable.detail_download_open_style);
downloadBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
} else {
downloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
@ -144,6 +144,7 @@ public class GameUtils {
gameUpdateEntity.setEtag(apkEntity.getEtag());
gameUpdateEntity.setPluggable(true);
gameUpdateEntity.setTag(gameEntity.getTag());
gameUpdateEntity.setTagStyle(gameEntity.getTagStyle());
gameUpdateEntity.setBrief(gameEntity.getBrief());
gameUpdateEntity.setPlugin(apkEntity.getPlugin());
return gameUpdateEntity;

View File

@ -3,7 +3,7 @@ package com.gh.common.util;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.support.v4.content.ContextCompat;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.View;
@ -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, 5), tagType, tagStyle.size() > i ? tagStyle.get(i) : null);
view = getGameTagView(context, tag.get(i), DisplayUtils.dip2px(context, 8), tagType, tagStyle.size() > i ? tagStyle.get(i) : null);
}
if (view != null) {
labelLayout.addView(view);
@ -73,14 +73,14 @@ public class GameViewUtils {
if ("border".equals(tagEntity.getStyle())) {
gradientDrawable.setColor(Color.TRANSPARENT);
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 0.6f), Color.parseColor(colorStr));
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), Color.parseColor(colorStr));
tag.setTextColor(Color.parseColor(colorStr));
} else {
gradientDrawable.setColor(Color.parseColor(colorStr));
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
tag.setTextColor(Color.WHITE);
}
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(1.5F));
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(3F));
tag.setBackgroundDrawable(gradientDrawable);
} else {
colorStr = TagUtils.getInstance(context).getColor(tagStr);
@ -90,8 +90,8 @@ public class GameViewUtils {
int color = Color.parseColor(colorStr);
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setColor(Color.TRANSPARENT);
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 0.6f), color);
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(1.5F));
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), color);
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(3F));
tag.setBackgroundDrawable(gradientDrawable);
tag.setTextColor(color);
}

View File

@ -0,0 +1,20 @@
package com.gh.common.util
import android.content.Context
import com.zhihu.matisse.MimeType
import com.zhihu.matisse.filter.Filter
import com.zhihu.matisse.internal.entity.IncapableCause
import com.zhihu.matisse.internal.entity.Item
class GhMatisseFilter : Filter() {
override fun constraintTypes(): MutableSet<MimeType> {
return MimeType.ofVideo()
}
override fun filter(context: Context?, item: Item?): IncapableCause? {
if (!needFiltering(context, item)) return null
return IncapableCause(IncapableCause.TOAST, "暂不支持视频")
}
}

View File

@ -1,36 +0,0 @@
package com.gh.common.util;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class HMACUtils {
public static String encrypt(String data, String key) {
try {
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(signingKey);
return byte2hex(mac.doFinal(data.getBytes()));
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
e.printStackTrace();
}
return null;
}
private static String byte2hex(byte[] ciphertext) {
StringBuilder builder = new StringBuilder();
String stmp;
for (int i = 0; ciphertext != null && i < ciphertext.length; i++) {
stmp = Integer.toHexString(ciphertext[i] & 0XFF);
if (stmp.length() == 1) {
builder.append('0');
}
builder.append(stmp);
}
return builder.toString().toLowerCase();
}
}

View File

@ -1,158 +0,0 @@
/*
* Copyright (C) 2015 Baidu, Inc. All Rights Reserved.
*/
package com.gh.common.util;
import android.annotation.TargetApi;
import android.content.Context;
import java.io.File;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import dalvik.system.DexClassLoader;
import dalvik.system.PathClassLoader;
/* compiled from: ProGuard */
public final class HotFix {
public static void patch(Context context, String patchDexFile, String patchClassName) {
if (patchDexFile != null && new File(patchDexFile).exists()) {
try {
if (hasLexClassLoader()) {
injectInAliyunOs(context, patchDexFile, patchClassName);
} else if (hasDexClassLoader()) {
injectAboveEqualApiLevel14(context, patchDexFile, patchClassName);
} else {
injectBelowApiLevel14(context, patchDexFile, patchClassName);
}
} catch (Throwable th) {
}
}
}
private static boolean hasLexClassLoader() {
try {
Class.forName("dalvik.system.LexClassLoader");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
private static void injectInAliyunOs(Context context, String patchDexFile, String patchClassName)
throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException,
InstantiationException, NoSuchFieldException {
PathClassLoader obj = (PathClassLoader) context.getClassLoader();
String replaceAll = new File(patchDexFile).getName().replaceAll("\\.[a-zA-Z0-9]+", ".lex");
Class cls = Class.forName("dalvik.system.LexClassLoader");
Object newInstance =
cls.getConstructor(new Class[]{String.class, String.class, String.class, ClassLoader.class}).newInstance(
new Object[]{context.getDir("dex", 0).getAbsolutePath() + File.separator + replaceAll,
context.getDir("dex", 0).getAbsolutePath(), patchDexFile, obj});
cls.getMethod("loadClass", new Class[]{String.class}).invoke(newInstance, new Object[]{patchClassName});
setField(obj, PathClassLoader.class, "mPaths",
appendArray(getField(obj, PathClassLoader.class, "mPaths"), getField(newInstance, cls, "mRawDexPath")));
setField(obj, PathClassLoader.class, "mFiles",
combineArray(getField(obj, PathClassLoader.class, "mFiles"), getField(newInstance, cls, "mFiles")));
setField(obj, PathClassLoader.class, "mZips",
combineArray(getField(obj, PathClassLoader.class, "mZips"), getField(newInstance, cls, "mZips")));
setField(obj, PathClassLoader.class, "mLexs",
combineArray(getField(obj, PathClassLoader.class, "mLexs"), getField(newInstance, cls, "mDexs")));
}
private static boolean hasDexClassLoader() {
try {
Class.forName("dalvik.system.BaseDexClassLoader");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
private static void injectAboveEqualApiLevel14(Context context, String str, String str2)
throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
PathClassLoader pathClassLoader = (PathClassLoader) context.getClassLoader();
Object a = combineArray(getDexElements(getPathList(pathClassLoader)),
getDexElements(getPathList(
new DexClassLoader(str, context.getDir("dex", 0).getAbsolutePath(), str, context.getClassLoader()))));
Object a2 = getPathList(pathClassLoader);
setField(a2, a2.getClass(), "dexElements", a);
pathClassLoader.loadClass(str2);
}
@TargetApi(14)
private static void injectBelowApiLevel14(Context context, String str, String str2)
throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
PathClassLoader obj = (PathClassLoader) context.getClassLoader();
DexClassLoader dexClassLoader =
new DexClassLoader(str, context.getDir("dex", 0).getAbsolutePath(), str, context.getClassLoader());
dexClassLoader.loadClass(str2);
setField(obj, PathClassLoader.class, "mPaths",
appendArray(getField(obj, PathClassLoader.class, "mPaths"), getField(dexClassLoader, DexClassLoader.class,
"mRawDexPath")
));
setField(obj, PathClassLoader.class, "mFiles",
combineArray(getField(obj, PathClassLoader.class, "mFiles"), getField(dexClassLoader, DexClassLoader.class,
"mFiles")
));
setField(obj, PathClassLoader.class, "mZips",
combineArray(getField(obj, PathClassLoader.class, "mZips"), getField(dexClassLoader, DexClassLoader.class,
"mZips")));
setField(obj, PathClassLoader.class, "mDexs",
combineArray(getField(obj, PathClassLoader.class, "mDexs"), getField(dexClassLoader, DexClassLoader.class,
"mDexs")));
obj.loadClass(str2);
}
private static void setField(Object obj, Class cls, String str, Object obj2)
throws NoSuchFieldException, IllegalAccessException {
Field declaredField = cls.getDeclaredField(str);
declaredField.setAccessible(true);
declaredField.set(obj, obj2);
}
private static Object appendArray(Object obj, Object obj2) {
Class componentType = obj.getClass().getComponentType();
int length = Array.getLength(obj);
Object newInstance = Array.newInstance(componentType, length + 1);
Array.set(newInstance, 0, obj2);
for (int i = 1; i < length + 1; i++) {
Array.set(newInstance, i, Array.get(obj, i - 1));
}
return newInstance;
}
private static Object getField(Object obj, Class cls, String str)
throws NoSuchFieldException, IllegalAccessException {
Field declaredField = cls.getDeclaredField(str);
declaredField.setAccessible(true);
return declaredField.get(obj);
}
private static Object combineArray(Object obj, Object obj2) {
Class componentType = obj2.getClass().getComponentType();
int length = Array.getLength(obj2);
int length2 = Array.getLength(obj) + length;
Object newInstance = Array.newInstance(componentType, length2);
for (int i = 0; i < length2; i++) {
if (i < length) {
Array.set(newInstance, i, Array.get(obj2, i));
} else {
Array.set(newInstance, i, Array.get(obj, i - length));
}
}
return newInstance;
}
private static Object getDexElements(Object obj) throws NoSuchFieldException, IllegalAccessException {
return getField(obj, obj.getClass(), "dexElements");
}
private static Object getPathList(Object obj) throws ClassNotFoundException, NoSuchFieldException,
IllegalAccessException {
return getField(obj, Class.forName("dalvik.system.BaseDexClassLoader"), "pathList");
}
}

View File

@ -9,22 +9,9 @@ import java.util.regex.Pattern;
* Created by khy on 27/12/17.
*/
public class AskUtils {
// public static String voteCountFormat(int voteCount) {
// String vote;
// if (voteCount >= 10000) {
// DecimalFormat df = new DecimalFormat("#.0万");
// vote = df.format(voteCount / 10000f);
// } else {
// vote = String.valueOf(voteCount);
// }
// return vote;
// }
public class HtmlUtils {
public static String stripHtml(String htmlStr) {
if (TextUtils.isEmpty(htmlStr)) return "";
String regEx_script = "<script[^>]*?>[\\s\\S]*?<\\/script>"; //定义script的正则表达式
@ -45,5 +32,4 @@ public class AskUtils {
return htmlStr.trim(); //返回文本字符串
}
}

View File

@ -7,8 +7,8 @@ import android.graphics.drawable.Animatable
import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.os.Build
import android.support.annotation.DrawableRes
import android.support.v4.content.ContextCompat
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import com.facebook.common.executors.CallerThreadExecutor
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.controller.BaseControllerListener
@ -237,6 +237,8 @@ object ImageUtils {
url?.let {
// 图片是以 gif 结尾的就
if (it.endsWith(".gif")) {
if (view?.tag == url) return@let
val controller = Fresco.newDraweeControllerBuilder()
.setUri(url)
.setAutoPlayAnimations(true)
@ -252,6 +254,7 @@ object ImageUtils {
}
}
}
view?.tag = url
}
}

View File

@ -64,7 +64,7 @@ public class InstallUtils {
keys.add(packageName);
DownloadEntity downloadEntity = DownloadManager.getInstance(context).getDownloadEntityByPackageName(packageName);
String installVersion = PackageUtils.getVersionByPackage(context, packageName);
String installVersion = PackageUtils.getVersionByPackage(packageName);
if (!TextUtils.isEmpty(installVersion) && downloadEntity != null &&
installVersion.equals(downloadEntity.getVersionName())) {
if (!downloadEntity.isPluggable() || PackageUtils.isSignature(context, packageName)) {

View File

@ -4,7 +4,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.gh.gamecenter.category.CategoryListActivity;
import com.gh.gamecenter.entity.CategoryEntity;

View File

@ -1,32 +0,0 @@
package com.gh.common.util;
import android.support.v4.content.ContextCompat;
import android.widget.TextView;
import com.gh.gamecenter.R;
/**
* Created by khy on 2017/3/19.
*/
public class KaiFuUtils {
public static void setKaiFuType(TextView textView, String type) {
if (type == null) return;
textView.setText(type);
textView.setBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.tag_yellow));
// switch (type) {
// case "不删档内测":
// textView.setBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.content));
// break;
// case "删档内测":
// textView.setBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.content));
// break;
// case "公测":
// textView.setBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.tag_yellow));
// break;
// default:
// textView.setBackgroundColor(ContextCompat.getColor(textView.getContext(), R.color.tag_yellow));
// break;
// }
}
}

View File

@ -5,13 +5,14 @@ import android.content.ClipboardManager;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.util.Log;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.LibaoDetailAdapter;
@ -84,7 +85,7 @@ public class LibaoUtils {
.subscribe(new JSONObjectResponse() {
@Override
public void onResponse(JSONObject response) {
listener.postSucced(response);
listener.postSucceed(response);
}
@Override
@ -105,7 +106,7 @@ public class LibaoUtils {
.subscribe(new JSONObjectResponse() {
@Override
public void onResponse(JSONObject response) {
listener.postSucced(response);
listener.postSucceed(response);
}
@Override
@ -123,7 +124,7 @@ public class LibaoUtils {
.subscribe(new Response<ResponseBody>() {
@Override
public void onResponse(ResponseBody response) {
listener.postSucced(response);
listener.postSucceed(response);
}
@Override
@ -140,7 +141,7 @@ public class LibaoUtils {
.subscribe(new Response<List<LibaoStatusEntity>>() {
@Override
public void onResponse(List<LibaoStatusEntity> response) {
listener.postSucced(response);
listener.postSucceed(response);
}
@Override
@ -233,164 +234,88 @@ public class LibaoUtils {
libaoBtn.setOnClickListener(v -> {
String btnStatus = libaoBtn.getText().toString();
// 领取限制
CheckLoginUtils.checkLogin(context, "礼包详情-[" + btnStatus + "]", () -> {
// 领取限制
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;
PermissionHelper.checkReadPhoneStatePermissionBeforeAction(context, () -> {
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());
}
}
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;
}
}
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;
}
}
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点刷新");
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;
}
final Dialog loadingDialog = DialogUtils.showWaitDialog(context, "淘号中...");
postLibaoTao(context, libaoEntity.getId(), new PostLibaoListener() {
@Override
public void postSucced(Object response) {
}
if (loadingDialog != null) loadingDialog.dismiss();
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 postSucceed(Object response) {
JSONObject responseBody = (JSONObject) response;
String libaoCode = null;
try {
libaoCode = responseBody.getString("code");
} catch (JSONException e) {
e.printStackTrace();
}
if (loadingDialog != null) loadingDialog.dismiss();
if (TextUtils.isEmpty(libaoCode)) {
JSONObject responseBody = (JSONObject) response;
String libaoCode = null;
try {
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;
}
libaoCode = responseBody.getString("code");
} catch (JSONException e) {
e.printStackTrace();
}
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))
, "关闭", " 复制礼包码"
, () -> {
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) {
if (TextUtils.isEmpty(libaoCode)) {
try {
JSONObject errorJson = new JSONObject(exception.response().errorBody().string());
String detail = errorJson.getString("detail");
// Utils.toast(context, "返回::" + detail);
String detail = responseBody.getString("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;
@ -398,24 +323,101 @@ public class LibaoUtils {
Utils.toast(context, "淘号失败,稍后重试");
break;
default:
Utils.toast(context, "操作失败");
Utils.toast(context, "淘号异常");
break;
}
} catch (Exception ex) {
ex.printStackTrace();
Utils.toast(context, "礼包处理异常" + ex.toString());
} catch (JSONException e) {
e.printStackTrace();
}
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))
, "关闭", " 复制礼包码"
, () -> {
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);
}
Utils.toast(context, "发生异常");
}
});
break;
}
@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;
}
});
});
});
}
@ -431,7 +433,7 @@ public class LibaoUtils {
postLibaoLing(context, libaoEntity.getId(), new PostLibaoListener() {
@Override
public void postSucced(Object response) {
public void postSucceed(Object response) {
if (loadingDialog != null) loadingDialog.dismiss();
JSONObject responseBody = (JSONObject) response;
@ -629,7 +631,7 @@ public class LibaoUtils {
public interface PostLibaoListener {
void postSucced(Object response);
void postSucceed(Object response);
void postFailed(Throwable error);
}

View File

@ -1,9 +1,7 @@
package com.gh.common.util;
import android.content.Context;
import android.text.TextUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -12,8 +10,6 @@ import com.lightgame.utils.Utils;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Iterator;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
@ -106,68 +102,6 @@ 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);
return;
}
try {
JSONObject errorJson = new JSONObject(errorString);
Iterator<String> iterator = errorJson.keys();
while (iterator.hasNext()) {
String key = iterator.next();
if ("toast".equals(key)) {
Utils.toast(context, errorJson.get(key).toString());
return;
}
}
int errorCode = errorJson.getInt("code");
switch (errorCode) {
case 403018:
Utils.toast(context, R.string.comment_failed_unable);
case 403050:
case 403053:
case 403048:
case 403049:
case 403057:
case 403045:
case 403046:
case 403054:
Utils.toast(context, R.string.comment_failed_userbanned);
break;
case 403051:
Utils.toast(context, R.string.comment_failed_userblocked);
break;
case 403020:
if (isQuestion) {
DialogUtils.showAlertDialog(context, "限制提醒"
, "提问过于频繁,请先休息一下哦", "知道了"
, null, null, null);
} else {
Utils.toast(context, R.string.comment_failed_toofrequent);
}
break;
case 403021:
Utils.toast(context, R.string.comment_failed_illegal);
break;
case 403047:
Utils.toast(context, R.string.deny_vote_answer);
break;
default:
Utils.toast(context, R.string.post_failure_hint);
break;
}
} catch (Exception e) {
Utils.toast(context, R.string.post_failure_hint);
e.printStackTrace();
}
}
public static void captchaErrorHint(Context context, JSONObject content) {
try {
@ -327,6 +261,9 @@ public class LoginUtils {
case 403204:
Utils.toast(context, "获取验证码太频繁,请稍后再试");
break;
case 400212:
Utils.toast(context, "请输入正确的手机号");
break;
default:
Utils.toast(context, code + "");
break;

View File

@ -11,9 +11,11 @@ import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
@ -27,12 +29,14 @@ import android.widget.TextView;
import com.gh.common.constant.Config;
import com.gh.gamecenter.R;
import com.lightgame.utils.Utils;
import com.tencent.connect.auth.QQToken;
import com.tencent.connect.share.QQShare;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelmsg.WXImageObject;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.tencent.open.TDialog;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.Tencent;
import com.tencent.tauth.UiError;
@ -41,6 +45,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Date;
import java.util.List;
@ -48,12 +53,20 @@ import java.util.List;
* Created by khy on 2016/11/8.
*/
public class MessageShareUtils {
private static MessageShareUtils instance;
private IWXAPI mIWXAPI;
private Tencent mTencent;
private WeakReference<Activity> mActivity; // 用来关闭分享页面
private Context mContext; // application context
private PopupWindow mPopupWindow;
private Bitmap shareBm; //分享截图
private String picName;
private boolean isPlugin = false;
private String[] mArrLabel = {"微信好友", "朋友圈", "QQ好友", "QQ空间", "保存"};
private int[] arrLogo = {
R.drawable.share_wechat_logo,
R.drawable.share_wechatmoments_logo,
@ -62,14 +75,6 @@ public class MessageShareUtils {
R.drawable.share_save
};
private String[] mArrLabel = {"微信好友", "朋友圈", "QQ好友", "QQ空间", "保存"};
private PopupWindow mPopupWindow;
private Context mContext;
//TODO 干掉activity将context变成applicationcontext
private Activity mActivity; // 用来关闭分享页面
//QQ或者QQ空间分享回调处理
public IUiListener QqShareListener = new IUiListener() {
@Override
@ -79,7 +84,17 @@ public class MessageShareUtils {
@Override
public void onError(UiError uiError) {
Utils.toast(mContext, "分享失败请检查是否已安装QQ");
// 单分享图片不支持显示未安装弹窗,手动调出
Activity activity = mActivity.get();
if (activity != null && !ShareUtils.isQQClientAvailable(activity.getApplication())) {
new TDialog(activity,
"",
"http://openmobile.qq.com/oauth2.0/m_jump_by_version",
null,
new QQToken("")).show();
} else {
Utils.toast(mContext, "分享失败");
}
}
@Override
@ -87,6 +102,7 @@ public class MessageShareUtils {
Utils.toast(mContext, R.string.share_cancel_hint);
}
};
// 适配快传成绩单分享
private int contentSize;
private int paddTop;
@ -99,8 +115,7 @@ public class MessageShareUtils {
private MessageShareUtils(Context context) {
mTencent = Tencent.createInstance(Config.TENCENT_APPID, context); //初始化QQ分享
mIWXAPI = WXAPIFactory.createWXAPI(context, Config.WECHAT_APPID); //初始化微信分享
//TODO changed to application context
mContext = context;
mContext = context.getApplicationContext();
}
public static MessageShareUtils getInstance(Context context) {
@ -110,25 +125,6 @@ public class MessageShareUtils {
return instance;
}
//检查是否安装手机QQ
public static boolean isQQClientAvailable(Context context) {
final PackageManager packageManager = context.getPackageManager();
List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
if (pinfo != null) {
for (int i = 0; i < pinfo.size(); i++) {
String pn = pinfo.get(i).packageName;
if ("com.tencent.mobileqq".equals(pn)) {
return true;
}
}
}
return false;
}
public IWXAPI getIWXAPI() {
return mIWXAPI;
}
public Tencent getTencent() {
return mTencent;
}
@ -137,7 +133,7 @@ public class MessageShareUtils {
this.shareBm = bitmap;
this.picName = picName;
this.shareType = shareType;
this.mActivity = activity;
this.mActivity = new WeakReference<>(activity);
if (shareType == 2) {
contentSize = 75;
@ -196,24 +192,16 @@ public class MessageShareUtils {
mPopupWindow.setAnimationStyle(R.style.mypopwindow_anim_style);
mPopupWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0);
contentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
contentView.setOnClickListener(v -> mPopupWindow.dismiss());
contentView.setOnKeyListener((v, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0
&& mPopupWindow != null
&& mPopupWindow.isShowing()) {
mPopupWindow.dismiss();
}
});
contentView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0 && mPopupWindow != null
&& mPopupWindow.isShowing()) {
mPopupWindow.dismiss();
}
return false;
}
return false;
});
}
@ -227,8 +215,12 @@ public class MessageShareUtils {
params.putString(QQShare.SHARE_TO_QQ_APP_NAME, mContext.getString(R.string.app_name));
params.putInt(QQShare.SHARE_TO_QQ_EXT_INT,
QQShare.SHARE_TO_QQ_FLAG_QZONE_ITEM_HIDE);
mTencent.shareToQQ(
mActivity, params, QqShareListener);
Activity activity = mActivity.get();
if (activity != null) {
mTencent.shareToQQ(activity, params, QqShareListener);
}
if (mPopupWindow == null) return;
mPopupWindow.dismiss();
}
@ -243,8 +235,12 @@ public class MessageShareUtils {
params.putString(QQShare.SHARE_TO_QQ_APP_NAME, mContext.getString(R.string.app_name));
params.putInt(QQShare.SHARE_TO_QQ_EXT_INT,
QQShare.SHARE_TO_QQ_FLAG_QZONE_AUTO_OPEN);
mTencent.shareToQQ(
mActivity, params, QqShareListener);
Activity activity = mActivity.get();
if (activity != null) {
mTencent.shareToQQ(activity, params, QqShareListener);
}
if (mPopupWindow == null) return;
mPopupWindow.dismiss();
}
@ -259,27 +255,27 @@ public class MessageShareUtils {
}
//官方分享
// WXImageObject imgObj = new WXImageObject();
// imgObj.setImagePath(mContext.getExternalCacheDir().getPath() + "/ShareImg/" + picName);
// WXMediaMessage msg = new WXMediaMessage();
// msg.mediaObject = imgObj;
//
// SendMessageToWX.Req req = new SendMessageToWX.Req();
// req.transaction = buildTransaction("img");
// req.message = msg;
// req.scene = SendMessageToWX.Req.WXSceneSession;
//
// Bitmap compressBp = compressBitmap(shareBm);
// msg.thumbData = Util.bmpToByteArray(compressBp, true);
// mIWXAPI.sendReq(req);
WXImageObject imgObj = new WXImageObject();
imgObj.setImagePath(mContext.getExternalCacheDir().getPath() + "/ShareImg/" + picName);
WXMediaMessage msg = new WXMediaMessage();
msg.mediaObject = imgObj;
//调用手机系统分享
try {
mContext.startActivity(IntentUtils.getWechatShareIntent(mContext, picName));
} catch (Exception e) {
Utils.toast(mContext, "分享失败!请检查是否已安装微信");
e.printStackTrace();
}
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("img");
req.message = msg;
req.scene = SendMessageToWX.Req.WXSceneSession;
Bitmap compressBp = compressBitmap(shareBm);
msg.thumbData = ImageUtils.bmpToByteArray(compressBp, true);
mIWXAPI.sendReq(req);
// //调用手机系统分享
// try {
// mContext.startActivity(IntentUtils.getWechatShareIntent(mContext, picName));
// } catch (Exception e) {
// Utils.toast(mContext, "分享失败!请检查是否已安装微信");
// e.printStackTrace();
// }
if (mPopupWindow == null) return;
mPopupWindow.dismiss();
@ -368,9 +364,9 @@ public class MessageShareUtils {
bitmap.compress(Bitmap.CompressFormat.JPEG, 75, fos);
}
if (isToast) {
Utils.toast(mContext, "成功保存到相册");
Utils.toast(mContext, "图片已保存到/Pictures/ghzhushou/");
//刷新手机图片库
refreshImage(_file, mContext);
refreshImage(mContext, _file);
}
}
}
@ -388,12 +384,15 @@ public class MessageShareUtils {
}
}
public static void refreshImage(File _file, Context context) {
/**
* 注意,第二个入参需要是 file 本身而不是 folder
*/
public static void refreshImage(Context context, File imageFile) {
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri uri = Uri.fromFile(_file);
Uri uri = Uri.fromFile(imageFile);
intent.setData(uri);
context.sendBroadcast(intent);
Utils.log("保存分享图片路径:" + _file.getAbsolutePath());
Utils.log("保存分享图片路径:" + imageFile.getAbsolutePath());
}
class ShareRecyclerViewAdapter extends RecyclerView.Adapter<ShareRecyclerViewAdapter.ViewHolder> {
@ -429,38 +428,35 @@ public class MessageShareUtils {
public void onBindViewHolder(final ViewHolder holder, int position) {
holder.shareLogo.setImageResource(arrLogo[position]);
holder.shareLabel.setText(mArrLabel[position]);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (holder.getPosition()) {
case 0:
wechatSahre();
if (shareType != 2) {
holder.itemView.setOnClickListener(v -> {
switch (holder.getPosition()) {
case 0:
wechatSahre();
if (shareType != 2) {
// activity.finish();
}
break;
case 1:
wechatMomentsSahre();
if (shareType != 2) {
}
break;
case 1:
wechatMomentsSahre();
if (shareType != 2) {
// activity.finish();
}
break;
case 2:
qqSahre();
break;
case 3:
qZoneSahre();
break;
case 4:
String savePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/ghzhushou/";
writeBitmap(savePath, "gh-" + new Date().getTime() + ".jpg", shareBm, true);
}
break;
case 2:
qqSahre();
break;
case 3:
qZoneSahre();
break;
case 4:
String savePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/ghzhushou/";
writeBitmap(savePath, "gh-" + new Date().getTime() + ".jpg", shareBm, true);
if (mPopupWindow == null) return;
mPopupWindow.dismiss();
if (mPopupWindow == null) return;
mPopupWindow.dismiss();
// activity.finish();
break;
break;
}
}
});
}

View File

@ -3,6 +3,7 @@ package com.gh.common.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
public class NetworkUtils {
@ -119,4 +120,48 @@ public class NetworkUtils {
return "NONE";
}
/**
* 获取当前移动网络连接的类型信息(当连接的网络是移动网络时使用)
*
* @param context 上下文
* @return 当前移动网络连接的类型信息
*/
public static String getMobileNetworkType(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
if (info == null) return "unknown";
switch (info.getType()) {
// Unknown
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
return "unknown";
// Cellular Data2G
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_IDEN:
case TelephonyManager.NETWORK_TYPE_1xRTT:
return "2G";
// Cellular Data3G
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
case TelephonyManager.NETWORK_TYPE_HSPAP:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
return "3G";
// Cellular Data4G
case TelephonyManager.NETWORK_TYPE_LTE:
return "4G";
default:
return "unknown";
}
}
}

View File

@ -0,0 +1,44 @@
package com.gh.common.util
import android.app.Dialog
import android.content.Context
import android.graphics.Color
import androidx.core.content.ContextCompat
import android.view.Window
import android.widget.LinearLayout
import android.widget.TextView
import com.gh.gamecenter.R
object OptionDialogHelper {
fun showOptionDialog(context: Context, typeList: List<String>, callback: (String) -> Unit) {
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 (type in typeList) {
val reportTv = TextView(context)
reportTv.text = type
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 {
callback.invoke(reportTv.text.toString())
dialog.cancel()
}
}
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setContentView(container)
dialog.show()
}
}

View File

@ -11,14 +11,16 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.content.FileProvider;
import android.text.TextUtils;
import androidx.core.content.FileProvider;
import com.g00fy2.versioncompare.Version;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.Utils;
import org.json.JSONArray;
@ -69,6 +71,7 @@ public class PackageUtils {
updateEntity.setEtag(apkEntity.getEtag());
updateEntity.setBrief(gameEntity.getBrief());
updateEntity.setTag(gameEntity.getTag());
updateEntity.setTagStyle(gameEntity.getTagStyle());
updateList.add(updateEntity);
}
}
@ -79,7 +82,7 @@ public class PackageUtils {
for (ApkEntity apkEntity : gameEntity.getApkNormal()) {
String versionFromRequest = apkEntity.getVersion();
String versionFromInstalledApp = getVersionByPackage(context, apkEntity.getPackageName());
String versionFromInstalledApp = getVersionByPackage(apkEntity.getPackageName());
// 是否需要显示更新
boolean shouldShouldUpdate = apkEntity.getForce();
@ -103,6 +106,7 @@ public class PackageUtils {
updateEntity.setEtag(apkEntity.getEtag());
updateEntity.setBrief(gameEntity.getBrief());
updateEntity.setTag(gameEntity.getTag());
updateEntity.setTagStyle(gameEntity.getTagStyle());
updateList.add(updateEntity);
}
}
@ -144,7 +148,13 @@ public class PackageUtils {
PackageInfo packageInfo = context.getApplicationContext().getPackageManager()
.getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
Signature[] signatures = packageInfo.signatures;
return parseSignature(signatures[0].toByteArray())[0];
// 使用幸运破解器破解安卓签名认证可能会出现不用签名也能装的情况,这里有可能是空的
if (signatures[0] != null) {
return parseSignature(signatures[0].toByteArray())[0];
} else {
return null;
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
@ -310,9 +320,9 @@ public class PackageUtils {
/*
* 获取apk的版本
*/
public static String getVersionByPackage(Context context, String packageName) {
public static String getVersionByPackage(String packageName) {
try {
return context.getApplicationContext().getPackageManager().getPackageInfo(packageName,
return HaloApp.getInstance().getApplication().getPackageManager().getPackageInfo(packageName,
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT).versionName;
} catch (NameNotFoundException e) {
e.printStackTrace();
@ -370,6 +380,25 @@ public class PackageUtils {
return jsonArray;
}
public static JSONObject getAppBasicInfoByPackageName(String packageName) {
JSONObject jsonObject = new JSONObject();
PackageManager pm = HaloApp.getInstance().getApplication().getPackageManager();
try {
PackageInfo packageInfo = HaloApp.getInstance().getApplication().getPackageManager().getPackageInfo(packageName,
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
jsonObject.put("name", pm.getApplicationLabel(packageInfo.applicationInfo).toString());
jsonObject.put("package", packageName);
jsonObject.put("version", packageInfo.versionName);
}
return jsonObject;
} catch (JSONException | NameNotFoundException e) {
e.printStackTrace();
return jsonObject;
}
}
/*
* 启动应用
*/

View File

@ -0,0 +1,127 @@
package com.gh.common.util
import android.Manifest
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.provider.Settings
import androidx.fragment.app.FragmentActivity
import com.tbruyelle.rxpermissions2.RxPermissions
object PermissionHelper {
@SuppressLint("CheckResult")
@JvmStatic
fun checkStoragePermissionBeforeAction(context: Context, emptyCallback: EmptyCallback) {
if (context is FragmentActivity) {
val rxPermission = RxPermissions(context)
rxPermission
.requestEachCombined(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)
.subscribe { permission ->
when {
permission.granted -> {
emptyCallback.onCallback()
}
permission.shouldShowRequestPermissionRationale -> {
DialogUtils.showPermissionDialog(context,
"权限申请",
"光环助手需要存储权限,以保证能正常使用相关功能",
"重试",
"放弃",
{ checkStoragePermissionBeforeAction(context, emptyCallback) },
null)
}
else -> {
DialogUtils.showPermissionDialog(context,
"权限申请",
"在设置-应用-光环助手-权限中开启存储权限,以保证能正常使用相关功能",
"去设置",
"放弃",
{
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:" + context.getPackageName())
context.startActivity(intent)
},
null)
}
}
}
}
}
@SuppressLint("CheckResult")
@JvmStatic
fun checkReadPhoneStateAndStoragePermissionBeforeAction(context: Context, emptyCallback: EmptyCallback) {
if (context is FragmentActivity) {
val rxPermission = RxPermissions(context)
rxPermission
.requestEachCombined(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE)
.subscribe { permission ->
when {
permission.granted -> {
emptyCallback.onCallback()
ActivationHelper.sendActivationInfo()
}
permission.shouldShowRequestPermissionRationale -> {
DialogUtils.showPermissionDialog(context, "权限申请",
"光环助手需要获取存储权限和手机信息权限,以保证能正常使用相关功能", "重试", "放弃",
{ checkStoragePermissionBeforeAction(context, emptyCallback) }, null)
}
else -> {
DialogUtils.showPermissionDialog(context, "权限申请",
"在设置-应用-光环助手-权限中开启获取存储权限和手机信息,以保证能正常使用相关功能",
"去设置",
"放弃",
{
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:" + context.getPackageName())
context.startActivity(intent)
}, null)
}
}
}
}
}
@SuppressLint("CheckResult")
@JvmStatic
fun checkReadPhoneStatePermissionBeforeAction(context: Context, emptyCallback: EmptyCallback) {
if (context is FragmentActivity) {
val rxPermission = RxPermissions(context)
rxPermission
.requestEachCombined(Manifest.permission.READ_PHONE_STATE)
.subscribe { permission ->
when {
permission.granted -> {
emptyCallback.onCallback()
ActivationHelper.sendActivationInfo()
}
permission.shouldShowRequestPermissionRationale -> {
DialogUtils.showPermissionDialog(context, "权限申请",
"光环助手需要获取手机信息权限,以保证能正常使用相关功能", "重试", "放弃",
{ checkStoragePermissionBeforeAction(context, emptyCallback) }, null)
}
else -> {
DialogUtils.showPermissionDialog(context, "权限申请",
"在设置-应用-光环助手-权限中开启获取手机信息,以保证能正常使用相关功能",
"去设置",
"放弃",
{
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:" + context.getPackageName())
context.startActivity(intent)
}, null)
}
}
}
}
}
}

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