Compare commits

...

240 Commits

Author SHA1 Message Date
f70b721441 版本更新至 5.8.0-511 2022-05-09 10:20:20 +08:00
5aa29782cc Merge branch 'hotfix-v5.8.0-510-image_blurry' into 'release'
修改社区信息流横向长图显示模糊问题

See merge request halo/android/assistant-android!241
2022-05-05 18:20:57 +08:00
8ed57cbfb8 修改社区信息流横向长图显示模糊问题 2022-05-05 14:11:22 +08:00
3144e3b007 升级 gid 依赖 2022-04-28 14:50:14 +08:00
270203266f 修复工具箱页面空指针闪退 2022-04-24 11:46:54 +08:00
0856b8a2ab 添加 ANR 上报到 BETA 渠道 2022-04-24 10:16:37 +08:00
8f95517dd7 尝试处理更新管理页面的并发操作问题 2022-04-24 10:13:56 +08:00
c828f3f479 尝试处理游戏搜索页和下载管理页的ANR问题 2022-04-24 10:13:08 +08:00
b90d026a74 尝试修复工作任务过多无法被执行的问题 2022-04-23 16:21:41 +08:00
3d6917cd5d Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/mygame/PlayedGameAdapter.kt
#	dependencies.gradle
2022-04-19 09:24:00 +08:00
e4300ab315 更新 sentry cli token 2022-04-19 09:22:18 +08:00
a93b49eb76 版本更新至 5.7.4 2022-04-18 11:48:07 +08:00
9fb25b80ea Merge branch 'hotfix-v5.7.3-494_crashes' into 'release'
处理一些闪退

See merge request halo/android/assistant-android!240
2022-04-18 11:06:01 +08:00
5c64deb874 修复游戏动态查看大图数组越界的问题 2022-04-18 10:48:37 +08:00
33cb09e201 请求登录dialog增加context有效性判断 2022-04-18 10:48:05 +08:00
032a9750e2 Merge branch 'hotfix-v5.7.3-494_crash' into 'release'
修改更新targetSdk为28以后透明activity配上portait在 8.0 设备上会闪退的问题

See merge request halo/android/assistant-android!238
2022-04-18 10:38:02 +08:00
ff6fcd038e Merge branch 'hotfix-v5.7.3-494_get_packagename_error' into 'release'
捕抓调用系统 API 获取包名的异常

See merge request halo/android/assistant-android!239
2022-04-18 10:37:21 +08:00
cc3908b416 捕抓调用系统 API 获取包名的异常 2022-04-18 10:35:02 +08:00
50a7527e7c 修改更新targetSdk为28以后透明activity配上portait在 8.0 设备上会闪退的问题 2022-04-18 10:34:22 +08:00
75e085b80a Merge branch 'hotfix-v5.7.3-494-played_game_wrong_status' into 'release'
修复玩过的游戏错误显示已卸载状态的问题

See merge request halo/android/assistant-android!237
2022-04-18 10:15:41 +08:00
39eecf0920 修复玩过的游戏错误显示已卸载状态的问题 2022-04-18 10:14:49 +08:00
cde9401b36 修复游戏动态查看大图数组越界的问题 2022-04-14 20:25:11 +08:00
4e0516e43f 版本更新至 5.7.3-494 2022-04-13 17:17:55 +08:00
d702cafc4f Merge branch 'hotfix-v5.7.2-uninstall' into 'release'
修复8.0以上设备无法插件化的问题

See merge request halo/android/assistant-android!236
2022-04-13 17:16:31 +08:00
6cd9076dff 修复8.0以上设备无法插件化的问题 2022-04-13 17:15:26 +08:00
f9d7255556 版本更新至 5.7.2-493 2022-04-12 09:50:18 +08:00
2b2cf1ca8f Merge branch 'hotfix-v5.7.1-492-fix_nullpointer_crash' into 'release'
处理空指针异常

See merge request halo/android/assistant-android!235
2022-04-12 09:48:59 +08:00
c651a97bbb 处理空指针异常 2022-04-12 09:40:53 +08:00
b54f1d125e Merge branch 'hotfix-v5.7.1-492_crash' into 'release'
修改sentry上的闪退问题

See merge request halo/android/assistant-android!232
2022-04-11 14:43:16 +08:00
ead711446d 1.修改更新targetSdk为28以后透明activity配上portait在 8.0 设备上会闪退的问题 2.修改帮助与反馈页面重建闪退问题 2022-04-11 14:43:15 +08:00
b19f0ac69c Merge branch 'hotfix-v5.7.1-492-crashes' into 'release'
修改sentry上的闪退问题

See merge request halo/android/assistant-android!234
2022-04-11 14:24:17 +08:00
25a325f7f7 Merge branch 'hotfix-v5.7.1-492-crashes' into 'dev'
修复sentry上的闪退问题

See merge request halo/android/assistant-android!233
2022-04-11 14:20:44 +08:00
8be52f7bdd 修复dialog中的lottie在非主线程执行的问题 2022-04-11 14:17:15 +08:00
3cb1cd3ba6 修复dialog中的lottie在非主线程执行的问题 2022-04-11 13:50:20 +08:00
b68a9a43de 修复青少年模式快速双击导致的闪退 2022-04-11 11:33:41 +08:00
0f80f5bc03 Merge branch 'hotfix-v5.7.1-472-out_of_bounds_crash' into 'release'
修复游戏库数组越界闪退问题

See merge request halo/android/assistant-android!231
2022-04-11 11:15:56 +08:00
647ef1d8d3 修复游戏库数组越界闪退问题 2022-04-11 11:14:18 +08:00
6c6a7f0677 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2022-04-07 09:59:52 +08:00
56dc30845a Merge branch 'hotfix-v5.7.1-492-wechat_redirect' into 'release'
修复微信内跳转无法跳转到论坛详情页的问题

See merge request halo/android/assistant-android!230
2022-04-07 09:58:46 +08:00
da14711bbc 修复微信内跳转无法跳转到论坛详情页的问题 2022-04-07 09:57:50 +08:00
33fe057a5f 版本更新至 5.7.1-492 2022-04-07 09:18:20 +08:00
5042bddec7 1.修改LoopThread名字 2.修改定时器回调到子线程 2022-04-06 17:45:52 +08:00
0803e61828 复用 Gson 对象 2022-04-06 16:21:18 +08:00
119f304e2f 尝试处理 ConnectivityManager 造成的内存泄漏问题 2022-04-06 11:35:36 +08:00
3db6f93b73 Merge branch 'release' into dev 2022-04-06 11:22:51 +08:00
3f74d8efc9 Merge branch 'hotfix-v5.7.1-491-wechat_crash' into 'release'
修复在 Android 8.0 系统上的微信登录闪退问题 https://git.shanqu.cc/halo/android/assistant-android/-/issues/56

See merge request halo/android/assistant-android!229
2022-04-06 11:21:55 +08:00
15aabc4db7 修复在 Android 8.0 系统上的微信登录闪退问题 https://git.shanqu.cc/halo/android/assistant-android/-/issues/56 2022-04-06 11:19:35 +08:00
3ed3a8d47a 版本更新至 5.7.1 2022-04-06 10:30:02 +08:00
3719f5e1cd Merge remote-tracking branch 'origin/release' into dev 2022-04-06 10:25:26 +08:00
957fca8960 Merge branch 'hotfix-v5.7.0-490-fix_wechat_redirect' into 'release'
修复微信内网页无法跳转光环首页的问题

See merge request halo/android/assistant-android!228
2022-04-06 10:23:06 +08:00
0066d2eb7b 修复微信内网页无法跳转光环首页的问题 2022-04-06 10:21:53 +08:00
cbae38b41d 修改加载图片重复调用AsyncImageLoader问题 2022-04-06 09:48:12 +08:00
6d62dd7fd1 删除多余代码 2022-04-02 17:35:07 +08:00
20d28525cf 处理加载图片时由于width获取为0导致图片占用内存过大的问题 2022-04-02 17:30:47 +08:00
lyr
3301b30ec2 优化WebFragment是否成功加载的判断逻辑(补充) 2022-04-01 15:43:50 +08:00
lyr
1f0216662a 优化WebFragment是否成功加载的判断逻辑 2022-04-01 15:03:32 +08:00
f483f1effc 清理无用 dokit 配置 2022-04-01 11:31:24 +08:00
cf5b0bcd41 添加 dokit 初始化脚本 2022-04-01 10:55:45 +08:00
4e51830c58 Update README.md 2022-04-01 09:23:51 +08:00
lyr
830a45e6d2 WebFragment网页销毁时移除JS Api 2022-03-31 21:58:27 +08:00
lyr
24c32b7a4b 【光环助手V5.8.0】游戏活动模板功能(前端部分)(优化游戏活动下载辅助类) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-31 21:56:22 +08:00
lyr
7e30f1702d Merge remote-tracking branch 'origin/dev' into dev 2022-03-31 20:57:21 +08:00
lyr
68ae4bf1b2 【光环助手V5.8.0】游戏活动模板功能(前端部分)(提供上报曝光方法) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-31 20:57:15 +08:00
0b757f24d1 缩小 Picasso 的内存 Lru size 2022-03-31 20:54:14 +08:00
lyr
99d0525c0a 【光环助手V5.8.0】游戏活动模板功能(前端部分)(0330测试 4)(增加防止web页面水平方向滑动冲突的JS Api) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-31 18:14:24 +08:00
4f3ec7aa18 处理 AppManager 的内存泄漏问题 2022-03-31 17:47:32 +08:00
bd228459fa 修复游戏详情页游戏图标的重复加载问题 2022-03-31 17:16:40 +08:00
c9227c20a2 修复列表游戏图标可能会加载不符合显示大小图片的问题 2022-03-31 17:15:31 +08:00
lyr
5270bc3ed7 【光环助手V5.8.0】游戏活动模板功能(前端部分)(0330测试 6(3)(4)) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-31 14:48:53 +08:00
e1de3dc873 缩减线程池核心规模 2022-03-31 11:37:43 +08:00
629a694279 【光环助手V5.8.0】客户端内部需求 (0328测试 1)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1746 2022-03-31 10:15:48 +08:00
lyr
48d335ad67 【光环助手V5.8.0】游戏活动模板功能(前端部分)(0328测试 9) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-29 14:23:48 +08:00
231434caeb 新增设计师用包编译脚本 2022-03-29 10:22:10 +08:00
5badb44e3e 处理编译问题 2022-03-29 09:43:11 +08:00
82d405c14c 【光环助手V5.8.0】前端优化汇总3月第2周(0328测试结果反馈4) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-28 20:32:57 +08:00
2157dcd51a Merge remote-tracking branch 'origin/dev' into dev 2022-03-28 18:38:00 +08:00
872d9d89c5 jenkins 包默认关闭 dokit 2022-03-28 18:37:52 +08:00
lyr
dae4543a82 【光环助手V5.8.0】游戏活动模板功能(前端部分)(0328测试 8) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-28 18:37:10 +08:00
60204d9ab2 测试包集成 dokit 2022-03-28 18:30:57 +08:00
0c86965260 测试包集成 dokit 2022-03-28 18:25:37 +08:00
5cd88cdb7f 【光环助手V5.8.0】客户端内部需求(0328UI测试问题1)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1746 2022-03-28 17:25:08 +08:00
60acd1bac4 【光环助手V5.8.0】前端优化汇总3月第2周(0328第4点UI测试问题1,2) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-28 17:10:01 +08:00
lyr
990efacb89 【光环助手V5.8.0】前端优化汇总3月第2周(UI测试问题 2)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755#note_140469 2022-03-28 14:27:49 +08:00
7076a6acaa 【光环助手V5.8.0】前端优化汇总3月第3周(4) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1763 2022-03-28 10:44:14 +08:00
acc4d6d8ab 【光环助手V5.8.0】前端优化汇总3月第2周(第6点UI测试问题1) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-28 10:22:29 +08:00
lyr
0a3ae4379d 【光环助手V5.8.0】游戏活动模板功能(前端部分)(优化下载) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-24 18:21:27 +08:00
lyr
8197f161c0 【光环助手V5.8.0】游戏活动模板功能(前端部分)(修复多版本游戏无法下载问题) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-24 17:10:47 +08:00
lyr
0cd5f0d640 【光环助手V5.8.0】游戏活动模板功能(前端部分)(修改判断是否完成任务的JS调用方法) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-24 11:21:41 +08:00
lyr
790093b585 处理 SonarQube 问题 2022-03-23 18:07:00 +08:00
46093c065d Merge branch 'hotfix-v5.7.0-490-category_crash' into 'release'
修复新分类页切换分类Tab可能导致的闪退问题

See merge request halo/android/assistant-android!227
2022-03-23 17:45:11 +08:00
lyr
9cc1a0dd4e 修复新分类页切换分类Tab可能导致的闪退问题 2022-03-23 17:41:23 +08:00
72a5d2881a 处理 SonarQube 问题 2022-03-23 17:31:59 +08:00
7eabb1098c 处理 SonarQube 问题 2022-03-23 17:08:36 +08:00
7a295a5d05 处理 SonarQube 问题 2022-03-23 16:36:25 +08:00
da26247d30 Merge branch 'dev-5.8.0' into dev 2022-03-23 16:02:50 +08:00
c797779598 修改帖子详情评论框弹起不能自动获取焦点问题 2022-03-23 14:49:44 +08:00
f66bf2398c 修复dialog宽度显示异常 2022-03-22 14:43:30 +08:00
lyr
010ce39e20 【光环助手V5.8.0】游戏活动模板功能(前端部分)(修改接口) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-22 14:36:38 +08:00
lyr
9320059a76 【光环助手V5.8.0】游戏活动模板功能(前端部分)(优化判断是否完成任务的JS调用方法) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-21 19:11:43 +08:00
lyr
3003a310a0 【光环助手V5.8.0】游戏活动模板功能(前端部分)(优化游戏活动页下载按钮的JS调用方法、提供判断是否完成任务的JS调用方法) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-21 18:48:15 +08:00
91af5e6fe6 【光环助手V5.8.0】后台优化汇总3月第2周 (4) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1754 2022-03-21 11:36:51 +08:00
lyr
d02dfbdaf7 【光环助手V5.8.0】游戏活动模板功能(前端部分)(提供游戏活动页下载按钮的JS调用方法) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1741 2022-03-18 18:31:46 +08:00
c3e06cc1ff 【光环助手V5.8.0】前端优化汇总3月第3周(3)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1763 2022-03-18 17:07:47 +08:00
3e86e368d8 游戏单广场选择标签后修改为不显示骨架图 2022-03-18 16:40:22 +08:00
df231d1530 【光环助手V5.8.0】游戏单功能优化 1(1) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1739 2022-03-18 16:34:51 +08:00
lyr
05abf00994 【光环助手V5.8.0】实名认证优化第五期(客户端 1、4)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1750 2022-03-17 11:59:39 +08:00
c8278f6364 修改帖子详情评论框弹起不能自动获取焦点问题 2022-03-17 11:37:11 +08:00
8cd951c669 Merge branch 'dev' into dev-5.8.0 2022-03-17 11:33:49 +08:00
c43700e4d6 【光环助手V5.8.0】前端优化汇总3月第3周(2) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1763 2022-03-17 11:11:11 +08:00
fa2174319e 优化版块页刷新按钮的显示逻辑 2022-03-17 10:48:22 +08:00
lyr
4d6a71c8be 升级Loghub配置方法 2022-03-17 10:35:35 +08:00
lyr
c866f16157 修复进入新分类2.0页-精选Tab数据为空的问题 2022-03-17 10:25:46 +08:00
b99e579ccd 调整社区推荐页列表标题和正文的文本内边距 2022-03-15 16:37:30 +08:00
f267908122 Merge branch 'dev' into dev-5.8.0 2022-03-14 16:22:32 +08:00
6128e364e6 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2022-03-14 16:20:46 +08:00
32a4fda9bc 完全移除 DataBinding(修复首页排行榜显示问题)https://git.shanqu.cc/halo/android/assistant-android/-/issues/59 2022-03-14 15:42:53 +08:00
792ce39792 Merge branch 'hotfix-v5.6.3-474-fix_gamedetail_invisible_on_some_old_devices' into 'release'
修复部分设备游戏详情页显示为空白的问题

See merge request halo/android/assistant-android!226
2022-03-14 14:47:47 +08:00
94b80b3f8b 修复部分设备游戏详情页显示为空白的问题 2022-03-14 14:43:54 +08:00
0e49985edf Merge branch 'hotfix-v5.6.3-474-crashes' into 'release'
修复查看大图、青少年模式页面闪退

See merge request halo/android/assistant-android!225
2022-03-14 11:39:55 +08:00
164f508cbc 修复查看大图、青少年模式页面闪退 2022-03-14 11:35:21 +08:00
cdfda4d963 修改我的游戏分割线显示问题 2022-03-11 16:42:54 +08:00
c3b850972f 【光环助手V5.8.0】前端优化汇总3月第2周(0311测试结果反馈4,10) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-11 16:28:26 +08:00
0e26943d25 【光环助手V5.8.0】前端优化汇总3月第2周(10) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-10 17:32:08 +08:00
8286b0137f 版本更新至 5.6.3 2022-03-10 17:22:06 +08:00
lyr
0a8bef8ac3 【光环助手V5.8.0】前端优化汇总3月第2周(3、6(游戏单详情骨架图))https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-10 17:13:53 +08:00
a8fa4cf872 修改设置页面异步获取缓存大小 2022-03-10 12:08:49 +08:00
775f454e38 【光环助手V5.8.0】前端优化汇总3月第2周 6(游戏单、游戏单广场) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755
【光环助手V5.8.0】游戏单功能优化(UI部分)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1739
2022-03-10 11:19:36 +08:00
b7de326a21 【光环助手V5.8.0】前端优化汇总3月第2周(4) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-10 09:53:06 +08:00
5b0d2e8294 缩减线程池等待队列大小 2022-03-09 15:16:29 +08:00
ec34de4675 Merge branch 'feature-optimise_filter_api' into 'dev-5.8.0'
调整启动时获取已收录游戏及游戏更新/插件化的逻辑 https://git.shanqu.cc/pm/halo-app-issues/-/issues/1746

See merge request halo/android/assistant-android!224
2022-03-09 15:11:25 +08:00
0f6aa5ca9f 调整启动时获取已收录游戏及游戏更新/插件化的逻辑 https://git.shanqu.cc/pm/halo-app-issues/-/issues/1746 2022-03-09 15:09:36 +08:00
lyr
b0cdd1029e 【光环助手V5.8.0】客户端内部需求 3(修改首页部分点击游戏item使用游戏id进入游戏详情)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1746 2022-03-08 16:41:52 +08:00
e554e9ca5f 修改游戏单详情游戏推荐理由不显示问题 2022-03-08 13:25:32 +08:00
ff879454c1 【光环助手V5.8.0】新社区3期-社区数据后台-内容数据(补充share_result埋点携带信息) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1420 2022-03-08 13:03:06 +08:00
7d3baaa501 【光环助手V5.8.0】前端优化汇总3月第2周(5,7) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-08 11:28:53 +08:00
5a57a58f0a Merge branch 'feature_remove_duplicated_files' into dev-5.8.0 2022-03-08 09:57:07 +08:00
e01bfb4676 移除完全相同的冗余资源文件 https://git.shanqu.cc/halo/android/assistant-android/-/issues/62 2022-03-08 09:53:48 +08:00
3617004de2 Merge branch 'hotfix-v5.6.2-473_simulator_not_install' into 'release'
修改第二次下载相同的游戏不能自动触发安装操作问题

See merge request halo/android/assistant-android!223
2022-03-07 18:34:28 +08:00
de8234868a 【光环助手V5.8.0】前端优化汇总3月第2周(8) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1755 2022-03-07 18:31:34 +08:00
3d31d9a435 修改第二次下载相同的游戏不能自动触发安装操作问题 2022-03-07 18:23:21 +08:00
9220f13c9e 移除完全相同的冗余资源文件 https://git.shanqu.cc/halo/android/assistant-android/-/issues/62 2022-03-07 17:42:03 +08:00
10a3ed7f15 Merge branch 'feature-remove_databinding' into dev-5.8.0
# Conflicts:
#	app/src/main/java/com/gh/gamecenter/gamedetail/fuli/GameNewsAdapter.kt
2022-03-07 11:13:08 +08:00
680ec6e285 移除搜索默认页冗余的数据库查询 2022-03-07 10:38:27 +08:00
d99fbe5292 确定 WorkManager 调用,移除日志上报 2022-03-07 10:35:31 +08:00
554eb671b2 新增开服页面还原为DataBinding 2022-03-04 14:57:48 +08:00
9f2e46d876 完全移除 DataBinding https://git.shanqu.cc/halo/android/assistant-android/-/issues/59 2022-03-04 11:09:13 +08:00
d2efb8391c 完全移除 DataBinding https://git.shanqu.cc/halo/android/assistant-android/-/issues/59 2022-03-04 10:39:23 +08:00
ac04cc4525 修改版本说明弹窗闪退问题 2022-03-03 18:52:32 +08:00
03855609c1 完全移除 DataBinding https://git.shanqu.cc/halo/android/assistant-android/-/issues/59 2022-03-03 18:03:08 +08:00
2408af31d9 Update .gitmodules 2022-03-03 10:13:12 +08:00
fc2dcbd4b0 Merge remote-tracking branch 'origin/release' into dev
# Conflicts:
#	dependencies.gradle
2022-03-02 18:13:06 +08:00
3012bf6a46 版本更新至 5.8.0 2022-03-02 17:31:07 +08:00
e07529846c 完全移除 DataBinding https://git.shanqu.cc/halo/android/assistant-android/-/issues/59 2022-03-02 17:12:38 +08:00
lyr
010c41c3c9 修复从帖子详情页点赞评论后返回论坛详情页会闪退的问题 2022-03-02 11:06:36 +08:00
lyr
d7a81d2268 完全移除 Kotlin synthetics for views https://git.shanqu.cc/halo/android/assistant-android/-/issues/58 2022-03-02 10:32:19 +08:00
afa8c776b9 修复部分游戏进入游戏详情旧专区闪退的问题 2022-03-01 15:17:39 +08:00
60cfee7ce3 修改多行输入框提示文字颜色 2022-02-28 18:24:16 +08:00
e418f5d3ea 处理 SonarQube 问题 2022-02-28 18:07:34 +08:00
80f30b82b6 【光环助手V5.7.0】光环助手UI组件库(第3期)(UI测试问题汇总补充1-2) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1698 2022-02-28 17:55:17 +08:00
1308737382 【光环助手V5.7.0】光环助手UI组件库(第3期)(UI测试问题汇总1-3) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1698 2022-02-28 16:24:53 +08:00
c1b1b2a6ce 【光环助手V5.7.0】光环助手UI组件库(第3期)(UI测试问题汇总1-3) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1698 2022-02-28 16:19:48 +08:00
3dd2b5df49 移除 Manifest 无用的 Activity 声明 2022-02-25 15:01:46 +08:00
lyr
34ac01cde8 处理 SonarQube 问题 2022-02-25 14:19:40 +08:00
lyr
c09efbfa78 【光环助手V5.7.0】游戏单功能优化(前端部分)(0224UI测试问题补充 遗留) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696#note_136637 2022-02-24 18:04:53 +08:00
lyr
054f6200f3 【光环助手V5.7.0】游戏单功能优化(前端部分)(0224UI测试问题补充 1修正) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696#note_136637 2022-02-24 17:57:41 +08:00
dabe88b703 【光环助手V5.7.0】自定义栏目优化(第二期)(0224UI测试) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1694#note_136524 2022-02-24 17:45:35 +08:00
35dee07537 【光环助手V5.7.0】游戏单功能优化(前端部分)(0224测试:1) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696 2022-02-24 15:37:27 +08:00
67e44d378c 【光环助手V5.7.0】自定义栏目优化(第二期)(0224UI测试) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1694#note_136524 2022-02-24 14:53:31 +08:00
lyr
09d9fc446e 【光环助手V5.7.0】游戏单功能优化(前端部分)(0224UI测试问题补充 1) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696#note_136491 2022-02-24 11:08:48 +08:00
1971e3bb81 修复 GameIconView 的显示问题 2022-02-24 09:43:39 +08:00
b560cdfa6e 修复登录中dialog不显示loading动画的问题
优化大图渐出动画
2022-02-23 18:17:28 +08:00
0bfdedfae8 处理 SonarQube 问题 2022-02-23 16:40:44 +08:00
5cd424a680 【光环助手V5.7.0】自定义栏目优化(第二期)(0222UI测试问题 & 0223测试) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1694#note_136262 2022-02-23 16:29:41 +08:00
lyr
012103e706 【光环助手V5.7.0】游戏单功能优化(前端部分)(UI测试问题汇总 3) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696#note_136359 2022-02-23 16:04:17 +08:00
2ad067b80d 【光环助手V5.7.0】游戏单功能优化(前端部分)(UI测试问题汇总1,2) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696 2022-02-23 14:36:45 +08:00
lyr
2f551db4c7 【光环助手V5.7.0】游戏单功能优化(前端部分)(0223测试 3) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696#note_136356 2022-02-23 14:21:21 +08:00
343aa77c86 【光环助手V5.7.0】游戏单功能优化(前端部分)(0223测试:1,2) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696 2022-02-23 12:05:12 +08:00
b7bbf8688f Merge branch 'flutter-dev' into 'dev'
更新Flutter Fresco插件(支持gif、webp)

See merge request halo/android/assistant-android!218
2022-02-23 10:25:19 +08:00
67a98023c6 更新Flutter Fresco插件(支持gif、webp) 2022-02-23 10:14:11 +08:00
f0c6486855 修改查看对话页面评论输入框UI错乱问题 2022-02-23 09:36:48 +08:00
201884643f 移除 butterknife 2022-02-22 18:34:47 +08:00
410ad346e6 【光环助手V5.7.0】新社区6期-活动管理优化(后台)(0222 验收问题5) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1608 2022-02-22 18:01:24 +08:00
782bb3a825 调整选择默认封面页面UI 2022-02-22 15:59:30 +08:00
e77b21719c 【光环助手V5.7.0】游戏单功能优化(前端部分)(9) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696 2022-02-22 15:43:00 +08:00
fffdd596d2 【光环助手V5.7.0】后台优化汇总2月第3周(9(2)) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1726 2022-02-22 15:03:31 +08:00
6e2b6cc397 移除 kotterknife 2022-02-22 14:47:54 +08:00
97ac478c8d 处理 SonarQube 问题 2022-02-22 14:44:46 +08:00
1b655f27d1 Merge branch 'release' into dev 2022-02-22 14:20:09 +08:00
32549fc16f 处理 flutter 编译脚本依赖冲突问题 2022-02-22 12:20:07 +08:00
55d83d12bb Merge remote-tracking branch 'origin/dev' into dev 2022-02-22 11:36:20 +08:00
fd1e7f7f4c 处理SonarQube问题 2022-02-22 11:36:11 +08:00
lyr
0fc5a16f80 【光环助手V5.7.0】前端优化汇总2月第3周(6)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1728 2022-02-22 11:32:14 +08:00
4992845195 处理SonarQube问题 2022-02-22 11:25:24 +08:00
e9db55bcb6 修改sonarQube问题 2022-02-22 11:15:11 +08:00
11056df05e 【光环助手V5.7.0】自定义栏目优化(第二期)(0222测试 1~4, 6) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1694 2022-02-22 11:04:57 +08:00
lyr
ffd04b6f60 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码(补充2)https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-22 10:33:48 +08:00
abdbe601b4 修改游戏单选择默认封面弹窗点击换一批卡片位置闪烁问题 2022-02-22 10:17:23 +08:00
bca7e2e4cf Merge remote-tracking branch 'origin/release' into dev 2022-02-22 09:37:54 +08:00
fcdd78d668 Merge branch 'dev-5.7.0' into dev 2022-02-22 09:33:12 +08:00
c210c3b286 【光环助手V5.7.0】游戏单功能优化(前端部分)(5) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696 2022-02-21 15:43:10 +08:00
cca1f76b85 Merge branch 'feature-issues1694' into 'dev-5.7.0'
完成【光环助手V5.7.0】自定义栏目优化(第二期) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1694

See merge request halo/android/assistant-android!214
2022-02-21 15:27:06 +08:00
f667ef562e 完成【光环助手V5.7.0】自定义栏目优化(第二期) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1694
完成【光环助手V5.7.0】自定义栏目优化(第二期)(UI 逻辑部分) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1694
2022-02-21 15:25:57 +08:00
3565214e38 【光环助手V5.7.0】前端优化汇总2月第3周(9) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1728 2022-02-21 14:55:13 +08:00
8f11ad7d6c Merge remote-tracking branch 'origin/dev-5.7.0' into dev-5.7.0 2022-02-21 10:23:16 +08:00
4612f7452f 【光环助手V5.7.0】前端优化汇总2月第3周(8) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1728 2022-02-21 10:22:52 +08:00
lyr
2850789b29 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码(补充1)https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-21 10:09:24 +08:00
bf3dbb623d 修改首页重建后点击返回键闪退问题 2022-02-18 20:49:12 +08:00
018959aa03 【光环助手V5.7.0】前端优化汇总2月第3周(7,10,12) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1728 2022-02-18 16:41:10 +08:00
f921ff6f4d 【光环助手V5.7.0】新社区6期-活动管理优化(后台)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1608 2022-02-18 14:35:03 +08:00
8a0809498a 移除无用 import 2022-02-18 11:31:19 +08:00
447e3f4421 Merge branch 'dev-5.7.0' of git.ghzs.com:halo/android/assistant-android into dev-5.7.0 2022-02-17 17:06:07 +08:00
e2172a6fe4 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码(补充1) https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-17 17:06:01 +08:00
lyr
ee1eafe5a1 【光环助手V5.7.0】前端优化汇总2月第3周(1)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1728 2022-02-16 17:26:08 +08:00
lyr
79e95a8146 【光环助手V5.7.0】游戏单功能优化(前端部分)(4 提交遗漏文件) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696 2022-02-16 16:51:20 +08:00
lyr
3d05bad997 【光环助手V5.7.0】游戏单功能优化(前端部分)(4) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696 2022-02-16 16:50:27 +08:00
09011ac18b 整理跳转工具箱代码 2022-02-16 14:59:23 +08:00
42a958a9cc Merge branch 'dev' into 'dev-5.7.0'
合并调整

See merge request halo/android/assistant-android!210
2022-02-16 10:08:37 +08:00
2922878163 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码(补充2) https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-15 17:04:59 +08:00
4608891a88 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码(补充1) https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-15 16:13:51 +08:00
c1c63d82af 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码(补充1) https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-15 11:50:54 +08:00
b78eb5a268 Merge branch 'dev-5.7.0' of git.ghzs.com:halo/android/assistant-android into dev-5.7.0 2022-02-15 10:55:20 +08:00
f9361ab134 【光环助手V5.7.0】新社区6期-帖子发布页优化 https://git.shanqu.cc/pm/halo-app-issues/-/issues/1692 2022-02-15 10:55:14 +08:00
efb6a07a13 【光环助手V5.7.0】光环助手UI组件库(第3期)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1698 2022-02-14 14:55:06 +08:00
6b0bacc018 整理游戏详情详情 tab 代码 2022-02-14 10:56:42 +08:00
9f2f0734ff 移除游戏详情详情 tab 使用的 databinding 代码 2022-02-11 15:04:13 +08:00
lyr
5d54fbde39 修复 WorkManager 失效的问题 https://git.shanqu.cc/halo/android/assistant-android/-/issues/57 2022-02-11 14:40:53 +08:00
93bfbe9c36 修复游戏单CardView在模拟器上不显示的问题 2022-02-11 10:58:49 +08:00
5e9e5c1892 【光环助手V5.7.0】游戏单功能优化(前端部分)(3) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696 2022-02-11 10:04:55 +08:00
ee3c431ef6 【光环助手V5.7.0】游戏单功能优化(前端部分)(3) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1696#note_134703 2022-02-10 17:58:54 +08:00
d4baa0b4d8 整理游戏详情详情 tab 代码 2022-02-10 15:31:13 +08:00
70b411a946 Merge branch 'feature-upgrade_targetSdk_28' into 'dev-5.7.0'
将 TargetSdk 升级到 28

See merge request halo/android/assistant-android!204
2022-02-10 11:38:27 +08:00
0e3189404e 将 TargetSdk 升级到 28 https://git.shanqu.cc/halo/android/assistant-android/-/issues/56 2022-02-10 09:28:15 +08:00
d95b2eccaf Merge remote-tracking branch 'origin/dev' into dev-5.7.0 2022-02-09 16:55:32 +08:00
4f4097a7a9 版本更新至 5.7.0 2022-02-08 10:50:38 +08:00
098639042b Merge branch 'feature-refactor_view_binding' into 'dev-5.7.0'
使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics

See merge request halo/android/assistant-android!201
2022-02-08 10:49:18 +08:00
lyr
3a9bc99f07 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码 https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-08 10:30:17 +08:00
37e1a18349 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码 https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-08 10:30:17 +08:00
3aa387a72a 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码 https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-08 10:29:19 +08:00
52cfa3def9 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码 https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-08 10:26:31 +08:00
506b3effdc 使用 ViewBinding 替换 ButterKnife/DataBinding/KotterKnife/Synthetics View 获取代码 https://git.shanqu.cc/halo/android/assistant-android/-/issues/55 2022-02-08 10:26:31 +08:00
1357 changed files with 44235 additions and 96332 deletions

4
.gitmodules vendored
View File

@ -1,7 +1,7 @@
[submodule "libraries/LGLibrary"]
path = libraries/LGLibrary
url = git@git.ghzs.com:android/common-library.git
url = git@git.shanqu.cc:android/common-library.git
branch = master
[submodule "assistant_flutter"]
path = assistant_flutter
url = git@git.ghzs.com:halo/android/flutter-module.git
url = git@git.shanqu.cc:halo/android/flutter-module.git

View File

@ -14,9 +14,9 @@
4. 遵循最小改动原则,在提交代码前务必先检查变动的代码,尽量以可控的变动规模来构成一个 commit ,以便日后追踪问题
5. 代码规范可参考 [AOSP Java 风格](https://source.android.com/setup/contribute/code-style)
6. 尽量使用 Kotlin 来写新文件
7. 尽量不要使用 DataBinding,因为回影响编译性能
7. 尽量不要使用 DataBinding
8. Commit 前请确保不带入非项目必须文件,可手动修改 [.gitignore](https://stackoverflow.com/questions/8527597/how-do-i-ignore-files-in-a-directory-in-git) 文件忽略
9. 新页面请勿使用 ButterKnife 来进行 View 获取和绑定,请使用 ViewBinding
9. 优先使用 ViewBinding 获取 View 对象
10. No AsyncTask!
### 公用部分
@ -25,7 +25,7 @@
### 首次拉取项目代码
`git clone -b dev git@git.ghzs.com:halo/android/assistant-android.git --recursive`
`git clone -b dev git@git.shanqu.cc:halo/android/assistant-android.git --recursive`
### git 版本管理
@ -45,8 +45,8 @@
### 第三方appkey等配置
* 修改`gradle.properties`文件将各种key填入其中实现统一管理
* 通过gradle文件内的resValue/buildConfigField/manifestPlaceHolder方式实现编译期间修改具体情况请参考``./build.gradle````./app/build.gradle``配置
* 修改 `gradle.properties` 文件将各种key填入其中实现统一管理
* 通过 gradle 文件内的 resValue/buildConfigField/manifestPlaceHolder 方式实现编译期间修改,具体情况请参考 ``./build.gradle````./app/build.gradle`` 配置
### 混淆配置
@ -55,11 +55,8 @@
### APK打包配置
* 本项目使用了 [VasDolly](https://github.com/Tencent/VasDolly) 作为渠道包实现方案
* 打包命令,具体参数请见相应文件:
> 打内部测试包:`./scripts/test_build.sh`
> 正式发布包:`./scripts/build_with_simple_backup.sh`
> 邮件测试包:`./scripts/jenkins_build.sh`
### TODO

View File

@ -1,7 +1,7 @@
// This comment exists for a reason, do not delete
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' // kotlin
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'AndResGuard'
@ -9,13 +9,9 @@ import groovy.xml.XmlUtil
android {
androidExtensions {
experimental = true
}
buildFeatures {
viewBinding = true
dataBinding = true
viewBinding true
dataBinding true
}
compileOptions {
@ -218,6 +214,7 @@ dependencies {
debugImplementation "com.squareup.okhttp3:logging-interceptor:${okHttp}"
// debugImplementation "com.gu.android:toolargetool:${toolargetool}" // 需要使用调试时才启用
debugImplementation "com.github.nichbar:WhatTheStack:${whatTheStack}"
debugImplementation "io.github.didi.dokit:dokitx:${dokit}"
implementation "androidx.core:core-ktx:${core}"
implementation "androidx.fragment:fragment-ktx:${fragment}"
@ -230,6 +227,7 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifeCycle"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifeCycle"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifeCycle"
implementation "androidx.lifecycle:lifecycle-extensions:$lifeCycleExtensions"
implementation "androidx.room:room-runtime:${room}"
implementation "androidx.room:room-rxjava2:${room}"
implementation "androidx.core:core-ktx:${ktx}"
@ -258,8 +256,6 @@ dependencies {
implementation "com.j256.ormlite:ormlite-android:${ormlite}"
implementation "com.j256.ormlite:ormlite-core:${ormlite}"
implementation "com.jakewharton:butterknife:${butterKnife}"
kapt "com.jakewharton:butterknife-compiler:${butterKnife}"
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
implementation "org.greenrobot:eventbus:${eventbus}"
@ -299,7 +295,7 @@ dependencies {
})
implementation "com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:$gsyVideo"
implementation "android.arch.work:work-runtime:${workManager}"
implementation "androidx.work:work-runtime:${workManager}"
implementation "com.llew.huawei:verifier:${verifier}"
@ -347,7 +343,7 @@ dependencies {
implementation "com.louiscad.splitties:splitties-fun-pack-android-base-with-views-dsl:${splitties}"
compileOnly "com.github.axen1314.lancet:lancet-base:$lancet_version"
compileOnly "com.github.axen1314.lancet:lancet-base:${lancet_version}"
implementation project(':libraries:LGLibrary')
implementation project(':libraries:QQShare')

View File

@ -41,12 +41,6 @@
-keepclassmembers class cn.trinea.android.* { *; }
-dontwarn cn.trinea.android.**
### Butterknife
-keep public class * implements butterknife.Unbinder { public <init>(**, android.view.View); }
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }
### eventbus
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe <methods>;
@ -153,6 +147,9 @@
### emoji4j
-keep class emoji4j.* {*;}
### dokit
-keep class com.didichuxing.** {*;}
# Flutter模块
-keep class com.gh.common.util.DirectUtils {
public static void directToQa(...);

View File

@ -25,6 +25,8 @@
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<!-- 允许应用程序快捷方式 -->
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<!-- 前台服务权限-->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
@ -32,6 +34,8 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<!-- 如果有视频相关的广告且使用textureView播放请务必添加否则黑屏 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
@ -161,8 +165,7 @@
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.WebActivity"
android:screenOrientation="portrait" />
android:name="com.gh.gamecenter.WebActivity" />
<activity
android:name="com.gh.gamecenter.SingletonWebActivity"
@ -240,11 +243,6 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
<activity
android:name="com.gh.gamecenter.ToolBoxActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.gh.gamecenter.WeiBoShareActivity"
android:screenOrientation="portrait"
@ -284,18 +282,10 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.gh.gamecenter.qa.search.AskSearchActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name=".qa.answer.fold.AnswerFoldActivity"
android:screenOrientation="portrait" />
@ -316,14 +306,6 @@
android:name="com.gh.gamecenter.MessageKeFuActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.select.CommunitiesSelectActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.subject.CommunitySubjectActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.MessageInviteActivity"
android:screenOrientation="portrait" />
@ -340,10 +322,6 @@
android:name="com.gh.gamecenter.qa.myqa.MyAskActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.column.order.AskTabOrderActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.questions.edit.QuestionEditActivity"
android:screenOrientation="portrait" />
@ -365,10 +343,6 @@
android:name="com.gh.gamecenter.amway.AmwayActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.column.detail.AskColumnDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.NetworkDiagnosisActivity"
android:screenOrientation="portrait" />
@ -414,14 +388,6 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" />
<activity
android:name="com.gh.gamecenter.qa.questions.edit.manager.HistoryDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.questions.edit.manager.HistoryActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.editor.InsertAnswerWrapperActivity"
android:screenOrientation="portrait" />
@ -455,10 +421,6 @@
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.video.videomanager.VideoManagerActivity"
android:screenOrientation="portrait" />
@ -507,13 +469,11 @@
<activity
android:name="com.gh.gamecenter.qa.comment.CommentActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Transparent"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name=".qa.dialog.ChooseForumActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Transparent"
android:windowSoftInputMode="adjustNothing" />
@ -668,7 +628,6 @@
<activity
android:name=".qa.editor.FullScreenVideoActivity"
android:screenOrientation="landscape"
android:theme="@style/AppFullScreenTheme" />
<activity
@ -764,6 +723,10 @@
android:name=".qa.editor.InsertGameCollectionWrapperActivity"
android:screenOrientation="portrait" />
<activity
android:name=".qa.editor.InsertVideoWrapperActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.toolbox.ToolBoxBlockActivity"
android:screenOrientation="portrait" />
@ -773,7 +736,6 @@
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity>
<!-- <activity-->
@ -793,9 +755,16 @@
</provider>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove" />
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<!-- If you are using androidx.startup to initialize other components -->
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>
<receiver
android:name="com.gh.gamecenter.receiver.DownloadReceiver"
@ -820,48 +789,6 @@
</intent-filter>
</receiver>
<!-- <receiver android:name="com.gh.gamecenter.receiver.UmengMessageReceiver">-->
<!-- <intent-filter>-->
<!-- <action android:name="com.gh.gamecenter.UMENG" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- &lt;!&ndash;魅族push应用定义消息receiver声明 &ndash;&gt;-->
<!-- <receiver android:name="com.gh.gamecenter.receiver.UmengMeizuPushReceiver">-->
<!-- <intent-filter>-->
<!-- &lt;!&ndash; 接收push消息 &ndash;&gt;-->
<!-- <action android:name="com.meizu.flyme.push.intent.MESSAGE" />-->
<!-- &lt;!&ndash; 接收register消息 &ndash;&gt;-->
<!-- <action android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK" />-->
<!-- &lt;!&ndash; 接收unregister消息&ndash;&gt;-->
<!-- <action android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK" />-->
<!-- &lt;!&ndash; 兼容低版本Flyme3推送服务配置 &ndash;&gt;-->
<!-- <action android:name="com.meizu.c2dm.intent.REGISTRATION" />-->
<!-- <action android:name="com.meizu.c2dm.intent.RECEIVE" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name="com.gh.common.im.ImReceiver"-->
<!-- android:enabled="true">-->
<!-- <intent-filter android:priority="2147483647">-->
<!-- <action android:name="com.gh.im" />-->
<!-- <action android:name="action_finish" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <meta-data-->
<!-- android:name="com.huawei.hms.client.appid"-->
<!-- android:value="@string/huawei_push_appid" />-->
<!-- <service-->
<!-- android:name="com.gh.base.GHUmengNotificationService"-->
<!-- android:permission="android.permission.BIND_JOB_SERVICE" />-->
<!--<service android:name = "com.gh.gamecenter.statistics.AppStaticService" />-->
<!-- 梦工厂配置 开始 -->
<!--<meta-data
android:name="MGC_APPID"

View File

@ -0,0 +1 @@
{"v":"5.6.9","fr":60,"ip":0,"op":76,"w":90,"h":90,"nm":"loading","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":2,"ty":4,"nm":"圆环1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[45,45,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":0,"k":[63,63],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.75],"y":[0.833]},"o":{"x":[0.25],"y":[0.167]},"t":28,"s":[0]},{"t":76,"s":[96]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.75],"y":[0.833]},"o":{"x":[0.25],"y":[0.167]},"t":0,"s":[4]},{"t":48,"s":[100]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.75],"y":[0.712]},"o":{"x":[0.25],"y":[0.288]},"t":0,"s":[-7.2]},{"t":76,"s":[367.2]}],"ix":3},"m":1,"ix":2,"nm":"修剪路径 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0.141176477075,0.588235318661,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":76,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"圆环2","sr":1,"ks":{"o":{"a":0,"k":40,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[45,45,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":0,"k":[63,63],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.75],"y":[0.861]},"o":{"x":[0.25],"y":[0.139]},"t":36,"s":[0]},{"t":76,"s":[96]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.75],"y":[0.806]},"o":{"x":[0.25],"y":[0.194]},"t":0,"s":[4]},{"t":56,"s":[100]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.75],"y":[0.712]},"o":{"x":[0.25],"y":[0.288]},"t":0,"s":[-7.2]},{"t":76,"s":[367.2]}],"ix":3},"m":1,"ix":2,"nm":"修剪路径 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0.141176477075,0.588235318661,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":76,"st":0,"bm":0}],"markers":[{"tm":-5940,"cm":"S:[false]","dr":0},{"tm":0.740234375,"cm":"FOCUSED -- TO SELECTION","dr":0}]}

View File

@ -0,0 +1 @@
{"v":"5.6.9","fr":60,"ip":0,"op":36,"w":120,"h":66,"nm":"开关动画-关闭","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"按钮手柄","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.667,"y":0},"t":0,"s":[87,33,0],"to":[7.682,0,0],"ti":[-13.443,0,0]},{"i":{"x":0.333,"y":1},"o":{"x":0.333,"y":0},"t":18,"s":[31,33,0],"to":[2.306,0,0],"ti":[-1.318,0,0]},{"t":24,"s":[33,33,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[16,16],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":37,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"指示器-on","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.667],"y":[0]},"t":0,"s":[100]},{"t":18,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.667,0.667],"y":[0,0]},"t":0,"s":[6.5,6.5]},{"t":18,"s":[4.5,4.5]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.966666666667,0.966666666667,0.966666666667,0.420000005762],"ix":3},"o":{"a":0,"k":40,"ix":4},"w":{"a":0,"k":1.5,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":37,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"指示器-off","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[87,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":1,"k":[{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.667,0.667],"y":[0,0]},"t":0,"s":[1.5,4]},{"t":18,"s":[1.5,6]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0.75,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":5,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":90,"ix":6},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.667],"y":[0]},"t":0,"s":[0]},{"t":18,"s":[100]}],"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":37,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"按钮背景","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[60,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"sy":[{"c":{"a":0,"k":[0,0,0,1],"ix":2},"o":{"a":0,"k":5,"ix":3},"a":{"a":0,"k":120,"ix":5},"s":{"a":0,"k":1,"ix":8},"d":{"a":0,"k":0,"ix":6},"ch":{"a":0,"k":100,"ix":7},"bm":{"a":0,"k":5,"ix":1},"no":{"a":0,"k":0,"ix":9},"ty":2,"nm":"内阴影"}],"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[40,22],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":12,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.667],"y":[0]},"t":0,"s":[0.141176477075,0.588235318661,1,1]},{"t":18,"s":[0.933333337307,0.933333337307,0.933333337307,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"filling","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0.118,0.006],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":37,"st":0,"bm":0}],"markers":[]}

View File

@ -0,0 +1 @@
{"v":"5.6.9","fr":60,"ip":0,"op":36,"w":120,"h":66,"nm":"开关动画-打开","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"按钮手柄","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.667,"y":0},"t":0,"s":[33,33,0],"to":[7.682,0,0],"ti":[-13.443,0,0]},{"i":{"x":0.333,"y":1},"o":{"x":0.333,"y":0},"t":18,"s":[89,33,0],"to":[2.306,0,0],"ti":[-1.318,0,0]},{"t":24,"s":[87,33,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[16,16],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":37,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"指示器-on","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.667],"y":[0]},"t":0,"s":[0]},{"t":18,"s":[100]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.667,0.667],"y":[0,0]},"t":0,"s":[4.5,4.5]},{"t":18,"s":[6.5,6.5]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.966666666667,0.966666666667,0.966666666667,0.420000005762],"ix":3},"o":{"a":0,"k":40,"ix":4},"w":{"a":0,"k":1.5,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":37,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"指示器-off","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[87,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":1,"k":[{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.667,0.667],"y":[0,0]},"t":0,"s":[1.5,6]},{"t":18,"s":[1.5,4]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0.75,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":5,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":90,"ix":6},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.667],"y":[0]},"t":0,"s":[100]},{"t":18,"s":[0]}],"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":37,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"按钮背景","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[60,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"sy":[{"c":{"a":0,"k":[0,0,0,1],"ix":2},"o":{"a":0,"k":5,"ix":3},"a":{"a":0,"k":120,"ix":5},"s":{"a":0,"k":1,"ix":8},"d":{"a":0,"k":0,"ix":6},"ch":{"a":0,"k":100,"ix":7},"bm":{"a":0,"k":5,"ix":1},"no":{"a":0,"k":0,"ix":9},"ty":2,"nm":"内阴影"}],"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[40,22],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":12,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.667],"y":[0]},"t":0,"s":[0.933332979679,0.933332979679,0.933332979679,1]},{"t":18,"s":[0.141176477075,0.588235318661,1,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"filling","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0.118,0.006],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":37,"st":0,"bm":0}],"markers":[]}

File diff suppressed because it is too large Load Diff

View File

@ -63,7 +63,6 @@ import org.json.JSONObject;
import java.lang.ref.WeakReference;
import java.util.List;
import butterknife.ButterKnife;
import kotlin.Pair;
import pub.devrel.easypermissions.EasyPermissions;
@ -131,7 +130,6 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
super.onCreate(savedInstanceState);
if (useEventBus()) EventBus.getDefault().register(this);
if (useButterKnife()) ButterKnife.bind(this);
mEntrance = getIntent().getStringExtra(KEY_ENTRANCE);
if (TextUtils.isEmpty(mEntrance)) {
mEntrance = Constants.ENTRANCE_UNKNOWN;
@ -387,10 +385,6 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
return true;
}
protected boolean useButterKnife() {
return true;
}
@Override
public Resources getResources() {
Resources resources = super.getResources();

View File

@ -17,7 +17,6 @@ import java.util.List;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
/**
* Created by khy on 15/03/18.
@ -27,14 +26,9 @@ public abstract class BaseActivity_TabLayout extends ToolBarActivity implements
public static final String PAGE_INDEX = "PAGE_INDEX";
@BindView(R.id.activity_tab_layout)
protected TabLayout mTabLayout;
@BindView(R.id.activity_view_pager)
protected NoScrollableViewPager mViewPager;
@BindView(R.id.activity_tab_indicator)
protected TabIndicatorView mTabIndicatorView;
@Nullable
@BindView(R.id.dividerLine)
protected View mDividerLineView;
protected List<Fragment> mFragmentsList;
@ -74,6 +68,12 @@ public abstract class BaseActivity_TabLayout extends ToolBarActivity implements
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mTabLayout = findViewById(R.id.activity_tab_layout);
mViewPager = findViewById(R.id.activity_view_pager);
mTabIndicatorView = findViewById(R.id.activity_tab_indicator);
mDividerLineView = findViewById(R.id.dividerLine);
if (getIntent() != null) mCheckedIndex = getIntent().getIntExtra(PAGE_INDEX, 0);
mTabTitleList = new ArrayList<>();
initTabTitleList(mTabTitleList);

View File

@ -3,8 +3,6 @@ package com.gh.base;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import butterknife.ButterKnife;
/**
* 目前仅提供butterknife bind方法
*
@ -20,7 +18,6 @@ public abstract class BaseRecyclerViewHolder<T> extends RecyclerView.ViewHolder
public BaseRecyclerViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
/**

View File

@ -14,17 +14,13 @@ import android.widget.CheckBox
import android.widget.FrameLayout
import android.widget.TextView
import androidx.lifecycle.Observer
import butterknife.OnClick
import com.gh.common.AppExecutor
import com.gh.common.runOnIoThread
import com.gh.common.util.*
import com.gh.common.view.RichEditor
import com.gh.gamecenter.CropImageActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.entity.GamesCollectionEntity
import com.gh.gamecenter.entity.LocalVideoEntity
import com.gh.gamecenter.entity.VideoEntity
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.qa.editor.*
import com.gh.gamecenter.qa.entity.AnswerEntity
import com.gh.gamecenter.qa.entity.ArticleEntity
@ -37,7 +33,6 @@ import com.lightgame.utils.Util_System_Keyboard
import com.lightgame.utils.Utils
import com.lightgame.view.CheckableImageView
import io.reactivex.disposables.Disposable
import kotterknife.bindView
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
@ -45,30 +40,30 @@ import java.io.File
abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarActivity(),
KeyboardHeightObserver, UploadVideoListener {
val mRichEditor by bindView<RichEditor>(R.id.rich_editor)
lateinit var mRichEditor: RichEditor
private val mEditorTextNumTv by bindView<TextView>(R.id.editorTextNumTv)
private val mEditorFont by bindView<CheckableImageView>(R.id.editor_font)
private val mEditorLink by bindView<CheckableImageView>(R.id.editor_link)
private lateinit var mEditorTextNumTv: TextView
private lateinit var mEditorFont: CheckableImageView
private lateinit var mEditorLink: CheckableImageView
private val mEditorFontBold by bindView<CheckableImageView>(R.id.editor_font_bold)
private val mEditorFontItalic by bindView<CheckableImageView>(R.id.editor_font_italic)
private val mEditorFontStrikeThrough by bindView<CheckableImageView>(R.id.editor_font_strikethrough)
private val mEditorFontUnderline by bindView<CheckableImageView>(R.id.editor_font_underline)
private val mEditorParagraphH1 by bindView<CheckableImageView>(R.id.editor_paragraph_h1)
private val mEditorParagraphH2 by bindView<CheckableImageView>(R.id.editor_paragraph_h2)
private val mEditorParagraphH3 by bindView<CheckableImageView>(R.id.editor_paragraph_h3)
private val mEditorParagraphH4 by bindView<CheckableImageView>(R.id.editor_paragraph_h4)
private val mEditorParagraphQuote by bindView<CheckableImageView>(R.id.editor_paragraph_quote)
private val mEditorFontContainer by bindView<View>(R.id.editor_font_container)
private val mEditorParagraphContainer by bindView<View>(R.id.editor_paragraph_container)
private val mEditorLinkContainer by bindView<View>(R.id.editor_link_container)
private val mEditorInsertDetailContainer by bindView<View>(R.id.editor_insert_detail_container)
private val mTagsContainer by bindView<FrameLayout>(R.id.tagsContainer)
private val mUploadVideoGuideContainer by bindView<View>(R.id.uploadVideoGuideContainer)
protected val mOriginalCb by bindView<CheckBox>(R.id.originalCb)
private val mOriginalTipsContainer by bindView<View>(R.id.originalTipsContainer)
private val mOriginalTipsClose by bindView<TextView>(R.id.originalTipsClose)
private lateinit var mEditorFontBold: CheckableImageView
private lateinit var mEditorFontItalic: CheckableImageView
private lateinit var mEditorFontStrikeThrough: CheckableImageView
private lateinit var mEditorFontUnderline: CheckableImageView
private lateinit var mEditorParagraphH1: CheckableImageView
private lateinit var mEditorParagraphH2: CheckableImageView
private lateinit var mEditorParagraphH3: CheckableImageView
private lateinit var mEditorParagraphH4: CheckableImageView
private lateinit var mEditorParagraphQuote: CheckableImageView
private lateinit var mEditorFontContainer: View
private lateinit var mEditorParagraphContainer: View
private lateinit var mEditorLinkContainer: View
private lateinit var mEditorInsertDetailContainer: View
private lateinit var mTagsContainer: FrameLayout
private lateinit var mUploadVideoGuideContainer: View
protected lateinit var mOriginalCb: CheckBox
private lateinit var mOriginalTipsContainer: View
private lateinit var mOriginalTipsClose: TextView
private var mCurrentParagraphStyle = ""
private var mIsExtendedKeyboardShow = false
@ -123,10 +118,8 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
REQUEST_CODE_IMAGE -> {
if (data != null) mViewModel.uploadPic(data)
}
INSERT_VIDEO_CODE -> {
val localVideoList =
data?.getParcelableArrayListExtra<LocalVideoEntity>(LocalVideoEntity::class.java.name)
?: arrayListOf()
INSERT_MEDIA_VIDEO_CODE -> {
val localVideoList = data?.getParcelableArrayListExtra<LocalVideoEntity>(LocalVideoEntity::class.java.name) ?: arrayListOf()
if (localVideoList.isNotEmpty()) {
mRichEditor.focusEditor()
uploadVideo(localVideoList)
@ -138,6 +131,14 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mViewModel.uploadPoster(imagePath)
}
}
INSERT_VIDEO_CODE -> {
val videoEntity = data?.getParcelableExtra<MyVideoEntity>(MyVideoEntity::class.java.simpleName)
if (videoEntity != null) {
mRichEditor.focusEditor()
insertData = EditorInsertEntity.transform(videoEntity)
mRichEditor.insertCustomStyleLink(insertData)
}
}
}
closeExtendedKeyboard()
AppExecutor.uiExecutor.executeWithDelay(Runnable {
@ -170,9 +171,36 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
}
private fun findView() {
mRichEditor = findViewById(R.id.rich_editor)
mEditorTextNumTv = findViewById(R.id.editorTextNumTv)
mEditorFont = findViewById(R.id.editor_font)
mEditorLink = findViewById(R.id.editor_link)
mEditorFontBold = findViewById(R.id.editor_font_bold)
mEditorFontItalic = findViewById(R.id.editor_font_italic)
mEditorFontStrikeThrough = findViewById(R.id.editor_font_strikethrough)
mEditorFontUnderline = findViewById(R.id.editor_font_underline)
mEditorParagraphH1 = findViewById(R.id.editor_paragraph_h1)
mEditorParagraphH2 = findViewById(R.id.editor_paragraph_h2)
mEditorParagraphH3 = findViewById(R.id.editor_paragraph_h3)
mEditorParagraphH4 = findViewById(R.id.editor_paragraph_h4)
mEditorParagraphQuote = findViewById(R.id.editor_paragraph_quote)
mEditorFontContainer = findViewById(R.id.editor_font_container)
mEditorParagraphContainer = findViewById(R.id.editor_paragraph_container)
mEditorLinkContainer = findViewById(R.id.editor_link_container)
mEditorInsertDetailContainer = findViewById(R.id.editor_insert_detail_container)
mTagsContainer = findViewById(R.id.tagsContainer)
mUploadVideoGuideContainer = findViewById(R.id.uploadVideoGuideContainer)
mOriginalCb = findViewById(R.id.originalCb)
mOriginalTipsContainer = findViewById(R.id.originalTipsContainer)
mOriginalTipsClose = findViewById(R.id.originalTipsClose)
}
@SuppressLint("AddJavascriptInterface", "ClickableViewAccessibility")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
findView()
onRichClick()
mViewModel = provideViewModel()
mViewModel.setUploadVideoListener(this)
mKeyboardHeightProvider = KeyboardHeightProvider(this)
@ -247,161 +275,156 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mEditorFont.isEnabled = isEnabled
}
@OnClick(
R.id.editor_image, R.id.editor_font, R.id.editor_link, R.id.editor_font_underline,
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_link_answer, R.id.editor_link_article,
R.id.editor_link_game, R.id.editor_link_video, R.id.uploadVideoGuideClose,
R.id.originalTipsClose, R.id.editor_link_game_collection
)
fun onRichClick(view: View) {
when (view.id) {
R.id.editor_font -> {
controlEditorFontContainer()
private fun onRichClick() {
mEditorFont.setOnClickListener {
controlEditorFontContainer()
}
mEditorLink.setOnClickListener {
controlEditorLinkContainer()
}
mEditorFontBold.setOnClickListener {
mEditorFontBold.isChecked = !mEditorFontBold.isChecked
mRichEditor.setBold()
if (mEditorFontBold.isChecked) {
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-加粗")
}
R.id.editor_link -> {
controlEditorLinkContainer()
}
mEditorFontItalic.setOnClickListener {
mEditorFontItalic.isChecked = !mEditorFontItalic.isChecked
mRichEditor.setItalic()
if (mEditorFontItalic.isChecked) {
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-斜体")
}
R.id.editor_font_bold -> {
mEditorFontBold.isChecked = !mEditorFontBold.isChecked
mRichEditor.setBold()
if (mEditorFontBold.isChecked) {
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-加粗")
}
}
R.id.editor_font_italic -> {
mEditorFontItalic.isChecked = !mEditorFontItalic.isChecked
mRichEditor.setItalic()
if (mEditorFontItalic.isChecked) {
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-斜体")
}
}
R.id.editor_font_strikethrough -> {
mEditorFontStrikeThrough.isChecked = !mEditorFontStrikeThrough.isChecked
mRichEditor.setStrikeThrough()
}
mEditorFontStrikeThrough.setOnClickListener {
mEditorFontStrikeThrough.isChecked = !mEditorFontStrikeThrough.isChecked
mRichEditor.setStrikeThrough()
if (mEditorFontStrikeThrough.isChecked) {
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-删除线")
}
if (mEditorFontStrikeThrough.isChecked) {
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-删除线")
}
R.id.editor_font_underline -> {
mEditorFontUnderline.isChecked = !mEditorFontUnderline.isChecked
mRichEditor.setUnderline()
}
mEditorFontUnderline.setOnClickListener {
mEditorFontUnderline.isChecked = !mEditorFontUnderline.isChecked
mRichEditor.setUnderline()
if (mEditorFontUnderline.isChecked) {
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-下滑线")
}
if (mEditorFontUnderline.isChecked) {
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-下滑线")
}
R.id.editor_paragraph_h1 -> {
if (mEditorParagraphH1.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-1级标题")
mRichEditor.setHeading(1)
}
mEditorParagraphH1.isChecked = !mEditorParagraphH1.isChecked
}
mEditorParagraphH1.setOnClickListener {
if (mEditorParagraphH1.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-1级标题")
mRichEditor.setHeading(1)
}
R.id.editor_paragraph_h2 -> {
if (mEditorParagraphH2.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-2级标题")
mRichEditor.setHeading(2)
}
mEditorParagraphH2.isChecked = !mEditorParagraphH2.isChecked
mEditorParagraphH1.isChecked = !mEditorParagraphH1.isChecked
}
mEditorParagraphH2.setOnClickListener {
if (mEditorParagraphH2.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-2级标题")
mRichEditor.setHeading(2)
}
R.id.editor_paragraph_h3 -> {
if (mEditorParagraphH3.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-3级标题")
mRichEditor.setHeading(3)
}
mEditorParagraphH3.isChecked = !mEditorParagraphH3.isChecked
mEditorParagraphH2.isChecked = !mEditorParagraphH2.isChecked
}
mEditorParagraphH3.setOnClickListener {
if (mEditorParagraphH3.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-3级标题")
mRichEditor.setHeading(3)
}
R.id.editor_paragraph_h4 -> {
if (mEditorParagraphH4.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-4级标题")
mRichEditor.setHeading(4)
}
mEditorParagraphH4.isChecked = !mEditorParagraphH4.isChecked
mEditorParagraphH3.isChecked = !mEditorParagraphH3.isChecked
}
mEditorParagraphH4.setOnClickListener {
if (mEditorParagraphH4.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-4级标题")
mRichEditor.setHeading(4)
}
R.id.editor_paragraph_quote -> {
if (mEditorParagraphQuote.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-引用")
mRichEditor.setBlockquote()
}
mEditorParagraphQuote.isChecked = !mEditorParagraphQuote.isChecked
mEditorParagraphH4.isChecked = !mEditorParagraphH4.isChecked
}
mEditorParagraphQuote.setOnClickListener {
if (mEditorParagraphQuote.isChecked) {
mRichEditor.formatBlock()
} else {
MtaHelper.onEvent(mtaEventName(), "段落样式", "段落样式-引用")
mRichEditor.setBlockquote()
}
R.id.editor_link_answer -> {
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-回答")
startActivityForResult(
InsertAnswerWrapperActivity.getIntent(this),
INSERT_ANSWER_CODE
mEditorParagraphQuote.isChecked = !mEditorParagraphQuote.isChecked
}
findViewById<View>(R.id.editor_link_answer).setOnClickListener {
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-回答")
startActivityForResult(
InsertAnswerWrapperActivity.getIntent(this),
INSERT_ANSWER_CODE
)
}
findViewById<View>(R.id.editor_link_article).setOnClickListener {
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-文章")
startActivityForResult(
InsertArticleWrapperActivity.getIntent(this),
INSERT_ARTICLE_CODE
)
}
findViewById<View>(R.id.editor_link_game).setOnClickListener {
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-游戏")
startActivityForResult(
GameActivity.getIntent(this, GameActivity.INSERT_GAME_TITLE),
INSERT_GAME_CODE
)
}
findViewById<View>(R.id.editor_link_video).setOnClickListener {
startActivityForResult(
InsertVideoWrapperActivity.getIntent(this),
INSERT_VIDEO_CODE
)
}
findViewById<View>(R.id.editor_link_game_collection).setOnClickListener {
startActivityForResult(
InsertGameCollectionWrapperActivity.getIntent(this),
INSERT_GAME_COLLECTION_CODE
)
}
findViewById<View>(R.id.editor_video).setOnClickListener {
chooseVideo()
}
findViewById<View>(R.id.editor_image).setOnClickListener {
if (!mAgreePostPic && !NetworkUtils.isWifiOr4GOr3GConnected(this)) {
mAgreePostPic = true
DialogHelper.showDialog(
this,
"警告",
"当前使用移动网络,上传图片会消耗手机流量",
"我知道了", "", { chooseImage() },
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
return@setOnClickListener
}
R.id.editor_link_article -> {
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-文章")
startActivityForResult(
InsertArticleWrapperActivity.getIntent(this),
INSERT_ARTICLE_CODE
)
chooseImage()
NewLogUtils.logChooseMedia(
"view_media",
if (mtaEventName() == "提问帖") "提问帖" else "帖子",
"图片"
)
}
findViewById<View>(R.id.uploadVideoGuideClose).setOnClickListener {
hideUploadVideoGuide()
if (mGuideDisposable != null && !mGuideDisposable!!.isDisposed) {
mGuideDisposable!!.dispose()
mGuideDisposable = null
}
R.id.editor_link_game -> {
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-游戏")
startActivityForResult(
GameActivity.getIntent(this, GameActivity.INSERT_GAME_TITLE),
INSERT_GAME_CODE
)
}
R.id.editor_link_game_collection -> {
startActivityForResult(
InsertGameCollectionWrapperActivity.getIntent(this),
INSERT_GAME_COLLECTION_CODE
)
}
R.id.editor_link_video -> {
chooseVideo()
}
R.id.editor_image -> {
if (!mAgreePostPic && !NetworkUtils.isWifiOr4GOr3GConnected(this)) {
mAgreePostPic = true
DialogHelper.showDialog(
this,
"警告",
"当前使用移动网络,上传图片会消耗手机流量",
"我知道了", "", { chooseImage() },
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
return
}
chooseImage()
NewLogUtils.logChooseMedia(
"view_media",
if (mtaEventName() == "提问帖") "提问帖" else "帖子",
"图片"
)
}
R.id.uploadVideoGuideClose -> {
hideUploadVideoGuide()
if (mGuideDisposable != null && !mGuideDisposable!!.isDisposed) {
mGuideDisposable!!.dispose()
mGuideDisposable = null
}
}
R.id.originalTipsClose -> {
val animator = ObjectAnimator.ofFloat(mOriginalTipsContainer, "alpha", 1f, 0f).setDuration(200)
animator.doOnEnd {
mOriginalTipsContainer.visibility = View.GONE
}
animator.start()
}
findViewById<View>(R.id.originalTipsClose).setOnClickListener {
val animator = ObjectAnimator.ofFloat(mOriginalTipsContainer, "alpha", 1f, 0f).setDuration(200)
animator.doOnEnd {
mOriginalTipsContainer.visibility = View.GONE
}
animator.start()
}
}
@ -423,7 +446,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
LocalMediaActivity.ChooseType.VIDEO,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
), INSERT_VIDEO_CODE
), INSERT_MEDIA_VIDEO_CODE
)
NewLogUtils.logChooseMedia(
"view_media",
@ -727,11 +750,12 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
const val INSERT_ARTICLE_CODE = 412
const val INSERT_GAME_CODE = 413
const val INSERT_GAME_COLLECTION_CODE = 414
const val INSERT_VIDEO_CODE = 415
const val MAX_INPUT_TEXT_NUM = 10000
const val MAX_MEDIA_COUNT = 20
const val REQUEST_CODE_IMAGE = 120
const val INSERT_VIDEO_CODE = 121
const val INSERT_MEDIA_VIDEO_CODE = 121
const val REQUEST_CODE_IMAGE_CROP = 122
}
}

View File

@ -91,7 +91,7 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
}
override fun onActivityDestroyed(activity: Activity) {
// do nothing
AppManager.getInstance().finishActivity(activity)
}
}

View File

@ -38,7 +38,6 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import butterknife.ButterKnife;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@ -154,10 +153,6 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
mCachedView = View.inflate(getContext(), getLayoutId(), null);
}
if (useButterKnife()) {
ButterKnife.bind(this, mCachedView);
}
initView(mCachedView);
if (addSyncPageObserver()) {
@ -336,8 +331,4 @@ public abstract class BaseFragment<T> extends Fragment implements OnRequestCallB
protected boolean addSyncPageObserver() {
return false;
}
protected boolean useButterKnife() {
return true;
}
}

View File

@ -24,7 +24,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
/**
* Created by khy on 15/03/18.
@ -34,14 +33,10 @@ public abstract class BaseFragment_TabLayout extends NormalFragment implements V
public static final String PAGE_INDEX = "PAGE_INDEX";
@BindView(R.id.fragment_tab_layout)
protected TabLayout mTabLayout;
@BindView(R.id.fragment_view_pager)
protected NoScrollableViewPager mViewPager;
@BindView(R.id.fragment_tab_indicator)
protected TabIndicatorView mTabIndicatorView;
@Nullable
@BindView(R.id.dividerLine)
protected View mDividerLineView;
protected List<Fragment> mFragmentsList;
@ -78,19 +73,6 @@ public abstract class BaseFragment_TabLayout extends NormalFragment implements V
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) mCheckedIndex = getArguments().getInt(PAGE_INDEX, 0);
mTabTitleList = new ArrayList<>();
initTabTitleList(mTabTitleList);
mFragmentsList = new ArrayList<>(restoreFragments());
if (mFragmentsList.isEmpty() || mFragmentsList.size() != mTabTitleList.size()) {
mFragmentsList.clear();
initFragmentList(mFragmentsList);
}
}
private ArrayList<Fragment> restoreFragments() {
String tag = "android:switcher:" + mViewPager.getId() + ":";
ArrayList<Fragment> fragments = new ArrayList<>();
@ -108,6 +90,21 @@ public abstract class BaseFragment_TabLayout extends NormalFragment implements V
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mTabLayout = view.findViewById(R.id.fragment_tab_layout);
mViewPager = view.findViewById(R.id.fragment_view_pager);
mTabIndicatorView = view.findViewById(R.id.fragment_tab_indicator);
mDividerLineView = view.findViewById(R.id.dividerLine);
if (getArguments() != null) mCheckedIndex = getArguments().getInt(PAGE_INDEX, 0);
mTabTitleList = new ArrayList<>();
initTabTitleList(mTabTitleList);
mFragmentsList = new ArrayList<>(restoreFragments());
if (mFragmentsList.isEmpty() || mFragmentsList.size() != mTabTitleList.size()) {
mFragmentsList.clear();
initFragmentList(mFragmentsList);
}
mViewPager.setOffscreenPageLimit(mFragmentsList.size());
mViewPager.addOnPageChangeListener(this);
mViewPager.setAdapter(new FragmentAdapter(getChildFragmentManager(), mFragmentsList, mTabTitleList));

View File

@ -6,23 +6,16 @@ import android.view.View
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.PagerAdapter
import androidx.viewpager.widget.ViewPager
import butterknife.BindView
import com.gh.base.adapter.FragmentAdapter
import com.gh.common.view.TabIndicatorView
import com.gh.gamecenter.R
import com.google.android.material.tabs.TabLayout
import com.lightgame.view.NoScrollableViewPager
import java.util.*
abstract class BaseLazyTabFragment : BaseLazyFragment(), ViewPager.OnPageChangeListener {
@BindView(R.id.fragment_tab_layout)
lateinit var mTabLayout: TabLayout
@BindView(R.id.fragment_view_pager)
lateinit var mViewPager: NoScrollableViewPager
@BindView(R.id.fragment_tab_indicator)
lateinit var mTabIndicatorView: TabIndicatorView
var mFragmentsList: MutableList<Fragment> = arrayListOf()
@ -67,6 +60,14 @@ abstract class BaseLazyTabFragment : BaseLazyFragment(), ViewPager.OnPageChangeL
return null
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mTabLayout = view.findViewById(R.id.fragment_tab_layout)
mViewPager = view.findViewById(R.id.fragment_view_pager)
mTabIndicatorView = view.findViewById(R.id.fragment_tab_indicator)
}
override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible()
mTabTitleList.clear()

View File

@ -44,8 +44,6 @@ abstract class LazyFragment : BaseLazyFragment() {
getStubLayoutId()
}
override fun useButterKnife() = false
override fun initView(view: View?) {
super.initView(view)
if (!isRecreatedByFragmentManager()) {

View File

@ -4,12 +4,14 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.ExtensionsKt;
import com.gh.gamecenter.R;
@ -53,6 +55,14 @@ public class WaitingDialogFragment extends BaseDialogFragment {
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
WindowManager.LayoutParams layoutParams = getDialog().getWindow().getAttributes();
layoutParams.width = DisplayUtils.dip2px(160);
getDialog().getWindow().setAttributes(layoutParams);
}
@Override
public void show(FragmentManager manager, String tag) {
try {

View File

@ -3,6 +3,7 @@ package com.gh.common
import android.os.Handler
import android.os.Looper
import com.gh.base.GHThreadFactory
import com.gh.common.AppExecutor.heavyWeightIoExecutor
import com.gh.common.AppExecutor.ioExecutor
import com.gh.common.AppExecutor.lightWeightIoExecutor
import com.gh.common.AppExecutor.logExecutor
@ -16,31 +17,33 @@ import java.util.concurrent.*
* [ioExecutor] 是一个最大线程数固定的线程池,较为繁重的 IO 任务可以交给它
* [uiExecutor] 是主线程的包裹,需要切换至主线程执行可以用它
* [lightWeightIoExecutor] 是一个单线程的线程池,轻量级且需要保证同一线程的 IO 任务可以交给它
* [heavyWeightIoExecutor] 重量级的线程池,一些高频调用但不用保证结果的任务可以交给它
* [logExecutor] 只为上传 log 而使用的线程池
*/
object AppExecutor {
private val mCoreSize = Runtime.getRuntime().availableProcessors()
private val mMinimumPoolSize = 16.coerceAtLeast(mCoreSize * 4)
private val mMaximumPoolSize = 64.coerceAtLeast(mCoreSize * 16)
// TODO 因为 LinkedBlockingQueue 过大导致 MaximumPoolSize 的值几乎无效,下版本改造 [PackageRepository] 启动请求一堆游戏摘要信息的接口?
private val mMinimumPoolSize = 6.coerceAtLeast(mCoreSize)
private val mMaximumPoolSize = 24.coerceAtLeast(mCoreSize * 3)
@JvmStatic
val uiExecutor by lazy { MainThreadExecutor() }
@JvmStatic
val lightWeightIoExecutor by lazy { Executors.newSingleThreadExecutor(GHThreadFactory("GH_LIGHT_WEIGHT_IO_THREAD")) }
val lightWeightIoExecutor: ExecutorService by lazy { Executors.newSingleThreadExecutor(GHThreadFactory("GH_LIGHT_WEIGHT_IO_THREAD")) }
@JvmStatic
val logExecutor by lazy { Executors.newSingleThreadExecutor(GHThreadFactory("GH_LOG_THREAD")) }
val heavyWeightIoExecutor: ExecutorService by lazy { Executors.newFixedThreadPool(2, GHThreadFactory("GH_HEAVY_WEIGHT_IO_THREAD")) }
@JvmStatic
val logExecutor: ExecutorService by lazy { Executors.newSingleThreadExecutor(GHThreadFactory("GH_LOG_THREAD")) }
@JvmStatic
val ioExecutor = ThreadPoolExecutor(
mMinimumPoolSize,
mMaximumPoolSize,
20L, TimeUnit.SECONDS,
LinkedBlockingQueue<Runnable>(1000),
LinkedBlockingQueue(256),
GHThreadFactory("GH_IO_THREAD"))
val cachedScheduler by lazy { Schedulers.from(ioExecutor) }
@ -58,14 +61,14 @@ object AppExecutor {
}
}
fun runOnIoThread(isLightWeightTask: Boolean = false, f: () -> Unit) {
if (isLightWeightTask) {
AppExecutor.lightWeightIoExecutor.execute(f)
} else {
AppExecutor.ioExecutor.execute(f)
fun runOnIoThread(isLightWeightTask: Boolean = false, isHeavyWightTask: Boolean = false, f: () -> Unit) {
when {
isLightWeightTask -> lightWeightIoExecutor.execute(f)
isHeavyWightTask -> heavyWeightIoExecutor.execute(f)
else -> ioExecutor.execute(f)
}
}
fun runOnUiThread(f: () -> Unit) {
AppExecutor.uiExecutor.execute(f)
uiExecutor.execute(f)
}

View File

@ -17,9 +17,7 @@ import com.gh.common.view.dsbridge.CompletionHandler
import com.gh.gamecenter.*
import com.gh.gamecenter.energy.EnergyCenterActivity
import com.gh.gamecenter.energy.EnergyHouseActivity
import com.gh.gamecenter.entity.Badge
import com.gh.gamecenter.entity.MtaEvent
import com.gh.gamecenter.entity.NotificationUgc
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.help.QaFeedbackDialogFragment
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
@ -401,7 +399,25 @@ class DefaultJsApi(var context: Context) {
@JavascriptInterface
fun checkUpdateGhzs(msg: Any) {
context.startActivity(AboutActivity.getIntent(context, true));
context.startActivity(AboutActivity.getIntent(context, true))
}
@JavascriptInterface
public fun clickGameActivityDownloadBtn(event: Any) {
val gameActivityEvent = event.toString().toObject() ?: GameActivityEvent()
GameActivityDownloadHelper.start(context, gameActivityEvent)
}
@JavascriptInterface
fun isGameActivityTaskCompleted(event: Any, handler: CompletionHandler<Any>) {
val gameActivityEvent = event.toString().toObject() ?: GameActivityEvent()
GameActivityDownloadHelper.checkTaskComplete(context, gameActivityEvent, handler)
}
@JavascriptInterface
fun postGameActivityExposureEvent(event: Any) {
val gameActivityEvent = event.toString().toObject() ?: GameActivityEvent()
GameActivityDownloadHelper.postExposureEvent(gameActivityEvent)
}
@Keep
@ -423,4 +439,18 @@ class DefaultJsApi(var context: Context) {
@Keep
internal data class BrowseTaskEvent(var timeout: String = "", var isFinished: String = "")
@Keep
data class GameActivityEvent(
var gameId: String = "",
var activityTitle: String = "",
var activityId: String = "",
var platform: String = ""
)
@Keep
data class GameActivityTaskEvent(
var gameId: String = "",
var activityId: String = "",
)
}

View File

@ -5,6 +5,7 @@ import android.content.Intent
import android.net.Uri
import android.text.TextUtils
import android.util.Base64
import com.gh.base.CurrentActivityHolder
import com.gh.common.constant.Constants
import com.gh.common.util.*
import com.gh.common.util.DirectUtils.directToFeedback
@ -31,7 +32,15 @@ import java.nio.charset.Charset
object DefaultUrlHandler {
@JvmStatic
fun interceptUrl(context: Context, url: String, entrance: String): Boolean {
fun interceptUrl(context: Context, url: String, entrance: String) : Boolean {
return interceptUrl(context, url, entrance, false)
}
/**
* @param bringAppToFront 是否需要在不匹配 host 的时候把 APP 调回到前台 (如微信调起)
*/
@JvmStatic
fun interceptUrl(context: Context, url: String, entrance: String, bringAppToFront: Boolean = false): Boolean {
val uri = Uri.parse(url)
if ("ghzhushou" == uri.scheme) {
Utils.log("url = $url")
@ -42,11 +51,21 @@ object DefaultUrlHandler {
if (!TextUtils.isEmpty(path)) {
id = path!!.substring(1)
}
if (TextUtils.isEmpty(id)) {
id = uri.getQueryParameter("id") ?: ""
}
val intent: Intent
when (host) {
"article" -> context.startActivity(NewsDetailActivity.getIntentById(context, id, entrance))
"game" -> DirectUtils.directToGameDetail(context, id = id, tab = uri.getQueryParameter("to"), autoDownload = uri.getQueryParameter("auto_download") == "true", entrance = entrance)
"game" -> DirectUtils.directToGameDetail(
context,
id = id,
tab = uri.getQueryParameter("to"),
autoDownload = uri.getQueryParameter("auto_download") == "true",
entrance = entrance
)
"column" -> SubjectActivity.startSubjectActivity(context, id, uri.getQueryParameter("name"), false, entrance)
@ -122,8 +141,9 @@ object DefaultUrlHandler {
}
if ("articles" == type) {
DirectUtils.directToCommunityArticle(
context, typeId, communityId,
entrance, "文章链接")
context, typeId, communityId,
entrance, "文章链接"
)
}
}
EntranceUtils.HOST_UPLOAD_VIDEO -> {
@ -154,7 +174,7 @@ object DefaultUrlHandler {
val fieldId = uri.getQueryParameter("fieldId") ?: ""
val sectionName = uri.getQueryParameter("sectionName") ?: ""
val paginationType = uri.getQueryParameter("paginationType")
?: "page"//活动分页方式 page filter
?: "page"//活动分页方式 page filter
val location = if (!TextUtils.isEmpty(act)) {
VideoDetailContainerViewModel.Location.VIDEO_ACTIVITY.value
} else if (!TextUtils.isEmpty(fieldId)) {
@ -162,15 +182,31 @@ object DefaultUrlHandler {
} else {
id
}
directToLegacyVideoDetail(context, id, location, false, gameId, entrance, "", referer, type, act, paginationType, fieldId, sectionName)
directToLegacyVideoDetail(
context,
id,
location,
false,
gameId,
entrance,
"",
referer,
type,
act,
paginationType,
fieldId,
sectionName
)
}
EntranceUtils.HOST_VIDEO_DETAIL -> {
DirectUtils.directToVideoDetail(context, id, entrance, path)
}
EntranceUtils.HOST_VIDEO_SINGLE -> {
val referer = uri.getQueryParameter("referer") ?: ""
DirectUtils.directToVideoDetail(context, id, VideoDetailContainerViewModel.Location.SINGLE_VIDEO.value,
false, "", entrance, "", if (TextUtils.isEmpty(referer)) "" else referer)
DirectUtils.directToVideoDetail(
context, id, VideoDetailContainerViewModel.Location.SINGLE_VIDEO.value,
false, "", entrance, "", if (TextUtils.isEmpty(referer)) "" else referer
)
}
EntranceUtils.HOST_VIDEO_STREAMING_HOME -> {
intent = Intent(context, MainActivity::class.java)
@ -213,7 +249,7 @@ object DefaultUrlHandler {
EntranceUtils.HOST_BLOCK -> {
val name = uri.getQueryParameter("name")
?: ""
?: ""
val entity = SubjectRecommendEntity(link = id, name = name, text = name)
DirectUtils.directToBlock(context, entity, entrance)
}
@ -228,13 +264,13 @@ object DefaultUrlHandler {
EntranceUtils.HOST_HELP -> {
val name = uri.getQueryParameter("name")
?: ""
?: ""
DirectUtils.directToQa(context, name, id)
}
EntranceUtils.HOST_HELP_COLLECTION -> {
val name = uri.getQueryParameter("name")
?: ""
?: ""
DirectUtils.directToQaCollection(context, name, id)
}
@ -262,10 +298,11 @@ object DefaultUrlHandler {
EntranceUtils.HOST_GAME_NEWS -> {
DirectUtils.directToGameNews(
context,
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
entrance);
context,
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
entrance
);
}
EntranceUtils.HOST_GAME_CALENDAR -> {
@ -282,10 +319,11 @@ object DefaultUrlHandler {
EntranceUtils.HOST_GAME_RATING_DETAIL -> {
DirectUtils.directToGameRatingDetail(
context,
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
uri.getQueryParameter(EntranceUtils.KEY_COMMENT_ID),
EntranceUtils.ENTRANCE_BROWSER)
context,
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
uri.getQueryParameter(EntranceUtils.KEY_COMMENT_ID),
EntranceUtils.ENTRANCE_BROWSER
)
}
EntranceUtils.HOST_FORUM -> {
@ -301,19 +339,28 @@ object DefaultUrlHandler {
val forumId = uri.getQueryParameter("forum_id") ?: ""
val forumIcon = uri.getQueryParameter("forum_icon") ?: ""
val forumType = uri.getQueryParameter("forum_type") ?: BbsType.OFFICIAL_BBS.value
val gameId = uri.getQueryParameter("game_id") ?: ""
val gameName = uri.getQueryParameter("game_name") ?: ""
val icon = uri.getQueryParameter("game_icon") ?: ""
val iconSubscript = uri.getQueryParameter("game_icon_subscript") ?: ""
val gameEntity = if (forumType == BbsType.OFFICIAL_BBS.value) {
GameEntity(id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
} else null
val activityLabelEntity = ActivityLabelEntity(id = activityId, name = activityName)
val communityEntity = CommunityEntity(id = forumId, name = forumName, icon = forumIcon)
context.startActivity(VideoPublishActivity.getIntent(
context.startActivity(
VideoPublishActivity.getIntent(
context,
communityEntity,
gameEntity,
activityLabelEntity,
forumType,
false,
entrance,
""
))
)
)
}
EntranceUtils.HOST_SUGGESTION -> {
@ -322,13 +369,17 @@ object DefaultUrlHandler {
val gameId = uri.getQueryParameter(EntranceUtils.KEY_GAMEID)
val packageMd5 = uri.getQueryParameter(EntranceUtils.KEY_PACKAGE_MD5)
val isQaFeedback = uri.getQueryParameter(EntranceUtils.KEY_IS_QA_FEEDBACK) == "true"
val content = if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) String.format("%s-%s-V%s",
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceUtils.KEY_VERSION)) else String.format("%s-%s-V%s\n游戏ID%s\n游戏包MD5%s\n",
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceUtils.KEY_VERSION), gameId, packageMd5)
val content = if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) String.format(
"%s-%s-V%s",
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceUtils.KEY_VERSION)
) else String.format(
"%s-%s-V%s\n游戏ID%s\n游戏包MD5%s\n",
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
if (TextUtils.isEmpty(platformName)) platform else platformName,
uri.getQueryParameter(EntranceUtils.KEY_VERSION), gameId, packageMd5
)
val qaId = uri.getQueryParameter("qa_id") ?: ""
val qaContentId = uri.getQueryParameter(EntranceUtils.KEY_QA_CONTENT_ID) ?: ""
val qaTitle = uri.getQueryParameter(EntranceUtils.KEY_QA_TITLE)
@ -373,7 +424,20 @@ object DefaultUrlHandler {
context.startActivity(GameCollectionEditActivity.getIntent(context, entrance))
}
else -> DialogHelper.showUpgradeDialog(context)
else -> {
if (bringAppToFront) {
DirectUtils.directToMainActivity(context)
if (!TextUtils.isEmpty(host)) {
AppExecutor.uiExecutor.executeWithDelay({
CurrentActivityHolder.getCurrentActivity()?.let {
DialogHelper.showUpgradeDialog(it)
}
}, 200)
}
} else {
DialogHelper.showUpgradeDialog(context)
}
}
}
return true
} else if ("zhiqu" == uri.scheme) {
@ -423,10 +487,11 @@ object DefaultUrlHandler {
fun transformNormalScheme(context: Context, url: String, entrance: String): Boolean {
val uri = Uri.parse(url)
if (uri.host == "www.ghzs666.com"
|| uri.host == "www.ghzs.com"
|| uri.host == "ask.ghzs.com"
|| uri.host == "m.ghzs.com"
|| uri.host == "m.ghzs666.com") {
|| uri.host == "www.ghzs.com"
|| uri.host == "ask.ghzs.com"
|| uri.host == "m.ghzs.com"
|| uri.host == "m.ghzs666.com"
) {
Utils.log(uri.path)
uri.path?.apply {
when {
@ -449,7 +514,9 @@ object DefaultUrlHandler {
var communityId = ""
var type = ""
var typeId = ""
val split = replace("/communities", "").replace("/bbs", "").replace(".html", "").split("/".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
val split =
replace("/communities", "").replace("/bbs", "").replace(".html", "").split("/".toRegex()).dropLastWhile { it.isEmpty() }
.toTypedArray()
for (text in split) {
if (TextUtils.isEmpty(communityId)) {
communityId = text
@ -465,8 +532,9 @@ object DefaultUrlHandler {
}
if ("articles" == type || "article" == type) {
DirectUtils.directToCommunityArticle(
context, typeId, communityId,
entrance, "文章链接")
context, typeId, communityId,
entrance, "文章链接"
)
}
}
contains("article") -> {
@ -494,4 +562,24 @@ object DefaultUrlHandler {
}
return false
}
/**
* 将 url 转换为 LinkEntity (实际只有 type 和 link 两个字段,仅供日志,不保证能用)
*/
fun urlToLinkEntity(url: String): LinkEntity? {
val uri = Uri.parse(url)
if ("ghzhushou" == uri.scheme) {
Utils.log("url = $url")
Utils.log("url = " + uri.scheme!!)
val host = uri.host
val path = uri.path
var id = ""
if (!TextUtils.isEmpty(path)) {
id = path!!.substring(1)
}
return LinkEntity(type = host, link = id)
}
return null
}
}

View File

@ -413,4 +413,6 @@ public class Constants {
public static final String SP_BROWSER_HINT_URL = "browser_hint_url";
public static final String DEFAULT_OPPO_BROWSER_HINT_URL = "https://static-web.ghzs.com/ghzs_help/help.html?content=5fa90fe143d91a022e0d33ff";
public static final String DEFAULT_VIVO_BROWSER_HINT_URL = "https://static-web.ghzs.com/ghzs_help/help.html?content=618112ce04796e63e97643a4&from=ghzs";
public static final int FOLLOW_HINT_TRIGGER_HEIGHT = 10;
}

View File

@ -16,7 +16,6 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.databinding.BindingAdapter;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.facebook.drawee.view.SimpleDraweeView;
@ -34,6 +33,7 @@ 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.ExtensionsKt;
import com.gh.common.util.GameUtils;
import com.gh.common.util.GameViewUtils;
import com.gh.common.util.ImageUtils;
@ -84,22 +84,18 @@ import java.util.List;
public class BindingAdapters {
@BindingAdapter("imageIcon")
public static void loadIcon(SimpleDraweeView view, String imageUrl) {
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("setTypeface")
public static void setTypeface(TextView view, String type) {
if (type == null) return;
@ -119,7 +115,6 @@ public class BindingAdapters {
}
}
@BindingAdapter({"addDetailKaiFuView", "addDetailKaiFuViewListener", "isReadyPatch"})
public static void addDetailKaiFuView(LinearLayout view, List<ServerCalendarEntity> list
, OnViewClickListener listener, Boolean isReadyPatch) {
if (list == null) return;
@ -127,13 +122,13 @@ public class BindingAdapters {
for (int i = 0; i < list.size() + 1; i++) { // 1 is Title
View inflate = LayoutInflater.from(view.getContext()).inflate(R.layout.kaifu_detail_item_row, null);
KaifuDetailItemRowBinding binding = KaifuDetailItemRowBinding.bind(inflate);
binding.setIsCloseBottom(i == list.size());
binding.setIsReadyPatch(isReadyPatch);
if (i == 0) {
binding.setIsTitle(true);
} else {
ServerCalendarEntity serverEntity = list.get(i - 1);
binding.setEntity(serverEntity);
binding.getRoot().setBackgroundColor(isReadyPatch != null && isReadyPatch ? ExtensionsKt.toColor(R.color.theme) : ExtensionsKt.toColor(R.color.white));
binding.getRoot().setPadding(DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), i == list.size() ? DisplayUtils.dip2px(1) : 0);
ServerCalendarEntity serverEntity = list.get(i - 1);
binding.timeTv.setText(i == 0 ? "时间" : serverEntity.getFormatTime("HH:mm"));
binding.remarkTv.setText(i == 0 ? "备注" : serverEntity.getRemark());
binding.nameTv.setText(i == 0 ? "名字" : (TextUtils.isEmpty(serverEntity.getNote()) ? "-" : serverEntity.getNote()));
if (i != 0) {
binding.getRoot().setOnClickListener(v -> {
listener.onClick(v, isReadyPatch != null && isReadyPatch ? serverEntity : null);
});
@ -155,12 +150,10 @@ public class BindingAdapters {
}
// 如果超过10000则转换为1.0W
@BindingAdapter("transSimpleCount")
public static void transSimpleCount(TextView view, int count) {
view.setText(NumberUtils.transSimpleCount(count));
}
@BindingAdapter("textColorFromString")
public static void textColorFromString(TextView tv, String hexString) {
if (TextUtils.isEmpty(hexString)) return;
@ -171,7 +164,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("visibleGone")
public static void showHide(View view, Boolean show) {
if (show != null && show) {
view.setVisibility(View.VISIBLE);
@ -180,7 +172,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("goneIf")
public static void goneIf(View view, Boolean gone) {
if (gone != null && gone) {
view.setVisibility(View.GONE);
@ -192,7 +183,6 @@ public class BindingAdapters {
/**
* lazy 的 paddingTop
*/
@BindingAdapter("lazyPaddingLeft")
public static void lazyPaddingLeft(View view, int paddingLeftInDp) {
view.setPadding(DisplayUtils.dip2px(paddingLeftInDp), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
}
@ -200,7 +190,6 @@ public class BindingAdapters {
/**
* lazy 的 paddingTop
*/
@BindingAdapter("lazyPaddingTop")
public static void lazyPaddingTop(View view, int paddingTopInDp) {
view.setPadding(view.getPaddingLeft(), DisplayUtils.dip2px(paddingTopInDp), view.getPaddingRight(), view.getPaddingBottom());
}
@ -208,12 +197,10 @@ public class BindingAdapters {
/**
* lazy 的 paddingBottom
*/
@BindingAdapter("lazyPaddingBottom")
public static void lazyPaddingBottom(View view, int paddingBottomInDp) {
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), DisplayUtils.dip2px(paddingBottomInDp));
}
@BindingAdapter("visibleInvisible")
public static void visibleInvisible(View view, Boolean show) {
if (show != null && show) {
view.setVisibility(View.VISIBLE);
@ -222,7 +209,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("messageUnread")
public static void setMessageUnread(TextView view, int unreadCount) {
if (unreadCount < 100) {
view.setText(String.valueOf(unreadCount));
@ -231,7 +217,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("serverTypePadding")
public static void setServerTypePadding(TextView view, String serverType) {
int paddRight = 0;
if (TextUtils.isEmpty(serverType)) {
@ -249,7 +234,6 @@ public class BindingAdapters {
view.setPadding(0, 0, paddRight, 0);
}
@BindingAdapter("serverType")
public static void setServerType(TextView view, String serverType) {
view.setText(serverType);
if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) {
@ -259,26 +243,22 @@ public class BindingAdapters {
}
}
@BindingAdapter("game")
public static void setGame(View view, GameEntity gameEntity) {
if (gameEntity != null && view instanceof GameIconView) {
((GameIconView) view).displayGameIcon(gameEntity);
}
}
@BindingAdapter("gameIcon")
public static void setGameIcon(View view, GameEntity gameEntity) {
if (gameEntity != null && view instanceof GameIconView) {
((GameIconView) view).displayGameIcon(gameEntity.getIcon(), gameEntity.getIconSubscript());
}
}
@BindingAdapter("articleType")
public static void setArticleType(TextView view, String articleType) {
NewsUtils.setNewsType(view, articleType, 0, 0);
}
@BindingAdapter("detailDownloadText")
public static void setDetailDownloadText(TextView view, GameEntity gameEntity) {
if (gameEntity == null || gameEntity.getApk().isEmpty()) {
view.setBackgroundResource(R.drawable.game_item_btn_pause_style);
@ -287,7 +267,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("liBaoBtn")
public static void setLiBaoBtn(TextView view, String status) {
if (TextUtils.isEmpty(status)) return;
switch (status) {
@ -352,7 +331,6 @@ public class BindingAdapters {
}
// 大图下的进度条
@BindingAdapter({"downloadButton", "traceEvent", "clickCallBack", "entrance", "location"})
public static void setDownloadButton(DownloadProgressBar progressBar,
GameEntity gameEntity,
ExposureEvent traceEvent,
@ -692,13 +670,11 @@ public class BindingAdapters {
}
}
@BindingAdapter("gameLabelList")
public static void setGameLabelList(LinearLayout layout, List<TagStyleEntity> tagStyle) {
GameViewUtils.setLabelList(layout.getContext(), layout, tagStyle);
}
// 包含测试开服标签
@BindingAdapter("setGameTags")
public static void setGameTags(LinearLayout layout, GameEntity gameEntity) {
try {
if (layout.getVisibility() == View.GONE) return;
@ -739,7 +715,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("setVideoDetailGameTags")
public static void setVideoDetailGameTags(LinearLayout layout, GameEntity gameEntity) {
try {
ArrayList<TagStyleEntity> tagStyle = new ArrayList<>();
@ -767,14 +742,12 @@ public class BindingAdapters {
}
}
@BindingAdapter("isRefreshing")
public static void isRefreshing(SwipeRefreshLayout layout, LoadStatus status) {
if (status != LoadStatus.INIT_LOADING && status != LoadStatus.LIST_LOADING) {
layout.setRefreshing(false);
}
}
@BindingAdapter({"setGameName", "isShowPlatform", "isShowSuffix"})
public static void setGameName(TextView view, GameEntity game, boolean isShowPlatform, @Nullable Boolean isShowSuffix) {
if (isShowSuffix == null) isShowSuffix = true; // 默认显示
if (isShowPlatform && game.getApk().size() > 0) {
@ -787,7 +760,6 @@ public class BindingAdapters {
}
@BindingAdapter({"setCommunityImage", "setCommunityVideoImage"})
public static void setCommunityImage(SimpleDraweeView imageView, List<String> images, List<CommunityVideoEntity> videos) {
if (videos.size() > 0) {
CommunityVideoEntity videoEntity = videos.get(0);
@ -801,7 +773,6 @@ public class BindingAdapters {
}
}
@BindingAdapter({"setCommunityVideoDuration"})
public static void setCommunityVideoDuration(TextView mVideoDuration, List<CommunityVideoEntity> videos) {
if (videos != null && videos.size() > 0) {
CommunityVideoEntity videoEntity = videos.get(0);
@ -813,7 +784,6 @@ public class BindingAdapters {
}
}
@BindingAdapter({"setGameTags", "setMaxGameTags"})
public static void setGameTags(TextView view, List<TagStyleEntity> tags, int maxTags) {
if (tags == null) {
view.setText("");
@ -842,7 +812,6 @@ public class BindingAdapters {
view.setText(span);
}
@BindingAdapter({"setVideoData"})
public static void setVideoData(TextView view, int count) {
if (count > 0) {
view.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(view.getContext(), R.drawable.ic_video_data_up), null, null, null);

View File

@ -129,10 +129,17 @@ class CertificationDialog(context: Context, private val authDialogEntity: AuthDi
val currentActivity = AppManager.getInstance().currentActivity() ?: return
AvoidOnResultManager.getInstance(currentActivity as AppCompatActivity)
.startForResult(ShellActivity.getIntent(context, ShellActivity.Type.REAL_NAME_INFO, null), object : Callback {
.startForResult(
ShellActivity.getIntent(
context,
ShellActivity.Type.REAL_NAME_INFO,
).apply {
putExtra(EntranceUtils.KEY_GAME_ID, gameId)
}, object : Callback {
override fun onActivityResult(resultCode: Int, data: Intent?) {
if (resultCode == Activity.RESULT_OK && data != null) {
val isAuthSuccess = data.getBooleanExtra(UserInfoEditFragment.AUTH_SUCCESS, false)
val isAuthSuccess =
data.getBooleanExtra(UserInfoEditFragment.AUTH_SUCCESS, false)
if (isAuthSuccess) {
listener.onConfirm()
dismiss()

View File

@ -23,6 +23,7 @@ import com.gh.common.constant.Constants
import com.gh.common.util.*
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DialogDeviceRemindBinding
import com.gh.gamecenter.entity.DeviceDialogEntity
import com.gh.gamecenter.entity.GameEntity
import com.google.gson.reflect.TypeToken
@ -31,14 +32,13 @@ import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.dialog_device_remind.view.*
import java.lang.ref.WeakReference
/**
* 设备提醒弹窗
*/
class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val gameEntity: GameEntity) : Dialog(context, R.style.GhAlertDialog) {
private lateinit var view: View
private val mBinding: DialogDeviceRemindBinding by lazy { DialogDeviceRemindBinding.inflate(layoutInflater) }
private var currentPage = 0
private var mSlideLooperInterval = 3000L
private lateinit var mLooperHandle: LooperHandle
@ -96,13 +96,12 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
view = LayoutInflater.from(context).inflate(R.layout.dialog_device_remind, null)
setContentView(view)
setContentView(mBinding.root)
mDatas.addAll(entity.gallery)
view.titleTv.text = entity.title
view.contentTv.text = entity.content
mBinding.titleTv.text = entity.title
mBinding.contentTv.text = entity.content
view.bannerView.apply {
mBinding.bannerView.apply {
orientation = ViewPager2.ORIENTATION_HORIZONTAL
mAdapter = BannerAdapter()
val recyclerView = getChildAt(0) as RecyclerView
@ -133,36 +132,36 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
}
val isFirst = SPUtils.getBoolean(Constants.SP_FIRST_DEVICE_REMIND, false)
if (!isFirst) {
view.cancelTv.isEnabled = false
view.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_round_f5f5f5)
mBinding.cancelTv.isEnabled = false
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_round_f5f5f5)
disposable = countDownTimer(3) { finish, time ->
if (finish) {
view.cancelTv.isEnabled = true
view.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
view.cancelTv.text = "我知道了"
view.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
mBinding.cancelTv.isEnabled = true
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
mBinding.cancelTv.text = "我知道了"
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
} else {
view.cancelTv.text = "我知道了(${time}S)"
mBinding.cancelTv.text = "我知道了(${time}S)"
}
}
SPUtils.setBoolean(Constants.SP_FIRST_DEVICE_REMIND, true)
} else {
view.noRemindAgainCb.visibility = View.VISIBLE
view.cancelTv.text = "我知道了"
view.cancelTv.isEnabled = true
view.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
view.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
mBinding.noRemindAgainCb.visibility = View.VISIBLE
mBinding.cancelTv.text = "我知道了"
mBinding.cancelTv.isEnabled = true
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
}
view.cancelTv.setOnClickListener {
SPUtils.setBoolean(Constants.SP_NO_REMIND_AGAIN, view.noRemindAgainCb.isChecked)
mBinding.cancelTv.setOnClickListener {
SPUtils.setBoolean(Constants.SP_NO_REMIND_AGAIN, mBinding.noRemindAgainCb.isChecked)
dismiss()
}
DownloadManager.getInstance().addObserver(dataWatcher)
}
private fun addIndicator() {
view.indicatorLl.removeAllViews()
mBinding.indicatorLl.removeAllViews()
mDatas.forEach { _ ->
val indicatorView = ImageView(context).apply {
setImageResource(R.drawable.selector_device_remind_indicator)
@ -171,13 +170,13 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
params.rightMargin = DisplayUtils.dip2px(1F)
layoutParams = params
}
view.indicatorLl.addView(indicatorView)
mBinding.indicatorLl.addView(indicatorView)
}
}
private fun slideIndicator(position: Int) {
for (i in 0 until view.indicatorLl.childCount) {
val childAt = view.indicatorLl.getChildAt(i)
for (i in 0 until mBinding.indicatorLl.childCount) {
val childAt = mBinding.indicatorLl.getChildAt(i)
childAt.isSelected = i == position
}
}
@ -210,7 +209,7 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
fun scrollToNextPage() {
currentPage++
view.bannerView.setCurrentItem(currentPage, true)
mBinding.bannerView.setCurrentItem(currentPage, true)
}
fun startScroll() {

View File

@ -16,10 +16,10 @@ import com.gh.common.util.PermissionHelper
import com.gh.common.util.fromHtml
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DialogNotificationHintBinding
import com.gh.gamecenter.entity.NotificationStyleEntity
import com.gh.gamecenter.entity.NotificationUgc
import com.lightgame.utils.Utils
import kotlinx.android.synthetic.main.dialog_notification_hint.*
import org.json.JSONArray
import java.io.BufferedReader
import java.io.IOException
@ -30,9 +30,10 @@ import kotlin.random.Random
class NotificationHintDialogFragment : BaseTrackableDialogFragment() {
private var mNotificationUgc: NotificationUgc? = null
private val mBinding: DialogNotificationHintBinding by lazy { DialogNotificationHintBinding.inflate(layoutInflater) }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.dialog_notification_hint, null)
return mBinding.root
}
@Suppress("DEPRECATION")
@ -55,39 +56,41 @@ class NotificationHintDialogFragment : BaseTrackableDialogFragment() {
val styleEntityJson = jsonObj.getJSONObject(mNotificationUgc!!.value)
val styleEntity = GsonUtils.fromJson(styleEntityJson.toString(), NotificationStyleEntity::class.java)
val drawableId = resources.getIdentifier(styleEntity.image, "drawable", requireContext().packageName)
notificationIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), drawableId))
notificationTitle.text = styleEntity.title
notificationContent.text = styleEntity.content.fromHtml()
if (index == 0) {
closeIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_notification_close_1))
} else {
activateTv.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_notification_open_btn_style_1)
activateTv.text = "优雅的开启"
}
mBinding.run {
notificationIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), drawableId))
notificationTitle.text = styleEntity.title
notificationContent.text = styleEntity.content.fromHtml()
if (index == 0) {
closeIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_notification_close_1))
} else {
activateTv.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_notification_open_btn_style_1)
activateTv.text = "优雅的开启"
}
activateTv.setOnClickListener {
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击立即开启")
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击立即开启")
dismissAllowingStateLoss()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//这种方案适用于 API 26, 即8.0含8.0)以上可以用
val intent = Intent()
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
intent.putExtra(Settings.EXTRA_APP_PACKAGE, BuildConfig.APPLICATION_ID)
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
activateTv.setOnClickListener {
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击立即开启")
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击立即开启")
dismissAllowingStateLoss()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//这种方案适用于 API 26, 即8.0含8.0)以上可以用
val intent = Intent()
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
intent.putExtra(Settings.EXTRA_APP_PACKAGE, BuildConfig.APPLICATION_ID)
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
PermissionHelper.toPermissionSetting(requireActivity())
}
} else {
PermissionHelper.toPermissionSetting(requireActivity())
}
} else {
PermissionHelper.toPermissionSetting(requireActivity())
}
}
closeIv.setOnClickListener {
dismissAllowingStateLoss()
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击关闭")
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击关闭")
closeIv.setOnClickListener {
dismissAllowingStateLoss()
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击关闭")
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击关闭")
}
}
dialog?.setCanceledOnTouchOutside(true)

View File

@ -62,9 +62,11 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
detectionObjects?.forEach { detectionObject ->
if (detectionObject.packages.contains(packageName)) {
val packageLink = gameEntity?.packageDialog?.links?.find { it.buttonLink }
LogUtils.uploadPackageCheck("pkg_check_pop_download", if (DownloadStatus.add == downloadEntity.status) "下载开始" else "下载完成",
gameEntity, packageLink?.text ?: "", packageLink?.title
?: "", downloadEntity.gameId, downloadEntity.getMetaExtra(Constants.GAME_NAME))
LogUtils.uploadPackageCheck(
"pkg_check_pop_download", if (DownloadStatus.add == downloadEntity.status) "下载开始" else "下载完成",
gameEntity, packageLink?.text ?: "", packageLink?.title
?: "", downloadEntity.gameId, downloadEntity.getMetaExtra(Constants.GAME_NAME)
)
}
}
}
@ -98,8 +100,10 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
val spanBuilder = SpanBuilder(it.linkHintText).build()
it.links.forEachIndexed { index, link ->
val linkSpan = SpanBuilder(link.title ?: "").click(0, (link.title
?: "").length, R.color.theme_font, true) {
val linkSpan = SpanBuilder(link.title ?: "").click(
0, (link.title
?: "").length, R.color.theme_font, true
) {
LogUtils.uploadPackageCheck("pkg_check_pop_click", "点击链接", gameEntity, link.text, link.title, "", "")
DirectUtils.directToLinkPage(requireContext(), link, "包名检测弹窗", "")
}.build()
@ -205,6 +209,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
if (it >= mDuration) {
mDisposable?.dispose()
binding.downloadBtn.isEnabled = true
binding.downloadBtn.background = R.drawable.bg_notification_open_btn_style_2.toDrawable()
}
}
val animator = ValueAnimator.ofInt(0, 100)
@ -273,7 +278,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
}
}
inner class PackageCheckAdapter(val context: Context, val entities: ArrayList<DetectionObjectEntity>) : BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
inner class PackageCheckAdapter(val context: Context, val entities: ArrayList<DetectionObjectEntity>) :
BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
private var index = -1
fun notifyPackages() {
@ -282,7 +288,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return PackageCheckViewHolder(PackageCheckItemBinding.bind(LayoutInflater.from(context).inflate(R.layout.package_check_item, parent, false)))
return PackageCheckViewHolder(parent.toBinding())
}
override fun getItemCount(): Int = entities.size
@ -290,7 +296,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is PackageCheckViewHolder) {
val entity = entities[position]
holder.binding.entity = entity
holder.binding.gameNameTv.text = entity.text
if (position <= index) {
val isAllInstalled = checkDetectionsInstalled(mAllInstalledPackages, entity.packages)
if (isAllInstalled) {
@ -339,7 +345,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
if (!activity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) return
var dialogFragment = activity.supportFragmentManager.findFragmentByTag(PackageCheckDialogFragment::class.java.simpleName) as? PackageCheckDialogFragment
var dialogFragment =
activity.supportFragmentManager.findFragmentByTag(PackageCheckDialogFragment::class.java.simpleName) as? PackageCheckDialogFragment
if (dialogFragment == null) {
dialogFragment = PackageCheckDialogFragment()
dialogFragment.gameEntity = gameEntity

View File

@ -1,384 +1,384 @@
package com.gh.common.dialog
import android.annotation.SuppressLint
import android.app.Application
import android.os.Bundle
import android.text.Html
import android.view.*
import android.view.animation.AnimationUtils
import android.widget.EditText
import android.widget.TextView
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import butterknife.BindView
import butterknife.ButterKnife
import butterknife.OnClick
import com.gh.base.fragment.BaseDialogFragment
import com.gh.common.AppExecutor
import com.gh.common.constant.Config
import com.gh.common.history.HistoryHelper
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.entity.NotificationUgc
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
import okhttp3.ResponseBody
import org.json.JSONArray
import org.json.JSONObject
// 预约弹窗
@Deprecated("v5.6.0废弃")
class ReserveDialogFragment
: BaseDialogFragment(), KeyboardHeightObserver {
// : BaseTrackableDialogFragment() {
@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
@BindView(R.id.content_container)
lateinit var contentContainer: View
@BindView(R.id.mobile_index_container)
lateinit var mobileIndexContainer: View
@BindView(R.id.mobile_index_reserve)
lateinit var mobileIndexReserve: TextView
@BindView(R.id.mobile_index_user)
lateinit var mobileIndexUser: TextView
@BindView(R.id.mobile_et_delete)
lateinit var mobileEtDelete: View
@BindView(R.id.layout_container)
lateinit var layoutContainer: View
private lateinit var mViewModel: ReserveViewModel
var successCallback: SuccessCallback? = null
private var mGame: GameEntity? = null
private var mGameId: String = ""
private var mGameName: String = ""
private var mKeyboardHeightProvider: KeyboardHeightProvider? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mGame = requireArguments().getParcelable(EntranceUtils.KEY_GAME)
mGameId = mGame?.id ?:""
mGameName = mGame?.name ?:""
mViewModel = viewModelProvider()
mKeyboardHeightProvider = KeyboardHeightProvider(activity)
mKeyboardHeightProvider?.start()
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.dialog_reserve_game, null)
}
// override fun getEvent(): String {
// return "预约游戏"
//package com.gh.common.dialog
//
//import android.annotation.SuppressLint
//import android.app.Application
//import android.os.Bundle
//import android.text.Html
//import android.view.*
//import android.view.animation.AnimationUtils
//import android.widget.EditText
//import android.widget.TextView
//import androidx.lifecycle.AndroidViewModel
//import androidx.lifecycle.MutableLiveData
//import androidx.lifecycle.Observer
//import butterknife.BindView
//import butterknife.ButterKnife
//import butterknife.OnClick
//import com.gh.base.fragment.BaseDialogFragment
//import com.gh.common.AppExecutor
//import com.gh.common.constant.Config
//import com.gh.common.history.HistoryHelper
//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.entity.NotificationUgc
//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
//import okhttp3.ResponseBody
//import org.json.JSONArray
//import org.json.JSONObject
//
//// 预约弹窗
//@Deprecated("v5.6.0废弃")
//class ReserveDialogFragment
// : BaseDialogFragment(), KeyboardHeightObserver {
//// : BaseTrackableDialogFragment() {
//
// @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
//
// @BindView(R.id.content_container)
// lateinit var contentContainer: View
//
// @BindView(R.id.mobile_index_container)
// lateinit var mobileIndexContainer: View
//
// @BindView(R.id.mobile_index_reserve)
// lateinit var mobileIndexReserve: TextView
//
// @BindView(R.id.mobile_index_user)
// lateinit var mobileIndexUser: TextView
//
// @BindView(R.id.mobile_et_delete)
// lateinit var mobileEtDelete: View
//
// @BindView(R.id.layout_container)
// lateinit var layoutContainer: View
//
// private lateinit var mViewModel: ReserveViewModel
//
// var successCallback: SuccessCallback? = null
//
// private var mGame: GameEntity? = null
// private var mGameId: String = ""
// private var mGameName: String = ""
//
// private var mKeyboardHeightProvider: KeyboardHeightProvider? = null
//
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
//
// mGame = requireArguments().getParcelable(EntranceUtils.KEY_GAME)
// mGameId = mGame?.id ?:""
// mGameName = mGame?.name ?:""
//
// mViewModel = viewModelProvider()
// mKeyboardHeightProvider = KeyboardHeightProvider(activity)
// mKeyboardHeightProvider?.start()
// }
//
// override fun getKey(): String {
// return "预约功能操作"
// override fun onActivityCreated(savedInstanceState: Bundle?) {
// super.onActivityCreated(savedInstanceState)
// dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
// }
@Suppress("DEPRECATION")
@SuppressLint("SetTextI18n")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
ButterKnife.bind(this, view)
val reserveContent = "游戏上线,您将收到<font color='#1383EB'>免费短信</font>提醒"
reserveContentTv.text = Html.fromHtml(reserveContent)
mobileEt.setTextChangedListener { s, _, _, _ ->
mobileIndexContainer.visibility = View.GONE
mobileEtDelete.goneIf(s.trim().isEmpty())
}
mViewModel.reservation.observeNonNull(this) {
if (it.success) {
showSuccessDialog(it.withMobile, it.boundWechat)
successCallback?.onSuccess()
HistoryHelper.insertGameEntity(mGame!!)
}
}
mViewModel.reserveMobile.observe(viewLifecycleOwner, Observer {
setMobileIndexHint(it)
})
dialog?.setCanceledOnTouchOutside(true)
}
private fun showSuccessDialog(withMobile: Boolean, boundWechat: 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 = dialogConfig?.htmlContent?.fromHtml()
if (dialogConfig?.text.isNullOrEmpty()
|| (dialogConfig?.type == "wechat_bind" && boundWechat)) {
customizableBtn.visibility = View.GONE
} else {
customizableBtn.text = dialogConfig?.text
customizableBtn.setOnClickListener {
// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击跳转按钮")
DirectUtils.directToLinkPage(
requireContext(),
dialogConfig!!.toLinkEntity(),
"(游戏预约)",
"")
dismissAllowingStateLoss()
}
}
}
private fun setMobileIndexHint(reserveMobile: String?) {
var userMobile = UserManager.getInstance().userInfoEntity?.mobile
if (reserveMobile == userMobile) userMobile = null
if (!reserveMobile.isNullOrEmpty()) {
mobileIndexReserve.visibility = View.VISIBLE
mobileIndexReserve.text = reserveMobile
} else {
mobileIndexReserve.visibility = View.GONE
}
if (!userMobile.isNullOrEmpty()) {
mobileIndexUser.visibility = View.VISIBLE
mobileIndexUser.text = userMobile
} else {
mobileIndexUser.visibility = View.GONE
}
mobileIndexContainer.goneIf(mobileIndexUser.visibility == View.GONE && mobileIndexReserve.visibility == View.GONE)
if (mobileIndexContainer.visibility ==View.VISIBLE) {
mobileIndexContainer.animation = AnimationUtils.loadAnimation(requireContext(), R.anim.reserve_dialog_index_anim)
}
}
@OnClick(R.id.reserve_with_mobile_btn,
R.id.reserve_without_mobile_btn,
R.id.content_container,
R.id.close_btn,
R.id.customizable_btn,
R.id.mobile_index_reserve,
R.id.mobile_index_user,
R.id.mobile_et_delete,
R.id.mobile_et,
R.id.layout_container)
fun onClick(view: View) {
when (view.id) {
R.id.reserve_without_mobile_btn -> {
// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击无手机号预约")
if (mobileIndexContainer.visibility == View.VISIBLE) {
mobileIndexContainer.visibility = View.GONE
return
}
mViewModel.reserve(gameId = mGameId, gameName = mGameName)
}
R.id.reserve_with_mobile_btn -> {
if (mobileIndexContainer.visibility == View.VISIBLE) {
mobileIndexContainer.visibility = View.GONE
return
}
val mobile = mobileEt.text.toString()
if (mobile.length < 11 || !mobile.startsWith("1")) {
Utils.toast(context, "手机号格式错误,请检查并重新输入")
return
}
// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击立即预约")
mViewModel.reserve(gameId = mGameId, gameName = mGameName, mobile = mobile)
}
R.id.close_btn -> {
// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击关闭")
dismissAllowingStateLoss()
AppExecutor.uiExecutor.executeWithDelay(Runnable {
NotificationHelper.showNotificationHintDialog(NotificationUgc.RESERVE_GAME)
}, 1000)
}
R.id.content_container -> {
mobileIndexContainer.visibility = View.GONE
}
R.id.mobile_index_reserve -> {
mobileEt.setText(mobileIndexReserve.text.toString())
mobileEt.setSelection(mobileEt.text.length)
mobileIndexContainer.visibility = View.GONE
}
R.id.mobile_index_user -> {
mobileEt.setText(mobileIndexUser.text.toString())
mobileEt.setSelection(mobileEt.text.length)
mobileIndexContainer.visibility = View.GONE
}
R.id.mobile_et_delete -> {
mobileEt.setText("")
}
R.id.mobile_et -> {
mobileIndexContainer.visibility = View.GONE
}
R.id.layout_container -> {
dismissAllowingStateLoss()
}
}
}
override fun onResume() {
super.onResume()
if (HaloApp.getInstance().mCacheKeyboardHeight > 0) {
val attributes = dialog?.window?.attributes
val heightPixels = requireContext().resources.displayMetrics.heightPixels
val mCacheKeyboardHeight = HaloApp.getInstance().mCacheKeyboardHeight
val statusBarHeight = DisplayUtils.getStatusBarHeight(requireContext().resources)
dialog?.window?.attributes?.height = heightPixels - mCacheKeyboardHeight - statusBarHeight
attributes?.gravity = Gravity.TOP
dialog?.window?.attributes = attributes
}
mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
}
override fun onPause() {
super.onPause()
mKeyboardHeightProvider?.setKeyboardHeightObserver(null)
}
override fun onDestroy() {
super.onDestroy()
mKeyboardHeightProvider?.close()
}
override fun onKeyboardHeightChanged(height: Int, orientation: Int) {
if (height > 0) {
val attributes = dialog?.window?.attributes
attributes?.gravity = Gravity.CENTER
dialog?.window?.attributes = attributes
HaloApp.getInstance().mCacheKeyboardHeight = height
}
}
companion object {
@JvmStatic
fun getInstance(gameEntity: GameEntity, successCallback: SuccessCallback) = ReserveDialogFragment().apply {
arguments = Bundle().apply {
putParcelable(EntranceUtils.KEY_GAME, gameEntity)
}
this.successCallback = successCallback
}
}
interface SuccessCallback {
fun onSuccess()
}
}
class ReserveViewModel(application: Application) : AndroidViewModel(application) {
val reservation = MutableLiveData<Reservation>()
val reserveMobile = MutableLiveData<String>()
init {
getAppointmentMobile()
}
@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().api
.createNewGameReservation(requestMap.createRequestBody())
.subscribeOn(Schedulers.io())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
var boundWechat = false
tryWithDefaultCatch {
boundWechat = JSONObject(data.string() ?: "").getBoolean("wechat_bind")
}
reservation.postValue(Reservation(success = true, withMobile = mobile.isNotEmpty(), boundWechat = boundWechat))
ReservationRepository.addReservationToMemoryAndRefresh(gameId)
// MtaHelper.onEvent("预约游戏", "预约", gameName)
}
override fun onFailure(exception: Exception) {
Utils.toast(getApplication(), exception.message)
}
})
}
@SuppressLint("CheckResult")
private fun getAppointmentMobile() {
RetrofitManager.getInstance().api
.getAppointmentMobile(UserManager.getInstance().userId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
var mobile: String? = null
tryCatchInRelease {
val jsonArray = JSONArray(data.string())
if (jsonArray.length() > 0) {
mobile = jsonArray.get(0).toString()
}
}
reserveMobile.postValue(mobile)
}
override fun onFailure(exception: Exception) {
reserveMobile.postValue(null)
}
})
}
class Reservation(var success: Boolean = false, var withMobile: Boolean = false, var boundWechat: Boolean = false)
}
//
// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
// return inflater.inflate(R.layout.dialog_reserve_game, null)
// }
//
//// override fun getEvent(): String {
//// return "预约游戏"
//// }
////
//// override fun getKey(): String {
//// return "预约功能操作"
//// }
//
// @Suppress("DEPRECATION")
// @SuppressLint("SetTextI18n")
// override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// super.onViewCreated(view, savedInstanceState)
// ButterKnife.bind(this, view)
//
// val reserveContent = "游戏上线,您将收到<font color='#1383EB'>免费短信</font>提醒"
// reserveContentTv.text = Html.fromHtml(reserveContent)
//
//
// mobileEt.setTextChangedListener { s, _, _, _ ->
// mobileIndexContainer.visibility = View.GONE
// mobileEtDelete.goneIf(s.trim().isEmpty())
// }
//
// mViewModel.reservation.observeNonNull(this) {
// if (it.success) {
// showSuccessDialog(it.withMobile, it.boundWechat)
// successCallback?.onSuccess()
// HistoryHelper.insertGameEntity(mGame!!)
// }
// }
//
// mViewModel.reserveMobile.observe(viewLifecycleOwner, Observer {
// setMobileIndexHint(it)
// })
//
// dialog?.setCanceledOnTouchOutside(true)
// }
//
// private fun showSuccessDialog(withMobile: Boolean, boundWechat: 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 = dialogConfig?.htmlContent?.fromHtml()
// if (dialogConfig?.text.isNullOrEmpty()
// || (dialogConfig?.type == "wechat_bind" && boundWechat)) {
// customizableBtn.visibility = View.GONE
// } else {
// customizableBtn.text = dialogConfig?.text
// customizableBtn.setOnClickListener {
//// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击跳转按钮")
// DirectUtils.directToLinkPage(
// requireContext(),
// dialogConfig!!.toLinkEntity(),
// "(游戏预约)",
// "")
// dismissAllowingStateLoss()
// }
// }
// }
//
// private fun setMobileIndexHint(reserveMobile: String?) {
// var userMobile = UserManager.getInstance().userInfoEntity?.mobile
// if (reserveMobile == userMobile) userMobile = null
//
// if (!reserveMobile.isNullOrEmpty()) {
// mobileIndexReserve.visibility = View.VISIBLE
// mobileIndexReserve.text = reserveMobile
// } else {
// mobileIndexReserve.visibility = View.GONE
// }
//
// if (!userMobile.isNullOrEmpty()) {
// mobileIndexUser.visibility = View.VISIBLE
// mobileIndexUser.text = userMobile
// } else {
// mobileIndexUser.visibility = View.GONE
// }
// mobileIndexContainer.goneIf(mobileIndexUser.visibility == View.GONE && mobileIndexReserve.visibility == View.GONE)
// if (mobileIndexContainer.visibility ==View.VISIBLE) {
// mobileIndexContainer.animation = AnimationUtils.loadAnimation(requireContext(), R.anim.reserve_dialog_index_anim)
// }
// }
//
// @OnClick(R.id.reserve_with_mobile_btn,
// R.id.reserve_without_mobile_btn,
// R.id.content_container,
// R.id.close_btn,
// R.id.customizable_btn,
// R.id.mobile_index_reserve,
// R.id.mobile_index_user,
// R.id.mobile_et_delete,
// R.id.mobile_et,
// R.id.layout_container)
// fun onClick(view: View) {
// when (view.id) {
// R.id.reserve_without_mobile_btn -> {
//// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击无手机号预约")
// if (mobileIndexContainer.visibility == View.VISIBLE) {
// mobileIndexContainer.visibility = View.GONE
// return
// }
//
// mViewModel.reserve(gameId = mGameId, gameName = mGameName)
// }
//
// R.id.reserve_with_mobile_btn -> {
// if (mobileIndexContainer.visibility == View.VISIBLE) {
// mobileIndexContainer.visibility = View.GONE
// return
// }
//
// val mobile = mobileEt.text.toString()
// if (mobile.length < 11 || !mobile.startsWith("1")) {
// Utils.toast(context, "手机号格式错误,请检查并重新输入")
// return
// }
//
//// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击立即预约")
// mViewModel.reserve(gameId = mGameId, gameName = mGameName, mobile = mobile)
// }
//
// R.id.close_btn -> {
//// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击关闭")
// dismissAllowingStateLoss()
// AppExecutor.uiExecutor.executeWithDelay(Runnable {
// NotificationHelper.showNotificationHintDialog(NotificationUgc.RESERVE_GAME)
// }, 1000)
// }
// R.id.content_container -> {
// mobileIndexContainer.visibility = View.GONE
// }
// R.id.mobile_index_reserve -> {
// mobileEt.setText(mobileIndexReserve.text.toString())
// mobileEt.setSelection(mobileEt.text.length)
// mobileIndexContainer.visibility = View.GONE
// }
// R.id.mobile_index_user -> {
// mobileEt.setText(mobileIndexUser.text.toString())
// mobileEt.setSelection(mobileEt.text.length)
// mobileIndexContainer.visibility = View.GONE
// }
// R.id.mobile_et_delete -> {
// mobileEt.setText("")
// }
// R.id.mobile_et -> {
// mobileIndexContainer.visibility = View.GONE
// }
// R.id.layout_container -> {
// dismissAllowingStateLoss()
// }
// }
// }
//
// override fun onResume() {
// super.onResume()
// if (HaloApp.getInstance().mCacheKeyboardHeight > 0) {
// val attributes = dialog?.window?.attributes
// val heightPixels = requireContext().resources.displayMetrics.heightPixels
// val mCacheKeyboardHeight = HaloApp.getInstance().mCacheKeyboardHeight
// val statusBarHeight = DisplayUtils.getStatusBarHeight(requireContext().resources)
// dialog?.window?.attributes?.height = heightPixels - mCacheKeyboardHeight - statusBarHeight
// attributes?.gravity = Gravity.TOP
// dialog?.window?.attributes = attributes
// }
// mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
// }
//
// override fun onPause() {
// super.onPause()
// mKeyboardHeightProvider?.setKeyboardHeightObserver(null)
// }
//
// override fun onDestroy() {
// super.onDestroy()
// mKeyboardHeightProvider?.close()
// }
//
// override fun onKeyboardHeightChanged(height: Int, orientation: Int) {
// if (height > 0) {
// val attributes = dialog?.window?.attributes
// attributes?.gravity = Gravity.CENTER
// dialog?.window?.attributes = attributes
// HaloApp.getInstance().mCacheKeyboardHeight = height
// }
// }
//
// companion object {
// @JvmStatic
// fun getInstance(gameEntity: GameEntity, successCallback: SuccessCallback) = ReserveDialogFragment().apply {
// arguments = Bundle().apply {
// putParcelable(EntranceUtils.KEY_GAME, gameEntity)
// }
// this.successCallback = successCallback
// }
// }
//
// interface SuccessCallback {
// fun onSuccess()
// }
//}
//
//class ReserveViewModel(application: Application) : AndroidViewModel(application) {
// val reservation = MutableLiveData<Reservation>()
//
// val reserveMobile = MutableLiveData<String>()
//
// init {
// getAppointmentMobile()
// }
//
// @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().api
// .createNewGameReservation(requestMap.createRequestBody())
// .subscribeOn(Schedulers.io())
// .subscribe(object : BiResponse<ResponseBody>() {
// override fun onSuccess(data: ResponseBody) {
// var boundWechat = false
// tryWithDefaultCatch {
// boundWechat = JSONObject(data.string() ?: "").getBoolean("wechat_bind")
// }
//
// reservation.postValue(Reservation(success = true, withMobile = mobile.isNotEmpty(), boundWechat = boundWechat))
// ReservationRepository.addReservationToMemoryAndRefresh(gameId)
//
//// MtaHelper.onEvent("预约游戏", "预约", gameName)
// }
//
// override fun onFailure(exception: Exception) {
// Utils.toast(getApplication(), exception.message)
// }
// })
// }
//
// @SuppressLint("CheckResult")
// private fun getAppointmentMobile() {
// RetrofitManager.getInstance().api
// .getAppointmentMobile(UserManager.getInstance().userId)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(object : BiResponse<ResponseBody>() {
// override fun onSuccess(data: ResponseBody) {
// var mobile: String? = null
// tryCatchInRelease {
// val jsonArray = JSONArray(data.string())
// if (jsonArray.length() > 0) {
// mobile = jsonArray.get(0).toString()
// }
// }
//
// reserveMobile.postValue(mobile)
// }
//
// override fun onFailure(exception: Exception) {
// reserveMobile.postValue(null)
// }
// })
// }
//
// class Reservation(var success: Boolean = false, var withMobile: Boolean = false, var boundWechat: Boolean = false)
//}

View File

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

View File

@ -12,7 +12,7 @@ import com.gh.common.util.getFirstElementDividedByDivider
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.entity.GameEntity
import com.lightgame.download.DownloadEntity
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import java.util.*
import kotlin.collections.ArrayList

View File

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

View File

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

View File

@ -15,7 +15,6 @@ import com.gh.common.util.tryWithDefaultCatch
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
object MetaUtil {

View File

@ -52,7 +52,6 @@ object HistoryHelper {
historyGame.iconSubscript = updateEntity.iconSubscript
historyGame.name = updateEntity.name
historyGame.tagStyle = updateEntity.tagStyle
historyGame.tag = updateEntity.tag
return historyGame
}
@ -161,7 +160,9 @@ object HistoryHelper {
gamesCollectionEntity.id = gamesCollectionDetailEntity.id
gamesCollectionEntity.tags = gamesCollectionDetailEntity.tags
gamesCollectionEntity.games = ArrayList(gamesCollectionDetailEntity.games?.take(3)?.map { it.toSimpleGame() })
gamesCollectionDetailEntity.games?.take(3)?.map { it.toSimpleGame() }?.run {
gamesCollectionEntity.games = ArrayList(this)
}
gamesCollectionEntity.title = gamesCollectionDetailEntity.title
gamesCollectionEntity.intro = gamesCollectionDetailEntity.intro
gamesCollectionEntity.cover = gamesCollectionDetailEntity.cover

View File

@ -4,7 +4,7 @@ import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import java.util.*
@Keep

View File

@ -36,7 +36,14 @@ object LoghubHelper {
}
private fun createClient(logStore: String): LogProducerClient {
val config = LogProducerConfig(ENDPOINT, PROJECT, logStore, ACCESS_KEY_ID, ACCESS_KEY_SECRET).apply {
val config = LogProducerConfig(
HaloApp.getInstance().applicationContext,
ENDPOINT,
PROJECT,
logStore,
ACCESS_KEY_ID,
ACCESS_KEY_SECRET
).apply {
// 1 开启断点续传功能, 0 关闭
// 每次发送前会把日志保存到本地的binlog文件只有发送成功才会删除保证日志上传At Least Once
setPersistent(1)
@ -74,17 +81,25 @@ object LoghubHelper {
return if (!PackageFlavorHelper.IS_TEST_FLAVOR) {
LogProducerClient(config)
} else {
return LogProducerClient(config,
LogProducerCallback { resultCode, reqId, errorMessage, logBytes, compressedBytes ->
// resultCode 返回结果代码
// reqId 请求id
// errorMessage 错误信息没有为null
// logBytes 日志大小
// compressedBytes 压缩后日志大小
Utils.log("LoghubHelper -> ${String.format("%s %s %s %s %s",
LogProducerResult.fromInt(resultCode), reqId, errorMessage, logBytes, compressedBytes)}")
})
LogProducerClient(config) { resultCode, reqId, errorMessage, logBytes, compressedBytes ->
// resultCode 返回结果代码
// reqId 请求id
// errorMessage 错误信息没有为null
// logBytes 日志大小
// compressedBytes 压缩后日志大小
Utils.log(
"LoghubHelper -> ${
String.format(
"%s %s %s %s %s",
LogProducerResult.fromInt(resultCode),
reqId,
errorMessage,
logBytes,
compressedBytes
)
}"
)
}
}
}
}

View File

@ -12,13 +12,15 @@ import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.core.view.ViewCompat
import com.facebook.drawee.view.SimpleDraweeView
import com.gh.common.util.DisplayUtils
import com.gh.common.util.ImageUtils
import com.gh.common.util.doOnEnd
import com.gh.common.util.doOnStart
import com.gh.gamecenter.R
import kotlinx.android.synthetic.main.view_notifier.view.*
class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0)
: FrameLayout(context, attrs, defStyle) {
@ -65,13 +67,21 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
var showVerticalTranslateAnimation: Boolean = true
private var mCardView: CardView
private var mContentTv: TextView
private var mIconIv: SimpleDraweeView
init {
inflate(context, R.layout.view_notifier, this)
ViewCompat.setTranslationZ(this, Integer.MAX_VALUE.toFloat())
cardView.scaleX = SCALE_MINI
cardView.scaleY = SCALE_MINI
mCardView = findViewById(R.id.cardView)
mContentTv = findViewById(R.id.tvText)
mIconIv = findViewById(R.id.ivIcon)
mCardView.scaleX = SCALE_MINI
mCardView.scaleY = SCALE_MINI
verticalAnimationOffset = dp2px(100F)
@ -113,7 +123,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
expandAnimator.duration = DEFAULT_DURATION
expandAnimator.addUpdateListener { a ->
val progress = a?.animatedValue as Float
tvText.width = (textWidth * progress).toInt()
mContentTv.width = (textWidth * progress).toInt()
}
expandAnimator.doOnEnd {
enableSwipeToDismiss()
@ -124,46 +134,46 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
shrinkAnimator.duration = DEFAULT_DURATION
shrinkAnimator.addUpdateListener { a ->
val progress = a?.animatedValue as Float
tvText.width = (textWidth * progress).toInt()
mContentTv.width = (textWidth * progress).toInt()
}
shrinkAnimator.doOnEnd {
val lp = FrameLayout.LayoutParams(cardView.layoutParams)
val lp = FrameLayout.LayoutParams(mCardView.layoutParams)
lp.gravity = Gravity.NO_GRAVITY
cardView.layoutParams = lp
mCardView.layoutParams = lp
disableSwipeToDismiss()
}
translateToLeftAnimator = ObjectAnimator.ofFloat(cardView, "translationX", veryRight, centerX)
translateToLeftAnimator = ObjectAnimator.ofFloat(mCardView, "translationX", veryRight, centerX)
translateToLeftAnimator.duration = DEFAULT_DURATION
translateToLeftAnimator.doOnEnd {
onShowListener?.onShow()
val lp = FrameLayout.LayoutParams(cardView.layoutParams)
val lp = FrameLayout.LayoutParams(mCardView.layoutParams)
lp.gravity = Gravity.CENTER_HORIZONTAL
cardView.layoutParams = lp
cardView.translationX = 0f
mCardView.layoutParams = lp
mCardView.translationX = 0f
expandAnimator.start()
}
translateToRightAnimator = ObjectAnimator.ofFloat(cardView, "translationX", centerX, veryRight)
translateToRightAnimator = ObjectAnimator.ofFloat(mCardView, "translationX", centerX, veryRight)
translateToRightAnimator.duration = DEFAULT_DURATION
translateUpAnimator = ObjectAnimator.ofFloat(cardView, "translationY", veryBottom + verticalAnimationOffset, veryBottom)
translateUpAnimator = ObjectAnimator.ofFloat(mCardView, "translationY", veryBottom + verticalAnimationOffset, veryBottom)
translateUpAnimator.duration = DEFAULT_DURATION
translateUpAnimator.doOnStart { cardView.translationX = veryRight }
translateUpAnimator.doOnStart { mCardView.translationX = veryRight }
translateDownAnimator = ObjectAnimator.ofFloat(cardView, "translationY", veryBottom, veryBottom + verticalAnimationOffset)
translateDownAnimator = ObjectAnimator.ofFloat(mCardView, "translationY", veryBottom, veryBottom + verticalAnimationOffset)
translateDownAnimator.duration = DEFAULT_DURATION
zoomInAnimator = ObjectAnimator.ofPropertyValuesHolder(cardView, PropertyValuesHolder.ofFloat("scaleX", SCALE_DEFAULT),
zoomInAnimator = ObjectAnimator.ofPropertyValuesHolder(mCardView, PropertyValuesHolder.ofFloat("scaleX", SCALE_DEFAULT),
PropertyValuesHolder.ofFloat("scaleY", SCALE_DEFAULT))
zoomInAnimator.duration = DEFAULT_DURATION
zoomInAnimator.doOnStart { cardView.translationX = veryRight }
zoomInAnimator.doOnStart { cardView.translationY = veryBottom }
zoomInAnimator.doOnStart { mCardView.translationX = veryRight }
zoomInAnimator.doOnStart { mCardView.translationY = veryBottom }
zoomOutAnimator = ObjectAnimator.ofPropertyValuesHolder(cardView, PropertyValuesHolder.ofFloat("scaleX", SCALE_MINI),
zoomOutAnimator = ObjectAnimator.ofPropertyValuesHolder(mCardView, PropertyValuesHolder.ofFloat("scaleX", SCALE_MINI),
PropertyValuesHolder.ofFloat("scaleY", SCALE_MINI))
zoomOutAnimator.duration = DEFAULT_DURATION
zoomOutAnimator.doOnEnd { removeFromParent() }
@ -177,7 +187,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
}
private fun enableSwipeToDismiss() {
cardView?.setOnTouchListener(SwipeDismissTouchListener(cardView, object : SwipeDismissTouchListener.DismissCallbacks {
mCardView?.setOnTouchListener(SwipeDismissTouchListener(mCardView, object : SwipeDismissTouchListener.DismissCallbacks {
override fun canDismiss(): Boolean {
return true
}
@ -193,7 +203,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
}
private fun disableSwipeToDismiss() {
cardView?.setOnTouchListener(null)
mCardView?.setOnTouchListener(null)
}
override fun onDetachedFromWindow() {
@ -264,13 +274,13 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
fun setText(text: String?) {
if (!TextUtils.isEmpty(text)) {
tvText.text = text
tvText.measure(0, 0)
textWidth = tvText.measuredWidth
tvText.width = 0
mContentTv.text = text
mContentTv.measure(0, 0)
textWidth = mContentTv.measuredWidth
mContentTv.width = 0
cardView.measure(0, 0)
cardViewWidth = cardView.measuredWidth
mCardView.measure(0, 0)
cardViewWidth = mCardView.measuredWidth
}
}
@ -284,7 +294,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
}
fun setIcon(url: String) {
ImageUtils.display(ivIcon, url)
ImageUtils.display(mIconIv, url)
}
private fun dp2px(dp: Float): Int {

View File

@ -16,7 +16,6 @@ import com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity
import com.gh.gamecenter.qa.entity.AnswerEntity
import com.gh.gamecenter.qa.entity.Questions
import com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity
class ExampleAdapter(context: Context) : ListAdapter<AnswerEntity>(context), ISyncAdapterHandler {
@ -63,10 +62,11 @@ class ExampleAdapter(context: Context) : ListAdapter<AnswerEntity>(context), ISy
binding.title.setOnClickListener {
if ("community_article" == answer.type) {
mContext.startActivity(ArticleDetailActivity.getIntent(mContext, UserManager.getInstance().community, answer.id!!, "", getPath()))
} else {
val questions = answer.questions
mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.id, "", getPath()))
}
// else {
// val questions = answer.questions
// mContext.startActivity(QuestionsDetailActivity.getIntent(mContext, questions.id, "", getPath()))
// }
}
answerViewHolder.itemView.setOnClickListener {

View File

@ -0,0 +1,125 @@
package com.gh.common.util
import androidx.annotation.Keep
import androidx.core.util.Pools
import com.facebook.drawee.view.SimpleDraweeView
import com.facebook.imagepipeline.request.Postprocessor
class AsyncImageLoader private constructor() {
fun addAsyncImage(view: SimpleDraweeView?, url: String, isAutoPlayGif: Boolean, processor: Postprocessor?) {
try {
val loopThread = LoopThread.getInstance()
val params = loopThread.obtainImageParams()
params.view = view
params.url = url
params.isAutoPlayGif = isAutoPlayGif
params.processor = processor
loopThread.addAsyncImage(params)
} catch (e: InterruptedException) {
e.printStackTrace()
}
}
private class LoopThread private constructor() : Thread("GH_LOOP_IMAGE_LOADER") {
private var mIsLoop = false
private val mRetryCount = 3
private val mInterval = 10L
private val mImageList = ArrayList<ImageLoadParams>()
private val mImageListTemp = ArrayList<ImageLoadParams>()
private val mImagePool = Pools.SynchronizedPool<ImageLoadParams>(15)
init {
start()
}
@Synchronized
fun addAsyncImage(image: ImageLoadParams) {
if (mIsLoop) {
mImageListTemp.add(image)
} else {
mImageList.add(image)
}
}
override fun run() {
rxTimerWithIoThread(mInterval) {
try {
if (!mIsLoop) {
runInner()
}
} catch (e: Exception) {
e.printStackTrace()
}
}
}
private fun runInner() {
if (mImageList.isEmpty()) return
mIsLoop = true
mImageList.forEach { image ->
val width = image.view?.width ?: 0
if (width == 0) {
if (image.retryCount >= mRetryCount) {
loadImage(image, true)
} else {
image.retryCount += 1
mImageListTemp.add(image)
}
} else {
if (image.view?.getTag(ImageUtils.TAG_TARGET_WIDTH) == null) {
image.view?.setTag(ImageUtils.TAG_TARGET_WIDTH, width)
}
loadImage(image)
}
}
mImageList.clear()
if (mImageListTemp.isNotEmpty()) {
mImageList.addAll(mImageListTemp)
mImageListTemp.clear()
}
mIsLoop = false
}
private fun loadImage(params: ImageLoadParams, isIgnoreWidth: Boolean = false) {
ImageUtils.display(params.view, params.url, params.isAutoPlayGif, params.processor, isIgnoreWidth)
releaseImageParams(params)
}
fun obtainImageParams(): ImageLoadParams {
var acquire = mImagePool.acquire()
if (acquire == null) {
acquire = ImageLoadParams()
}
return acquire
}
private fun releaseImageParams(params: ImageLoadParams) {
params.run {
view = null
url = ""
isAutoPlayGif = false
processor = null
retryCount = 0
mImagePool.release(this)
}
}
companion object : SingletonHolder<LoopThread>({ LoopThread() })
}
companion object : SingletonHolder<AsyncImageLoader>({ AsyncImageLoader() })
}
@Keep
data class ImageLoadParams(
var view: SimpleDraweeView? = null,
var url: String = "",
var isAutoPlayGif: Boolean = true,
var processor: Postprocessor? = null,
var retryCount: Int = 0
)

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;
@ -19,11 +18,9 @@ import java.util.List;
**/
public class ConcernContentUtils {
private static final ArrayList<SimpleDraweeView> imageViewList = new ArrayList<>();
public static void addContentPic(Context context, LinearLayout linearLayout, List<String> list,
String entrance, int width) {
imageViewList.clear();
ArrayList<SimpleDraweeView> imageViewList = new ArrayList<>();
int count = list.size();
int index = 0;
for (int i = 0, size = (int) Math.ceil(list.size() / 3.0f); i < size; i++) {
@ -36,6 +33,11 @@ public class ConcernContentUtils {
for (int j = 0; j < 3; j++) {
SimpleDraweeView draweeView = getImageView(context, list, entrance, index, width, 0);
imageViewList.add(draweeView);
int position = index;
draweeView.setOnClickListener(v -> {
Intent checkIntent = ImageViewerActivity.getIntent(context, (ArrayList<String>) list, position, imageViewList, entrance);
context.startActivity(checkIntent);
});
ll.addView(draweeView);
index += 1;
}
@ -45,6 +47,11 @@ public class ConcernContentUtils {
case 1:
SimpleDraweeView draweeView = getImageView(context, list, entrance, index, width, 1);
imageViewList.add(draweeView);
int position1 = index;
draweeView.setOnClickListener(v -> {
Intent checkIntent = ImageViewerActivity.getIntent(context, (ArrayList<String>) list, position1, imageViewList, entrance);
context.startActivity(checkIntent);
});
linearLayout.addView(draweeView);
count -= 1;
index += 1;
@ -55,6 +62,11 @@ public class ConcernContentUtils {
for (int j = 0; j < 2; j++) {
SimpleDraweeView imageView = getImageView(context, list, entrance, index, width, 2);
imageViewList.add(imageView);
int position2 = index;
imageView.setOnClickListener(v -> {
Intent checkIntent = ImageViewerActivity.getIntent(context, (ArrayList<String>) list, position2, imageViewList, entrance);
context.startActivity(checkIntent);
});
ll.addView(imageView);
index += 1;
}
@ -102,10 +114,6 @@ public class ConcernContentUtils {
ScalingUtils.ScaleType.CENTER_CROP, list.get(position));
break;
}
imageView.setOnClickListener(v -> {
Intent checkIntent = ImageViewerActivity.getIntent(context, (ArrayList<String>) list, position, imageViewList, entrance);
context.startActivity(checkIntent);
});
return imageView;
}

View File

@ -123,7 +123,7 @@ public class DataUtils {
SentryAndroid.init(context, options -> {
// Sentry 疯狂报 ANR (很大一部分还是莫名奇妙的 ANR)严重影响到其它闪退日志的收集
// 这里将它局限到只有官网渠道的包才统计 ANR
if ("GH_206".equals(channel)) {
if ("GH_206".equals(channel) || "GH_BETA".equals(channel)) {
options.setAnrEnabled(true);
options.setAnrTimeoutIntervalMillis(6000);
} else {

View File

@ -170,6 +170,8 @@ public class DeviceUtils {
}
public static String getNetwork(Context context) {
context = context.getApplicationContext();
ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connManager == null) return null;
NetworkInfo info = connManager.getActiveNetworkInfo();

View File

@ -176,6 +176,8 @@ object DialogHelper {
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setContentView(binding.root)
dialog.setCanceledOnTouchOutside(false)
dialog.window?.setBackgroundDrawableResource(R.drawable.background_shape_white_radius_8)
dialog.window?.attributes = dialog.window?.attributes?.apply { width = 160F.dip2px() }
uiModificationCallback?.invoke(binding)
dialog.show()
return dialog

View File

@ -44,13 +44,9 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.common.AppExecutor;
@ -81,6 +77,7 @@ import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.Badge;
import com.gh.gamecenter.entity.BadgeEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.PermissionsEntity;
import com.gh.gamecenter.entity.PrivacyPolicyEntity;
import com.gh.gamecenter.entity.SettingsEntity;
import com.gh.gamecenter.entity.SimpleGameEntity;
@ -101,6 +98,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
public class DialogUtils {
public static Dialog showWaitDialog(Context context, String msg) {
@ -113,6 +113,10 @@ public class DialogUtils {
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setBackgroundDrawableResource(R.drawable.background_shape_white_radius_8);
WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
layoutParams.width = DisplayUtils.dip2px(160);
dialog.getWindow().setAttributes(layoutParams);
dialog.show();
return dialog;
}
@ -994,7 +998,10 @@ public class DialogUtils {
if (holder instanceof PrivacyPolicyItemViewHolder) {
PrivacyPolicyItemViewHolder viewHolder = (PrivacyPolicyItemViewHolder) holder;
PrivacyItemBinding binding = viewHolder.getBinding();
binding.setData(entity.getPermissions().get(position));
final PermissionsEntity permissionsEntity = entity.getPermissions().get(position);
ImageUtils.display(binding.icon, permissionsEntity.getIcon());
binding.name.setText(permissionsEntity.getName());
binding.intro.setText(permissionsEntity.getIntro());
GenericDraweeHierarchy hierarchy = binding.icon.getHierarchy();
if (hierarchy != null) {
if (position == 0) {
@ -1393,11 +1400,12 @@ public class DialogUtils {
} else {
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
DialogOverseaConfirmationBinding binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_oversea_confirmation, null, false);
DialogOverseaConfirmationBinding binding = DialogOverseaConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
View contentView = binding.getRoot();
binding.setGame(gameEntity);
binding.gameIcon.displayGameIcon(gameEntity);
binding.gameNameTv.setText(context.getString(R.string.dialog_oversea_hint, gameEntity.getName()));
binding.urlTv.setText(gameEntity.getOverseasAddressDialog().getLink());
binding.closeIv.setOnClickListener(v -> dialog.dismiss());
binding.downloadBtn.setText("下载(" + gameEntity.getApk().get(0).getSize() + "");
@ -1434,7 +1442,7 @@ public class DialogUtils {
params = window.getAttributes();
params.width = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.9);
window.setAttributes(params);
window.setBackgroundDrawableResource(R.drawable.full_dialog_background);
window.setBackgroundDrawableResource(R.drawable.textview_white_up);
}
inflate.findViewById(R.id.imprint_close).setOnClickListener(v -> dialog.dismiss());
@ -1453,10 +1461,11 @@ public class DialogUtils {
continue;
}
View item = LayoutInflater.from(context).inflate(R.layout.imprint_content_item, null);
ImprintContentItemBinding bind = DataBindingUtil.bind(item);
bind.setApk(apk);
ImprintContentItemBinding bind = ImprintContentItemBinding.bind(item);
String platform = TextUtils.isEmpty(apk.getRemark()) ? apk.getPlatformName() : apk.getPlatformName() + "\n" + apk.getRemark();
bind.setPlatformName(platform);
bind.imprintPlatform.setText(platform);
bind.imprintVersion.setText(apk.getVersion());
bind.imprintTime.setText(NewsUtils.getFormattedTime(apk.getTime() != null ? apk.getTime() : 0));
content.addView(item, LinearLayout.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(40));
}
@ -2209,7 +2218,7 @@ public class DialogUtils {
dialog.show();
}
public static void showReserveSuccess2WechatBindDialog(Context context, ConfirmListener confirmListener,CancelListener cancelListener) {
public static void showReserveSuccess2WechatBindDialog(Context context, ConfirmListener confirmListener, CancelListener cancelListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);

View File

@ -49,11 +49,8 @@ import com.gh.gamecenter.personalhome.background.PersonalityBackgroundActivity
import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
import com.gh.gamecenter.personalhome.home.UserHistoryViewModel
import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity
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.newdetail.NewQuestionDetailActivity
import com.gh.gamecenter.qa.subject.CommunitySubjectActivity
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
@ -706,7 +703,7 @@ object DirectUtils {
fun directToToolbox(context: Context, gameId: String, toolboxUrl: String, entrance: String = ENTRANCE_BROWSER) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance)
bundle.putString(KEY_TO, ToolBoxActivity::class.java.simpleName)
bundle.putString(KEY_TO, ToolBoxBlockActivity::class.java.name)
bundle.putString(KEY_GAMEID, gameId)
bundle.putString(KEY_URL, toolboxUrl)
jumpActivity(context, bundle)
@ -901,14 +898,14 @@ object DirectUtils {
*/
@JvmStatic
fun directToCommunityColumn(context: Context, community: CommunityEntity?, subjectId: String, entrance: String?, path: String?) {
if (subjectId.isEmpty()) return
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)
// if (subjectId.isEmpty()) return
// 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)
}
@JvmStatic
@ -1175,13 +1172,13 @@ object DirectUtils {
*/
@JvmStatic
fun directAskColumnLabelDetail(context: Context, tag: String, community: CommunityEntity, entrance: String? = null, path: String? = "") {
val bundle = Bundle()
bundle.putString(KEY_TO, AskColumnDetailActivity::class.java.name)
bundle.putString(KEY_ASK_TAG, tag)
bundle.putParcelable(KEY_COMMUNITY_DATA, community)
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_PATH, path)
jumpActivity(context, bundle)
// val bundle = Bundle()
// bundle.putString(KEY_TO, AskColumnDetailActivity::class.java.name)
// bundle.putString(KEY_ASK_TAG, tag)
// bundle.putParcelable(KEY_COMMUNITY_DATA, community)
// bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
// bundle.putString(KEY_PATH, path)
// jumpActivity(context, bundle)
}
/**
@ -1189,14 +1186,14 @@ object DirectUtils {
*/
@JvmStatic
fun directAskColumnDetail(context: Context, columnId: String, community: CommunityEntity, entrance: String? = null, path: String? = "") {
if (columnId.isEmpty()) return
val bundle = Bundle()
bundle.putString(KEY_TO, AskColumnDetailActivity::class.java.name)
bundle.putString(KEY_COLUMN_ID, columnId)
bundle.putParcelable(KEY_COMMUNITY_DATA, community)
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_PATH, path)
jumpActivity(context, bundle)
// if (columnId.isEmpty()) return
// val bundle = Bundle()
// bundle.putString(KEY_TO, AskColumnDetailActivity::class.java.name)
// bundle.putString(KEY_COLUMN_ID, columnId)
// bundle.putParcelable(KEY_COMMUNITY_DATA, community)
// bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
// bundle.putString(KEY_PATH, path)
// jumpActivity(context, bundle)
}
/**
@ -1239,13 +1236,13 @@ object DirectUtils {
*/
@JvmStatic
fun directSimpleArticleList(context: Context, sortType: String, entrance: String? = null, path: String? = "") {
if (sortType.isEmpty()) return
val bundle = Bundle()
bundle.putString(KEY_TO, SimpleArticleListActivity::class.java.name)
bundle.putString(KEY_TYPE, sortType)
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_PATH, path)
jumpActivity(context, bundle)
// if (sortType.isEmpty()) return
// val bundle = Bundle()
// bundle.putString(KEY_TO, SimpleArticleListActivity::class.java.name)
// bundle.putString(KEY_TYPE, sortType)
// bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
// bundle.putString(KEY_PATH, path)
// jumpActivity(context, bundle)
}
@JvmStatic

View File

@ -114,7 +114,7 @@ object DownloadItemUtils {
// 已预约
holder.gameDownloadBtn.visibility = View.VISIBLE
holder.gameDownloadBtn.text = "已预约"
holder.gameDownloadBtn.setTextColor(ContextCompat.getColor(holder.gameDes.context, R.color.aaaaaa))
holder.gameDownloadBtn.setTextColor(ContextCompat.getColor(holder.gameDes.context, R.color.text_subtitleDesc))
holder.gameDownloadBtn.setBackgroundResource(R.drawable.button_round_f5f5f5)
updateItemViewStatus(holder, false, null, null)
}
@ -181,8 +181,8 @@ object DownloadItemUtils {
setBackgroundResource(R.drawable.button_reserve)
} else {
text = "已预约"
setTextColor(Color.WHITE)
setBackgroundResource(R.drawable.game_item_btn_pause_dn)
setTextColor(R.color.text_subtitleDesc.toColor())
setBackgroundResource(R.drawable.bg_shape_f5_radius_999)
}
}
return
@ -208,7 +208,7 @@ object DownloadItemUtils {
} else {
text = context.getString(R.string.none)
setTextColor(R.color.button_gray.toColor())
setBackgroundResource(R.drawable.news_detail_comment)
setBackgroundResource(R.drawable.button_border_gray_oval)
if (hideDownloadBtnIfNoAvailableContent) {
visibility = View.GONE
}
@ -227,16 +227,18 @@ object DownloadItemUtils {
setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style))
} else if (status == DownloadStatus.waiting) {
setText(R.string.waiting)
setBackgroundResource(R.drawable.game_item_btn_downloading_style)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style))
setBackgroundResource(R.drawable.button_round_border_eeeeee)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_subtitleDesc))
} else if (status == DownloadStatus.pause || status == DownloadStatus.timeout || status == DownloadStatus.neterror || status == DownloadStatus.subscribe || status == DownloadStatus.overflow) {
if (status == DownloadStatus.waiting) {
setText(R.string.waiting)
setBackgroundResource(R.drawable.button_round_border_eeeeee)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_subtitleDesc))
} else {
setText(R.string.downloading)
setBackgroundResource(R.drawable.game_item_btn_downloading_style)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style))
}
setBackgroundResource(R.drawable.game_item_btn_downloading_style)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style))
} else if (status == DownloadStatus.done) {
val xapkStatus = downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS]
if (XapkUnzipStatus.UNZIPPING.name == xapkStatus) {
@ -416,6 +418,7 @@ object DownloadItemUtils {
holder.recommendTv.text = recommendStyle.text
if (TextUtils.isEmpty(recommendStyle.icon)) {
holder.recommendIv.visibility = View.GONE
holder.recommendContainer?.setPadding(6F.dip2px(), 0, 8F.dip2px(), 0)
} else {
holder.recommendIv.visibility = View.VISIBLE
ImageUtils.display(holder.recommendIv, recommendStyle.icon)

View File

@ -186,6 +186,6 @@ object DownloadNotificationHelper {
}
private fun getNotificationIcon(): Int {
return if (mShouldUseAlternativeNotificationIcon) R.drawable.ic_notification else R.mipmap.logo
return if (mShouldUseAlternativeNotificationIcon) R.drawable.ic_download_notification else R.mipmap.logo
}
}

View File

@ -41,6 +41,7 @@ import java.util.*
object DownloadObserver {
private val mApplication = HaloApp.getInstance().application
// 简单 debounce 因为内存更新 downloadEntity 对象造成的触发双重下载完成事件
// TODO 修复因为更改内存对象造成的双重下载完成事件问题,具体触发代码见 DownloadDao.updateSnapshotList
private var mDoneDebouncePair: Pair<String, Long>? = null
@ -75,15 +76,18 @@ object DownloadObserver {
val currentActivity = AppManager.getInstance().currentActivity() ?: return
DialogHelper.showDialog(currentActivity, "下载失败", "下载链接已失效,建议提交反馈", "立即反馈", "取消", {
SuggestionActivity.startSuggestionActivity(currentActivity,
SuggestType.gameQuestion, "notfound",
StringUtils.buildString(downloadEntity.name, ",问题反馈:下载链接失效"),
SimpleGameEntity(gameId, downloadEntity.name, ""))
SuggestionActivity.startSuggestionActivity(
currentActivity,
SuggestType.gameQuestion, "notfound",
StringUtils.buildString(downloadEntity.name, ",问题反馈:下载链接失效"),
SimpleGameEntity(gameId, downloadEntity.name, "")
)
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
return
} else if (DownloadStatus.neterror == downloadEntity.status || DownloadStatus.timeout == downloadEntity.status) {
if (downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD].isNullOrEmpty()
&& NetworkUtils.isWifiConnected(HaloApp.getInstance().application)) {
&& NetworkUtils.isWifiConnected(HaloApp.getInstance().application)
) {
downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD] = downloadEntity.progress.toString()
downloadManager.updateDownloadEntity(downloadEntity)
downloadManager.resumeDownload(downloadEntity.url)
@ -123,7 +127,8 @@ object DownloadObserver {
performDownloadCompleteAction(downloadEntity, gameId, downloadManager)
} else {
if (mDoneDebouncePair?.second == 0L
|| (mDoneDebouncePair?.second ?: 0) - System.currentTimeMillis() > 500) {
|| System.currentTimeMillis() - (mDoneDebouncePair?.second ?: 0) > 500
) {
performDownloadCompleteAction(downloadEntity, gameId, downloadManager)
}
}
@ -137,7 +142,8 @@ object DownloadObserver {
// 如果已下载大小发生变化,表示成功恢复下载,则重置重试标记
if (downloadEntity.status == DownloadStatus.downloading &&
downloadEntity.progress.toString() != downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD]) {
downloadEntity.progress.toString() != downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD]
) {
downloadEntity.meta[Constants.MARK_RETRY_DOWNLOAD] = ""
downloadManager.updateDownloadEntity(downloadEntity)
}
@ -149,9 +155,11 @@ object DownloadObserver {
}
private fun performDownloadCompleteAction(downloadEntity: DownloadEntity,
gameId: String,
downloadManager: DownloadManager) {
private fun performDownloadCompleteAction(
downloadEntity: DownloadEntity,
gameId: String,
downloadManager: DownloadManager
) {
if (downloadEntity.name.contains(mApplication.getString(R.string.app_name))) {
statDoneEvent(downloadEntity)
MtaHelper.onEvent("软件更新", "下载完成")
@ -167,6 +175,8 @@ object DownloadObserver {
} else {
statDoneEvent(downloadEntity)
GameActivityDownloadHelper.clear()
EnergyTaskHelper.postEnergyTask(
"download_game",
downloadEntity.gameId,
@ -196,8 +206,10 @@ object DownloadObserver {
val currentActivity = AppManager.getInstance().currentActivity()
?: return
SimulatorDownloadManager.getInstance().showDownloadDialog(currentActivity, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, downloadEntity.gameId, gameName, null)
SimulatorDownloadManager.getInstance().showDownloadDialog(
currentActivity, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, downloadEntity.gameId, gameName, null
)
}
SimulatorGameManager.recordDownloadSimulatorGame(downloadEntity.gameId, simulator.type)
SimulatorGameManager.postPlayedGame(downloadEntity.gameId, downloadEntity.packageName)
@ -205,7 +217,8 @@ object DownloadObserver {
val downloadType = downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE)
// 是否是自动安装
val isAutoInstall = PreferenceManager.getDefaultSharedPreferences(mApplication).getBoolean(
GameDownloadSettingFragment.AUTO_INSTALL_SP_KEY, true)
GameDownloadSettingFragment.AUTO_INSTALL_SP_KEY, true
)
if (downloadType == Constants.SIMULATOR_DOWNLOAD || isAutoInstall) {
if (FileUtils.isEmptyFile(downloadEntity.path)) {
Utils.toast(mApplication, R.string.install_failure_hint)
@ -252,7 +265,8 @@ object DownloadObserver {
val simulator = HaloApp.get(downloadEntity.name, true) as? SimulatorEntity
?: return@showSimulatorParseErrorDialog
DownloadManager.getInstance().cancel(downloadEntity.url, true, true)
SimulatorDownloadManager.getInstance().showDownloadDialog(currentActivity, simulator, SimulatorDownloadManager.SimulatorLocation.SIMULATOR_GAME)
SimulatorDownloadManager.getInstance()
.showDownloadDialog(currentActivity, simulator, SimulatorDownloadManager.SimulatorLocation.SIMULATOR_GAME)
}
}
}
@ -290,15 +304,18 @@ object DownloadObserver {
}
val isPlatformRecommend = java.lang.Boolean.parseBoolean(downloadEntity.getMetaExtra(Constants.IS_PLATFORM_RECOMMEND))
ExposureUtils.logADownloadCompleteExposureEvent(
GameEntity(id = downloadEntity.gameId,
mName = downloadEntity.name.removeSuffix(Constants.GAME_NAME_DECORATOR),
gameVersion = downloadEntity.versionName ?: "",
isPlatformRecommend = isPlatformRecommend),
downloadEntity.platform,
downloadEntity.exposureTrace,
downloadEntity.meta[DownloadEntity.DOWNLOAD_HOST_KEY] ?: "unknown",
downloadEntity.meta[DownloadEntity.DOWNLOAD_PATH_KEY] ?: "unknown",
type)
GameEntity(
id = downloadEntity.gameId,
mName = downloadEntity.name.removeSuffix(Constants.GAME_NAME_DECORATOR),
gameVersion = downloadEntity.versionName ?: "",
isPlatformRecommend = isPlatformRecommend
),
downloadEntity.platform,
downloadEntity.exposureTrace,
downloadEntity.meta[DownloadEntity.DOWNLOAD_HOST_KEY] ?: "unknown",
downloadEntity.meta[DownloadEntity.DOWNLOAD_PATH_KEY] ?: "unknown",
type
)
DataCollectionUtils.uploadDownload(mApplication, downloadEntity, "完成")
}
@ -320,12 +337,14 @@ object DownloadObserver {
val params = HashMap<String, String>()
params["game"] = id
params["platform"] = platform ?: ""
val body = RequestBody.create(MediaType.parse("application/json"),
JSONObject(params as Map<*, *>).toString())
val body = RequestBody.create(
MediaType.parse("application/json"),
JSONObject(params as Map<*, *>).toString()
)
RetrofitManager.getInstance().api.postDownload(body)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Response())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Response())
}
}

View File

@ -28,6 +28,9 @@ import java.util.Set;
*/
public class EmojiUtils {
private EmojiUtils() {
}
// Generated from https://unicode.org/Public/14.0.0/ucd/emoji/emoji-data.txt
private static final Set<String> EMOJI_HASH_SET = new HashSet<>(Arrays.asList(
"1f000", "1f001", "1f002", "1f003", "1f004", "1f005", "1f006", "1f007", "1f008", "1f009",
@ -398,10 +401,6 @@ public class EmojiUtils {
"e0072", "e0073", "e0074", "e0075", "e0076", "e0077", "e0078", "e0079", "e007a", "e007b",
"e007c", "e007d", "e007e", "e007f", "fe0f"));
private static String toHexStr(char c) {
return Integer.toHexString(c);
}
private static String toHexStr(int c) {
return Integer.toHexString(c);
}

View File

@ -257,6 +257,7 @@ public class EntranceUtils {
public static final String KEY_BLOCK_ID = "block_id";
public static final String KEY_BLOCK_NAME = "block_name";
public static final String KEY_INSERT_GAME_COLLECTION = "insert_game_collection";
public static final String KEY_INSERT_BBS_VIDEO = "insert_bbs_video";
public static final String KEY_IS_FROM_SQUARE = "is_from_square";
public static final String KEY_FORUM_NAME = "forum_name";//版块名称
public static final String KEY_GAME_COLLECTION_TITLE = "game_collection_title";//游戏单标题

View File

@ -752,10 +752,11 @@ fun <T> Array<out T>.secondOrNull(): T? {
*/
fun ExpandTextView.setTextWithInterceptingInternalUrl(
shrankText: CharSequence,
expandedText: CharSequence
expandedText: CharSequence,
clickedCallback: (url: String)-> Unit
) {
var shrankSsb = shrankText.interceptUrlSpanAndRoundImageSpan()
var expandedSsb = expandedText.interceptUrlSpanAndRoundImageSpan()
var shrankSsb = shrankText.interceptUrlSpanAndRoundImageSpan(clickedCallback)
var expandedSsb = expandedText.interceptUrlSpanAndRoundImageSpan(clickedCallback)
// 去掉旧版本 Android 系统 [Html.FROM_HTML_MODE_LEGACY] 产生的两个换行符 (丑陋的代码)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
@ -830,7 +831,7 @@ fun TextView.setTextWithInterceptingInternalUrl(text: CharSequence) {
setText(ssb)
}
fun CharSequence.interceptUrlSpanAndRoundImageSpan(): SpannableStringBuilder {
fun CharSequence.interceptUrlSpanAndRoundImageSpan(clickedCallback: ((url: String) -> Unit)? = null): SpannableStringBuilder {
return SpannableStringBuilder.valueOf(this).apply {
getSpans(0, length, URLSpan::class.java).forEach {
setSpan(
@ -845,6 +846,7 @@ fun CharSequence.interceptUrlSpanAndRoundImageSpan(): SpannableStringBuilder {
}
override fun onClick(widget: View) {
clickedCallback?.invoke(it.url)
if (!DefaultUrlHandler.interceptUrl(widget.context, it.url, "")) {
widget.context.startActivity(
WebActivity.getIntent(
@ -887,6 +889,10 @@ fun Int.toResString(): String {
return HaloApp.getInstance().application.resources.getString(this)
}
fun Int.toPx(): Int {
return HaloApp.getInstance().application.resources.getDimension(this).toInt()
}
fun Int.toSimpleCount(): String {
return NumberUtils.transSimpleCount(this)
}
@ -905,8 +911,13 @@ fun Long.toProperReadableSize(): String {
/**
* Image related
*/
fun SimpleDraweeView.display(url: String) {
ImageUtils.display(this, url)
fun SimpleDraweeView.display(url: String?, goneIfEmpty: Boolean = false) {
if (goneIfEmpty && TextUtils.isEmpty(url)) {
visibility = View.GONE
} else {
ImageUtils.display(this, url)
visibility = View.VISIBLE
}
}
/**
@ -1036,6 +1047,13 @@ inline fun rxTimer(interval: Long, crossinline block: (times: Long) -> Unit): Di
}
}
inline fun rxTimerWithIoThread(interval: Long, crossinline block: (times: Long) -> Unit): Disposable {
return Observable.interval(0, interval, TimeUnit.MILLISECONDS)
.subscribe {
block.invoke(it)
}
}
fun LottieAnimationView.doOnAnimationEnd(action: () -> Unit) {
this.addAnimatorListener(object : Animator.AnimatorListener {
override fun onAnimationRepeat(animation: Animator?) {

View File

@ -0,0 +1,413 @@
package com.gh.common.util
import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import androidx.appcompat.app.AppCompatActivity
import com.gh.common.DefaultJsApi
import com.gh.common.constant.Constants
import com.gh.common.dialog.CertificationDialog
import com.gh.common.exposure.ExposureEvent
import com.gh.common.exposure.ExposureManager
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.ExposureType
import com.gh.common.history.HistoryHelper
import com.gh.common.repository.ReservationRepository
import com.gh.common.runOnUiThread
import com.gh.common.view.dsbridge.CompletionHandler
import com.gh.download.DownloadManager
import com.gh.download.dialog.DownloadDialog
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.entity.ApkEntity
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.entity.PluginLocation
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.retrofit.EmptyResponse
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.teenagermode.TeenagerModeActivity
import com.gh.gamecenter.user.ApiResponse
import com.lightgame.download.FileUtils
/**
* 游戏活动下载辅助类
*/
object GameActivityDownloadHelper {
private var mTraceEvent: ExposureEvent? = null
private var mGameEntity: GameEntity? = null
fun start(context: Context, event: DefaultJsApi.GameActivityEvent) {
if (mGameEntity != null && mGameEntity?.id == event.gameId) {
runOnUiThread {
handleGameEntity(context, event, mGameEntity!!)
}
} else {
RetrofitManager.getInstance()
.api
.getGameDigest(event.gameId)
.map(ApkActiveUtils.filterMapper)
.compose(observableToMain())
.subscribe(object : Response<GameEntity>() {
override fun onResponse(gameEntity: GameEntity?) {
mGameEntity = gameEntity
gameEntity?.let {
handleGameEntity(context, event, it)
}
}
})
}
}
private fun handleGameEntity(
context: Context,
event: DefaultJsApi.GameActivityEvent,
gameEntity: GameEntity
) {
// 青少年模式
if (isTeenageMode(context)) return
val entrance = "(游戏活动[${event.activityTitle}])"
val location = "游戏活动:${event.activityTitle}-${gameEntity.name}"
if (mTraceEvent == null) {
val exposureSources = arrayListOf(
ExposureSource("游戏活动", "${event.activityTitle}+${event.activityId}")
)
mTraceEvent = ExposureEvent.createEvent(gameEntity, exposureSources, null, ExposureType.EXPOSURE)
}
mTraceEvent?.run {
when {
// 预约
gameEntity.isReservable -> reserve(context, gameEntity, entrance, this)
// 开始玩
gameEntity.getApk().size == 0 && gameEntity.h5Link != null -> play(context, gameEntity)
// 下载
else -> handleDownload(context, event, gameEntity, entrance, location, this)
}
}
}
// 青少年模式
private fun isTeenageMode(context: Context): Boolean {
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
DialogHelper.showDialog(
context,
"提示",
"当前处于儿童/青少年模式, \n暂不提供游戏下载",
"退出青少年模式",
"关闭",
{ context.startActivity(TeenagerModeActivity.getIntent(context)) },
{},
DialogHelper.Config(
centerTitle = true,
centerContent = true
)
)
return true
}
return false
}
// 预约
private fun reserve(
context: Context,
gameEntity: GameEntity,
entrance: String,
traceEvent: ExposureEvent
) {
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.id)) {
CheckLoginUtils.checkLogin(context, entrance) {
ReservationHelper.reserve(context, gameEntity.id, object : EmptyCallback {
override fun onCallback() {
LogUtils.logReservation(gameEntity, traceEvent)
clear()
}
})
}
} else {
ToastUtils.toast("游戏已成功预约")
}
}
// 开始玩(H5链接)
private fun play(context: Context, gameEntity: GameEntity) {
val linkEntity = gameEntity.h5Link
val isPlay = "play" == linkEntity!!.type // 是否为开始玩
if (isPlay) {
HistoryHelper.insertGameEntity(gameEntity)
}
val i = WebActivity.getIntentForWebGame(
context,
gameEntity.h5Link!!.link,
gameEntity.name,
isPlay,
linkEntity.closeButton
)
context.startActivity(i)
}
// 下载
private fun handleDownload(
context: Context,
event: DefaultJsApi.GameActivityEvent,
gameEntity: GameEntity,
entrance: String,
location: String,
traceEvent: ExposureEvent
) {
val apk = getApk(gameEntity, event, true) ?: return
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshotByUrl(apk.url)
if (downloadEntity != null) {
ToastUtils.toast("${gameEntity.name}已加入下载队列")
} else {
val str = GameUtils.getDownloadBtnText(context, gameEntity, PluginLocation.only_game)
if (str == context.getString(R.string.download)) {
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
}
}
}
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.attempt)) {
RealNameHelper.checkIfAuth(context, gameEntity, object : EmptyCallback {
override fun onCallback() {
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
}
}
}
}
})
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str.contains("")) {
if (gameEntity.pluggableCollection != null) {
DownloadDialog.showDownloadDialog(context, gameEntity, traceEvent, entrance, location)
} else {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
plugin(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
}
}
}
} else if (str == context.getString(R.string.install) || str == context.getString(R.string.launch)) {
ToastUtils.toast("${gameEntity.name}已加入下载队列")
} else if (str == context.getString(R.string.update)) {
DialogUtils.checkDownload(context, apk.size) { isSubscribe: Boolean ->
update(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
}
}
}
}
private fun getApk(
gameEntity: GameEntity,
event: DefaultJsApi.GameActivityEvent,
isRemoveOther: Boolean
): ApkEntity? {
return when {
gameEntity.getApk().isEmpty() -> null
gameEntity.getApk().size == 1 -> gameEntity.getApk()[0]
// 找出对应平台版本Apk且移除掉其他平台版本Apk
isRemoveOther -> {
// 当前游戏为多版本时,只保留活动指定的版本即可,方便之后判断
var apk: ApkEntity? = null
val iterator = gameEntity.getApk().iterator()
while (iterator.hasNext()) {
val tempApk = iterator.next()
if (tempApk.getPlatform() == event.platform) {
apk = tempApk
} else {
iterator.remove()
}
}
apk
}
// 找出对应平台版本Apk即可
else -> {
var apk: ApkEntity? = null
run outside@{
gameEntity.getApk().forEach {
if (it.getPlatform() == event.platform) {
apk = it
return@outside
}
}
}
apk
}
}
}
private fun download(
context: Context,
gameEntity: GameEntity,
apk: ApkEntity,
isSubscribe: Boolean,
entrance: String,
location: String,
traceEvent: ExposureEvent
) {
val msg = FileUtils.isCanDownload(context, apk.size)
if (TextUtils.isEmpty(msg)) {
DataUtils.onGameDownloadEvent(context, gameEntity.name, apk.getPlatform(), entrance, "下载开始", "下载")
DownloadManager.createDownload(context, apk, gameEntity, context.getString(
R.string.download), entrance, location, isSubscribe, traceEvent)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
} else {
ToastUtils.toast(msg)
}
}
// 插件化
private fun plugin(
context: Context,
gameEntity: GameEntity,
apk: ApkEntity,
entrance: String,
location: String,
isSubscribe: Boolean,
traceEvent: ExposureEvent?
) {
val msg = FileUtils.isCanDownload(context, apk.size)
if (TextUtils.isEmpty(msg)) {
DataUtils.onGameDownloadEvent(context, gameEntity.name, apk.getPlatform(), entrance, "下载开始", "插件化")
DownloadManager.createDownload(context, apk, gameEntity, "插件化", entrance, location, isSubscribe, traceEvent)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
} else {
ToastUtils.toast(msg)
}
}
// 更新
private fun update(
context: Context,
gameEntity: GameEntity,
apk: ApkEntity,
entrance: String,
location: String,
isSubscribe: Boolean,
traceEvent: ExposureEvent?
) {
DataUtils.onGameUpdateEvent(context, gameEntity.name, apk.getPlatform(), "下载开始")
DownloadManager.createDownload(context, apk, gameEntity, "更新", entrance, location, isSubscribe, traceEvent)
ToastUtils.toast("${gameEntity.name}已加入下载队列")
}
@SuppressLint("CheckResult")
fun postTaskComplete(gameId: String) {
val api = RetrofitManager.getInstance().newApi
val single = if (UserManager.getInstance().isLoggedIn) {
api.postGameActivityTask(gameId)
} else {
api.postGameActivityTaskForNoLogin(gameId)
}
single.compose(singleToMain()).subscribe(EmptyResponse())
}
// 判断是否完成任务(预约完成或者已安装且无更新)
@SuppressLint("CheckResult")
fun checkTaskComplete(
context: Context,
event: DefaultJsApi.GameActivityEvent,
handler: CompletionHandler<Any>
) {
// 预约完成
if (ReservationRepository.thisGameHasBeenReserved(event.gameId)) {
postTaskComplete(event.gameId)
handler.complete(true)
return
}
if (mGameEntity != null && mGameEntity?.id == event.gameId) {
handleCheckTaskComplete(context, mGameEntity, event, handler)
} else {
RetrofitManager.getInstance()
.api
.getGameDigest(event.gameId)
.map(ApkActiveUtils.filterMapper)
.compose(observableToMain())
.subscribe(object : Response<GameEntity>() {
override fun onResponse(gameEntity: GameEntity?) {
mGameEntity = gameEntity
handleCheckTaskComplete(context, gameEntity, event, handler)
}
override fun onApiFailure(e: ApiResponse<GameEntity>?) {
super.onApiFailure(e)
handler.complete(false)
}
})
}
}
private fun handleCheckTaskComplete(
context: Context,
gameEntity: GameEntity?,
event: DefaultJsApi.GameActivityEvent,
handler: CompletionHandler<Any>
) {
if (gameEntity == null) {
handler.complete(false)
} else {
val apk = getApk(gameEntity, event, false)
if (apk == null) {
handler.complete(false)
} else {
// 已安装
if (PackageUtils.isInstalled(context, apk.packageName)) {
// 是否可更新
if (PackageUtils.isCanUpdate(apk, event.gameId)
|| PackageUtils.isNonPluginUpdatable(apk, gameEntity)) {
handler.complete(false)
} else {
// 已安装且无更新
postTaskComplete(event.gameId)
handler.complete(true)
}
} else {
handler.complete(false)
}
}
}
}
fun postExposureEvent(event: DefaultJsApi.GameActivityEvent) {
RetrofitManager.getInstance()
.api
.getGameDigest(event.gameId)
.map(ApkActiveUtils.filterMapper)
.compose(observableToMain())
.subscribe(object : Response<GameEntity>() {
override fun onResponse(gameEntity: GameEntity?) {
mGameEntity = gameEntity
gameEntity?.let {
val exposureSources = arrayListOf(
ExposureSource("游戏活动", "${event.activityTitle}+${event.activityId}")
)
mTraceEvent = ExposureEvent.createEvent(
gameEntity,
exposureSources,
null,
ExposureType.EXPOSURE
)
mTraceEvent?.run { ExposureManager.log(this) }
}
}
})
}
fun clear() {
mTraceEvent = null
mGameEntity = null
}
}

View File

@ -6,6 +6,7 @@ import android.app.Application
import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.widget.ImageView
import android.widget.ProgressBar
import com.gh.base.CurrentActivityHolder
@ -105,7 +106,7 @@ object GameCollectionSquareBrowseTaskHelper {
HaloApp.getInstance().unregisterActivityLifecycleCallbacks(mActivityLifecycleCallbacks)
}
fun resumeTimeCount() {
private fun resumeTimeCount() {
if (!mIsBrowseTimeCountEnabled) return
mIsBrowseTimeCountValid = true
@ -113,30 +114,42 @@ object GameCollectionSquareBrowseTaskHelper {
mThreadService.execute {
while (mIsBrowseTimeCountEnabled && mIsBrowseTimeCountValid) {
val topActivity = CurrentActivityHolder.getCurrentActivity() ?: continue
if (isGameCollectionSquare(topActivity, false) && mIsFirstEnterSquare) {
mIsFirstEnterSquare = false
topActivity.intent.putExtra(KEY_IS_FORM_BROWSE_TASK, true)
}
if (isTopActivityGameCollectionRelated(topActivity)) {
tryWithDefaultCatch {
showOrUpdateFloatView(topActivity, if (mIsFinished) mBrowseTimeTimeout else mBrowseTimeCount)
if (mIsFinished) {
disableBrowseTimeCount()
} else {
mBrowseTimeCount++
if (mBrowseTimeCount >= mBrowseTimeTimeout) {
showOrUpdateFloatView(topActivity, mBrowseTimeTimeout)
postBrowseFinish()
}
}
}
}
checkFirstEnterSquare(topActivity)
runBrowseTask(topActivity)
Thread.sleep(1000)
}
}
}
fun pauseTimeCount() {
private fun checkFirstEnterSquare(topActivity: Activity) {
if (isGameCollectionSquare(topActivity, false) && mIsFirstEnterSquare) {
mIsFirstEnterSquare = false
topActivity.intent.putExtra(KEY_IS_FORM_BROWSE_TASK, true)
}
}
private fun runBrowseTask(topActivity: Activity) {
if (isTopActivityGameCollectionRelated(topActivity)) {
tryWithDefaultCatch {
showOrUpdateFloatView(topActivity, if (mIsFinished) mBrowseTimeTimeout else mBrowseTimeCount)
if (mIsFinished) {
disableBrowseTimeCount()
} else {
countBrowseTimeout(topActivity)
}
}
}
}
private fun countBrowseTimeout(topActivity: Activity) {
mBrowseTimeCount++
if (mBrowseTimeCount >= mBrowseTimeTimeout) {
showOrUpdateFloatView(topActivity, mBrowseTimeTimeout)
postBrowseFinish()
}
}
private fun pauseTimeCount() {
if (!mIsBrowseTimeCountEnabled) return
mIsBrowseTimeCountValid = false
@ -165,49 +178,61 @@ object GameCollectionSquareBrowseTaskHelper {
val isFinished = time == mBrowseTimeTimeout
val floatView = EasyFloat.getFloatView(FLOATING_SQUARE_BROWSE_TASK_VIEW)
if (floatView != null) {
if (mBrowsePro == null) {
mBrowsePro = floatView.findViewById(R.id.browsePro)
}
mBrowsePro?.progress = time
if (isFinished) {
floatView.findViewById<ImageView>(R.id.browsePic)
.setImageResource(R.drawable.pic_browse_square_finish)
}
updateFloatView(floatView, isFinished, time)
} else {
EasyFloat.with(activity)
.setLayout(R.layout.layout_square_browse_task_float)
.setTag(FLOATING_SQUARE_BROWSE_TASK_VIEW)
.setAnimator(null)
.setGravity(Gravity.END.or(Gravity.CENTER_VERTICAL), 0, 0)
.setSidePattern(SidePattern.RIGHT)
.setShowPattern(ShowPattern.CURRENT_ACTIVITY)
.setDragEnable(false)
.registerCallback {
createResult { _, _, view ->
if (isFinished) {
view?.findViewById<ProgressBar>(R.id.browsePro)?.run {
max = mBrowseTimeTimeout
progress = mBrowseTimeTimeout
}
view?.findViewById<ImageView>(R.id.browsePic)
?.setImageResource(R.drawable.pic_browse_square_finish)
} else {
view?.findViewById<ProgressBar>(R.id.browsePro)?.run {
mBrowsePro = this
max = mBrowseTimeTimeout
progress = 0
}
view?.findViewById<ImageView>(R.id.browsePic)
?.setImageResource(R.drawable.pic_browse_square)
}
}
}
.show()
showFloatView(activity, isFinished)
}
}
}
fun dismissFloatView() {
private fun showFloatView(activity: Activity, isFinished: Boolean) {
EasyFloat.with(activity)
.setLayout(R.layout.layout_square_browse_task_float)
.setTag(FLOATING_SQUARE_BROWSE_TASK_VIEW)
.setAnimator(null)
.setGravity(Gravity.END.or(Gravity.CENTER_VERTICAL), 0, 0)
.setSidePattern(SidePattern.RIGHT)
.setShowPattern(ShowPattern.CURRENT_ACTIVITY)
.setDragEnable(false)
.registerCallback {
createResult { _, _, view ->
initFloatView(view, isFinished)
}
}
.show()
}
private fun initFloatView(view: View?, isFinished: Boolean) {
if (isFinished) {
view?.findViewById<ProgressBar>(R.id.browsePro)?.run {
max = mBrowseTimeTimeout
progress = mBrowseTimeTimeout
}
view?.findViewById<ImageView>(R.id.browsePic)
?.setImageResource(R.drawable.pic_browse_square_finish)
} else {
view?.findViewById<ProgressBar>(R.id.browsePro)?.run {
mBrowsePro = this
max = mBrowseTimeTimeout
progress = 0
}
view?.findViewById<ImageView>(R.id.browsePic)
?.setImageResource(R.drawable.pic_browse_square)
}
}
private fun updateFloatView(floatView: View, isFinished: Boolean, time: Int) {
if (mBrowsePro == null) {
mBrowsePro = floatView.findViewById(R.id.browsePro)
}
mBrowsePro?.progress = time
if (isFinished) {
floatView.findViewById<ImageView>(R.id.browsePic)
.setImageResource(R.drawable.pic_browse_square_finish)
}
}
private fun dismissFloatView() {
EasyFloat.dismiss(FLOATING_SQUARE_BROWSE_TASK_VIEW)
}

View File

@ -118,10 +118,9 @@ public class GameUtils {
if (PackagesManager.INSTANCE.isCanUpdate(gameEntity.getId(), apkEntity.getPackageName())) {
updateCount++;
}
if (PackagesManager.INSTANCE.isInstalled(apkEntity.getPackageName())) {
if (PackagesManager.isInstalled(apkEntity.getPackageName())) {
gh_id = PackageUtils.getMetaData(context, apkEntity.getPackageName(), "gh_id");
if (gameEntity.getTag() != null && gameEntity.getTag().size() != 0
&& !TextUtils.isEmpty(apkEntity.getGhVersion())
if (!TextUtils.isEmpty(apkEntity.getGhVersion())
&& !PackageUtils.isSignedByGh(context, apkEntity.getPackageName())
&& apkEntity.isShowPlugin(pluginLocation)) {
pluginCount++;
@ -231,7 +230,6 @@ public class GameUtils {
gameUpdateEntity.setPlatform(apkEntity.getPlatform());
gameUpdateEntity.setEtag(apkEntity.getEtag());
gameUpdateEntity.setPluggable(true);
gameUpdateEntity.setTag(gameEntity.getTag());
gameUpdateEntity.setTagStyle(gameEntity.getTagStyle());
gameUpdateEntity.setBrief(gameEntity.getBrief());
gameUpdateEntity.setPlugin(apkEntity.getPlugin());

View File

@ -32,6 +32,7 @@ import com.gh.common.structure.FixedSizeLinkedHashSet
import com.gh.gamecenter.R
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
import com.squareup.picasso.LruCache
import com.squareup.picasso.Picasso
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
@ -60,6 +61,13 @@ object ImageUtils {
)
}
@JvmStatic
val picasso: Picasso by lazy {
// Picasso 的 Lru 缓存改为 5M默认设定是 1/7 的 heap 大小,太大了
// https://stackoverflow.com/a/20105828/4812571
Picasso.Builder(HaloApp.getInstance()).memoryCache(LruCache(5 * 1024 * 1024)).build()
}
/**
* 禁用动图,全局设置
*/
@ -393,9 +401,10 @@ object ImageUtils {
view: SimpleDraweeView?,
url: String?,
isAutoPlayGif: Boolean = true,
processor: Postprocessor? = null
processor: Postprocessor? = null,
isIgnoreWidth: Boolean = false
) {
displayInternal(view, url, isAutoPlayGif, processor)
displayInternal(view, url, isAutoPlayGif, processor, isIgnoreWidth)
}
@JvmStatic
@ -403,7 +412,8 @@ object ImageUtils {
view: SimpleDraweeView?,
url: String?,
isAutoPlayGif: Boolean = true,
processor: Postprocessor? = null
processor: Postprocessor? = null,
isIgnoreWidth: Boolean = false
) {
mImageDecorationThread.execute {
if (url.isNullOrEmpty()) return@execute
@ -414,6 +424,10 @@ object ImageUtils {
val height = view?.layoutParams?.height
val shouldNotSaveMemoryCache = view?.getTag(TAG_NO_MEMORY_CACHE) == true
if (view != null && width == 0 && !isIgnoreWidth) {
AsyncImageLoader.getInstance().addAsyncImage(view, url, isAutoPlayGif, processor)
return@execute
}
var lowResUrl = ""
var highResUrl = ""
@ -471,12 +485,12 @@ object ImageUtils {
loadImageClosure(shouldLoadAsGif, highResUrl, lowResUrl)
} else {
if (width != null && width > 0) {
highResUrl = resizeGif(url, view!!.width, height ?: 0)
highResUrl = resizeGif(url, width, height ?: 0)
loadImageClosure(shouldLoadAsGif, highResUrl, lowResUrl)
} else {
runOnUiThread {
view ?: return@runOnUiThread
highResUrl = resizeGif(url, view.width, height ?: 0)
highResUrl = resizeGif(url, width ?: view.width, height ?: 0)
loadImageClosure(shouldLoadAsGif, highResUrl, lowResUrl)
}
}

View File

@ -58,7 +58,7 @@ public class IntentUtils {
"\n" +
"光环助手官网地址:\n" +
"\n" +
"http://www.ghzs.com/link?source=appshare333");
"https://www.ghzs.com/link?source=appshare333");
return data;
}

View File

@ -8,6 +8,7 @@ import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
@ -170,8 +171,8 @@ public class LibaoUtils {
break;
case "coming":
libaoBtn.setText(R.string.libao_coming);
libaoBtn.setBackgroundResource(R.drawable.button_normal_round_border);
libaoBtn.setTextColor(context.getResources().getColor(R.color.theme_font));
libaoBtn.setBackgroundResource(R.drawable.bg_shape_f5_radius_999);
libaoBtn.setTextColor(context.getResources().getColor(R.color.text_subtitleDesc));
break;
case "used_up":
libaoBtn.setText(R.string.libao_used_up);
@ -185,8 +186,8 @@ public class LibaoUtils {
break;
case "linged":
libaoBtn.setText(R.string.libao_linged);
libaoBtn.setBackgroundResource(R.drawable.button_border_round_gray);
libaoBtn.setTextColor(context.getResources().getColor(R.color.button_gray));
libaoBtn.setBackgroundResource(R.drawable.bg_shape_f5_radius_999);
libaoBtn.setTextColor(context.getResources().getColor(R.color.text_subtitleDesc));
break;
case "taoed":
libaoBtn.setText(R.string.libao_taoed);

View File

@ -20,6 +20,7 @@ public class NetworkUtils {
*/
public static boolean isNetworkConnected(Context context) {
if (context != null) {
context = context.getApplicationContext();
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager
@ -39,6 +40,7 @@ public class NetworkUtils {
*/
public static boolean isWifiConnected(Context context) {
if (context != null) {
context = context.getApplicationContext();
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWiFiNetworkInfo = mConnectivityManager
@ -108,6 +110,7 @@ public class NetworkUtils {
*/
public static String getConnectedType(Context context) {
if (context != null) {
context = context.getApplicationContext();
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager

View File

@ -5,6 +5,7 @@ import com.gh.common.json.JsonObjectBuilder
import com.gh.common.json.json
import com.gh.common.loghub.LoghubUtils
import com.gh.common.tracker.Tracker
import com.gh.gamecenter.entity.AdditionalParamsEntity
import com.gh.gamecenter.entity.LinkEntity
import com.gh.gamecenter.entity.QuoteCountEntity
import com.gh.gamecenter.entity.WechatConfigEntity
@ -569,12 +570,21 @@ object NewLogUtils {
//分享结果
@JvmStatic
fun logShareResult(shareResult: Boolean) {
fun logShareResult(additionalParams: AdditionalParamsEntity? = null, shareResult: Boolean) {
val json = json {
"location" to "分享面板"
"event" to "share_result"
"meta" to LogUtils.getMetaObject()
"share_success" to shareResult
additionalParams?.let {
"content_type" to it.contentType
"content_id" to it.contentId
"bbs_id" to it.bbsId
"bbs_type" to it.bbsType
"ref_user_id" to it.refUserId
}
"launch_id" to Tracker.launchId
"session_id" to Tracker.sessionId
"timestamp" to System.currentTimeMillis() / 1000
@ -1781,6 +1791,29 @@ object NewLogUtils {
log(json, "event", false)
}
// 自定义栏目点击跳转
fun logCustomColumnClicked(
gameId: String?,
gameName: String?,
title: String?,
entrance: String?,
linkType: String?,
linkTitle: String?
) {
val json = json {
"event" to "custom_column_jump"
"title" to title
"game_id" to gameId
"game_name" to gameName
"link_type" to linkType
"link_title" to linkTitle
"entrance" to entrance
"timestamp" to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//成功预约游戏
@JvmStatic
fun logReserveGameSuccess(wechatConfigEntity: WechatConfigEntity) {
@ -1848,4 +1881,39 @@ object NewLogUtils {
}
log(json, "appointment", false)
}
//选择图片上传方式
@JvmStatic
fun logShowGameCollectionCoverTypeDialog() {
val json = json {
"event" to "dialog_game_collect_chose_picture"
"timestamp" to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//选择图片上传方式点击
@JvmStatic
fun logClickGameCollectionChooseCoverDialog(action: String) {
val json = json {
"event" to "click_dialog_game_collect_chose_picture"
"action" to action
"timestamp" to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//默认封面点击事件
@JvmStatic
fun logClickGameCollectionDefaultCoverDialog(action: String) {
val json = json {
"event" to "click_dialog_game_collect_chose_default_picture"
"action" to action
"timestamp" to System.currentTimeMillis() / 1000
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
}

View File

@ -1,6 +1,7 @@
package com.gh.common.util
import java.text.DecimalFormat
import kotlin.math.roundToInt
object NumberUtils {
@ -45,8 +46,8 @@ object NumberUtils {
fun transSimpleUsageTime(second: Long): String {
val totalMinute = second / 60
if (totalMinute < 60) return ((if (totalMinute == 0L) 1 else totalMinute).toString() + "分钟")
val hour = Math.round((totalMinute / 60).toFloat())
val minute = Math.round((totalMinute - hour * 60).toFloat())
val hour = (totalMinute / 60).toFloat().roundToInt()
val minute = (totalMinute - hour * 60).toFloat().roundToInt()
return hour.toString() + "小时" + if (minute == 0) "" else minute.toString() + "分钟"
}

View File

@ -82,7 +82,6 @@ public class PackageUtils {
updateEntity.setPlatform(apkEntity.getPlatform());
updateEntity.setEtag(apkEntity.getEtag());
updateEntity.setBrief(gameEntity.getBrief());
updateEntity.setTag(gameEntity.getTag());
updateEntity.setTagStyle(gameEntity.getTagStyle());
updateEntity.setDownload(gameEntity.getDownload());
updateEntity.setIndexPlugin(gameEntity.getIndexPlugin());
@ -131,7 +130,6 @@ public class PackageUtils {
updateEntity.setPlatform(apkEntity.getPlatform());
updateEntity.setEtag(apkEntity.getEtag());
updateEntity.setBrief(gameEntity.getBrief());
updateEntity.setTag(gameEntity.getTag());
updateEntity.setTagStyle(gameEntity.getTagStyle());
updateEntity.setIndexPlugin(gameEntity.getIndexPlugin());
updateEntity.setPluginDesc(gameEntity.getPluginDesc());
@ -411,10 +409,15 @@ public class PackageUtils {
}
PackageManager packageManager = context.getApplicationContext().getPackageManager();
PackageInfo info = packageManager.getPackageArchiveInfo(path, 0);
if (info != null) {
ApplicationInfo appInfo = info.applicationInfo;
return appInfo.packageName;
try {
PackageInfo info = packageManager.getPackageArchiveInfo(path, 0);
if (info != null) {
ApplicationInfo appInfo = info.applicationInfo;
return appInfo.packageName;
}
} catch (Exception e) {
e.printStackTrace();
SentryHelper.INSTANCE.onEvent("GET_PACKAGE_INFO_ERROR", "path", path);
}
return null;
@ -736,7 +739,6 @@ public class PackageUtils {
updateEntity.setPlatform(apkEntity.getPlatform());
updateEntity.setEtag(apkEntity.getEtag());
updateEntity.setBrief(gameEntity.getBrief());
updateEntity.setTag(gameEntity.getTag());
updateEntity.setTagStyle(gameEntity.getTagStyle());
updateEntity.setIndexPlugin(gameEntity.getIndexPlugin());
updateEntity.setPluginDesc(gameEntity.getPluginDesc());

View File

@ -34,7 +34,7 @@ public class PicassoImageGetter implements Html.ImageGetter {
BitmapDrawablePlaceHolder drawable = new BitmapDrawablePlaceHolder();
Context context = HaloApp.getInstance().getApplication();
Picasso.with(context)
ImageUtils.getPicasso()
.load(source)
.transform(new CircleTransformation())
.placeholder(ResourcesCompat.getDrawable(context.getResources(), R.drawable.personal_user_default_icon, context

View File

@ -2,6 +2,7 @@ package com.gh.common.util
import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.content.pm.PackageManager
@ -16,6 +17,7 @@ import com.cmic.sso.sdk.auth.LoginClickListener
import com.cmic.sso.sdk.auth.TokenListener
import com.gh.common.constant.Config
import com.gh.common.constant.Constants
import com.gh.common.runOnUiThread
import com.gh.common.util.PermissionHelper.checkReadPhoneStatePermissionBeforeAction
import com.gh.common.util.ToastUtils.toast
import com.gh.gamecenter.LoginActivity
@ -29,7 +31,6 @@ import com.gh.gamecenter.user.UserRepository
import com.lightgame.utils.AppManager
import com.lightgame.utils.Utils
import org.json.JSONObject
import java.util.*
/**
* 一键登录辅助类
@ -163,14 +164,18 @@ object QuickLoginHelper {
}
private fun loginAuth(context: Context) {
mPreDialog = Dialog(context, R.style.DialogWindowTransparent).apply {
val binding = SetWaitDialogBinding.inflate(LayoutInflater.from(context)).apply {
setWaitMessage.text = "请求登录中"
runOnUiThread {
val dialogContext = DialogUtils.checkDialogContext(context)
if (dialogContext is Activity && dialogContext.isFinishing) return@runOnUiThread
mPreDialog = Dialog(dialogContext, R.style.DialogWindowTransparent).apply {
val binding = SetWaitDialogBinding.inflate(LayoutInflater.from(dialogContext)).apply {
setWaitMessage.text = "请求登录中"
}
requestWindowFeature(Window.FEATURE_NO_TITLE)
setContentView(binding.root)
setCanceledOnTouchOutside(false)
show()
}
requestWindowFeature(Window.FEATURE_NO_TITLE)
setContentView(binding.root)
setCanceledOnTouchOutside(false)
show()
}
// 2.授权请求
mAuthnHelper?.loginAuth(Config.QUICK_LOGIN_APPID, Config.QUICK_LOGIN_APPKEY, mTokenListener, REQUEST_LOGIN_AUTH_CODE)

View File

@ -28,6 +28,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.gh.common.constant.Config;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WeiBoShareActivity;
import com.gh.gamecenter.entity.AdditionalParamsEntity;
import com.gh.gamecenter.entity.ShareEntity;
import com.gh.gamecenter.eventbus.EBShare;
import com.lightgame.utils.Utils;
@ -129,6 +130,7 @@ public class ShareUtils {
public static String resourceId = "";//分享内容的id(事件上报用)
public static ShareEntity shareEntity;//分享信息(事件上报用)
private static ShareType mShareType;//分享类型(事件上报用)
public static AdditionalParamsEntity additionalParams;//附加参数(事件上报用)
private WeakReference<Activity> mActivity;
@ -148,7 +150,7 @@ public class ShareUtils {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(true);
NewLogUtils.logShareResult(ShareUtils.additionalParams, true);
} else if (ShareUtils.shareEntrance == ShareEntrance.gameCollection) {
String shareType;
if (mShareType == ShareType.qq) {
@ -176,7 +178,7 @@ public class ShareUtils {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(false);
NewLogUtils.logShareResult(ShareUtils.additionalParams, false);
}
}
@ -191,7 +193,7 @@ public class ShareUtils {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(false);
NewLogUtils.logShareResult(ShareUtils.additionalParams, false);
}
}
@ -232,7 +234,7 @@ public class ShareUtils {
public void shareInviteFriends(Activity activity, String url, String way) {
if (activity.isFinishing()) return;
this.mActivity = new WeakReference<>(activity);
this.shareIcon = activity.getString(R.string.gh_icon_url);
this.shareIcon = getHttpsUrl(activity.getString(R.string.gh_icon_url));
this.shareUrl = url;
this.mSummary = "卡牌神器,海量游戏下载,积分大礼,等你尝鲜";
this.mTitle = "推荐一款好玩的游戏下载APP【光环助手】";
@ -270,7 +272,7 @@ public class ShareUtils {
public void showShareUserHomeWindows(Activity activity, View view, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id, ShareCallBack callBack) {
if (activity.isFinishing()) return;
this.mActivity = new WeakReference<>(activity);
this.shareIcon = icon;
this.shareIcon = getHttpsUrl(icon);
this.shareUrl = url;
this.mSummary = shareSummary;
this.mTitle = shareTitle;
@ -331,7 +333,7 @@ public class ShareUtils {
public void showShareWindowsCallback(Activity activity, View view, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id, ShareCallBack callBack) {
if (activity.isFinishing()) return;
this.mActivity = new WeakReference<>(activity);
this.shareIcon = icon;
this.shareIcon = getHttpsUrl(icon);
this.shareUrl = url;
this.mSummary = shareSummary;
this.mTitle = shareTitle;
@ -416,14 +418,19 @@ public class ShareUtils {
});
}
public void shareParamsDetail(Activity activity, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id, ShareCallBack callBack) {
public void shareParamsDetail(Activity activity, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id) {
shareParamsDetail(activity, url, icon, shareTitle, shareSummary, shareEntrance, id, null);
}
public void shareParamsDetail(Activity activity, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id, AdditionalParamsEntity params) {
if (activity.isFinishing()) return;
this.mActivity = new WeakReference<>(activity);
this.shareIcon = icon;
this.shareIcon = getHttpsUrl(icon);
this.shareUrl = url;
this.mSummary = shareSummary;
this.mTitle = shareTitle;
this.mShareEntrance = shareEntrance;
ShareUtils.additionalParams = params;
ShareUtils.shareEntrance = mShareEntrance;
ShareUtils.resourceId = id;
ShareUtils.shareEntity = new ShareEntity(shareUrl, mTitle, mSummary);
@ -888,6 +895,13 @@ public class ShareUtils {
}
}
private String getHttpsUrl(String url) {
if (url.startsWith("http://")) {
return url.replace("http://", "https://");
}
return url;
}
interface OnItemClickListener {
void onItemClick(int position);
}

View File

@ -39,7 +39,7 @@ object TextHelper {
val str = editText.text.toString().substring(0, length)
editText.setText(str)
editText.setSelection(str.length)
if (!ClickUtils.isFastDoubleClick(R.id.userinfo_nickname_et, 2000)) {
if (!ClickUtils.isFastDoubleClick(R.id.inputEt, 2000)) {
exceedCallback?.onExceed()
}
}

View File

@ -38,23 +38,23 @@ public class UserIconUtils {
public static String getUserIconUrl(int i) {
switch (i) {
case 1:
return "http://image.ghzs666.com/pic/default_icon_1.png";
return "https://image.ghzs666.com/pic/default_icon_1.png";
case 2:
return "http://image.ghzs666.com/pic/default_icon_2.png";
return "https://image.ghzs666.com/pic/default_icon_2.png";
case 3:
return "http://image.ghzs666.com/pic/default_icon_3.png";
return "https://image.ghzs666.com/pic/default_icon_3.png";
case 4:
return "http://image.ghzs666.com/pic/default_icon_4.png";
return "https://image.ghzs666.com/pic/default_icon_4.png";
case 5:
return "http://image.ghzs666.com/pic/default_icon_5.png";
return "https://image.ghzs666.com/pic/default_icon_5.png";
case 6:
return "http://image.ghzs666.com/pic/default_icon_6.png";
return "https://image.ghzs666.com/pic/default_icon_6.png";
case 7:
return "http://image.ghzs666.com/pic/default_icon_7.png";
return "https://image.ghzs666.com/pic/default_icon_7.png";
case 8:
return "http://image.ghzs666.com/pic/default_icon_8.png";
return "https://image.ghzs666.com/pic/default_icon_8.png";
default:
return "http://image.ghzs666.com/pic/default_icon_1.png";
return "https://image.ghzs666.com/pic/default_icon_1.png";
}
}
}

View File

@ -4,7 +4,7 @@ import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import java.util.*
@Keep

View File

@ -2,7 +2,6 @@ package com.gh.common.view
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
@ -17,18 +16,23 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.entity.SubjectSettingEntity
import com.google.android.flexbox.FlexboxLayout
class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
: ConstraintLayout(context, attrs, defStyleAttr) {
class ConfigFilterView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
private var mSizeTv: TextView
var newestTv: TextView
var ratingTv: TextView //目前只在专题页面显示
var recommendedTv: TextView
var updateTv: TextView //更新
var sizeFilterArray: ArrayList<SubjectSettingEntity.Size>? = null
private var mOnConfigFilterSetupListener: OnConfigFilterSetupListener? = null
private var mSelectionTvList: ArrayList<TextView>
init {
View.inflate(context, R.layout.layout_config_filter, this)
@ -36,8 +40,11 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
mSizeTv = findViewById(R.id.size_tv)
newestTv = findViewById(R.id.newest_tv)
ratingTv = findViewById(R.id.rating_tv)
updateTv = findViewById(R.id.updateTv)
recommendedTv = findViewById(R.id.recommended_tv)
mSelectionTvList = arrayListOf(newestTv, ratingTv, updateTv, recommendedTv)
mSizeTv.setOnClickListener {
mOnConfigFilterSetupListener?.onShowSortSize()
showSelectionPopupWindow(this, mSizeTv, mSizeTv.text.toString())
@ -45,23 +52,28 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
ratingTv.setOnClickListener {
mOnConfigFilterSetupListener?.onSetupSortType(SortType.RATING)
toggleHighlightedTextView(ratingTv, true)
toggleHighlightedTextView(newestTv, false)
toggleHighlightedTextView(recommendedTv, false)
updateHighlightedTextView(ratingTv)
}
updateTv.setOnClickListener {
mOnConfigFilterSetupListener?.onSetupSortType(SortType.UPDATE)
updateHighlightedTextView(updateTv)
}
newestTv.setOnClickListener {
mOnConfigFilterSetupListener?.onSetupSortType(SortType.NEWEST)
toggleHighlightedTextView(ratingTv, false)
toggleHighlightedTextView(newestTv, true)
toggleHighlightedTextView(recommendedTv, false)
updateHighlightedTextView(newestTv)
}
recommendedTv.setOnClickListener {
mOnConfigFilterSetupListener?.onSetupSortType(SortType.RECOMMENDED)
toggleHighlightedTextView(ratingTv, false)
toggleHighlightedTextView(newestTv, false)
toggleHighlightedTextView(recommendedTv, true)
updateHighlightedTextView(recommendedTv)
}
}
private fun updateHighlightedTextView(highlightedTv: TextView) {
for (tv in mSelectionTvList) {
toggleHighlightedTextView(tv, tv == highlightedTv)
}
}
@ -71,17 +83,24 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
private fun toggleHighlightedTextView(targetTextView: TextView, highlightIt: Boolean) {
if (highlightIt) {
targetTextView.background = ContextCompat.getDrawable(targetTextView.context, R.drawable.bg_tag_text)
targetTextView.background =
ContextCompat.getDrawable(targetTextView.context, R.drawable.bg_tag_text)
targetTextView.setTextColor(Color.WHITE)
} else {
targetTextView.background = null
targetTextView.setTextColor(ContextCompat.getColor(targetTextView.context, R.color.text_757575))
targetTextView.setTextColor(
ContextCompat.getColor(
targetTextView.context,
R.color.text_757575
)
)
}
}
private fun showSelectionPopupWindow(containerView: View, sizeTv: TextView, sizeText: String) {
val drawableUp = ContextCompat.getDrawable(sizeTv.context, R.drawable.ic_filter_arrow_up)
val drawableDown = ContextCompat.getDrawable(sizeTv.context, R.drawable.ic_filter_arrow_down)
val drawableDown =
ContextCompat.getDrawable(sizeTv.context, R.drawable.ic_filter_arrow_down)
drawableUp?.setBounds(0, 0, drawableUp.minimumWidth, drawableUp.minimumHeight)
drawableDown?.setBounds(0, 0, drawableDown.minimumWidth, drawableDown.minimumHeight)
@ -91,9 +110,10 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
val inflater = LayoutInflater.from(sizeTv.context)
val layout = inflater.inflate(R.layout.layout_filter_size, null)
val popupWindow = PopupWindow(
layout,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT)
layout,
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
val flexboxLayout = layout.findViewById<FlexboxLayout>(R.id.flexbox)
val backgroundView = layout.findViewById<View>(R.id.background)
@ -173,7 +193,8 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
enum class SortType {
RECOMMENDED,
NEWEST,
RATING
RATING,
UPDATE
}
}

View File

@ -170,7 +170,7 @@ public class DownloadProgressBar extends ProgressBar {
case INSTALL_NORMAL:
case H5_GAME:
if (mDownloadStyle == DOWNLOAD_IMAGE_STYLE) {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_normal_image_style));
setProgressDrawable(getResources().getDrawable(R.drawable.text_white_background));
mDefaultColor = Color.BLACK;
} else {
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
@ -185,7 +185,7 @@ public class DownloadProgressBar extends ProgressBar {
setProgress(0);
break;
case NONE:
setProgressDrawable(getResources().getDrawable(R.drawable.news_detail_comment));
setProgressDrawable(getResources().getDrawable(R.drawable.button_border_gray_oval));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.hint);
setProgress(0);
break;
@ -209,8 +209,8 @@ public class DownloadProgressBar extends ProgressBar {
}
break;
case DOWNLOADING_PLUGIN:
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_plugin_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.text_00B8B8);
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_style));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme_font);
break;
case RESERVABLE:
setProgressDrawable(getResources().getDrawable(R.drawable.button_reserve));
@ -221,8 +221,8 @@ public class DownloadProgressBar extends ProgressBar {
mDefaultColor = ContextCompat.getColor(getContext(), R.color.white);
break;
case RESERVED:
setProgressDrawable(getResources().getDrawable(R.drawable.game_item_btn_pause_dn));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.white);
setProgressDrawable(getResources().getDrawable(R.drawable.bg_shape_f5_radius_999));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.text_subtitleDesc);
break;
case XAPK_FAILURE:
case XAPK_SUCCESS:

View File

@ -13,7 +13,6 @@ import android.widget.TextView
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import com.gh.common.databind.DrawablesBindingAdapter
import com.gh.common.util.DisplayUtils
import com.gh.common.util.dip2px
import com.halo.assistant.HaloApp

View File

@ -79,9 +79,20 @@ class GameIconView : CardView {
}
fun displayGameIcon(icon: String?, iconSubscript: String?) {
ImageUtils.display(mGameIconIv, icon)
ImageUtils.display(mGameIconDecorationIv, iconSubscript)
displayGameIcon(icon, iconSubscript, false)
}
fun displayGameIcon(icon: String?, iconSubscript: String?, goneIfEmpty: Boolean = false) {
if (getTag(ImageUtils.TAG_TARGET_WIDTH) == null) {
setTag(ImageUtils.TAG_TARGET_WIDTH, layoutParams.width)
}
mGameIconIv?.display(icon)
mGameIconDecorationIv?.display(iconSubscript)
mGameIconDecorationIv?.goneIf(TextUtils.isEmpty(iconSubscript))
if (goneIfEmpty) {
visibility = if(TextUtils.isEmpty(icon)) View.GONE else View.VISIBLE
}
}
fun getIconIv(): SimpleDraweeView = mGameIconIv!!

View File

@ -237,6 +237,10 @@ class ImageContainerView : LinearLayout {
} else {
params.width = mDefaultWidth.toInt()
params.height = mDefaultWidth.toInt()
if (width > height) {
val loadImageWidth = width * (mDefaultWidth.toInt() / height)
binding.image.setTag(ImageUtils.TAG_TARGET_WIDTH, loadImageWidth.toInt())
}
ImageUtils.display(binding.image, url, false)
}
//长图

View File

@ -4,11 +4,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.base.BaseRecyclerViewHolder
import com.gh.base.fragment.BaseDialogFragment
import com.gh.common.util.ImageUtils
import com.gh.common.util.fromHtml
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
@ -23,8 +23,8 @@ class ReserveDialog : BaseDialogFragment() {
private lateinit var mReserveList: List<SimpleGameEntity>
private var mDismissListener: (() -> Unit)? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding: DialogReserveBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_reserve, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
val binding: DialogReserveBinding = DialogReserveBinding.inflate(layoutInflater, null, false)
mReserveList = arguments?.getParcelableArrayList(RESERVE_LIST) ?: arrayListOf()
@ -54,7 +54,8 @@ class ReserveDialog : BaseDialogFragment() {
override fun onBindViewHolder(holder: ReserveDialogItemViewHolder, position: Int) {
val entity = mReserveList[position]
holder.binding.game = entity
ImageUtils.display(holder.binding.icon, entity.icon)
holder.binding.gameNameTv.text = entity.name
holder.itemView.setOnClickListener {
GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(预约弹窗)")
dismissAllowingStateLoss()

View File

@ -0,0 +1,143 @@
package com.gh.common.view
import android.animation.ValueAnimator
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.Gravity
import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.RadioButton
import android.widget.RadioGroup
import androidx.core.content.ContextCompat
import com.gh.common.util.dip2px
import com.gh.gamecenter.R
import splitties.views.dsl.core.add
class SegmentedFilterView : FrameLayout {
private var mItemWidth = 0
private var mItemHeight = 0
private var mTextColor: ColorStateList? =
ContextCompat.getColorStateList(context, R.color.game_collection_rg_button_selector)
private var mTextSize = 10F
private var mContainerBackground: Drawable? = null
private var mIndicatorBackground: Drawable? = null
private var mAnimationDuration = 200
private var mContainerPadding = 1F.dip2px()
private lateinit var mContainer: FrameLayout
private lateinit var mRadioGroup: RadioGroup
private lateinit var mIndicator: View
private var mItemList = listOf<String>()
constructor(context: Context) : super(context, null) {
initView(null)
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs, 0) {
initView(attrs)
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
) {
initView(attrs)
}
private fun initView(attrs: AttributeSet?) {
if (attrs != null) {
val ta = context.obtainStyledAttributes(attrs, R.styleable.SegmentedFilterView)
mContainerBackground =
ta.getDrawable(R.styleable.SegmentedFilterView_containerBackground)
mIndicatorBackground =
ta.getDrawable(R.styleable.SegmentedFilterView_indicatorBackground)
mContainerPadding = ta.getDimensionPixelSize(
R.styleable.SegmentedFilterView_containerPadding,
1F.dip2px()
)
mItemWidth = ta.getDimensionPixelSize(
R.styleable.SegmentedFilterView_sfv_itemWidth,
36F.dip2px()
)
mItemHeight = ta.getDimensionPixelSize(
R.styleable.SegmentedFilterView_sfv_itemHeight,
24F.dip2px()
)
mAnimationDuration = ta.getInt(R.styleable.SegmentedFilterView_animationDuration, 200)
mTextColor = ta.getColorStateList(R.styleable.SegmentedFilterView_sfv_textColor)
mTextSize = ta.getFloat(R.styleable.SegmentedFilterView_sfv_textSize, 10F)
ta.recycle()
}
setPadding(mContainerPadding, mContainerPadding, mContainerPadding, mContainerPadding)
if (mContainerBackground != null) background = mContainerBackground
mContainer = FrameLayout(context)
mIndicator = View(context).apply {
background = mIndicatorBackground
}
mRadioGroup = RadioGroup(context).apply {
gravity = Gravity.CENTER
orientation = LinearLayout.HORIZONTAL
}
add(mContainer, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT))
mContainer.add(mIndicator, LayoutParams(mItemWidth, mItemHeight))
mContainer.add(
mRadioGroup,
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
)
}
fun setItemList(itemList: List<String>, defaultCheckPosition: Int) {
mItemList = itemList
mRadioGroup.removeAllViews()
addRadioButton()
if (defaultCheckPosition in 0 until mRadioGroup.childCount) (mRadioGroup.getChildAt(defaultCheckPosition) as RadioButton).isChecked = true
}
fun setOnCheckedCallback(callback: OnCheckedCallback) {
mRadioGroup.setOnCheckedChangeListener { _, checkId ->
for (i in 0 until mRadioGroup.childCount) {
val radioBtn = mRadioGroup.getChildAt(i)
if (checkId == radioBtn.id) {
startIndicatorAnimation(radioBtn.x)
callback.onItemCheck(i)
}
}
}
}
private fun addRadioButton() {
for (item in mItemList) {
val radioButton = RadioButton(context).apply {
background = null
buttonDrawable = null
text = item
gravity = Gravity.CENTER
textSize = mTextSize
setTextColor(mTextColor)
isChecked = false
}
mRadioGroup.add(radioButton, LinearLayout.LayoutParams(mItemWidth, mItemHeight))
}
}
private fun startIndicatorAnimation(x: Float) {
ValueAnimator.ofFloat(mIndicator.x, x).apply {
interpolator = AccelerateDecelerateInterpolator()
duration = mAnimationDuration.toLong()
addUpdateListener {
mIndicator.x = it.animatedValue as Float
}
}.start()
}
interface OnCheckedCallback {
fun onItemCheck(position: Int)
}
}

View File

@ -0,0 +1,25 @@
package com.gh.common.view;
import android.content.Context;
import android.util.AttributeSet;
import androidx.appcompat.widget.AppCompatTextView;
public class TrimmedPaddingTextView extends AppCompatTextView {
public TrimmedPaddingTextView(Context context) {
super(context);
}
public TrimmedPaddingTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setIncludeFontPadding(getLineCount() > 1);
}
}

View File

@ -73,7 +73,6 @@ import java.util.concurrent.LinkedBlockingQueue;
public class DownloadManager implements DownloadStatusListener {
private static final Gson gson = new Gson();
private static final String UPDATE_IS_READ_MARK = "update_is_read";
private static final String DOWNLOADING_IS_READ_MARK = "downloading_is_read";
private static final String DOWNLOADED_IS_READ_MARK = "downloaded_is_read";
@ -118,7 +117,7 @@ public class DownloadManager implements DownloadStatusListener {
downloadingMap.put(entity.getUrl(), entity);
// DownloadWorkManager.addWorker();
DownloadWorkManager.addWorker();
}
@Override
@ -142,7 +141,7 @@ public class DownloadManager implements DownloadStatusListener {
mDownloadedGameIdAndPackageNameDao.add(entity.getGameId() + entity.getPackageName());
if (downloadingMap.isEmpty()) {
// DownloadWorkManager.cancelWorker();
DownloadWorkManager.cancelWorker();
}
}
@ -349,7 +348,7 @@ public class DownloadManager implements DownloadStatusListener {
ExposureEvent downloadExposureEvent = ExposureUtils.logADownloadExposureEvent(gameEntity, apkEntity.getPlatform(), traceEvent, downloadType);
// 将下载事件放入 downloadEntity 中供下载完成时取出使用
downloadEntity.setExposureTrace(gson.toJson(downloadExposureEvent));
downloadEntity.setExposureTrace(GsonUtils.toJson(downloadExposureEvent));
if (isSubscribe) {
DownloadManager.getInstance().subscribe(downloadEntity);
@ -690,11 +689,13 @@ public class DownloadManager implements DownloadStatusListener {
public void cancel(String url, boolean isDeleteFile, boolean automatic) {
DownloadEntity entry = mDownloadDao.get(url);
if (entry != null) {
if (isDeleteFile) {
FileUtils.deleteFile(entry.getPath());
}
mDownloadDao.delete(url);
Utils.log(DownloadManager.class.getSimpleName(), "cancel==>record were deleted!");
AppExecutor.getIoExecutor().execute(() -> {
if (isDeleteFile) {
FileUtils.deleteFile(entry.getPath());
}
mDownloadDao.delete(url);
Utils.log(DownloadManager.class.getSimpleName(), "cancel==>record were deleted!");
});
}
if (entry != null) {
if (automatic) {

View File

@ -3,6 +3,7 @@ package com.gh.download
import androidx.work.PeriodicWorkRequest
import androidx.work.WorkManager
import com.gh.common.util.tryWithDefaultCatch
import com.halo.assistant.HaloApp
import java.util.concurrent.TimeUnit
object DownloadWorkManager {
@ -23,13 +24,12 @@ object DownloadWorkManager {
.addTag(TAG_DOWNLOAD)
.build()
// TODO 某些特殊场景下会出现 WorkManagerImpl.getInstance() 为空的情况,下版本更新 WorkManager
tryWithDefaultCatch { WorkManager.getInstance().enqueue(workerRequest) }
tryWithDefaultCatch { WorkManager.getInstance(HaloApp.getInstance().applicationContext).enqueue(workerRequest) }
}
@JvmStatic
fun cancelWorker() {
// tryWithDefaultCatch { WorkManager.getInstance().cancelAllWorkByTag(TAG_DOWNLOAD) }
tryWithDefaultCatch { WorkManager.getInstance(HaloApp.getInstance().applicationContext).cancelAllWorkByTag(TAG_DOWNLOAD) }
}
}

View File

@ -9,7 +9,8 @@ class DownloadWorker(private val mContext: Context, workerParams: WorkerParamete
: Worker(mContext, workerParams) {
override fun doWork(): Result {
Utils.log("Let's try checkRetryDownload.")
Utils.log("WorkManager try checkAndRetryDownload.")
DownloadManager.getInstance().checkAndRetryDownload()
return Result.success()
}

View File

@ -3,10 +3,11 @@ package com.gh.download.dialog
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.view.*
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.Animation
import android.view.animation.AnimationUtils
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Observer
@ -32,7 +33,6 @@ import com.lightgame.utils.AppManager
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.*
class DownloadDialog : BaseDraggableDialogFragment() {
@ -62,17 +62,20 @@ class DownloadDialog : BaseDraggableDialogFragment() {
private val mDataWatcher = object : DataWatcher() {
override fun onDataChanged(downloadEntity: DownloadEntity) {
if (downloadEntity.gameId == mGameEntity?.id &&
DownloadStatus.delete != DownloadManager.getInstance().getStatus(downloadEntity.url)) {
DownloadStatus.delete != DownloadManager.getInstance().getStatus(downloadEntity.url)
) {
mAdapter?.listData?.forEachIndexed { index, entity ->
if (entity.normal?.packageName == downloadEntity.packageName
|| entity.installed?.packageName == downloadEntity.packageName) {
|| entity.installed?.packageName == downloadEntity.packageName
) {
mAdapter?.notifyItemChanged(index)
}
}
mCollectionAdapter?.listData?.forEachIndexed { index, entity ->
if (entity.normal?.packageName == downloadEntity.packageName
|| entity.installed?.packageName == downloadEntity.packageName) {
|| entity.installed?.packageName == downloadEntity.packageName
) {
mCollectionAdapter?.notifyItemChanged(index)
}
}
@ -146,8 +149,8 @@ class DownloadDialog : BaseDraggableDialogFragment() {
}
@SuppressLint("ClickableViewAccessibility")
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_download, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
mBinding = DialogDownloadBinding.bind(layoutInflater.inflate(R.layout.dialog_download, container, false))
mBinding.title.text = ("选择下载" + mGameEntity.pluginDesc + "版本")
val downloadNotice = mGameEntity.downloadAd
@ -159,9 +162,10 @@ class DownloadDialog : BaseDraggableDialogFragment() {
DialogUtils.showImprintDialog(requireContext(), mGameEntity, downloadNotice.title)
} else {
DirectUtils.directToLinkPage(
requireContext(),
downloadNotice,
mEntrance, "下载多平台弹窗")
requireContext(),
downloadNotice,
mEntrance, "下载多平台弹窗"
)
}
// MtaHelper.onEvent(MTA_KEY, "点击", mViewModel.gameEntity.name + "_" + downloadNotice.title)
}

View File

@ -1,15 +1,13 @@
package com.gh.download.dialog
import android.content.Context
import android.graphics.drawable.GradientDrawable
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.base.OnViewClickListener
import com.gh.common.exposure.ExposureEvent
import com.gh.common.util.DirectUtils
import com.gh.common.util.MtaHelper
import com.gh.common.util.dip2px
import com.gh.common.util.throwExceptionInDebug
import com.gh.common.util.*
import com.gh.gamecenter.NewsDetailActivity
import com.gh.gamecenter.QaActivity
import com.gh.gamecenter.R
@ -18,13 +16,15 @@ import com.gh.gamecenter.entity.GameEntity
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.utils.Utils
class DownloadDialogAdapter(context: Context,
val viewModel: DownloadViewModel,
val listData: List<DownloadDialogItemData>,
val isCollectionPage: Boolean,
private val mTraceEvent: ExposureEvent?,
private val mEntrance: String,
private val mLocation: String) : BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
class DownloadDialogAdapter(
context: Context,
val viewModel: DownloadViewModel,
val listData: List<DownloadDialogItemData>,
val isCollectionPage: Boolean,
private val mTraceEvent: ExposureEvent?,
private val mEntrance: String,
private val mLocation: String
) : BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
private val mPath = if (isCollectionPage) {
"下载弹窗-二级页"
@ -83,11 +83,13 @@ class DownloadDialogAdapter(context: Context,
} else 0
holder.binding.root.layoutParams = this
}
holder.binding.type = listData[position].section
val section = listData[position].section
holder.binding.title.text = if (section == DownloadDialogSectionType.OTHER) "其它版本" else "我的版本"
holder.binding.otherVersionHint.goneIf(section != DownloadDialogSectionType.OTHER)
}
is DownloadDialogLinkItemViewHolder -> {
holder.binding.links = listData[position].links
holder.binding.clickListener = OnViewClickListener<GameEntity.PluginLink> { _, data ->
val links = listData[position].links
val clickListener = OnViewClickListener<GameEntity.PluginLink> { _, data ->
when (data.linkType) {
"dialog" -> {
DownloadLinkDialog.showDownloadDialog(mContext, data)
@ -109,6 +111,28 @@ class DownloadDialogAdapter(context: Context,
// MtaHelper.onEvent(DownloadDialog.MTA_KEY, "点击", viewModel.gameEntity.name + "_" + data.title)
}
holder.binding.run {
links?.let {
leftLink.setOnClickListener { view ->
clickListener.onClick(view, links[0])
}
rightLink.setOnClickListener { view ->
clickListener.onClick(view, links[1])
}
}
leftLink.visibleIf(!links.isNullOrEmpty())
rightLink.visibleIf(links?.size ?:0 > 1)
leftLink.text = if (links.isNullOrEmpty()) "" else links[0].title
rightLink.text = if (links?.size ?: 0 > 1) links?.get(1)?.title else ""
leftLink.background = GradientDrawable().apply {
cornerRadius = 8F.dip2px().toFloat()
setStroke(0.5F.dip2px(), R.color.divider.toColor())
}
rightLink.background = GradientDrawable().apply {
cornerRadius = 8F.dip2px().toFloat()
setStroke(0.5F.dip2px(), R.color.divider.toColor())
}
}
}
is DownloadDialogInstructionItemViewHolder -> {
holder.bindItem(listData, position, mEntrance)

View File

@ -4,10 +4,7 @@ import android.view.View
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.constant.Config
import com.gh.common.exposure.ExposureEvent
import com.gh.common.util.PackageUtils
import com.gh.common.util.goneIf
import com.gh.common.util.throwExceptionInDebug
import com.gh.common.util.toColor
import com.gh.common.util.*
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DownloadDialogInstalledItemBinding
@ -16,15 +13,28 @@ import com.lightgame.download.DownloadStatus
class DownloadDialogInstalledItemViewHolder(val binding: DownloadDialogInstalledItemBinding) : BaseRecyclerViewHolder<Any>(binding.root) {
fun bindInstalledItem(apkEntity: ApkEntity, viewModel: DownloadViewModel, traceEvent: ExposureEvent?, entrance: String, path: String, location: String) {
fun bindInstalledItem(
apkEntity: ApkEntity,
viewModel: DownloadViewModel,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String
) {
val gameEntity = viewModel.gameEntity
val apkCollection = apkEntity.apkCollection
binding.pluginDesc = gameEntity.pluginDesc
binding.apk = if (apkCollection != null) {
val pluginDesc = gameEntity.pluginDesc
val apk = if (apkCollection != null) {
ApkEntity(platformIcon = apkCollection.newIcon, platformName = apkCollection.name, remark = apkCollection.remark)
} else apkEntity
ImageUtils.display(binding.icon, apk.getPlatformIcon())
binding.name.text = apk.getPlatformName()
binding.remark.text = apk.remark
binding.root.setBackgroundResource(R.drawable.download_dialog_item_background)
binding.launch.text = "启动${pluginDesc}"
binding.pluggable.text = "${pluginDesc}此版本"
binding.update.text = "更新${pluginDesc}"
if (apkEntity.apkLink != null) {
throwExceptionInDebug("apkLink 不应该出现在这里")
@ -132,6 +142,5 @@ class DownloadDialogInstalledItemViewHolder(val binding: DownloadDialogInstalled
}
DownloadDialogItemViewHolder.setDownloadClickListener(itemView, apkEntity, viewModel, traceEvent, entrance, path, location)
binding.executePendingBindings()
}
}

View File

@ -32,37 +32,51 @@ import com.lightgame.utils.Utils
class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : BaseRecyclerViewHolder<Any>(binding.root) {
fun bindItem(listData: List<DownloadDialogItemData>,
position: Int,
viewModel: DownloadViewModel,
isCollectionPage: Boolean,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String) {
fun bindItem(
listData: List<DownloadDialogItemData>,
position: Int,
viewModel: DownloadViewModel,
isCollectionPage: Boolean,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String
) {
val apkEntity = listData[position].normal!!
val gameEntity = viewModel.gameEntity
val apkLink = apkEntity.apkLink
val apkCollection = apkEntity.apkCollection
binding.apk = when {
val apk = when {
apkLink != null -> ApkEntity(
platformIcon = apkLink.icon,
platformName = apkLink.name,
remark = apkLink.remark)
platformIcon = apkLink.icon,
platformName = apkLink.name,
remark = apkLink.remark
)
apkCollection != null -> ApkEntity(
platformIcon = apkCollection.newIcon,
platformName = apkCollection.name,
recommend = apkCollection.recommend,
remark = apkCollection.remark)
platformIcon = apkCollection.newIcon,
platformName = apkCollection.name,
recommend = apkCollection.recommend,
remark = apkCollection.remark
)
else -> apkEntity
}
ImageUtils.display(binding.icon, apk.getPlatformIcon())
binding.name.text = apk.getPlatformName()
binding.remark.text = apk.remark
binding.recommendDesTv.goneIf(apk.recommend == null)
binding.recommendDesTv.text = apk.recommend?.description
binding.recommendLabel.goneIf(apk.recommend == null)
binding.recommendLabelTv.text = apk.recommend?.subscript
binding.containerView.setBackgroundResource(R.drawable.download_dialog_item_background)
binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null)
changeRecommendUI(apkEntity, listData, position)
if (apkLink != null) {
binding.root.visibility = View.VISIBLE
binding.downloadStatusIcon.visibility = View.GONE
binding.status.visibility = View.VISIBLE
binding.progressbar.visibility = View.GONE
@ -70,7 +84,12 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
binding.remark.goneIf(apkLink.remark.isEmpty())
binding.status.text = "点击查看"
binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_link), null)
binding.status.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_link),
null
)
binding.containerView.setBackgroundResource(R.drawable.download_dialog_installed_background)
itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.LINK)
} else if (apkCollection != null || (!isCollectionPage && apkEntity.downloadInstruction.isNotEmpty())) {
@ -119,11 +138,17 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
binding.status.visibility = View.VISIBLE
binding.status.text = "可更新"
binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_update), null)
binding.status.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_update),
null
)
binding.downloadStatusIcon.visibility = View.GONE
itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.UPDATE)
} else if (PackageUtils.getGhId(apkEntity.packageName) == gameEntity.id ||
PackagesManager.isInstalled(apkEntity.packageName) && Config.getSettings()?.gameDownloadBlackList?.contains(apkEntity.packageName) == true) {
PackagesManager.isInstalled(apkEntity.packageName) && Config.getSettings()?.gameDownloadBlackList?.contains(apkEntity.packageName) == true
) {
binding.downloadStatusIcon.visibility = View.GONE
binding.status.visibility = View.VISIBLE
binding.containerView.setBackgroundResource(R.drawable.download_dialog_installed_background)
@ -143,7 +168,12 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
// 点击启动
binding.status.text = "点击启动"
itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.LAUNCH)
binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_launch), null)
binding.status.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_launch),
null
)
}
} else {
binding.downloadStatusIcon.visibility = View.VISIBLE
@ -160,7 +190,6 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
setDownloadClickListener(itemView, apkEntity, viewModel, traceEvent, entrance, path, location)
binding.executePendingBindings()
}
private fun changeRecommendUI(apkEntity: ApkEntity, listData: List<DownloadDialogItemData>, position: Int) {
@ -171,7 +200,8 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
(binding.root.layoutParams as RecyclerView.LayoutParams).apply {
bottomMargin = if (apkEntity.recommend != null) {
if ((position + 1 < listData.size && listData[position + 1].normal?.recommend == null) ||
(position + 2 < listData.size && listData[position + 2].normal?.recommend == null)) {
(position + 2 < listData.size && listData[position + 2].normal?.recommend == null)
) {
20f.dip2px()
} else 16f.dip2px()
} else 8f.dip2px()
@ -192,13 +222,15 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
}
fun setDownloadClickListener(itemView: View,
apkEntity: ApkEntity,
viewModel: DownloadViewModel,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String) {
fun setDownloadClickListener(
itemView: View,
apkEntity: ApkEntity,
viewModel: DownloadViewModel,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String
) {
val gameEntity = viewModel.gameEntity
itemView.setOnClickListener {
@ -215,10 +247,13 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
DownloadDialogItemStatus.DOWNLOADING -> {
// 打开下载管理界面
it.context.startActivity(DownloadManagerActivity.getDownloadMangerIntent(
it.context.startActivity(
DownloadManagerActivity.getDownloadMangerIntent(
it.context,
apkEntity.url,
BaseActivity.mergeEntranceAndPath(entrance, path)))
BaseActivity.mergeEntranceAndPath(entrance, path)
)
)
if (AppManager.getInstance().currentActivity() is DownloadManagerActivity) {
viewModel.dismissLiveData.postValue(Any())
}
@ -237,7 +272,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
DownloadDialogItemStatus.INSTALL -> {
val downloadEntity = DownloadManager.getInstance().getDownloadEntityByUrl(apkEntity.url)
?: return@setOnClickListener
?: return@setOnClickListener
if (FileUtils.isEmptyFile(downloadEntity.path)) {
Utils.toast(it.context, R.string.install_failure_hint)
@ -300,13 +335,15 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
}
private fun createDownloadTask(context: Context,
apkEntity: ApkEntity,
gameEntity: GameEntity,
downloadMethod: String,
traceEvent: ExposureEvent?,
entrance: String,
location: String) {
private fun createDownloadTask(
context: Context,
apkEntity: ApkEntity,
gameEntity: GameEntity,
downloadMethod: String,
traceEvent: ExposureEvent?,
entrance: String,
location: String
) {
// todo 有时间存储判断统一处理
val msg = FileUtils.isCanDownload(context, apkEntity.size)
if (msg.isNullOrEmpty()) {
@ -318,13 +355,14 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
CertificationDialog.showCertificationDialog(context, gameEntity, DialogUtils.ConfirmListener {
DialogUtils.checkDownload(context, apkEntity.size) { isSubscribe ->
DownloadManager.createDownload(
context,
apkEntity,
gameEntity,
downloadMethod,
entrance,
location,
isSubscribe, traceEvent)
context,
apkEntity,
gameEntity,
downloadMethod,
entrance,
location,
isSubscribe, traceEvent
)
DeviceRemindDialog.showDeviceRemindDialog(context, gameEntity)
}

View File

@ -5,12 +5,10 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.FragmentActivity
import com.gh.base.fragment.BaseDialogFragment
import com.gh.common.util.dip2px
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DialogDownloadLinkBinding
import com.gh.gamecenter.entity.GameEntity
import com.halo.assistant.HaloApp
@ -25,11 +23,14 @@ class DownloadLinkDialog : BaseDialogFragment() {
super.onCreate(savedInstanceState)
mLinkEntity = requireArguments().getParcelable(KEY_LINK_ENTITY)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding: DialogDownloadLinkBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_download_link, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
val binding: DialogDownloadLinkBinding = DialogDownloadLinkBinding.inflate(layoutInflater, container, false)
binding.title.text = mLinkEntity?.title
binding.webView.loadDataWithBaseURL(null,
mLinkEntity?.content ?: "", "text/html", "utf-8", null)
binding.webView.loadDataWithBaseURL(
null,
mLinkEntity?.content ?: "", "text/html", "utf-8", null
)
binding.confirm.setOnClickListener {
dismissAllowingStateLoss()

View File

@ -14,15 +14,12 @@ import com.gh.gamecenter.qa.comment.CommentActivity;
import com.gh.gamecenter.qa.comment.NewCommentConversationFragment;
import com.halo.assistant.fragment.comment.CommentDetailFragment;
import butterknife.BindView;
/**
* Created by khy on 2017/3/22.
*/
public class CommentDetailActivity extends NormalActivity {
@BindView(R.id.shadowView)
public View shadowView;
private View mShadowView;
@Override
protected int getLayoutId() {
@ -32,12 +29,17 @@ public class CommentDetailActivity extends NormalActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ViewGroup.LayoutParams layoutParams = shadowView.getLayoutParams();
mShadowView = findViewById(R.id.shadowView);
ViewGroup.LayoutParams layoutParams = mShadowView.getLayoutParams();
layoutParams.height = DisplayUtils.dip2px(50f) + DisplayUtils.getStatusBarHeight(getResources());
shadowView.setLayoutParams(layoutParams);
mShadowView.setLayoutParams(layoutParams);
DisplayUtils.setStatusBarColor(this, R.color.transparent, true);
}
public View getShadowView() {
return mShadowView;
}
// article 不为空则显示跳转原文按钮
public static Intent getIntent(Context context, String commentId, MessageEntity.Article article) {
Bundle args = new Bundle();
@ -83,6 +85,4 @@ public class CommentDetailActivity extends NormalActivity {
args.putParcelable(EntranceUtils.KEY_LINK, linkEntity);
return getTargetIntent(context, CommentDetailActivity.class, NewCommentConversationFragment.class, args);
}
}

View File

@ -23,14 +23,9 @@ import java.lang.ref.SoftReference;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import butterknife.BindView;
public class CropImageActivity extends ToolBarActivity {
@BindView(R.id.cropimage_custom)
public CropImageCustom mCropImageCustom;
@BindView(R.id.status_bar)
public View mStatusBar;
protected CropImageCustom mCropImageCustom;
public static final String RESULT_CLIP_PATH = "result_clip_path";
@ -68,9 +63,13 @@ public class CropImageActivity extends ToolBarActivity {
protected void onCreate(Bundle savedInstanceState) {
mBlackTheme = getIntent().getBooleanExtra(EntranceUtils.KEY_BLACK_THEME, false);
super.onCreate(savedInstanceState);
mCropImageCustom = findViewById(R.id.cropimage_custom);
View statusBarView = findViewById(R.id.status_bar);
mTitleTv.setTextColor(mBlackTheme ? Color.WHITE : Color.BLACK);
mToolbar.setBackgroundColor(getResources().getColor(mBlackTheme ? R.color.text_28282E : R.color.white));
mStatusBar.setBackgroundColor(getResources().getColor(mBlackTheme ? R.color.text_28282E : R.color.white));
statusBarView.setBackgroundColor(getResources().getColor(mBlackTheme ? R.color.text_28282E : R.color.white));
setNavigationTitle(getString(R.string.title_crop_image));
setToolbarMenu(R.menu.menu_positive);

View File

@ -299,7 +299,7 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
// 处理非等比例缩放的图片
private fun resizeImage(position: Int) {
mBigImageView?.ssiv?.run {
mScale = mBigImageView?.ssiv?.scale ?: 0F
mScale = scale
mImageRatio = sWidth / sHeight.toFloat()
mViewRatio = mOriginWidth / mOriginHeight.toFloat()
if (!shouldResize()) return
@ -468,12 +468,10 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
}
}
private fun shouldResize() = !(abs(mImageRatio - mViewRatio) <= 0.1F || scaleWithoutResize())
private fun shouldResize() = abs(mImageRatio - mViewRatio) > RATIO_DIFF
private fun justChangeBoundsAndTransform() = mImageRatio < mViewRatio && mIsFromImageContainerView && adapter?.count == 1
private fun scaleWithoutResize() = mScale in 0.95F..1.05F && !justChangeBoundsAndTransform()
private fun startEndTransition() {
if (mAnimating) return
val doResizeTransition = Runnable {
@ -680,10 +678,10 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
startValues: TransitionValues?,
endValues: TransitionValues?
): Animator? {
val startWidth = startValues?.values!!["width"] as Int
val endWidth = endValues?.values!!["width"] as Int
val startHeight = startValues.values!!["height"] as Int
val endHeight = endValues.values!!["height"] as Int
val startWidth = (startValues?.values?.get("width") as Int?) ?: 0
val endWidth = (endValues?.values?.get("width") as Int?) ?: 0
val startHeight = (startValues?.values?.get("height") as Int?) ?: 0
val endHeight = (endValues?.values?.get("height") as Int?) ?: 0
val firstValue = if (mViewRatio < mImageRatio) startWidth.toFloat() else startHeight.toFloat()
val secondValue = if (mViewRatio < mImageRatio) endWidth.toFloat() else endHeight.toFloat()
@ -718,15 +716,11 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
startValues: TransitionValues?,
endValues: TransitionValues?
): Animator? {
val startHeight = startValues?.values!!["height"] as Int
val endHeight = endValues?.values!!["height"] as Int
val startHeight = (startValues?.values?.get("height") as Int?) ?: 0
val endHeight = (endValues?.values?.get("height") as Int?) ?: 0
return ObjectAnimator.ofFloat(startHeight.toFloat(), endHeight.toFloat()).apply {
addUpdateListener {
sceneRoot.findViewById<BigImageView>(R.id.viewimage_iv_show)?.ssiv?.run {
if (abs(mImageRatio - mViewRatio) > 0.1F && scaleWithoutResize()) {
maxScale = scale
setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP)
}
setScaleAndCenter(minScale, PointF(sWidth / 2F, sHeight / 2F))
}
}
@ -880,6 +874,7 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
companion object {
const val REQUEST_FOR_VIEWED_IMAGE = 921
const val VIEWED_IMAGE = "viewed_image"
const val RATIO_DIFF = 0.01F
private const val KEY_BASE64 = "base64"
private const val KEY_URL_LIST = "urls"

View File

@ -59,12 +59,10 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import retrofit2.HttpException;
import static com.gh.gamecenter.R.id.reuse_tv_none_data;
import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
/**
@ -73,21 +71,13 @@ import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
public class LibaoDetailActivity extends ToolBarActivity implements LibaoDetailAdapter.OnCodeScrollListener,
OnRequestCallBackListener {
@BindView(R.id.libaodetail_rv_show)
RecyclerView mLibaoDetailRv;
@BindView(R.id.reuse_ll_loading)
LinearLayout mLlLoading;
@BindView(R.id.reuse_no_connection)
LinearLayout mNoConnection;
@BindView(reuse_tv_none_data)
TextView mNoneDataTv;
@BindView(R.id.reuse_none_data)
LinearLayout mNoneData;
@BindView(R.id.detail_progressbar)
DownloadProgressBar mDownloadPb;
@BindView(R.id.list_skeleton)
View mListSkeleton;
@BindView(R.id.detail_ll_bottom)
View mDetailBottom;
private ViewSkeletonScreen mSkeleton;
@ -189,6 +179,16 @@ public class LibaoDetailActivity extends ToolBarActivity implements LibaoDetailA
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mLibaoDetailRv = findViewById(R.id.libaodetail_rv_show);
mLlLoading = findViewById(R.id.reuse_ll_loading);
mNoConnection = findViewById(R.id.reuse_no_connection);
mNoneDataTv = findViewById(R.id.reuse_tv_none_data);
mNoneData = findViewById(R.id.reuse_none_data);
mDownloadPb = findViewById(R.id.detail_progressbar);
mListSkeleton = findViewById(R.id.list_skeleton);
mDetailBottom = findViewById(R.id.detail_ll_bottom);
mName = getString(R.string.libao_detail);
setNavigationTitle(mName);
mLibaoEntity = (LibaoEntity) HaloApp.get(LibaoEntity.TAG, false);
@ -319,7 +319,7 @@ public class LibaoDetailActivity extends ToolBarActivity implements LibaoDetailA
mLibaoDetailRv.postDelayed(() -> {
if (mAdapter.libaoDetailTopViewHolder != null) {
try {
mAdapter.libaoDetailTopViewHolder.libaoCopyBtn.performClick();
mAdapter.libaoDetailTopViewHolder.binding.libaodetailCopyBtn.performClick();
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -30,7 +30,6 @@ import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
@ -99,7 +98,6 @@ import com.gh.gamecenter.manager.UpdateManager;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.normal.NormalFragment;
import com.gh.gamecenter.packagehelper.PackageViewModel;
import com.gh.gamecenter.qa.CommunityFragment;
import com.gh.gamecenter.retrofit.BiResponse;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -274,9 +272,6 @@ public class MainActivity extends BaseActivity {
ReservationRepository.refreshReservations();
if (getIntent().getBooleanExtra(SWITCH_TO_COMMUNITY, false)) {
handler.postDelayed(this::switchToCommunityTabAndRefresh, 800);
}
if (getIntent().getBooleanExtra(SWITCH_TO_VIDEO, false)) {
handler.postDelayed(() -> mMainWrapperFragment.setCurrentItem(2), 800);
}
@ -805,21 +800,11 @@ public class MainActivity extends BaseActivity {
doSkip();
}
// 跳转到问答社区并刷新
if (getIntent().getBooleanExtra(SWITCH_TO_COMMUNITY, false)) {
switchToCommunityTabAndRefresh();
}
if (getIntent().getBooleanExtra(SWITCH_TO_VIDEO, false)) {
mMainWrapperFragment.setCurrentItem(2);
}
}
private void switchToCommunityTabAndRefresh() {
getIntent().putExtra(SWITCH_TO_COMMUNITY, false);
Log.e("Switch", "true");
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_BBS));
EventBus.getDefault().post(new EBReuse(CommunityFragment.EB_RETRY_PAGE));
}
private void checkTinkerPath() {
// CommonDebug.logMethodWithParams(this, TinkerManager.getTinkerId(), TinkerManager.getNewTinkerId());
@ -943,10 +928,9 @@ public class MainActivity extends BaseActivity {
} else if (entryName.contains("halo_skip.json")) {
InputStream in = zipfile.getInputStream(entry);
if (in != null) {
final Gson gson = new Gson();
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
InnerMetaInfoEntity info = gson.fromJson(reader, InnerMetaInfoEntity.class);
InnerMetaInfoEntity info = GsonUtils.getGson().fromJson(reader, InnerMetaInfoEntity.class);
if (info != null) {
if (EntranceUtils.HOST_COMMUNITY.equals(info.getType())) {
UserManager.getInstance().setCommunityData(new CommunityEntity(info.getLink(), info.getText()));
@ -1009,11 +993,6 @@ public class MainActivity extends BaseActivity {
}
}
@Override
protected boolean useButterKnife() {
return false;
}
@Override
public String getActivityNameInChinese() {
return "游戏首页";

View File

@ -13,8 +13,6 @@ import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.message.MessageDetailFragment;
import com.halo.assistant.HaloApp;
import butterknife.BindView;
/**
* Created by khy on 2016/11/8.
* 消息详情界面(评论详情)
@ -22,8 +20,7 @@ import butterknife.BindView;
@Deprecated
public class MessageDetailActivity extends NormalActivity {
@BindView(R.id.shadowView)
public View shadowView;
private View mShadowView;
@Override
protected int getLayoutId() {
@ -33,12 +30,17 @@ public class MessageDetailActivity extends NormalActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ViewGroup.LayoutParams layoutParams = shadowView.getLayoutParams();
mShadowView = findViewById(R.id.shadowView);
ViewGroup.LayoutParams layoutParams = mShadowView.getLayoutParams();
layoutParams.height = DisplayUtils.dip2px(50f) + DisplayUtils.getStatusBarHeight(getResources());
shadowView.setLayoutParams(layoutParams);
mShadowView.setLayoutParams(layoutParams);
DisplayUtils.setStatusBarColor(this, R.color.transparent, false);
}
public View getShadowView() {
return mShadowView;
}
// 评论回复
public static Intent getMessageDetailIntent(Context context, CommentEntity entity, String newsId) {
Intent intent = new Intent(context, MessageDetailActivity.class);

View File

@ -24,7 +24,6 @@ import io.reactivex.Observable
import io.reactivex.ObservableOnSubscribe
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotterknife.bindView
import okhttp3.OkHttpClient
import okhttp3.Request
import java.io.File
@ -37,11 +36,11 @@ class NetworkDiagnosisActivity : ToolBarActivity() {
data class ProgressAndDetail(val progress: Int, val detail: String)
private val mResult by bindView<TextView>(R.id.network_diagnosis_result)
private val mProgress by bindView<TextView>(R.id.network_diagnosis_progress)
private val mWebView by bindView<WebView>(R.id.network_diagnosis_web)
private val mScrollView by bindView<ScrollView>(R.id.network_diagnosis_scrollview)
private val mSuggestBtn by bindView<TextView>(R.id.network_diagnosis_suggest)
private lateinit var mResult: TextView
private lateinit var mProgress: TextView
private lateinit var mWebView: WebView
private lateinit var mScrollView: ScrollView
private lateinit var mSuggestBtn: TextView
private val builder = SpannableStringBuilder()
@ -57,6 +56,12 @@ class NetworkDiagnosisActivity : ToolBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mResult = findViewById(R.id.network_diagnosis_result)
mProgress = findViewById(R.id.network_diagnosis_progress)
mWebView = findViewById(R.id.network_diagnosis_web)
mScrollView = findViewById(R.id.network_diagnosis_scrollview)
mSuggestBtn = findViewById(R.id.network_diagnosis_suggest)
setNavigationTitle("网络诊断")
// 5.0后Android对WebView做了优化此为关闭该优化
if (android.os.Build.VERSION.SDK_INT >= 21) {
@ -158,7 +163,6 @@ class NetworkDiagnosisActivity : ToolBarActivity() {
}
fun setResultProgress(progress: Int) {
mProgress.text = "正在进行网络诊断 $progress%"
mBaseHandler.post {

View File

@ -69,7 +69,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import retrofit2.HttpException;
@ -84,21 +83,13 @@ import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
*/
public class NewsDetailActivity extends ToolBarActivity implements OnClickListener, OnRequestCallBackListener {
@BindView(R.id.news_detail_rv_show)
RecyclerView mDetailRv;
@BindView(R.id.news_detail_ll_bottom)
LinearLayout mDetailBottomLl;
@BindView(R.id.reuse_ll_loading)
LinearLayout mReuseLoading;
@BindView(R.id.reuse_no_connection)
LinearLayout mNoConn;
@BindView(R.id.reuse_none_data)
LinearLayout mNoneData;
@BindView(R.id.reuse_tv_none_data)
TextView mNoneDataTv;
@BindView(R.id.news_detail_ll_coment)
RelativeLayout mDetailCommentLl;
@BindView(R.id.news_skeleton)
RelativeLayout mSkeletonView;
MenuItem mNewsShare;
@ -246,6 +237,15 @@ public class NewsDetailActivity extends ToolBarActivity implements OnClickListen
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDetailRv = findViewById(R.id.news_detail_rv_show);
mDetailBottomLl = findViewById(R.id.news_detail_ll_bottom);
mReuseLoading = findViewById(R.id.reuse_ll_loading);
mNoConn = findViewById(R.id.reuse_no_connection);
mNoneData = findViewById(R.id.reuse_none_data);
mNoneDataTv = findViewById(R.id.reuse_tv_none_data);
mDetailCommentLl = findViewById(R.id.news_detail_ll_coment);
mSkeletonView = findViewById(R.id.news_skeleton);
mViewSkeletonScreen = Skeleton.bind(mSkeletonView).shimmer(false).load(R.layout.news_detail_skeleton).show();
// init toolbar
setNavigationTitle("");

View File

@ -24,17 +24,16 @@ import com.gh.gamecenter.search.SearchGameResultFragment
import com.lightgame.utils.Util_System_Keyboard
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.subjects.PublishSubject
import kotterknife.bindView
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.concurrent.TimeUnit
open class SearchActivity : BaseActivity() {
val searchEt by bindView<EditText>(R.id.searchEt)
val searchBtn by bindView<TextView>(R.id.searchBtn)
private val deleteIv by bindView<ImageView>(R.id.deleteIv)
private val backBtn by bindView<RelativeLayout>(R.id.backBtn)
lateinit var searchEt: EditText
lateinit var searchBtn: TextView
private lateinit var deleteIv: ImageView
private lateinit var backBtn: RelativeLayout
private var mDao: SearchHistoryDao? = null
@ -60,6 +59,12 @@ open class SearchActivity : BaseActivity() {
@SuppressLint("CheckResult")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
searchEt = findViewById(R.id.searchEt)
searchBtn = findViewById(R.id.searchBtn)
deleteIv = findViewById(R.id.deleteIv)
backBtn = findViewById(R.id.backBtn)
val hint = intent.getStringExtra(EntranceUtils.KEY_HINT)
val searchImmediately = intent.getBooleanExtra(KEY_SEARCH_IMMEDIATELY, false)
var ignoreTextChanges = savedInstanceState != null

View File

@ -1,28 +0,0 @@
package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.gh.common.util.EntranceUtils;
import com.halo.assistant.fragment.SettingsFragment;
/**
* 游戏设置页面
*
* @ 吕方
* @since 0814
*/
@Deprecated
public class SettingActivity extends NormalActivity {
@NonNull
public static Intent getIntent(Context context, boolean isUpdate, String entrance) {
Bundle args = new Bundle();
args.putString(EntranceUtils.KEY_ENTRANCE, entrance);
args.putBoolean(EntranceUtils.KEY_VERSION_UPDATE, isUpdate);
return getTargetIntent(context, SettingActivity.class, SettingsFragment.class, args);
}
}

View File

@ -0,0 +1,22 @@
package com.gh.gamecenter
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.gh.common.util.EntranceUtils
import com.halo.assistant.fragment.SettingsFragment
class SettingActivity : NormalActivity() {
companion object {
fun getIntent(context: Context, isUpdate: Boolean, entrance: String): Intent {
return getTargetIntent(
context,
SettingActivity::class.java,
SettingsFragment::class.java, Bundle().apply {
putString(EntranceUtils.KEY_ENTRANCE, entrance)
putBoolean(EntranceUtils.KEY_VERSION_UPDATE, isUpdate)
}
)
}
}
}

View File

@ -27,27 +27,18 @@ import com.gh.gamecenter.entity.ConcernEntity;
import java.io.File;
import butterknife.BindView;
/**
* Created by khy on 2016/11/7.
* 分享卡片
*/
public class ShareCardActivity extends ToolBarActivity {
@BindView(R.id.sharecard_content)
TextView mShareContentTv;
@BindView(R.id.sharecard_game_name)
TextView mShareGameNameTv;
@BindView(R.id.sharecard_game_icon)
SimpleDraweeView mShareGameIconDv;
@BindView(R.id.sharecard_qrcode)
ImageView mShareQrCodeDv;
@BindView(R.id.sharecard_screenshot)
LinearLayout mShareScreenshotLl;
@BindView(R.id.normal_toolbar_container)
View mActionbar;
@BindView(R.id.sharecard_bottom)
LinearLayout mShareBottomLl;
String gameName;
String gameIconUrl;
@ -79,6 +70,15 @@ public class ShareCardActivity extends ToolBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mShareContentTv = findViewById(R.id.sharecard_content);
mShareGameNameTv = findViewById(R.id.sharecard_game_name);
mShareGameIconDv = findViewById(R.id.sharecard_game_icon);
mShareQrCodeDv = findViewById(R.id.sharecard_qrcode);
mShareScreenshotLl = findViewById(R.id.sharecard_screenshot);
mActionbar = findViewById(R.id.normal_toolbar_container);
mShareBottomLl = findViewById(R.id.sharecard_bottom);
Bundle extras = getIntent().getExtras();
gameName = extras.getString(EntranceUtils.KEY_GAMENAME);
gameIconUrl = extras.getString(EntranceUtils.KEY_GAME_ICON_URL);

View File

@ -44,8 +44,6 @@ import java.util.List;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
import butterknife.BindView;
import butterknife.OnClick;
import io.reactivex.functions.Consumer;
/**
@ -53,27 +51,16 @@ import io.reactivex.functions.Consumer;
*/
public class ShareCardPicActivity extends ToolBarActivity {
@BindView(R.id.sharecard_content)
TextView mShareContentTv;
@BindView(R.id.sharecard_game_name)
TextView mShareGameNameTv;
@BindView(R.id.sharecard_game_icon)
SimpleDraweeView mShareGameIconDv;
@BindView(R.id.sharecard_qrcode)
ImageView mShareQrCodeDv;
@BindView(R.id.sharecard_game_content_img)
SimpleDraweeView mShareContentImgRv;
@BindView(R.id.sharecard_screenshot)
ScrollView mShareScreenshotRl;
@BindView(R.id.normal_toolbar_container)
View mActionbar;
@BindView(R.id.sharecard_chang_img)
RelativeLayout mShareChangImageRl;
@BindView(R.id.sharecard_share_btn)
RelativeLayout mShareShareRl;
@BindView(R.id.sharecard_chang_img_icon)
ImageView mShareChangImageIcon;
@BindView(R.id.sharecard_chang_img_tv)
TextView mShareChangImageTv;
public static final String KEY_SHARE_ARRIMG = "shareArrImg";
@ -126,6 +113,9 @@ public class ShareCardPicActivity extends ToolBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initView();
Bundle extras = getIntent().getExtras();
gameName = extras.getString(EntranceUtils.KEY_GAMENAME);
gameIconUrl = extras.getString(EntranceUtils.KEY_GAME_ICON_URL);
@ -190,6 +180,39 @@ public class ShareCardPicActivity extends ToolBarActivity {
}
}
private void initView() {
mShareContentTv = findViewById(R.id.sharecard_content);
mShareGameNameTv = findViewById(R.id.sharecard_game_name);
mShareGameIconDv = findViewById(R.id.sharecard_game_icon);
mShareQrCodeDv = findViewById(R.id.sharecard_qrcode);
mShareContentImgRv = findViewById(R.id.sharecard_game_content_img);
mShareScreenshotRl = findViewById(R.id.sharecard_screenshot);
mActionbar = findViewById(R.id.normal_toolbar_container);
mShareChangImageRl = findViewById(R.id.sharecard_chang_img);
mShareShareRl = findViewById(R.id.sharecard_share_btn);
mShareChangImageIcon = findViewById(R.id.sharecard_chang_img_icon);
mShareChangImageTv = findViewById(R.id.sharecard_chang_img_tv);
mShareShareRl.setOnClickListener(v -> {
if (shareBm != null && shareBm.isRecycled()) {
shareBm.isRecycled();
}
shareBm = getBitmapByView(mShareScreenshotRl);
saveBitmap(shareBm);
MessageShareUtils.getInstance(ShareCardPicActivity.this).showShareWindows(ShareCardPicActivity.this, getWindow().getDecorView(), shareBm, picName, 1);
});
mShareChangImageRl.setOnClickListener(v -> {
if (currentImgPosition > shareArrImg.size() - 1) {
currentImgPosition = 0;
}
setContentImage(shareArrImg.get(currentImgPosition));
currentImgPosition++;
});
}
private void setContentImage(String url) {
ControllerListener<ImageInfo> listener = new BaseControllerListener<ImageInfo>() {
@Override
@ -273,17 +296,6 @@ public class ShareCardPicActivity extends ToolBarActivity {
}.start();
}
@OnClick(R.id.sharecard_share_btn)
public void OnShareListener() {
if (shareBm != null && shareBm.isRecycled()) {
shareBm.isRecycled();
}
shareBm = getBitmapByView(mShareScreenshotRl);
saveBitmap(shareBm);
MessageShareUtils.getInstance(ShareCardPicActivity.this).showShareWindows(ShareCardPicActivity.this, getWindow().getDecorView(), shareBm, picName, 1);
}
public static Bitmap getBitmapByView(ScrollView scrollView) {
int h = 0;
Bitmap bitmap;
@ -314,15 +326,4 @@ public class ShareCardPicActivity extends ToolBarActivity {
}
MessageShareUtils.getInstance(ShareCardPicActivity.this).writeBitmap(file.getPath(), picName, bm, false);
}
@OnClick(R.id.sharecard_chang_img)
public void OnChangPicListener() {
if (currentImgPosition > shareArrImg.size() - 1) {
currentImgPosition = 0;
}
setContentImage(shareArrImg.get(currentImgPosition));
currentImgPosition++;
}
}

View File

@ -19,22 +19,14 @@ import com.gh.common.util.QRCodeUtils;
import com.gh.common.util.ShareUtils;
import com.tencent.tauth.Tencent;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by khy on 2017/2/6.
*/
public class ShareGhActivity extends ToolBarActivity {
@BindView(R.id.gh_address_qrcode)
ImageView mGhQrcode;
@BindView(R.id.gh_address_tv)
TextView mGhAddress;
@BindView(R.id.content_ll)
LinearLayout mContentLl;
@BindView(R.id.share_rl)
RelativeLayout mShareRl;
@NonNull
@ -60,8 +52,18 @@ public class ShareGhActivity extends ToolBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGhQrcode = findViewById(R.id.gh_address_qrcode);
mGhAddress = findViewById(R.id.gh_address_tv);
mContentLl = findViewById(R.id.content_ll);
mShareRl = findViewById(R.id.share_rl);
mGhAddress.setOnClickListener(v -> {
MtaHelper.onEvent("我的光环_新", "分享光环", "复制官网");
ExtensionsKt.copyTextAndToast(getString(R.string.gh_website_url_100), "网址复制成功,请到微信/QQ粘贴分享");
});
setNavigationTitle(getString(R.string.title_share_gh));
ButterKnife.bind(this);
mGhAddress.setText(Html.fromHtml("<u>" + "www.ghzs.com" + "</u>"));
QRCodeUtils.setQRCode(this, getString(R.string.gh_website_url_100), mGhQrcode);
@ -69,10 +71,4 @@ public class ShareGhActivity extends ToolBarActivity {
, getString(R.string.gh_icon_url), "玩手游不用肝的感觉真好"
, "绿色安全的手游加速助手", ShareUtils.ShareEntrance.shareGh, "");
}
@OnClick(R.id.gh_address_tv)
public void copyAddress() {
MtaHelper.onEvent("我的光环_新", "分享光环", "复制官网");
ExtensionsKt.copyTextAndToast(getString(R.string.gh_website_url_100), "网址复制成功,请到微信/QQ粘贴分享");
}
}

View File

@ -49,7 +49,6 @@ import com.gh.download.DownloadManager;
import com.gh.gamecenter.entity.AuthDialogEntity;
import com.gh.gamecenter.entity.DeviceDialogEntity;
import com.gh.gamecenter.entity.PrivacyPolicyEntity;
import com.gh.gamecenter.manager.FilterManager;
import com.gh.gamecenter.retrofit.BiResponse;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -376,11 +375,6 @@ public class SplashScreenActivity extends BaseActivity {
return false;
}
@Override
protected boolean useButterKnife() {
return false;
}
// 跳转到主界面
private void launchMainActivity() {
SPUtils.setLong(Constants.SP_GH_LAST_UPDATE_TIME, PackageUtils.getHaloLastUpdateTime());
@ -455,15 +449,7 @@ public class SplashScreenActivity extends BaseActivity {
UsageStatsHelper.checkAndPostUsageStats();
GameSubstituteRepositoryHelper.updateGameSubstituteRepository();
// 第一次启动把package.txt文件内容加载进数据库
FilterManager filterManager = new FilterManager(getApplicationContext());
if (!mSharedPreferences.getBoolean("isLoadFilterV2d4", false)) {
filterManager.loadFilter();
}
// 获取过滤包
filterManager.getFilterFromServer(0);
// 更新过滤表获取自动刷新的cd获取版本对应表
// 获取自动刷新的cd获取版本对应表
String time = mSharedPreferences.getString("refresh_time", null);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
String today = format.format(new Date());

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