Compare commits
594 Commits
pack/test-
...
refactor/s
| Author | SHA1 | Date | |
|---|---|---|---|
| 5de629cfdd | |||
| f026623600 | |||
| 2f5ee0eb91 | |||
| e7651e8092 | |||
| 82d51d6375 | |||
| 6080edfd8a | |||
| d9713571c9 | |||
| b466525e8b | |||
| 2a25675dce | |||
| 5486ad8818 | |||
| 5552fcf7bc | |||
| 782a0af13c | |||
| c6c2d9cd12 | |||
| f929a08e46 | |||
| e48f96d7d7 | |||
| 3cc95dbc08 | |||
| f75396d7ae | |||
| 72c3df7fa6 | |||
| 2d4920cfb0 | |||
| 2d30b97cca | |||
| 40346e3c9a | |||
| 7f601c856a | |||
| 6e56f2e3a0 | |||
| e2fbda1e4c | |||
| 1e88ba8539 | |||
| 0f43b5610d | |||
| 04dcfbab2e | |||
| 8dd33cb599 | |||
| af5826962b | |||
| 9883f8d5c0 | |||
| 848207784e | |||
| fc294f9e7b | |||
| 96cd53a2c9 | |||
| 5458c93475 | |||
| 675d63c1d6 | |||
| 1040f5ff4d | |||
| 97be320529 | |||
| 0e086c9452 | |||
| dc677d1b9f | |||
| fa50c6e417 | |||
| dc96f2274f | |||
| ad5f5048a6 | |||
| e5491fb297 | |||
| ff96eaafee | |||
| da0ace0aa6 | |||
| 11a2d7aa53 | |||
| d3444918dd | |||
| 09f54daa76 | |||
| fa800284f5 | |||
| cdae5e4427 | |||
| e3e3155b95 | |||
| ac38f3b239 | |||
| c775ddd922 | |||
| 70a50f7d4a | |||
| 773c9da941 | |||
| c5fdcd5902 | |||
| fee31f2672 | |||
| e64585746e | |||
| 236b6e5205 | |||
| c0d1c97490 | |||
| 818a9eaf31 | |||
| 1fbd6d9f81 | |||
| c37b8f5a59 | |||
| 0d5c51f087 | |||
| ba171e27d9 | |||
| c217e524a7 | |||
| 29729ec154 | |||
| 299eba4b60 | |||
| c2b3d40525 | |||
| b7de6ab1bf | |||
| a0c5343326 | |||
| b2b42c3f0f | |||
| b318fab26f | |||
| 59cde4e2bf | |||
| cc0c7c7fae | |||
| 013398d14b | |||
| 9e9ce6a84f | |||
| 7d0b500ff9 | |||
| ac86baaca9 | |||
| c42e6705c2 | |||
| 0508f6b7ea | |||
| 04094a0016 | |||
| f99f513ed9 | |||
| 03ef795e26 | |||
| 39599a8f99 | |||
| ba9e5b28c6 | |||
| 65dfa665f5 | |||
| 9e77ca818f | |||
| 615acae0b5 | |||
| 158928253a | |||
| 45242baa8b | |||
| 04331b8881 | |||
| 425456b263 | |||
| f6abab9a2d | |||
| 6fc7eea011 | |||
| d194f969e4 | |||
| 95f66344fb | |||
| dca0fc7261 | |||
| fd77516e7c | |||
| 21226ec96c | |||
| f932978caf | |||
| 803498460c | |||
| d32d00a4fa | |||
| 3b916a527d | |||
| bd02a0b4be | |||
| 51830d0e09 | |||
| 7a498763bb | |||
| 8b839a5b13 | |||
| 7d2ed0eac0 | |||
| 5c70bc2237 | |||
| 03b36096b8 | |||
| 4191dbc4f0 | |||
| cc20b6e38a | |||
| 3ad5890238 | |||
| 6179d7055b | |||
| f18391adc2 | |||
| 3a2f15a436 | |||
| c0e8160955 | |||
| 9038131c96 | |||
| 4430ae1107 | |||
| d6aa2690b2 | |||
| e42fd24b71 | |||
| 452a1ede24 | |||
| ceb227f645 | |||
| 479ea5778b | |||
| 8969d6fd5d | |||
| cc43f2e0fd | |||
| ab12491f2f | |||
| ae24ab0c87 | |||
| 570e2fa9bc | |||
| 9e07080043 | |||
| e10a329159 | |||
| b3bc7b43f7 | |||
| 811d42457c | |||
| ac0b819ea9 | |||
| d931fb5940 | |||
| 383712900c | |||
| cea62b55e2 | |||
| ff6cdb1ba3 | |||
| b6e531fa96 | |||
| e7a37df690 | |||
| 5308ccfabe | |||
| 2ee49b9a20 | |||
| 3af3d413c0 | |||
| 9bf24977ca | |||
| bf1dd958cd | |||
| 30c34b799b | |||
| b202b580bb | |||
| 239b056abb | |||
| 315be3797c | |||
| 6d29da5172 | |||
| 8aeb0d6f09 | |||
| bdcca58770 | |||
| 4115383b68 | |||
| 9075bfa214 | |||
| 3fa63e331b | |||
| aef19fcd49 | |||
| 15d7252974 | |||
| f6fa060f3a | |||
| 7cfe48b3c8 | |||
| 6bd3c1011d | |||
| 3447ecffd8 | |||
| 644b93ab02 | |||
| 6b44140ff3 | |||
| 78d26b4cc1 | |||
| 5565539445 | |||
| 1ee0f292ba | |||
| f609637f0b | |||
| 9d10add8eb | |||
| f5a39f982e | |||
| 1a063bb0c1 | |||
| 86340d603f | |||
| 0731cc1fde | |||
| 86dfee2ff9 | |||
| edf82952ce | |||
| 062f0149d0 | |||
| a504f00bac | |||
| 4412d159bb | |||
| e119b7fecd | |||
| 72460b88be | |||
| 3fe7c8252e | |||
| 36ebab77ee | |||
| e84db01984 | |||
| ae605d4a55 | |||
| 882bf4b551 | |||
| 968164af55 | |||
| 0119e6f123 | |||
| 30135bdb8f | |||
| f8ac85d29c | |||
| 7093552259 | |||
| 2be52d21ee | |||
| cb093cc3f0 | |||
| 3cbdd94189 | |||
| 11013319bf | |||
| aa954b3af9 | |||
| 93f279a384 | |||
| 4e54833cc9 | |||
| f95862da8b | |||
| 1515df34b5 | |||
| 8a8ef40dc1 | |||
| b6194fed26 | |||
| 02752f6c81 | |||
| b33d367dfd | |||
| d5046ab431 | |||
| a53168c9bc | |||
| 3cbc8c2f74 | |||
| 7398b83004 | |||
| 8013426ded | |||
| b86d85b15f | |||
| 5a73afbab3 | |||
| e19ee25839 | |||
| 61bf39e95f | |||
| ef82ae2378 | |||
| 2dcccc22a8 | |||
| cb0e77d204 | |||
| a6ea178609 | |||
| 6a62f08891 | |||
| ddb48481d2 | |||
| 48a55a6b31 | |||
| 50fcb0c3ea | |||
| e97722b6fb | |||
| 2163b2ff9e | |||
| b9558e2732 | |||
| 39bba71e7a | |||
| 5daddeadda | |||
| 58b1c0295c | |||
| a56082d002 | |||
| 877ab7cf39 | |||
| 428e3496d8 | |||
| b33419ea05 | |||
| e9bcd0a0d6 | |||
| 98b877671a | |||
| 6c61a62799 | |||
| 391e409ee1 | |||
| cfd1ee845a | |||
| 34b123a0a7 | |||
| 51515171a8 | |||
| e9139c66e1 | |||
| 24941a165a | |||
| 9d661eefa7 | |||
| 373fa7fc80 | |||
| d9743a89d6 | |||
| 0f596836dc | |||
| eb08575f3e | |||
| 405268bbce | |||
| 2453e34a74 | |||
| 2830367826 | |||
| 782d94289f | |||
| 3e2c2fe18f | |||
| 1afd154364 | |||
| b24cac0cb1 | |||
| d5db516112 | |||
| b2a7a606e5 | |||
| 219866e195 | |||
| dea7ceb5f6 | |||
| da1da1c1af | |||
| 9b4fa45492 | |||
| 01df42b76b | |||
| cef8aa1968 | |||
| 4147612d9b | |||
| 9b57d10e2d | |||
| 19f4e70ada | |||
| 49b7e4c245 | |||
| 638de59562 | |||
| 69b092be46 | |||
| 27d1d02d58 | |||
| e4bfa5e6bf | |||
| 3ea3238011 | |||
| 2dcae2168b | |||
| 4b1c198818 | |||
| e42e2fbd56 | |||
| 713e4157db | |||
| 76cf7dce1d | |||
| f492d2ea97 | |||
| 37a3689a2c | |||
| 7429f17538 | |||
| 32ba015686 | |||
| e5365fd527 | |||
| 1c873d0194 | |||
| 1424ee2b45 | |||
| 69cb916364 | |||
| 04f1d712cd | |||
| ee14ae51be | |||
| 4683217e44 | |||
| df94d6677a | |||
| 6f85e12edf | |||
| 020c826f1d | |||
| 5640d778a2 | |||
| 2300475a9e | |||
| 612b4061d5 | |||
| 49c7ff8f8e | |||
| 1c408f3966 | |||
| 055f5b23da | |||
| 9810b3e8fe | |||
| dba7042b12 | |||
| 6695dc596e | |||
| 079ba014f8 | |||
| 46955685bb | |||
| 14eeb00539 | |||
| 56843f18d4 | |||
| 53a46892a4 | |||
| a2153761c2 | |||
| 26a8c0abd8 | |||
| 21bf0fd8e9 | |||
| 9787d23ea0 | |||
| 6ae34b81db | |||
| 0b1e770c03 | |||
| f4681dab31 | |||
| 79a7f994eb | |||
| 3276fca27c | |||
| 372db8e52c | |||
| 9b6d986f1c | |||
| 0e88db1600 | |||
| 05b59c8732 | |||
| 28f68cae95 | |||
| 22713db44e | |||
| d9389ac4aa | |||
| 31ec9311fc | |||
| fca62df263 | |||
| 978c01d7dc | |||
| b7a24e331a | |||
| b1eac6a043 | |||
| 9f8a712be6 | |||
| 930ab904ed | |||
| 3c207244e6 | |||
| 0f59e03afa | |||
| c5d99fa304 | |||
| a313cd8050 | |||
| ce477e2bd0 | |||
| 7cf2adaa37 | |||
| 0852497df2 | |||
| 592df6ea44 | |||
| 7b5d1b1bf3 | |||
| 5b1a614eb7 | |||
| ae9fbfb8c4 | |||
| 48b118d342 | |||
| 39625369d7 | |||
| 05b9920f6d | |||
| 8a5fa2c31a | |||
| c2dc6d7dbe | |||
| a027442ae6 | |||
| ba1584f642 | |||
| 4124d571b7 | |||
| a545401ca3 | |||
| 4b7f2401dd | |||
| daa1e4fc64 | |||
| 064135a057 | |||
| b56946d6f0 | |||
| 1a46d371e4 | |||
| d2a062907a | |||
| 56e945eb43 | |||
| 91579194a4 | |||
| c42a7d5963 | |||
| d2293bd881 | |||
| db4eb9f811 | |||
| 24d95b8e95 | |||
| 435dac11a1 | |||
| bffa2dab7f | |||
| 136975c067 | |||
| f389fcc206 | |||
| 9c5ef246a4 | |||
| 5f71f52fe1 | |||
| 2bfa0c1031 | |||
| 97c9dd9923 | |||
| cc3733e6fe | |||
| cacdc13b9a | |||
| ab3ebd7b37 | |||
| 08879b63da | |||
| ca8d41bac2 | |||
| 31c54b8f3b | |||
| 038da5dae2 | |||
| 3bcf332dfa | |||
| ee7723a4d8 | |||
| aed68e3268 | |||
| 6902e748e4 | |||
| fa9186cb54 | |||
| 119a684112 | |||
| 72d8016c4b | |||
| 6569eecbb1 | |||
| 83cb925be2 | |||
| a98b54269a | |||
| 570cf800e5 | |||
| 83ec4414f9 | |||
| 004bd3421a | |||
| f365a80a84 | |||
| ff078ab2a1 | |||
| 0ba49550b3 | |||
| 251e867833 | |||
| ca20d7e2a3 | |||
| 8fb4b373d3 | |||
| 58fa40fe08 | |||
| cd4f2783b5 | |||
| 4ee735b8cd | |||
| 605b886315 | |||
| 54eb44d072 | |||
| 5866b0d28a | |||
| 9f47f30f38 | |||
| dcb3fa3910 | |||
| 12bbd008d8 | |||
| 49b35b2837 | |||
| 1269560541 | |||
| a788b7b485 | |||
| f47a2db92b | |||
| aa41551c4e | |||
| 813634379a | |||
| e884e9b45a | |||
| e86a301d10 | |||
| 89bdafe7ed | |||
| 8dc4b86790 | |||
| 989d1578ef | |||
| ba3b86a00e | |||
| 2a279762e1 | |||
| 574ae0eece | |||
| 9412c255eb | |||
| c2c6901b04 | |||
| e8cca4b491 | |||
| b4e2685f19 | |||
| 8f9c5fac95 | |||
| e28a4a8fed | |||
| 45b4d1214e | |||
| a7dc78b969 | |||
| 11a0d55d12 | |||
| 398ff16f76 | |||
| 5d7056735a | |||
| 3bd0444dde | |||
| 4d2d3d24ee | |||
| 7310056d2e | |||
| 5cf8b80ea4 | |||
| bf5b7ced89 | |||
| b1e44ea89b | |||
| 1f5b9bde3e | |||
| c57063bcfe | |||
| 5fd7d0bb62 | |||
| a45d6ce0b4 | |||
| dcff648d37 | |||
| 513938da99 | |||
| 6490111940 | |||
| 56437855d8 | |||
| 29facb49df | |||
| f023a315b9 | |||
| b9d217d773 | |||
| cbdab7cd50 | |||
| 5b2f710be8 | |||
| b15dafb852 | |||
| 37b36a9632 | |||
| 17495e3699 | |||
| d9ee277e82 | |||
| bb6bdb1351 | |||
| 204300ca98 | |||
| 24815cd398 | |||
| b963281eb6 | |||
| 95721268f7 | |||
| dfd542f5df | |||
| 14522e5d07 | |||
| 71efe3b69a | |||
| b8cbbc0301 | |||
| 2fe8051280 | |||
| 0d4a893552 | |||
| e07216365a | |||
| 1c04e966d9 | |||
| ba0ad10f61 | |||
| 9592731033 | |||
| 0dc9fb1aa3 | |||
| fd450f0d67 | |||
| 57984d160f | |||
| 165ca21926 | |||
| e19c091532 | |||
| 5db6b3511f | |||
| 8557b230ac | |||
| 44a817be12 | |||
| c76e0b8bfa | |||
| bbbd77b8ab | |||
| 08ab5ec727 | |||
| 39afbecce8 | |||
| 4229f0e335 | |||
| efae6cb459 | |||
| 8f8cfb757f | |||
| 1e894e1158 | |||
| 96b479b8f0 | |||
| 342eefe7ba | |||
| e9c9f6f66b | |||
| 7da90ffb0b | |||
| c71f8676dd | |||
| 50555cb217 | |||
| 766e4fc3ab | |||
| c091e496e7 | |||
| ecd81ea353 | |||
| 21e7198589 | |||
| d6c97bc215 | |||
| 321e9b6ee6 | |||
| 7cc3e7ec67 | |||
| 08dac2eb42 | |||
| 85c7746206 | |||
| a35700e2f7 | |||
| 6a44294338 | |||
| b8c275d8fc | |||
| 638bf86d1e | |||
| 158c46f210 | |||
| a28ef7d20b | |||
| bae20a4e7d | |||
| 4a2f0896bb | |||
| 51ccc532d5 | |||
| 1bf977f3e4 | |||
| da2aeeeaf2 | |||
| 52d160a0e0 | |||
| cbba9c09b5 | |||
| 3c877ada98 | |||
| 9b95e01d33 | |||
| 567576fc04 | |||
| 1b7913a00e | |||
| 05e2719e1c | |||
| 8ed10c411a | |||
| f9f4bb84b4 | |||
| 44a2e616ab | |||
| fffd3ef789 | |||
| d53782b8de | |||
| b16c5d723b | |||
| 1dfd636283 | |||
| 65feed01f4 | |||
| 2a596bd2a0 | |||
| 16c4f1016c | |||
| 1ced82c1f6 | |||
| 078c9204af | |||
| 68818b3409 | |||
| 7d4aa34d12 | |||
| 209c3d7d30 | |||
| 2a27e0f467 | |||
| 54ee8a9c69 | |||
| 2b44efd6b3 | |||
| d62c8beb30 | |||
| 155ec08280 | |||
| d46aa81dbe | |||
| 51c0bf27cf | |||
| 43eb4c88c9 | |||
| 06b2d2b416 | |||
| af7580a6a6 | |||
| 1e4375ec8a | |||
| 195247a5c3 | |||
| dd65bc8bc2 | |||
| 196e719358 | |||
| b1c267b179 | |||
| a2679c8dbd | |||
| c9e1816be0 | |||
| a1f0455d5a | |||
| 5b3f4b6104 | |||
| fe4e9d9d3b | |||
| dd051b4d13 | |||
| e7f756555c | |||
| 9488837e9e | |||
| b8c4f1403b | |||
| b88698c2a3 | |||
| c897d5ad0f | |||
| 037f453a75 | |||
| ad3a3c1341 | |||
| ba320f7740 | |||
| f3dbc0b779 | |||
| 0c518ac40e | |||
| ccc0140bba | |||
| bf57118900 | |||
| b80a14f2b1 | |||
| 2c044d0ee4 | |||
| 1450064640 | |||
| 90e19d5099 | |||
| 383124dc36 | |||
| 6d6ce2613a | |||
| 8569264b82 | |||
| 59667abf09 | |||
| 5201637326 | |||
| 417c41c8a0 | |||
| b651ef8617 | |||
| af67894d4e | |||
| 76e17eddd7 | |||
| f8c9c41eb0 | |||
| 40ac173389 | |||
| c6bc7ca6cc | |||
| f01e08aec9 | |||
| faddf5d7b6 | |||
| 81cf2f0ddc | |||
| 198561d15a | |||
| 1e721b699c | |||
| 8f48dfd347 | |||
| bc811a2882 | |||
| bdccbc4c28 | |||
| bfd986fdfd | |||
| a2bd5e01e0 | |||
| 844d227f19 | |||
| 8b1f92e9c4 | |||
| f5834d440b | |||
| f982bf6478 | |||
| 33d7afec71 | |||
| 37ef50f323 | |||
| 4c6acdee3a | |||
| 6beb060e63 | |||
| d11ccba0b7 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -9,4 +9,6 @@ build/
|
|||||||
release-app/
|
release-app/
|
||||||
test-app/
|
test-app/
|
||||||
scripts/apk-channel/
|
scripts/apk-channel/
|
||||||
app/src/test/java/com/gh/gamecenter
|
app/src/test/java/com/gh/gamecenter
|
||||||
|
app/src/main/assets-debug/
|
||||||
|
app/src/main/assets-release/
|
||||||
@ -78,7 +78,7 @@ sonarqube_analysis:
|
|||||||
tags:
|
tags:
|
||||||
- offline-test
|
- offline-test
|
||||||
stage: build&analyze
|
stage: build&analyze
|
||||||
image: sonarsource/sonar-scanner-cli:latest
|
image: hub.shanqu.cc/library/sonar-scanner-cli:latest
|
||||||
dependencies: [] #禁止传递来的artifact
|
dependencies: [] #禁止传递来的artifact
|
||||||
script:
|
script:
|
||||||
## 获取项目的一级组和二级组和项目名作为projectKey,例如projectKey=platform-backend-eci-monitor
|
## 获取项目的一级组和二级组和项目名作为projectKey,例如projectKey=platform-backend-eci-monitor
|
||||||
@ -127,6 +127,9 @@ oss-upload&send-email:
|
|||||||
- sysadm-devops
|
- sysadm-devops
|
||||||
stage: oss-upload&send-email
|
stage: oss-upload&send-email
|
||||||
image: hub.shanqu.cc/devops/android-apk-oss-upload:latest
|
image: hub.shanqu.cc/devops/android-apk-oss-upload:latest
|
||||||
|
id_tokens:
|
||||||
|
VAULT_ID_TOKEN:
|
||||||
|
aud: https://vault.shanqu.cc
|
||||||
variables:
|
variables:
|
||||||
GIT_STRATEGY: none
|
GIT_STRATEGY: none
|
||||||
VAULT_ADDR: https://vault.shanqu.cc # 固定值
|
VAULT_ADDR: https://vault.shanqu.cc # 固定值
|
||||||
@ -145,6 +148,7 @@ oss-upload&send-email:
|
|||||||
artifacts: true
|
artifacts: true
|
||||||
script:
|
script:
|
||||||
### 绑定上传参数 ###
|
### 绑定上传参数 ###
|
||||||
|
|
||||||
- export OSS_PATH="release/dev/${CI_PROJECT_NAME}/$(date "+%Y/%m/%d")"
|
- export OSS_PATH="release/dev/${CI_PROJECT_NAME}/$(date "+%Y/%m/%d")"
|
||||||
### 开启上传 ###
|
### 开启上传 ###
|
||||||
- /usr/local/bin/python /upload.py
|
- /usr/local/bin/python /upload.py
|
||||||
@ -152,4 +156,4 @@ oss-upload&send-email:
|
|||||||
- /usr/local/bin/python /ci-android-mail-jira-comment.py
|
- /usr/local/bin/python /ci-android-mail-jira-comment.py
|
||||||
only:
|
only:
|
||||||
- dev
|
- dev
|
||||||
- release
|
- release
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -8,3 +8,6 @@
|
|||||||
[submodule "ndownload"]
|
[submodule "ndownload"]
|
||||||
path = ndownload
|
path = ndownload
|
||||||
url = ../../../android/ndownload.git
|
url = ../../../android/ndownload.git
|
||||||
|
[submodule "vasdk"]
|
||||||
|
path = vasdk
|
||||||
|
url = ../../../sdg/android/vasdk.git
|
||||||
|
|||||||
@ -44,5 +44,4 @@
|
|||||||
|
|
||||||
### 混淆配置
|
### 混淆配置
|
||||||
|
|
||||||
* 本项目使用了微信的 [AndResGuard](https://github.com/shwenzhang/AndResGuard) 作为资源混淆压缩方案,新增需要使用 `getIdentifier` 获取的资源文件时需要添加至白名单
|
|
||||||
* 本项目默认使用 R8 作为混淆工具,往 proguard-rules.txt 添加 proguard 新配置项时请检查可用性(如语法等)
|
* 本项目默认使用 R8 作为混淆工具,往 proguard-rules.txt 添加 proguard 新配置项时请检查可用性(如语法等)
|
||||||
|
|||||||
289
app/build.gradle
289
app/build.gradle
@ -3,7 +3,6 @@ apply plugin: 'com.android.application'
|
|||||||
apply plugin: 'kotlin-android' // kotlin
|
apply plugin: 'kotlin-android' // kotlin
|
||||||
apply plugin: 'kotlin-parcelize'
|
apply plugin: 'kotlin-parcelize'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
apply plugin: 'AndResGuard'
|
|
||||||
|
|
||||||
import groovy.xml.XmlUtil
|
import groovy.xml.XmlUtil
|
||||||
|
|
||||||
@ -75,7 +74,7 @@ android {
|
|||||||
versionName rootProject.ext.versionName
|
versionName rootProject.ext.versionName
|
||||||
applicationId rootProject.ext.applicationId
|
applicationId rootProject.ext.applicationId
|
||||||
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard-fresco.txt'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard-fresco.txt', rootProject.ext.va_proguard_rules
|
||||||
|
|
||||||
String CORE_EVENT_GAME_CATEGORY = ""
|
String CORE_EVENT_GAME_CATEGORY = ""
|
||||||
|
|
||||||
@ -102,10 +101,14 @@ android {
|
|||||||
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
|
buildConfigField "String", "NEW_API_HOST", "\"${NEW_API_HOST}\""
|
||||||
buildConfigField "String", "LOG_HUB_PROJECT", "\"${LOG_HUB_PROJECT}\""
|
buildConfigField "String", "LOG_HUB_PROJECT", "\"${LOG_HUB_PROJECT}\""
|
||||||
buildConfigField "String", "VAPI_HOST", "\"${VAPI_HOST}\""
|
buildConfigField "String", "VAPI_HOST", "\"${VAPI_HOST}\""
|
||||||
|
buildConfigField "String", "WGAME_CPM_BUSIAPPID", "\"${WGAME_CPM_BUSIAPPID}\""
|
||||||
|
buildConfigField "String", "WGAME_CPM_API_HOST", "\"${WGAME_CPM_API_HOST}\""
|
||||||
buildConfigField "String", "WECHAT_APPID", "\"${WECHAT_APPID}\""
|
buildConfigField "String", "WECHAT_APPID", "\"${WECHAT_APPID}\""
|
||||||
buildConfigField "String", "WECHAT_SECRET", "\"${WECHAT_SECRET}\""
|
buildConfigField "String", "WECHAT_SECRET", "\"${WECHAT_SECRET}\""
|
||||||
buildConfigField "String", "TENCENT_APPID", "\"${TENCENT_APPID}\""
|
buildConfigField "String", "TENCENT_APPID", "\"${TENCENT_APPID}\""
|
||||||
buildConfigField "String", "WEIBO_APPKEY", "\"${WEIBO_APPKEY}\""
|
buildConfigField "String", "WEIBO_APPKEY", "\"${WEIBO_APPKEY}\""
|
||||||
|
// 一体包的32位畅玩游戏助手包名
|
||||||
|
buildConfigField "String", "EXT_PACKAGE_NAME", "\"${rootProject.ext.EXT_PACKAGE_NAME}\""
|
||||||
}
|
}
|
||||||
|
|
||||||
// gradle 2.2以上默认同时启用v1和v2(优先用于Android N)
|
// gradle 2.2以上默认同时启用v1和v2(优先用于Android N)
|
||||||
@ -126,6 +129,23 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
// exclude 部分冗余的文件
|
||||||
|
exclude 'META-INF/gradle/incremental.annotation.processors'
|
||||||
|
exclude 'darwin/x86_64/liblz4-java.dylib'
|
||||||
|
|
||||||
|
exclude 'assets/libwbsafeedit_x86'
|
||||||
|
exclude 'assets/libwbsafeedit_x86_64'
|
||||||
|
|
||||||
|
exclude 'lib/armeabi-v7a/libRSSupport.so'
|
||||||
|
exclude 'lib/arm64-v8a/libRSSupport.so'
|
||||||
|
exclude 'lib/armeabi-v7a/librsjni.so'
|
||||||
|
exclude 'lib/arm64-v8a/librsjni.so'
|
||||||
|
|
||||||
|
resources.excludes += "com/j256/*"
|
||||||
|
resources.excludes += "org/apache/commons/codec/language/bm/*"
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
debuggable true
|
debuggable true
|
||||||
@ -164,6 +184,15 @@ android {
|
|||||||
flavorDimensions("env", "region")
|
flavorDimensions("env", "region")
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|
||||||
|
debug {
|
||||||
|
assets.srcDirs += 'src/main/assets-debug'
|
||||||
|
}
|
||||||
|
|
||||||
|
release {
|
||||||
|
assets.srcDirs += 'src/main/assets-release'
|
||||||
|
}
|
||||||
|
|
||||||
publish {
|
publish {
|
||||||
java.srcDirs = ['src/main/java', "src/default/java"]
|
java.srcDirs = ['src/main/java', "src/default/java"]
|
||||||
}
|
}
|
||||||
@ -203,6 +232,9 @@ android {
|
|||||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${DEV_QUICK_LOGIN_APPKEY}\""
|
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${DEV_QUICK_LOGIN_APPKEY}\""
|
||||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${DEV_CSJ_APPID}\""
|
buildConfigField "String", "DEV_CSJ_APPID", "\"${DEV_CSJ_APPID}\""
|
||||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
|
|
||||||
|
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}-debug\""
|
||||||
|
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}-debug")
|
||||||
}
|
}
|
||||||
|
|
||||||
// publish, 发布时候使用的 flavor,接口仅包含正式环境
|
// publish, 发布时候使用的 flavor,接口仅包含正式环境
|
||||||
@ -216,6 +248,9 @@ android {
|
|||||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
|
|
||||||
|
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||||
|
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||||
}
|
}
|
||||||
|
|
||||||
tea {
|
tea {
|
||||||
@ -229,7 +264,10 @@ android {
|
|||||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
|
|
||||||
|
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||||
|
|
||||||
manifestPlaceholders.put("APPLOG_SCHEME", "rangersapplog.byAx6uYt".toLowerCase())
|
manifestPlaceholders.put("APPLOG_SCHEME", "rangersapplog.byAx6uYt".toLowerCase())
|
||||||
|
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||||
}
|
}
|
||||||
|
|
||||||
kuaishou {
|
kuaishou {
|
||||||
@ -242,6 +280,9 @@ android {
|
|||||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
|
|
||||||
|
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||||
|
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||||
}
|
}
|
||||||
|
|
||||||
gdt {
|
gdt {
|
||||||
@ -254,6 +295,9 @@ android {
|
|||||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
|
|
||||||
|
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||||
|
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||||
}
|
}
|
||||||
|
|
||||||
sm {
|
sm {
|
||||||
@ -266,6 +310,9 @@ android {
|
|||||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||||
|
|
||||||
|
buildConfigField "String", "VA_VERSION_NAME", "\"${rootProject.ext.VA_VERSION}\""
|
||||||
|
manifestPlaceholders.put("VA_VERSION_NAME", "${rootProject.ext.VA_VERSION}")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 港澳台
|
// 港澳台
|
||||||
@ -295,6 +342,21 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除不需要的 assets
|
||||||
|
android.applicationVariants.configureEach { variant ->
|
||||||
|
variant.mergeAssets.doLast {
|
||||||
|
def assetDir = variant.mergeAssetsProvider.get().outputDir.get()
|
||||||
|
def unwantedAssets = ['2011394667', 'gdt_plugin/gdtadv2.jar']
|
||||||
|
|
||||||
|
unwantedAssets.each { assetPath ->
|
||||||
|
def file = new File([assetDir, assetPath].join(File.separator))
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||||
@ -303,7 +365,6 @@ dependencies {
|
|||||||
kuaishouImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/kuaishou/libs')
|
kuaishouImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/kuaishou/libs')
|
||||||
gdtImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/gdt/libs')
|
gdtImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/gdt/libs')
|
||||||
smImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/sm/libs')
|
smImplementation fileTree(include: ['*.jar', '*.aar'], dir: 'src/sm/libs')
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
|
|
||||||
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leakcanary}"
|
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leakcanary}"
|
||||||
debugImplementation "com.squareup.leakcanary:leakcanary-android-process:${leakcanary}"
|
debugImplementation "com.squareup.leakcanary:leakcanary-android-process:${leakcanary}"
|
||||||
@ -319,8 +380,6 @@ dependencies {
|
|||||||
implementation "androidx.viewpager2:viewpager2:${viewpager2}"
|
implementation "androidx.viewpager2:viewpager2:${viewpager2}"
|
||||||
kapt "androidx.room:room-compiler:${room}"
|
kapt "androidx.room:room-compiler:${room}"
|
||||||
|
|
||||||
implementation "com.kyleduo.switchbutton:library:${switchButton}"
|
|
||||||
|
|
||||||
implementation "com.tencent.vasdolly:helper:${apkChannelPackage}"
|
implementation "com.tencent.vasdolly:helper:${apkChannelPackage}"
|
||||||
implementation "com.tencent.vasdolly:writer:${apkChannelPackage}"
|
implementation "com.tencent.vasdolly:writer:${apkChannelPackage}"
|
||||||
|
|
||||||
@ -343,12 +402,14 @@ dependencies {
|
|||||||
exclude module: "gsyvideoplayer-androidvideocache"
|
exclude module: "gsyvideoplayer-androidvideocache"
|
||||||
exclude group: "tv.danmaku.ijk.media"
|
exclude group: "tv.danmaku.ijk.media"
|
||||||
})
|
})
|
||||||
implementation "com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:$gsyVideo"
|
implementation ("com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:$gsyVideo") {
|
||||||
|
exclude group: 'com.google.android.exoplayer', module: 'extension-rtmp'
|
||||||
|
}
|
||||||
|
|
||||||
implementation "com.llew.huawei:verifier:${verifier}"
|
implementation "com.llew.huawei:verifier:${verifier}"
|
||||||
|
|
||||||
teaImplementation "com.bytedance.applog:RangersAppLog-Lite-cn:${bytedanceApplog}"
|
teaImplementation "com.bytedance.applog:RangersAppLog-Lite-cn:${bytedanceApplog}"
|
||||||
teaImplementation "com.bytedance.applog:RangersAppLog-All-convert:${bytedanceApplog}"
|
teaImplementation "com.bytedance.ads:AppConvert:${bytedanceAppConvert}"
|
||||||
|
|
||||||
implementation "net.lingala.zip4j:zip4j:${zip4j}"
|
implementation "net.lingala.zip4j:zip4j:${zip4j}"
|
||||||
|
|
||||||
@ -357,7 +418,9 @@ dependencies {
|
|||||||
|
|
||||||
implementation "com.lg:easyfloat:${easyFloat}"
|
implementation "com.lg:easyfloat:${easyFloat}"
|
||||||
|
|
||||||
implementation "com.lg:apksig:${apksig}"
|
implementation("com.lg:apksig:${apksig}") {
|
||||||
|
exclude group: 'com.google.protobuf'
|
||||||
|
}
|
||||||
|
|
||||||
implementation "com.lg:gid:${gid}"
|
implementation "com.lg:gid:${gid}"
|
||||||
|
|
||||||
@ -369,52 +432,95 @@ dependencies {
|
|||||||
|
|
||||||
implementation project(':ndownload')
|
implementation project(':ndownload')
|
||||||
implementation project(':vspace-bridge:vspace')
|
implementation project(':vspace-bridge:vspace')
|
||||||
|
implementation(project(':feature:xapk-installer'))
|
||||||
|
|
||||||
implementation (project(':module_common')) {
|
implementation(project(':module_common')) {
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation(project(':module_login')) {
|
implementation(project(':module_login')) {
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
}
|
}
|
||||||
implementation(project(':module_setting')) {
|
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
|
||||||
}
|
|
||||||
// implementation(project(':module_setting_compose')) {
|
|
||||||
// exclude group: 'androidx.swiperefreshlayout'
|
|
||||||
// }
|
|
||||||
implementation(project(':module_core_feature')) {
|
implementation(project(':module_core_feature')) {
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
}
|
}
|
||||||
// implementation(project(':module_feedback')) {
|
|
||||||
// exclude group: 'androidx.swiperefreshlayout'
|
implementation(project(':module_setting')) {
|
||||||
// }
|
|
||||||
implementation(project(':feature:new_feedback',)) {
|
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
}
|
}
|
||||||
implementation(project(':module_sensors_data')) {
|
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
// implementation(project(':module_setting_compose')) {
|
||||||
|
// exclude group: 'androidx.swiperefreshlayout'
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enablePkg) {
|
||||||
|
implementation(project(':feature:pkg'))
|
||||||
}
|
}
|
||||||
implementation(project(':module_message')) {
|
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableFeedback) {
|
||||||
|
implementation(project(':feature:new_feedback')) {
|
||||||
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// implementation(project(':feature:vpn'))
|
|
||||||
implementation(project(':feature:pkg'))
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableMessage) {
|
||||||
implementation(project(':feature:oaid'))
|
implementation(project(':module_message')) {
|
||||||
implementation(project(':feature:floating-window'))
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
implementation(project(':feature:csj_ad'))
|
}
|
||||||
// implementation(project(':feature:beizi_startup_ad'))
|
|
||||||
implementation(project(':feature:xapk-installer'))
|
|
||||||
implementation(project(':feature:qq_game')) {
|
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableOaid) {
|
||||||
|
implementation(project(':feature:oaid'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableFloatingWindow) {
|
||||||
|
implementation(project(':feature:floating-window'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableSensorData) {
|
||||||
|
implementation(project(':module_sensors_data')) {
|
||||||
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableCsjAd) {
|
||||||
|
implementation(project(':feature:csj_ad'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableQQGame) {
|
||||||
|
implementation(project(':feature:qq_game')) {
|
||||||
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enablePush) {
|
||||||
|
def pushProperty = findProperty('BUILD_PUSH_TYPE')
|
||||||
|
// 根据BUILD_PUSH_TYPE决定使用哪个推送SDK,目前默认使用极光推送
|
||||||
|
def pushProject = (pushProperty == null || pushProperty == 'jg')
|
||||||
|
? project(':feature:jg_push') : project(':feature:acloud_push')
|
||||||
|
|
||||||
|
implementation(pushProject) {
|
||||||
|
exclude group: 'androidx.swiperefreshlayout'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableSentry) {
|
||||||
|
implementation(project(':feature:sentry'))
|
||||||
|
}
|
||||||
|
|
||||||
|
implementation(project(':feature:media_select'))
|
||||||
|
|
||||||
|
implementation(project(":module_va_api"))
|
||||||
|
implementation(project(":va-archive-common"))
|
||||||
|
if (!gradle.ext.excludeOptionalModules || gradle.ext.enableVa) {
|
||||||
|
implementation(project(":module_va_impl"))
|
||||||
|
}
|
||||||
|
debugImplementation "com.bytedance.tools.codelocator:codelocator-core:2.0.3"
|
||||||
internalImplementation(project(':module_internal_test'))
|
internalImplementation(project(':module_internal_test'))
|
||||||
|
|
||||||
// 根据BUILD_PUSH_TYPE决定使用哪个推送SDK,目前默认使用阿里云推送
|
debugImplementation 'com.bytedance.android:shadowhook:1.0.9'
|
||||||
def pushProject = findProperty('BUILD_PUSH_TYPE') == 'jg'
|
debugImplementation 'io.github.shiqos:wytrace:1.0.1'
|
||||||
? project(':feature:jg_push') : project(':feature:acloud_push')
|
|
||||||
implementation(pushProject) {
|
|
||||||
exclude group: 'androidx.swiperefreshlayout'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
File propFile = file('sign.properties')
|
File propFile = file('sign.properties')
|
||||||
@ -474,113 +580,6 @@ if (propFile.exists()) {
|
|||||||
// }.each { t -> t.dependsOn generateMetaJson }
|
// }.each { t -> t.dependsOn generateMetaJson }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
andResGuard {
|
|
||||||
mappingFile = null
|
|
||||||
use7zip = true
|
|
||||||
useSign = true
|
|
||||||
// 打开这个开关,会keep住所有资源的原始路径,只混淆资源的名字
|
|
||||||
keepRoot = false
|
|
||||||
// 设置这个值,会把arsc name列混淆成相同的名字,减少string常量池的大小
|
|
||||||
fixedResName = "arg"
|
|
||||||
// 打开这个开关会合并所有哈希值相同的资源,但请不要过度依赖这个功能去除去冗余资源
|
|
||||||
mergeDuplicatedRes = true
|
|
||||||
whiteList = [
|
|
||||||
"R.xml.jpush*",
|
|
||||||
"R.drawable.jpush*",
|
|
||||||
"R.layout.jpush*",
|
|
||||||
"R.layout.push*",
|
|
||||||
"R.string.jg*",
|
|
||||||
"R.style.MyDialogStyle",
|
|
||||||
"R.style.JPushTheme",
|
|
||||||
"R.drawable.icon",
|
|
||||||
"R.drawable.ic_bar_back",
|
|
||||||
"R.drawable.toolbar_search_icon",
|
|
||||||
"R.drawable.bg_notification_answer_style_1",
|
|
||||||
"R.drawable.bg_notification_answer_style_2",
|
|
||||||
"R.drawable.bg_notification_article_style_1",
|
|
||||||
"R.drawable.bg_notification_article_style_2",
|
|
||||||
"R.drawable.bg_notification_feedback_style_1",
|
|
||||||
"R.drawable.bg_notification_feedback_style_2",
|
|
||||||
"R.drawable.bg_notification_gift_style_1",
|
|
||||||
"R.drawable.bg_notification_gift_style_2",
|
|
||||||
"R.drawable.bg_notification_login_style_1",
|
|
||||||
"R.drawable.bg_notification_login_style_2",
|
|
||||||
"R.drawable.bg_notification_question_style_1",
|
|
||||||
"R.drawable.bg_notification_question_style_2",
|
|
||||||
"R.drawable.bg_notification_rating_style_1",
|
|
||||||
"R.drawable.bg_notification_rating_style_2",
|
|
||||||
"R.drawable.bg_notification_reserve_game_style_1",
|
|
||||||
"R.drawable.bg_notification_reserve_game_style_2",
|
|
||||||
"R.drawable.bg_notification_video_style_1",
|
|
||||||
"R.drawable.bg_notification_video_style_2",
|
|
||||||
"R.drawable.ic_recommend_activity",
|
|
||||||
"R.drawable.ic_recommend_discount",
|
|
||||||
"R.drawable.ic_recommend_function",
|
|
||||||
"R.drawable.ic_recommend_gift",
|
|
||||||
"R.drawable.ic_recommend_role",
|
|
||||||
"R.drawable.download_button_normal_style",
|
|
||||||
"R.drawable.ic_selector_selected",
|
|
||||||
"R.drawable.ic_selector_default",
|
|
||||||
"R.id.download_speed",
|
|
||||||
"R.id.download_percentage",
|
|
||||||
"R.id.comment",
|
|
||||||
"R.id.vote",
|
|
||||||
"R.id.watermark_hint",
|
|
||||||
"R.id.watermark_sb",
|
|
||||||
"R.id.bottomShareIv",
|
|
||||||
"R.id.bottomShareTv",
|
|
||||||
"R.id.recommendStarPref",
|
|
||||||
"R.id.recommendStar",
|
|
||||||
"R.id.iv_vmode_badge",
|
|
||||||
"R.id.tv_vmode",
|
|
||||||
"R.id.iv_vmode",
|
|
||||||
"R.drawable.help_search_delete",
|
|
||||||
"R.drawable.suggest_type_normal",
|
|
||||||
"R.drawable.suggest_type_crash",
|
|
||||||
"R.drawable.suggest_type_game_question",
|
|
||||||
"R.drawable.suggest_type_game_collect",
|
|
||||||
"R.drawable.suggest_type_function_suggest",
|
|
||||||
"R.drawable.suggest_type_article_collect",
|
|
||||||
"R.drawable.suggest_type_copyright",
|
|
||||||
"R.drawable.news_comment_detail_read",
|
|
||||||
"R.drawable.news_comment_detail_comment",
|
|
||||||
"R.drawable.news_comment_detail_share",
|
|
||||||
"R.drawable.ic_libao",
|
|
||||||
"R.drawable.ic_link",
|
|
||||||
"R.drawable.concern_message_icon",
|
|
||||||
"R.drawable.reuse_blank_hint",
|
|
||||||
"R.drawable.ic_concern",
|
|
||||||
"R.drawable.concern_down",
|
|
||||||
"R.drawable.concern_up",
|
|
||||||
"R.drawable.ic_libao_more",
|
|
||||||
"R.drawable.ic_libao_delete",
|
|
||||||
"R.drawable.ic_dialog_close",
|
|
||||||
"R.drawable.occupy2",
|
|
||||||
"R.drawable.kc_checkbox_unselect",
|
|
||||||
"R.drawable.kc_checkbox_select",
|
|
||||||
"R.drawable.ic_type_unselect",
|
|
||||||
"R.drawable.ic_type_selected",
|
|
||||||
"R.drawable.suggest_add_pic_icon",
|
|
||||||
"R.drawable.icon_pic_add",
|
|
||||||
"R.drawable.ask_search_input_delete",
|
|
||||||
"R.drawable.suggest_pic_delete",
|
|
||||||
"R.id.cardIv",
|
|
||||||
"R.id.cardMask",
|
|
||||||
"R.id.cardGradientMask",
|
|
||||||
"R.id.gameIconIv",
|
|
||||||
"R.id.titleContainer"
|
|
||||||
]
|
|
||||||
compressFilePattern = [
|
|
||||||
"*.png",
|
|
||||||
"*.jpg",
|
|
||||||
"*.jpeg",
|
|
||||||
"*.gif",
|
|
||||||
]
|
|
||||||
sevenzip {
|
|
||||||
artifact = 'io.github.leon406:SevenZip:1.2.22.5'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project.afterEvaluate {
|
project.afterEvaluate {
|
||||||
def variants = null
|
def variants = null
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -28,6 +28,9 @@ object GdtHelper {
|
|||||||
} else {
|
} else {
|
||||||
GDTAction.init(application, USER_ACTION_SET_ID, APP_SECRET_ID, channel)
|
GDTAction.init(application, USER_ACTION_SET_ID, APP_SECRET_ID, channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GDTAction.start()
|
||||||
|
|
||||||
Utils.log("init GdtHelper")
|
Utils.log("init GdtHelper")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
BIN
app/src/gdt/libs/GDTActionSDK.min.1.8.9.aar
Normal file
BIN
app/src/gdt/libs/GDTActionSDK.min.1.8.9.aar
Normal file
Binary file not shown.
@ -6,27 +6,37 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import com.gh.gamecenter.R
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.core.utils.ToastUtils
|
||||||
import com.gh.gamecenter.databinding.LayoutPersonalOtherItemBinding
|
import com.gh.gamecenter.databinding.LayoutPersonalOtherItemBinding
|
||||||
import com.gh.vspace.installexternalgames.InstallExternalGameActivity
|
import com.gh.vspace.installexternalgames.InstallExternalGameActivity
|
||||||
|
import com.lightgame.utils.Utils
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
@Keep
|
@Keep
|
||||||
class ExternalGameUsage : IExternalGamesUsage {
|
class ExternalGameUsage : ITestCase {
|
||||||
override fun addInstallExternalGameButton(viewParent: ViewGroup) {
|
|
||||||
|
private fun buttonTemplate(viewParent: ViewGroup, id: Int, fn: (LayoutPersonalOtherItemBinding) -> Unit) {
|
||||||
val context = viewParent.context
|
val context = viewParent.context
|
||||||
viewParent.findViewById<View>(R.id.install_game_from_external) ?: run {
|
viewParent.findViewById<View>(id) ?: run {
|
||||||
val binding = LayoutPersonalOtherItemBinding.inflate(LayoutInflater.from(context)).apply {
|
val binding = LayoutPersonalOtherItemBinding.inflate(LayoutInflater.from(context)).apply {
|
||||||
root.id = R.id.install_game_from_external
|
root.id = id
|
||||||
titleTv.text = context.getString(R.string.title_install_external_game)
|
fn(this)
|
||||||
iconIv.setImageResource(R.drawable.ic_personal_my_game)
|
|
||||||
root.setOnClickListener {
|
|
||||||
VHelper.connectService {
|
|
||||||
context.startActivity(
|
|
||||||
InstallExternalGameActivity.getIntent(context)
|
|
||||||
.apply { flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
viewParent.addView(binding.root, 0)
|
viewParent.addView(binding.root, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun addInstallExternalGameButton(viewParent: ViewGroup) {
|
||||||
|
val context = viewParent.context
|
||||||
|
buttonTemplate(viewParent, R.id.install_game_from_external) {
|
||||||
|
it.titleTv.text = context.getString(R.string.title_install_external_game)
|
||||||
|
it.iconIv.setImageResource(R.drawable.ic_personal_my_game)
|
||||||
|
it.root.setOnClickListener {
|
||||||
|
context.startActivity(
|
||||||
|
InstallExternalGameActivity.getIntent(context)
|
||||||
|
.apply { flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -25,6 +25,11 @@ class ExternalGameAdapter(private val games: List<ExternalGameUiState>, private
|
|||||||
路径:${item.apkPath}
|
路径:${item.apkPath}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.update.setOnClickListener {
|
||||||
|
onItemClickListener.onItemClick(item, OnItemClickListener.ClickType.CLICK_INSTALL)
|
||||||
|
}
|
||||||
|
|
||||||
holder.install.goneIf(item.isInstalled) {
|
holder.install.goneIf(item.isInstalled) {
|
||||||
holder.install.setOnClickListener {
|
holder.install.setOnClickListener {
|
||||||
onItemClickListener.onItemClick(item, OnItemClickListener.ClickType.CLICK_INSTALL)
|
onItemClickListener.onItemClick(item, OnItemClickListener.ClickType.CLICK_INSTALL)
|
||||||
|
|||||||
@ -8,4 +8,5 @@ class ExternalGameViewHolder(binding: LayoutExternalGameItemBinding) : RecyclerV
|
|||||||
val install = binding.btnInstall
|
val install = binding.btnInstall
|
||||||
val uninstall = binding.btnUninstall
|
val uninstall = binding.btnUninstall
|
||||||
val start = binding.btnStart
|
val start = binding.btnStart
|
||||||
|
val update = binding.btnUpdate
|
||||||
}
|
}
|
||||||
@ -1,10 +1,14 @@
|
|||||||
package com.gh.vspace.installexternalgames
|
package com.gh.vspace.installexternalgames
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.gh.common.util.DialogUtils
|
import com.gh.common.util.DialogUtils
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
|
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
|
||||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil
|
import com.gh.gamecenter.common.exposure.meta.MetaUtil
|
||||||
import com.gh.gamecenter.common.utils.dip2px
|
import com.gh.gamecenter.common.utils.dip2px
|
||||||
@ -16,6 +20,7 @@ import com.gh.gamecenter.databinding.FragmentInstallExternalGamesBinding
|
|||||||
import com.gh.vspace.VHelper
|
import com.gh.vspace.VHelper
|
||||||
import com.halo.assistant.HaloApp
|
import com.halo.assistant.HaloApp
|
||||||
import com.lg.vspace.VirtualAppManager
|
import com.lg.vspace.VirtualAppManager
|
||||||
|
import com.lightgame.download.DownloadEntity
|
||||||
import io.reactivex.Single
|
import io.reactivex.Single
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
@ -39,6 +44,19 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
|||||||
|
|
||||||
private lateinit var dialog: Dialog
|
private lateinit var dialog: Dialog
|
||||||
|
|
||||||
|
|
||||||
|
private val requestPermissionLauncher = registerForActivityResult<String, Boolean>(
|
||||||
|
ActivityResultContracts.RequestPermission()
|
||||||
|
) { result ->
|
||||||
|
if (result == true) {
|
||||||
|
// grant
|
||||||
|
mViewModel.scanPaths()
|
||||||
|
} else {
|
||||||
|
// not grant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setNavigationTitle(getString(com.gh.gamecenter.R.string.title_install_external_game))
|
setNavigationTitle(getString(com.gh.gamecenter.R.string.title_install_external_game))
|
||||||
@ -55,11 +73,30 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
|||||||
)
|
)
|
||||||
adapter.notifyDataSetChanged()
|
adapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
mViewModel.scanPaths()
|
|
||||||
|
|
||||||
|
|
||||||
|
requestStoragePermission()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun requestStoragePermission() {
|
||||||
|
when {
|
||||||
|
ContextCompat.checkSelfPermission(
|
||||||
|
requireContext(),
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||||
|
) == PackageManager.PERMISSION_GRANTED -> {
|
||||||
|
mViewModel.scanPaths()
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldShowRequestPermissionRationale(Manifest.permission.READ_EXTERNAL_STORAGE) -> {
|
||||||
|
requestPermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
requestPermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun initView() {
|
private fun initView() {
|
||||||
dialog = DialogUtils.showWaitDialog(requireContext(), "")
|
dialog = DialogUtils.showWaitDialog(requireContext(), "")
|
||||||
mBinding.externalGamesList.let {
|
mBinding.externalGamesList.let {
|
||||||
@ -67,7 +104,7 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
|||||||
it.layoutManager = LinearLayoutManager(requireContext())
|
it.layoutManager = LinearLayoutManager(requireContext())
|
||||||
val itemDecoration = HorizontalDividerItemDecoration.Builder(requireContext())
|
val itemDecoration = HorizontalDividerItemDecoration.Builder(requireContext())
|
||||||
.size(2F.dip2px())
|
.size(2F.dip2px())
|
||||||
.color(R.color.ui_divider.toColor(requireContext()))
|
.color(com.gh.gamecenter.common.R.color.ui_divider.toColor(requireContext()))
|
||||||
.build()
|
.build()
|
||||||
if (it.itemDecorationCount != 0) {
|
if (it.itemDecorationCount != 0) {
|
||||||
it.removeItemDecorationAt(0)
|
it.removeItemDecorationAt(0)
|
||||||
@ -93,9 +130,11 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
|||||||
OnItemClickListener.ClickType.CLICK_INSTALL -> {
|
OnItemClickListener.ClickType.CLICK_INSTALL -> {
|
||||||
install(externalGameUiState)
|
install(externalGameUiState)
|
||||||
}
|
}
|
||||||
|
|
||||||
OnItemClickListener.ClickType.CLICK_UNINSTALL -> {
|
OnItemClickListener.ClickType.CLICK_UNINSTALL -> {
|
||||||
uninstall(externalGameUiState)
|
uninstall(externalGameUiState)
|
||||||
}
|
}
|
||||||
|
|
||||||
OnItemClickListener.ClickType.CLICK_START -> {
|
OnItemClickListener.ClickType.CLICK_START -> {
|
||||||
start(externalGameUiState)
|
start(externalGameUiState)
|
||||||
}
|
}
|
||||||
@ -103,21 +142,21 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun install(externalGameUiState: ExternalGameUiState) {
|
private fun install(externalGameUiState: ExternalGameUiState) {
|
||||||
val bit =
|
|
||||||
externalGameUiState.externalGameEntity.cpuAbi.let { if (it.size == 1 && it.contains("armeabi-v7a")) "32" else "64" }
|
VHelper.disableLaunchGameAfterInstallation()
|
||||||
if (VHelper.showDialogIfVSpaceIsNeeded(
|
VHelper.install(requireContext(), DownloadEntity().apply {
|
||||||
requireContext(),
|
externalGameUiState.externalGameEntity.apply {
|
||||||
"",
|
packageName = apkPackageName
|
||||||
externalGameUiState.externalGameEntity.appName,
|
path = apkPath
|
||||||
"",
|
}
|
||||||
bit = bit
|
}, true)
|
||||||
)
|
|
||||||
) return
|
VHelper.newCwValidateVspaceBeforeAction(
|
||||||
dialog.show()
|
requireContext(),null,
|
||||||
externalGameUiState.externalGameEntity.let {
|
) {
|
||||||
val intent = VirtualAppManager.getInstallIntent(context, it.apkPath, it.apkPackageName)
|
dialog.show()
|
||||||
requireActivity().startActivity(intent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun uninstall(externalGameUiState: ExternalGameUiState) {
|
private fun uninstall(externalGameUiState: ExternalGameUiState) {
|
||||||
@ -144,7 +183,15 @@ class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
|||||||
com.gh.gamecenter.BuildConfig.VERSION_NAME,
|
com.gh.gamecenter.BuildConfig.VERSION_NAME,
|
||||||
HaloApp.getInstance().channel,
|
HaloApp.getInstance().channel,
|
||||||
"",
|
"",
|
||||||
""
|
"",
|
||||||
|
com.gh.gamecenter.BuildConfig.VA_VERSION_NAME,
|
||||||
|
HaloApp.getInstance().oaid
|
||||||
|
)
|
||||||
|
intent.setComponent(
|
||||||
|
ComponentName(
|
||||||
|
com.gh.gamecenter.BuildConfig.APPLICATION_ID,
|
||||||
|
VirtualAppManager.AIDL_SERVER_REMOTE_GUIDE_ACTIVITY
|
||||||
|
)
|
||||||
)
|
)
|
||||||
requireActivity().startActivity(intent)
|
requireActivity().startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,14 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_update"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/text_update"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_uninstall"
|
android:id="@+id/btn_uninstall"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="title_install_external_game">從SD卡安裝</string>
|
<string name="title_install_external_game">從SD卡安裝</string>
|
||||||
<string name="text_install">安裝</string>
|
<string name="text_install">安裝</string>
|
||||||
|
<string name="text_update">更新</string>
|
||||||
<string name="text_uninstall">卸載</string>
|
<string name="text_uninstall">卸載</string>
|
||||||
<string name="text_start">啟動</string>
|
<string name="text_start">啟動</string>
|
||||||
</resources>
|
</resources>
|
||||||
@ -2,6 +2,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="title_install_external_game">从SD卡安装</string>
|
<string name="title_install_external_game">从SD卡安装</string>
|
||||||
<string name="text_install">安装</string>
|
<string name="text_install">安装</string>
|
||||||
|
<string name="text_update">更新</string>
|
||||||
<string name="text_uninstall">卸载</string>
|
<string name="text_uninstall">卸载</string>
|
||||||
<string name="text_start">启动</string>
|
<string name="text_start">启动</string>
|
||||||
</resources>
|
</resources>
|
||||||
Binary file not shown.
BIN
app/src/kuaishou/libs/channelsdk-0.2.3.aar
Normal file
BIN
app/src/kuaishou/libs/channelsdk-0.2.3.aar
Normal file
Binary file not shown.
@ -7,17 +7,28 @@
|
|||||||
<package android:name="com.gh.gamecenter" />
|
<package android:name="com.gh.gamecenter" />
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
|
<queries>
|
||||||
|
<package android:name="com.gh.toolmap" />
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
<data android:scheme="ghtoolmap"/>
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
|
|
||||||
<queries>
|
<queries>
|
||||||
<package android:name="com.lg.vspace" />
|
<package android:name="com.lg.vspace" />
|
||||||
|
<package android:name="com.gh.gamecenter.addon" />
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
<!-- 华为/荣耀角标 -->
|
<!-- 华为/荣耀角标 -->
|
||||||
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE "/>
|
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE " />
|
||||||
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
|
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
|
||||||
<!-- vivo角标 -->
|
<!-- vivo角标 -->
|
||||||
<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" />
|
<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
<uses-permission
|
||||||
|
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||||
tools:ignore="ScopedStorage" />
|
tools:ignore="ScopedStorage" />
|
||||||
<!-- 允许应用程序访问网络连接 -->
|
<!-- 允许应用程序访问网络连接 -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
@ -39,7 +50,7 @@
|
|||||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||||
<!-- 应用安装相关 -->
|
<!-- 应用安装相关 -->
|
||||||
<uses-permission android:name="com.android.permission.GET_INSTALLED_APPS" />
|
<uses-permission android:name="com.android.permission.GET_INSTALLED_APPS" />
|
||||||
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||||
<!-- 前台服务权限-->
|
<!-- 前台服务权限-->
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
|
||||||
@ -54,6 +65,9 @@
|
|||||||
<!-- 如果有视频相关的广告且使用textureView播放,请务必添加,否则黑屏 -->
|
<!-- 如果有视频相关的广告且使用textureView播放,请务必添加,否则黑屏 -->
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
|
||||||
|
<!-- 悬浮窗 -->
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
|
||||||
<uses-sdk tools:overrideLibrary="
|
<uses-sdk tools:overrideLibrary="
|
||||||
com.shuyu.gsyvideoplayer,
|
com.shuyu.gsyvideoplayer,
|
||||||
com.shuyu.gsyvideoplayer.lib,
|
com.shuyu.gsyvideoplayer.lib,
|
||||||
@ -92,7 +106,33 @@
|
|||||||
com.tencent.qqmini,
|
com.tencent.qqmini,
|
||||||
com.tencent.qqmini.minigame.external,
|
com.tencent.qqmini.minigame.external,
|
||||||
com.tencent.qqmini.minigame.opensdk,
|
com.tencent.qqmini.minigame.opensdk,
|
||||||
com.tencent.qqmini.union.ad" />
|
com.tencent.qqmini.union.ad,
|
||||||
|
com.lg.vspace,
|
||||||
|
io.lg.va.common,
|
||||||
|
com.va.floating,
|
||||||
|
com.lg.cloud,
|
||||||
|
com.lg.archive,
|
||||||
|
com.lg.vclient,
|
||||||
|
com.va.realname,
|
||||||
|
com.lg.vspace.flavor,
|
||||||
|
com.lg.update,
|
||||||
|
com.lg.login,
|
||||||
|
com.lg.accelerator,
|
||||||
|
com.lody.virtual,
|
||||||
|
com.lg.core,
|
||||||
|
com.lg.ads,
|
||||||
|
com.lg.common,
|
||||||
|
com.lg.vspace.network,
|
||||||
|
com.lody.virtual.lib.res,
|
||||||
|
com.va.host,
|
||||||
|
com.lg.vspace.plugin.host,
|
||||||
|
com.lg.plugin.constant,
|
||||||
|
com.bytedance.tools.codelocator,
|
||||||
|
org.chickenhook.restrictionbypass,
|
||||||
|
com.lody.virtual.sandhook,
|
||||||
|
com.lg.vspace.common,
|
||||||
|
com.lg.vspace.archive.common,
|
||||||
|
com.wy.lib.wytrace" />
|
||||||
|
|
||||||
<!-- 去掉 SDK 一些流氓权限 -->
|
<!-- 去掉 SDK 一些流氓权限 -->
|
||||||
<uses-permission
|
<uses-permission
|
||||||
@ -111,6 +151,14 @@
|
|||||||
android:name="android.permission.ACCESS_COARSE_LOCATION"
|
android:name="android.permission.ACCESS_COARSE_LOCATION"
|
||||||
tools:node="remove" />
|
tools:node="remove" />
|
||||||
|
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.ACCESS_BACKGROUND_LOCATION"
|
||||||
|
tools:node="remove" />
|
||||||
|
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.ACCESS_FINE_LOCATION"
|
||||||
|
tools:node="remove" />
|
||||||
|
|
||||||
<supports-screens
|
<supports-screens
|
||||||
android:anyDensity="true"
|
android:anyDensity="true"
|
||||||
android:largeScreens="true"
|
android:largeScreens="true"
|
||||||
@ -146,6 +194,8 @@
|
|||||||
android:name="io.sentry.breadcrumbs.system-events"
|
android:name="io.sentry.breadcrumbs.system-events"
|
||||||
android:value="false" />
|
android:value="false" />
|
||||||
|
|
||||||
|
<meta-data android:name="module_version" android:value="${VA_VERSION_NAME}" />
|
||||||
|
|
||||||
<service android:name="com.gh.ndownload.NDownloadService" />
|
<service android:name="com.gh.ndownload.NDownloadService" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@ -270,10 +320,6 @@
|
|||||||
android:name="com.gh.gamecenter.CleanApkActivity"
|
android:name="com.gh.gamecenter.CleanApkActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name="com.gh.gamecenter.SelectUserIconActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.gh.gamecenter.CommentDetailActivity"
|
android:name="com.gh.gamecenter.CommentDetailActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
@ -298,14 +344,6 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="stateHidden" />
|
android:windowSoftInputMode="stateHidden" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".category.CategoryDirectoryActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".category.CategoryListActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.gh.gamecenter.UserInfoActivity"
|
android:name="com.gh.gamecenter.UserInfoActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
@ -427,9 +465,6 @@
|
|||||||
android:name="com.gh.gamecenter.video.game.GameVideoActivity"
|
android:name="com.gh.gamecenter.video.game.GameVideoActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name="com.gh.gamecenter.qa.editor.LocalMediaActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.gh.gamecenter.servers.GameServersActivity"
|
android:name="com.gh.gamecenter.servers.GameServersActivity"
|
||||||
@ -462,9 +497,6 @@
|
|||||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/TransparentStatusBarAndNavigationBar" />
|
android:theme="@style/TransparentStatusBarAndNavigationBar" />
|
||||||
<activity
|
|
||||||
android:name=".gamedetail.myrating.MyRatingActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity"
|
android:name="com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity"
|
||||||
@ -530,14 +562,6 @@
|
|||||||
android:name=".simulatorgame.SimulatorManagementActivity"
|
android:name=".simulatorgame.SimulatorManagementActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".catalog.CatalogActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".catalog.NewCatalogListActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".forum.search.ForumOrUserSearchActivity"
|
android:name=".forum.search.ForumOrUserSearchActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
@ -558,10 +582,6 @@
|
|||||||
android:name=".personal.DeliveryInfoActivity"
|
android:name=".personal.DeliveryInfoActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".qa.editor.PreviewVideoActivity"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".qa.video.publish.VideoPublishActivity"
|
android:name=".qa.video.publish.VideoPublishActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
@ -747,11 +767,11 @@
|
|||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.gh.gamecenter.qgame.QGameHomeWrapperActivity"
|
android:name="com.gh.gamecenter.minigame.qq.QGameHomeWrapperActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.gh.gamecenter.qgame.QGameSearchActivity"
|
android:name="com.gh.gamecenter.minigame.MiniGameSearchActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@ -770,8 +790,24 @@
|
|||||||
android:name="com.gh.gamecenter.wrapper.ToolbarWrapperActivity"
|
android:name="com.gh.gamecenter.wrapper.ToolbarWrapperActivity"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity android:name=".forum.home.CommunityActivity"
|
<activity
|
||||||
android:screenOrientation="portrait"/>
|
android:name=".forum.home.CommunityActivity"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".forum.home.follow.FollowDynamicActivity"
|
||||||
|
android:theme="@style/Theme.Transparent" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".forum.home.follow.AllFollowedActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/AppCompatTheme.APP" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".search.SearchTabActivity"
|
||||||
|
android:configChanges="keyboardHidden"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/AppCompatTheme.APP" />
|
||||||
|
|
||||||
<!-- <activity-->
|
<!-- <activity-->
|
||||||
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
|
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
|
||||||
@ -783,7 +819,8 @@
|
|||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="${applicationId}"
|
android:authorities="${applicationId}"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true">
|
android:grantUriPermissions="true"
|
||||||
|
tools:replace="android:authorities">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
android:resource="@xml/provider_paths" />
|
android:resource="@xml/provider_paths" />
|
||||||
@ -829,6 +866,8 @@
|
|||||||
|
|
||||||
<service android:name="com.gh.gamecenter.install.InstallService" />
|
<service android:name="com.gh.gamecenter.install.InstallService" />
|
||||||
|
|
||||||
|
<service android:name="com.gh.download.suspendwindow.DownloadSuspendWindowService" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.gh.gamecenter.receiver.DownloadReceiver"
|
android:name="com.gh.gamecenter.receiver.DownloadReceiver"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
|
|||||||
1
app/src/main/assets/lottie/draw_overlay_permission.json
Normal file
1
app/src/main/assets/lottie/draw_overlay_permission.json
Normal file
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
{"v":"5.6.9","fr":30,"ip":0,"op":20,"w":66,"h":66,"nm":"bottom bar tab/论坛/选中/E","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"白-修正","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":0,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":4,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":9,"s":[110,110,100]},{"t":13,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":0,"s":[{"i":[[0,-0.66],[0,0],[1.38,0],[0,1.38],[0,0],[-0.66,0],[0,0]],"o":[[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.66],[0,0],[0.66,0]],"v":[[2.5,-1.3],[2.5,0],[0,2.5],[-2.5,0],[-2.5,-1.3],[-1.3,-2.5],[1.3,-2.5]],"c":true}]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":4,"s":[{"i":[[0,-0.66],[0,0],[1.38,0],[0,1.38],[0,0],[-0.66,0],[0,0]],"o":[[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.66],[0,0],[0.66,0]],"v":[[2.5,-0.102],[2.5,0],[0,2.109],[-2.5,0],[-2.5,-0.102],[-1.3,-1.302],[1.3,-1.302]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":9,"s":[{"i":[[0,-0.66],[0,0],[1.38,0],[0,1.38],[0,0],[-0.66,0],[0,0]],"o":[[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.66],[0,0],[0.66,0]],"v":[[2.498,-1.845],[2.5,0],[0,2.734],[-2.5,0],[-2.502,-1.845],[-1.302,-3.045],[1.298,-3.045]],"c":true}]},{"t":13,"s":[{"i":[[0,-0.66],[0,0],[1.38,0],[0,1.38],[0,0],[-0.66,0],[0,0]],"o":[[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.66],[0,0],[0.66,0]],"v":[[2.5,-1.3],[2.5,0],[0,2.5],[-2.5,0],[-2.5,-1.3],[-1.3,-2.5],[1.3,-2.5]],"c":true}]}],"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":150,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"蓝","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33.76,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.8,0.42],[-3.44,-0.79],[-0.09,-1.71],[0,0],[0,0],[1.98,-0.1],[0,0],[0,0],[0,0],[0.62,0.57],[0,0],[0,0],[0,0],[0,0],[0,0],[0.2,1.89],[0,0],[0,0],[0,0]],"o":[[3.44,-0.79],[1.74,0.41],[0,0],[0,0],[0,2],[0,0],[0,0],[0,0],[-0.69,0.52],[0,0],[0,0],[0,0],[0,0],[0,0],[-1.94,0],[0,0],[0,0],[0,0],[0,-1.8]],"v":[[-6.39,-8.971],[6.39,-8.971],[9.49,-5.471],[9.5,-5.271],[9.5,3.249],[5.95,6.989],[5.75,6.999],[3.25,6.999],[0.3,9.209],[-1.95,9.089],[-2.06,8.969],[-2.17,8.849],[-2.21,8.779],[-3.4,6.999],[-5.75,6.999],[-9.48,3.639],[-9.49,3.449],[-9.5,3.249],[-9.5,-5.271]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"bm":0,"g":{"p":3,"k":{"a":0,"k":[0,0.266,0.638,1,0.5,0.242,0.595,1,1,0.217,0.552,1],"ix":9}},"s":{"a":0,"k":[-9.5,-9.561],"ix":5},"e":{"a":0,"k":[9.5,9.561],"ix":6},"t":1,"nm":"color","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"路径","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":150,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"预合成 1","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33,0],"ix":2},"a":{"a":0,"k":[33,33,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":0,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":4,"s":[70,70,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":9,"s":[110,110,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":13,"s":[90,90,100]},{"t":16,"s":[100,100,100]}],"ix":6}},"ao":0,"w":66,"h":66,"ip":0,"op":20,"st":0,"bm":0}],"markers":[]}
|
|
||||||
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
{"v":"5.5.9","fr":30,"ip":0,"op":20,"w":66,"h":66,"nm":"tab_video","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"形状图层 1","parent":2,"sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.771],"y":[0]},"t":0,"s":[0]},{"t":5,"s":[100]}],"ix":11},"r":{"a":0,"k":90,"ix":10},"p":{"a":0,"k":[-3.742,6.835,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[30.937,31.042,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"sr","sy":2,"d":1,"pt":{"a":0,"k":3,"ix":3},"p":{"a":0,"k":[0,0],"ix":4},"r":{"a":0,"k":0,"ix":5},"or":{"a":0,"k":29.286,"ix":7},"os":{"a":0,"k":75,"ix":9},"ix":1,"nm":"多边星形路径 1","mn":"ADBE Vector Shape - Star","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":13,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[-20.75,-13.25],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[102.743,88.578],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"多边星形 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.657],"y":[0]},"t":0,"s":[0]},{"t":8,"s":[100]}],"ix":2},"o":{"a":0,"k":-115,"ix":3},"m":1,"ix":2,"nm":"修剪路径 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":60,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"路径 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33.004,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.508,0.508,0.333],"y":[0,0,0]},"t":0,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.488,0.488,0.333],"y":[0,0,0]},"t":4,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.502,0.502,0.333],"y":[0,0,0]},"t":9,"s":[110,110,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.534,0.534,0.333],"y":[0,0,0]},"t":13,"s":[95,95,100]},{"t":16,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[2.16,0.38],[3.22,-0.55],[0.38,-2.16],[-0.55,-3.22],[-2.16,-0.38],[-1.63,0],[-1.61,0.27],[-0.38,2.16],[0.55,3.22]],"o":[[-0.38,-2.16],[-3.22,-0.55],[-2.16,0.38],[-0.55,3.22],[0.38,2.16],[1.61,0.27],[1.63,0],[2.16,-0.38],[0.55,-3.22],[0,0]],"v":[[9.09,-4.86],[4.86,-9.09],[-4.86,-9.09],[-9.09,-4.86],[-9.09,4.86],[-4.86,9.09],[0,9.5],[4.86,9.09],[9.09,4.86],[9.09,-4.86]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"bm":0,"g":{"p":3,"k":{"a":0,"k":[0,0.266,0.638,1,0.5,0.242,0.595,1,1,0.217,0.552,1],"ix":9}},"s":{"a":0,"k":[-5.174,-4.43],"ix":5},"e":{"a":0,"k":[8.612,8.214],"ix":6},"t":1,"nm":"Gradient Fill 3","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"路径","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60,"st":0,"bm":0}],"markers":[]}
|
|
||||||
@ -28,7 +28,7 @@ import com.gh.gamecenter.common.constant.RouteConsts
|
|||||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||||
import com.gh.gamecenter.common.utils.*
|
import com.gh.gamecenter.common.utils.*
|
||||||
import com.gh.gamecenter.core.provider.IBeiziAdProvider
|
import com.gh.gamecenter.core.AppExecutor
|
||||||
import com.gh.gamecenter.core.provider.ICsjAdProvider
|
import com.gh.gamecenter.core.provider.ICsjAdProvider
|
||||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||||
import com.gh.gamecenter.core.utils.SPUtils
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
@ -46,14 +46,11 @@ import io.reactivex.schedulers.Schedulers
|
|||||||
*
|
*
|
||||||
* 由它来分发功能实现到具体的实现
|
* 由它来分发功能实现到具体的实现
|
||||||
*
|
*
|
||||||
* 以最复杂的开屏广告为例,有三种实现(1. 自有的广告实现 2. 穿山甲的开屏广告实现 3. Beizi 的开屏广告实现)
|
* 以开屏广告为例,有两种实现(1. 自有的广告实现 2. 穿山甲的开屏广告实现 )
|
||||||
*
|
|
||||||
* 由于两个广告 SDK 有可能在一次启动中都被使用,所以会根据获取到的广告配置 config 来决定是否需要出是很好两个 SDK
|
|
||||||
*/
|
*/
|
||||||
object AdDelegateHelper {
|
object AdDelegateHelper {
|
||||||
|
|
||||||
private var mCsjAdImpl: ICsjAdProvider? = null
|
private var mCsjAdImpl: ICsjAdProvider? = null
|
||||||
private var mBeiziAdImpl: IBeiziAdProvider? = null
|
|
||||||
|
|
||||||
private val mAdConfigList: ArrayList<AdConfig> by lazy { arrayListOf() }
|
private val mAdConfigList: ArrayList<AdConfig> by lazy { arrayListOf() }
|
||||||
|
|
||||||
@ -65,8 +62,10 @@ object AdDelegateHelper {
|
|||||||
val vGameLaunchAd: AdConfig?
|
val vGameLaunchAd: AdConfig?
|
||||||
get() = mVGameLaunchAd
|
get() = mVGameLaunchAd
|
||||||
|
|
||||||
|
val splashAdDisplayInterval: Int
|
||||||
|
get() = mSplashAd?.ownerAd?.startAd?.displayInterval ?: 3
|
||||||
|
|
||||||
private const val AD_SDK_CSJ = "穿山甲"
|
private const val AD_SDK_CSJ = "穿山甲"
|
||||||
private const val AD_SDK_BEIZI = "倍孜"
|
|
||||||
const val AD_TYPE_SDK = "third_party_ads" // 第三方 SDK 广告
|
const val AD_TYPE_SDK = "third_party_ads" // 第三方 SDK 广告
|
||||||
const val AD_TYPE_OWNER = "owner_ads" // 自有广告
|
const val AD_TYPE_OWNER = "owner_ads" // 自有广告
|
||||||
|
|
||||||
@ -80,13 +79,19 @@ object AdDelegateHelper {
|
|||||||
var gameSearchKeyword = ""
|
var gameSearchKeyword = ""
|
||||||
|
|
||||||
fun initAdSdk(context: Context) {
|
fun initAdSdk(context: Context) {
|
||||||
// 初始化 Beizi
|
if (AdPluginDownloadHelper.isCsjPluginDownloaded()) {
|
||||||
if (mBeiziAdImpl == null) {
|
initAdSdkInternal(context)
|
||||||
mBeiziAdImpl =
|
} else {
|
||||||
ARouter.getInstance().build(RouteConsts.provider.beiziAd).navigation() as? IBeiziAdProvider
|
// 首次启动,为了不影响首页加载,延迟 3 秒再下载广告插件并初始化
|
||||||
mBeiziAdImpl?.initSDK(context)
|
AppExecutor.uiExecutor.executeWithDelay({
|
||||||
|
AdPluginDownloadHelper.downloadPluginIfNeeded(isCsj = true) {
|
||||||
|
initAdSdkInternal(context)
|
||||||
|
}
|
||||||
|
}, 3000L)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initAdSdkInternal(context: Context) {
|
||||||
// 初始化穿山甲
|
// 初始化穿山甲
|
||||||
if (mCsjAdImpl == null) {
|
if (mCsjAdImpl == null) {
|
||||||
mCsjAdImpl =
|
mCsjAdImpl =
|
||||||
@ -191,10 +196,11 @@ object AdDelegateHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 热启动是否需要显示开屏广告
|
* 热启动是否需要显示开屏广告(目前只展示第三方广告)
|
||||||
*/
|
*/
|
||||||
private fun shouldShowStartUpAdWhenHotLaunch() =
|
private fun shouldShowStartUpAdWhenHotLaunch() = (mCsjAdImpl != null)
|
||||||
mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK && mSplashAd?.hotStartThirdPartyAd != null
|
&& mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK
|
||||||
|
&& mSplashAd?.hotStartThirdPartyAd != null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否需要显示下载管理广告
|
* 是否需要显示下载管理广告
|
||||||
@ -203,6 +209,10 @@ object AdDelegateHelper {
|
|||||||
return mDownloadManagerAd != null && !isMatchAdFreeRule(mDownloadManagerAd) && isMatchDownloadManagerAdDisplayRule()
|
return mDownloadManagerAd != null && !isMatchAdFreeRule(mDownloadManagerAd) && isMatchDownloadManagerAdDisplayRule()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun shouldShowHelperLaunchAd(): Boolean {
|
||||||
|
return mVGameLaunchAd != null && !isMatchAdFreeRule(mVGameLaunchAd) && isMatchAdDisplayRule(mVGameLaunchAd, Constants.SP_LAST_HELPER_LAUNCH_AD_SHOW_TIME)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否需要显示游戏搜索广告
|
* 是否需要显示游戏搜索广告
|
||||||
*/
|
*/
|
||||||
@ -231,26 +241,16 @@ object AdDelegateHelper {
|
|||||||
/**
|
/**
|
||||||
* 是否大于开屏广告展示间隔时长
|
* 是否大于开屏广告展示间隔时长
|
||||||
*/
|
*/
|
||||||
private fun isMatchStartUpAdDisplayRule(): Boolean {
|
private fun isMatchStartUpAdDisplayRule(): Boolean = isMatchAdDisplayRule(mSplashAd, Constants.SP_LAST_SPLASH_AD_SHOW_TIME)
|
||||||
mSplashAd?.displayRule?.run {
|
|
||||||
if (adDisplayInterval > 0) {
|
|
||||||
val lastShowTime = SPUtils.getLong(Constants.SP_LAST_SPLASH_AD_SHOW_TIME, 0L)
|
|
||||||
val durationInMinutes = (System.currentTimeMillis() - lastShowTime).toFloat() / 1000 / 60
|
|
||||||
return durationInMinutes > adDisplayInterval
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否大于广告管理展示间隔时长
|
* 是否大于广告管理展示间隔时长
|
||||||
*/
|
*/
|
||||||
private fun isMatchDownloadManagerAdDisplayRule(): Boolean {
|
private fun isMatchDownloadManagerAdDisplayRule(): Boolean = isMatchAdDisplayRule(mDownloadManagerAd, Constants.SP_LAST_DOWNLOAD_MANAGER_AD_SHOW_TIME)
|
||||||
mDownloadManagerAd?.displayRule?.run {
|
private fun isMatchAdDisplayRule(adConfig: AdConfig?, spKey: String): Boolean {
|
||||||
|
adConfig?.displayRule?.run {
|
||||||
if (adDisplayInterval > 0) {
|
if (adDisplayInterval > 0) {
|
||||||
val lastShowTime = SPUtils.getLong(Constants.SP_LAST_DOWNLOAD_MANAGER_AD_SHOW_TIME, 0L)
|
val lastShowTime = SPUtils.getLong(spKey, 0L)
|
||||||
val durationInMinutes = (System.currentTimeMillis() - lastShowTime).toFloat() / 1000 / 60
|
val durationInMinutes = (System.currentTimeMillis() - lastShowTime).toFloat() / 1000 / 60
|
||||||
return durationInMinutes > adDisplayInterval
|
return durationInMinutes > adDisplayInterval
|
||||||
} else {
|
} else {
|
||||||
@ -295,6 +295,7 @@ object AdDelegateHelper {
|
|||||||
adViewHeightInDp: Float,
|
adViewHeightInDp: Float,
|
||||||
startAdContainer: ViewGroup,
|
startAdContainer: ViewGroup,
|
||||||
sdkStartAdContainer: ViewGroup,
|
sdkStartAdContainer: ViewGroup,
|
||||||
|
sdkJumpBtn: TextView,
|
||||||
adsViewGroup: FrameLayout,
|
adsViewGroup: FrameLayout,
|
||||||
handler: BaseActivity.BaseHandler,
|
handler: BaseActivity.BaseHandler,
|
||||||
isHotLaunch: Boolean,
|
isHotLaunch: Boolean,
|
||||||
@ -316,6 +317,7 @@ object AdDelegateHelper {
|
|||||||
adViewHeightInDp,
|
adViewHeightInDp,
|
||||||
startAdContainer,
|
startAdContainer,
|
||||||
sdkStartAdContainer,
|
sdkStartAdContainer,
|
||||||
|
sdkJumpBtn,
|
||||||
adsViewGroup,
|
adsViewGroup,
|
||||||
handler,
|
handler,
|
||||||
isHotLaunch,
|
isHotLaunch,
|
||||||
@ -333,6 +335,7 @@ object AdDelegateHelper {
|
|||||||
adViewHeightInDp,
|
adViewHeightInDp,
|
||||||
startAdContainer,
|
startAdContainer,
|
||||||
sdkStartAdContainer,
|
sdkStartAdContainer,
|
||||||
|
sdkJumpBtn,
|
||||||
adsViewGroup,
|
adsViewGroup,
|
||||||
handler,
|
handler,
|
||||||
isHotLaunch,
|
isHotLaunch,
|
||||||
@ -356,6 +359,7 @@ object AdDelegateHelper {
|
|||||||
adViewHeightInDp: Float,
|
adViewHeightInDp: Float,
|
||||||
startAdContainer: ViewGroup,
|
startAdContainer: ViewGroup,
|
||||||
sdkStartAdContainer: ViewGroup,
|
sdkStartAdContainer: ViewGroup,
|
||||||
|
sdkJumpBtn: TextView,
|
||||||
adsViewGroup: FrameLayout,
|
adsViewGroup: FrameLayout,
|
||||||
handler: BaseActivity.BaseHandler,
|
handler: BaseActivity.BaseHandler,
|
||||||
isHotLaunch: Boolean,
|
isHotLaunch: Boolean,
|
||||||
@ -377,6 +381,7 @@ object AdDelegateHelper {
|
|||||||
adViewHeightInDp,
|
adViewHeightInDp,
|
||||||
startAdContainer,
|
startAdContainer,
|
||||||
sdkStartAdContainer,
|
sdkStartAdContainer,
|
||||||
|
sdkJumpBtn,
|
||||||
adsViewGroup,
|
adsViewGroup,
|
||||||
handler,
|
handler,
|
||||||
isHotLaunch,
|
isHotLaunch,
|
||||||
@ -402,20 +407,18 @@ object AdDelegateHelper {
|
|||||||
((mSplashAd?.displayRule?.timeout ?: 3.5F) * 1000).toInt()
|
((mSplashAd?.displayRule?.timeout ?: 3.5F) * 1000).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thirdPartyAd.sourceName == AD_SDK_BEIZI) {
|
if (thirdPartyAd.sourceName == AD_SDK_CSJ) {
|
||||||
sdkStartAdContainer.visibility = View.VISIBLE
|
|
||||||
requestBeiziSplashAd(sdkStartAdContainer, adsViewGroup, adViewWidthInPx, adViewHeightInPx, timeout.toLong(), sdkSplashCallback)
|
|
||||||
} else if (thirdPartyAd.sourceName == AD_SDK_CSJ) {
|
|
||||||
sdkStartAdContainer.visibility = View.VISIBLE
|
sdkStartAdContainer.visibility = View.VISIBLE
|
||||||
requestCsjSplashAd(
|
requestCsjSplashAd(
|
||||||
activity,
|
activity,
|
||||||
thirdPartyAd.slotId,
|
|
||||||
adViewWidthInPx,
|
adViewWidthInPx,
|
||||||
adViewHeightInPx,
|
adViewHeightInPx,
|
||||||
adViewWidthInDp,
|
adViewWidthInDp,
|
||||||
adViewHeightInDp,
|
adViewHeightInDp,
|
||||||
sdkStartAdContainer,
|
sdkStartAdContainer,
|
||||||
|
sdkJumpBtn,
|
||||||
timeout,
|
timeout,
|
||||||
|
isHotLaunch,
|
||||||
sdkSplashCallback
|
sdkSplashCallback
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -426,50 +429,70 @@ object AdDelegateHelper {
|
|||||||
*/
|
*/
|
||||||
private fun requestCsjSplashAd(
|
private fun requestCsjSplashAd(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
slotId: String,
|
|
||||||
adViewWidthInPx: Int,
|
adViewWidthInPx: Int,
|
||||||
adViewHeightInPx: Int,
|
adViewHeightInPx: Int,
|
||||||
adViewWidthInDp: Float,
|
adViewWidthInDp: Float,
|
||||||
adViewHeightInDp: Float,
|
adViewHeightInDp: Float,
|
||||||
startAdContainer: ViewGroup,
|
startAdContainer: ViewGroup,
|
||||||
|
sdkJumpBtn: TextView,
|
||||||
timeout: Int,
|
timeout: Int,
|
||||||
|
isHotLaunch: Boolean,
|
||||||
callback: (isSuccess: Boolean) -> Unit,
|
callback: (isSuccess: Boolean) -> Unit,
|
||||||
) {
|
) {
|
||||||
if (mCsjAdImpl == null) {
|
val thirdPartyAd = if (isHotLaunch) mSplashAd?.hotStartThirdPartyAd else mSplashAd?.thirdPartyAd
|
||||||
|
if (mCsjAdImpl == null || thirdPartyAd == null) {
|
||||||
callback.invoke(false)
|
callback.invoke(false)
|
||||||
} else {
|
} else {
|
||||||
|
sdkJumpBtn.setOnClickListener {
|
||||||
|
callback.invoke(true)
|
||||||
|
if (activity is BaseActivity) {
|
||||||
|
activity.baseHandler.removeMessages(MainActivity.COUNTDOWN_SDK_AD)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val onAdShowAction = {
|
||||||
|
sdkJumpBtn.visibility = View.VISIBLE
|
||||||
|
if (activity is BaseActivity) {
|
||||||
|
activity.baseHandler.sendEmptyMessageDelayed(MainActivity.COUNTDOWN_SDK_AD, 1000)
|
||||||
|
}
|
||||||
|
SensorsBridge.trackEvent("ThirdPartyAdShow",
|
||||||
|
"ad_source", thirdPartyAd.sourceName,
|
||||||
|
"ad_id", thirdPartyAd.slotId,
|
||||||
|
"ad_format", mSplashAd?.typeChinese ?: "",
|
||||||
|
"ad_placement", "光环启动",
|
||||||
|
"launch_type", if (isHotLaunch) "热启动" else "冷启动",
|
||||||
|
"ad_space_id", mSplashAd?.id ?: "",
|
||||||
|
"ad_space_name", mSplashAd?.name ?: ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val onAdClickAction = {
|
||||||
|
callback.invoke(true)
|
||||||
|
SensorsBridge.trackEvent("ThirdPartyAdClick",
|
||||||
|
"ad_source", thirdPartyAd.sourceName,
|
||||||
|
"ad_id", thirdPartyAd.slotId,
|
||||||
|
"ad_format", mSplashAd?.typeChinese ?: "",
|
||||||
|
"ad_placement", "光环启动",
|
||||||
|
"launch_type", if (isHotLaunch) "热启动" else "冷启动",
|
||||||
|
"ad_space_id", mSplashAd?.id ?: "",
|
||||||
|
"ad_space_name", mSplashAd?.name ?: ""
|
||||||
|
)
|
||||||
|
}
|
||||||
mCsjAdImpl?.requestSplashAd(
|
mCsjAdImpl?.requestSplashAd(
|
||||||
activity,
|
activity,
|
||||||
slotId,
|
thirdPartyAd.slotId,
|
||||||
adViewWidthInPx,
|
adViewWidthInPx,
|
||||||
adViewHeightInPx,
|
adViewHeightInPx,
|
||||||
adViewWidthInDp,
|
adViewWidthInDp,
|
||||||
adViewHeightInDp,
|
adViewHeightInDp,
|
||||||
startAdContainer,
|
startAdContainer,
|
||||||
timeout,
|
timeout,
|
||||||
|
onAdShowAction,
|
||||||
|
onAdClickAction,
|
||||||
callback,
|
callback,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 Beizi 的开屏广告
|
|
||||||
*/
|
|
||||||
private fun requestBeiziSplashAd(
|
|
||||||
startAdContainer: View,
|
|
||||||
adsFl: FrameLayout,
|
|
||||||
adViewWidthInPx: Int,
|
|
||||||
adViewHeightInPx: Int,
|
|
||||||
timeout: Long,
|
|
||||||
callback: (isSuccess: Boolean) -> Unit,
|
|
||||||
) {
|
|
||||||
if (mBeiziAdImpl == null) {
|
|
||||||
callback.invoke(false)
|
|
||||||
} else {
|
|
||||||
mBeiziAdImpl?.requestSplashAd(startAdContainer, adsFl, adViewWidthInPx, adViewHeightInPx, timeout, callback)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示自有的开屏广告
|
* 显示自有的开屏广告
|
||||||
*/
|
*/
|
||||||
@ -481,6 +504,7 @@ object AdDelegateHelper {
|
|||||||
adViewHeightInDp: Float,
|
adViewHeightInDp: Float,
|
||||||
startAdContainer: ViewGroup,
|
startAdContainer: ViewGroup,
|
||||||
sdkStartAdContainer: ViewGroup,
|
sdkStartAdContainer: ViewGroup,
|
||||||
|
sdkJumpBtn: TextView,
|
||||||
adsViewGroup: FrameLayout,
|
adsViewGroup: FrameLayout,
|
||||||
handler: BaseActivity.BaseHandler,
|
handler: BaseActivity.BaseHandler,
|
||||||
isHotLaunch: Boolean,
|
isHotLaunch: Boolean,
|
||||||
@ -498,6 +522,7 @@ object AdDelegateHelper {
|
|||||||
adViewHeightInDp,
|
adViewHeightInDp,
|
||||||
startAdContainer,
|
startAdContainer,
|
||||||
sdkStartAdContainer,
|
sdkStartAdContainer,
|
||||||
|
sdkJumpBtn,
|
||||||
adsViewGroup,
|
adsViewGroup,
|
||||||
handler,
|
handler,
|
||||||
isHotLaunch,
|
isHotLaunch,
|
||||||
@ -550,12 +575,15 @@ object AdDelegateHelper {
|
|||||||
handler: BaseActivity.BaseHandler,
|
handler: BaseActivity.BaseHandler,
|
||||||
hideCallback: () -> Unit
|
hideCallback: () -> Unit
|
||||||
) {
|
) {
|
||||||
val jumpBtn: View = startAdContainer.findViewById(R.id.jumpBtn)
|
val jumpBtn = startAdContainer.findViewById<TextView>(R.id.jumpBtn)
|
||||||
val jumpDetailBtn: TextView = startAdContainer.findViewById(R.id.jumpDetailBtn)
|
val jumpDetailBtn: TextView = startAdContainer.findViewById(R.id.jumpDetailBtn)
|
||||||
val adImage: SimpleDraweeView = startAdContainer.findViewById(R.id.adImage)
|
val adImage: SimpleDraweeView = startAdContainer.findViewById(R.id.adImage)
|
||||||
|
val adVideo = startAdContainer.findViewById<SplashAdVideoView>(R.id.ad_video)
|
||||||
val icpContainer: View? = startAdContainer.findViewById(R.id.startAdIcpContainer)
|
val icpContainer: View? = startAdContainer.findViewById(R.id.startAdIcpContainer)
|
||||||
startAdContainer.visibility = View.VISIBLE
|
startAdContainer.visibility = View.VISIBLE
|
||||||
icpContainer?.visibility = View.VISIBLE
|
icpContainer?.visibility = View.VISIBLE
|
||||||
|
jumpBtn.text = startAdContainer.context.getString(R.string.splash_jump, splashAdDisplayInterval)
|
||||||
|
|
||||||
jumpDetailBtn.text = ad.desc
|
jumpDetailBtn.text = ad.desc
|
||||||
jumpDetailBtn.setDrawableEnd(
|
jumpDetailBtn.setDrawableEnd(
|
||||||
AppCompatResources.getDrawable(
|
AppCompatResources.getDrawable(
|
||||||
@ -563,7 +591,16 @@ object AdDelegateHelper {
|
|||||||
R.drawable.ic_startup_ad_arrow
|
R.drawable.ic_startup_ad_arrow
|
||||||
), null, null
|
), null, null
|
||||||
)
|
)
|
||||||
|
|
||||||
|
adImage.visibleIf(true)
|
||||||
ImageUtils.display(adImage, ad.img)
|
ImageUtils.display(adImage, ad.img)
|
||||||
|
|
||||||
|
if (ad.isImageType) {
|
||||||
|
adVideo.visibleIf(false)
|
||||||
|
} else {
|
||||||
|
adVideo.visibleIf(true)
|
||||||
|
adVideo.startPlay(ad.video.url)
|
||||||
|
}
|
||||||
startAdContainer.setOnClickListener {
|
startAdContainer.setOnClickListener {
|
||||||
// 拦截点击事件传递
|
// 拦截点击事件传递
|
||||||
}
|
}
|
||||||
@ -633,9 +670,11 @@ object AdDelegateHelper {
|
|||||||
slotId: String,
|
slotId: String,
|
||||||
adContainerView: ViewGroup,
|
adContainerView: ViewGroup,
|
||||||
expressViewWidth: Float,
|
expressViewWidth: Float,
|
||||||
|
onAdShowAction: () -> Unit,
|
||||||
|
onAdClickAction: () -> Unit,
|
||||||
callback: (isSuccess: Boolean) -> Unit,
|
callback: (isSuccess: Boolean) -> Unit,
|
||||||
) {
|
) {
|
||||||
mCsjAdImpl?.requestFlowAd(fragment, adContainerView, slotId, expressViewWidth, callback)
|
mCsjAdImpl?.requestFlowAd(fragment, adContainerView, slotId, expressViewWidth, onAdShowAction, onAdClickAction, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -646,6 +685,8 @@ object AdDelegateHelper {
|
|||||||
containerView: ViewGroup,
|
containerView: ViewGroup,
|
||||||
ad: AdConfig.ThirdPartyAd,
|
ad: AdConfig.ThirdPartyAd,
|
||||||
expressViewWidthInDp: Float,
|
expressViewWidthInDp: Float,
|
||||||
|
onAdShowAction: () -> Unit,
|
||||||
|
onAdClickAction: () -> Unit,
|
||||||
callback: (isSuccess: Boolean) -> Unit
|
callback: (isSuccess: Boolean) -> Unit
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@ -668,6 +709,28 @@ object AdDelegateHelper {
|
|||||||
slotId,
|
slotId,
|
||||||
expressViewWidthInDp,
|
expressViewWidthInDp,
|
||||||
expressViewHeightInDp,
|
expressViewHeightInDp,
|
||||||
|
onAdShowAction,
|
||||||
|
onAdClickAction,
|
||||||
|
callback
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取第三方 全屏/插屏 广告
|
||||||
|
*/
|
||||||
|
fun requestFullScreenAd(
|
||||||
|
fragment: Fragment,
|
||||||
|
ad: AdConfig.ThirdPartyAd,
|
||||||
|
onAdShowAction: () -> Unit,
|
||||||
|
onAdClickAction: () -> Unit,
|
||||||
|
callback: (isSuccess: Boolean) -> Unit
|
||||||
|
) {
|
||||||
|
val slotId = ad.slotId
|
||||||
|
mCsjAdImpl?.requestFullScreenAd(
|
||||||
|
fragment,
|
||||||
|
slotId,
|
||||||
|
onAdShowAction,
|
||||||
|
onAdClickAction,
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -676,7 +739,6 @@ object AdDelegateHelper {
|
|||||||
* 取消开屏广告
|
* 取消开屏广告
|
||||||
*/
|
*/
|
||||||
fun cancelSplashAd(context: Context) {
|
fun cancelSplashAd(context: Context) {
|
||||||
mBeiziAdImpl?.cancelSplashAd(context)
|
|
||||||
mCsjAdImpl?.cancelSplashAd(context)
|
mCsjAdImpl?.cancelSplashAd(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
149
app/src/main/java/com/gh/ad/AdPluginDownloadHelper.kt
Normal file
149
app/src/main/java/com/gh/ad/AdPluginDownloadHelper.kt
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
package com.gh.ad
|
||||||
|
|
||||||
|
import com.gh.download.simple.DownloadMessageHandler
|
||||||
|
import com.gh.download.simple.SimpleDownloadDatabase
|
||||||
|
import com.gh.download.simple.SimpleDownloadManager
|
||||||
|
import com.gh.gamecenter.core.runOnIoThread
|
||||||
|
import com.gh.gamecenter.core.utils.PluginRedirectHelper
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
|
import com.lg.download.DownloadError
|
||||||
|
import com.lg.download.DownloadStatus
|
||||||
|
import com.lg.download.httpclient.DefaultHttpClient
|
||||||
|
import com.lg.download.listener.InnerDownloadListener
|
||||||
|
import com.lg.ndownload.DownloadConfig
|
||||||
|
import com.lg.ndownload.DownloadConfigBuilder
|
||||||
|
import com.lg.ndownload.DownloadIoExecutor
|
||||||
|
import com.lightgame.utils.Utils
|
||||||
|
import java.lang.Exception
|
||||||
|
import java.net.URLConnection
|
||||||
|
|
||||||
|
object AdPluginDownloadHelper : InnerDownloadListener {
|
||||||
|
|
||||||
|
private const val CSJ_FILE_NAME = "2011394667"
|
||||||
|
private const val GDT_FILE_NAME = "gdt_plugin/gdtadv2.jar"
|
||||||
|
|
||||||
|
private const val CSJ_PLUGIN_URL = "https://and-static.ghzs66.com/android/static/2011394667"
|
||||||
|
private const val GDT_PLUGIN_URL = "https://and-static.ghzs66.com/android/static/gdtadv2.jar"
|
||||||
|
|
||||||
|
private var csjDownloadedCallback: (() -> Unit)? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已经下载了广告插件
|
||||||
|
*/
|
||||||
|
fun isCsjPluginDownloaded(): Boolean {
|
||||||
|
return SPUtils.getBoolean(CSJ_FILE_NAME, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载广告插件并初始化 (初始化限定穿山甲)
|
||||||
|
*/
|
||||||
|
fun downloadPluginIfNeeded(isCsj: Boolean = false, isGdt: Boolean = false, csjCallback: (() -> Unit)? = null) {
|
||||||
|
val isCsjPluginDownloaded = SPUtils.getBoolean(CSJ_FILE_NAME, false)
|
||||||
|
val isGdtPluginDownloaded = SPUtils.getBoolean(GDT_FILE_NAME, false)
|
||||||
|
|
||||||
|
if (isCsj && isCsjPluginDownloaded) {
|
||||||
|
csjCallback?.invoke()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isGdt && isGdtPluginDownloaded) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
runOnIoThread {
|
||||||
|
csjDownloadedCallback = csjCallback
|
||||||
|
|
||||||
|
DownloadMessageHandler.init(SimpleDownloadDatabase.instance.downloadDao())
|
||||||
|
|
||||||
|
if (!isCsjPluginDownloaded && isCsj) {
|
||||||
|
val csjPluginConfig = DownloadConfigBuilder()
|
||||||
|
.setUniqueId(CSJ_FILE_NAME)
|
||||||
|
.setUrl(CSJ_PLUGIN_URL)
|
||||||
|
.setFileName(CSJ_FILE_NAME)
|
||||||
|
.setHttpClient(DefaultHttpClient())
|
||||||
|
.setDownloadThreadSize(2)
|
||||||
|
.setPathToStore(PluginRedirectHelper.getAssetDir())
|
||||||
|
.setDownloadExecutor(DownloadIoExecutor.getInstance())
|
||||||
|
.setDownloadListener(this).build()
|
||||||
|
|
||||||
|
SimpleDownloadManager.download(csjPluginConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isGdtPluginDownloaded && isGdt) {
|
||||||
|
val gdtPluginConfig = DownloadConfigBuilder()
|
||||||
|
.setUniqueId(GDT_FILE_NAME)
|
||||||
|
.setUrl(GDT_PLUGIN_URL)
|
||||||
|
.setFileName(GDT_FILE_NAME)
|
||||||
|
.setHttpClient(DefaultHttpClient())
|
||||||
|
.setDownloadThreadSize(2)
|
||||||
|
.setPathToStore(PluginRedirectHelper.getAssetDir())
|
||||||
|
.setDownloadExecutor(DownloadIoExecutor.getInstance())
|
||||||
|
.setDownloadListener(this).build()
|
||||||
|
|
||||||
|
SimpleDownloadManager.download(gdtPluginConfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(id: String?, error: DownloadError?, exception: Exception?) {
|
||||||
|
Utils.log("下载广告插件失败 $id")
|
||||||
|
id?.let {
|
||||||
|
if (it == CSJ_FILE_NAME) {
|
||||||
|
csjDownloadedCallback = null
|
||||||
|
}
|
||||||
|
SimpleDownloadManager.cancel(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProgress(id: String?, progress: Float) {
|
||||||
|
Utils.log("下载广告插件进度 $id $progress")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProgressWithoutThrottle(id: String?, progress: Float) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSizeReceived(id: String?, fileSize: Long) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onReadyToDownload(id: String?, actualThreadSize: Int) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStatusChanged(id: String?, status: DownloadStatus?) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDownloadComplete(id: String?, elapsedTime: Long) {
|
||||||
|
id?.let {
|
||||||
|
// id 即为插件名
|
||||||
|
SPUtils.setBoolean(it, true)
|
||||||
|
if (it == CSJ_FILE_NAME) {
|
||||||
|
csjDownloadedCallback?.invoke()
|
||||||
|
csjDownloadedCallback = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSpeedChanged(id: String?, speed: Float) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRedirectingUrl(
|
||||||
|
id: String?,
|
||||||
|
connection: URLConnection?,
|
||||||
|
config: DownloadConfig?
|
||||||
|
) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRedirectedUrl(
|
||||||
|
id: String?,
|
||||||
|
connection: URLConnection?,
|
||||||
|
redirectedUrl: String?
|
||||||
|
) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
107
app/src/main/java/com/gh/ad/LaunchAdImpl.kt
Normal file
107
app/src/main/java/com/gh/ad/LaunchAdImpl.kt
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
package com.gh.ad
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.ViewStub
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
|
import com.gh.gamecenter.common.provider.ILaunchAd
|
||||||
|
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||||
|
import com.gh.gamecenter.common.utils.goneIf
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
|
import com.gh.gamecenter.entity.AdConfig
|
||||||
|
|
||||||
|
@Route(path = RouteConsts.provider.vaAd, name = "畅玩启动页广告")
|
||||||
|
class LaunchAdImpl : ILaunchAd {
|
||||||
|
override fun init(context: Context?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun requestAd(fragment: Fragment, container: ViewGroup, maskView: View, topViewStub: ViewStub, bottomViewStub: ViewStub, adClickAction: () -> Unit): View {
|
||||||
|
if (AdDelegateHelper.shouldShowHelperLaunchAd()) {
|
||||||
|
val launchAd = AdDelegateHelper.vGameLaunchAd
|
||||||
|
val showThirdPartyAd = launchAd?.displayRule?.adSource == AdDelegateHelper.AD_TYPE_SDK
|
||||||
|
val thirdPartyAd = launchAd?.thirdPartyAd
|
||||||
|
if (showThirdPartyAd && thirdPartyAd != null) {
|
||||||
|
val onAdShowAction = {
|
||||||
|
SensorsBridge.trackEvent("ThirdPartyAdShow",
|
||||||
|
"ad_source", thirdPartyAd.sourceName,
|
||||||
|
"ad_id", thirdPartyAd.slotId,
|
||||||
|
"ad_format", launchAd.typeChinese,
|
||||||
|
"ad_placement", AD_PLACEMENT,
|
||||||
|
"ad_space_id", launchAd.id,
|
||||||
|
"ad_space_name", launchAd.name
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val onAdClickAction = {
|
||||||
|
SensorsBridge.trackEvent("ThirdPartyAdClick",
|
||||||
|
"ad_source", thirdPartyAd.sourceName,
|
||||||
|
"ad_id", thirdPartyAd.slotId,
|
||||||
|
"ad_format", launchAd.typeChinese,
|
||||||
|
"ad_placement", AD_PLACEMENT,
|
||||||
|
"ad_space_id", launchAd.id,
|
||||||
|
"ad_space_name", launchAd.name
|
||||||
|
)
|
||||||
|
adClickAction.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (launchAd.type == AdConfig.TYPE_BANNER) {
|
||||||
|
requestBannerAd(fragment, container, maskView, thirdPartyAd, onAdShowAction, onAdClickAction)
|
||||||
|
return topViewStub.inflate()
|
||||||
|
} else if (launchAd.type == AdConfig.TYPE_INTERSTITIAL) {
|
||||||
|
requestFullScreenAd(fragment, thirdPartyAd, onAdShowAction, onAdClickAction)
|
||||||
|
return bottomViewStub.inflate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bottomViewStub.inflate()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun requestBannerAd(
|
||||||
|
fragment: Fragment,
|
||||||
|
container: ViewGroup,
|
||||||
|
maskView: View,
|
||||||
|
thirdPartyAd: AdConfig.ThirdPartyAd,
|
||||||
|
onAdShowAction: () -> Unit,
|
||||||
|
onAdClickAction: () -> Unit,
|
||||||
|
) {
|
||||||
|
AdDelegateHelper.requestThirdPartyBannerAd(
|
||||||
|
fragment,
|
||||||
|
container,
|
||||||
|
thirdPartyAd,
|
||||||
|
DisplayUtils.getScreenWidthInDp(fragment.requireActivity()),
|
||||||
|
onAdShowAction,
|
||||||
|
onAdClickAction
|
||||||
|
) { isSuccess ->
|
||||||
|
maskView.goneIf(!isSuccess)
|
||||||
|
if (isSuccess) {
|
||||||
|
SPUtils.setLong(Constants.SP_LAST_HELPER_LAUNCH_AD_SHOW_TIME, System.currentTimeMillis())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun requestFullScreenAd(
|
||||||
|
fragment: Fragment,
|
||||||
|
thirdPartyAd: AdConfig.ThirdPartyAd,
|
||||||
|
onAdShowAction: () -> Unit,
|
||||||
|
onAdClickAction: () -> Unit
|
||||||
|
) {
|
||||||
|
AdDelegateHelper.requestFullScreenAd(
|
||||||
|
fragment,
|
||||||
|
thirdPartyAd,
|
||||||
|
onAdShowAction,
|
||||||
|
onAdClickAction
|
||||||
|
) { isSuccess ->
|
||||||
|
if (isSuccess) {
|
||||||
|
SPUtils.setLong(Constants.SP_LAST_HELPER_LAUNCH_AD_SHOW_TIME, System.currentTimeMillis())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val AD_PLACEMENT = "畅玩启动"
|
||||||
|
}
|
||||||
|
}
|
||||||
78
app/src/main/java/com/gh/ad/SplashAdVideoView.kt
Normal file
78
app/src/main/java/com/gh/ad/SplashAdVideoView.kt
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
package com.gh.ad
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.WindowManager
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.video.detail.CustomManager
|
||||||
|
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||||
|
import com.shuyu.gsyvideoplayer.utils.GSYVideoType.SCREEN_TYPE_FULL
|
||||||
|
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||||
|
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||||
|
|
||||||
|
class SplashAdVideoView @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null
|
||||||
|
) :
|
||||||
|
StandardGSYVideoPlayer(context, attrs) {
|
||||||
|
|
||||||
|
fun startPlay(url: String) {
|
||||||
|
GSYVideoType.setShowType(SCREEN_TYPE_FULL)
|
||||||
|
GSYVideoType.setRenderType(GSYVideoType.SUFRACE)
|
||||||
|
CustomManager.getCustomManager(getKey()).isNeedMute = true
|
||||||
|
|
||||||
|
setUp(url, true, "")
|
||||||
|
|
||||||
|
setNeedAutoAdaptation(false)
|
||||||
|
startPlayLogic()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||||
|
CustomManager.getCustomManager(getKey()).initContext(context.applicationContext)
|
||||||
|
return CustomManager.getCustomManager(getKey())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getKey() = "splash_ad"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 覆盖父类方法,防止在是视频 Preparing 阶段封面图被隐藏,导致白屏
|
||||||
|
*/
|
||||||
|
override fun changeUiToPreparingShow() = Unit
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
return R.layout.layout_splash_ad_video
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAutoCompletion() {
|
||||||
|
setStateAndUi(CURRENT_STATE_AUTO_COMPLETE);
|
||||||
|
|
||||||
|
mSaveChangeViewTIme = 0
|
||||||
|
mCurrentPosition = 0
|
||||||
|
|
||||||
|
if (!mIfCurrentIsFullscreen) {
|
||||||
|
getGSYVideoManager().setLastListener(null)
|
||||||
|
}
|
||||||
|
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener);
|
||||||
|
if (mContext is Activity) {
|
||||||
|
try {
|
||||||
|
(mContext as Activity).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
releaseNetWorkState()
|
||||||
|
|
||||||
|
if (mVideoAllCallBack != null && isCurrentMediaListener()) {
|
||||||
|
mVideoAllCallBack.onAutoComplete(mOriginUrl, mTitle, this)
|
||||||
|
}
|
||||||
|
mHadPlay = false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun clearAll() {
|
||||||
|
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_DEFAULT)
|
||||||
|
GSYVideoType.setRenderType(GSYVideoType.TEXTURE)
|
||||||
|
release()
|
||||||
|
CustomManager.removeManager(getKey())
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -21,6 +21,8 @@ import com.gh.common.view.RichEditor
|
|||||||
import com.gh.gamecenter.CropImageActivity
|
import com.gh.gamecenter.CropImageActivity
|
||||||
import com.gh.gamecenter.R
|
import com.gh.gamecenter.R
|
||||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||||
|
import com.gh.gamecenter.common.entity.LocalVideoEntity
|
||||||
|
import com.gh.gamecenter.feature.selector.LocalMediaActivity
|
||||||
import com.gh.gamecenter.common.utils.*
|
import com.gh.gamecenter.common.utils.*
|
||||||
import com.gh.gamecenter.core.AppExecutor
|
import com.gh.gamecenter.core.AppExecutor
|
||||||
import com.gh.gamecenter.core.runOnIoThread
|
import com.gh.gamecenter.core.runOnIoThread
|
||||||
@ -30,6 +32,7 @@ import com.gh.gamecenter.feature.entity.GameEntity
|
|||||||
import com.gh.gamecenter.qa.editor.*
|
import com.gh.gamecenter.qa.editor.*
|
||||||
import com.gh.gamecenter.feature.entity.AnswerEntity
|
import com.gh.gamecenter.feature.entity.AnswerEntity
|
||||||
import com.gh.gamecenter.feature.entity.ArticleEntity
|
import com.gh.gamecenter.feature.entity.ArticleEntity
|
||||||
|
import com.gh.gamecenter.feature.selector.ChooseType
|
||||||
import com.gh.gamecenter.qa.entity.EditorInsertEntity
|
import com.gh.gamecenter.qa.entity.EditorInsertEntity
|
||||||
import com.gh.gamecenter.video.poster.PosterEditActivity
|
import com.gh.gamecenter.video.poster.PosterEditActivity
|
||||||
import com.gh.gamecenter.video.upload.UploadManager
|
import com.gh.gamecenter.video.upload.UploadManager
|
||||||
@ -233,7 +236,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
|
|||||||
mKeyboardHeightProvider = KeyboardHeightProvider(this)
|
mKeyboardHeightProvider = KeyboardHeightProvider(this)
|
||||||
mRichEditor.post { mKeyboardHeightProvider?.start() }
|
mRichEditor.post { mKeyboardHeightProvider?.start() }
|
||||||
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
|
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
|
||||||
mRichEditor.setEditorBackgroundColor(R.color.ui_surface.toColor(this))
|
mRichEditor.setEditorBackgroundColor(com.gh.gamecenter.common.R.color.ui_surface.toColor(this))
|
||||||
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
|
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
|
||||||
// 防止个别手机在Js里无法获取粘贴内容
|
// 防止个别手机在Js里无法获取粘贴内容
|
||||||
mRichEditor.addJavascriptInterface(OnPasteListener(), "onPasteListener")
|
mRichEditor.addJavascriptInterface(OnPasteListener(), "onPasteListener")
|
||||||
@ -502,7 +505,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
|
|||||||
startActivityForResult(
|
startActivityForResult(
|
||||||
LocalMediaActivity.getIntent(
|
LocalMediaActivity.getIntent(
|
||||||
this@BaseRichEditorActivity,
|
this@BaseRichEditorActivity,
|
||||||
LocalMediaActivity.ChooseType.VIDEO,
|
ChooseType.VIDEO,
|
||||||
maxChooseCount,
|
maxChooseCount,
|
||||||
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
|
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
|
||||||
), INSERT_MEDIA_VIDEO_CODE
|
), INSERT_MEDIA_VIDEO_CODE
|
||||||
@ -531,7 +534,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
|
|||||||
val maxChooseCount = if (imageCount + 10 <= MAX_IMAGE_COUNT) 10 else MAX_IMAGE_COUNT - imageCount
|
val maxChooseCount = if (imageCount + 10 <= MAX_IMAGE_COUNT) 10 else MAX_IMAGE_COUNT - imageCount
|
||||||
val intent = LocalMediaActivity.getIntent(
|
val intent = LocalMediaActivity.getIntent(
|
||||||
this@BaseRichEditorActivity,
|
this@BaseRichEditorActivity,
|
||||||
LocalMediaActivity.ChooseType.IMAGE,
|
ChooseType.IMAGE,
|
||||||
maxChooseCount,
|
maxChooseCount,
|
||||||
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
|
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
|
||||||
)
|
)
|
||||||
@ -797,9 +800,9 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
|
|||||||
|
|
||||||
override fun onDarkModeChanged() {
|
override fun onDarkModeChanged() {
|
||||||
super.onDarkModeChanged()
|
super.onDarkModeChanged()
|
||||||
updateStatusBarColor(R.color.ui_surface, R.color.ui_surface)
|
updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
|
||||||
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
|
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
|
||||||
mRichEditor.setEditorBackgroundColor(R.color.ui_surface.toColor(this))
|
mRichEditor.setEditorBackgroundColor(com.gh.gamecenter.common.R.color.ui_surface.toColor(this))
|
||||||
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
|
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import android.text.TextUtils
|
|||||||
import androidx.lifecycle.AndroidViewModel
|
import androidx.lifecycle.AndroidViewModel
|
||||||
import androidx.lifecycle.MediatorLiveData
|
import androidx.lifecycle.MediatorLiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
|
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
|
||||||
import com.gh.gamecenter.common.entity.ErrorEntity
|
import com.gh.gamecenter.common.entity.ErrorEntity
|
||||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||||
@ -20,7 +19,7 @@ import com.gh.gamecenter.core.runOnUiThread
|
|||||||
import com.gh.gamecenter.core.utils.MD5Utils
|
import com.gh.gamecenter.core.utils.MD5Utils
|
||||||
import com.gh.gamecenter.core.utils.ToastUtils
|
import com.gh.gamecenter.core.utils.ToastUtils
|
||||||
import com.gh.gamecenter.entity.ForumDetailEntity
|
import com.gh.gamecenter.entity.ForumDetailEntity
|
||||||
import com.gh.gamecenter.entity.LocalVideoEntity
|
import com.gh.gamecenter.common.entity.LocalVideoEntity
|
||||||
import com.gh.gamecenter.entity.QuoteCountEntity
|
import com.gh.gamecenter.entity.QuoteCountEntity
|
||||||
import com.gh.gamecenter.qa.BbsType
|
import com.gh.gamecenter.qa.BbsType
|
||||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||||
@ -39,8 +38,6 @@ import retrofit2.HttpException
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
import kotlin.collections.HashMap
|
|
||||||
import kotlin.collections.LinkedHashMap
|
import kotlin.collections.LinkedHashMap
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
|
|
||||||
@ -86,7 +83,7 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
|
|||||||
val application: Application = getApplication()
|
val application: Application = getApplication()
|
||||||
Utils.toast(
|
Utils.toast(
|
||||||
getApplication(),
|
getApplication(),
|
||||||
application.getString(R.string.pic_max_hint, count)
|
application.getString(com.gh.gamecenter.common.R.string.pic_max_hint, count)
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,15 +16,18 @@ import com.gh.gamecenter.SplashScreenActivity
|
|||||||
import com.gh.gamecenter.authorization.AuthorizationActivity
|
import com.gh.gamecenter.authorization.AuthorizationActivity
|
||||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||||
import com.gh.gamecenter.common.constant.RouteConsts
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
|
import com.gh.gamecenter.common.provider.IHelpAndFeedbackProvider
|
||||||
import com.gh.gamecenter.common.utils.PackageFlavorHelper
|
import com.gh.gamecenter.common.utils.PackageFlavorHelper
|
||||||
import com.gh.gamecenter.core.provider.IPushProvider
|
import com.gh.gamecenter.core.provider.IPushProvider
|
||||||
|
import com.gh.gamecenter.login.view.LoginActivity
|
||||||
|
import com.gh.gamecenter.va.VCore
|
||||||
|
import com.gh.gamecenter.login.utils.QuickLoginHelper
|
||||||
import com.gh.vspace.VHelper
|
import com.gh.vspace.VHelper
|
||||||
import com.halo.assistant.HaloApp
|
import com.halo.assistant.HaloApp
|
||||||
|
|
||||||
// TODO:移动到对应的模块
|
// TODO:移动到对应的模块
|
||||||
class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
||||||
private var isFromBackgroundToForeground = false // 是否后台回到前台
|
private var isFromBackgroundToForeground = false // 是否后台回到前台
|
||||||
private var activityCount = 0
|
|
||||||
|
|
||||||
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
|
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
|
||||||
// do nothing
|
// do nothing
|
||||||
@ -32,19 +35,31 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
|||||||
|
|
||||||
override fun onActivityStarted(activity: Activity) {
|
override fun onActivityStarted(activity: Activity) {
|
||||||
GlobalActivityManager.currentActivity = activity
|
GlobalActivityManager.currentActivity = activity
|
||||||
activityCount ++
|
GlobalActivityManager.activityCount ++
|
||||||
if (activityCount == 1 && isFromBackgroundToForeground) {
|
if (GlobalActivityManager.activityCount == 1 && isFromBackgroundToForeground) {
|
||||||
if (AdDelegateHelper.shouldShowStartUpAd(true)
|
if (AdDelegateHelper.shouldShowStartUpAd(true)
|
||||||
&& !HaloApp.getInstance().isSkippingThirdParty
|
&& !HaloApp.getInstance().isDisableSplashAdTemporarily
|
||||||
&& activity !is SplashScreenActivity
|
&& activity !is SplashScreenActivity
|
||||||
&& activity !is SkipActivity
|
&& activity !is SkipActivity
|
||||||
&& activity !is AuthorizationActivity
|
&& activity !is AuthorizationActivity
|
||||||
&& activity !is SplashAdActivity
|
&& activity !is SplashAdActivity
|
||||||
|
&& !isSuggestionActivity(activity)
|
||||||
) {
|
) {
|
||||||
activity.startActivity(SplashAdActivity.getIntent(activity))
|
activity.startActivity(SplashAdActivity.getIntent(activity))
|
||||||
}
|
}
|
||||||
isFromBackgroundToForeground = false
|
isFromBackgroundToForeground = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GlobalActivityManager.activityCount == 1) {
|
||||||
|
// 清除桌面角标
|
||||||
|
if (activity !is SplashScreenActivity && activity !is AuthorizationActivity) {
|
||||||
|
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
||||||
|
pushProvider?.cleanBadgeNumber(activity.applicationContext)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (QuickLoginHelper.isLoginAuthPage(activity)) {
|
||||||
|
QuickLoginHelper.addCustomViewToLoginAuthPage(activity)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResumed(activity: Activity) {
|
override fun onActivityResumed(activity: Activity) {
|
||||||
@ -76,6 +91,8 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (activity is AppCompatActivity
|
if (activity is AppCompatActivity
|
||||||
|
&& !VCore.getInstance().isLaunchActivity(activity)
|
||||||
|
&& activity !is LoginActivity
|
||||||
&& activity !is SplashScreenActivity
|
&& activity !is SplashScreenActivity
|
||||||
&& activity !is SkipActivity
|
&& activity !is SkipActivity
|
||||||
&& activity !is AuthorizationActivity
|
&& activity !is AuthorizationActivity
|
||||||
@ -84,10 +101,6 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XapkInstaller.updateCurrentInstallStatus()
|
XapkInstaller.updateCurrentInstallStatus()
|
||||||
|
|
||||||
// 清除桌面角标
|
|
||||||
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
|
||||||
pushProvider?.cleanBadgeNumber(activity.applicationContext)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityPaused(activity: Activity) {
|
override fun onActivityPaused(activity: Activity) {
|
||||||
@ -98,8 +111,8 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityStopped(activity: Activity) {
|
override fun onActivityStopped(activity: Activity) {
|
||||||
activityCount --
|
GlobalActivityManager.activityCount --
|
||||||
isFromBackgroundToForeground = activityCount <= 0
|
isFromBackgroundToForeground = GlobalActivityManager.activityCount <= 0
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
|
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
|
||||||
@ -107,7 +120,16 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityDestroyed(activity: Activity) {
|
override fun onActivityDestroyed(activity: Activity) {
|
||||||
// do nothing
|
if (QuickLoginHelper.isLoginAuthPage(activity)) {
|
||||||
|
QuickLoginHelper.release()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isSuggestionActivity(activity: Activity): Boolean {
|
||||||
|
val helpAndFeedbackProvider =
|
||||||
|
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback)
|
||||||
|
.navigation() as? IHelpAndFeedbackProvider
|
||||||
|
return helpAndFeedbackProvider?.isSuggestionActivity(activity) ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -32,9 +32,13 @@ import com.gh.gamecenter.common.utils.*
|
|||||||
import com.gh.gamecenter.common.utils.NewFlatLogUtils
|
import com.gh.gamecenter.common.utils.NewFlatLogUtils
|
||||||
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
|
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
|
||||||
import com.gh.gamecenter.core.AppExecutor
|
import com.gh.gamecenter.core.AppExecutor
|
||||||
|
import com.gh.gamecenter.core.provider.IPushProvider
|
||||||
import com.gh.gamecenter.core.runOnIoThread
|
import com.gh.gamecenter.core.runOnIoThread
|
||||||
import com.gh.gamecenter.core.runOnUiThread
|
import com.gh.gamecenter.core.runOnUiThread
|
||||||
import com.gh.gamecenter.core.utils.*
|
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
|
import com.gh.gamecenter.core.utils.ToastUtils
|
||||||
import com.gh.gamecenter.entity.SensorsEvent
|
import com.gh.gamecenter.entity.SensorsEvent
|
||||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||||
import com.gh.gamecenter.eventbus.EBPackage
|
import com.gh.gamecenter.eventbus.EBPackage
|
||||||
@ -45,6 +49,7 @@ import com.gh.gamecenter.login.user.LoginTag
|
|||||||
import com.gh.gamecenter.login.user.UserManager
|
import com.gh.gamecenter.login.user.UserManager
|
||||||
import com.gh.gamecenter.login.user.UserRepository
|
import com.gh.gamecenter.login.user.UserRepository
|
||||||
import com.gh.gamecenter.login.utils.LoginHelper
|
import com.gh.gamecenter.login.utils.LoginHelper
|
||||||
|
import com.gh.gamecenter.login.utils.QuickLoginHelper
|
||||||
import com.gh.gamecenter.login.view.LoginActivity
|
import com.gh.gamecenter.login.view.LoginActivity
|
||||||
import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
|
import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
|
||||||
import com.gh.gamecenter.setting.SettingBridge
|
import com.gh.gamecenter.setting.SettingBridge
|
||||||
@ -69,7 +74,7 @@ class DefaultJsApi(
|
|||||||
private var mFragment: Fragment? = null,
|
private var mFragment: Fragment? = null,
|
||||||
private var mBbsId: String? = "",
|
private var mBbsId: String? = "",
|
||||||
private var mOriginUrl: String? = "",
|
private var mOriginUrl: String? = "",
|
||||||
private val mForumName: String? = ""
|
private val mForumName: String? = "",
|
||||||
) {
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@ -89,6 +94,11 @@ class DefaultJsApi(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
fun isEnableForceDark(msg: Any): Boolean {
|
||||||
|
return DarkModeUtils.isWebViewForceDarkEnabled
|
||||||
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun isGhzs(msg: Any): String {
|
fun isGhzs(msg: Any): String {
|
||||||
return "true"
|
return "true"
|
||||||
@ -129,12 +139,12 @@ class DefaultJsApi(
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun login(msg: Any) {
|
fun login(msg: Any) {
|
||||||
// if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
|
if (NetworkUtils.isQuickLoginEnabled(context)) {
|
||||||
// QuickLoginHelper.startLogin(context, "浏览器")
|
QuickLoginHelper.startLogin(context, "浏览器")
|
||||||
// } else {
|
} else {
|
||||||
val intent = LoginActivity.getIntent(context, "浏览器")
|
val intent = LoginActivity.getIntent(context, "浏览器")
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
@ -219,7 +229,7 @@ class DefaultJsApi(
|
|||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
// 若畅玩列表中安装了,优先启动畅玩游戏
|
// 若畅玩列表中安装了,优先启动畅玩游戏
|
||||||
if (VHelper.isInstalled(packageName)) {
|
if (VHelper.isInstalled(packageName)) {
|
||||||
if (!VHelper.showDialogIfVSpaceIsNeeded(context, "", "", "", "")) {
|
VHelper.validateVSpaceBeforeAction(context, packageName, null) {
|
||||||
VHelper.launch(context, packageName)
|
VHelper.launch(context, packageName)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -246,7 +256,7 @@ class DefaultJsApi(
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun isInstalled(event: Any): String {
|
fun isInstalled(event: Any): String {
|
||||||
val localInstalledPackageList = PackageUtils.getAllPackageName(HaloApp.getInstance().application)
|
val localInstalledPackageList = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
|
||||||
val packageNameList: ArrayList<String> = event.toString().toObject() ?: ArrayList()
|
val packageNameList: ArrayList<String> = event.toString().toObject() ?: ArrayList()
|
||||||
|
|
||||||
for (packageName in packageNameList) {
|
for (packageName in packageNameList) {
|
||||||
@ -333,6 +343,12 @@ class DefaultJsApi(
|
|||||||
return HaloApp.getInstance().oaid
|
return HaloApp.getInstance().oaid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
fun getPushId(): String {
|
||||||
|
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
||||||
|
return pushProvider?.getRegistrationId(HaloApp.getInstance()) ?: "unknown"
|
||||||
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun showIncompatibleVersionDialog(msg: Any) {
|
fun showIncompatibleVersionDialog(msg: Any) {
|
||||||
DialogHelper.showUpgradeDialog(context)
|
DialogHelper.showUpgradeDialog(context)
|
||||||
@ -539,7 +555,7 @@ class DefaultJsApi(
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun getInstallStatus(event: Any): String {
|
fun getInstallStatus(event: Any): String {
|
||||||
val localInstalledPackageList = PackageUtils.getAllPackageName(HaloApp.getInstance().application)
|
val localInstalledPackageList = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
|
||||||
val packageNameList: ArrayList<String> = event.toString().toObject() ?: ArrayList()
|
val packageNameList: ArrayList<String> = event.toString().toObject() ?: ArrayList()
|
||||||
val installStatusMap: HashMap<String, Boolean> = hashMapOf()
|
val installStatusMap: HashMap<String, Boolean> = hashMapOf()
|
||||||
|
|
||||||
|
|||||||
@ -268,10 +268,6 @@ object DefaultUrlHandler {
|
|||||||
directToGameVideo(context, id, entrance, "")
|
directToGameVideo(context, id, entrance, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
EntranceConsts.HOST_CATEGORY -> {
|
|
||||||
val title = uri.getQueryParameter("title")
|
|
||||||
DirectUtils.directCategoryDirectory(context, id, title ?: "", entrance, "")
|
|
||||||
}
|
|
||||||
EntranceConsts.HOST_COLUMN_COLLECTION -> {
|
EntranceConsts.HOST_COLUMN_COLLECTION -> {
|
||||||
val name = uri.getQueryParameter("name")
|
val name = uri.getQueryParameter("name")
|
||||||
DirectUtils.directToColumnCollection(context, id, -1, entrance, name ?: "")
|
DirectUtils.directToColumnCollection(context, id, -1, entrance, name ?: "")
|
||||||
@ -378,7 +374,7 @@ object DefaultUrlHandler {
|
|||||||
val iconSubscript = uri.getQueryParameter("game_icon_subscript") ?: ""
|
val iconSubscript = uri.getQueryParameter("game_icon_subscript") ?: ""
|
||||||
val gameEntity =
|
val gameEntity =
|
||||||
if (forumType == BbsType.OFFICIAL_BBS.value && gameId.isNotEmpty() && gameName.isNotEmpty() && icon.isNotEmpty()) {
|
if (forumType == BbsType.OFFICIAL_BBS.value && gameId.isNotEmpty() && gameName.isNotEmpty() && icon.isNotEmpty()) {
|
||||||
GameEntity(id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
|
GameEntity(_id = gameId, mName = gameName, mIcon = icon, mIconSubscript = iconSubscript)
|
||||||
} else null
|
} else null
|
||||||
val activityLabelEntity = if (activityId.isNotEmpty() && activityName.isNotEmpty()) {
|
val activityLabelEntity = if (activityId.isNotEmpty() && activityName.isNotEmpty()) {
|
||||||
ActivityLabelEntity(
|
ActivityLabelEntity(
|
||||||
|
|||||||
@ -6,8 +6,8 @@ class DownloadChainBuilder {
|
|||||||
|
|
||||||
private var processEndCallback: ((asVGame: Boolean, Any?) -> Unit)? = null
|
private var processEndCallback: ((asVGame: Boolean, Any?) -> Unit)? = null
|
||||||
|
|
||||||
fun setProcessEndCallback(callback: (asVGame: Boolean, Any?) -> Unit): DownloadChainBuilder {
|
fun setProcessEndCallback(gameId: String, callback: (asVGame: Boolean, Any?) -> Unit): DownloadChainBuilder {
|
||||||
processEndCallback = callback
|
processEndCallback = VaPluginDownloadWrapper(gameId = gameId, callback = callback) // 其他需要添加行为的装饰者可以一直包装A(B(C(callback))), 执行顺序 A->B->C->callback
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.gh.common.chain
|
||||||
|
|
||||||
|
import com.gh.vspace.VHelper
|
||||||
|
|
||||||
|
class VaPluginDownloadWrapper(val gameId: String, val callback: (Boolean, Any?) -> Unit) : (Boolean, Any?) -> Unit {
|
||||||
|
override fun invoke(asVGame: Boolean, any: Any?) {
|
||||||
|
callback.invoke(asVGame, any)
|
||||||
|
if (asVGame) {
|
||||||
|
VHelper.initVaPlugin(gameId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,7 +16,7 @@ class ValidateVSpaceHandler : DownloadChainHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (asVGame) {
|
if (asVGame) {
|
||||||
VHelper.validateVSpaceBeforeAction(context, gameEntity) {
|
VHelper.validateVSpaceBeforeAction(context,gameEntity.getUniquePackageName(), gameEntity) {
|
||||||
closure.invoke()
|
closure.invoke()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class VersionNumberHandler : DownloadChainHandler() {
|
|||||||
"温馨提示",
|
"温馨提示",
|
||||||
gameEntity.getVersionNumberString(),
|
gameEntity.getVersionNumberString(),
|
||||||
"继续下载",
|
"继续下载",
|
||||||
R.string.cancel.toResString(),
|
com.gh.gamecenter.common.R.string.cancel.toResString(),
|
||||||
{
|
{
|
||||||
confirmCallback.invoke()
|
confirmCallback.invoke()
|
||||||
SensorsBridge.trackGameDemoDialogClick(
|
SensorsBridge.trackGameDemoDialogClick(
|
||||||
@ -42,7 +42,7 @@ class VersionNumberHandler : DownloadChainHandler() {
|
|||||||
},
|
},
|
||||||
cancelClickCallback = {
|
cancelClickCallback = {
|
||||||
SensorsBridge.trackGameDemoDialogClick(
|
SensorsBridge.trackGameDemoDialogClick(
|
||||||
buttonName = R.string.cancel.toResString(),
|
buttonName = com.gh.gamecenter.common.R.string.cancel.toResString(),
|
||||||
gameId = gameEntity.id,
|
gameId = gameEntity.id,
|
||||||
gameName = gameEntity.name ?: "",
|
gameName = gameEntity.name ?: "",
|
||||||
gameType = gameEntity.categoryChinese
|
gameType = gameEntity.categoryChinese
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package com.gh.common.constant;
|
package com.gh.common.constant;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.gh.common.util.PackageHelper;
|
import com.gh.common.util.PackageHelper;
|
||||||
@ -14,21 +16,28 @@ import com.gh.gamecenter.BuildConfig;
|
|||||||
import com.gh.gamecenter.common.constant.CommonConsts;
|
import com.gh.gamecenter.common.constant.CommonConsts;
|
||||||
import com.gh.gamecenter.common.constant.Constants;
|
import com.gh.gamecenter.common.constant.Constants;
|
||||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||||
|
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||||
import com.gh.gamecenter.common.retrofit.BiResponse;
|
import com.gh.gamecenter.common.retrofit.BiResponse;
|
||||||
import com.gh.gamecenter.common.retrofit.Response;
|
import com.gh.gamecenter.common.retrofit.Response;
|
||||||
import com.gh.gamecenter.common.utils.DarkModeUtils;
|
import com.gh.gamecenter.common.utils.DarkModeUtils;
|
||||||
import com.gh.gamecenter.common.utils.EnvHelper;
|
import com.gh.gamecenter.common.utils.EnvHelper;
|
||||||
|
import com.gh.gamecenter.core.AppExecutor;
|
||||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||||
import com.gh.gamecenter.core.utils.SPUtils;
|
import com.gh.gamecenter.core.utils.SPUtils;
|
||||||
import com.gh.gamecenter.core.utils.UrlFilterUtils;
|
import com.gh.gamecenter.core.utils.UrlFilterUtils;
|
||||||
|
import com.gh.gamecenter.entity.AppEntity;
|
||||||
|
import com.gh.gamecenter.entity.FloatWindowSettingEntity;
|
||||||
import com.gh.gamecenter.entity.GameGuidePopupEntity;
|
import com.gh.gamecenter.entity.GameGuidePopupEntity;
|
||||||
import com.gh.gamecenter.entity.NewApiSettingsEntity;
|
import com.gh.gamecenter.entity.NewApiSettingsEntity;
|
||||||
import com.gh.gamecenter.entity.NewSettingsEntity;
|
import com.gh.gamecenter.entity.NewSettingsEntity;
|
||||||
|
import com.gh.gamecenter.entity.VNewSetting;
|
||||||
import com.gh.gamecenter.entity.VSetting;
|
import com.gh.gamecenter.entity.VSetting;
|
||||||
import com.gh.gamecenter.feature.entity.SettingsEntity;
|
import com.gh.gamecenter.feature.entity.SettingsEntity;
|
||||||
import com.gh.gamecenter.feature.entity.SimulatorEntity;
|
import com.gh.gamecenter.feature.entity.SimulatorEntity;
|
||||||
import com.gh.gamecenter.feature.utils.ContentBlockedHelper;
|
import com.gh.gamecenter.feature.utils.ContentBlockedHelper;
|
||||||
|
import com.gh.gamecenter.receiver.PackageChangeBroadcastReceiver;
|
||||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||||
|
import com.gh.gamecenter.retrofit.service.VApiService;
|
||||||
import com.gh.vspace.VHelper;
|
import com.gh.vspace.VHelper;
|
||||||
import com.halo.assistant.HaloApp;
|
import com.halo.assistant.HaloApp;
|
||||||
|
|
||||||
@ -39,8 +48,12 @@ import org.json.JSONObject;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.Single;
|
||||||
|
import io.reactivex.SingleSource;
|
||||||
|
import io.reactivex.functions.Function;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
import io.reactivex.subjects.BehaviorSubject;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
@ -50,6 +63,9 @@ public class Config {
|
|||||||
public static final String NEW_API_HOST = EnvHelper.getNewHost();
|
public static final String NEW_API_HOST = EnvHelper.getNewHost();
|
||||||
public static final String VAPI_HOST = EnvHelper.getVHost();
|
public static final String VAPI_HOST = EnvHelper.getVHost();
|
||||||
|
|
||||||
|
public static final String WGAME_CPM_BUSIAPPID = BuildConfig.WGAME_CPM_BUSIAPPID;
|
||||||
|
public static final String WGAME_CPM_API_HOST = EnvHelper.getWGameCPMHost();
|
||||||
|
|
||||||
// Third-Party confs
|
// Third-Party confs
|
||||||
public static final String WECHAT_APPID = BuildConfig.WECHAT_APPID;
|
public static final String WECHAT_APPID = BuildConfig.WECHAT_APPID;
|
||||||
public static final String WECHAT_SECRET = BuildConfig.WECHAT_SECRET;
|
public static final String WECHAT_SECRET = BuildConfig.WECHAT_SECRET;
|
||||||
@ -68,6 +84,12 @@ public class Config {
|
|||||||
private static NewApiSettingsEntity.NightMode mNightModeSetting;
|
private static NewApiSettingsEntity.NightMode mNightModeSetting;
|
||||||
private static SimulatorEntity mNewSimulatorEntity;
|
private static SimulatorEntity mNewSimulatorEntity;
|
||||||
private static VSetting mVSetting;
|
private static VSetting mVSetting;
|
||||||
|
private volatile static VNewSetting mVNewSetting;
|
||||||
|
|
||||||
|
private static FloatWindowSettingEntity mFloatWindowSetting;
|
||||||
|
|
||||||
|
private static AppEntity mNew32UpdateEntity;
|
||||||
|
private static BehaviorSubject<VNewSetting> vNewSettingSubject = BehaviorSubject.create();
|
||||||
private static GameGuidePopupEntity mGameGuidePopupEntity;
|
private static GameGuidePopupEntity mGameGuidePopupEntity;
|
||||||
private static SharedPreferences mDefaultSharedPreferences;
|
private static SharedPreferences mDefaultSharedPreferences;
|
||||||
|
|
||||||
@ -77,25 +99,11 @@ public class Config {
|
|||||||
return !SPUtils.getBoolean(Constants.SP_TEENAGER_MODE);
|
return !SPUtils.getBoolean(Constants.SP_TEENAGER_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* VPN 开关选项是否开启
|
|
||||||
*/
|
|
||||||
public static boolean isVpnOptionEnabled() {
|
|
||||||
if (mNewApiSettingsEntity == null
|
|
||||||
|| mNewApiSettingsEntity.getInstall() == null
|
|
||||||
|| mNewApiSettingsEntity.getInstall().getVpnRequired() == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mNewApiSettingsEntity.getInstall().getVpnRequired().getShouldShowVpnOption();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setSettings(SettingsEntity settingsEntity) {
|
public static void setSettings(SettingsEntity settingsEntity) {
|
||||||
getPreferences().edit().putString(SETTINGS_KEY, GsonUtils.toJson(settingsEntity)).apply();
|
getPreferences().edit().putString(SETTINGS_KEY, GsonUtils.toJson(settingsEntity)).apply();
|
||||||
mSettingsEntity = settingsEntity;
|
mSettingsEntity = settingsEntity;
|
||||||
|
|
||||||
// 加载完设置后刷新下
|
PackageHelper.refreshPackageNameList();
|
||||||
PackageHelper.initList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -196,6 +204,52 @@ public class Config {
|
|||||||
return mVSetting;
|
return mVSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static VNewSetting getVNewSettingEntity() {
|
||||||
|
if (mVNewSetting == null) {
|
||||||
|
try {
|
||||||
|
String json = SPUtils.getString(Constants.SP_V_NEW_SETTINGS);
|
||||||
|
if (!TextUtils.isEmpty(json)) {
|
||||||
|
mVNewSetting = GsonUtils.fromJson(json, VNewSetting.class);
|
||||||
|
vNewSettingSubject.onNext(mVNewSetting);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mVNewSetting;
|
||||||
|
}
|
||||||
|
@Nullable
|
||||||
|
public static FloatWindowSettingEntity getFloatWindowSettingEntity() {
|
||||||
|
if (mFloatWindowSetting == null) {
|
||||||
|
try {
|
||||||
|
String json = SPUtils.getString(Constants.SP_FLOAT_WINDOW_SETTINGS);
|
||||||
|
if (!TextUtils.isEmpty(json)) {
|
||||||
|
mFloatWindowSetting = GsonUtils.fromJson(json, FloatWindowSettingEntity.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mFloatWindowSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public static Observable<VNewSetting> getVNewSettingObservable() {
|
||||||
|
if (mVNewSetting != null) {
|
||||||
|
return Observable.just(mVNewSetting);
|
||||||
|
} else {
|
||||||
|
return vNewSettingSubject.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static AppEntity getNew32UpdateEntity() {
|
||||||
|
return mNew32UpdateEntity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求网络数据,尝试刷新畅玩相关配置
|
* 请求网络数据,尝试刷新畅玩相关配置
|
||||||
*/
|
*/
|
||||||
@ -204,7 +258,6 @@ public class Config {
|
|||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.getVApi().getSettings(BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT)
|
.getVApi().getSettings(BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new BiResponse<VSetting>() {
|
.subscribe(new BiResponse<VSetting>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(VSetting data) {
|
public void onSuccess(VSetting data) {
|
||||||
@ -216,6 +269,35 @@ public class Config {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
public static void getNewSetting() {
|
||||||
|
VApiService vApi = RetrofitManager.getInstance().getVApi();
|
||||||
|
vApi.getNewSettings(BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT).flatMap(new Function<VNewSetting, SingleSource<AppEntity>>() {
|
||||||
|
@Override
|
||||||
|
public SingleSource<AppEntity> apply(VNewSetting data) throws Exception {
|
||||||
|
mVNewSetting = data;
|
||||||
|
vNewSettingSubject.onNext(mVNewSetting);
|
||||||
|
SPUtils.setString(Constants.SP_V_NEW_SETTINGS, GsonUtils.toJson(data));
|
||||||
|
if (data.getVa() != null && data.getVa().getArch32() != null) {
|
||||||
|
String versionNameByPackageName = PackageUtils.getVersionNameByPackageName(data.getVa().getArch32().getPackageName());
|
||||||
|
return vApi.getNewPackageUpdate(
|
||||||
|
BuildConfig.VERSION_NAME,
|
||||||
|
versionNameByPackageName != null ? versionNameByPackageName : "",
|
||||||
|
HaloApp.getInstance().getChannel()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Single.error(new IllegalStateException("VNewSetting entity is not expected"));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new BiResponse<AppEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(AppEntity data) {
|
||||||
|
mNew32UpdateEntity = data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static GameGuidePopupEntity getGameGuidePopupEntity() {
|
public static GameGuidePopupEntity getGameGuidePopupEntity() {
|
||||||
return mGameGuidePopupEntity;
|
return mGameGuidePopupEntity;
|
||||||
@ -239,7 +321,6 @@ public class Config {
|
|||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.getApi().getSettings(PackageUtils.getGhVersionName(), channel)
|
.getApi().getSettings(PackageUtils.getGhVersionName(), channel)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new Response<SettingsEntity>() {
|
.subscribe(new Response<SettingsEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(SettingsEntity response) {
|
public void onResponse(SettingsEntity response) {
|
||||||
@ -252,7 +333,7 @@ public class Config {
|
|||||||
edit.apply();
|
edit.apply();
|
||||||
|
|
||||||
if (!SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
|
if (!SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
|
||||||
EventBus.getDefault().post(new EBReuse("Refresh"));
|
AppExecutor.getUiExecutor().execute(() -> EventBus.getDefault().post(new EBReuse("Refresh")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -260,7 +341,6 @@ public class Config {
|
|||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.getApi().getNewSettings(Build.MANUFACTURER, Build.MODEL, channel, Build.VERSION.SDK_INT, BuildConfig.VERSION_NAME)
|
.getApi().getNewSettings(Build.MANUFACTURER, Build.MODEL, channel, Build.VERSION.SDK_INT, BuildConfig.VERSION_NAME)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new BiResponse<NewSettingsEntity>() {
|
.subscribe(new BiResponse<NewSettingsEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(NewSettingsEntity data) {
|
public void onSuccess(NewSettingsEntity data) {
|
||||||
@ -270,11 +350,12 @@ public class Config {
|
|||||||
});
|
});
|
||||||
|
|
||||||
refreshVSettingEntity();
|
refreshVSettingEntity();
|
||||||
|
getNewSetting();
|
||||||
|
getFloatWindowSetting();
|
||||||
|
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)
|
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new BiResponse<GameGuidePopupEntity>() {
|
.subscribe(new BiResponse<GameGuidePopupEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(GameGuidePopupEntity data) {
|
public void onSuccess(GameGuidePopupEntity data) {
|
||||||
@ -286,7 +367,6 @@ public class Config {
|
|||||||
if (manufacturer.equals("OPPO") || manufacturer.equals("VIVO")) {
|
if (manufacturer.equals("OPPO") || manufacturer.equals("VIVO")) {
|
||||||
RetrofitManager.getInstance().getNewApi().getBrowserHintUrl(manufacturer)
|
RetrofitManager.getInstance().getNewApi().getBrowserHintUrl(manufacturer)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new BiResponse<ResponseBody>() {
|
.subscribe(new BiResponse<ResponseBody>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ResponseBody data) {
|
public void onSuccess(ResponseBody data) {
|
||||||
@ -310,12 +390,13 @@ public class Config {
|
|||||||
String filterString = UrlFilterUtils.getFilterQuery(
|
String filterString = UrlFilterUtils.getFilterQuery(
|
||||||
"manufacturer", Build.MANUFACTURER,
|
"manufacturer", Build.MANUFACTURER,
|
||||||
"model", Build.MODEL,
|
"model", Build.MODEL,
|
||||||
"android_sdk_version", String.valueOf(Build.VERSION.SDK_INT));
|
"android_sdk_version", String.valueOf(Build.VERSION.SDK_INT),
|
||||||
|
"rom", MetaUtil.INSTANCE.getRom().name() + " " + MetaUtil.INSTANCE.getRom().getVersionName()
|
||||||
|
);
|
||||||
|
|
||||||
RetrofitManager.getInstance()
|
RetrofitManager.getInstance()
|
||||||
.getNewApi().getNewSettings(PackageUtils.getGhVersionName(), channel, filterString)
|
.getNewApi().getNewSettings(PackageUtils.getGhVersionName(), channel, filterString)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(new BiResponse<NewApiSettingsEntity>() {
|
.subscribe(new BiResponse<NewApiSettingsEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(NewApiSettingsEntity data) {
|
public void onSuccess(NewApiSettingsEntity data) {
|
||||||
@ -324,7 +405,7 @@ public class Config {
|
|||||||
mNewSimulatorEntity = data.getSimulator();
|
mNewSimulatorEntity = data.getSimulator();
|
||||||
if (HaloApp.getInstance().isNewForThisVersion && mNightModeSetting != null && mNightModeSetting.getInstall()) {
|
if (HaloApp.getInstance().isNewForThisVersion && mNightModeSetting != null && mNightModeSetting.getInstall()) {
|
||||||
DarkModeUtils.INSTANCE.updateFollowSystemDarkModeToSp(true);
|
DarkModeUtils.INSTANCE.updateFollowSystemDarkModeToSp(true);
|
||||||
DarkModeUtils.INSTANCE.initDarkMode();
|
AppExecutor.getUiExecutor().execute(DarkModeUtils.INSTANCE::initDarkMode);
|
||||||
}
|
}
|
||||||
SPUtils.setString(Constants.SP_NEW_API_SETTINGS, GsonUtils.toJson(data));
|
SPUtils.setString(Constants.SP_NEW_API_SETTINGS, GsonUtils.toJson(data));
|
||||||
|
|
||||||
@ -332,8 +413,45 @@ public class Config {
|
|||||||
if (mNewApiSettingsEntity.getGameShieldContents() != null) {
|
if (mNewApiSettingsEntity.getGameShieldContents() != null) {
|
||||||
ContentBlockedHelper.INSTANCE.init(mNewApiSettingsEntity.getGameShieldContents());
|
ContentBlockedHelper.INSTANCE.init(mNewApiSettingsEntity.getGameShieldContents());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新安装列表是否开启的配置
|
||||||
|
if (mNewApiSettingsEntity.getInstalledComplianceSwitch() != null) {
|
||||||
|
PackageHelper.INSTANCE.updateIsGetInstalledPackagesApiAgreedRequired(mNewApiSettingsEntity.getInstalledComplianceSwitch());
|
||||||
|
} else {
|
||||||
|
PackageHelper.INSTANCE.updateIsGetInstalledPackagesApiAgreedRequired(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新包名监听是否开启
|
||||||
|
if (mNewApiSettingsEntity.isPackageObserveEnable()) {
|
||||||
|
AppExecutor.getUiExecutor().execute(() -> observePackageChange(mNewApiSettingsEntity.getPackageObserveActions()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
private static void getFloatWindowSetting() {
|
||||||
|
RetrofitManager.getInstance().getNewApi()
|
||||||
|
.getFloatWindowSettings()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(new BiResponse<FloatWindowSettingEntity>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(FloatWindowSettingEntity data) {
|
||||||
|
mFloatWindowSetting = data;
|
||||||
|
SPUtils.setString(Constants.SP_FLOAT_WINDOW_SETTINGS, GsonUtils.toJson(data));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void observePackageChange(NewApiSettingsEntity.PackageObserveActions packageObserveActions) {
|
||||||
|
PackageChangeBroadcastReceiver receiver = new PackageChangeBroadcastReceiver(packageObserveActions);
|
||||||
|
IntentFilter intentFilter = new IntentFilter();
|
||||||
|
intentFilter.addAction(packageObserveActions.getAdd());
|
||||||
|
intentFilter.addAction(packageObserveActions.getRem());
|
||||||
|
intentFilter.addAction(packageObserveActions.getRep());
|
||||||
|
intentFilter.addDataScheme("package");
|
||||||
|
HaloApp.getInstance().registerReceiver(receiver, intentFilter);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,14 +120,14 @@ object AddKaiFuBindingAdapter {
|
|||||||
@BindingAdapter("kaiFuTextColor", "kaiFuTextPosition")
|
@BindingAdapter("kaiFuTextColor", "kaiFuTextPosition")
|
||||||
fun kaiFuTextColor(view: EditText, dataMark: Int, position: Int) {
|
fun kaiFuTextColor(view: EditText, dataMark: Int, position: Int) {
|
||||||
if (dataMark == 1 && view.id == R.id.kaifu_add_time || dataMark == 2 && view.id == R.id.kaifu_add_first_name || dataMark == 3 && view.id == R.id.kaifu_add_server_name || dataMark == 4) {
|
if (dataMark == 1 && view.id == R.id.kaifu_add_time || dataMark == 2 && view.id == R.id.kaifu_add_first_name || dataMark == 3 && view.id == R.id.kaifu_add_server_name || dataMark == 4) {
|
||||||
view.setTextColor(ContextCompat.getColor(view.context, R.color.secondary_red))
|
view.setTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.secondary_red))
|
||||||
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.secondary_red))
|
view.setHintTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.secondary_red))
|
||||||
} else if (position == 0) {
|
} else if (position == 0) {
|
||||||
view.setTextColor(ContextCompat.getColor(view.context, R.color.hint))
|
view.setTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.hint))
|
||||||
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.hint))
|
view.setHintTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.hint))
|
||||||
} else {
|
} else {
|
||||||
view.setTextColor(ContextCompat.getColor(view.context, R.color.text_primary))
|
view.setTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.text_primary))
|
||||||
view.setHintTextColor(ContextCompat.getColor(view.context, R.color.hint))
|
view.setHintTextColor(ContextCompat.getColor(view.context, com.gh.gamecenter.common.R.color.hint))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ object AddKaiFuBindingAdapter {
|
|||||||
popupWindow.isTouchable = true
|
popupWindow.isTouchable = true
|
||||||
popupWindow.inputMethodMode = PopupWindow.INPUT_METHOD_NEEDED
|
popupWindow.inputMethodMode = PopupWindow.INPUT_METHOD_NEEDED
|
||||||
popupWindow.isOutsideTouchable = true
|
popupWindow.isOutsideTouchable = true
|
||||||
popupWindow.animationStyle = R.style.popwindow_option_anim_style
|
popupWindow.animationStyle = com.gh.gamecenter.common.R.style.popwindow_option_anim_style
|
||||||
|
|
||||||
// 设置偏移
|
// 设置偏移
|
||||||
windowPos[1] = windowPos[1] - 12F.dip2px()
|
windowPos[1] = windowPos[1] - 12F.dip2px()
|
||||||
|
|||||||
@ -27,7 +27,6 @@ import com.gh.common.chain.PackageCheckHandler;
|
|||||||
import com.gh.common.chain.UnsupportedFeatureHandler;
|
import com.gh.common.chain.UnsupportedFeatureHandler;
|
||||||
import com.gh.common.chain.ValidateVSpaceHandler;
|
import com.gh.common.chain.ValidateVSpaceHandler;
|
||||||
import com.gh.common.chain.VersionNumberHandler;
|
import com.gh.common.chain.VersionNumberHandler;
|
||||||
import com.gh.common.constant.Config;
|
|
||||||
import com.gh.common.filter.RegionSetting;
|
import com.gh.common.filter.RegionSetting;
|
||||||
import com.gh.common.filter.RegionSettingHelper;
|
import com.gh.common.filter.RegionSettingHelper;
|
||||||
import com.gh.common.history.HistoryHelper;
|
import com.gh.common.history.HistoryHelper;
|
||||||
@ -53,7 +52,6 @@ import com.gh.gamecenter.common.entity.LinkEntity;
|
|||||||
import com.gh.gamecenter.common.utils.DarkModeUtils;
|
import com.gh.gamecenter.common.utils.DarkModeUtils;
|
||||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||||
import com.gh.gamecenter.common.utils.FileUtils;
|
import com.gh.gamecenter.common.utils.FileUtils;
|
||||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
|
||||||
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
|
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
|
||||||
import com.gh.gamecenter.common.utils.SensorsBridge;
|
import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||||
@ -172,7 +170,7 @@ public class BindingAdapters {
|
|||||||
builder.addHandler(new OverseaDownloadHandler());
|
builder.addHandler(new OverseaDownloadHandler());
|
||||||
builder.addHandler(new CheckDownloadHandler());
|
builder.addHandler(new CheckDownloadHandler());
|
||||||
|
|
||||||
builder.setProcessEndCallback((asVGame, isSubscribe) -> {
|
builder.setProcessEndCallback(gameEntity.getId(), (asVGame, isSubscribe) -> {
|
||||||
download(v.getContext(),
|
download(v.getContext(),
|
||||||
progressBar,
|
progressBar,
|
||||||
gameEntity,
|
gameEntity,
|
||||||
@ -197,7 +195,7 @@ public class BindingAdapters {
|
|||||||
builder.addHandler(new GamePermissionHandler());
|
builder.addHandler(new GamePermissionHandler());
|
||||||
builder.addHandler(new VersionNumberHandler());
|
builder.addHandler(new VersionNumberHandler());
|
||||||
|
|
||||||
builder.setProcessEndCallback((asVGame, isSubscribe) -> {
|
builder.setProcessEndCallback(gameEntity.getId(), (asVGame, isSubscribe) -> {
|
||||||
DownloadDialog.showDownloadDialog(
|
DownloadDialog.showDownloadDialog(
|
||||||
v.getContext(),
|
v.getContext(),
|
||||||
gameEntity,
|
gameEntity,
|
||||||
@ -296,7 +294,7 @@ public class BindingAdapters {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ReservationHelper.showCancelReservationDialog(progressBar.getContext(), () -> {
|
ReservationHelper.showCancelReservationDialog(progressBar.getContext(),gameEntity, () -> {
|
||||||
ReservationHelper.cancelReservation(gameEntity, () -> {
|
ReservationHelper.cancelReservation(gameEntity, () -> {
|
||||||
updateReservation(progressBar, gameEntity);
|
updateReservation(progressBar, gameEntity);
|
||||||
});
|
});
|
||||||
@ -389,7 +387,7 @@ public class BindingAdapters {
|
|||||||
case diskisfull:
|
case diskisfull:
|
||||||
case diskioerror:
|
case diskioerror:
|
||||||
case waiting:
|
case waiting:
|
||||||
progressBar.setText(R.string.downloading);
|
progressBar.setText(com.gh.gamecenter.feature.R.string.downloading);
|
||||||
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
|
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
|
||||||
progressBar.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
|
progressBar.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
|
||||||
} else {
|
} else {
|
||||||
@ -397,7 +395,7 @@ public class BindingAdapters {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case done:
|
case done:
|
||||||
progressBar.setText(R.string.install);
|
progressBar.setText(com.gh.gamecenter.feature.R.string.install);
|
||||||
if (downloadEntity.isPluggable()
|
if (downloadEntity.isPluggable()
|
||||||
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
|
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
|
||||||
progressBar.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_PLUGIN);
|
progressBar.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_PLUGIN);
|
||||||
@ -555,15 +553,15 @@ public class BindingAdapters {
|
|||||||
gameName = String.format("%s - %s", game.getName(),
|
gameName = String.format("%s - %s", game.getName(),
|
||||||
PlatformUtils.getInstance(view.getContext()).getPlatformName(
|
PlatformUtils.getInstance(view.getContext()).getPlatformName(
|
||||||
game.getApk().get(0).getPlatform()));
|
game.getApk().get(0).getPlatform()));
|
||||||
if (!gameName.equals((String) view.getTag(R.string.tag_game_name_id))) {
|
if (!gameName.equals((String) view.getTag(com.gh.gamecenter.common.R.string.tag_game_name_id))) {
|
||||||
view.setText(gameName);
|
view.setText(gameName);
|
||||||
view.setTag(R.string.tag_game_name_id, gameName);
|
view.setTag(com.gh.gamecenter.common.R.string.tag_game_name_id, gameName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameName = game.getName();
|
gameName = game.getName();
|
||||||
if (gameName != null && !gameName.equals((String) view.getTag(R.string.tag_game_name_id))) {
|
if (gameName != null && !gameName.equals((String) view.getTag(com.gh.gamecenter.common.R.string.tag_game_name_id))) {
|
||||||
view.setText(gameName);
|
view.setText(gameName);
|
||||||
view.setTag(R.string.tag_game_name_id, gameName);
|
view.setTag(com.gh.gamecenter.common.R.string.tag_game_name_id, gameName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.gh.common.util.DirectUtils
|
import com.gh.common.util.DirectUtils
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||||
import com.gh.gamecenter.common.utils.dip2px
|
import com.gh.gamecenter.common.utils.dip2px
|
||||||
@ -49,7 +48,7 @@ class ApplyModeratorDialogFragment : BaseDialogFragment() {
|
|||||||
requireContext(),
|
requireContext(),
|
||||||
startText.length,
|
startText.length,
|
||||||
startText.length + mGroupNumber.length,
|
startText.length + mGroupNumber.length,
|
||||||
R.color.text_theme,
|
com.gh.gamecenter.common.R.color.text_theme,
|
||||||
true
|
true
|
||||||
) {
|
) {
|
||||||
DirectUtils.directToQqGroup(
|
DirectUtils.directToQqGroup(
|
||||||
|
|||||||
@ -40,7 +40,7 @@ import java.lang.ref.WeakReference
|
|||||||
* 设备提醒弹窗
|
* 设备提醒弹窗
|
||||||
*/
|
*/
|
||||||
class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val gameEntity: GameEntity) :
|
class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val gameEntity: GameEntity) :
|
||||||
Dialog(context, R.style.GhAlertDialog) {
|
Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog) {
|
||||||
private val mBinding: DialogDeviceRemindBinding by lazy { DialogDeviceRemindBinding.inflate(layoutInflater) }
|
private val mBinding: DialogDeviceRemindBinding by lazy { DialogDeviceRemindBinding.inflate(layoutInflater) }
|
||||||
private var currentPage = 0
|
private var currentPage = 0
|
||||||
private var mSlideLooperInterval = 3000L
|
private var mSlideLooperInterval = 3000L
|
||||||
@ -136,13 +136,13 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
|
|||||||
val isFirst = SPUtils.getBoolean(Constants.SP_FIRST_DEVICE_REMIND, false)
|
val isFirst = SPUtils.getBoolean(Constants.SP_FIRST_DEVICE_REMIND, false)
|
||||||
if (!isFirst) {
|
if (!isFirst) {
|
||||||
mBinding.cancelTv.isEnabled = false
|
mBinding.cancelTv.isEnabled = false
|
||||||
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_round_f5f5f5)
|
mBinding.cancelTv.background = ContextCompat.getDrawable(context, com.gh.gamecenter.common.R.drawable.button_round_f5f5f5)
|
||||||
disposable = countDownTimer(3) { finish, time ->
|
disposable = countDownTimer(3) { finish, time ->
|
||||||
if (finish) {
|
if (finish) {
|
||||||
mBinding.cancelTv.isEnabled = true
|
mBinding.cancelTv.isEnabled = true
|
||||||
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
|
mBinding.cancelTv.background = ContextCompat.getDrawable(context, com.gh.gamecenter.common.R.drawable.button_blue_oval)
|
||||||
mBinding.cancelTv.text = "我知道了"
|
mBinding.cancelTv.text = "我知道了"
|
||||||
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
|
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.white))
|
||||||
} else {
|
} else {
|
||||||
mBinding.cancelTv.text = "我知道了(${time}S)"
|
mBinding.cancelTv.text = "我知道了(${time}S)"
|
||||||
}
|
}
|
||||||
@ -153,8 +153,8 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
|
|||||||
mBinding.noRemindAgainCb.visibility = View.VISIBLE
|
mBinding.noRemindAgainCb.visibility = View.VISIBLE
|
||||||
mBinding.cancelTv.text = "我知道了"
|
mBinding.cancelTv.text = "我知道了"
|
||||||
mBinding.cancelTv.isEnabled = true
|
mBinding.cancelTv.isEnabled = true
|
||||||
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
|
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.white))
|
||||||
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
|
mBinding.cancelTv.background = ContextCompat.getDrawable(context, com.gh.gamecenter.common.R.drawable.button_blue_oval)
|
||||||
}
|
}
|
||||||
mBinding.cancelTv.setOnClickListener {
|
mBinding.cancelTv.setOnClickListener {
|
||||||
SPUtils.setBoolean(Constants.SP_NO_REMIND_AGAIN, mBinding.noRemindAgainCb.isChecked)
|
SPUtils.setBoolean(Constants.SP_NO_REMIND_AGAIN, mBinding.noRemindAgainCb.isChecked)
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
|||||||
import com.gh.common.util.DirectUtils
|
import com.gh.common.util.DirectUtils
|
||||||
import com.gh.gamecenter.common.utils.dip2px
|
import com.gh.gamecenter.common.utils.dip2px
|
||||||
import com.gh.gamecenter.common.utils.toColor
|
import com.gh.gamecenter.common.utils.toColor
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.databinding.DialogGameOffServiceBinding
|
import com.gh.gamecenter.databinding.DialogGameOffServiceBinding
|
||||||
import com.gh.gamecenter.feature.entity.GameEntity
|
import com.gh.gamecenter.feature.entity.GameEntity
|
||||||
|
|
||||||
@ -62,7 +61,7 @@ class GameOffServiceDialogFragment : BaseDialogFragment() {
|
|||||||
if (index == notEmptySite.size - 1) bottomMargin = 8F.dip2px()
|
if (index == notEmptySite.size - 1) bottomMargin = 8F.dip2px()
|
||||||
}
|
}
|
||||||
siteTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14F)
|
siteTv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14F)
|
||||||
siteTv.setTextColor(R.color.text_theme.toColor(requireContext()))
|
siteTv.setTextColor(com.gh.gamecenter.common.R.color.text_theme.toColor(requireContext()))
|
||||||
siteTv.text = site.text
|
siteTv.text = site.text
|
||||||
siteTv.paintFlags = siteTv.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
siteTv.paintFlags = siteTv.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||||
siteTv.setOnClickListener {
|
siteTv.setOnClickListener {
|
||||||
|
|||||||
@ -158,7 +158,7 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
|
|||||||
}
|
}
|
||||||
if (isXapk) {
|
if (isXapk) {
|
||||||
val xapkUnzipVersions = Config.getSettings()?.permissionPopupAppliedVersions?.xapkUnzip
|
val xapkUnzipVersions = Config.getSettings()?.permissionPopupAppliedVersions?.xapkUnzip
|
||||||
if (xapkUnzipVersions?.contains(Build.VERSION.SDK_INT.toString()) == false) {
|
if (xapkUnzipVersions?.contains(Build.VERSION.SDK_INT.toString()) == false || XapkInstaller.systemHasFlaw) {
|
||||||
callBack?.invoke(false)
|
callBack?.invoke(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,12 +76,12 @@ class NewPrivacyPolicyDialogFragment : BaseDialogFragment() {
|
|||||||
contentText.setSpan(object : ClickableSpan() {
|
contentText.setSpan(object : ClickableSpan() {
|
||||||
override fun updateDrawState(ds: TextPaint) {
|
override fun updateDrawState(ds: TextPaint) {
|
||||||
super.updateDrawState(ds)
|
super.updateDrawState(ds)
|
||||||
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
|
ds.color = ContextCompat.getColor(requireContext(), com.gh.gamecenter.common.R.color.text_theme)
|
||||||
ds.isUnderlineText = false
|
ds.isUnderlineText = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(widget: View) {
|
override fun onClick(widget: View) {
|
||||||
val privacyPolicyUrl = requireContext().getString(R.string.privacy_policy_url)
|
val privacyPolicyUrl = requireContext().getString(com.gh.gamecenter.common.R.string.privacy_policy_url)
|
||||||
val childrenPrivacyPolicyUrl = requireContext().getString(R.string.children_policy_url)
|
val childrenPrivacyPolicyUrl = requireContext().getString(R.string.children_policy_url)
|
||||||
val thirdPartySdkUrl = requireContext().getString(R.string.sdk_list_url)
|
val thirdPartySdkUrl = requireContext().getString(R.string.sdk_list_url)
|
||||||
val permissionListUrl = requireContext().getString(R.string.permission_and_usage_url)
|
val permissionListUrl = requireContext().getString(R.string.permission_and_usage_url)
|
||||||
|
|||||||
@ -19,9 +19,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.gh.common.util.DirectUtils
|
import com.gh.common.util.DirectUtils
|
||||||
import com.gh.common.util.LogUtils
|
import com.gh.common.util.LogUtils
|
||||||
|
import com.gh.common.util.PackageHelper
|
||||||
import com.gh.common.util.PackageUtils
|
import com.gh.common.util.PackageUtils
|
||||||
import com.gh.download.DownloadManager
|
import com.gh.download.DownloadManager
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
|
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
|
||||||
import com.gh.gamecenter.common.callback.ConfirmListener
|
import com.gh.gamecenter.common.callback.ConfirmListener
|
||||||
import com.gh.gamecenter.common.constant.Constants
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
@ -59,7 +59,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
private val mDuration = 3000
|
private val mDuration = 3000
|
||||||
private var mDisposable: Disposable? = null
|
private var mDisposable: Disposable? = null
|
||||||
private var mAdapter: PackageCheckAdapter? = null
|
private var mAdapter: PackageCheckAdapter? = null
|
||||||
private var mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
|
private var mAllInstalledPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
|
||||||
var gameEntity: GameEntity? = null
|
var gameEntity: GameEntity? = null
|
||||||
var callBack: ConfirmListener? = null
|
var callBack: ConfirmListener? = null
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
requireContext(),
|
requireContext(),
|
||||||
0,
|
0,
|
||||||
(link.title ?: "").length,
|
(link.title ?: "").length,
|
||||||
R.color.text_theme,
|
com.gh.gamecenter.common.R.color.text_theme,
|
||||||
true
|
true
|
||||||
) {
|
) {
|
||||||
LogUtils.uploadPackageCheck(
|
LogUtils.uploadPackageCheck(
|
||||||
@ -284,7 +284,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
if (it >= mDuration) {
|
if (it >= mDuration) {
|
||||||
mDisposable?.dispose()
|
mDisposable?.dispose()
|
||||||
binding.downloadBtn.isEnabled = true
|
binding.downloadBtn.isEnabled = true
|
||||||
binding.downloadBtn.background = R.drawable.bg_notification_open_btn_style_2.toDrawable()
|
binding.downloadBtn.background = com.gh.gamecenter.common.R.drawable.bg_notification_open_btn_style_2.toDrawable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val animator = ValueAnimator.ofInt(0, 100)
|
val animator = ValueAnimator.ofInt(0, 100)
|
||||||
@ -325,7 +325,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
|
mAllInstalledPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
|
||||||
gameEntity?.packageDialog?.let {
|
gameEntity?.packageDialog?.let {
|
||||||
if (isAllPackageInstalled(mAllInstalledPackages, it)) {
|
if (isAllPackageInstalled(mAllInstalledPackages, it)) {
|
||||||
callBack?.onConfirm()
|
callBack?.onConfirm()
|
||||||
@ -363,7 +363,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onEventMainThread(busFour: EBPackage) {
|
fun onEventMainThread(busFour: EBPackage) {
|
||||||
if (busFour.isInstalledOrUninstalled()) {
|
if (busFour.isInstalledOrUninstalled()) {
|
||||||
mAllInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
|
mAllInstalledPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
|
||||||
mAdapter?.notifyDataSetChanged()
|
mAdapter?.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,10 +391,10 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
val isAllInstalled = checkDetectionsInstalled(mAllInstalledPackages, entity.packages)
|
val isAllInstalled = checkDetectionsInstalled(mAllInstalledPackages, entity.packages)
|
||||||
if (isAllInstalled) {
|
if (isAllInstalled) {
|
||||||
holder.binding.statusTv.text = "已安装"
|
holder.binding.statusTv.text = "已安装"
|
||||||
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme))
|
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme))
|
||||||
} else {
|
} else {
|
||||||
holder.binding.statusTv.text = "未安装"
|
holder.binding.statusTv.text = "未安装"
|
||||||
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.secondary_red))
|
holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.secondary_red))
|
||||||
}
|
}
|
||||||
holder.binding.statusTv.visibility = View.VISIBLE
|
holder.binding.statusTv.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
@ -416,7 +416,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val allInstalledPackages = PackageUtils.getInstalledPackages(HaloApp.getInstance().application, 0)
|
val allInstalledPackages = PackageHelper.getInstalledPackageNameList(HaloApp.getInstance().application, 0)
|
||||||
if (isAllPackageInstalled(allInstalledPackages, packageDialogEntity)) {
|
if (isAllPackageInstalled(allInstalledPackages, packageDialogEntity)) {
|
||||||
callBack.onConfirm()
|
callBack.onConfirm()
|
||||||
return
|
return
|
||||||
@ -453,12 +453,12 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun checkDetectionsInstalled(
|
private fun checkDetectionsInstalled(
|
||||||
allInstalledPackages: List<PackageInfo>,
|
allInstalledPackages: List<String>,
|
||||||
packages: ArrayList<String>
|
packages: ArrayList<String>
|
||||||
): Boolean {
|
): Boolean {
|
||||||
var isPackagesInstalled = false
|
var isPackagesInstalled = false
|
||||||
packages.forEach { packageName ->
|
packages.forEach { packageName ->
|
||||||
val isInstalled = allInstalledPackages.find { it.packageName == packageName } != null
|
val isInstalled = allInstalledPackages.find { it == packageName } != null
|
||||||
if (isInstalled) {
|
if (isInstalled) {
|
||||||
isPackagesInstalled = true
|
isPackagesInstalled = true
|
||||||
return@forEach
|
return@forEach
|
||||||
@ -469,7 +469,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
|||||||
|
|
||||||
|
|
||||||
fun isAllPackageInstalled(
|
fun isAllPackageInstalled(
|
||||||
allInstalledPackages: List<PackageInfo>,
|
allInstalledPackages: List<String>,
|
||||||
packageDialogEntity: PackageDialogEntity
|
packageDialogEntity: PackageDialogEntity
|
||||||
): Boolean {
|
): Boolean {
|
||||||
var isAllInstalled = true
|
var isAllInstalled = true
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import android.view.*
|
|||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.fragment.app.FragmentTransaction
|
import androidx.fragment.app.FragmentTransaction
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.WebActivity
|
import com.gh.gamecenter.WebActivity
|
||||||
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||||
import com.gh.gamecenter.common.constant.Constants
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
@ -68,13 +67,13 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
|
|||||||
skipText.setSpan(object : ClickableSpan() {
|
skipText.setSpan(object : ClickableSpan() {
|
||||||
override fun updateDrawState(ds: TextPaint) {
|
override fun updateDrawState(ds: TextPaint) {
|
||||||
super.updateDrawState(ds)
|
super.updateDrawState(ds)
|
||||||
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
|
ds.color = ContextCompat.getColor(requireContext(), com.gh.gamecenter.common.R.color.text_theme)
|
||||||
ds.isUnderlineText = false
|
ds.isUnderlineText = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(widget: View) {
|
override fun onClick(widget: View) {
|
||||||
val intent =
|
val intent =
|
||||||
WebActivity.getIntent(requireContext(), context!!.getString(R.string.privacy_policy_url), true)
|
WebActivity.getIntent(requireContext(), context!!.getString(com.gh.gamecenter.common.R.string.privacy_policy_url), true)
|
||||||
context?.startActivity(intent)
|
context?.startActivity(intent)
|
||||||
}
|
}
|
||||||
}, skipText.length - 6, skipText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
}, skipText.length - 6, skipText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
@ -110,13 +109,13 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
|
|||||||
skipText.setSpan(object : ClickableSpan() {
|
skipText.setSpan(object : ClickableSpan() {
|
||||||
override fun updateDrawState(ds: TextPaint) {
|
override fun updateDrawState(ds: TextPaint) {
|
||||||
super.updateDrawState(ds)
|
super.updateDrawState(ds)
|
||||||
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
|
ds.color = ContextCompat.getColor(requireContext(), com.gh.gamecenter.common.R.color.text_theme)
|
||||||
ds.isUnderlineText = false
|
ds.isUnderlineText = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(widget: View) {
|
override fun onClick(widget: View) {
|
||||||
val intent =
|
val intent =
|
||||||
WebActivity.getIntent(requireContext(), context!!.getString(R.string.privacy_policy_url), true)
|
WebActivity.getIntent(requireContext(), context!!.getString(com.gh.gamecenter.common.R.string.privacy_policy_url), true)
|
||||||
context?.startActivity(intent)
|
context?.startActivity(intent)
|
||||||
}
|
}
|
||||||
}, skipText.length - 9, skipText.length - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
}, skipText.length - 9, skipText.length - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
@ -124,12 +123,12 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
|
|||||||
skipText.setSpan(object : ClickableSpan() {
|
skipText.setSpan(object : ClickableSpan() {
|
||||||
override fun updateDrawState(ds: TextPaint) {
|
override fun updateDrawState(ds: TextPaint) {
|
||||||
super.updateDrawState(ds)
|
super.updateDrawState(ds)
|
||||||
ds.color = ContextCompat.getColor(requireContext(), R.color.text_theme)
|
ds.color = ContextCompat.getColor(requireContext(), com.gh.gamecenter.common.R.color.text_theme)
|
||||||
ds.isUnderlineText = false
|
ds.isUnderlineText = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(widget: View) {
|
override fun onClick(widget: View) {
|
||||||
val intent = WebActivity.getIntent(requireContext(), context!!.getString(R.string.disclaimer_url), true)
|
val intent = WebActivity.getIntent(requireContext(), context!!.getString(com.gh.gamecenter.common.R.string.disclaimer_url), true)
|
||||||
context?.startActivity(intent)
|
context?.startActivity(intent)
|
||||||
}
|
}
|
||||||
}, skipText.length - 4, skipText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
}, skipText.length - 4, skipText.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
|
|||||||
@ -1,27 +1,42 @@
|
|||||||
package com.gh.common.dialog
|
package com.gh.common.dialog
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.DialogInterface
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
|
import com.gh.common.exposure.ExposureListener
|
||||||
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
import com.gh.common.exposure.IExposable
|
||||||
import com.gh.gamecenter.common.utils.ImageUtils
|
import com.gh.gamecenter.DownloadManagerActivity
|
||||||
import com.gh.gamecenter.common.utils.fromHtml
|
|
||||||
import com.gh.gamecenter.GameDetailActivity
|
import com.gh.gamecenter.GameDetailActivity
|
||||||
import com.gh.gamecenter.R
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
|
||||||
|
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||||
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
|
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||||
|
import com.gh.gamecenter.common.utils.*
|
||||||
import com.gh.gamecenter.common.view.FixLinearLayoutManager
|
import com.gh.gamecenter.common.view.FixLinearLayoutManager
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils.getBoolean
|
||||||
import com.gh.gamecenter.databinding.DialogReserveBinding
|
import com.gh.gamecenter.databinding.DialogReserveBinding
|
||||||
import com.gh.gamecenter.databinding.DialogReserveItemBinding
|
import com.gh.gamecenter.databinding.DialogReserveItemBinding
|
||||||
import com.gh.gamecenter.common.entity.SimpleGameEntity
|
import com.gh.gamecenter.feature.entity.GameEntity
|
||||||
|
import com.gh.gamecenter.feature.entity.ReserveOnlineEntity
|
||||||
|
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||||
import com.gh.gamecenter.mygame.MyGameActivity
|
import com.gh.gamecenter.mygame.MyGameActivity
|
||||||
|
import com.halo.assistant.HaloApp
|
||||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||||
|
|
||||||
class ReserveDialog : BaseDialogFragment() {
|
class ReserveDialog : BaseDialogFragment() {
|
||||||
|
|
||||||
private lateinit var mReserveList: List<SimpleGameEntity>
|
private lateinit var reserveOnlineEntity: ReserveOnlineEntity
|
||||||
|
val games: List<GameEntity>
|
||||||
|
get() = reserveOnlineEntity.games
|
||||||
|
|
||||||
private var mDismissListener: (() -> Unit)? = null
|
private var mDismissListener: (() -> Unit)? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -36,66 +51,162 @@ class ReserveDialog : BaseDialogFragment() {
|
|||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
val binding: DialogReserveBinding = DialogReserveBinding.inflate(layoutInflater, null, false)
|
val binding: DialogReserveBinding = DialogReserveBinding.inflate(layoutInflater, null, false)
|
||||||
|
|
||||||
mReserveList = arguments?.getParcelableArrayList(RESERVE_LIST) ?: arrayListOf()
|
reserveOnlineEntity = arguments?.getParcelable(RESERVE_ONLINE) ?: ReserveOnlineEntity()
|
||||||
|
|
||||||
binding.title.text = resources.getString(R.string.dialog_reserve_title, mReserveList.size).fromHtml()
|
binding.tvTitle.text =
|
||||||
binding.more.visibility = if (mReserveList.size > 4) {
|
resources.getString(R.string.dialog_reserve_title, reserveOnlineEntity.gamesTotal).fromHtml()
|
||||||
View.VISIBLE
|
binding.tvViewAllAppointment.setOnClickListener {
|
||||||
} else View.GONE
|
SensorsBridge.trackAppointmentGameOnlineDialogClick(buttonName = "查看全部预约")
|
||||||
binding.more.setOnClickListener {
|
val intent = MyGameActivity.getIntentWithConfig(requireContext(), MyGameActivity.RESERVATION_INDEX)
|
||||||
val intent = MyGameActivity.getIntentWithConfig(requireContext(), 2)
|
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
val adapter = ReserveDialogAdapter(requireContext(), games)
|
||||||
|
binding.rvGames.layoutManager = FixLinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
||||||
|
binding.rvGames.adapter = adapter
|
||||||
|
|
||||||
|
val exposureListener = ExposureListener(this, adapter)
|
||||||
|
binding.rvGames.addOnScrollListener(exposureListener)
|
||||||
|
|
||||||
|
binding.ivClose.setOnClickListener {
|
||||||
dismissAllowingStateLoss()
|
dismissAllowingStateLoss()
|
||||||
}
|
}
|
||||||
binding.recyclerView.layoutManager = if (mReserveList.size > 4) {
|
|
||||||
GridLayoutManager(context, 4)
|
|
||||||
} else {
|
|
||||||
FixLinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
|
||||||
}
|
|
||||||
binding.recyclerView.adapter = object : BaseRecyclerAdapter<ReserveDialogItemViewHolder>(context) {
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReserveDialogItemViewHolder {
|
|
||||||
val inflate = mLayoutInflater.inflate(R.layout.dialog_reserve_item, parent, false)
|
|
||||||
return ReserveDialogItemViewHolder(DialogReserveItemBinding.bind(inflate))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
checkHasAutoDownload(binding)
|
||||||
return if (mReserveList.size > 4) 4 else mReserveList.size
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ReserveDialogItemViewHolder, position: Int) {
|
|
||||||
val entity = mReserveList[position]
|
|
||||||
ImageUtils.display(holder.binding.icon, entity.icon)
|
|
||||||
holder.binding.gameNameTv.text = entity.name
|
|
||||||
holder.itemView.setOnClickListener {
|
|
||||||
GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(预约弹窗)")
|
|
||||||
dismissAllowingStateLoss()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog?.setCanceledOnTouchOutside(true)
|
dialog?.setCanceledOnTouchOutside(true)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkHasAutoDownload(binding: DialogReserveBinding) {
|
||||||
|
if (reserveOnlineEntity.wifiAutoDownloadTotal > 0) {
|
||||||
|
// 开启自动下载
|
||||||
|
binding.tvAutoDownloadTips.goneIf(false)
|
||||||
|
var firstAutoDownloadGameName =
|
||||||
|
reserveOnlineEntity.games.find { it.wifiAutoDownload && !it.isLandPageAddressDialog() }?.name
|
||||||
|
|
||||||
|
if(!firstAutoDownloadGameName.isNullOrBlank() && firstAutoDownloadGameName.length > GAME_NAME_SHOW_MAX_LENGTH){
|
||||||
|
firstAutoDownloadGameName = "${firstAutoDownloadGameName.take(GAME_NAME_SHOW_MAX_LENGTH-1)}..."
|
||||||
|
}
|
||||||
|
val isWifiOpen = NetworkUtils.isWifiConnected(HaloApp.getInstance())
|
||||||
|
binding.tvAutoDownloadTips.text =
|
||||||
|
if (isWifiOpen) {
|
||||||
|
if (firstAutoDownloadGameName.isNullOrBlank()) {
|
||||||
|
getString(
|
||||||
|
R.string.reserve_reminder_auto_download,
|
||||||
|
"${reserveOnlineEntity.wifiAutoDownloadTotal}"
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
getString(
|
||||||
|
R.string.reserve_reminder_auto_download_with_name,
|
||||||
|
firstAutoDownloadGameName,
|
||||||
|
"${reserveOnlineEntity.wifiAutoDownloadTotal}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (firstAutoDownloadGameName.isNullOrBlank()) {
|
||||||
|
getString(
|
||||||
|
R.string.reserve_reminder_wait_for_wifi_to_auto_download,
|
||||||
|
"${reserveOnlineEntity.wifiAutoDownloadTotal}"
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
getString(
|
||||||
|
R.string.reserve_reminder_wait_for_wifi_to_auto_download_with_name,
|
||||||
|
firstAutoDownloadGameName,
|
||||||
|
"${reserveOnlineEntity.wifiAutoDownloadTotal}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.tvAutoDownloadTips.setOnClickListener {
|
||||||
|
SensorsBridge.trackAppointmentGameOnlineDialogClick(buttonName = "查看进度")
|
||||||
|
val intent = DownloadManagerActivity.getDownloadMangerIntent(requireContext(), "")
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding.tvAutoDownloadTips.goneIf(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setOnDismissListener(dismissListener: () -> Unit) {
|
fun setOnDismissListener(dismissListener: () -> Unit) {
|
||||||
mDismissListener = dismissListener
|
mDismissListener = dismissListener
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDismiss(dialog: DialogInterface) {
|
||||||
|
super.onDismiss(dialog)
|
||||||
|
SensorsBridge.trackAppointmentGameOnlineDialogClick(buttonName = "关闭弹窗")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
dialog?.window?.let {
|
||||||
|
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
val params = it.attributes
|
||||||
|
params.width = DisplayUtils.dip2px(300F)
|
||||||
|
it.attributes = params
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
mDismissListener?.invoke()
|
mDismissListener?.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val RESERVE_LIST = "reserve_list"
|
const val RESERVE_ONLINE = "reserve_online"
|
||||||
|
private const val GAME_NAME_SHOW_MAX_LENGTH = 8
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getInstance(reserveList: List<SimpleGameEntity>) = ReserveDialog().apply {
|
fun getInstance(reserveOnlineEntity: ReserveOnlineEntity?) = ReserveDialog().apply {
|
||||||
arguments = Bundle()
|
arguments = Bundle().apply {
|
||||||
arguments?.putParcelableArrayList(RESERVE_LIST, ArrayList(reserveList))
|
putParcelable(RESERVE_ONLINE, reserveOnlineEntity)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ReserveDialogAdapter(
|
||||||
|
context: Context,
|
||||||
|
private val games: List<GameEntity>
|
||||||
|
) :
|
||||||
|
BaseRecyclerAdapter<ReserveDialogItemViewHolder>(context), IExposable {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReserveDialogItemViewHolder {
|
||||||
|
return ReserveDialogItemViewHolder(parent.toBinding())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount(): Int {
|
||||||
|
return if (games.size > 8) 8 else games.size
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ReserveDialogItemViewHolder, position: Int) {
|
||||||
|
val entity = games[position]
|
||||||
|
holder.binding.icon.displayGameIcon(entity)
|
||||||
|
holder.binding.gameNameTv.text = entity.name
|
||||||
|
holder.itemView.setOnClickListener {
|
||||||
|
SensorsBridge.trackAppointmentGameOnlineDialogClick(
|
||||||
|
"游戏",
|
||||||
|
entity.id,
|
||||||
|
entity.name ?: "",
|
||||||
|
entity.categoryChinese,
|
||||||
|
)
|
||||||
|
GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(预约弹窗)", entity.exposureEvent)
|
||||||
|
}
|
||||||
|
entity.exposureEvent = ExposureEvent.createEvent(
|
||||||
|
entity,
|
||||||
|
listOf(ExposureSource("预约上线弹窗", ""))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getEventByPosition(pos: Int): ExposureEvent? {
|
||||||
|
return games.getOrNull(pos)?.exposureEvent
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getEventListByPosition(pos: Int): List<ExposureEvent>? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class ReserveDialogItemViewHolder(val binding: DialogReserveItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
|
class ReserveDialogItemViewHolder(val binding: DialogReserveItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
|
||||||
@ -0,0 +1,278 @@
|
|||||||
|
package com.gh.common.dialog
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.text.InputFilter
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import androidx.core.widget.addTextChangedListener
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||||
|
import com.gh.gamecenter.common.retrofit.Response
|
||||||
|
import com.gh.gamecenter.common.utils.singleToMain
|
||||||
|
import com.gh.gamecenter.common.utils.toColor
|
||||||
|
import com.gh.gamecenter.common.utils.toResString
|
||||||
|
import com.gh.gamecenter.core.utils.ToastUtils
|
||||||
|
import com.gh.gamecenter.databinding.DialogReserveReminderPhoneNumberBinding
|
||||||
|
import com.gh.gamecenter.entity.ReserveModifyEntity
|
||||||
|
import com.gh.gamecenter.entity.ValidateCodeResponse
|
||||||
|
import com.halo.assistant.fragment.reserve.OnReserveReminderListener
|
||||||
|
import com.halo.assistant.fragment.reserve.ReserveReminderRepository
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import org.json.JSONObject
|
||||||
|
import retrofit2.HttpException
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
|
||||||
|
class ReserveReminderPhoneNumberDialog(
|
||||||
|
context: Context,
|
||||||
|
themeResId: Int,
|
||||||
|
private val dialogType: Int,
|
||||||
|
private val phoneNumber: String,
|
||||||
|
private var serviceId: String,
|
||||||
|
private val gameId: String,
|
||||||
|
private val repository: ReserveReminderRepository,
|
||||||
|
private val listener: OnReserveReminderListener
|
||||||
|
) :
|
||||||
|
Dialog(context, themeResId) {
|
||||||
|
|
||||||
|
private val compositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
|
private lateinit var binding: DialogReserveReminderPhoneNumberBinding
|
||||||
|
|
||||||
|
private var hasValidated = false
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
binding = DialogReserveReminderPhoneNumberBinding.inflate(LayoutInflater.from(context))
|
||||||
|
setContentView(binding.root)
|
||||||
|
initView()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
binding.vClose.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
setSubmitState(phoneNumber)
|
||||||
|
binding.etInput.addTextChangedListener {
|
||||||
|
val content = binding.etInput.text?.toString() ?: ""
|
||||||
|
if (dialogType == DIALOG_TYPE_BIND_PHONE || dialogType == DIALOG_TYPE_CHANGE_PHONE) {
|
||||||
|
setSubmitState(content)
|
||||||
|
} else {
|
||||||
|
val length = content.length
|
||||||
|
if (length == VALIDATE_CODE_LENGTH) {
|
||||||
|
verifyPhoneNumber(content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
when (dialogType) {
|
||||||
|
DIALOG_TYPE_BIND_PHONE -> {
|
||||||
|
binding.tvTitle.setText(R.string.enable_sms_reminder)
|
||||||
|
binding.tvDescription.setText(R.string.enable_sms_reminder_description)
|
||||||
|
binding.etInput.setText(phoneNumber)
|
||||||
|
binding.etInput.setHint(com.gh.gamecenter.login.R.string.input_phone_hint)
|
||||||
|
}
|
||||||
|
|
||||||
|
DIALOG_TYPE_CHANGE_PHONE -> {
|
||||||
|
binding.tvTitle.setText(R.string.change_phone_number_2)
|
||||||
|
binding.tvDescription.setText(R.string.enable_sms_reminder_description)
|
||||||
|
binding.etInput.setText(phoneNumber)
|
||||||
|
binding.etInput.setHint(com.gh.gamecenter.login.R.string.input_phone_hint)
|
||||||
|
}
|
||||||
|
|
||||||
|
DIALOG_TYPE_VERIFY_PHONE -> {
|
||||||
|
startCountDown()
|
||||||
|
binding.tvTitle.setText(R.string.please_input_sms_verify_code)
|
||||||
|
if (phoneNumber.length == PHONE_NUMBER_LENGTH) {
|
||||||
|
val phoneNumberWithMask = phoneNumber.substring(0, 3) + MASK + phoneNumber.substring(7)
|
||||||
|
binding.tvDescription.text =
|
||||||
|
context.getString(R.string.verify_code_send_with_phone_number, phoneNumberWithMask)
|
||||||
|
}
|
||||||
|
binding.tvSubmit.alpha = 1.0F
|
||||||
|
binding.etInput.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(VALIDATE_CODE_LENGTH))
|
||||||
|
binding.etInput.setHint(R.string.please_input_verify_code)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.tvSubmit.setOnClickListener {
|
||||||
|
val text = binding.etInput.text?.toString() ?: ""
|
||||||
|
if (dialogType == DIALOG_TYPE_VERIFY_PHONE) {
|
||||||
|
resendValidateCode()
|
||||||
|
} else {
|
||||||
|
if (isEnableSubmit(text)) {
|
||||||
|
when (dialogType) {
|
||||||
|
DIALOG_TYPE_BIND_PHONE -> bindPhoneNumber(text)
|
||||||
|
DIALOG_TYPE_CHANGE_PHONE -> bindPhoneNumber(text)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (text != phoneNumber) {
|
||||||
|
ToastUtils.toast(R.string.invalid_phone_number_format.toResString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun resendValidateCode() {
|
||||||
|
repository.sendVerifyCode(phoneNumber)
|
||||||
|
.compose(singleToMain())
|
||||||
|
.subscribe(object : BiResponse<ValidateCodeResponse>() {
|
||||||
|
override fun onSuccess(data: ValidateCodeResponse) {
|
||||||
|
serviceId = data.serviceId
|
||||||
|
startCountDown()
|
||||||
|
}
|
||||||
|
|
||||||
|
}).let(compositeDisposable::add)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun verifyPhoneNumber(content: String) {
|
||||||
|
repository.verifyPhoneNumber(phoneNumber, content, serviceId)
|
||||||
|
.compose(singleToMain())
|
||||||
|
.subscribe(object : BiResponse<ResponseBody>() {
|
||||||
|
override fun onSuccess(data: ResponseBody) {
|
||||||
|
hasValidated = true
|
||||||
|
listener.phoneNumberValidateSuccessfully()
|
||||||
|
ToastUtils.toast(R.string.phone_number_validate_successfully.toResString())
|
||||||
|
dismiss()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(exception: Exception) {
|
||||||
|
super.onFailure(exception)
|
||||||
|
binding.etInput.text = null
|
||||||
|
ToastUtils.toast(R.string.phone_number_validate_failure.toResString())
|
||||||
|
}
|
||||||
|
}).let(compositeDisposable::add)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun bindPhoneNumber(phone: String) {
|
||||||
|
repository.bindPhone(gameId, phone)
|
||||||
|
.compose(singleToMain())
|
||||||
|
.subscribe(object : BiResponse<ReserveModifyEntity>() {
|
||||||
|
override fun onSuccess(data: ReserveModifyEntity) {
|
||||||
|
listener.bindPhoneSuccessfully(data.smsConfig.mobileValidated, phone)
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(exception: Exception) {
|
||||||
|
super.onFailure(exception)
|
||||||
|
if (exception is HttpException) {
|
||||||
|
try {
|
||||||
|
val string = exception.response().errorBody()?.string()
|
||||||
|
if (!string.isNullOrBlank()) {
|
||||||
|
val json = JSONObject(string)
|
||||||
|
val message = json.getJSONObject("toast").getString("sms_config.mobile")
|
||||||
|
ToastUtils.showToast(message)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// no implement
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}).let(compositeDisposable::add)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun startCountDown() {
|
||||||
|
binding.tvSubmit.isEnabled = false
|
||||||
|
binding.tvSubmit.setBackgroundResource(com.gh.gamecenter.common.R.drawable.bg_common_button_light_fill_gray)
|
||||||
|
binding.tvSubmit.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
|
||||||
|
Observable.interval(0, 1, TimeUnit.SECONDS)
|
||||||
|
.take(COUNT_DOWN_DURATION)
|
||||||
|
.map {
|
||||||
|
COUNT_DOWN_DURATION - it
|
||||||
|
}
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(object : Response<Long>() {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
compositeDisposable.add(d)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onNext(time: Long) {
|
||||||
|
binding.tvSubmit.text = context.getString(R.string.resend_with_time, "$time")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
binding.tvSubmit.isEnabled = true
|
||||||
|
binding.tvSubmit.setBackgroundResource(com.gh.gamecenter.common.R.drawable.bg_common_button_fill_blue)
|
||||||
|
binding.tvSubmit.setTextColor(com.gh.gamecenter.common.R.color.text_aw_primary.toColor(context))
|
||||||
|
binding.tvSubmit.setText(R.string.resend)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dismiss() {
|
||||||
|
compositeDisposable.clear()
|
||||||
|
if (dialogType == DIALOG_TYPE_VERIFY_PHONE && !hasValidated) {
|
||||||
|
ToastUtils.toast(R.string.phone_number_validate_cancel.toResString())
|
||||||
|
}
|
||||||
|
super.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isEnableSubmit(phone: String) =
|
||||||
|
PHONE_NUMBER_PATTERN.toRegex().matches(phone)
|
||||||
|
&& if (dialogType == DIALOG_TYPE_CHANGE_PHONE) phone != phoneNumber else true
|
||||||
|
|
||||||
|
private fun setSubmitState(phone: String) {
|
||||||
|
val isEnable = isEnableSubmit(phone)
|
||||||
|
binding.tvSubmit.alpha = if (isEnable) {
|
||||||
|
TV_SUBMIT_ENABLE_ALPHA
|
||||||
|
} else {
|
||||||
|
TV_SUBMIT_UNABLE_ALPHA
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
private const val PHONE_NUMBER_PATTERN = "^1\\d{10}$"
|
||||||
|
private const val MASK = "****"
|
||||||
|
private const val PHONE_NUMBER_LENGTH = 11
|
||||||
|
private const val VALIDATE_CODE_LENGTH = 6
|
||||||
|
|
||||||
|
const val DIALOG_TYPE_BIND_PHONE = 0
|
||||||
|
const val DIALOG_TYPE_CHANGE_PHONE = 1
|
||||||
|
const val DIALOG_TYPE_VERIFY_PHONE = 2
|
||||||
|
|
||||||
|
private const val COUNT_DOWN_DURATION = 60L
|
||||||
|
|
||||||
|
private const val TV_SUBMIT_ENABLE_ALPHA = 1F
|
||||||
|
private const val TV_SUBMIT_UNABLE_ALPHA = 0.4F
|
||||||
|
|
||||||
|
fun create(
|
||||||
|
context: Context,
|
||||||
|
dialogType: Int,
|
||||||
|
phoneNumber: String,
|
||||||
|
serviceId: String,
|
||||||
|
gameId: String,
|
||||||
|
repository: ReserveReminderRepository,
|
||||||
|
listener: OnReserveReminderListener
|
||||||
|
) =
|
||||||
|
ReserveReminderPhoneNumberDialog(
|
||||||
|
context,
|
||||||
|
com.gh.gamecenter.common.R.style.DialogWindowTransparent,
|
||||||
|
dialogType,
|
||||||
|
phoneNumber,
|
||||||
|
serviceId,
|
||||||
|
gameId,
|
||||||
|
repository,
|
||||||
|
listener
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,428 @@
|
|||||||
|
package com.gh.common.dialog
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.*
|
||||||
|
import android.view.ViewGroup.MarginLayoutParams
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import com.gh.common.pop.EditBindPhoneInfoPop
|
||||||
|
import com.gh.common.pop.EditBindWechatPop
|
||||||
|
import com.gh.common.pop.RealNameTipsPop
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
|
import com.gh.gamecenter.common.utils.dip2px
|
||||||
|
import com.gh.gamecenter.common.utils.goneIf
|
||||||
|
import com.gh.gamecenter.common.utils.toObject
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
|
import com.gh.gamecenter.databinding.*
|
||||||
|
import com.gh.gamecenter.entity.ReserveReminderEntity
|
||||||
|
import com.gh.gamecenter.login.entity.UserInfoEntity
|
||||||
|
import com.gh.gamecenter.login.user.UserManager
|
||||||
|
import com.halo.assistant.HaloApp
|
||||||
|
import com.halo.assistant.fragment.reserve.OnReserveReminderListener
|
||||||
|
|
||||||
|
class ReserveSuccessReminderDialog(
|
||||||
|
context: Context,
|
||||||
|
themeResId: Int,
|
||||||
|
private val listener: OnReserveReminderListener
|
||||||
|
) :
|
||||||
|
Dialog(context, themeResId), OnReserveSuccessListener {
|
||||||
|
|
||||||
|
private var reserveReminder = ReserveReminderEntity()
|
||||||
|
|
||||||
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
|
private val handlers = arrayListOf<ReminderContentHandler>()
|
||||||
|
|
||||||
|
private lateinit var binding: DialogReserveSuccessWithSmsBinding
|
||||||
|
|
||||||
|
private val realNameQuestionPop by lazy {
|
||||||
|
RealNameTipsPop.create(context, listener)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var hasAutoPopped = false
|
||||||
|
private var isInit = true
|
||||||
|
|
||||||
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||||
|
if (event.action == MotionEvent.ACTION_UP) {
|
||||||
|
if (realNameQuestionPop.isShowing) {
|
||||||
|
realNameQuestionPop.dismiss()
|
||||||
|
return true
|
||||||
|
} else if (handlers.any { it.hasPopShowing }) {
|
||||||
|
handlers.forEach {
|
||||||
|
it.dismissPop()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onTouchEvent(event)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = DialogReserveSuccessWithSmsBinding.inflate(LayoutInflater.from(context))
|
||||||
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
binding.ivClose.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
binding.ivQuestion.setOnClickListener {
|
||||||
|
realNameQuestionPop.showAtLocation(binding.cbAutoDownload, Gravity.BOTTOM, 0, 4F.dip2px())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
handlers.clear()
|
||||||
|
binding.flContentContainer.removeAllViews()
|
||||||
|
|
||||||
|
val smsConfig = reserveReminder.smsConfig
|
||||||
|
val wechatConfig = reserveReminder.wechatConfig
|
||||||
|
when {
|
||||||
|
reserveReminder.onlyShowWechatReminder && !wechatConfig.isReminderEnable -> { // 只显示微信:未开启
|
||||||
|
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
|
||||||
|
arrayListOf(OnlyWechatReminderUnableHandler(16.dp, binding.flContentContainer, this))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reserveReminder.onlyShowWechatReminder && wechatConfig.isReminderEnable -> { // 只显示微信:已开
|
||||||
|
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
|
||||||
|
arrayListOf(
|
||||||
|
WechatReminderEnableHandler(
|
||||||
|
reserveReminder.wechatConfig.nickName,
|
||||||
|
8.dp,
|
||||||
|
binding.flContentContainer,
|
||||||
|
this
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
!smsConfig.notice && !wechatConfig.isReminderEnable -> { // 短信,微信未开启
|
||||||
|
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
|
||||||
|
arrayListOf(
|
||||||
|
SmsReminderUnableHandler(16.dp, binding.flContentContainer, this),
|
||||||
|
WechatReminderUnableHandler(8.dp, binding.flContentContainer, this)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
smsConfig.notice && wechatConfig.isReminderEnable -> {// 短信,微信已开启
|
||||||
|
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
|
||||||
|
arrayListOf(
|
||||||
|
SmsReminderEnableHandler(reserveReminder.smsConfig, 8.dp, binding.flContentContainer, this),
|
||||||
|
WechatReminderEnableHandler(
|
||||||
|
reserveReminder.wechatConfig.nickName,
|
||||||
|
8.dp,
|
||||||
|
binding.flContentContainer,
|
||||||
|
this
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
smsConfig.notice && !wechatConfig.isReminderEnable -> { // 短信开启,微信未开启
|
||||||
|
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
|
||||||
|
arrayListOf(
|
||||||
|
SmsReminderEnableHandler(smsConfig, 8.dp, binding.flContentContainer, this),
|
||||||
|
WechatReminderUnableHandler(16.dp, binding.flContentContainer, this)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
!smsConfig.notice && wechatConfig.isReminderEnable -> { // 微信开启,短信未开启
|
||||||
|
binding.tvContent.setText(R.string.reverse_success_with_reminder_tips)
|
||||||
|
arrayListOf(
|
||||||
|
WechatReminderEnableHandler(
|
||||||
|
wechatConfig.nickName,
|
||||||
|
8.dp,
|
||||||
|
binding.flContentContainer,
|
||||||
|
this
|
||||||
|
),
|
||||||
|
SmsReminderUnableHandler(16.dp, binding.flContentContainer, this)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
binding.tvContent.setText(R.string.reverse_success_without_reminder_tips)
|
||||||
|
arrayListOf()
|
||||||
|
}
|
||||||
|
}.let {
|
||||||
|
handlers.clear()
|
||||||
|
handlers.addAll(it)
|
||||||
|
}
|
||||||
|
handlers.forEach {
|
||||||
|
binding.flContentContainer.addView(it.init())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isInit) {
|
||||||
|
isInit = false
|
||||||
|
binding.gAutoDownload.goneIf(!reserveReminder.isEnableAutoDownload)
|
||||||
|
if (reserveReminder.isEnableAutoDownload) {
|
||||||
|
binding.cbAutoDownload.isChecked = reserveReminder.wifiAutoDownload
|
||||||
|
checkIfShowRealNamePop()
|
||||||
|
}
|
||||||
|
binding.cbAutoDownload.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
listener.enableAutoDownload(isChecked)
|
||||||
|
checkIfShowRealNamePop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkIfShowRealNamePop() {
|
||||||
|
if (hasAutoPopped) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hasAutoPopped = true
|
||||||
|
handler.postDelayed({
|
||||||
|
val idCard = UserManager.getInstance().userInfoEntity?.idCard
|
||||||
|
if (idCard != null && idCard.status != 1 && idCard.minor != true) {
|
||||||
|
// 账号已实名
|
||||||
|
return@postDelayed
|
||||||
|
}
|
||||||
|
|
||||||
|
val deviceCertificationInfoString =
|
||||||
|
SPUtils.getString(Constants.SP_DEVICE_CERTIFICATION_PREFIX + HaloApp.getInstance().gid)
|
||||||
|
if (!TextUtils.isEmpty(deviceCertificationInfoString)) {
|
||||||
|
val deviceIdCard = deviceCertificationInfoString.toObject<UserInfoEntity>()?.idCard
|
||||||
|
if (deviceIdCard != null && deviceIdCard.status != 1 && deviceIdCard.minor != true) {
|
||||||
|
// 设备已实名
|
||||||
|
return@postDelayed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
realNameQuestionPop.showAtLocation(binding.cbAutoDownload, Gravity.BOTTOM, 0, 0)
|
||||||
|
}, 16)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateSmsReminder(isEnable: Boolean) {
|
||||||
|
listener.updateSmsReminder(isEnable)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateWechatReminder() {
|
||||||
|
listener.updateWechatReminder()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun changePhoneNumber() {
|
||||||
|
listener.changedPhoneNumber()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun verifyPhoneNumber() {
|
||||||
|
listener.verifyPhoneNumber()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun changeWechatBinding() {
|
||||||
|
listener.changeWechatBinding()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
window?.let {
|
||||||
|
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
val params = it.attributes
|
||||||
|
params.width = DisplayUtils.dip2px(300F)
|
||||||
|
it.attributes = params
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateReserveReminder(reserveReminder: ReserveReminderEntity) {
|
||||||
|
this.reserveReminder = reserveReminder
|
||||||
|
initView()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dismiss() {
|
||||||
|
handler.removeCallbacksAndMessages(null)
|
||||||
|
super.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val Int.dp: Int
|
||||||
|
get() = DisplayUtils.dip2px(this.toFloat())
|
||||||
|
|
||||||
|
fun create(context: Context, listener: OnReserveReminderListener) =
|
||||||
|
ReserveSuccessReminderDialog(
|
||||||
|
context,
|
||||||
|
com.gh.gamecenter.common.R.style.DialogWindowTransparent,
|
||||||
|
listener
|
||||||
|
).apply {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class ReminderContentHandler(
|
||||||
|
val topMargin: Int,
|
||||||
|
val parent: ViewGroup,
|
||||||
|
val listener: OnReserveSuccessListener
|
||||||
|
) {
|
||||||
|
|
||||||
|
open val hasPopShowing: Boolean = false
|
||||||
|
|
||||||
|
fun init(): View {
|
||||||
|
val root = createView(LayoutInflater.from(parent.context))
|
||||||
|
root.updateLayoutParams<MarginLayoutParams> {
|
||||||
|
this.topMargin = this@ReminderContentHandler.topMargin
|
||||||
|
}
|
||||||
|
initView()
|
||||||
|
return root
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract fun createView(inflater: LayoutInflater): View
|
||||||
|
|
||||||
|
protected abstract fun initView()
|
||||||
|
|
||||||
|
open fun dismissPop() = Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
class SmsReminderUnableHandler(topMargin: Int, parent: ViewGroup, listener: OnReserveSuccessListener) :
|
||||||
|
ReminderContentHandler(topMargin, parent, listener) {
|
||||||
|
|
||||||
|
private lateinit var binding: LayoutReserveSmsReminderUnableBinding
|
||||||
|
|
||||||
|
override fun createView(inflater: LayoutInflater): View {
|
||||||
|
return LayoutReserveSmsReminderUnableBinding.inflate(inflater, parent, false)
|
||||||
|
.also {
|
||||||
|
binding = it
|
||||||
|
}.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
binding.vSmsAdd.setOnClickListener {
|
||||||
|
listener.updateSmsReminder(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class WechatReminderUnableHandler(topMargin: Int, parent: ViewGroup, listener: OnReserveSuccessListener) :
|
||||||
|
ReminderContentHandler(topMargin, parent, listener) {
|
||||||
|
|
||||||
|
private lateinit var binding: LayoutReserveWechatReminderUnableBinding
|
||||||
|
|
||||||
|
override fun createView(inflater: LayoutInflater): View {
|
||||||
|
return LayoutReserveWechatReminderUnableBinding.inflate(inflater, parent, false)
|
||||||
|
.also {
|
||||||
|
binding = it
|
||||||
|
}.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
binding.vWechatAdd.setOnClickListener {
|
||||||
|
listener.updateWechatReminder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class SmsReminderEnableHandler(
|
||||||
|
private val smsConfig: ReserveReminderEntity.SmsConfig,
|
||||||
|
topMargin: Int,
|
||||||
|
parent: ViewGroup, listener:
|
||||||
|
OnReserveSuccessListener
|
||||||
|
) :
|
||||||
|
ReminderContentHandler(topMargin, parent, listener) {
|
||||||
|
|
||||||
|
private lateinit var binding: LayoutReserveSmsReminderEnableBinding
|
||||||
|
|
||||||
|
override val hasPopShowing: Boolean
|
||||||
|
get() = editBindPhoneInfoPop.isShowing
|
||||||
|
|
||||||
|
override fun dismissPop() {
|
||||||
|
if (hasPopShowing) {
|
||||||
|
editBindPhoneInfoPop.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val editBindPhoneInfoPop by lazy {
|
||||||
|
EditBindPhoneInfoPop.create(parent.context, smsConfig.mobileValidated, listener)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createView(inflater: LayoutInflater) =
|
||||||
|
LayoutReserveSmsReminderEnableBinding.inflate(inflater, parent, false)
|
||||||
|
.also {
|
||||||
|
binding = it
|
||||||
|
}.root
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
binding.tvPhone.text = smsConfig.mobile
|
||||||
|
binding.vSmsEdit.setOnClickListener {
|
||||||
|
editBindPhoneInfoPop.showAsDropDown(
|
||||||
|
binding.ivSmsEdit,
|
||||||
|
(-104).dp,
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class WechatReminderEnableHandler(
|
||||||
|
private val nickName: String,
|
||||||
|
topMargin: Int,
|
||||||
|
parent: ViewGroup,
|
||||||
|
listener: OnReserveSuccessListener
|
||||||
|
) :
|
||||||
|
ReminderContentHandler(topMargin, parent, listener) {
|
||||||
|
|
||||||
|
private lateinit var binding: LayoutReserveWechatReminderEnableBinding
|
||||||
|
|
||||||
|
private val editWechatPop by lazy {
|
||||||
|
EditBindWechatPop.create(parent.context, listener)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createView(inflater: LayoutInflater) =
|
||||||
|
LayoutReserveWechatReminderEnableBinding.inflate(inflater, parent, false)
|
||||||
|
.also {
|
||||||
|
binding = it
|
||||||
|
}.root
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
binding.tvWechat.text = nickName
|
||||||
|
binding.vModifyWechat.setOnClickListener {
|
||||||
|
editWechatPop.showAsDropDown(
|
||||||
|
binding.ivModifyWechat,
|
||||||
|
(-104).dp,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class OnlyWechatReminderUnableHandler(topMargin: Int, parent: ViewGroup, listener: OnReserveSuccessListener) :
|
||||||
|
ReminderContentHandler(topMargin, parent, listener) {
|
||||||
|
|
||||||
|
private lateinit var binding: LayoutReserveOnlyWechatUnableBinding
|
||||||
|
|
||||||
|
override fun createView(inflater: LayoutInflater) =
|
||||||
|
LayoutReserveOnlyWechatUnableBinding.inflate(inflater, parent, false)
|
||||||
|
.also {
|
||||||
|
binding = it
|
||||||
|
}.root
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
binding.vSubmitBackground.setOnClickListener {
|
||||||
|
listener.updateWechatReminder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OnReserveSuccessListener {
|
||||||
|
|
||||||
|
fun updateSmsReminder(isEnable: Boolean)
|
||||||
|
|
||||||
|
fun updateWechatReminder()
|
||||||
|
|
||||||
|
fun changePhoneNumber()
|
||||||
|
|
||||||
|
fun verifyPhoneNumber()
|
||||||
|
|
||||||
|
fun changeWechatBinding()
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package com.gh.common.dialog
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||||
|
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.databinding.DialogWechatBindingConflictBinding
|
||||||
|
|
||||||
|
class WechatBindingConflictDialogFragment : BaseDialogFragment() {
|
||||||
|
|
||||||
|
private lateinit var binding: DialogWechatBindingConflictBinding
|
||||||
|
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
return super.onCreateDialog(savedInstanceState).apply {
|
||||||
|
setCanceledOnTouchOutside(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
|
return DialogWechatBindingConflictBinding.inflate(inflater, container, false)
|
||||||
|
.also {
|
||||||
|
binding = it
|
||||||
|
}.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
binding.tvIKnow.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
dialog?.window?.let {
|
||||||
|
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
val params = it.attributes
|
||||||
|
params.width = DisplayUtils.dip2px(300F)
|
||||||
|
it.attributes = params
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun show(context: Context) {
|
||||||
|
if (context is AppCompatActivity) {
|
||||||
|
context.supportFragmentManager
|
||||||
|
} else {
|
||||||
|
(CurrentActivityHolder.getCurrentActivity() as? AppCompatActivity)?.supportFragmentManager
|
||||||
|
}?.let {
|
||||||
|
WechatBindingConflictDialogFragment().show(it, WechatBindingConflictDialogFragment::class.java.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,125 @@
|
|||||||
|
package com.gh.common.dialog
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||||
|
import com.gh.gamecenter.common.entity.ErrorEntity
|
||||||
|
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.databinding.DialogWechatBindingFailedBinding
|
||||||
|
import com.gh.gamecenter.login.user.UserRepository
|
||||||
|
import com.lightgame.utils.Utils
|
||||||
|
|
||||||
|
class WechatBindingFailedDialogFragment : BaseDialogFragment() {
|
||||||
|
|
||||||
|
private lateinit var binding: DialogWechatBindingFailedBinding
|
||||||
|
|
||||||
|
private var currentUserId: String? = null
|
||||||
|
private lateinit var userConflict: ErrorEntity.Data.UserConflict
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
userConflict = arguments?.getParcelable(KEY_USER_CONFLICT) ?: ErrorEntity.Data.UserConflict()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
return super.onCreateDialog(savedInstanceState).apply {
|
||||||
|
setCanceledOnTouchOutside(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
|
return DialogWechatBindingFailedBinding.inflate(inflater, container, false)
|
||||||
|
.also {
|
||||||
|
binding = it
|
||||||
|
}.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
UserRepository.getInstance().loginUserInfo.observe(viewLifecycleOwner) {
|
||||||
|
currentUserId = it.data.getShortUserId()
|
||||||
|
binding.tvCurrentName.text = it.data.name
|
||||||
|
binding.ivCurrentAvatar.displayAvatar(it.data.icon)
|
||||||
|
binding.tvUserId.text = getString(R.string.user_id, currentUserId)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.tvConflictName.text = userConflict.name
|
||||||
|
binding.ivConflictAvatar.displayAvatar(userConflict.icon)
|
||||||
|
binding.tvConflictUserId.text = getString(R.string.user_id, userConflict.seq)
|
||||||
|
|
||||||
|
|
||||||
|
binding.tvConflictProblem.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
WechatBindingConflictDialogFragment.show(requireContext())
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.tvIKnow.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.tvUserId.setOnLongClickListener {
|
||||||
|
currentUserId?.let {
|
||||||
|
copyTextToClipboard(it)
|
||||||
|
true
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.tvConflictUserId.setOnLongClickListener {
|
||||||
|
copyTextToClipboard(userConflict.id)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun copyTextToClipboard(text: String) {
|
||||||
|
val clipboardManager = context?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
|
||||||
|
if (clipboardManager != null) {
|
||||||
|
val clip = ClipData.newPlainText(COPY_ID_TEXT, text)
|
||||||
|
clipboardManager.setPrimaryClip(clip)
|
||||||
|
Utils.toast(requireContext(), R.string.copy_user_id_successfully)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
dialog?.window?.let {
|
||||||
|
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
val params = it.attributes
|
||||||
|
params.width = DisplayUtils.dip2px(300F)
|
||||||
|
it.attributes = params
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
private const val COPY_ID_TEXT = "user_id"
|
||||||
|
private const val KEY_USER_CONFLICT = "key_user_conflict"
|
||||||
|
|
||||||
|
fun show(context: Context, userConflict: ErrorEntity.Data.UserConflict?) {
|
||||||
|
if (context is AppCompatActivity) {
|
||||||
|
context.supportFragmentManager
|
||||||
|
} else {
|
||||||
|
(CurrentActivityHolder.getCurrentActivity() as? AppCompatActivity)?.supportFragmentManager
|
||||||
|
}?.let {
|
||||||
|
val fragment = WechatBindingFailedDialogFragment().apply {
|
||||||
|
arguments = Bundle().apply {
|
||||||
|
putParcelable(KEY_USER_CONFLICT, userConflict)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fragment.show(it, WechatBindingFailedDialogFragment::class.java.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.recyclerview.widget.RecyclerView.LayoutManager
|
import androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||||
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||||
import io.reactivex.functions.Consumer
|
import io.reactivex.functions.Consumer
|
||||||
|
|
||||||
@ -16,8 +17,9 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
|
|||||||
|
|
||||||
val throttleBus: ExposureThrottleBus by lazy {
|
val throttleBus: ExposureThrottleBus by lazy {
|
||||||
ExposureThrottleBus(
|
ExposureThrottleBus(
|
||||||
Consumer { commitExposure(it) },
|
{ commitExposure(it) },
|
||||||
Consumer(Throwable::printStackTrace)
|
Consumer(Throwable::printStackTrace),
|
||||||
|
{ commitWXCPMExposure(it) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
var layoutManager: LayoutManager? = null
|
var layoutManager: LayoutManager? = null
|
||||||
@ -93,4 +95,32 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
|
|||||||
ExposureManager.log(eventList)
|
ExposureManager.log(eventList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小游戏CPM曝光事件接口上报,由于普通曝光事件的上报通道存在节流特性,不符合CPM接口对于数据上报的实时性和准确性的要求,所以使用额外的通道进行上报
|
||||||
|
*/
|
||||||
|
private fun commitWXCPMExposure(visibleState: ExposureThrottleBus.VisibleState) {
|
||||||
|
|
||||||
|
val eventList = arrayListOf<ExposureEvent>()
|
||||||
|
|
||||||
|
for (pos in visibleState.firstVisiblePosition..visibleState.lastVisiblePosition) {
|
||||||
|
try {
|
||||||
|
exposable.getEventByPosition(pos)?.let {
|
||||||
|
if (it.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
|
||||||
|
eventList.add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exposable.getEventListByPosition(pos)?.let { list ->
|
||||||
|
list.forEach {
|
||||||
|
if (it.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
|
||||||
|
eventList.add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ignore: Exception) {
|
||||||
|
// Just ignore the error.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ExposureManager.logCPM(eventList)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,13 +1,15 @@
|
|||||||
package com.gh.common.exposure
|
package com.gh.common.exposure
|
||||||
|
|
||||||
import com.aliyun.sls.android.producer.Log
|
|
||||||
import com.gh.gamecenter.BuildConfig
|
import com.gh.gamecenter.BuildConfig
|
||||||
import com.gh.gamecenter.common.loghub.LoghubHelper
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
|
import com.gh.gamecenter.common.loghub.TLogHubHelper
|
||||||
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
|
import com.gh.gamecenter.common.utils.FixedSizeLinkedHashSet
|
||||||
import com.gh.gamecenter.common.utils.toJson
|
import com.gh.gamecenter.common.utils.toJson
|
||||||
import com.gh.gamecenter.core.AppExecutor
|
import com.gh.gamecenter.core.AppExecutor
|
||||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||||
|
import com.gh.gamecenter.feature.minigame.wechat.WGameSubjectCPMListReportHelper
|
||||||
import com.lightgame.utils.Utils
|
import com.lightgame.utils.Utils
|
||||||
|
import com.volcengine.model.tls.LogItem
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A handful tool for committing logs to aliyun loghub.
|
* A handful tool for committing logs to aliyun loghub.
|
||||||
@ -32,6 +34,9 @@ object ExposureManager {
|
|||||||
*/
|
*/
|
||||||
fun log(event: ExposureEvent) {
|
fun log(event: ExposureEvent) {
|
||||||
AppExecutor.logExecutor.execute {
|
AppExecutor.logExecutor.execute {
|
||||||
|
if (event.payload.miniGameType == Constants.WECHAT_MINI_GAME_CPM) {
|
||||||
|
WGameSubjectCPMListReportHelper.reportExposure(event)
|
||||||
|
}
|
||||||
if (!exposureCache.contains(event.id)) {
|
if (!exposureCache.contains(event.id)) {
|
||||||
exposureSet.add(event)
|
exposureSet.add(event)
|
||||||
exposureCache.add(event.id)
|
exposureCache.add(event.id)
|
||||||
@ -58,6 +63,17 @@ object ExposureManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log a wechat mini game cpm collection of exposure event.
|
||||||
|
*/
|
||||||
|
fun logCPM(eventList: List<ExposureEvent>) {
|
||||||
|
AppExecutor.logExecutor.execute {
|
||||||
|
if (eventList.isNotEmpty()) {
|
||||||
|
WGameSubjectCPMListReportHelper.reportExposure(eventList.toSet())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param forcedUpload Ignore all restrictions.
|
* @param forcedUpload Ignore all restrictions.
|
||||||
*/
|
*/
|
||||||
@ -78,19 +94,20 @@ object ExposureManager {
|
|||||||
|
|
||||||
private fun uploadExposures(eventSet: HashSet<ExposureEvent>, forced: Boolean) {
|
private fun uploadExposures(eventSet: HashSet<ExposureEvent>, forced: Boolean) {
|
||||||
eventSet.forEach {
|
eventSet.forEach {
|
||||||
LoghubHelper.uploadLog(buildLog(it), LOG_STORE, forced)
|
TLogHubHelper.sendLog(buildLog(it), LOG_STORE)
|
||||||
|
// LoghubHelper.uploadLog(buildLog(it), LOG_STORE, forced)
|
||||||
// it.recycle()
|
// it.recycle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildLog(event: ExposureEvent) = Log().apply {
|
private fun buildLog(event: ExposureEvent) = LogItem(System.currentTimeMillis()).apply {
|
||||||
putContent("id", event.id)
|
addContent("__id", event.id)
|
||||||
putContent("payload", event.payload.toJson())
|
addContent("payload", event.payload.toJson())
|
||||||
putContent("event", event.event.toString())
|
addContent("event", event.event.toString())
|
||||||
putContent("source", eliminateMultipleBrackets(event.source.toJson()))
|
addContent("source", eliminateMultipleBrackets(event.source.toJson()))
|
||||||
putContent("meta", event.meta.toJson())
|
addContent("meta", event.meta.toJson())
|
||||||
putContent("real_millisecond", event.timeInMillisecond.toString())
|
addContent("real_millisecond", event.timeInMillisecond.toString())
|
||||||
putContent(
|
addContent(
|
||||||
"e-traces", if (event.eTrace != null) {
|
"e-traces", if (event.eTrace != null) {
|
||||||
eliminateMultipleBrackets(event.eTrace?.toJson() ?: "")
|
eliminateMultipleBrackets(event.eTrace?.toJson() ?: "")
|
||||||
} else ""
|
} else ""
|
||||||
|
|||||||
@ -3,16 +3,20 @@ package com.gh.common.exposure
|
|||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import io.reactivex.functions.Consumer
|
import io.reactivex.functions.Consumer
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.subjects.BehaviorSubject
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class ExposureThrottleBus(var onSuccess: Consumer<VisibleState>, var onError: Consumer<Throwable>) {
|
class ExposureThrottleBus(
|
||||||
|
var onSuccess: Consumer<VisibleState>,
|
||||||
|
var onError: Consumer<Throwable>,
|
||||||
|
onPreSuccess: Consumer<VisibleState>
|
||||||
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val THRESHOLD_TIME = 300L
|
private const val THRESHOLD_TIME = 300L
|
||||||
}
|
}
|
||||||
|
|
||||||
private val mPublishSubject: PublishSubject<VisibleState> = PublishSubject.create()
|
private val mPublishSubject: BehaviorSubject<VisibleState> = BehaviorSubject.create()
|
||||||
private val mCompositeDisposable: CompositeDisposable = CompositeDisposable()
|
private val mCompositeDisposable: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -24,6 +28,7 @@ class ExposureThrottleBus(var onSuccess: Consumer<VisibleState>, var onError: Co
|
|||||||
*/
|
*/
|
||||||
val disposable = mPublishSubject
|
val disposable = mPublishSubject
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
.doOnNext(onPreSuccess)
|
||||||
.throttleWithTimeout(THRESHOLD_TIME, TimeUnit.MILLISECONDS)
|
.throttleWithTimeout(THRESHOLD_TIME, TimeUnit.MILLISECONDS)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.subscribe(onSuccess, onError)
|
.subscribe(onSuccess, onError)
|
||||||
|
|||||||
@ -53,7 +53,6 @@ object ExposureUtils {
|
|||||||
return exposureEvent
|
return exposureEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun logADownloadCompleteExposureEvent(
|
fun logADownloadCompleteExposureEvent(
|
||||||
entity: GameEntity,
|
entity: GameEntity,
|
||||||
platform: String?,
|
platform: String?,
|
||||||
@ -61,6 +60,7 @@ object ExposureUtils {
|
|||||||
speed: Long,
|
speed: Long,
|
||||||
host: String? = "unknown",
|
host: String? = "unknown",
|
||||||
path: String? = "unknown",
|
path: String? = "unknown",
|
||||||
|
redirectedUrlList: String? = "unknown",
|
||||||
downloadType: DownloadType
|
downloadType: DownloadType
|
||||||
): ExposureEvent? {
|
): ExposureEvent? {
|
||||||
val gameEntity = entity.copy()
|
val gameEntity = entity.copy()
|
||||||
@ -88,6 +88,7 @@ object ExposureUtils {
|
|||||||
exposureEvent.payload.host = host
|
exposureEvent.payload.host = host
|
||||||
exposureEvent.payload.path = path
|
exposureEvent.payload.path = path
|
||||||
exposureEvent.payload.speed = speed
|
exposureEvent.payload.speed = speed
|
||||||
|
exposureEvent.payload.redirectedUrlList = redirectedUrlList
|
||||||
|
|
||||||
ExposureManager.log(exposureEvent)
|
ExposureManager.log(exposureEvent)
|
||||||
ExposureManager.commitSavedExposureEvents(forcedUpload = true)
|
ExposureManager.commitSavedExposureEvents(forcedUpload = true)
|
||||||
|
|||||||
@ -5,6 +5,6 @@ import com.gh.gamecenter.entity.BottomTab
|
|||||||
interface ISearchToolbarTab {
|
interface ISearchToolbarTab {
|
||||||
fun onScrollChanged(totalHeight: Int, offset: Int, isDarkModeChanged: Boolean)
|
fun onScrollChanged(totalHeight: Int, offset: Int, isDarkModeChanged: Boolean)
|
||||||
fun changeAppBarColor(color: Int, pageId: String)
|
fun changeAppBarColor(color: Int, pageId: String)
|
||||||
fun setSearchStyle(searchStyle: BottomTab.SearchStyle)
|
fun updateSearchStyle(searchStyle: BottomTab.SearchStyle)
|
||||||
fun getCurrentTabIndex(): Int?
|
fun getCurrentTabIndex(): Int?
|
||||||
}
|
}
|
||||||
44
app/src/main/java/com/gh/common/pop/BatchManagementPop.kt
Normal file
44
app/src/main/java/com/gh/common/pop/BatchManagementPop.kt
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package com.gh.common.pop
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
|
||||||
|
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupItemBinding
|
||||||
|
|
||||||
|
class BatchManagementPop(
|
||||||
|
binding: LayoutPopupContainerBinding,
|
||||||
|
private val listener: OnBatchManagementListener
|
||||||
|
) :
|
||||||
|
CommonPopupWindow(binding) {
|
||||||
|
override val viewDataList: List<ViewData>
|
||||||
|
get() = listOf(
|
||||||
|
ViewData(R.string.enable_automatic_downloading_in_batches) {
|
||||||
|
listener.enableAutoDownload()
|
||||||
|
},
|
||||||
|
ViewData(R.string.batch_management) {
|
||||||
|
listener.batchManage()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun create(context: Context, listener: OnBatchManagementListener): BatchManagementPop {
|
||||||
|
val binding = LayoutPopupContainerBinding.inflate(LayoutInflater.from(context))
|
||||||
|
return BatchManagementPop(binding, listener).apply {
|
||||||
|
initView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OnBatchManagementListener {
|
||||||
|
|
||||||
|
fun enableAutoDownload()
|
||||||
|
|
||||||
|
fun batchManage()
|
||||||
|
}
|
||||||
|
}
|
||||||
49
app/src/main/java/com/gh/common/pop/CancelReservePop.kt
Normal file
49
app/src/main/java/com/gh/common/pop/CancelReservePop.kt
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package com.gh.common.pop
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
|
||||||
|
import com.gh.gamecenter.feature.entity.GameEntity
|
||||||
|
|
||||||
|
class CancelReservePop(
|
||||||
|
private val game: GameEntity,
|
||||||
|
binding: LayoutPopupContainerBinding,
|
||||||
|
private val listener: OnCancelReserveListener
|
||||||
|
|
||||||
|
) : CommonPopupWindow(binding) {
|
||||||
|
|
||||||
|
override val viewDataList: List<ViewData>
|
||||||
|
get() {
|
||||||
|
val list = arrayListOf<ViewData>()
|
||||||
|
if (game.wifiAutoDownloadEnable) {
|
||||||
|
list.add(ViewData(if (game.wifiAutoDownload) R.string.cancel_auto_download_with_wifi else R.string.enable_automatic_downloading_with_wifi) {
|
||||||
|
listener.enableAutoDownload(!game.wifiAutoDownload)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
list.add(ViewData(R.string.cancel_reserve, listener::cancelReserve))
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun create(
|
||||||
|
game: GameEntity,
|
||||||
|
context: Context,
|
||||||
|
listener: OnCancelReserveListener
|
||||||
|
): CancelReservePop {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
val binding = LayoutPopupContainerBinding.inflate(inflater)
|
||||||
|
return CancelReservePop(game, binding, listener).apply {
|
||||||
|
initView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OnCancelReserveListener {
|
||||||
|
|
||||||
|
fun enableAutoDownload(isEnable: Boolean)
|
||||||
|
|
||||||
|
fun cancelReserve()
|
||||||
|
}
|
||||||
|
}
|
||||||
47
app/src/main/java/com/gh/common/pop/CommonPopupWindow.kt
Normal file
47
app/src/main/java/com/gh/common/pop/CommonPopupWindow.kt
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package com.gh.common.pop
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
|
||||||
|
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupBinding
|
||||||
|
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupItemBinding
|
||||||
|
import com.gh.gamecenter.databinding.LayoutPopupOptionItemBinding
|
||||||
|
import com.gh.gamecenter.databinding.LayoutPopupReserveReminderOptionItemBinding
|
||||||
|
|
||||||
|
abstract class CommonPopupWindow(
|
||||||
|
private val binding: LayoutPopupContainerBinding,
|
||||||
|
) : BugFixedPopupWindow(binding.root, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
|
||||||
|
|
||||||
|
private val inflater = LayoutInflater.from(binding.root.context)
|
||||||
|
|
||||||
|
abstract val viewDataList: List<ViewData>
|
||||||
|
|
||||||
|
fun initView() {
|
||||||
|
isFocusable = true
|
||||||
|
binding.container.updateLayoutParams<ViewGroup.LayoutParams> {
|
||||||
|
width = DisplayUtils.dip2px(128F)
|
||||||
|
}
|
||||||
|
viewDataList.forEach {
|
||||||
|
addItemView(it.textResId, it.click)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addItemView(textResId: Int, click: () -> Unit) =
|
||||||
|
LayoutPopupReserveReminderOptionItemBinding.inflate(inflater, binding.container, false)
|
||||||
|
.also {
|
||||||
|
it.hintText.setText(textResId)
|
||||||
|
binding.container.addView(it.root)
|
||||||
|
it.root.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
click()
|
||||||
|
}
|
||||||
|
}.root
|
||||||
|
|
||||||
|
data class ViewData(
|
||||||
|
val textResId: Int,
|
||||||
|
val click: () -> Unit
|
||||||
|
)
|
||||||
|
}
|
||||||
70
app/src/main/java/com/gh/common/pop/EditBindPhoneInfoPop.kt
Normal file
70
app/src/main/java/com/gh/common/pop/EditBindPhoneInfoPop.kt
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package com.gh.common.pop
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import com.gh.common.dialog.OnReserveSuccessListener
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
|
||||||
|
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupItemBinding
|
||||||
|
|
||||||
|
class EditBindPhoneInfoPop(
|
||||||
|
private val hasValidated: Boolean,
|
||||||
|
private val binding: LayoutPopupContainerBinding,
|
||||||
|
private val listener: OnReserveSuccessListener
|
||||||
|
) : BugFixedPopupWindow(binding.root, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
|
||||||
|
|
||||||
|
private val context
|
||||||
|
get() = binding.root.context
|
||||||
|
|
||||||
|
init {
|
||||||
|
initView()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
isOutsideTouchable = false
|
||||||
|
isFocusable = true
|
||||||
|
binding.container.updateLayoutParams<ViewGroup.LayoutParams> {
|
||||||
|
width = DisplayUtils.dip2px(128F)
|
||||||
|
}
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
fun createItemView(textResId: Int) =
|
||||||
|
LayoutAddKaifuPopupItemBinding.inflate(inflater, binding.container, false)
|
||||||
|
.also {
|
||||||
|
it.hintText.setText(textResId)
|
||||||
|
binding.container.addView(it.root)
|
||||||
|
}.root
|
||||||
|
|
||||||
|
val tvChangePhoneNumber = createItemView(R.string.change_phone_number)
|
||||||
|
if(!hasValidated){
|
||||||
|
val tvVerifyPhoneNumber = createItemView(R.string.verify_phone_number)
|
||||||
|
tvVerifyPhoneNumber.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
listener.verifyPhoneNumber()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val tvTurnOffSmsReminder = createItemView(R.string.turn_off_sms_reminders)
|
||||||
|
|
||||||
|
tvChangePhoneNumber.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
listener.changePhoneNumber()
|
||||||
|
}
|
||||||
|
|
||||||
|
tvTurnOffSmsReminder.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
listener.updateSmsReminder(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun create(context: Context, hasValidated: Boolean, listener: OnReserveSuccessListener): EditBindPhoneInfoPop {
|
||||||
|
val binding = LayoutPopupContainerBinding.inflate(LayoutInflater.from(context))
|
||||||
|
return EditBindPhoneInfoPop(hasValidated, binding, listener)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/src/main/java/com/gh/common/pop/EditBindWechatPop.kt
Normal file
26
app/src/main/java/com/gh/common/pop/EditBindWechatPop.kt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.gh.common.pop
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import com.gh.common.dialog.OnReserveSuccessListener
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
|
||||||
|
|
||||||
|
class EditBindWechatPop(
|
||||||
|
binding: LayoutPopupContainerBinding,
|
||||||
|
private val listener: OnReserveSuccessListener
|
||||||
|
) : CommonPopupWindow(binding) {
|
||||||
|
|
||||||
|
override val viewDataList: List<ViewData>
|
||||||
|
get() = listOf(
|
||||||
|
ViewData(R.string.change_the_wechat_binding, listener::changeWechatBinding)
|
||||||
|
)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun create(context: Context, listener: OnReserveSuccessListener): EditBindWechatPop {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
return EditBindWechatPop(LayoutPopupContainerBinding.inflate(inflater), listener).apply { initView() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
69
app/src/main/java/com/gh/common/pop/RealNameTipsPop.kt
Normal file
69
app/src/main/java/com/gh/common/pop/RealNameTipsPop.kt
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package com.gh.common.pop
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.text.SpannableString
|
||||||
|
import android.text.TextPaint
|
||||||
|
import android.text.method.LinkMovementMethod
|
||||||
|
import android.text.style.ClickableSpan
|
||||||
|
import android.text.style.ForegroundColorSpan
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import androidx.core.text.set
|
||||||
|
import com.gh.common.dialog.OnReserveSuccessListener
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.utils.toColor
|
||||||
|
import com.gh.gamecenter.common.utils.toResString
|
||||||
|
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.databinding.PopRealNameTipsBinding
|
||||||
|
import com.halo.assistant.fragment.reserve.OnReserveReminderListener
|
||||||
|
|
||||||
|
class RealNameTipsPop(
|
||||||
|
private val binding: PopRealNameTipsBinding,
|
||||||
|
private val listener: OnReserveReminderListener
|
||||||
|
) :
|
||||||
|
BugFixedPopupWindow(binding.root, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
|
||||||
|
|
||||||
|
private val context: Context
|
||||||
|
get() = binding.root.context
|
||||||
|
|
||||||
|
init {
|
||||||
|
initView()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
|
||||||
|
val text = R.string.reserve_real_name_description.toResString()
|
||||||
|
val spannableString = SpannableString(text)
|
||||||
|
val clickSpan = object : ClickableSpan() {
|
||||||
|
override fun updateDrawState(ds: TextPaint) {
|
||||||
|
ds.bgColor = Color.TRANSPARENT
|
||||||
|
ds.setColor(com.gh.gamecenter.common.R.color.text_theme.toColor(context))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(widget: View) {
|
||||||
|
dismiss()
|
||||||
|
listener.realName()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spannableString.set(start = text.length - 6, end = text.length, span = clickSpan)
|
||||||
|
binding.tvRealNameDescription.text = spannableString
|
||||||
|
|
||||||
|
binding.tvRealNameDescription.movementMethod = LinkMovementMethod.getInstance()
|
||||||
|
binding.tvRealNameDescription.setHighlightColor(Color.TRANSPARENT)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun create(context: Context, listener: OnReserveReminderListener): RealNameTipsPop {
|
||||||
|
val pop = RealNameTipsPop(PopRealNameTipsBinding.inflate(LayoutInflater.from(context)), listener)
|
||||||
|
pop.isFocusable = true
|
||||||
|
pop.isOutsideTouchable = false
|
||||||
|
return pop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
95
app/src/main/java/com/gh/common/pop/ReserveAllSelectPop.kt
Normal file
95
app/src/main/java/com/gh/common/pop/ReserveAllSelectPop.kt
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
package com.gh.common.pop
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.CompoundButton
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.gh.gamecenter.R
|
||||||
|
import com.gh.gamecenter.common.utils.dip2px
|
||||||
|
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||||
|
import com.gh.gamecenter.databinding.PopReserveAllSelectBinding
|
||||||
|
import com.gh.gamecenter.mygame.MyReservationFragment
|
||||||
|
|
||||||
|
class ReserveAllSelectPop(
|
||||||
|
val binding: PopReserveAllSelectBinding,
|
||||||
|
private val listener: OnReserveAllSelectListener
|
||||||
|
) : BugFixedPopupWindow(binding.root, ViewGroup.LayoutParams.MATCH_PARENT, 56F.dip2px()) {
|
||||||
|
|
||||||
|
private var pageStatus: MyReservationFragment.ReservePageState =
|
||||||
|
MyReservationFragment.ReservePageState.EnableAutoDownload
|
||||||
|
|
||||||
|
private val onCheckedChangeListener = { _: CompoundButton, isChecked: Boolean ->
|
||||||
|
val count = listener.selectAll(isChecked)
|
||||||
|
updateSelectedCount(count)
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
isOutsideTouchable = false
|
||||||
|
binding.cbAll.setOnCheckedChangeListener(onCheckedChangeListener)
|
||||||
|
binding.tvSubmit.setOnClickListener {
|
||||||
|
listener.submit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun show(state: MyReservationFragment.ReservePageState, context: Context) {
|
||||||
|
enableSubmit(false)
|
||||||
|
binding.tvSubmit.setText(
|
||||||
|
if (state == MyReservationFragment.ReservePageState.EnableAutoDownload) {
|
||||||
|
R.string.enable_automatic_downloading_with_wifi
|
||||||
|
} else {
|
||||||
|
R.string.cancel_reserve
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 清空上一次的状态
|
||||||
|
pageStatus = state
|
||||||
|
updateSelectedCount(0)
|
||||||
|
|
||||||
|
if (!isShowing) {
|
||||||
|
showAtLocation((context as AppCompatActivity).window.decorView, Gravity.BOTTOM, 0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateSelectedCount(count: Int) {
|
||||||
|
if (count == 0) {
|
||||||
|
enableSubmit(false)
|
||||||
|
|
||||||
|
binding.cbAll.setOnCheckedChangeListener(null)
|
||||||
|
binding.cbAll.isChecked = false
|
||||||
|
binding.cbAll.setOnCheckedChangeListener(onCheckedChangeListener)
|
||||||
|
} else {
|
||||||
|
enableSubmit(true)
|
||||||
|
binding.tvNumber.text = binding.root.context.getString(R.string.count_with_parentheses, "$count")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun enableSubmit(isEnable: Boolean) {
|
||||||
|
binding.tvSubmit.isEnabled = isEnable
|
||||||
|
if (isEnable) {
|
||||||
|
binding.tvSubmit.alpha = 1F
|
||||||
|
} else {
|
||||||
|
binding.tvSubmit.alpha = 0.4F
|
||||||
|
binding.tvNumber.setText(null)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun create(context: Context, listener: OnReserveAllSelectListener): ReserveAllSelectPop {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
return ReserveAllSelectPop(PopReserveAllSelectBinding.inflate(inflater), listener)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OnReserveAllSelectListener {
|
||||||
|
|
||||||
|
fun selectAll(isChecked: Boolean): Int
|
||||||
|
|
||||||
|
fun submit()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,12 @@
|
|||||||
package com.gh.common.prioritychain
|
package com.gh.common.prioritychain
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
|
import android.os.Handler
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import com.gh.common.util.NewFlatLogUtils
|
import com.gh.common.util.NewFlatLogUtils
|
||||||
import com.gh.gamecenter.GameDetailActivity
|
import com.gh.gamecenter.GameDetailActivity
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.common.base.fragment.BaseFragment
|
|
||||||
import com.gh.gamecenter.common.constant.Constants
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
@ -19,7 +18,7 @@ import com.gh.gamecenter.wrapper.MainWrapperViewModel
|
|||||||
class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priority) {
|
class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||||
|
|
||||||
private var mActivity: Activity? = null
|
private var mActivity: Activity? = null
|
||||||
private var mBaseHandler: BaseFragment.BaseHandler? = null
|
private var mHandler: Handler? = null
|
||||||
private var mGameList: List<GameEntity>? = null
|
private var mGameList: List<GameEntity>? = null
|
||||||
private var mViewModel: MainWrapperViewModel? = null
|
private var mViewModel: MainWrapperViewModel? = null
|
||||||
|
|
||||||
@ -28,13 +27,13 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
|||||||
*/
|
*/
|
||||||
fun doPreProcess(
|
fun doPreProcess(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
baseHandler: BaseFragment.BaseHandler,
|
handler: Handler,
|
||||||
gameEntityList: List<GameEntity>?,
|
gameEntityList: List<GameEntity>?,
|
||||||
viewModel: MainWrapperViewModel
|
viewModel: MainWrapperViewModel
|
||||||
) {
|
) {
|
||||||
mActivity = activity
|
mActivity = activity
|
||||||
mGameList = gameEntityList
|
mGameList = gameEntityList
|
||||||
mBaseHandler = baseHandler
|
mHandler = handler
|
||||||
mViewModel = viewModel
|
mViewModel = viewModel
|
||||||
|
|
||||||
if (getStatus() == STATUS_PENDING) {
|
if (getStatus() == STATUS_PENDING) {
|
||||||
@ -59,7 +58,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
|||||||
val accelerateSet =
|
val accelerateSet =
|
||||||
HashSet(SPUtils.getStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET))
|
HashSet(SPUtils.getStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET))
|
||||||
if (!mGameList.isNullOrEmpty() && !accelerateSet.contains(mGameList!![0].messageId)) {
|
if (!mGameList.isNullOrEmpty() && !accelerateSet.contains(mGameList!![0].messageId)) {
|
||||||
showAccelerateNotificationPopupWindow(mActivity!!, mViewModel, mBaseHandler, mGameList!![0]) {
|
showAccelerateNotificationPopupWindow(mActivity!!, mViewModel, mHandler, mGameList!![0]) {
|
||||||
processNext()
|
processNext()
|
||||||
}
|
}
|
||||||
accelerateSet.add(mGameList!![0].messageId)
|
accelerateSet.add(mGameList!![0].messageId)
|
||||||
@ -82,7 +81,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
|||||||
fun showAccelerateNotificationPopupWindow(
|
fun showAccelerateNotificationPopupWindow(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
viewModel: MainWrapperViewModel?,
|
viewModel: MainWrapperViewModel?,
|
||||||
baseHandler: BaseFragment.BaseHandler?,
|
handler: Handler?,
|
||||||
gameEntity: GameEntity?,
|
gameEntity: GameEntity?,
|
||||||
dismissCallback: (() -> Unit)?
|
dismissCallback: (() -> Unit)?
|
||||||
) {
|
) {
|
||||||
@ -121,7 +120,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
|||||||
isTouchable = true
|
isTouchable = true
|
||||||
isFocusable = true
|
isFocusable = true
|
||||||
isOutsideTouchable = true
|
isOutsideTouchable = true
|
||||||
animationStyle = R.style.popup_window_ease_in_and_out_anim_style
|
animationStyle = com.gh.gamecenter.common.R.style.popup_window_ease_in_and_out_anim_style
|
||||||
showAtLocation(
|
showAtLocation(
|
||||||
activity.window.decorView,
|
activity.window.decorView,
|
||||||
Gravity.TOP,
|
Gravity.TOP,
|
||||||
@ -131,7 +130,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
|||||||
setOnDismissListener {
|
setOnDismissListener {
|
||||||
dismissCallback?.invoke()
|
dismissCallback?.invoke()
|
||||||
}
|
}
|
||||||
baseHandler?.postDelayed({ dismiss() }, 5000)
|
handler?.postDelayed({ dismiss() }, 5000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,168 @@
|
|||||||
|
package com.gh.common.prioritychain
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Handler
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.PopupWindow
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
|
import com.gh.gamecenter.common.utils.dip2px
|
||||||
|
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
|
import com.gh.gamecenter.databinding.PopupBottomTabGuideBinding
|
||||||
|
import com.gh.gamecenter.entity.BottomTab
|
||||||
|
|
||||||
|
class BottomTabGuideHandler(priority: Int): PriorityChainHandler(priority) {
|
||||||
|
private var mActivity: Activity? = null
|
||||||
|
private var mHandler: Handler? = null
|
||||||
|
private var mViewPager: ViewGroup? = null
|
||||||
|
private var mGuide: BottomTab.Guide? = null
|
||||||
|
private var mTriangleTransX = 0F
|
||||||
|
private var mGuideTransX = 0F
|
||||||
|
private var mRestWidth = 0F
|
||||||
|
private var mIsCenterPosition = false
|
||||||
|
private var mIsRightPosition = false
|
||||||
|
|
||||||
|
private var mPopupWindow: PopupWindow? = null
|
||||||
|
|
||||||
|
fun doPreProcess(
|
||||||
|
shouldShow: Boolean,
|
||||||
|
activity: Activity? = null,
|
||||||
|
handler: Handler? = null,
|
||||||
|
viewPager: ViewGroup? = null,
|
||||||
|
guide: BottomTab.Guide? = null,
|
||||||
|
triangleTransX: Float = 0F,
|
||||||
|
guideTransX: Float = 0F,
|
||||||
|
restWidth: Float = 0F,
|
||||||
|
isCenterPosition: Boolean = false,
|
||||||
|
isRightPosition: Boolean = false
|
||||||
|
) {
|
||||||
|
mActivity = activity
|
||||||
|
mHandler = handler
|
||||||
|
mViewPager = viewPager
|
||||||
|
mGuide = guide
|
||||||
|
mTriangleTransX = triangleTransX
|
||||||
|
mGuideTransX = guideTransX
|
||||||
|
mRestWidth = restWidth
|
||||||
|
mIsCenterPosition = isCenterPosition
|
||||||
|
mIsRightPosition = isRightPosition
|
||||||
|
|
||||||
|
if (getStatus() == STATUS_PENDING) {
|
||||||
|
if (shouldShow) {
|
||||||
|
updateStatus(STATUS_VALID)
|
||||||
|
process()
|
||||||
|
} else {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (shouldShow) {
|
||||||
|
updateStatus(STATUS_VALID)
|
||||||
|
} else {
|
||||||
|
updateStatus(STATUS_INVALID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProcess(): Boolean {
|
||||||
|
when (getStatus()) {
|
||||||
|
STATUS_VALID -> {
|
||||||
|
if (mGuide == null || mActivity == null || mViewPager == null) {
|
||||||
|
processNext()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
val guideSet = HashSet(SPUtils.getStringSet(Constants.SP_BOTTOM_TAB_GUIDE_SET))
|
||||||
|
if (!guideSet.contains(mGuide?.bottomTabId + mGuide?.text)) {
|
||||||
|
mPopupWindow = showBottomTabPopupWindow(
|
||||||
|
mActivity!!,
|
||||||
|
mHandler,
|
||||||
|
mViewPager!!,
|
||||||
|
mGuide!!,
|
||||||
|
mTriangleTransX,
|
||||||
|
mGuideTransX,
|
||||||
|
mRestWidth,
|
||||||
|
mIsCenterPosition,
|
||||||
|
mIsRightPosition
|
||||||
|
) {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
guideSet.add(mGuide?.bottomTabId + mGuide?.text)
|
||||||
|
SPUtils.setStringSet(Constants.SP_BOTTOM_TAB_GUIDE_SET, guideSet)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
STATUS_INVALID -> {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dismiss() {
|
||||||
|
if (mPopupWindow?.isShowing == true) {
|
||||||
|
mPopupWindow?.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val KEY_BOTTOM_TAB_GUIDE_AUTO_DISMISS = 100
|
||||||
|
private const val AUTO_DISMISS_DELAY_TIME = 5000L
|
||||||
|
|
||||||
|
fun showBottomTabPopupWindow(
|
||||||
|
activity: Activity,
|
||||||
|
handler: Handler?,
|
||||||
|
viewPager: ViewGroup,
|
||||||
|
guide: BottomTab.Guide,
|
||||||
|
triangleTransX: Float,
|
||||||
|
guideTransX: Float,
|
||||||
|
restWidth: Float,
|
||||||
|
isCenterPosition: Boolean,
|
||||||
|
isRightPosition: Boolean,
|
||||||
|
dismissCallback: (() -> Unit)?
|
||||||
|
): PopupWindow {
|
||||||
|
val binding = PopupBottomTabGuideBinding.inflate(LayoutInflater.from(activity))
|
||||||
|
binding.guideTv.text = guide.text
|
||||||
|
binding.guideTriangleIv.translationX = triangleTransX
|
||||||
|
binding.guideTv.translationX = guideTransX
|
||||||
|
binding.guideIconIv.translationX = guideTransX
|
||||||
|
binding.guideTv.updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||||
|
horizontalBias = if (isCenterPosition) 0.5F else if (isRightPosition) 1F else 0F
|
||||||
|
}
|
||||||
|
|
||||||
|
val popupWindow = BugFixedPopupWindow(
|
||||||
|
binding.root,
|
||||||
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
popupWindow.contentView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
|
||||||
|
val measureWidth = popupWindow.contentView.measuredWidth
|
||||||
|
val measureHeight = popupWindow.contentView.measuredHeight
|
||||||
|
if (measureWidth > restWidth) {
|
||||||
|
binding.guideTv.translationX = 0F
|
||||||
|
binding.guideIconIv.translationX = 0F
|
||||||
|
}
|
||||||
|
|
||||||
|
return popupWindow.apply {
|
||||||
|
isFocusable = false
|
||||||
|
isOutsideTouchable = false
|
||||||
|
animationStyle = com.gh.gamecenter.common.R.style.popup_window_ease_in_and_out_anim_style
|
||||||
|
setOnDismissListener {
|
||||||
|
dismissCallback?.invoke()
|
||||||
|
}
|
||||||
|
handler?.post {
|
||||||
|
if (!activity.isFinishing) {
|
||||||
|
showAsDropDown(viewPager, 0, 8F.dip2px() - measureHeight)
|
||||||
|
}
|
||||||
|
handler.sendEmptyMessageDelayed(KEY_BOTTOM_TAB_GUIDE_AUTO_DISMISS, AUTO_DISMISS_DELAY_TIME)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package com.gh.common.prioritychain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import com.airbnb.lottie.LottieAnimationView
|
||||||
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
|
import com.gh.gamecenter.databinding.LayoutCommunityHomeVideoGuideBinding
|
||||||
|
|
||||||
|
class CommunityHomeGuideHandler(
|
||||||
|
priority: Int,
|
||||||
|
private val context: Context,
|
||||||
|
private val decorView: FrameLayout?,
|
||||||
|
private val videoLottie: LottieAnimationView?
|
||||||
|
) : PriorityChainHandler(priority) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
updateStatus(STATUS_VALID)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProcess(): Boolean {
|
||||||
|
return if (SPUtils.getBoolean(Constants.SP_SHOW_COMMUNITY_HOME_VIDEO_GUIDE, true)) {
|
||||||
|
showHomeVideoGuide(context, decorView, videoLottie)
|
||||||
|
processNext()
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
processNext()
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun showHomeVideoGuide(context: Context, decorView: FrameLayout?, videoLottie: LottieAnimationView?) {
|
||||||
|
val guideLayoutBinding = LayoutCommunityHomeVideoGuideBinding.inflate(
|
||||||
|
LayoutInflater.from(context),
|
||||||
|
decorView,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
guideLayoutBinding.root.setOnClickListener { view ->
|
||||||
|
decorView?.removeView(view)
|
||||||
|
SPUtils.setBoolean(Constants.SP_SHOW_COMMUNITY_HOME_VIDEO_GUIDE, false)
|
||||||
|
|
||||||
|
videoLottie?.playAnimation()
|
||||||
|
SPUtils.setLong(
|
||||||
|
Constants.SP_COMMUNITY_HOME_VIDEO_LOTTIE_LAST_PLAY_TIME,
|
||||||
|
System.currentTimeMillis()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@ package com.gh.common.prioritychain
|
|||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import com.gh.gamecenter.floatingwindow.FloatingWindowEntity
|
import com.gh.gamecenter.feature.entity.FloatingWindowEntity
|
||||||
import com.gh.gamecenter.livedata.Event
|
import com.gh.gamecenter.livedata.Event
|
||||||
|
|
||||||
class CustomFloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
|
class CustomFloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||||
@ -60,7 +60,7 @@ class CustomFloatingWindowHandler(priority: Int) : PriorityChainHandler(priority
|
|||||||
when (getStatus()) {
|
when (getStatus()) {
|
||||||
STATUS_VALID -> {
|
STATUS_VALID -> {
|
||||||
_showFloatingAction.value = Event(data)
|
_showFloatingAction.value = Event(data)
|
||||||
processNext()
|
return true
|
||||||
// floatingWindowProvider.showFloatingWindowOnly(
|
// floatingWindowProvider.showFloatingWindowOnly(
|
||||||
// mFragment!!,
|
// mFragment!!,
|
||||||
// mRecyclerView!!,
|
// mRecyclerView!!,
|
||||||
@ -79,4 +79,9 @@ class CustomFloatingWindowHandler(priority: Int) : PriorityChainHandler(priority
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun dismiss() {
|
||||||
|
if (getStatus() == STATUS_HANDLING || getStatus() == STATUS_VALID) {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -5,21 +5,35 @@ import android.app.Activity
|
|||||||
import android.app.Application.ActivityLifecycleCallbacks
|
import android.app.Application.ActivityLifecycleCallbacks
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.preference.PreferenceManager
|
import android.preference.PreferenceManager
|
||||||
|
import android.text.TextUtils
|
||||||
|
import androidx.annotation.WorkerThread
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import com.gh.common.iinterface.ISuperiorChain
|
import com.gh.common.iinterface.ISuperiorChain
|
||||||
import com.gh.common.util.CheckLoginUtils
|
import com.gh.common.util.CheckLoginUtils
|
||||||
import com.gh.common.util.PackageUtils
|
import com.gh.common.util.PackageUtils
|
||||||
|
import com.gh.download.DownloadManager
|
||||||
|
import com.gh.gamecenter.SplashAdActivity
|
||||||
import com.gh.gamecenter.SplashScreenActivity
|
import com.gh.gamecenter.SplashScreenActivity
|
||||||
import com.gh.gamecenter.common.constant.Constants
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
import com.gh.gamecenter.common.entity.SimpleGameEntity
|
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||||
|
import com.gh.gamecenter.common.utils.*
|
||||||
|
import com.gh.gamecenter.core.AppExecutor
|
||||||
|
import com.gh.gamecenter.core.runOnIoThread
|
||||||
import com.gh.gamecenter.core.utils.SPUtils
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils.getBoolean
|
||||||
|
import com.gh.gamecenter.core.utils.ToastUtils
|
||||||
import com.gh.gamecenter.entity.DialogEntity
|
import com.gh.gamecenter.entity.DialogEntity
|
||||||
|
import com.gh.gamecenter.feature.entity.GameEntity
|
||||||
|
import com.gh.gamecenter.feature.entity.ReserveOnlineEntity
|
||||||
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
|
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
|
||||||
|
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||||
|
import com.gh.gamecenter.hud.PendingInstallHUDHandler
|
||||||
|
import com.gh.gamecenter.hud.ResumeDownloadHudHandler
|
||||||
|
import com.gh.gamecenter.login.entity.UserInfoEntity
|
||||||
import com.gh.gamecenter.login.user.UserManager
|
import com.gh.gamecenter.login.user.UserManager
|
||||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||||
import com.halo.assistant.HaloApp
|
import com.halo.assistant.HaloApp
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,6 +45,7 @@ import io.reactivex.schedulers.Schedulers
|
|||||||
object GlobalPriorityChainHelper : ISuperiorChain {
|
object GlobalPriorityChainHelper : ISuperiorChain {
|
||||||
|
|
||||||
private val api = RetrofitManager.getInstance().api
|
private val api = RetrofitManager.getInstance().api
|
||||||
|
private val newApi = RetrofitManager.getInstance().newApi
|
||||||
private var inferiorChain: PriorityChain? = null
|
private var inferiorChain: PriorityChain? = null
|
||||||
private val mainChain: PriorityChain by lazy { PriorityChain { inferiorChain?.start() } }
|
private val mainChain: PriorityChain by lazy { PriorityChain { inferiorChain?.start() } }
|
||||||
|
|
||||||
@ -42,18 +57,21 @@ object GlobalPriorityChainHelper : ISuperiorChain {
|
|||||||
return activity is FragmentActivity
|
return activity is FragmentActivity
|
||||||
&& !activity.isFinishing
|
&& !activity.isFinishing
|
||||||
&& activity !is SplashScreenActivity
|
&& activity !is SplashScreenActivity
|
||||||
|
&& activity !is SplashAdActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预启动所有的优先级弹窗管理链
|
* 预启动所有的优先级弹窗管理链
|
||||||
*/
|
*/
|
||||||
fun preStart() {
|
fun preStart(withSpecialDelay: Boolean) {
|
||||||
val launchRedirectHandler = LaunchRedirectHandler(-101)
|
val launchRedirectHandler = LaunchRedirectHandler(-101)
|
||||||
val updateDialogHandler = UpdateDialogHandler(-100)
|
val updateDialogHandler = UpdateDialogHandler(-100)
|
||||||
val privacyPolicyDialogHandler = PrivacyPolicyDialogHandler(-99)
|
val privacyPolicyDialogHandler = PrivacyPolicyDialogHandler(-99)
|
||||||
val notificationPermissionDialogHandler = NotificationPermissionDialogHandler(0)
|
val notificationPermissionDialogHandler = NotificationPermissionDialogHandler(0)
|
||||||
val reserveDialogHandler = ReserveDialogHandler(1)
|
val reserveDialogHandler = ReserveDialogHandler(1)
|
||||||
val welcomeDialogHandler = WelcomeDialogHandler(2)
|
val welcomeDialogHandler = WelcomeDialogHandler(2)
|
||||||
|
val pendingInstallHandler = PendingInstallHUDHandler(3)
|
||||||
|
val resumeDownloadHandler = ResumeDownloadHudHandler(4)
|
||||||
|
|
||||||
mainChain.addHandler(launchRedirectHandler)
|
mainChain.addHandler(launchRedirectHandler)
|
||||||
mainChain.addHandler(updateDialogHandler)
|
mainChain.addHandler(updateDialogHandler)
|
||||||
@ -61,11 +79,18 @@ object GlobalPriorityChainHelper : ISuperiorChain {
|
|||||||
mainChain.addHandler(welcomeDialogHandler)
|
mainChain.addHandler(welcomeDialogHandler)
|
||||||
mainChain.addHandler(reserveDialogHandler)
|
mainChain.addHandler(reserveDialogHandler)
|
||||||
mainChain.addHandler(notificationPermissionDialogHandler)
|
mainChain.addHandler(notificationPermissionDialogHandler)
|
||||||
|
mainChain.addHandler(pendingInstallHandler)
|
||||||
|
mainChain.addHandler(resumeDownloadHandler)
|
||||||
|
|
||||||
launchRedirectHandler.doPreProcess()
|
launchRedirectHandler.doPreProcess()
|
||||||
updateDialogHandler.doPreProcess()
|
updateDialogHandler.doPreProcess()
|
||||||
requestOpeningDialogData(welcomeDialogHandler, privacyPolicyDialogHandler)
|
|
||||||
requestReserveDialogData(reserveDialogHandler)
|
// 首次启动延迟 300ms,保证请求首次启动时已经获取到了 GID 、 OAID 等标记
|
||||||
|
val requestDelay = if (withSpecialDelay) 300L else 0L
|
||||||
|
AppExecutor.uiExecutor.executeWithDelay({
|
||||||
|
requestOpeningDialogData(welcomeDialogHandler, privacyPolicyDialogHandler)
|
||||||
|
requestReserveDialogData(reserveDialogHandler)
|
||||||
|
}, requestDelay)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,6 +148,17 @@ object GlobalPriorityChainHelper : ISuperiorChain {
|
|||||||
mainChain.resume()
|
mainChain.resume()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加新的 handler 到优先级弹窗管理链 (插队!)
|
||||||
|
*/
|
||||||
|
fun queueNewHandler(handler: PriorityChainHandler) {
|
||||||
|
if (mainChain.isHandlerQueueEmpty()) {
|
||||||
|
observeLifecycle()
|
||||||
|
}
|
||||||
|
|
||||||
|
mainChain.addHandler(handler)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求首页启动弹窗相关的数据并执行相关 handler 的 preProcess
|
* 请求首页启动弹窗相关的数据并执行相关 handler 的 preProcess
|
||||||
*/
|
*/
|
||||||
@ -198,7 +234,7 @@ object GlobalPriorityChainHelper : ISuperiorChain {
|
|||||||
/**
|
/**
|
||||||
* 请求预约弹窗相关的数据
|
* 请求预约弹窗相关的数据
|
||||||
*/
|
*/
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
private fun requestReserveDialogData(reserveDialogHandler: ReserveDialogHandler) {
|
private fun requestReserveDialogData(reserveDialogHandler: ReserveDialogHandler) {
|
||||||
// debugOnly {
|
// debugOnly {
|
||||||
// reserveDialogHandler.doPreProcess(arrayListOf(SimpleGameEntity(
|
// reserveDialogHandler.doPreProcess(arrayListOf(SimpleGameEntity(
|
||||||
@ -211,23 +247,145 @@ object GlobalPriorityChainHelper : ISuperiorChain {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (CheckLoginUtils.isLogin()) {
|
if (CheckLoginUtils.isLogin()) {
|
||||||
api.getReserveDialog(UserManager.getInstance().userId)
|
val isTeenagerMode = getBoolean(Constants.SP_TEENAGER_MODE)
|
||||||
.subscribeOn(Schedulers.io())
|
loadReserveDialogOnlineData(isTeenagerMode, reserveDialogHandler)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(object : BiResponse<List<SimpleGameEntity>>() {
|
|
||||||
override fun onSuccess(data: List<SimpleGameEntity>) {
|
|
||||||
reserveDialogHandler.doPreProcess(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(exception: Exception) {
|
|
||||||
reserveDialogHandler.doPreProcess(null)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
reserveDialogHandler.doPreProcess(null)
|
reserveDialogHandler.doPreProcess(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 由于用户预约的游戏个数没有限制,为避免一次加载游戏过多,这里采用先加载第一页,显示出dialog,后续数据在第二页返回
|
||||||
|
* 注意:当page = 2 时,后台会将后续所有数据一次性返回,所以递归到第三层时,就会结束
|
||||||
|
* @param isTeenagerMode 青少年模式关闭时才需要启动自动下载,所以当 isTeenagerMode == true 时,不需要加载后续数据,也不需要启动自动下载
|
||||||
|
*/
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
private fun loadReserveDialogOnlineData(isTeenagerMode: Boolean, handler: ReserveDialogHandler? = null) {
|
||||||
|
newApi.getReserveDialog()
|
||||||
|
.compose(singleToMain())
|
||||||
|
.subscribe(object : BiResponse<ReserveOnlineEntity>() {
|
||||||
|
override fun onSuccess(data: ReserveOnlineEntity) {
|
||||||
|
handler?.doPreProcess(data)
|
||||||
|
// 继续获取后续需要自动下载的游戏
|
||||||
|
runOnIoThread {
|
||||||
|
loadGamesWithAutoDownload(1, 20, isTeenagerMode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(exception: Exception) {
|
||||||
|
handler?.doPreProcess(null)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 由于这个方法本身就是在子线程调用的,这里不需要另外在做线程切换
|
||||||
|
*/
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
@WorkerThread
|
||||||
|
private fun loadGamesWithAutoDownload(page: Int, pageSize: Int, isTeenagerMode: Boolean) {
|
||||||
|
if (page >= 5) {
|
||||||
|
// 为防止死循环,这里设置最多请求到第5页(正常情况下,第一页就是全部数据)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val filter = "wifi_auto_download:true"
|
||||||
|
newApi.loadGamesWithAutoDownload(page, pageSize, filter)
|
||||||
|
.doOnSuccess(::trackAppointmentGameOnlineDialogShow)
|
||||||
|
.subscribe(object : BiResponse<List<GameEntity>>() {
|
||||||
|
|
||||||
|
override fun onSuccess(data: List<GameEntity>) {
|
||||||
|
// 请注意,这是在子线程中
|
||||||
|
if (data.isNotEmpty()) {
|
||||||
|
loadGamesWithAutoDownload(page + 1, pageSize, isTeenagerMode)
|
||||||
|
startAutoDownloadIfNeed(data, isTeenagerMode)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
private fun startAutoDownloadIfNeed(games: List<GameEntity>, isTeenagerMode: Boolean) {
|
||||||
|
val autoDownloadGameIds = mutableSetOf<String>()
|
||||||
|
games.forEach {
|
||||||
|
autoDownloadGameIds.add(it.id)
|
||||||
|
if (it.wifiAutoDownload && !it.isLandPageAddressDialog() && !isTeenagerMode) {
|
||||||
|
// 开启了 wifi 自动下载,并且不能为第三方落地页跳转
|
||||||
|
val apk = when (it.getApk().size) {
|
||||||
|
0 -> null
|
||||||
|
1 -> it.getApk().first()
|
||||||
|
else -> {
|
||||||
|
// 自动下载,多版本默认:九游版
|
||||||
|
it.getApk().find { apk -> "9u" == apk.getPlatform() && apk.isActive }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (apk != null) {
|
||||||
|
val updateEntities = PackageUtils.getUpdateData(it, false)
|
||||||
|
val isCanUpdate = if (updateEntities.size == 1) {
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
// 多版本只需要判断九游版是否需要更新
|
||||||
|
updateEntities.any { update -> "9u" == update.platform }
|
||||||
|
}
|
||||||
|
val isCanPluggable = PackageUtils.isCanPluggable(apk)
|
||||||
|
if ((!PackageUtils.isInstalled(HaloApp.getInstance(), apk.packageName)
|
||||||
|
|| isCanUpdate
|
||||||
|
|| isCanPluggable)
|
||||||
|
&& DownloadManager.getInstance().getDownloadEntityByUrl(apk.url) == null
|
||||||
|
) {
|
||||||
|
// 未下载/可更新/可插件化 且 之前没有下载记录
|
||||||
|
val msg = FileUtils.isCanDownload(HaloApp.getInstance(), apk.size ?: "")
|
||||||
|
if (msg.isNullOrBlank()) {
|
||||||
|
val isWifiOpen = NetworkUtils.isWifiConnected(HaloApp.getInstance())
|
||||||
|
val isSubscribe = !isWifiOpen
|
||||||
|
DownloadManager.createDownload(
|
||||||
|
HaloApp.getInstance(),
|
||||||
|
apk,
|
||||||
|
it,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
isSubscribe,
|
||||||
|
ExposureEvent.createEvent(it, listOf(ExposureSource("预约上线弹窗-自动下载", "")))
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
// 存储空间不足,直接跳出循环,放弃后续的所有游戏
|
||||||
|
ToastUtils.showToast(msg)
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (autoDownloadGameIds.isNotEmpty()) {
|
||||||
|
val body = hashMapOf(
|
||||||
|
"game_ids" to autoDownloadGameIds,
|
||||||
|
"type" to "wifi_auto_download"
|
||||||
|
)
|
||||||
|
newApi.logAutoDownload(body)
|
||||||
|
.subscribe({}, {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun trackAppointmentGameOnlineDialogShow(games: List<GameEntity>) {
|
||||||
|
if (games.isNotEmpty()) {
|
||||||
|
val gameIds = arrayListOf<String>()
|
||||||
|
val gameNames = arrayListOf<String>()
|
||||||
|
val gameTypes = arrayListOf<String>()
|
||||||
|
games.forEach { game ->
|
||||||
|
gameIds.add(game.id)
|
||||||
|
gameNames.add(game.name ?: "")
|
||||||
|
gameTypes.add(game.categoryChinese)
|
||||||
|
}
|
||||||
|
val gameId = gameIds.joinToString()
|
||||||
|
val gameName = gameNames.joinToString()
|
||||||
|
val gameType = gameTypes.joinToString()
|
||||||
|
SensorsBridge.trackAppointmentGameOnlineDialogShow(gameId, gameName, gameType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun registerInferiorChain(chain: PriorityChain) {
|
override fun registerInferiorChain(chain: PriorityChain) {
|
||||||
inferiorChain = chain
|
inferiorChain = chain
|
||||||
if (mainChain.isHandlerQueueEmpty()) {
|
if (mainChain.isHandlerQueueEmpty()) {
|
||||||
|
|||||||
@ -0,0 +1,296 @@
|
|||||||
|
package com.gh.common.prioritychain
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Handler
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.PopupWindow
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
|
import com.gh.gamecenter.common.utils.dip2px
|
||||||
|
import com.gh.gamecenter.common.utils.goneIf
|
||||||
|
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||||
|
import com.gh.gamecenter.common.view.NoDefaultMinWidthTabLayout
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||||
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
|
import com.gh.gamecenter.databinding.PopupMultiTabGuideBinding
|
||||||
|
import com.gh.gamecenter.entity.BottomTab
|
||||||
|
import com.gh.gamecenter.wrapper.BaseTabWrapperFragment
|
||||||
|
import com.gh.gamecenter.wrapper.MainWrapperFragment
|
||||||
|
import com.google.android.material.tabs.TabLayout
|
||||||
|
import com.google.android.material.tabs.TabLayout.TabView
|
||||||
|
|
||||||
|
class MultiTabGuideHandler(priority: Int): PriorityChainHandler(priority) {
|
||||||
|
private var mActivity: Activity? = null
|
||||||
|
private var mHandler: Handler? = null
|
||||||
|
private var mGuide: BottomTab.Guide? = null
|
||||||
|
private var mTabLayout: TabLayout? = null
|
||||||
|
private var mTabView: TabView? = null
|
||||||
|
private var mIsSingleLineTab = false
|
||||||
|
private var mMainWrapperFragment: MainWrapperFragment? = null
|
||||||
|
private var mTabWrapperFragment: BaseTabWrapperFragment? = null
|
||||||
|
|
||||||
|
fun doPreProcess(
|
||||||
|
shouldShow: Boolean,
|
||||||
|
activity: Activity? = null,
|
||||||
|
handler: Handler? = null,
|
||||||
|
guide: BottomTab.Guide? = null,
|
||||||
|
tabLayout: TabLayout? = null,
|
||||||
|
tabView: TabLayout.TabView? = null,
|
||||||
|
isSingleLineTab: Boolean = false,
|
||||||
|
mainWrapperFragment: MainWrapperFragment? = null,
|
||||||
|
tabWrapperFragment: BaseTabWrapperFragment? = null
|
||||||
|
) {
|
||||||
|
mActivity = activity
|
||||||
|
mHandler = handler
|
||||||
|
mGuide = guide
|
||||||
|
mTabLayout = tabLayout
|
||||||
|
mTabView = tabView
|
||||||
|
mIsSingleLineTab = isSingleLineTab
|
||||||
|
mMainWrapperFragment = mainWrapperFragment
|
||||||
|
mTabWrapperFragment = tabWrapperFragment
|
||||||
|
|
||||||
|
if (getStatus() == STATUS_PENDING) {
|
||||||
|
if (shouldShow) {
|
||||||
|
updateStatus(STATUS_VALID)
|
||||||
|
process()
|
||||||
|
} else {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (shouldShow) {
|
||||||
|
updateStatus(STATUS_VALID)
|
||||||
|
} else {
|
||||||
|
updateStatus(STATUS_INVALID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProcess(): Boolean {
|
||||||
|
when (getStatus()) {
|
||||||
|
STATUS_VALID -> {
|
||||||
|
if (mGuide == null || mActivity == null || mTabView == null || mTabLayout == null) {
|
||||||
|
processNext()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return showMultiTabGuide(
|
||||||
|
true,
|
||||||
|
mActivity!!,
|
||||||
|
mHandler,
|
||||||
|
mGuide!!,
|
||||||
|
mTabLayout!!,
|
||||||
|
mTabView!!,
|
||||||
|
mIsSingleLineTab,
|
||||||
|
mMainWrapperFragment,
|
||||||
|
mTabWrapperFragment
|
||||||
|
) {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
STATUS_INVALID -> {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAB_GUIDE_TRIANGLE_OFFSET_DP = 5F
|
||||||
|
private const val TAB_GUIDE_START_TRIANGLE_OFFSET_DP = 12F
|
||||||
|
private const val TAB_GUIDE_RIGHT_SIDE_ICON_RIGHT_RESERVED_OFFSET_DP = 51F + TAB_GUIDE_TRIANGLE_OFFSET_DP // 光宝在文案右侧时预留引导到屏幕右侧的距离
|
||||||
|
private const val TAB_GUIDE_RIGHT_SIDE_ICON_LEFT_RESERVED_OFFSET_DP = TAB_GUIDE_START_TRIANGLE_OFFSET_DP + TAB_GUIDE_TRIANGLE_OFFSET_DP // 光宝在文案作侧时预留引导到屏幕右侧的距离
|
||||||
|
|
||||||
|
fun showMultiTabGuide(
|
||||||
|
isImmediately: Boolean,
|
||||||
|
activity: Activity,
|
||||||
|
handler: Handler?,
|
||||||
|
guide: BottomTab.Guide,
|
||||||
|
tabLayout: TabLayout,
|
||||||
|
tabView: TabView,
|
||||||
|
isSingleLineTab: Boolean = false,
|
||||||
|
mainWrapperFragment: MainWrapperFragment? = null,
|
||||||
|
tabWrapperFragment: BaseTabWrapperFragment? = null,
|
||||||
|
dismissCallback: (() -> Unit)? = null
|
||||||
|
): Boolean {
|
||||||
|
val guideSet = HashSet(SPUtils.getStringSet(Constants.SP_MULTI_TAB_NAV_GUIDE_SET))
|
||||||
|
val hasShownGuide = guideSet.contains(guide.multiTabId + guide.text)
|
||||||
|
val isCurrentBottomTab = mainWrapperFragment == null || guide.bottomTabId == mainWrapperFragment.currentTab?.id
|
||||||
|
if (!hasShownGuide && isCurrentBottomTab) {
|
||||||
|
val screenWidth = DisplayUtils.getScreenWidth(activity)
|
||||||
|
val outLocation = IntArray(2)
|
||||||
|
tabView.getLocationOnScreen(outLocation)
|
||||||
|
val tabViewCenterPosX = outLocation.first() + tabView.width / 2F
|
||||||
|
val iconLeftMaxPosX = if (isSingleLineTab) tabLayout.width else tabLayout.width - TAB_GUIDE_RIGHT_SIDE_ICON_LEFT_RESERVED_OFFSET_DP.dip2px()
|
||||||
|
val iconRightMaxPosX = if (isSingleLineTab) tabLayout.width else tabLayout.width - TAB_GUIDE_RIGHT_SIDE_ICON_RIGHT_RESERVED_OFFSET_DP.dip2px()
|
||||||
|
val isIconLeftValid = tabViewCenterPosX <= iconLeftMaxPosX
|
||||||
|
val isIconRightValid = tabViewCenterPosX <= iconRightMaxPosX
|
||||||
|
val isTabViewShowOnScreen = tabViewCenterPosX > 0 && (isIconLeftValid || isIconRightValid)
|
||||||
|
val isTabLayoutScrollStateIdle = (tabLayout as? NoDefaultMinWidthTabLayout)?.isScrollStateIdle == true
|
||||||
|
if (isTabViewShowOnScreen && isTabLayoutScrollStateIdle) {
|
||||||
|
val trianglePosX = tabViewCenterPosX - TAB_GUIDE_TRIANGLE_OFFSET_DP.dip2px()
|
||||||
|
val guideStartPosX = trianglePosX - TAB_GUIDE_START_TRIANGLE_OFFSET_DP.dip2px()
|
||||||
|
val xoff = tabView.width / 2 - TAB_GUIDE_START_TRIANGLE_OFFSET_DP.dip2px() - TAB_GUIDE_TRIANGLE_OFFSET_DP.dip2px()
|
||||||
|
val restGuideWidth = screenWidth - guideStartPosX
|
||||||
|
|
||||||
|
showMultiTabPopupWindow(
|
||||||
|
activity,
|
||||||
|
handler,
|
||||||
|
guide,
|
||||||
|
tabView,
|
||||||
|
xoff,
|
||||||
|
screenWidth,
|
||||||
|
restGuideWidth,
|
||||||
|
isIconRightValid,
|
||||||
|
dismissCallback
|
||||||
|
)
|
||||||
|
guideSet.add(guide.multiTabId + guide.text)
|
||||||
|
SPUtils.setStringSet(Constants.SP_MULTI_TAB_NAV_GUIDE_SET, guideSet)
|
||||||
|
|
||||||
|
return true
|
||||||
|
} else if (isImmediately) {
|
||||||
|
(tabLayout as? NoDefaultMinWidthTabLayout)?.let {
|
||||||
|
it.onScrollListener = object :
|
||||||
|
NoDefaultMinWidthTabLayout.OnScrollListener() {
|
||||||
|
override fun onScrollStateChanged(view: NoDefaultMinWidthTabLayout, scrollState: Int) {
|
||||||
|
if (scrollState == SCROLL_STATE_IDLE) {
|
||||||
|
showMultiTabGuideIfTabViewShow(
|
||||||
|
activity,
|
||||||
|
handler,
|
||||||
|
guide,
|
||||||
|
it,
|
||||||
|
tabView,
|
||||||
|
isSingleLineTab,
|
||||||
|
mainWrapperFragment
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isImmediately && !isCurrentBottomTab) {
|
||||||
|
tabWrapperFragment?.setResumeAndPauseListener {
|
||||||
|
if (it) {
|
||||||
|
handler?.post {
|
||||||
|
(tabLayout as? NoDefaultMinWidthTabLayout)?.let { tl ->
|
||||||
|
showMultiTabGuideIfBottomTabShow(
|
||||||
|
activity,
|
||||||
|
handler,
|
||||||
|
guide,
|
||||||
|
tl,
|
||||||
|
tabView,
|
||||||
|
isSingleLineTab,
|
||||||
|
mainWrapperFragment,
|
||||||
|
tabWrapperFragment
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dismissCallback?.invoke()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun showMultiTabGuideIfTabViewShow(
|
||||||
|
activity: Activity,
|
||||||
|
handler: Handler?,
|
||||||
|
guide: BottomTab.Guide,
|
||||||
|
tabLayout: NoDefaultMinWidthTabLayout,
|
||||||
|
tabView: TabView,
|
||||||
|
isSingleLineTab: Boolean = false,
|
||||||
|
mainWrapperFragment: MainWrapperFragment?
|
||||||
|
) {
|
||||||
|
if (showMultiTabGuide(
|
||||||
|
false,
|
||||||
|
activity,
|
||||||
|
handler,
|
||||||
|
guide,
|
||||||
|
tabLayout,
|
||||||
|
tabView,
|
||||||
|
isSingleLineTab,
|
||||||
|
mainWrapperFragment
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
tabLayout.onScrollListener = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun showMultiTabGuideIfBottomTabShow(
|
||||||
|
activity: Activity,
|
||||||
|
handler: Handler?,
|
||||||
|
guide: BottomTab.Guide,
|
||||||
|
tabLayout: NoDefaultMinWidthTabLayout,
|
||||||
|
tabView: TabView,
|
||||||
|
isSingleLineTab: Boolean = false,
|
||||||
|
mainWrapperFragment: MainWrapperFragment?,
|
||||||
|
tabWrapperFragment: BaseTabWrapperFragment?
|
||||||
|
) {
|
||||||
|
if (showMultiTabGuide(
|
||||||
|
false,
|
||||||
|
activity,
|
||||||
|
handler,
|
||||||
|
guide,
|
||||||
|
tabLayout,
|
||||||
|
tabView,
|
||||||
|
isSingleLineTab,
|
||||||
|
mainWrapperFragment,
|
||||||
|
tabWrapperFragment
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
tabWrapperFragment?.setResumeAndPauseListener(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun showMultiTabPopupWindow(
|
||||||
|
activity: Activity,
|
||||||
|
handler: Handler?,
|
||||||
|
guide: BottomTab.Guide,
|
||||||
|
tabView: TabView,
|
||||||
|
xoff: Int,
|
||||||
|
screenWidth: Int,
|
||||||
|
restGuideWidth: Float,
|
||||||
|
isIconRight: Boolean,
|
||||||
|
dismissCallback: (() -> Unit)?
|
||||||
|
): PopupWindow {
|
||||||
|
val binding = PopupMultiTabGuideBinding.inflate(LayoutInflater.from(activity))
|
||||||
|
binding.guideTv.text = guide.text
|
||||||
|
binding.guideTriangleIv.translationX = 12F.dip2px().toFloat()
|
||||||
|
binding.guideTv.setPadding(if (isIconRight) 8F.dip2px() else 52F.dip2px(), 0, if (isIconRight) 52F.dip2px() else 8F.dip2px(), 0)
|
||||||
|
binding.guideIconIv.goneIf(!isIconRight)
|
||||||
|
binding.guideIconFlipIv.goneIf(isIconRight)
|
||||||
|
|
||||||
|
val popupWindow = BugFixedPopupWindow(
|
||||||
|
binding.root,
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
popupWindow.contentView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
|
||||||
|
val measureWidth = popupWindow.contentView.measuredWidth
|
||||||
|
if (measureWidth >= screenWidth) {
|
||||||
|
popupWindow.width = screenWidth
|
||||||
|
binding.guideTriangleIv.translationX += screenWidth - restGuideWidth
|
||||||
|
} else if (measureWidth > restGuideWidth) {
|
||||||
|
binding.guideTriangleIv.translationX += measureWidth - restGuideWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
return popupWindow.apply {
|
||||||
|
isTouchable = false
|
||||||
|
isFocusable = false
|
||||||
|
isOutsideTouchable = true
|
||||||
|
animationStyle = com.gh.gamecenter.common.R.style.popup_window_ease_in_and_out_anim_style
|
||||||
|
setOnDismissListener {
|
||||||
|
dismissCallback?.invoke()
|
||||||
|
}
|
||||||
|
handler?.post {
|
||||||
|
if (!activity.isFinishing) {
|
||||||
|
showAsDropDown(tabView, xoff, (-25F).dip2px())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.gh.common.prioritychain
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
import com.gh.common.util.PackageHelper
|
||||||
|
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||||
|
|
||||||
|
class RequestInstalledListPermissionHandler : PriorityChainHandler(-1000) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
updateStatus(STATUS_VALID)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProcess(): Boolean {
|
||||||
|
val currentActivity = GlobalActivityManager.currentActivity ?: return false
|
||||||
|
|
||||||
|
if (currentActivity !is FragmentActivity) return false
|
||||||
|
|
||||||
|
PackageHelper.showGetInstallAppsListDialogAndRequestPermissionIfNeeded(
|
||||||
|
activity = currentActivity,
|
||||||
|
ignorePermanentlyDenied = true
|
||||||
|
) {
|
||||||
|
processNext()
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,28 +2,28 @@ package com.gh.common.prioritychain
|
|||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import com.gh.common.dialog.ReserveDialog
|
import com.gh.common.dialog.ReserveDialog
|
||||||
import com.gh.gamecenter.common.entity.SimpleGameEntity
|
|
||||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||||
|
import com.gh.gamecenter.feature.entity.ReserveOnlineEntity
|
||||||
|
|
||||||
class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||||
|
|
||||||
private var mReserveData: List<SimpleGameEntity>? = null
|
private var mReserveData: ReserveOnlineEntity? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提前预处理显示弹窗的内容
|
* 提前预处理显示弹窗的内容
|
||||||
*/
|
*/
|
||||||
fun doPreProcess(reserveData: List<SimpleGameEntity>?) {
|
fun doPreProcess(reserveData: ReserveOnlineEntity?) {
|
||||||
mReserveData = reserveData
|
mReserveData = reserveData
|
||||||
|
|
||||||
if (getStatus() == STATUS_PENDING) {
|
if (getStatus() == STATUS_PENDING) {
|
||||||
if (reserveData.isNullOrEmpty()) {
|
if (reserveData?.games.isNullOrEmpty()) {
|
||||||
processNext()
|
processNext()
|
||||||
} else {
|
} else {
|
||||||
updateStatus(STATUS_VALID)
|
updateStatus(STATUS_VALID)
|
||||||
process()
|
process()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (reserveData.isNullOrEmpty()) {
|
if (reserveData?.games.isNullOrEmpty()) {
|
||||||
updateStatus(STATUS_INVALID)
|
updateStatus(STATUS_INVALID)
|
||||||
} else {
|
} else {
|
||||||
updateStatus(STATUS_VALID)
|
updateStatus(STATUS_VALID)
|
||||||
@ -37,7 +37,7 @@ class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
|||||||
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
|
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
|
||||||
when (getStatus()) {
|
when (getStatus()) {
|
||||||
STATUS_VALID -> {
|
STATUS_VALID -> {
|
||||||
val reserveDialog = ReserveDialog.getInstance(mReserveData!!)
|
val reserveDialog = ReserveDialog.getInstance(mReserveData ?:ReserveOnlineEntity())
|
||||||
reserveDialog.setOnDismissListener {
|
reserveDialog.setOnDismissListener {
|
||||||
processNext()
|
processNext()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.gh.common.prioritychain
|
||||||
|
|
||||||
|
import com.gh.gamecenter.home.video.ScrollCalculatorHelper
|
||||||
|
|
||||||
|
class VideoHandler(priority: Int, val scrollCalculatorHelper: ScrollCalculatorHelper): PriorityChainHandler(priority) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
updateStatus(STATUS_VALID)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProcess(): Boolean {
|
||||||
|
scrollCalculatorHelper.enableAndPlayIfValid()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ import com.gh.gamecenter.R
|
|||||||
import com.gh.gamecenter.common.constant.RouteConsts
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
import com.gh.gamecenter.core.provider.IAppProvider
|
import com.gh.gamecenter.core.provider.IAppProvider
|
||||||
import com.gh.gamecenter.core.provider.IFlavorProvider
|
import com.gh.gamecenter.core.provider.IFlavorProvider
|
||||||
|
import com.gh.gamecenter.va.VCore
|
||||||
import com.halo.assistant.HaloApp
|
import com.halo.assistant.HaloApp
|
||||||
|
|
||||||
@Route(path = RouteConsts.provider.app, name = "Application暴露服务")
|
@Route(path = RouteConsts.provider.app, name = "Application暴露服务")
|
||||||
@ -83,7 +84,13 @@ class AppProviderImpl : IAppProvider {
|
|||||||
return HaloApp.getInstance().isBrandNewInstall
|
return HaloApp.getInstance().isBrandNewInstall
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setSkippingThirdParty(isSkippingThirdParty: Boolean) {
|
override fun setDisableSplashAdTemporarily(isDisable: Boolean) {
|
||||||
HaloApp.getInstance().isSkippingThirdParty = isSkippingThirdParty
|
HaloApp.getInstance().isDisableSplashAdTemporarily = isDisable
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getPluginVersion(): String = VCore.getInstance().getPluginVersion()
|
||||||
|
|
||||||
|
override fun initImageLoaderIfNeeded() {
|
||||||
|
HaloApp.getInstance().initFresco()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,5 +32,10 @@ class BuildConfigImpl : IBuildConfigProvider {
|
|||||||
override fun getVApiHost(): String = BuildConfig.VAPI_HOST
|
override fun getVApiHost(): String = BuildConfig.VAPI_HOST
|
||||||
|
|
||||||
override fun getVDevApiHost(): String = BuildConfig.DEV_VAPI_HOST
|
override fun getVDevApiHost(): String = BuildConfig.DEV_VAPI_HOST
|
||||||
|
|
||||||
|
override fun getWGameCPMApiHost(): String = BuildConfig.WGAME_CPM_API_HOST
|
||||||
|
|
||||||
|
override fun getWGameCPMBusiAppId(): String = BuildConfig.WGAME_CPM_BUSIAPPID
|
||||||
|
|
||||||
override fun getLogProducerProject(): String = BuildConfig.LOG_HUB_PROJECT
|
override fun getLogProducerProject(): String = BuildConfig.LOG_HUB_PROJECT
|
||||||
}
|
}
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
package com.gh.common.provider
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.viewbinding.ViewBinding
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.facebook.drawee.view.SimpleDraweeView
|
||||||
|
import com.gh.common.util.ConcernContentUtils
|
||||||
|
import com.gh.common.view.ImageContainerView
|
||||||
|
import com.gh.gamecenter.ImageViewerActivity.Companion.getIntent
|
||||||
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
|
import com.gh.gamecenter.common.utils.toArrayList
|
||||||
|
import com.gh.gamecenter.core.provider.IConcernArticleUtilsProvider
|
||||||
|
import com.gh.gamecenter.databinding.RecyclerGameArticleBinding
|
||||||
|
|
||||||
|
@Route(path = RouteConsts.provider.concernContentUtils, name = "ConcernContentUtils暴露服务")
|
||||||
|
class ConcernArticleUtilsProviderImpl : IConcernArticleUtilsProvider {
|
||||||
|
override fun addContentPic(
|
||||||
|
context: Context,
|
||||||
|
linearLayout: LinearLayout,
|
||||||
|
list: List<String>,
|
||||||
|
entrance: String,
|
||||||
|
width: Int
|
||||||
|
) {
|
||||||
|
ConcernContentUtils.addContentPic(context, linearLayout, list, entrance, width)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createArticleBinding(parent: ViewGroup): ViewBinding {
|
||||||
|
val inflater = LayoutInflater.from(parent.context)
|
||||||
|
return RecyclerGameArticleBinding.inflate(inflater, parent, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initArticleStyle(binding: ViewBinding) {
|
||||||
|
if (binding is RecyclerGameArticleBinding) {
|
||||||
|
val context = binding.root.context
|
||||||
|
binding.root
|
||||||
|
.setBackground(ContextCompat.getDrawable(context, com.gh.gamecenter.common.R.drawable.reuse_listview_item_style))
|
||||||
|
binding.tvGameName.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_primary))
|
||||||
|
binding.tvTime.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_tertiary))
|
||||||
|
binding.tvTitle.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_primary))
|
||||||
|
binding.tvDescription.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_secondary))
|
||||||
|
binding.tvComment.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_tertiary))
|
||||||
|
binding.tvShare.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_tertiary))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getIvIcon(binding: ViewBinding): View =
|
||||||
|
(binding as RecyclerGameArticleBinding).ivIcon
|
||||||
|
|
||||||
|
override fun getTvGameName(binding: ViewBinding): TextView =
|
||||||
|
(binding as RecyclerGameArticleBinding).tvGameName
|
||||||
|
|
||||||
|
override fun getTvTime(binding: ViewBinding): TextView = (binding as RecyclerGameArticleBinding).tvTime
|
||||||
|
|
||||||
|
override fun getTvTitle(binding: ViewBinding): TextView = (binding as RecyclerGameArticleBinding).tvTitle
|
||||||
|
|
||||||
|
override fun getTvDescription(binding: ViewBinding): TextView =
|
||||||
|
(binding as RecyclerGameArticleBinding).tvDescription
|
||||||
|
|
||||||
|
override fun bindImgs(binding: ViewBinding, img: List<String>) {
|
||||||
|
if (binding is RecyclerGameArticleBinding) {
|
||||||
|
val images = img.map {
|
||||||
|
ImageContainerView.ImageContainerData.ImageInfo(it, 3, 2)
|
||||||
|
}
|
||||||
|
val imageContainerData =
|
||||||
|
ImageContainerView.ImageContainerData("", false, images, show = images.isNotEmpty())
|
||||||
|
binding.ivImagesContainer.bindData(imageContainerData,
|
||||||
|
object : ImageContainerView.OnImageContainerEventListener {
|
||||||
|
override fun onImageClick(
|
||||||
|
images: List<String>,
|
||||||
|
position: Int,
|
||||||
|
imageViewList: ArrayList<SimpleDraweeView>
|
||||||
|
) {
|
||||||
|
val checkIntent = getIntent(
|
||||||
|
binding.root.context,
|
||||||
|
images.toArrayList(),
|
||||||
|
position,
|
||||||
|
imageViewList,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
binding.root.context.startActivity(checkIntent)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onVideoCLick(videoId: String) = Unit
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getTvComment(binding: ViewBinding): TextView = (binding as RecyclerGameArticleBinding).tvComment
|
||||||
|
|
||||||
|
override fun getTvShare(binding: ViewBinding): TextView = (binding as RecyclerGameArticleBinding).tvShare
|
||||||
|
|
||||||
|
override fun init(context: Context?) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,26 +0,0 @@
|
|||||||
package com.gh.common.provider
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
|
||||||
import com.gh.common.util.ConcernContentUtils
|
|
||||||
import com.gh.gamecenter.common.constant.RouteConsts
|
|
||||||
import com.gh.gamecenter.core.provider.IConcernContentUtilsProvider
|
|
||||||
|
|
||||||
@Route(path = RouteConsts.provider.concernContentUtils, name = "ConcernContentUtils暴露服务")
|
|
||||||
class ConcernContentUtilsProviderImpl : IConcernContentUtilsProvider {
|
|
||||||
override fun addContentPic(
|
|
||||||
context: Context,
|
|
||||||
linearLayout: LinearLayout,
|
|
||||||
list: List<String>,
|
|
||||||
entrance: String,
|
|
||||||
width: Int
|
|
||||||
) {
|
|
||||||
ConcernContentUtils.addContentPic(context, linearLayout, list, entrance, width)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun init(context: Context?) {
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package com.gh.common.provider
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.viewbinding.ViewBinding
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
|
import com.gh.gamecenter.common.utils.goneIf
|
||||||
|
import com.gh.gamecenter.common.utils.toColor
|
||||||
|
import com.gh.gamecenter.core.provider.IConcernGiftPackUtilsProvider
|
||||||
|
import com.gh.gamecenter.databinding.RecyclerGiftPackBinding
|
||||||
|
|
||||||
|
@Route(path = RouteConsts.provider.concernGiftPackUtils, name = "ConcernGiftPackUtils暴露服务")
|
||||||
|
class ConcernGiftPackUtilsProviderImpl : IConcernGiftPackUtilsProvider {
|
||||||
|
override fun createBinding(parent: ViewGroup): ViewBinding {
|
||||||
|
val inflater = LayoutInflater.from(parent.context)
|
||||||
|
return RecyclerGiftPackBinding.inflate(inflater, parent, false)
|
||||||
|
.also {
|
||||||
|
it.gCode.goneIf(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initStyle(viewBinding: ViewBinding) {
|
||||||
|
with(viewBinding as RecyclerGiftPackBinding) {
|
||||||
|
val context = root.context
|
||||||
|
tvGameName.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
|
||||||
|
tvTime.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(context))
|
||||||
|
tvGiftPackName.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
|
||||||
|
tvGiftPackContent.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(context))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getIvGameIcon(viewBinding: ViewBinding) =
|
||||||
|
(viewBinding as RecyclerGiftPackBinding).ivIcon
|
||||||
|
|
||||||
|
override fun getTvGameName(viewBinding: ViewBinding) =
|
||||||
|
(viewBinding as RecyclerGiftPackBinding).tvGameName
|
||||||
|
|
||||||
|
override fun getTvTime(viewBinding: ViewBinding) =
|
||||||
|
(viewBinding as RecyclerGiftPackBinding).tvTime
|
||||||
|
|
||||||
|
override fun getTvGiftPackName(viewBinding: ViewBinding) =
|
||||||
|
(viewBinding as RecyclerGiftPackBinding).tvGiftPackName
|
||||||
|
|
||||||
|
override fun getTvGiftPackContent(viewBinding: ViewBinding) =
|
||||||
|
(viewBinding as RecyclerGiftPackBinding).tvGiftPackContent
|
||||||
|
|
||||||
|
override fun init(context: Context?) {
|
||||||
|
// Do Nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.gh.common.provider
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
|
import com.gh.gamecenter.core.provider.IConcernShareNewsProvider
|
||||||
|
import com.gh.gamecenter.newsdetail.NewsShareDialog
|
||||||
|
|
||||||
|
@Route(path = RouteConsts.provider.concernShareNews, name = "ConcernShareNews暴露服务")
|
||||||
|
class ConcernShareNewsProviderImpl : IConcernShareNewsProvider {
|
||||||
|
override fun share(activity: AppCompatActivity, shortId: String?, id: String?, gameIcon: String?, title: String?) {
|
||||||
|
NewsShareDialog.show(activity, shortId, id, gameIcon, title)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun init(context: Context?) {
|
||||||
|
// Do Nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -100,6 +100,10 @@ class ConfigProviderImpl : IConfigProvider {
|
|||||||
return Config.getNightModeSetting()?.setting ?: false
|
return Config.getNightModeSetting()?.setting ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isJiguangSwitch(): Boolean {
|
||||||
|
return Config.getNewApiSettingsEntity()?.jiguangSwitch ?: false
|
||||||
|
}
|
||||||
|
|
||||||
override fun init(context: Context?) {
|
override fun init(context: Context?) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.gh.common.provider
|
package com.gh.common.provider
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
@ -61,7 +62,13 @@ class DirectProviderImpl : IDirectProvider {
|
|||||||
DirectUtils.directToCommunityArticle(context, articleId, communityId, entrance, path, sourceEntrance)
|
DirectUtils.directToCommunityArticle(context, articleId, communityId, entrance, path, sourceEntrance)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun directToVideoDetail(context: Context, videoId: String, entrance: String?, path: String?, sourceEntrance: String) {
|
override fun directToVideoDetail(
|
||||||
|
context: Context,
|
||||||
|
videoId: String,
|
||||||
|
entrance: String?,
|
||||||
|
path: String?,
|
||||||
|
sourceEntrance: String
|
||||||
|
) {
|
||||||
DirectUtils.directToVideoDetail(context, videoId, entrance, path, sourceEntrance)
|
DirectUtils.directToVideoDetail(context, videoId, entrance, path, sourceEntrance)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,10 +76,23 @@ class DirectProviderImpl : IDirectProvider {
|
|||||||
DirectUtils.directToAmway(context, fixedTopAmwayCommentId, entrance, path)
|
DirectUtils.directToAmway(context, fixedTopAmwayCommentId, entrance, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun directToQGame(context: Context) {
|
override fun directToQQGameHome(context: Context) {
|
||||||
return DirectUtils.directToQGameHome(context)
|
return DirectUtils.directToQGameHome(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun directToQQGameById(activity: Activity, qqAppId: String) {
|
||||||
|
DirectUtils.directToQQGameById(activity, qqAppId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun directToWechatGameById(
|
||||||
|
activity: Activity,
|
||||||
|
wechatAppId: String,
|
||||||
|
wechatAppPath: String,
|
||||||
|
wechatAppExtData: String
|
||||||
|
) {
|
||||||
|
DirectUtils.directToWechatGameById(activity, wechatAppId, wechatAppPath, wechatAppExtData)
|
||||||
|
}
|
||||||
|
|
||||||
override fun directToExternalBrowser(context: Context, url: String) {
|
override fun directToExternalBrowser(context: Context, url: String) {
|
||||||
DirectUtils.directToExternalBrowser(context, url)
|
DirectUtils.directToExternalBrowser(context, url)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com.gh.common.provider
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
import com.gh.common.util.NewFlatLogUtils
|
import com.gh.common.util.NewFlatLogUtils
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||||
import com.gh.gamecenter.common.constant.RouteConsts
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||||
@ -107,7 +106,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
val text = downloadButton.text.ifEmpty {
|
val text = downloadButton.text.ifEmpty {
|
||||||
downloadButton.getTag(R.string.download) ?: ""
|
downloadButton.getTag(com.gh.gamecenter.feature.R.string.download) ?: ""
|
||||||
}.toString()
|
}.toString()
|
||||||
|
|
||||||
val downloadType = if (text.contains("畅玩")) {
|
val downloadType = if (text.contains("畅玩")) {
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
package com.gh.common.provider
|
package com.gh.common.provider
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
import com.gh.common.util.EntranceUtils
|
import com.gh.common.util.EntranceUtils
|
||||||
|
import com.gh.gamecenter.common.avoidcallback.Callback
|
||||||
import com.gh.gamecenter.common.constant.RouteConsts
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
import com.gh.gamecenter.core.provider.IEntranceUtilsProvider
|
import com.gh.gamecenter.core.provider.IEntranceUtilsProvider
|
||||||
|
import com.lightgame.utils.AppManager
|
||||||
|
|
||||||
@Route(path = RouteConsts.provider.entranceUtils, name = "EntranceUtils暴露服务")
|
@Route(path = RouteConsts.provider.entranceUtils, name = "EntranceUtils暴露服务")
|
||||||
class EntranceUtilsProviderImpl : IEntranceUtilsProvider {
|
class EntranceUtilsProviderImpl : IEntranceUtilsProvider {
|
||||||
@ -17,6 +22,19 @@ class EntranceUtilsProviderImpl : IEntranceUtilsProvider {
|
|||||||
EntranceUtils.saveShortcut(activityName, bundle)
|
EntranceUtils.saveShortcut(activityName, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun jumpActivityWithCallback(context: Context, bundle: Bundle, callback: () -> Unit) {
|
||||||
|
if (context is FragmentActivity && !context.supportFragmentManager.isDestroyed) {
|
||||||
|
EntranceUtils.jumpActivityCompat(context, bundle, null, object : Callback {
|
||||||
|
override fun onActivityResult(resultCode: Int, data: Intent?) {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
EntranceUtils.jumpActivityCompat(AppManager.getInstance().currentActivity(), bundle)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
override fun init(context: Context?) {
|
override fun init(context: Context?) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.gh.common.provider
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
|
import com.gh.gamecenter.core.provider.IMiniGameRecentlyPlayedProvider
|
||||||
|
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
|
||||||
|
|
||||||
|
@Route(path = RouteConsts.provider.miniGameRecentPlayed, name = "MiniGameRecentlyPlayed暴露服务")
|
||||||
|
class MiniGameRecentlyPlayedProviderImpl : IMiniGameRecentlyPlayedProvider {
|
||||||
|
override fun clearMiniGameRecentlyPlayed(gameType: String) {
|
||||||
|
MiniGameRecentlyPlayUseCase.clearRecentlyPlayedMiniGameList(gameType)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun refreshQQMiniRecentPlayed() {
|
||||||
|
MiniGameRecentlyPlayUseCase.loadRecentlyPlayedMiniGameList(Constants.QQ_MINI_GAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun init(context: Context?) {
|
||||||
|
// no implement
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,7 +9,7 @@ import com.gh.gamecenter.core.provider.IPackageHelperProvider
|
|||||||
@Route(path = RouteConsts.provider.packageHelper, name = "PackageHelper暴露服务")
|
@Route(path = RouteConsts.provider.packageHelper, name = "PackageHelper暴露服务")
|
||||||
class PackageHelperProviderImpl : IPackageHelperProvider {
|
class PackageHelperProviderImpl : IPackageHelperProvider {
|
||||||
|
|
||||||
override fun getLocalPackageNameSet(): HashSet<String> {
|
override fun getLocalPackageNameSet(): Set<String> {
|
||||||
return PackageHelper.localPackageNameSet
|
return PackageHelper.localPackageNameSet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.gh.common.provider
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.PackageInfo
|
import android.content.pm.PackageInfo
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.gh.common.util.PackageHelper
|
||||||
import com.gh.common.util.PackageUtils
|
import com.gh.common.util.PackageUtils
|
||||||
import com.gh.gamecenter.common.constant.RouteConsts
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
|
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
|
||||||
@ -23,7 +24,7 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getInstalledPackages(context: Context, flag: Int): List<PackageInfo> {
|
override fun getInstalledPackages(context: Context, flag: Int): List<PackageInfo> {
|
||||||
return PackageUtils.getInstalledPackages(context, flag)
|
return PackageHelper.getInstalledPackageInfoList(context, flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getApkSignatureByPackageName(context: Context, packageName: String): Array<String> {
|
override fun getApkSignatureByPackageName(context: Context, packageName: String): Array<String> {
|
||||||
@ -38,6 +39,10 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
|
|||||||
return PackageUtils.isSignedByGh(context, packageName)
|
return PackageUtils.isSignedByGh(context, packageName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isInstalledWithLauncherIcon(context: Context, packageName: String): Boolean {
|
||||||
|
return PackageUtils.isInstalled(context, packageName)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getInstalledTime(context: Context, packageName: String): Long {
|
override fun getInstalledTime(context: Context, packageName: String): Long {
|
||||||
return PackageUtils.getInstalledTime(context, packageName)
|
return PackageUtils.getInstalledTime(context, packageName)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.gh.common.provider
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
|
import com.gh.gamecenter.core.provider.ISearchTabUtilsProvider
|
||||||
|
import com.gh.gamecenter.search.viewmodel.SearchTabViewModel
|
||||||
|
|
||||||
|
@Route(path = RouteConsts.provider.searchTabUtils, name = "SearchTabUtils暴露服务")
|
||||||
|
class SearchTabUtilsProviderImpl : ISearchTabUtilsProvider {
|
||||||
|
|
||||||
|
override fun obtainParentViewModel(fragment: Fragment): ViewModel {
|
||||||
|
val store = (fragment.parentFragment ?: fragment).viewModelStore
|
||||||
|
val factory = fragment.defaultViewModelProviderFactory
|
||||||
|
return ViewModelProvider(
|
||||||
|
store,
|
||||||
|
factory
|
||||||
|
).get(SearchTabViewModel::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getKeyAndTypeLiveData(viewModel: ViewModel?): LiveData<Pair<String, String>>? =
|
||||||
|
if (viewModel is SearchTabViewModel) {
|
||||||
|
viewModel.searchKeyAndType
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun init(context: Context?) {
|
||||||
|
// no implement
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,16 +4,19 @@ import android.content.Context
|
|||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
import com.gh.common.util.WechatBindHelper
|
import com.gh.common.util.WechatBindHelper
|
||||||
import com.gh.gamecenter.common.constant.RouteConsts
|
import com.gh.gamecenter.common.constant.RouteConsts
|
||||||
|
import com.gh.gamecenter.common.entity.WechatConfigEntity
|
||||||
import com.gh.gamecenter.core.provider.IWechatBindHelperProvider
|
import com.gh.gamecenter.core.provider.IWechatBindHelperProvider
|
||||||
|
|
||||||
@Route(path = RouteConsts.provider.wechatHelper, name = "WechatHelper暴露服务")
|
@Route(path = RouteConsts.provider.wechatHelper, name = "WechatHelper暴露服务")
|
||||||
class WechatHelperProviderImpl : IWechatBindHelperProvider {
|
class WechatHelperProviderImpl : IWechatBindHelperProvider<WechatConfigEntity> {
|
||||||
override fun getWechatConfig(callback: (() -> Unit)?) {
|
|
||||||
|
override fun getWechatConfig(callback: ((WechatConfigEntity) -> Unit)?) {
|
||||||
WechatBindHelper.getWechatConfig {
|
WechatBindHelper.getWechatConfig {
|
||||||
callback?.invoke()
|
callback?.invoke(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun init(context: Context?) {
|
override fun init(context: Context?) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import com.gh.common.constant.Config
|
|||||||
import com.gh.common.util.LogUtils
|
import com.gh.common.util.LogUtils
|
||||||
import com.gh.common.util.NewFlatLogUtils
|
import com.gh.common.util.NewFlatLogUtils
|
||||||
import com.gh.gamecenter.BuildConfig
|
import com.gh.gamecenter.BuildConfig
|
||||||
import com.gh.gamecenter.R
|
|
||||||
import com.gh.gamecenter.common.utils.*
|
import com.gh.gamecenter.common.utils.*
|
||||||
import com.gh.gamecenter.core.utils.EmptyCallback
|
import com.gh.gamecenter.core.utils.EmptyCallback
|
||||||
import com.gh.gamecenter.core.utils.SPUtils
|
import com.gh.gamecenter.core.utils.SPUtils
|
||||||
@ -91,7 +90,7 @@ object NewSimulatorGameManager {
|
|||||||
},
|
},
|
||||||
uiModificationCallback = { binding ->
|
uiModificationCallback = { binding ->
|
||||||
binding.contentTv.gravity = Gravity.START
|
binding.contentTv.gravity = Gravity.START
|
||||||
binding.contentTv.setTextColor(R.color.text_secondary.toColor(context))
|
binding.contentTv.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(context))
|
||||||
},
|
},
|
||||||
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -166,162 +166,160 @@ class SimulatorDownloadManager private constructor() {
|
|||||||
this.gameName = gameName
|
this.gameName = gameName
|
||||||
this.gameType = gameCategoryChinese
|
this.gameType = gameCategoryChinese
|
||||||
|
|
||||||
PermissionHelper.checkGetInstalledAppsListBeforeAction(context, object : EmptyCallback {
|
PermissionHelper.checkGetInstalledAppsListBeforeAction(context) { _ ->
|
||||||
override fun onCallback() {
|
val isInstalledNewSimulator =
|
||||||
val isInstalledNewSimulator =
|
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
|
||||||
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
|
//当没有安装新版本模拟器时候 判断是否隐藏
|
||||||
//当没有安装新版本模拟器时候 判断是否隐藏
|
if (simulator?.active == false && !isInstalledNewSimulator) {
|
||||||
if (simulator?.active == false && !isInstalledNewSimulator) {
|
showNoneEmulatorDialog(context)
|
||||||
showNoneEmulatorDialog(context)
|
return@checkGetInstalledAppsListBeforeAction
|
||||||
return
|
|
||||||
}
|
|
||||||
var isInstalled = PackageUtils.isInstalledFromAllPackage(
|
|
||||||
context,
|
|
||||||
simulator?.apk?.packageName
|
|
||||||
)
|
|
||||||
//模拟器管理界面还是用之前的逻辑
|
|
||||||
if (isInstalledNewSimulator && location != SimulatorLocation.SIMULATOR_MANAGE) {
|
|
||||||
isInstalled = isInstalledNewSimulator
|
|
||||||
}
|
|
||||||
// val versionFromInstalledApp = PackageUtils.getVersionNameByPackageName(simulator?.apk?.packageName)
|
|
||||||
val shouldShowUpdate =
|
|
||||||
PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
|
|
||||||
val showAlertTag = SPUtils.getString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, "") //当天是否弹过
|
|
||||||
val todayIsShow = showAlertTag == TimeUtils.getToday()
|
|
||||||
downloadType = if (shouldShowUpdate && isInstalled) "update" else "download"
|
|
||||||
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (downloadType == "download" && isInstalled) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val title = if (shouldShowUpdate && isInstalled) "更新模拟器" else "安装模拟器"
|
|
||||||
val message =
|
|
||||||
if (shouldShowUpdate && isInstalled) "检测到模拟器存在更高版本,是否前往更新" else "模拟器游戏需要先下载安装对应的模拟器,才可以运行"
|
|
||||||
val positiveText =
|
|
||||||
if (shouldShowUpdate && isInstalled) "更新(${simulator?.apk?.size})" else "下载(${simulator?.apk?.size})"
|
|
||||||
val negativeText = if (shouldShowUpdate && isInstalled) "下次再说" else "取消"
|
|
||||||
val trackableEntity = TrackableEntity(
|
|
||||||
"模拟器下载",
|
|
||||||
key = if (shouldShowUpdate && isInstalled) "更新弹窗" else "下载弹窗",
|
|
||||||
logShowEvent = true
|
|
||||||
)
|
|
||||||
if (shouldShowUpdate && isInstalled) {
|
|
||||||
NewFlatLogUtils.logSimulatorUpdateAlertShow()
|
|
||||||
}
|
|
||||||
if (shouldShowUpdate && isInstalled) {
|
|
||||||
SensorsBridge.trackSimulatorUpdateDialogShow(
|
|
||||||
gameId = gameId,
|
|
||||||
gameName = gameName,
|
|
||||||
gameType = gameCategoryChinese,
|
|
||||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
|
||||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
|
||||||
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
SensorsBridge.trackSimulatorInstallDialogShow(
|
|
||||||
gameId = gameId,
|
|
||||||
gameName = gameName,
|
|
||||||
gameType = gameCategoryChinese,
|
|
||||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
|
||||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
|
||||||
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
DialogHelper.showDialog(
|
|
||||||
context,
|
|
||||||
title,
|
|
||||||
message,
|
|
||||||
positiveText,
|
|
||||||
negativeText,
|
|
||||||
trackMtaEvent = true,
|
|
||||||
cancelClickCallback = {
|
|
||||||
if (shouldShowUpdate && isInstalled) {
|
|
||||||
cancelCallback?.invoke()
|
|
||||||
NewFlatLogUtils.logSimulatorUpdateAlertClick("取消")
|
|
||||||
MtaHelper.onEvent(trackableEntity.event, trackableEntity.key, "点击下次再说")
|
|
||||||
SensorsBridge.trackSimulatorUpdateDialogClick(
|
|
||||||
buttonName = negativeText,
|
|
||||||
gameId = gameId,
|
|
||||||
gameName = gameName,
|
|
||||||
gameType = gameCategoryChinese,
|
|
||||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
|
||||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
|
||||||
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
SensorsBridge.trackSimulatorInstallDialogClick(
|
|
||||||
buttonName = negativeText,
|
|
||||||
gameId = gameId,
|
|
||||||
gameName = gameName,
|
|
||||||
gameType = gameCategoryChinese,
|
|
||||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
|
||||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
|
||||||
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
confirmClickCallback = {
|
|
||||||
showDownloadingDialog(context, simulator, gameId, gameName, gameCategoryChinese)
|
|
||||||
NewFlatLogUtils.logSimulatorUpdateAlertClick("更新")
|
|
||||||
MtaHelper.onEvent(
|
|
||||||
trackableEntity.event,
|
|
||||||
trackableEntity.key,
|
|
||||||
if (shouldShowUpdate && isInstalled) "点击更新" else "点击下载"
|
|
||||||
)
|
|
||||||
if (shouldShowUpdate && isInstalled) {
|
|
||||||
SensorsBridge.trackSimulatorUpdateDialogClick(
|
|
||||||
buttonName = positiveText,
|
|
||||||
gameId = gameId,
|
|
||||||
gameName = gameName,
|
|
||||||
gameType = gameCategoryChinese,
|
|
||||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
|
||||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
|
||||||
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
SensorsBridge.trackSimulatorInstallDialogClick(
|
|
||||||
buttonName = positiveText,
|
|
||||||
gameId = gameId,
|
|
||||||
gameName = gameName,
|
|
||||||
gameType = gameCategoryChinese,
|
|
||||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
|
||||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
|
||||||
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
touchOutsideCallback = {
|
|
||||||
if (shouldShowUpdate && isInstalled) {
|
|
||||||
SensorsBridge.trackSimulatorUpdateDialogClick(
|
|
||||||
buttonName = "关闭弹窗",
|
|
||||||
gameId = gameId,
|
|
||||||
gameName = gameName,
|
|
||||||
gameType = gameCategoryChinese,
|
|
||||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
|
||||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
|
||||||
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
SensorsBridge.trackSimulatorInstallDialogClick(
|
|
||||||
buttonName = "关闭弹窗",
|
|
||||||
gameId = gameId,
|
|
||||||
gameName = gameName,
|
|
||||||
gameType = gameCategoryChinese,
|
|
||||||
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
|
||||||
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
|
||||||
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mtaEvent = trackableEntity.event, mtaKey = trackableEntity.key,
|
|
||||||
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
|
||||||
)
|
|
||||||
if (downloadType == "update" && location != SimulatorLocation.SIMULATOR_MANAGE) {
|
|
||||||
SPUtils.setString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, TimeUtils.getToday())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
var isInstalled = PackageUtils.isInstalledFromAllPackage(
|
||||||
|
context,
|
||||||
|
simulator?.apk?.packageName
|
||||||
|
)
|
||||||
|
//模拟器管理界面还是用之前的逻辑
|
||||||
|
if (isInstalledNewSimulator && location != SimulatorLocation.SIMULATOR_MANAGE) {
|
||||||
|
isInstalled = isInstalledNewSimulator
|
||||||
|
}
|
||||||
|
// val versionFromInstalledApp = PackageUtils.getVersionNameByPackageName(simulator?.apk?.packageName)
|
||||||
|
val shouldShowUpdate =
|
||||||
|
PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
|
||||||
|
val showAlertTag = SPUtils.getString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, "") //当天是否弹过
|
||||||
|
val todayIsShow = showAlertTag == TimeUtils.getToday()
|
||||||
|
downloadType = if (shouldShowUpdate && isInstalled) "update" else "download"
|
||||||
|
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE) {
|
||||||
|
return@checkGetInstalledAppsListBeforeAction
|
||||||
|
}
|
||||||
|
if (downloadType == "download" && isInstalled) {
|
||||||
|
return@checkGetInstalledAppsListBeforeAction
|
||||||
|
}
|
||||||
|
val title = if (shouldShowUpdate && isInstalled) "更新模拟器" else "安装模拟器"
|
||||||
|
val message =
|
||||||
|
if (shouldShowUpdate && isInstalled) "检测到模拟器存在更高版本,是否前往更新" else "模拟器游戏需要先下载安装对应的模拟器,才可以运行"
|
||||||
|
val positiveText =
|
||||||
|
if (shouldShowUpdate && isInstalled) "更新(${simulator?.apk?.size})" else "下载(${simulator?.apk?.size})"
|
||||||
|
val negativeText = if (shouldShowUpdate && isInstalled) "下次再说" else "取消"
|
||||||
|
val trackableEntity = TrackableEntity(
|
||||||
|
"模拟器下载",
|
||||||
|
key = if (shouldShowUpdate && isInstalled) "更新弹窗" else "下载弹窗",
|
||||||
|
logShowEvent = true
|
||||||
|
)
|
||||||
|
if (shouldShowUpdate && isInstalled) {
|
||||||
|
NewFlatLogUtils.logSimulatorUpdateAlertShow()
|
||||||
|
}
|
||||||
|
if (shouldShowUpdate && isInstalled) {
|
||||||
|
SensorsBridge.trackSimulatorUpdateDialogShow(
|
||||||
|
gameId = gameId,
|
||||||
|
gameName = gameName,
|
||||||
|
gameType = gameCategoryChinese,
|
||||||
|
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||||
|
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||||
|
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
SensorsBridge.trackSimulatorInstallDialogShow(
|
||||||
|
gameId = gameId,
|
||||||
|
gameName = gameName,
|
||||||
|
gameType = gameCategoryChinese,
|
||||||
|
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||||
|
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||||
|
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
DialogHelper.showDialog(
|
||||||
|
context,
|
||||||
|
title,
|
||||||
|
message,
|
||||||
|
positiveText,
|
||||||
|
negativeText,
|
||||||
|
trackMtaEvent = true,
|
||||||
|
cancelClickCallback = {
|
||||||
|
if (shouldShowUpdate && isInstalled) {
|
||||||
|
cancelCallback?.invoke()
|
||||||
|
NewFlatLogUtils.logSimulatorUpdateAlertClick("取消")
|
||||||
|
MtaHelper.onEvent(trackableEntity.event, trackableEntity.key, "点击下次再说")
|
||||||
|
SensorsBridge.trackSimulatorUpdateDialogClick(
|
||||||
|
buttonName = negativeText,
|
||||||
|
gameId = gameId,
|
||||||
|
gameName = gameName,
|
||||||
|
gameType = gameCategoryChinese,
|
||||||
|
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||||
|
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||||
|
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
SensorsBridge.trackSimulatorInstallDialogClick(
|
||||||
|
buttonName = negativeText,
|
||||||
|
gameId = gameId,
|
||||||
|
gameName = gameName,
|
||||||
|
gameType = gameCategoryChinese,
|
||||||
|
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||||
|
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||||
|
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirmClickCallback = {
|
||||||
|
showDownloadingDialog(context, simulator, gameId, gameName, gameCategoryChinese)
|
||||||
|
NewFlatLogUtils.logSimulatorUpdateAlertClick("更新")
|
||||||
|
MtaHelper.onEvent(
|
||||||
|
trackableEntity.event,
|
||||||
|
trackableEntity.key,
|
||||||
|
if (shouldShowUpdate && isInstalled) "点击更新" else "点击下载"
|
||||||
|
)
|
||||||
|
if (shouldShowUpdate && isInstalled) {
|
||||||
|
SensorsBridge.trackSimulatorUpdateDialogClick(
|
||||||
|
buttonName = positiveText,
|
||||||
|
gameId = gameId,
|
||||||
|
gameName = gameName,
|
||||||
|
gameType = gameCategoryChinese,
|
||||||
|
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||||
|
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||||
|
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
SensorsBridge.trackSimulatorInstallDialogClick(
|
||||||
|
buttonName = positiveText,
|
||||||
|
gameId = gameId,
|
||||||
|
gameName = gameName,
|
||||||
|
gameType = gameCategoryChinese,
|
||||||
|
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||||
|
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||||
|
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
touchOutsideCallback = {
|
||||||
|
if (shouldShowUpdate && isInstalled) {
|
||||||
|
SensorsBridge.trackSimulatorUpdateDialogClick(
|
||||||
|
buttonName = "关闭弹窗",
|
||||||
|
gameId = gameId,
|
||||||
|
gameName = gameName,
|
||||||
|
gameType = gameCategoryChinese,
|
||||||
|
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||||
|
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||||
|
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
SensorsBridge.trackSimulatorInstallDialogClick(
|
||||||
|
buttonName = "关闭弹窗",
|
||||||
|
gameId = gameId,
|
||||||
|
gameName = gameName,
|
||||||
|
gameType = gameCategoryChinese,
|
||||||
|
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
|
||||||
|
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
|
||||||
|
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mtaEvent = trackableEntity.event, mtaKey = trackableEntity.key,
|
||||||
|
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
||||||
|
)
|
||||||
|
if (downloadType == "update" && location != SimulatorLocation.SIMULATOR_MANAGE) {
|
||||||
|
SPUtils.setString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, TimeUtils.getToday())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showDownloadingDialog(
|
fun showDownloadingDialog(
|
||||||
@ -341,8 +339,8 @@ class SimulatorDownloadManager private constructor() {
|
|||||||
Utils.toast(context, "当前使用移动数据进行下载")
|
Utils.toast(context, "当前使用移动数据进行下载")
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadDialog = TrackableDialog(context, R.style.GhAlertDialog, "模拟器下载", "下载中弹窗")
|
downloadDialog = TrackableDialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog, "模拟器下载", "下载中弹窗")
|
||||||
downloadDialog?.window?.setBackgroundDrawableResource(R.color.transparent)
|
downloadDialog?.window?.setBackgroundDrawableResource(com.gh.gamecenter.common.R.color.transparent)
|
||||||
|
|
||||||
val view = View.inflate(context, R.layout.download_simulator_dialog, null)
|
val view = View.inflate(context, R.layout.download_simulator_dialog, null)
|
||||||
|
|
||||||
@ -394,7 +392,7 @@ class SimulatorDownloadManager private constructor() {
|
|||||||
ToastUtils.showToast("该模拟器暂未提供下载")
|
ToastUtils.showToast("该模拟器暂未提供下载")
|
||||||
},
|
},
|
||||||
uiModificationCallback = { binding ->
|
uiModificationCallback = { binding ->
|
||||||
binding.confirmTv.setTextColor(R.color.text_instance.toColor(context))
|
binding.confirmTv.setTextColor(com.gh.gamecenter.common.R.color.text_instance.toColor(context))
|
||||||
},
|
},
|
||||||
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -19,8 +19,10 @@ import com.gh.gamecenter.databinding.DialogArchiveLoadingBinding
|
|||||||
import com.gh.gamecenter.entity.ArchiveEntity
|
import com.gh.gamecenter.entity.ArchiveEntity
|
||||||
import com.gh.gamecenter.feature.entity.GameEntity
|
import com.gh.gamecenter.feature.entity.GameEntity
|
||||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||||
|
import com.gh.gamecenter.va.VCore
|
||||||
import com.gh.vspace.VArchiveHelper
|
import com.gh.vspace.VArchiveHelper
|
||||||
import com.gh.vspace.VHelper
|
import com.gh.vspace.VHelper
|
||||||
|
import com.gh.vspace.VHelper.is32
|
||||||
import com.lg.download.DownloadError
|
import com.lg.download.DownloadError
|
||||||
import com.lg.download.DownloadStatus
|
import com.lg.download.DownloadStatus
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
@ -50,8 +52,6 @@ object ArchiveDownloadButtonHelper {
|
|||||||
}
|
}
|
||||||
downloadBtn.setOnClickListener {
|
downloadBtn.setOnClickListener {
|
||||||
when {
|
when {
|
||||||
// 检查是否已安装畅玩助手
|
|
||||||
!VHelper.isVSpaceInstalled(context) -> showVSpaceTipDialog(context, gameEntity)
|
|
||||||
// 检查是否已安装游戏
|
// 检查是否已安装游戏
|
||||||
!VHelper.isInstalled(packageName) -> {
|
!VHelper.isInstalled(packageName) -> {
|
||||||
// 检查游戏是否在安装中
|
// 检查游戏是否在安装中
|
||||||
@ -95,13 +95,13 @@ object ArchiveDownloadButtonHelper {
|
|||||||
R.string.archive_dialog_title.toResString(),
|
R.string.archive_dialog_title.toResString(),
|
||||||
R.string.archive_vspace_dialog_content.toResString(),
|
R.string.archive_vspace_dialog_content.toResString(),
|
||||||
R.string.archive_vspace_dialog_confirm.toResString(),
|
R.string.archive_vspace_dialog_confirm.toResString(),
|
||||||
R.string.cancel.toResString(),
|
com.gh.gamecenter.common.R.string.cancel.toResString(),
|
||||||
{
|
{
|
||||||
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.archive_vspace_dialog_confirm.toResString())
|
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.archive_vspace_dialog_confirm.toResString())
|
||||||
VHelper.showVSpaceDialog(context, gameEntity)
|
VHelper.showVSpaceDialog(context, gameEntity)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(R.string.cancel.toResString())
|
NewFlatLogUtils.logCloudArchiveVSpaceDownloadDialogClick(com.gh.gamecenter.common.R.string.cancel.toResString())
|
||||||
},
|
},
|
||||||
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
||||||
)
|
)
|
||||||
@ -114,14 +114,14 @@ object ArchiveDownloadButtonHelper {
|
|||||||
R.string.archive_dialog_title.toResString(),
|
R.string.archive_dialog_title.toResString(),
|
||||||
R.string.archive_download_dialog_content.toResString(),
|
R.string.archive_download_dialog_content.toResString(),
|
||||||
R.string.archive_download_dialog_confirm.toResString(),
|
R.string.archive_download_dialog_confirm.toResString(),
|
||||||
R.string.cancel.toResString(),
|
com.gh.gamecenter.common.R.string.cancel.toResString(),
|
||||||
confirmClickCallback = {
|
confirmClickCallback = {
|
||||||
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.archive_download_dialog_confirm.toResString())
|
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.archive_download_dialog_confirm.toResString())
|
||||||
VHelper.disableLaunchGameAfterInstallation()
|
VHelper.disableLaunchGameAfterInstallation()
|
||||||
EventBus.getDefault().post(EBReuse("download"))
|
EventBus.getDefault().post(EBReuse("download"))
|
||||||
},
|
},
|
||||||
cancelClickCallback = {
|
cancelClickCallback = {
|
||||||
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.cancel.toResString())
|
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(com.gh.gamecenter.common.R.string.cancel.toResString())
|
||||||
},
|
},
|
||||||
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
||||||
)
|
)
|
||||||
@ -178,7 +178,7 @@ object ArchiveDownloadButtonHelper {
|
|||||||
VArchiveHelper.downloadArchive(archiveEntity)
|
VArchiveHelper.downloadArchive(archiveEntity)
|
||||||
|
|
||||||
// 下载进度弹窗
|
// 下载进度弹窗
|
||||||
val archiveLoadingDialog = Dialog(context, R.style.DialogWindowTransparent)
|
val archiveLoadingDialog = Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent)
|
||||||
val archiveLoadingBinding = DialogArchiveLoadingBinding.inflate(context.layoutInflater)
|
val archiveLoadingBinding = DialogArchiveLoadingBinding.inflate(context.layoutInflater)
|
||||||
showArchiveLoadingDialog(archiveLoadingDialog, archiveLoadingBinding.root)
|
showArchiveLoadingDialog(archiveLoadingDialog, archiveLoadingBinding.root)
|
||||||
|
|
||||||
@ -271,16 +271,21 @@ object ArchiveDownloadButtonHelper {
|
|||||||
R.string.archive_dialog_title.toResString(),
|
R.string.archive_dialog_title.toResString(),
|
||||||
R.string.archive_apply_dialog_content.toResString(),
|
R.string.archive_apply_dialog_content.toResString(),
|
||||||
R.string.archive_apply.toResString(),
|
R.string.archive_apply.toResString(),
|
||||||
R.string.cancel.toResString(),
|
com.gh.gamecenter.common.R.string.cancel.toResString(),
|
||||||
{
|
{
|
||||||
applyArchive(context, entrance, packageName, config, archiveEntity, gameEntity)
|
if(gameEntity.is32() && VHelper.isInnerInstalled(packageName) && !VCore.getInstance().isExtPackageInstalled()) {
|
||||||
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "使用")
|
// 32位的游戏 并且 32位畅玩没有安装 并且 一体化
|
||||||
SensorsBridge.trackEvent(
|
VHelper.newCwValidateVspaceBeforeAction(context, gameEntity) {}
|
||||||
"CloudSaveOverwriteDialogClick",
|
} else {
|
||||||
"game_id", gameEntity?.id ?: "",
|
applyArchive(context, entrance, packageName, config, archiveEntity, gameEntity)
|
||||||
"game_name", gameEntity?.name ?: "",
|
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "使用")
|
||||||
"button_name", "使用"
|
SensorsBridge.trackEvent(
|
||||||
)
|
"CloudSaveOverwriteDialogClick",
|
||||||
|
"game_id", gameEntity?.id ?: "",
|
||||||
|
"game_name", gameEntity?.name ?: "",
|
||||||
|
"button_name", "使用"
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "取消")
|
NewFlatLogUtils.logCloudArchiveApplyDialogRelated("cloud_save_overwrite_dialog_click", "取消")
|
||||||
|
|||||||
@ -41,7 +41,7 @@ object BbsReportHelper {
|
|||||||
CurrentActivityHolder.getCurrentActivity()?.apply {
|
CurrentActivityHolder.getCurrentActivity()?.apply {
|
||||||
if (this.isFinishing) return@apply
|
if (this.isFinishing) return@apply
|
||||||
|
|
||||||
val dialog = Dialog(this, R.style.DialogWindowTransparent)
|
val dialog = Dialog(this, com.gh.gamecenter.common.R.style.DialogWindowTransparent)
|
||||||
val binding: DialogReportReasonBinding =
|
val binding: DialogReportReasonBinding =
|
||||||
DialogReportReasonBinding.inflate(LayoutInflater.from(this))
|
DialogReportReasonBinding.inflate(LayoutInflater.from(this))
|
||||||
val reportReasonAdapter = ReportReasonAdapter(
|
val reportReasonAdapter = ReportReasonAdapter(
|
||||||
@ -64,7 +64,7 @@ object BbsReportHelper {
|
|||||||
this,
|
this,
|
||||||
1f,
|
1f,
|
||||||
false,
|
false,
|
||||||
R.color.ui_background
|
com.gh.gamecenter.common.R.color.ui_background
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
binding.reasonRv.adapter = reportReasonAdapter
|
binding.reasonRv.adapter = reportReasonAdapter
|
||||||
@ -94,7 +94,7 @@ object BbsReportHelper {
|
|||||||
binding.otherReasonEt.doOnTextChanged { text, start, before, count ->
|
binding.otherReasonEt.doOnTextChanged { text, start, before, count ->
|
||||||
val tvCount: Int = text.toString().length
|
val tvCount: Int = text.toString().length
|
||||||
if (tvCount >= 500) {
|
if (tvCount >= 500) {
|
||||||
binding.tvCount.setTextColor(R.color.secondary_red.toColor(binding.tvCount.context))
|
binding.tvCount.setTextColor(com.gh.gamecenter.common.R.color.secondary_red.toColor(binding.tvCount.context))
|
||||||
}
|
}
|
||||||
binding.tvCount.text = "$tvCount/500"
|
binding.tvCount.text = "$tvCount/500"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,21 @@
|
|||||||
package com.gh.common.util;
|
package com.gh.common.util;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||||
import com.gh.gamecenter.login.view.LoginActivity;
|
import com.gh.gamecenter.common.utils.NetworkUtils;
|
||||||
|
import com.gh.gamecenter.core.utils.CurrentActivityHolder;
|
||||||
import com.gh.gamecenter.login.user.UserManager;
|
import com.gh.gamecenter.login.user.UserManager;
|
||||||
|
import com.gh.gamecenter.login.utils.QuickLoginHelper;
|
||||||
|
import com.gh.gamecenter.login.view.LoginActivity;
|
||||||
import com.lightgame.utils.Utils;
|
import com.lightgame.utils.Utils;
|
||||||
|
|
||||||
|
import kotlin.Unit;
|
||||||
|
import kotlin.jvm.functions.Function0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by khy on 28/06/17.
|
* Created by khy on 28/06/17.
|
||||||
@ -22,15 +29,15 @@ public class CheckLoginUtils {
|
|||||||
LogUtils.login("dialog", null, entrance);
|
LogUtils.login("dialog", null, entrance);
|
||||||
LogUtils.login("activity", null, entrance);
|
LogUtils.login("activity", null, entrance);
|
||||||
|
|
||||||
// if (SPUtils.getBoolean(Constants.SP_HAS_GET_PHONE_INFO) || NetworkUtils.isOpenMobileData(context)) {
|
if (NetworkUtils.isQuickLoginEnabled(context)) {
|
||||||
// startQuickLogin(context, entrance);
|
startQuickLogin(context, entrance, null);
|
||||||
// } else {
|
} else {
|
||||||
// 有可能App未启动
|
// 有可能App未启动
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
||||||
bundle.putString(EntranceConsts.KEY_TO, LoginActivity.class.getName());
|
bundle.putString(EntranceConsts.KEY_TO, LoginActivity.class.getName());
|
||||||
EntranceUtils.jumpActivity(context, bundle);
|
EntranceUtils.jumpActivity(context, bundle);
|
||||||
// }
|
}
|
||||||
} else {
|
} else {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onLogin();
|
listener.onLogin();
|
||||||
@ -38,16 +45,16 @@ public class CheckLoginUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static void startQuickLogin(Context context, String entrance) {
|
private static void startQuickLogin(Context context, String entrance, Function0<Unit> callback) {
|
||||||
// // 需要确保传入的 context 不为 application
|
// 需要确保传入的 context 不为 application
|
||||||
// if (!(context instanceof Activity)) {
|
if (!(context instanceof Activity)) {
|
||||||
// context = CurrentActivityHolder.getCurrentActivity();
|
context = CurrentActivityHolder.getCurrentActivity();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (context != null) {
|
if (context != null) {
|
||||||
// QuickLoginHelper.startLogin(context, entrance);
|
QuickLoginHelper.startLogin(context, entrance, callback);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
public static void checkLogin(final Context context, Bundle nextToBundle, boolean isTriggerNextStep, String entrance, OnLoginListener listener) {
|
public static void checkLogin(final Context context, Bundle nextToBundle, boolean isTriggerNextStep, String entrance, OnLoginListener listener) {
|
||||||
if (!isLogin()) {
|
if (!isLogin()) {
|
||||||
@ -55,15 +62,25 @@ public class CheckLoginUtils {
|
|||||||
LogUtils.login("dialog", null, entrance);
|
LogUtils.login("dialog", null, entrance);
|
||||||
LogUtils.login("activity", null, entrance);
|
LogUtils.login("activity", null, entrance);
|
||||||
|
|
||||||
// 有可能App未启动
|
if (NetworkUtils.isQuickLoginEnabled(context)) {
|
||||||
Bundle bundle = new Bundle();
|
startQuickLogin(context, entrance, () -> {
|
||||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
if (isTriggerNextStep && listener != null && isLogin()) {
|
||||||
bundle.putString(EntranceConsts.KEY_TO, LoginActivity.class.getName());
|
listener.onLogin();
|
||||||
EntranceUtils.jumpActivity(context, nextToBundle, bundle, (resultCode, data) -> {
|
}
|
||||||
if (isTriggerNextStep && listener != null && isLogin()) {
|
return null;
|
||||||
listener.onLogin();
|
});
|
||||||
}
|
} else {
|
||||||
});
|
// 有可能App未启动
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
||||||
|
bundle.putString(EntranceConsts.KEY_TO, LoginActivity.class.getName());
|
||||||
|
EntranceUtils.jumpActivityCompat(context, bundle, nextToBundle, (resultCode, data) -> {
|
||||||
|
if (isTriggerNextStep && listener != null && isLogin()) {
|
||||||
|
listener.onLogin();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onLogin();
|
listener.onLogin();
|
||||||
|
|||||||
@ -177,7 +177,7 @@ object CommentHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val inflater = LayoutInflater.from(context)
|
val inflater = LayoutInflater.from(context)
|
||||||
val layout = inflater.inflate(R.layout.layout_popup_container, null)
|
val layout = inflater.inflate(com.gh.gamecenter.common.R.layout.layout_popup_container, null)
|
||||||
val popupWindow = BugFixedPopupWindow(
|
val popupWindow = BugFixedPopupWindow(
|
||||||
layout,
|
layout,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
|||||||
@ -117,7 +117,7 @@ public class CommentUtils {
|
|||||||
) {
|
) {
|
||||||
Context context = anchor.getContext();
|
Context context = anchor.getContext();
|
||||||
LayoutInflater inflater = LayoutInflater.from(context);
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
View contentView = inflater.inflate(R.layout.layout_popup_container, null);
|
View contentView = inflater.inflate(com.gh.gamecenter.common.R.layout.layout_popup_container, null);
|
||||||
PopupWindow popupWindow = new PopupWindow(
|
PopupWindow popupWindow = new PopupWindow(
|
||||||
contentView,
|
contentView,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
@ -198,14 +198,14 @@ public class CommentUtils {
|
|||||||
LinearLayout container = new LinearLayout(context);
|
LinearLayout container = new LinearLayout(context);
|
||||||
container.setOrientation(LinearLayout.VERTICAL);
|
container.setOrientation(LinearLayout.VERTICAL);
|
||||||
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
|
container.setPadding(0, DisplayUtils.dip2px(context, 12), 0, DisplayUtils.dip2px(context, 12));
|
||||||
container.setBackgroundColor(ContextCompat.getColor(context, R.color.ui_surface));
|
container.setBackgroundColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.ui_surface));
|
||||||
|
|
||||||
for (final String s : arrReportType) {
|
for (final String s : arrReportType) {
|
||||||
TextView reportTypeTv = new TextView(context);
|
TextView reportTypeTv = new TextView(context);
|
||||||
reportTypeTv.setText(s);
|
reportTypeTv.setText(s);
|
||||||
reportTypeTv.setTextSize(17);
|
reportTypeTv.setTextSize(17);
|
||||||
reportTypeTv.setTextColor(ContextCompat.getColor(context, R.color.title));
|
reportTypeTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.title));
|
||||||
reportTypeTv.setBackgroundResource(R.drawable.textview_white_style);
|
reportTypeTv.setBackgroundResource(com.gh.gamecenter.common.R.drawable.textview_white_style);
|
||||||
reportTypeTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
|
reportTypeTv.setLayoutParams(new LinearLayout.LayoutParams((widthPixels * 9) / 10,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT));
|
LinearLayout.LayoutParams.WRAP_CONTENT));
|
||||||
reportTypeTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
|
reportTypeTv.setPadding(DisplayUtils.dip2px(context, 20), DisplayUtils.dip2px(context, 12),
|
||||||
@ -248,12 +248,12 @@ public class CommentUtils {
|
|||||||
public static void postVote(final Context context, final CommentEntity commentEntity,
|
public static void postVote(final Context context, final CommentEntity commentEntity,
|
||||||
final TextView commentLikeCountTv, final ImageView commentLikeIv,
|
final TextView commentLikeCountTv, final ImageView commentLikeIv,
|
||||||
final OnVoteListener listener) {
|
final OnVoteListener listener) {
|
||||||
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.text_theme)) {
|
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme)) {
|
||||||
ToastUtils.INSTANCE.showToast("已经点过赞啦!");
|
ToastUtils.INSTANCE.showToast("已经点过赞啦!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
commentEntity.setVote(commentEntity.getVote() + 1);
|
commentEntity.setVote(commentEntity.getVote() + 1);
|
||||||
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
|
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme));
|
||||||
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
|
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
|
||||||
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
||||||
commentLikeCountTv.setVisibility(View.VISIBLE);
|
commentLikeCountTv.setVisibility(View.VISIBLE);
|
||||||
@ -271,7 +271,7 @@ public class CommentUtils {
|
|||||||
public void postFailed(Throwable e) {
|
public void postFailed(Throwable e) {
|
||||||
|
|
||||||
commentEntity.setVote(commentEntity.getVote() - 1);
|
commentEntity.setVote(commentEntity.getVote() - 1);
|
||||||
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
|
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.hint));
|
||||||
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
|
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
|
||||||
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
||||||
if (commentEntity.getVote() == 0) {
|
if (commentEntity.getVote() == 0) {
|
||||||
@ -318,12 +318,12 @@ public class CommentUtils {
|
|||||||
entrance = "视频流-评论-点赞";
|
entrance = "视频流-评论-点赞";
|
||||||
}
|
}
|
||||||
CheckLoginUtils.checkLogin(context, entrance, () -> {
|
CheckLoginUtils.checkLogin(context, entrance, () -> {
|
||||||
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, R.color.text_theme)) {
|
if (commentLikeCountTv.getCurrentTextColor() == ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme)) {
|
||||||
ToastUtils.INSTANCE.showToast("已经点过赞啦!");
|
ToastUtils.INSTANCE.showToast("已经点过赞啦!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
commentEntity.setVote(commentEntity.getVote() + 1);
|
commentEntity.setVote(commentEntity.getVote() + 1);
|
||||||
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
|
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme));
|
||||||
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
|
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
|
||||||
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
||||||
commentLikeCountTv.setVisibility(View.VISIBLE);
|
commentLikeCountTv.setVisibility(View.VISIBLE);
|
||||||
@ -340,7 +340,7 @@ public class CommentUtils {
|
|||||||
@Override
|
@Override
|
||||||
public void postFailed(Throwable e) {
|
public void postFailed(Throwable e) {
|
||||||
commentEntity.setVote(commentEntity.getVote() - 1);
|
commentEntity.setVote(commentEntity.getVote() - 1);
|
||||||
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
|
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.hint));
|
||||||
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
|
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
|
||||||
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
||||||
if (commentEntity.getVote() == 0) {
|
if (commentEntity.getVote() == 0) {
|
||||||
@ -394,7 +394,7 @@ public class CommentUtils {
|
|||||||
@Override
|
@Override
|
||||||
public void postFailed(Throwable e) {
|
public void postFailed(Throwable e) {
|
||||||
commentEntity.setVote(commentEntity.getVote() - 1);
|
commentEntity.setVote(commentEntity.getVote() - 1);
|
||||||
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.hint));
|
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.hint));
|
||||||
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
|
commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
|
||||||
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
||||||
if (commentEntity.getVote() == 0) {
|
if (commentEntity.getVote() == 0) {
|
||||||
@ -444,7 +444,7 @@ public class CommentUtils {
|
|||||||
public void onFailure(@Nullable HttpException e) {
|
public void onFailure(@Nullable HttpException e) {
|
||||||
super.onFailure(e);
|
super.onFailure(e);
|
||||||
commentEntity.setVote(commentEntity.getVote() + 1);
|
commentEntity.setVote(commentEntity.getVote() + 1);
|
||||||
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, R.color.text_theme));
|
commentLikeCountTv.setTextColor(ContextCompat.getColor(context, com.gh.gamecenter.common.R.color.text_theme));
|
||||||
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
|
commentLikeIv.setImageResource(R.drawable.comment_vote_select);
|
||||||
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
commentLikeCountTv.setText(NumberUtils.transSimpleCount(commentEntity.getVote()));
|
||||||
commentLikeCountTv.setVisibility(View.VISIBLE);
|
commentLikeCountTv.setVisibility(View.VISIBLE);
|
||||||
@ -487,7 +487,7 @@ public class CommentUtils {
|
|||||||
// 设置评论item 用户相关的view(点赞/头像/用户名)
|
// 设置评论item 用户相关的view(点赞/头像/用户名)
|
||||||
public static void setCommentUserView(Context mContext, CommentViewHolder holder, CommentEntity entity) {
|
public static void setCommentUserView(Context mContext, CommentViewHolder holder, CommentEntity entity) {
|
||||||
MeEntity userDataEntity = entity.getMe();
|
MeEntity userDataEntity = entity.getMe();
|
||||||
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, R.color.hint));
|
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, com.gh.gamecenter.common.R.color.hint));
|
||||||
holder.commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
|
holder.commentLikeIv.setImageResource(R.drawable.comment_vote_unselect);
|
||||||
|
|
||||||
if (userDataEntity == null || !userDataEntity.isCommentOwner()) {
|
if (userDataEntity == null || !userDataEntity.isCommentOwner()) {
|
||||||
@ -502,7 +502,7 @@ public class CommentUtils {
|
|||||||
holder.commentLikeCountTv.setVisibility(View.GONE);
|
holder.commentLikeCountTv.setVisibility(View.GONE);
|
||||||
} else { // 检查是否已点赞
|
} else { // 检查是否已点赞
|
||||||
if (userDataEntity != null && (userDataEntity.isCommentVoted())) {
|
if (userDataEntity != null && (userDataEntity.isCommentVoted())) {
|
||||||
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, R.color.text_theme));
|
holder.commentLikeCountTv.setTextColor(ContextCompat.getColor(mContext, com.gh.gamecenter.common.R.color.text_theme));
|
||||||
holder.commentLikeIv.setImageResource(R.drawable.comment_vote_select);
|
holder.commentLikeIv.setImageResource(R.drawable.comment_vote_select);
|
||||||
}
|
}
|
||||||
holder.commentLikeCountTv.setVisibility(View.VISIBLE);
|
holder.commentLikeCountTv.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import android.widget.LinearLayout;
|
|||||||
import com.facebook.drawee.drawable.ScalingUtils;
|
import com.facebook.drawee.drawable.ScalingUtils;
|
||||||
import com.facebook.drawee.view.SimpleDraweeView;
|
import com.facebook.drawee.view.SimpleDraweeView;
|
||||||
import com.gh.gamecenter.ImageViewerActivity;
|
import com.gh.gamecenter.ImageViewerActivity;
|
||||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
|
||||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||||
|
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -121,5 +121,4 @@ public class ConcernContentUtils {
|
|||||||
}
|
}
|
||||||
return imageView;
|
return imageView;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,14 @@
|
|||||||
package com.gh.common.util;
|
package com.gh.common.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
|
||||||
|
|
||||||
import com.gh.gamecenter.common.constant.Constants;
|
import com.gh.gamecenter.common.constant.Constants;
|
||||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||||
import com.gh.gamecenter.common.utils.NetworkUtils;
|
|
||||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||||
import com.gh.gamecenter.entity.NewsDetailEntity;
|
import com.gh.gamecenter.entity.NewsDetailEntity;
|
||||||
import com.gh.gamecenter.feature.utils.PlatformUtils;
|
import com.gh.gamecenter.feature.utils.PlatformUtils;
|
||||||
import com.gh.gamecenter.manager.DataCollectionManager;
|
import com.gh.gamecenter.manager.DataCollectionManager;
|
||||||
import com.gh.gamecenter.manager.PackagesManager;
|
|
||||||
import com.lightgame.download.DownloadEntity;
|
import com.lightgame.download.DownloadEntity;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -32,7 +29,7 @@ public class DataCollectionUtils {
|
|||||||
map.put("type", android.os.Build.MODEL);
|
map.put("type", android.os.Build.MODEL);
|
||||||
map.put("system", android.os.Build.VERSION.SDK_INT + "=" + android.os.Build.VERSION.RELEASE);
|
map.put("system", android.os.Build.VERSION.SDK_INT + "=" + android.os.Build.VERSION.RELEASE);
|
||||||
// WIFI实时
|
// WIFI实时
|
||||||
DataCollectionManager.onEvent(context, "error", map, NetworkUtils.isWifiConnected(context));
|
DataCollectionManager.onEvent(context, "error", map, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传下载数据(开始、完成)
|
// 上传下载数据(开始、完成)
|
||||||
|
|||||||
@ -9,19 +9,18 @@ import android.preference.PreferenceManager;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.gh.ad.AdDelegateHelper;
|
import com.gh.ad.AdDelegateHelper;
|
||||||
import com.gh.gamecenter.BuildConfig;
|
import com.gh.gamecenter.BuildConfig;
|
||||||
import com.gh.gamecenter.common.base.GlobalActivityManager;
|
|
||||||
import com.gh.gamecenter.common.base.activity.BaseActivity;
|
|
||||||
import com.gh.gamecenter.common.constant.Constants;
|
import com.gh.gamecenter.common.constant.Constants;
|
||||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
import com.gh.gamecenter.common.constant.RouteConsts;
|
||||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||||
import com.gh.gamecenter.common.retrofit.BiResponse;
|
import com.gh.gamecenter.common.retrofit.BiResponse;
|
||||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
import com.gh.gamecenter.core.AppExecutor;
|
||||||
|
import com.gh.gamecenter.core.provider.ISentryProvider;
|
||||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
|
||||||
import com.gh.gamecenter.core.utils.SPUtils;
|
import com.gh.gamecenter.core.utils.SPUtils;
|
||||||
import com.gh.gamecenter.core.utils.SentryHelper;
|
import com.gh.gamecenter.feature.utils.SentryHelper;
|
||||||
import com.gh.gamecenter.login.entity.IdCardEntity;
|
import com.gh.gamecenter.login.entity.IdCardEntity;
|
||||||
import com.gh.gamecenter.login.entity.UserInfoEntity;
|
import com.gh.gamecenter.login.entity.UserInfoEntity;
|
||||||
import com.gh.gamecenter.provider.GhContentProvider;
|
import com.gh.gamecenter.provider.GhContentProvider;
|
||||||
@ -32,12 +31,7 @@ import com.halo.assistant.HaloApp;
|
|||||||
import com.lightgame.config.CommonDebug;
|
import com.lightgame.config.CommonDebug;
|
||||||
import com.lightgame.utils.Utils;
|
import com.lightgame.utils.Utils;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
|
||||||
|
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import io.sentry.Sentry;
|
|
||||||
import io.sentry.android.core.SentryAndroid;
|
|
||||||
import kotlin.Pair;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by LGT on 2016/6/15.
|
* Created by LGT on 2016/6/15.
|
||||||
@ -61,92 +55,58 @@ public class DataUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void initSentry(Context context, String channel) {
|
private static void initSentry(Context context, String channel) {
|
||||||
SentryAndroid.init(context, options -> {
|
ISentryProvider sentryProvider = (ISentryProvider) ARouter.getInstance().build(RouteConsts.provider.sentry).navigation();
|
||||||
// Sentry 疯狂报 ANR (很大一部分还是莫名奇妙的 ANR)严重影响到其它闪退日志的收集
|
if (sentryProvider != null) {
|
||||||
// 这里将它局限到只有官网渠道的包才统计 ANR
|
sentryProvider.init(context, channel, BuildConfig.FLAVOR, BuildConfig.VERSION_NAME);
|
||||||
if ("GH_206".equals(channel) || "GH_BETA".equals(channel) || com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0) {
|
}
|
||||||
options.setAnrEnabled(true);
|
|
||||||
options.setAnrTimeoutIntervalMillis(6000);
|
|
||||||
} else {
|
|
||||||
options.setAnrEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
options.setDebug(BuildConfig.DEBUG);
|
|
||||||
options.setEnableAutoSessionTracking(true);
|
|
||||||
options.setEnvironment(BuildConfig.FLAVOR);
|
|
||||||
options.setEnableSystemEventBreadcrumbs(false);
|
|
||||||
options.setDsn("https://6b1caf0d17c1408e8680f3f73ff80bd0@sentry.shanqu.cc/22");
|
|
||||||
|
|
||||||
options.setBeforeSend((event, hint) -> {
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
options.setBeforeBreadcrumb(((breadcrumb, hint) -> {
|
|
||||||
if ("ui.lifecycle".equals(breadcrumb.getCategory()) && "started".equals(breadcrumb.getData("state")) && GlobalActivityManager.INSTANCE.getCurrentActivity() instanceof BaseActivity) {
|
|
||||||
Pair<String, String> businessId = ((BaseActivity) GlobalActivityManager.INSTANCE.getCurrentActivity()).getBusinessId();
|
|
||||||
if (businessId != null) {
|
|
||||||
breadcrumb.setData("businessId1", businessId.component1());
|
|
||||||
breadcrumb.setData("businessId2", businessId.component2());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return breadcrumb;
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
Sentry.configureScope(scope -> {
|
|
||||||
if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) {
|
|
||||||
scope.setTag("alias", "内测版" + BuildConfig.VERSION_NAME);
|
|
||||||
} else {
|
|
||||||
scope.setTag("alias", "正式版" + BuildConfig.VERSION_NAME);
|
|
||||||
scope.setTag("channel", channel);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getGid() {
|
public static void getGid() {
|
||||||
GidHelper.getInstance().registerDevice(HaloApp.getInstance().getApplication(), new GidCallback() {
|
// 默认用 APP 级已存储的 GID 来使用,不使用外部 GID
|
||||||
@Override
|
String savedGid = SPUtils.getString(Constants.GID);
|
||||||
public void onSuccess(String gid) {
|
if (!TextUtils.isEmpty(savedGid)) {
|
||||||
Utils.log("Gid", gid);
|
HaloApp.getInstance().setGid(savedGid);
|
||||||
PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication()).edit().putString(Constants.DEVICE_KEY, gid).apply();
|
onGidReceived(savedGid);
|
||||||
|
} else {
|
||||||
|
GidHelper.getInstance().registerDevice(HaloApp.getInstance().getApplication(), new GidCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String gid) {
|
||||||
|
Utils.log("Gid", gid);
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication()).edit().putString(Constants.DEVICE_KEY, gid).apply();
|
||||||
|
|
||||||
// 默认用 APP 级已存储的 GID 来使用,不使用外部 GID
|
|
||||||
String savedGid = SPUtils.getString(Constants.GID);
|
|
||||||
if (!TextUtils.isEmpty(savedGid)) {
|
|
||||||
gid = savedGid;
|
|
||||||
} else {
|
|
||||||
SPUtils.setString(Constants.GID, gid);
|
SPUtils.setString(Constants.GID, gid);
|
||||||
|
|
||||||
|
onGidReceived(gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
HaloApp.getInstance().setGid(gid);
|
@Override
|
||||||
|
public void onFailure(String s) {
|
||||||
// 更新广告配置
|
// 更新广告配置
|
||||||
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
|
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
|
||||||
|
|
||||||
getDeviceCertification(gid);
|
|
||||||
|
|
||||||
// 避免初始化顺序问题导致 MetaUtil 一直持有空的 gid
|
|
||||||
MetaUtil.INSTANCE.refreshMeta();
|
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
|
||||||
values.put(GhContentProvider.KEY_GID, gid);
|
|
||||||
values.put(GhContentProvider.KEY_ANDROID_ID, MetaUtil.getBase64EncodedAndroidId());
|
|
||||||
try {
|
|
||||||
HaloApp.getInstance().getContentResolver().insert(Uri.parse("content://com.gh.gamecenter.provider/device"), values);
|
|
||||||
} catch (Exception exception) {
|
|
||||||
SentryHelper.INSTANCE.onEvent("DEVICE_INSERT_ERROR", "exception_digest", exception.getLocalizedMessage());
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
private static void onGidReceived(String gid) {
|
||||||
public void onFailure(String s) {
|
HaloApp.getInstance().setGid(gid);
|
||||||
// 更新广告配置
|
// 更新广告配置
|
||||||
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
|
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
|
||||||
|
|
||||||
|
getDeviceCertification(gid);
|
||||||
|
|
||||||
|
// 避免初始化顺序问题导致 MetaUtil 一直持有空的 gid
|
||||||
|
MetaUtil.INSTANCE.refreshMeta();
|
||||||
|
|
||||||
|
AppExecutor.getIoExecutor().execute(() -> {
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(GhContentProvider.KEY_GID, gid);
|
||||||
|
values.put(GhContentProvider.KEY_ANDROID_ID, MetaUtil.getBase64EncodedAndroidId());
|
||||||
|
try {
|
||||||
|
HaloApp.getInstance().getContentResolver().insert(Uri.parse("content://com.gh.gamecenter.provider/device"), values);
|
||||||
|
} catch (Exception exception) {
|
||||||
|
SentryHelper.INSTANCE.onEvent("DEVICE_INSERT_ERROR", "exception_digest", exception.getLocalizedMessage());
|
||||||
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import android.text.TextUtils;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.gh.common.constant.Config;
|
|
||||||
import com.gh.common.filter.RegionSetting;
|
import com.gh.common.filter.RegionSetting;
|
||||||
import com.gh.common.filter.RegionSettingHelper;
|
import com.gh.common.filter.RegionSettingHelper;
|
||||||
import com.gh.common.repository.ReservationRepository;
|
import com.gh.common.repository.ReservationRepository;
|
||||||
@ -19,6 +18,7 @@ import com.gh.gamecenter.common.constant.Constants;
|
|||||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||||
import com.gh.gamecenter.core.utils.SPUtils;
|
import com.gh.gamecenter.core.utils.SPUtils;
|
||||||
|
import com.gh.gamecenter.core.utils.SpeedUtils;
|
||||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||||
import com.gh.gamecenter.feature.entity.PluginLocation;
|
import com.gh.gamecenter.feature.entity.PluginLocation;
|
||||||
import com.gh.gamecenter.feature.view.DownloadButton;
|
import com.gh.gamecenter.feature.view.DownloadButton;
|
||||||
@ -48,11 +48,6 @@ public class DetailDownloadUtils {
|
|||||||
GameEntity gameEntity = viewHolder.getGameEntity();
|
GameEntity gameEntity = viewHolder.getGameEntity();
|
||||||
String downloadAddWord = gameEntity.getDownloadAddWord();
|
String downloadAddWord = gameEntity.getDownloadAddWord();
|
||||||
|
|
||||||
// 隐藏下载按钮上的畅玩文案
|
|
||||||
if (viewHolder.getOverlayTv() != null) {
|
|
||||||
viewHolder.getOverlayTv().setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 多版本下载箭头
|
// 多版本下载箭头
|
||||||
if (viewHolder.getMultiVersionDownloadTv() != null) {
|
if (viewHolder.getMultiVersionDownloadTv() != null) {
|
||||||
viewHolder.getMultiVersionDownloadTv().setVisibility(View.GONE);
|
viewHolder.getMultiVersionDownloadTv().setVisibility(View.GONE);
|
||||||
@ -117,17 +112,6 @@ public class DetailDownloadUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新默认的下载按钮
|
|
||||||
updateWithSingleApk(
|
|
||||||
gameEntity,
|
|
||||||
viewHolder,
|
|
||||||
viewHolder.getDownloadPb(),
|
|
||||||
downloadAddWord,
|
|
||||||
showVGame,
|
|
||||||
showDualDownloadButton,
|
|
||||||
downloadEntity
|
|
||||||
);
|
|
||||||
|
|
||||||
if (showDualDownloadButton) {
|
if (showDualDownloadButton) {
|
||||||
// 双下载按钮时更新占位的下载按钮
|
// 双下载按钮时更新占位的下载按钮
|
||||||
updateWithSingleApk(
|
updateWithSingleApk(
|
||||||
@ -140,6 +124,17 @@ public class DetailDownloadUtils {
|
|||||||
downloadEntity
|
downloadEntity
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新默认的下载按钮
|
||||||
|
updateWithSingleApk(
|
||||||
|
gameEntity,
|
||||||
|
viewHolder,
|
||||||
|
viewHolder.getDownloadPb(),
|
||||||
|
downloadAddWord,
|
||||||
|
showVGame,
|
||||||
|
showDualDownloadButton,
|
||||||
|
downloadEntity
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// 游戏包含多 APK 的情况
|
// 游戏包含多 APK 的情况
|
||||||
viewHolder.getMultiVersionDownloadTv().setText("选择下载你的版本" + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord));
|
viewHolder.getMultiVersionDownloadTv().setText("选择下载你的版本" + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord));
|
||||||
@ -192,49 +187,53 @@ public class DetailDownloadUtils {
|
|||||||
Context context = viewHolder.getContext();
|
Context context = viewHolder.getContext();
|
||||||
TextView overlayTv = viewHolder.getOverlayTv();
|
TextView overlayTv = viewHolder.getOverlayTv();
|
||||||
|
|
||||||
String status = GameUtils.getDownloadBtnText(context, gameEntity, false, showAsVGame, PluginLocation.only_game);
|
boolean containsAddWord = !TextUtils.isEmpty(downloadAddWord); // 是否存在下载补充文案
|
||||||
|
|
||||||
|
// 根据游戏实体获取下载按钮文案
|
||||||
|
String rawBtnText = GameUtils.getDownloadBtnText(context, gameEntity, false, showAsVGame, PluginLocation.only_game);
|
||||||
|
|
||||||
if (showAsVGame) {
|
if (showAsVGame) {
|
||||||
// 显示为畅玩游戏
|
// 显示为畅玩游戏
|
||||||
if (context.getString(R.string.launch).equals(status)) {
|
if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
||||||
} else {
|
} else {
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
String btnText;
|
String decoratedBtnText;
|
||||||
|
// 双下载按钮时,显示特殊样式
|
||||||
if (showDualDownloadButton
|
if (showDualDownloadButton
|
||||||
&& (context.getString(R.string.launch).equals(status) || context.getString(R.string.install).equals(status) || context.getString(R.string.smooth).equals(status) || context.getString(R.string.update).equals(status))) {
|
&& (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.smooth).equals(rawBtnText) || context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText))) {
|
||||||
if (context.getString(R.string.smooth).equals(status)) {
|
if (context.getString(com.gh.gamecenter.feature.R.string.smooth).equals(rawBtnText)) {
|
||||||
btnText = context.getString(R.string.download_v);
|
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.download_v);
|
||||||
} else if (context.getString(R.string.update).equals(status)) {
|
} else if (context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText)) {
|
||||||
btnText = context.getString(R.string.update_v);
|
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.update_v);
|
||||||
} else {
|
} else {
|
||||||
btnText = context.getString(R.string.launch_v);
|
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.launch_v);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
|
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
|
||||||
overlayTv.setVisibility(View.VISIBLE);
|
overlayTv.setVisibility(View.VISIBLE);
|
||||||
overlayTv.setText(btnText);
|
overlayTv.setText(decoratedBtnText);
|
||||||
downloadButton.setText("");
|
downloadButton.setText("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
btnText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : downloadAddWord) + getDownloadSizeText(viewHolder);
|
decoratedBtnText = rawBtnText + (containsAddWord? "" : downloadAddWord) + getWrappedDownloadSizeText(viewHolder);
|
||||||
|
|
||||||
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
|
if (overlayTv != null && downloadButton.getVisibility() != View.GONE) {
|
||||||
if (context.getString(R.string.launch).equals(status)
|
if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)
|
||||||
|| context.getString(R.string.install).equals(status)) {
|
|| context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
|
||||||
overlayTv.setVisibility(View.VISIBLE);
|
overlayTv.setVisibility(View.VISIBLE);
|
||||||
overlayTv.setText("启动(畅玩)");
|
overlayTv.setText("启动(畅玩)");
|
||||||
} else {
|
} else {
|
||||||
overlayTv.setVisibility(View.GONE);
|
overlayTv.setVisibility(View.GONE);
|
||||||
downloadButton.setText(btnText);
|
downloadButton.setText(decoratedBtnText);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (overlayTv != null) {
|
if (overlayTv != null) {
|
||||||
overlayTv.setVisibility(View.GONE);
|
overlayTv.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
downloadButton.setText(btnText);
|
downloadButton.setText(decoratedBtnText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,11 +246,11 @@ public class DetailDownloadUtils {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 非畅玩,显示为普通游戏
|
// 非畅玩,显示为普通游戏
|
||||||
if (context.getString(R.string.pluggable).equals(status)) {
|
if (context.getString(com.gh.gamecenter.feature.R.string.pluggable).equals(rawBtnText)) {
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.PLUGIN);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.PLUGIN);
|
||||||
} else if (context.getString(R.string.launch).equals(status)) {
|
} else if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
||||||
} else if (context.getString(R.string.install).equals(status)) {
|
} else if (context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
|
||||||
} else {
|
} else {
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
|
||||||
@ -271,55 +270,85 @@ public class DetailDownloadUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String btnText;
|
String decoratedBtnText;
|
||||||
String extraBtnText;
|
String localBtnText;
|
||||||
|
boolean useAlternativeTextStyle = false; // 是否使用带图标的文案,仅不包含补充文案时使用且
|
||||||
|
|
||||||
|
// 更新下载按钮文案
|
||||||
if (viewHolder.isNewsDetail()) {
|
if (viewHolder.isNewsDetail()) {
|
||||||
btnText = status;
|
decoratedBtnText = rawBtnText;
|
||||||
extraBtnText = status;
|
localBtnText = rawBtnText;
|
||||||
} else if (context.getString(R.string.pluggable).equals(status)) {
|
} else if (context.getString(com.gh.gamecenter.feature.R.string.pluggable).equals(rawBtnText)) {
|
||||||
btnText = "升级" + (TextUtils.isEmpty(downloadAddWord) ? "" : "至" + downloadAddWord) + getDownloadSizeText(viewHolder);
|
decoratedBtnText = "升级" + (!containsAddWord ? "" : "至" + downloadAddWord) + getWrappedDownloadSizeText(viewHolder);
|
||||||
extraBtnText = "升级" + (TextUtils.isEmpty(downloadAddWord) ? "" : "至" + downloadAddWord);
|
localBtnText = "升级" + (!containsAddWord ? "" : "至" + downloadAddWord);
|
||||||
} else if (context.getString(R.string.launch).equals(status)) {
|
} else if (context.getString(com.gh.gamecenter.feature.R.string.launch).equals(rawBtnText)) {
|
||||||
btnText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord);
|
decoratedBtnText = rawBtnText + (!containsAddWord ? "" : "-" + downloadAddWord);
|
||||||
extraBtnText = context.getString(R.string.launch_local);
|
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.launch_local);
|
||||||
} else if (context.getString(R.string.attempt).equals(status)) {
|
} else if (context.getString(com.gh.gamecenter.feature.R.string.attempt).equals(rawBtnText)) {
|
||||||
btnText = status + getDownloadSizeText(viewHolder);
|
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.attempt);
|
||||||
extraBtnText = status;
|
localBtnText = rawBtnText;
|
||||||
if (showDualDownloadButton
|
if (showDualDownloadButton
|
||||||
&& viewHolder.getLocalDownloadContainer() != null
|
&& viewHolder.getLocalDownloadContainer() != null
|
||||||
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
|
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
|
||||||
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
|
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
|
||||||
|
} else if (viewHolder.getOverlayTv() != null) {
|
||||||
|
useAlternativeTextStyle = true;
|
||||||
}
|
}
|
||||||
} else if (context.getString(R.string.install).equals(status)) {
|
} else if (context.getString(com.gh.gamecenter.feature.R.string.install).equals(rawBtnText)) {
|
||||||
btnText = context.getString(R.string.install);
|
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.install);
|
||||||
extraBtnText = context.getString(R.string.install_local);
|
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.install_local);
|
||||||
} else if (context.getString(R.string.update).equals(status)) {
|
} else if (context.getString(com.gh.gamecenter.feature.R.string.update).equals(rawBtnText)) {
|
||||||
btnText = context.getString(R.string.update);
|
decoratedBtnText = context.getString(com.gh.gamecenter.feature.R.string.update);
|
||||||
extraBtnText = context.getString(R.string.update_local);
|
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.update_local);
|
||||||
if (showDualDownloadButton
|
if (showDualDownloadButton
|
||||||
&& viewHolder.getLocalDownloadContainer() != null
|
&& viewHolder.getLocalDownloadContainer() != null
|
||||||
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
|
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
|
||||||
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
|
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
btnText = status + (TextUtils.isEmpty(downloadAddWord) ? "" : downloadAddWord) + getDownloadSizeText(viewHolder);
|
if (containsAddWord) {
|
||||||
extraBtnText = context.getString(R.string.download_local);
|
decoratedBtnText = rawBtnText + downloadAddWord + getWrappedDownloadSizeText(viewHolder);
|
||||||
|
} else {
|
||||||
|
decoratedBtnText = rawBtnText;
|
||||||
|
}
|
||||||
|
localBtnText = context.getString(com.gh.gamecenter.feature.R.string.download_local);
|
||||||
if (showDualDownloadButton
|
if (showDualDownloadButton
|
||||||
&& viewHolder.getLocalDownloadContainer() != null
|
&& viewHolder.getLocalDownloadContainer() != null
|
||||||
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
|
&& viewHolder.getLocalDownloadContainer().getVisibility() == View.VISIBLE) {
|
||||||
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
|
viewHolder.getLocalDownloadSizeTv().setVisibility(View.VISIBLE);
|
||||||
|
} else if (viewHolder.getOverlayTv() != null && !containsAddWord) {
|
||||||
|
useAlternativeTextStyle = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
downloadButton.setText(btnText);
|
|
||||||
|
if (useAlternativeTextStyle) {
|
||||||
|
downloadButton.setText("");
|
||||||
|
viewHolder.getOverlayTv().setText(decoratedBtnText);
|
||||||
|
viewHolder.getOverlayTv().setVisibility(View.VISIBLE);
|
||||||
|
viewHolder.getOverlayTv().setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_special_download, 0, 0, 0);
|
||||||
|
if (viewHolder.getExtraOverlayTv() != null) {
|
||||||
|
viewHolder.getExtraOverlayTv().setVisibility(View.VISIBLE);
|
||||||
|
viewHolder.getExtraOverlayTv().setText(gameEntity.getApk().get(0).getSize());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (viewHolder.getOverlayTv() != null && !showDualDownloadButton) {
|
||||||
|
viewHolder.getOverlayTv().setVisibility(View.GONE);
|
||||||
|
if (viewHolder.getExtraOverlayTv() != null) {
|
||||||
|
viewHolder.getExtraOverlayTv().setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
downloadButton.setText(decoratedBtnText);
|
||||||
|
}
|
||||||
|
|
||||||
if (viewHolder.getLocalDownloadTitleTv() != null) {
|
if (viewHolder.getLocalDownloadTitleTv() != null) {
|
||||||
viewHolder.getLocalDownloadTitleTv().setText(extraBtnText);
|
viewHolder.getLocalDownloadTitleTv().setText(localBtnText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlayTv != null && overlayTv.getVisibility() == View.VISIBLE) {
|
if (overlayTv != null && overlayTv.getVisibility() == View.VISIBLE) {
|
||||||
downloadButton.setTag(R.string.download, overlayTv.getText());
|
downloadButton.setTag(com.gh.gamecenter.feature.R.string.download, overlayTv.getText());
|
||||||
} else {
|
} else {
|
||||||
downloadButton.setTag(R.string.download, downloadButton.getText());
|
downloadButton.setTag(com.gh.gamecenter.feature.R.string.download, downloadButton.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downloadEntity == null) return;
|
if (downloadEntity == null) return;
|
||||||
@ -349,10 +378,13 @@ public class DetailDownloadUtils {
|
|||||||
if (overlayTv != null
|
if (overlayTv != null
|
||||||
&& downloadEntity.getStatus() != DownloadStatus.done) {
|
&& downloadEntity.getStatus() != DownloadStatus.done) {
|
||||||
overlayTv.setVisibility(View.GONE);
|
overlayTv.setVisibility(View.GONE);
|
||||||
|
if (viewHolder.getExtraOverlayTv() != null) {
|
||||||
|
viewHolder.getExtraOverlayTv().setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showAsVGame) {
|
if (showAsVGame) {
|
||||||
updateVStyleDownloadButton(viewHolder, downloadButton, downloadEntity, status);
|
updateVStyleDownloadButton(viewHolder, downloadButton, downloadEntity, rawBtnText);
|
||||||
} else {
|
} else {
|
||||||
updateDefaultStyleDownloadButton(context, viewHolder, downloadButton, gameEntity, downloadEntity);
|
updateDefaultStyleDownloadButton(context, viewHolder, downloadButton, gameEntity, downloadEntity);
|
||||||
}
|
}
|
||||||
@ -441,7 +473,7 @@ public class DetailDownloadUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getDownloadSizeText(DetailViewHolder viewHolder) {
|
private static String getWrappedDownloadSizeText(DetailViewHolder viewHolder) {
|
||||||
return String.format("(%s)", viewHolder.getGameEntity().getApk().isEmpty() ? "" : viewHolder.getGameEntity().getApk().get(0).getSize());
|
return String.format("(%s)", viewHolder.getGameEntity().getApk().isEmpty() ? "" : viewHolder.getGameEntity().getApk().get(0).getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,11 +484,11 @@ public class DetailDownloadUtils {
|
|||||||
switch (downloadEntity.getStatus()) {
|
switch (downloadEntity.getStatus()) {
|
||||||
case redirected:
|
case redirected:
|
||||||
case downloading:
|
case downloading:
|
||||||
downloadButton.setText("游戏加载中 " + downloadEntity.getPercent() + "%");
|
downloadButton.setText(SpeedUtils.getSpeed(downloadEntity.getSpeed()));
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
|
||||||
break;
|
break;
|
||||||
case waiting:
|
case waiting:
|
||||||
downloadButton.setText(R.string.waiting);
|
downloadButton.setText(com.gh.gamecenter.feature.R.string.waiting);
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
|
||||||
break;
|
break;
|
||||||
case overflow:
|
case overflow:
|
||||||
@ -466,11 +498,13 @@ public class DetailDownloadUtils {
|
|||||||
case diskisfull:
|
case diskisfull:
|
||||||
case diskioerror:
|
case diskioerror:
|
||||||
case pause:
|
case pause:
|
||||||
downloadButton.setText("继续加载 " + downloadEntity.getPercent() + "%");
|
String pausedText = viewHolder.getContext().getString(com.gh.gamecenter.feature.R.string.paused);
|
||||||
|
downloadButton.setText(getValidProgress(downloadEntity) + "% " + pausedText);
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
|
||||||
break;
|
break;
|
||||||
case done:
|
case done:
|
||||||
if (!status.contains("更新")) {
|
String updateText = viewHolder.getContext().getString(com.gh.gamecenter.feature.R.string.update);
|
||||||
|
if (!status.contains(updateText)) {
|
||||||
if (VHelper.isInstalled(downloadEntity.getPackageName())) {
|
if (VHelper.isInstalled(downloadEntity.getPackageName())) {
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
||||||
} else {
|
} else {
|
||||||
@ -510,8 +544,9 @@ public class DetailDownloadUtils {
|
|||||||
case diskisfull:
|
case diskisfull:
|
||||||
case diskioerror:
|
case diskioerror:
|
||||||
case overflow:
|
case overflow:
|
||||||
String downloadingText = "游戏加载中 " + downloadEntity.getPercent() + "%";
|
String pausedText = context.getString(com.gh.gamecenter.feature.R.string.paused);
|
||||||
String resumeText = "继续加载 " + downloadEntity.getPercent() + "%";
|
String downloadingText = SpeedUtils.getSpeed(downloadEntity.getSpeed());
|
||||||
|
String resumeText = getValidProgress(downloadEntity) + "% " + pausedText;
|
||||||
downloadButton.setText((downloadEntity.getStatus() == DownloadStatus.downloading || downloadEntity.getStatus() == DownloadStatus.redirected) ? downloadingText : resumeText);
|
downloadButton.setText((downloadEntity.getStatus() == DownloadStatus.downloading || downloadEntity.getStatus() == DownloadStatus.redirected) ? downloadingText : resumeText);
|
||||||
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
|
if (downloadEntity.isPluggable() && PackagesManager.isInstalled(downloadEntity.getPackageName())) {
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN);
|
||||||
@ -520,7 +555,7 @@ public class DetailDownloadUtils {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case waiting:
|
case waiting:
|
||||||
downloadButton.setText(R.string.waiting);
|
downloadButton.setText(com.gh.gamecenter.feature.R.string.waiting);
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.WAITING);
|
||||||
break;
|
break;
|
||||||
case done:
|
case done:
|
||||||
@ -528,21 +563,21 @@ public class DetailDownloadUtils {
|
|||||||
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(context, gameEntity.getSimulator().getApk().getPackageName());
|
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(context, gameEntity.getSimulator().getApk().getPackageName());
|
||||||
boolean isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(context);
|
boolean isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(context);
|
||||||
if (isInstalled || isInstalledNewSimulator) {
|
if (isInstalled || isInstalledNewSimulator) {
|
||||||
downloadButton.setText(R.string.launch);
|
downloadButton.setText(com.gh.gamecenter.feature.R.string.launch);
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.LAUNCH_OR_OPEN);
|
||||||
} else {
|
} else {
|
||||||
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
|
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
|
||||||
downloadButton.setText(R.string.browser_install_install);
|
downloadButton.setText(com.gh.gamecenter.feature.R.string.browser_install_install);
|
||||||
} else {
|
} else {
|
||||||
downloadButton.setText(R.string.install);
|
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
|
||||||
}
|
}
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.INSTALL_NORMAL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
|
if (SPUtils.getBoolean(Constants.SP_USE_BROWSER_TO_INSTALL) && !Objects.equals(Constants.XAPK_APKS_FORMAT, downloadEntity.getFormat())) {
|
||||||
downloadButton.setText(R.string.browser_install_install);
|
downloadButton.setText(com.gh.gamecenter.feature.R.string.browser_install_install);
|
||||||
} else {
|
} else {
|
||||||
downloadButton.setText(R.string.install);
|
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,6 +596,10 @@ public class DetailDownloadUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getValidProgress(DownloadEntity downloadEntity) {
|
||||||
|
return (int) Math.ceil(downloadEntity.getPercent());
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean handleDownloadButtonAsXapk(DownloadEntity downloadEntity, DownloadButton downloadButton) {
|
private static boolean handleDownloadButtonAsXapk(DownloadEntity downloadEntity, DownloadButton downloadButton) {
|
||||||
String xapkStatus = downloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_STATUS);
|
String xapkStatus = downloadEntity.getMeta().get(XapkInstaller.XAPK_UNZIP_STATUS);
|
||||||
|
|
||||||
@ -578,7 +617,7 @@ public class DetailDownloadUtils {
|
|||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_UNZIPPING);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_UNZIPPING);
|
||||||
return true;
|
return true;
|
||||||
} else if (XapkUnzipStatus.FAILURE.name().equals(xapkStatus)) {
|
} else if (XapkUnzipStatus.FAILURE.name().equals(xapkStatus)) {
|
||||||
downloadButton.setText(R.string.install);
|
downloadButton.setText(com.gh.gamecenter.feature.R.string.install);
|
||||||
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_FAILURE);
|
downloadButton.setButtonStyle(DownloadButton.ButtonStyle.XAPK_FAILURE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.gh.common.util;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -66,6 +67,7 @@ import com.gh.gamecenter.databinding.DialogReportReasonBinding;
|
|||||||
import com.gh.gamecenter.databinding.DialogWechatReserveSuccessBinding;
|
import com.gh.gamecenter.databinding.DialogWechatReserveSuccessBinding;
|
||||||
import com.gh.gamecenter.databinding.ImprintContentItemBinding;
|
import com.gh.gamecenter.databinding.ImprintContentItemBinding;
|
||||||
import com.gh.gamecenter.entity.BadgeEntity;
|
import com.gh.gamecenter.entity.BadgeEntity;
|
||||||
|
import com.gh.gamecenter.entity.ReserveReminderEntity;
|
||||||
import com.gh.gamecenter.entity.TrackableEntity;
|
import com.gh.gamecenter.entity.TrackableEntity;
|
||||||
import com.gh.gamecenter.feature.entity.ApkEntity;
|
import com.gh.gamecenter.feature.entity.ApkEntity;
|
||||||
import com.gh.gamecenter.feature.entity.Badge;
|
import com.gh.gamecenter.feature.entity.Badge;
|
||||||
@ -73,6 +75,7 @@ import com.gh.gamecenter.feature.entity.GameEntity;
|
|||||||
import com.gh.gamecenter.feature.entity.SettingsEntity;
|
import com.gh.gamecenter.feature.entity.SettingsEntity;
|
||||||
import com.gh.gamecenter.help.HelpAndFeedbackBridge;
|
import com.gh.gamecenter.help.HelpAndFeedbackBridge;
|
||||||
import com.gh.gamecenter.setting.SettingBridge;
|
import com.gh.gamecenter.setting.SettingBridge;
|
||||||
|
import com.halo.assistant.fragment.reserve.ReserveReminderContainerFragment;
|
||||||
import com.lightgame.download.DownloadEntity;
|
import com.lightgame.download.DownloadEntity;
|
||||||
import com.lightgame.utils.AppManager;
|
import com.lightgame.utils.AppManager;
|
||||||
import com.lightgame.utils.Util_System_Keyboard;
|
import com.lightgame.utils.Util_System_Keyboard;
|
||||||
@ -91,13 +94,13 @@ public class DialogUtils {
|
|||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
Dialog dialog = new Dialog(context);
|
Dialog dialog = new Dialog(context);
|
||||||
View view = View.inflate(context, R.layout.set_wait_dialog, null);
|
View view = View.inflate(context, com.gh.gamecenter.common.R.layout.set_wait_dialog, null);
|
||||||
TextView message = view.findViewById(R.id.set_wait_message);
|
TextView message = view.findViewById(com.gh.gamecenter.common.R.id.set_wait_message);
|
||||||
message.setText(msg);
|
message.setText(msg);
|
||||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
dialog.setContentView(view);
|
dialog.setContentView(view);
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
dialog.getWindow().setBackgroundDrawableResource(R.drawable.background_shape_white_radius_8);
|
dialog.getWindow().setBackgroundDrawableResource(com.gh.gamecenter.common.R.drawable.background_shape_white_radius_8);
|
||||||
WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
|
WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
|
||||||
layoutParams.width = DisplayUtils.dip2px(160);
|
layoutParams.width = DisplayUtils.dip2px(160);
|
||||||
dialog.getWindow().setAttributes(layoutParams);
|
dialog.getWindow().setAttributes(layoutParams);
|
||||||
@ -148,6 +151,7 @@ public class DialogUtils {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showNoConnectionDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener) {
|
public static void showNoConnectionDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener) {
|
||||||
DialogHelper.showDialog(context, "下载提示", "网络异常,请检查手机网络状态", "知道了", "WiFi自动下载", listener::onConfirm, cancelListener::onCancel, false, "", "");
|
DialogHelper.showDialog(context, "下载提示", "网络异常,请检查手机网络状态", "知道了", "WiFi自动下载", listener::onConfirm, cancelListener::onCancel, false, "", "");
|
||||||
}
|
}
|
||||||
@ -159,7 +163,7 @@ public class DialogUtils {
|
|||||||
|
|
||||||
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
|
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_download_traffic, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_download_traffic, null);
|
||||||
View allowOnce = contentView.findViewById(R.id.allow_once);
|
View allowOnce = contentView.findViewById(R.id.allow_once);
|
||||||
@ -255,7 +259,7 @@ public class DialogUtils {
|
|||||||
final ConfirmListener cmListener) {
|
final ConfirmListener cmListener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_community, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_community, null);
|
||||||
View contentContainer = contentView.findViewById(R.id.content_container);
|
View contentContainer = contentView.findViewById(R.id.content_container);
|
||||||
@ -314,7 +318,7 @@ public class DialogUtils {
|
|||||||
EmptyCallback callback) {
|
EmptyCallback callback) {
|
||||||
final Context activityContext = checkDialogContext(context);
|
final Context activityContext = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(activityContext, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(activityContext, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(activityContext).inflate(R.layout.dialog_disallow_privacy_policy, null);
|
View contentView = LayoutInflater.from(activityContext).inflate(R.layout.dialog_disallow_privacy_policy, null);
|
||||||
View backButton = contentView.findViewById(R.id.back_button);
|
View backButton = contentView.findViewById(R.id.back_button);
|
||||||
@ -350,14 +354,14 @@ public class DialogUtils {
|
|||||||
final ConfirmListener cmListener) {
|
final ConfirmListener cmListener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_video_upload_draft, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_video_upload_draft, null);
|
||||||
TextView negativeTv = contentView.findViewById(R.id.negative);
|
TextView negativeTv = contentView.findViewById(R.id.negative);
|
||||||
TextView positiveTv = contentView.findViewById(R.id.positive);
|
TextView positiveTv = contentView.findViewById(R.id.positive);
|
||||||
TextView content = contentView.findViewById(R.id.content);
|
TextView content = contentView.findViewById(R.id.content);
|
||||||
positiveTv.setBackground(DrawableView.getOvalDrawable(R.color.ui_background, 999));
|
positiveTv.setBackground(DrawableView.getOvalDrawable(com.gh.gamecenter.common.R.color.ui_background, 999));
|
||||||
negativeTv.setBackground(DrawableView.getOvalDrawable(R.color.primary_theme, 999));
|
negativeTv.setBackground(DrawableView.getOvalDrawable(com.gh.gamecenter.common.R.color.primary_theme, 999));
|
||||||
content.setText(Html.fromHtml(context.getString(R.string.video_upload_draft_dialog_content)));
|
content.setText(Html.fromHtml(context.getString(R.string.video_upload_draft_dialog_content)));
|
||||||
|
|
||||||
negativeTv.setOnClickListener(view -> {
|
negativeTv.setOnClickListener(view -> {
|
||||||
@ -407,7 +411,7 @@ public class DialogUtils {
|
|||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final TrackableDialog dialog = new TrackableDialog(context,
|
final TrackableDialog dialog = new TrackableDialog(context,
|
||||||
R.style.GhAlertDialog,
|
com.gh.gamecenter.common.R.style.GhAlertDialog,
|
||||||
trackableEntity.getEvent(),
|
trackableEntity.getEvent(),
|
||||||
trackableEntity.getKey(),
|
trackableEntity.getKey(),
|
||||||
trackableEntity.getValue(),
|
trackableEntity.getValue(),
|
||||||
@ -423,7 +427,7 @@ public class DialogUtils {
|
|||||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
contentView = LayoutInflater.from(context).inflate(R.layout.dialog_alert, null);
|
contentView = LayoutInflater.from(context).inflate(com.gh.gamecenter.common.R.layout.dialog_alert, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
||||||
@ -478,7 +482,7 @@ public class DialogUtils {
|
|||||||
public static Dialog showUsageStatsDialog(Context context, final ConfirmListener cmListener, final CancelListener clListener) {
|
public static Dialog showUsageStatsDialog(Context context, final ConfirmListener cmListener, final CancelListener clListener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_usage_stats, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_usage_stats, null);
|
||||||
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
|
TextView negativeTv = contentView.findViewById(R.id.dialog_negative);
|
||||||
@ -518,7 +522,7 @@ public class DialogUtils {
|
|||||||
public static void showDownloadMutexDialog(Context context) {
|
public static void showDownloadMutexDialog(Context context) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_downlaod_mutex, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_downlaod_mutex, null);
|
||||||
TextView positive = contentView.findViewById(R.id.dialog_positive);
|
TextView positive = contentView.findViewById(R.id.dialog_positive);
|
||||||
@ -558,7 +562,7 @@ public class DialogUtils {
|
|||||||
|
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
|
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
|
||||||
|
|
||||||
@ -625,7 +629,7 @@ public class DialogUtils {
|
|||||||
public static void showLandPageAddressDialog(Context context, GameEntity gameEntity, @NonNull ConfirmListener listener) {
|
public static void showLandPageAddressDialog(Context context, GameEntity gameEntity, @NonNull ConfirmListener listener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
|
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
|
||||||
|
|
||||||
@ -633,7 +637,19 @@ public class DialogUtils {
|
|||||||
|
|
||||||
binding.gameIcon.displayGameIcon(gameEntity);
|
binding.gameIcon.displayGameIcon(gameEntity);
|
||||||
binding.gameNameTv.setText(context.getString(R.string.dialog_land_page_address_hint, gameEntity.getName()));
|
binding.gameNameTv.setText(context.getString(R.string.dialog_land_page_address_hint, gameEntity.getName()));
|
||||||
binding.closeIv.setOnClickListener(v -> dialog.dismiss());
|
|
||||||
|
AtomicBoolean dismissByButton = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
binding.closeIv.setOnClickListener(v -> {
|
||||||
|
dismissByButton.set(true);
|
||||||
|
SensorsBridge.INSTANCE.trackJumpLandPageAddressDialogClick(
|
||||||
|
"取消",
|
||||||
|
gameEntity.getId(),
|
||||||
|
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||||
|
gameEntity.getCategoryChinese()
|
||||||
|
);
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
binding.urlTv.setText(gameEntity.getLandPageAddressDialog().getLink());
|
binding.urlTv.setText(gameEntity.getLandPageAddressDialog().getLink());
|
||||||
|
|
||||||
@ -643,10 +659,28 @@ public class DialogUtils {
|
|||||||
|
|
||||||
binding.downloadBtn.setText(downloadText);
|
binding.downloadBtn.setText(downloadText);
|
||||||
binding.downloadBtn.setOnClickListener(v -> {
|
binding.downloadBtn.setOnClickListener(v -> {
|
||||||
|
dismissByButton.set(true);
|
||||||
|
SensorsBridge.INSTANCE.trackJumpLandPageAddressDialogClick(
|
||||||
|
"前往第三方网站下载游戏",
|
||||||
|
gameEntity.getId(),
|
||||||
|
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||||
|
gameEntity.getCategoryChinese()
|
||||||
|
);
|
||||||
listener.onConfirm();
|
listener.onConfirm();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialog.setOnDismissListener(dialog1 -> {
|
||||||
|
if (!dismissByButton.get()) {
|
||||||
|
SensorsBridge.INSTANCE.trackJumpLandPageAddressDialogClick(
|
||||||
|
"关闭弹窗",
|
||||||
|
gameEntity.getId(),
|
||||||
|
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||||
|
gameEntity.getCategoryChinese()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Window window = dialog.getWindow();
|
Window window = dialog.getWindow();
|
||||||
if (window != null) {
|
if (window != null) {
|
||||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
@ -655,12 +689,18 @@ public class DialogUtils {
|
|||||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
dialog.setContentView(contentView);
|
dialog.setContentView(contentView);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
|
SensorsBridge.INSTANCE.trackJumpLandPageAddressDialogShow(
|
||||||
|
gameEntity.getId(),
|
||||||
|
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||||
|
gameEntity.getCategoryChinese()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showGameH5DownloadDialog(Context context, GameEntity gameEntity, RegionSetting.GameH5Download gameH5Download) {
|
public static void showGameH5DownloadDialog(Context context, GameEntity gameEntity, RegionSetting.GameH5Download gameH5Download) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
|
DialogAddressConfirmationBinding binding = DialogAddressConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
|
||||||
|
|
||||||
@ -701,7 +741,7 @@ public class DialogUtils {
|
|||||||
params = window.getAttributes();
|
params = window.getAttributes();
|
||||||
params.width = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.9);
|
params.width = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.9);
|
||||||
window.setAttributes(params);
|
window.setAttributes(params);
|
||||||
window.setBackgroundDrawableResource(R.drawable.textview_white_up);
|
window.setBackgroundDrawableResource(com.gh.gamecenter.common.R.drawable.textview_white_up);
|
||||||
}
|
}
|
||||||
|
|
||||||
inflate.findViewById(R.id.imprint_close).setOnClickListener(v -> dialog.dismiss());
|
inflate.findViewById(R.id.imprint_close).setOnClickListener(v -> dialog.dismiss());
|
||||||
@ -731,7 +771,7 @@ public class DialogUtils {
|
|||||||
|
|
||||||
// close line
|
// close line
|
||||||
View view = new View(context);
|
View view = new View(context);
|
||||||
view.setBackgroundColor(context.getResources().getColor(R.color.text_5d5d5d));
|
view.setBackgroundColor(context.getResources().getColor(com.gh.gamecenter.common.R.color.text_5d5d5d));
|
||||||
view.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(1)));
|
view.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(1)));
|
||||||
content.addView(view);
|
content.addView(view);
|
||||||
}
|
}
|
||||||
@ -739,7 +779,7 @@ public class DialogUtils {
|
|||||||
public static void showKaifuRemindDialog(Context context, String content, String gameName) {
|
public static void showKaifuRemindDialog(Context context, String content, String gameName) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new TrackableDialog(context, R.style.GhAlertDialog, "开服说明弹窗", "弹窗", gameName, null, null, true);
|
final Dialog dialog = new TrackableDialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog, "开服说明弹窗", "弹窗", gameName, null, null, true);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_kaifu_remind, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_kaifu_remind, null);
|
||||||
|
|
||||||
@ -769,7 +809,7 @@ public class DialogUtils {
|
|||||||
public static void showStopServerExplanationDialog(Context context, String content, String gameName) {
|
public static void showStopServerExplanationDialog(Context context, String content, String gameName) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new TrackableDialog(context, R.style.GhAlertDialog, "评论说明弹窗", "弹窗", gameName, null, null, true);
|
final Dialog dialog = new TrackableDialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog, "评论说明弹窗", "弹窗", gameName, null, null, true);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_stop_service_explanation, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_stop_service_explanation, null);
|
||||||
|
|
||||||
@ -814,7 +854,7 @@ public class DialogUtils {
|
|||||||
|
|
||||||
final Dialog dialog = new TrackableDialog(
|
final Dialog dialog = new TrackableDialog(
|
||||||
context,
|
context,
|
||||||
R.style.GhAlertDialog,
|
com.gh.gamecenter.common.R.style.GhAlertDialog,
|
||||||
"礼仪考试",
|
"礼仪考试",
|
||||||
"礼仪考试弹窗",
|
"礼仪考试弹窗",
|
||||||
null, null, null,
|
null, null, null,
|
||||||
@ -868,9 +908,9 @@ public class DialogUtils {
|
|||||||
public static void showNoticeDialog(Context context, String title, String content, @NonNull ConfirmListener listener) {
|
public static void showNoticeDialog(Context context, String title, String content, @NonNull ConfirmListener listener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_notice, null);
|
View contentView = LayoutInflater.from(context).inflate(com.gh.gamecenter.common.R.layout.dialog_notice, null);
|
||||||
TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
||||||
TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
||||||
|
|
||||||
@ -895,7 +935,7 @@ public class DialogUtils {
|
|||||||
public static void showViewBadgeDialog(Context context, Badge badge, ConfirmListener listener) {
|
public static void showViewBadgeDialog(Context context, Badge badge, ConfirmListener listener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_view_badge, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_view_badge, null);
|
||||||
TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
||||||
@ -916,7 +956,7 @@ public class DialogUtils {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation animation = AnimationUtils.loadAnimation(context, R.anim.anim_badge_light_bg);
|
Animation animation = AnimationUtils.loadAnimation(context, com.gh.gamecenter.common.R.anim.anim_badge_light_bg);
|
||||||
badgeLightBg.startAnimation(animation);
|
badgeLightBg.startAnimation(animation);
|
||||||
|
|
||||||
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
|
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
|
||||||
@ -933,7 +973,7 @@ public class DialogUtils {
|
|||||||
public static void showReceiveBadgeDialog(Context context, BadgeEntity badge, ConfirmListener listener) {
|
public static void showReceiveBadgeDialog(Context context, BadgeEntity badge, ConfirmListener listener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_receive_badge, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_receive_badge, null);
|
||||||
TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
||||||
@ -963,7 +1003,7 @@ public class DialogUtils {
|
|||||||
receiveTv.setText(R.string.apply_badge);
|
receiveTv.setText(R.string.apply_badge);
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation animation = AnimationUtils.loadAnimation(context, R.anim.anim_badge_light_bg);
|
Animation animation = AnimationUtils.loadAnimation(context, com.gh.gamecenter.common.R.anim.anim_badge_light_bg);
|
||||||
badgeLightBg.startAnimation(animation);
|
badgeLightBg.startAnimation(animation);
|
||||||
|
|
||||||
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
|
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
|
||||||
@ -980,7 +1020,7 @@ public class DialogUtils {
|
|||||||
public static void showPassRegulationDialog(Context context, String icon) {
|
public static void showPassRegulationDialog(Context context, String icon) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_pass_regulation, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_pass_regulation, null);
|
||||||
SimpleDraweeView userIcon = contentView.findViewById(R.id.dialog_icon);
|
SimpleDraweeView userIcon = contentView.findViewById(R.id.dialog_icon);
|
||||||
@ -999,7 +1039,7 @@ public class DialogUtils {
|
|||||||
public static void showShortCutPermissionDialog(Context context) {
|
public static void showShortCutPermissionDialog(Context context) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_shortcut_permission, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_shortcut_permission, null);
|
||||||
|
|
||||||
@ -1024,7 +1064,7 @@ public class DialogUtils {
|
|||||||
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
|
, String positive, String negative, final ConfirmListener cmListener, final CancelListener clListener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_cancel_reservation, null);
|
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_cancel_reservation, null);
|
||||||
TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
||||||
@ -1065,11 +1105,11 @@ public class DialogUtils {
|
|||||||
|
|
||||||
public static void showSimulatorParseErrorDialog(Context context, String gameId, String gameName, ConfirmListener confirmListener) {
|
public static void showSimulatorParseErrorDialog(Context context, String gameId, String gameName, ConfirmListener confirmListener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.GhAlertDialog);
|
||||||
|
|
||||||
DialogPackageParseErrorBinding binding = DialogPackageParseErrorBinding.inflate(LayoutInflater.from(context), null, false);
|
DialogPackageParseErrorBinding binding = DialogPackageParseErrorBinding.inflate(LayoutInflater.from(context), null, false);
|
||||||
Context finalContext = context;
|
Context finalContext = context;
|
||||||
SpannableStringBuilder builder = new SpanBuilder("您也可以点击提交反馈跟我们联系").click(context, 6, 10, R.color.text_theme, true, new Function0<Unit>() {
|
SpannableStringBuilder builder = new SpanBuilder("您也可以点击提交反馈跟我们联系").click(context, 6, 10, com.gh.gamecenter.common.R.color.text_theme, true, new Function0<Unit>() {
|
||||||
@Override
|
@Override
|
||||||
public Unit invoke() {
|
public Unit invoke() {
|
||||||
SimpleGameEntity entity = new SimpleGameEntity(gameId, gameName, "", "");
|
SimpleGameEntity entity = new SimpleGameEntity(gameId, gameName, "", "");
|
||||||
@ -1109,7 +1149,7 @@ public class DialogUtils {
|
|||||||
public static void showReportReasonDialog(Context context, ArrayList<String> items, String title, ReportReasonCallBack callBack) {
|
public static void showReportReasonDialog(Context context, ArrayList<String> items, String title, ReportReasonCallBack callBack) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
DialogReportReasonBinding binding = DialogReportReasonBinding.inflate(LayoutInflater.from(context));
|
DialogReportReasonBinding binding = DialogReportReasonBinding.inflate(LayoutInflater.from(context));
|
||||||
|
|
||||||
if (!title.isEmpty()) {
|
if (!title.isEmpty()) {
|
||||||
@ -1128,7 +1168,7 @@ public class DialogUtils {
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
binding.reasonRv.setLayoutManager(new LinearLayoutManager(context));
|
binding.reasonRv.setLayoutManager(new LinearLayoutManager(context));
|
||||||
binding.reasonRv.addItemDecoration(new VerticalItemDecoration(context, 1F, false, R.color.ui_background));
|
binding.reasonRv.addItemDecoration(new VerticalItemDecoration(context, 1F, false, com.gh.gamecenter.common.R.color.ui_background));
|
||||||
binding.reasonRv.setAdapter(reportReasonAdapter);
|
binding.reasonRv.setAdapter(reportReasonAdapter);
|
||||||
|
|
||||||
binding.negativeBtn.setOnClickListener(v -> {
|
binding.negativeBtn.setOnClickListener(v -> {
|
||||||
@ -1150,7 +1190,7 @@ public class DialogUtils {
|
|||||||
ExtensionsKt.setTextChangedListener(binding.otherReasonEt, (s, start, before, count) -> {
|
ExtensionsKt.setTextChangedListener(binding.otherReasonEt, (s, start, before, count) -> {
|
||||||
int tvCount = s.length();
|
int tvCount = s.length();
|
||||||
if (tvCount >= 500) {
|
if (tvCount >= 500) {
|
||||||
binding.tvCount.setTextColor(ContextCompat.getColor(finalContext, R.color.secondary_red));
|
binding.tvCount.setTextColor(ContextCompat.getColor(finalContext, com.gh.gamecenter.common.R.color.secondary_red));
|
||||||
}
|
}
|
||||||
binding.tvCount.setText(tvCount + "/500");
|
binding.tvCount.setText(tvCount + "/500");
|
||||||
return null;
|
return null;
|
||||||
@ -1164,7 +1204,7 @@ public class DialogUtils {
|
|||||||
public static Dialog showBindPhoneDialog(Context context, ConfirmListener listener) {
|
public static Dialog showBindPhoneDialog(Context context, ConfirmListener listener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
DialogBindPhoneBinding binding = DialogBindPhoneBinding.inflate(LayoutInflater.from(context));
|
DialogBindPhoneBinding binding = DialogBindPhoneBinding.inflate(LayoutInflater.from(context));
|
||||||
|
|
||||||
binding.positiveTv.setOnClickListener(v -> {
|
binding.positiveTv.setOnClickListener(v -> {
|
||||||
@ -1185,10 +1225,10 @@ public class DialogUtils {
|
|||||||
public static void showReserveOrVoteSuccess2WechatBindDialog(Context context, Boolean isReserve, ConfirmListener confirmListener, CancelListener cancelListener) {
|
public static void showReserveOrVoteSuccess2WechatBindDialog(Context context, Boolean isReserve, ConfirmListener confirmListener, CancelListener cancelListener) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
DialogWechatReserveSuccessBinding binding = DialogWechatReserveSuccessBinding.inflate(LayoutInflater.from(context));
|
DialogWechatReserveSuccessBinding binding = DialogWechatReserveSuccessBinding.inflate(LayoutInflater.from(context));
|
||||||
binding.titleIv.setImageResource(isReserve ? R.drawable.bg_reserve_success : R.drawable.bg_vote_success);
|
binding.titleIv.setImageResource(isReserve ? R.drawable.bg_reserve_success : R.drawable.bg_vote_success);
|
||||||
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心收到通知。为了避免错过通知,建议您开启微信公众号提醒": "版本上线时,您将在消息中心收到通知。为了避免错过通知,亦建议您开启微信公众号提醒");
|
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心收到通知。为了避免错过通知,建议您开启微信公众号提醒" : "版本上线时,您将在消息中心收到通知。为了避免错过通知,亦建议您开启微信公众号提醒");
|
||||||
binding.closeBtn.setOnClickListener(v -> {
|
binding.closeBtn.setOnClickListener(v -> {
|
||||||
cancelListener.onCancel();
|
cancelListener.onCancel();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
@ -1212,7 +1252,7 @@ public class DialogUtils {
|
|||||||
public static void showReserveOrVoteSuccessDialog(Context context, Boolean isReserve) {
|
public static void showReserveOrVoteSuccessDialog(Context context, Boolean isReserve) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
DialogAlertDefaultBinding binding = DialogAlertDefaultBinding.inflate(LayoutInflater.from(context));
|
DialogAlertDefaultBinding binding = DialogAlertDefaultBinding.inflate(LayoutInflater.from(context));
|
||||||
binding.titleTv.setText(isReserve ? "游戏预约成功" : "版本投票成功");
|
binding.titleTv.setText(isReserve ? "游戏预约成功" : "版本投票成功");
|
||||||
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心和微信公众号收到通知,不会错过任何预约的游戏" : "版本上线时,您将在消息中心和微信公众号收到通知,不会错过任何投票的版本");
|
binding.contentTv.setText(isReserve ? "游戏上线时,您将在消息中心和微信公众号收到通知,不会错过任何预约的游戏" : "版本上线时,您将在消息中心和微信公众号收到通知,不会错过任何投票的版本");
|
||||||
@ -1233,10 +1273,14 @@ public class DialogUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showReserveReminderDialog(Context context, GameEntity gameEntity, ReserveReminderEntity reserveReminder) {
|
||||||
|
ReserveReminderContainerFragment.show(context, gameEntity, reserveReminder);
|
||||||
|
}
|
||||||
|
|
||||||
public static void showRelievePhoneDialog(Context context) {
|
public static void showRelievePhoneDialog(Context context) {
|
||||||
context = checkDialogContext(context);
|
context = checkDialogContext(context);
|
||||||
|
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
final Dialog dialog = new Dialog(context, com.gh.gamecenter.common.R.style.DialogWindowTransparent);
|
||||||
DialogRelievePhoneBinding binding = DialogRelievePhoneBinding.inflate(LayoutInflater.from(context));
|
DialogRelievePhoneBinding binding = DialogRelievePhoneBinding.inflate(LayoutInflater.from(context));
|
||||||
|
|
||||||
Context finalContext = context;
|
Context finalContext = context;
|
||||||
|
|||||||
@ -10,7 +10,9 @@ import android.os.Build
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.os.bundleOf
|
||||||
import com.alibaba.android.arouter.launcher.ARouter
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.gh.ad.AdPluginDownloadHelper
|
||||||
import com.gh.common.constant.Config
|
import com.gh.common.constant.Config
|
||||||
import com.gh.common.exposure.ExposureManager.log
|
import com.gh.common.exposure.ExposureManager.log
|
||||||
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
|
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
|
||||||
@ -18,8 +20,6 @@ import com.gh.common.util.EntranceUtils.jumpActivity
|
|||||||
import com.gh.common.util.EntranceUtils.jumpActivityCompat
|
import com.gh.common.util.EntranceUtils.jumpActivityCompat
|
||||||
import com.gh.gamecenter.*
|
import com.gh.gamecenter.*
|
||||||
import com.gh.gamecenter.amway.AmwayActivity
|
import com.gh.gamecenter.amway.AmwayActivity
|
||||||
import com.gh.gamecenter.catalog.CatalogActivity
|
|
||||||
import com.gh.gamecenter.category.CategoryDirectoryActivity
|
|
||||||
import com.gh.gamecenter.category2.CategoryV2Activity
|
import com.gh.gamecenter.category2.CategoryV2Activity
|
||||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||||
import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout
|
import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout
|
||||||
@ -43,11 +43,13 @@ import com.gh.gamecenter.feature.entity.MeEntity
|
|||||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||||
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
|
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
|
||||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||||
|
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
|
||||||
import com.gh.gamecenter.feature.provider.IConcernInfoProvider
|
import com.gh.gamecenter.feature.provider.IConcernInfoProvider
|
||||||
import com.gh.gamecenter.forum.detail.ForumDetailActivity
|
import com.gh.gamecenter.forum.detail.ForumDetailActivity
|
||||||
import com.gh.gamecenter.forum.home.CommunityActivity
|
import com.gh.gamecenter.forum.home.CommunityActivity
|
||||||
import com.gh.gamecenter.forum.search.ForumOrUserSearchActivity
|
import com.gh.gamecenter.forum.search.ForumOrUserSearchActivity
|
||||||
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailActivity
|
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailActivity
|
||||||
|
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailFragment
|
||||||
import com.gh.gamecenter.game.commoncollection.detail.CustomCommonCollectionDetailActivity
|
import com.gh.gamecenter.game.commoncollection.detail.CustomCommonCollectionDetailActivity
|
||||||
import com.gh.gamecenter.game.upload.GameSubmissionActivity
|
import com.gh.gamecenter.game.upload.GameSubmissionActivity
|
||||||
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
||||||
@ -63,6 +65,9 @@ import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
|
|||||||
import com.gh.gamecenter.help.HelpAndFeedbackBridge
|
import com.gh.gamecenter.help.HelpAndFeedbackBridge
|
||||||
import com.gh.gamecenter.libao.LibaoDetailActivity
|
import com.gh.gamecenter.libao.LibaoDetailActivity
|
||||||
import com.gh.gamecenter.login.user.UserManager
|
import com.gh.gamecenter.login.user.UserManager
|
||||||
|
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
|
||||||
|
import com.gh.gamecenter.minigame.MiniGameSearchActivity
|
||||||
|
import com.gh.gamecenter.minigame.qq.QGameHomeWrapperActivity
|
||||||
import com.gh.gamecenter.newsdetail.NewsDetailActivity
|
import com.gh.gamecenter.newsdetail.NewsDetailActivity
|
||||||
import com.gh.gamecenter.personalhome.UserHomeActivity
|
import com.gh.gamecenter.personalhome.UserHomeActivity
|
||||||
import com.gh.gamecenter.personalhome.background.PersonalityBackgroundActivity
|
import com.gh.gamecenter.personalhome.background.PersonalityBackgroundActivity
|
||||||
@ -73,10 +78,8 @@ import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity
|
|||||||
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity
|
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity
|
||||||
import com.gh.gamecenter.qa.subject.CommunitySubjectActivity
|
import com.gh.gamecenter.qa.subject.CommunitySubjectActivity
|
||||||
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity
|
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity
|
||||||
import com.gh.gamecenter.qgame.QGameHomeWrapperActivity
|
|
||||||
import com.gh.gamecenter.qgame.QGameSearchActivity
|
|
||||||
import com.gh.gamecenter.qgame.QGameViewModel
|
|
||||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||||
|
import com.gh.gamecenter.SearchActivity
|
||||||
import com.gh.gamecenter.servers.GameServerTestActivity
|
import com.gh.gamecenter.servers.GameServerTestActivity
|
||||||
import com.gh.gamecenter.servers.GameServersActivity
|
import com.gh.gamecenter.servers.GameServersActivity
|
||||||
import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity
|
import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity
|
||||||
@ -95,6 +98,8 @@ import com.gh.vspace.VDownloadManagerActivity
|
|||||||
import com.halo.assistant.HaloApp
|
import com.halo.assistant.HaloApp
|
||||||
import com.halo.assistant.fragment.WebFragment
|
import com.halo.assistant.fragment.WebFragment
|
||||||
import com.lightgame.utils.Utils
|
import com.lightgame.utils.Utils
|
||||||
|
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram
|
||||||
|
import com.tencent.mm.opensdk.openapi.WXAPIFactory
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
@ -108,8 +113,14 @@ import kotlin.math.roundToInt
|
|||||||
object DirectUtils {
|
object DirectUtils {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun directToLinkPage(context: Context, linkEntity: LinkEntity, entrance: String, path: String, sourceEntrance: String = "") {
|
fun directToLinkPage(
|
||||||
directToLinkPage(context, linkEntity, entrance, path, null, sourceEntrance)
|
context: Context,
|
||||||
|
linkEntity: LinkEntity,
|
||||||
|
entrance: String,
|
||||||
|
path: String,
|
||||||
|
sourceEntrance: String = ""
|
||||||
|
) {
|
||||||
|
directToLinkPage(context, linkEntity, entrance, path, null, sourceEntrance)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@ -140,14 +151,12 @@ object DirectUtils {
|
|||||||
"qqqun",
|
"qqqun",
|
||||||
"tag",
|
"tag",
|
||||||
"all_community_article",
|
"all_community_article",
|
||||||
"category",
|
|
||||||
"block",
|
"block",
|
||||||
"column_collection",
|
"column_collection",
|
||||||
"server",
|
"server",
|
||||||
"top_game_comment",
|
"top_game_comment",
|
||||||
"wechat_bind",
|
"wechat_bind",
|
||||||
"video",
|
"video",
|
||||||
"catalog",
|
|
||||||
"category_v2",
|
"category_v2",
|
||||||
"common_collection",
|
"common_collection",
|
||||||
"game_list",
|
"game_list",
|
||||||
@ -170,7 +179,8 @@ object DirectUtils {
|
|||||||
"bbs_section",
|
"bbs_section",
|
||||||
"qa",
|
"qa",
|
||||||
"feedback",
|
"feedback",
|
||||||
"toolkit"
|
"toolkit",
|
||||||
|
"float_window_game"
|
||||||
)
|
)
|
||||||
|
|
||||||
fun directToLinkPage(
|
fun directToLinkPage(
|
||||||
@ -243,7 +253,7 @@ object DirectUtils {
|
|||||||
path
|
path
|
||||||
)
|
)
|
||||||
|
|
||||||
HOST_WEB, HOST_WEB_INURL, HOST_WEB_AL -> {
|
HOST_WEB, HOST_WEB_INURL, HOST_WEB_AL, HOST_QA_CONTENT -> {
|
||||||
when {
|
when {
|
||||||
linkEntity.link!!.contains("v.douyin") && PackageHelper.localPackageNameSet.contains("com.ss.android.ugc.aweme") -> {
|
linkEntity.link!!.contains("v.douyin") && PackageHelper.localPackageNameSet.contains("com.ss.android.ugc.aweme") -> {
|
||||||
directDouyin(context, "1402577827140941")
|
directDouyin(context, "1402577827140941")
|
||||||
@ -274,10 +284,6 @@ object DirectUtils {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
"category", "分类" -> directCategoryDirectory(context, linkEntity.link!!, linkEntity.text!!)
|
|
||||||
|
|
||||||
"catalog" -> directCatalog(context, linkEntity.link!!, linkEntity.text!!, entrance, path)
|
|
||||||
|
|
||||||
"category_v2" -> directCategoryV2(
|
"category_v2" -> directCategoryV2(
|
||||||
context,
|
context,
|
||||||
linkEntity.link!!,
|
linkEntity.link!!,
|
||||||
@ -343,9 +349,9 @@ object DirectUtils {
|
|||||||
|
|
||||||
"feedback" -> directToFeedback(context, linkEntity.name, false, "", false, false, entrance)
|
"feedback" -> directToFeedback(context, linkEntity.name, false, "", false, false, entrance)
|
||||||
|
|
||||||
"qa", "qa_content", "Q&A" -> directToQa(context, linkEntity.text ?: "", linkEntity.link ?: "")
|
"qa", "Q&A" -> directToQa(context, linkEntity.text ?: "", linkEntity.link ?: "")
|
||||||
|
|
||||||
"qa_list" -> directToHelpAndFeedback(context)
|
"qa_list" -> directToHelpAndFeedback(context, bundleOf(KEY_ENTRANCE to entrance))
|
||||||
|
|
||||||
"qa_collection", "Q&A合集" -> directToQaCollection(
|
"qa_collection", "Q&A合集" -> directToQaCollection(
|
||||||
context, linkEntity.text
|
context, linkEntity.text
|
||||||
@ -470,22 +476,30 @@ object DirectUtils {
|
|||||||
"column_test_v2" -> context.startActivity(
|
"column_test_v2" -> context.startActivity(
|
||||||
GameServerTestV2Activity.getIntent(
|
GameServerTestV2Activity.getIntent(
|
||||||
context,
|
context,
|
||||||
|
linkEntity.link ?: "none",
|
||||||
entrance,
|
entrance,
|
||||||
exposureEvent
|
exposureEvent
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
"qq_mini_game_column" -> directToQGameHome(context)
|
ColumnCollectionDetailFragment.TYPE_QQ_MINI_GAME_COLUMN -> directToQGameHome(context)
|
||||||
|
|
||||||
// QQ游戏专题详情页
|
// QQ游戏专题详情页
|
||||||
"qq_mini_game_column_detail" -> {
|
ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN,
|
||||||
|
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_COLUMN,
|
||||||
|
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_CPM_COLUMN -> {
|
||||||
|
val subjectType = when (linkEntity.type) {
|
||||||
|
ViewPagerFragmentHelper.TYPE_QQ_MINI_GAME_COLUMN -> SubjectData.SubjectType.QQ_GAME
|
||||||
|
ViewPagerFragmentHelper.TYPE_WECHAT_GAME_CPM_COLUMN -> SubjectData.SubjectType.WECHAT_GAME_CPM
|
||||||
|
else -> SubjectData.SubjectType.WECHAT_GAME
|
||||||
|
}
|
||||||
directToSubject(
|
directToSubject(
|
||||||
context = context,
|
context = context,
|
||||||
id = linkEntity.link ?: "",
|
id = linkEntity.link ?: "",
|
||||||
subjectName = linkEntity.text,
|
subjectName = linkEntity.text,
|
||||||
entrance = BaseActivity.mergeEntranceAndPath(entrance, path),
|
entrance = BaseActivity.mergeEntranceAndPath(entrance, path),
|
||||||
exposureEvent = exposureEvent,
|
exposureEvent = exposureEvent,
|
||||||
isQQMiniGame = true
|
subjectType = subjectType
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,6 +550,26 @@ object DirectUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"wechat_game" -> linkEntity.link?.let {
|
||||||
|
MiniGameItemHelper.launchMiniGame(it, Constants.WECHAT_MINI_GAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
"float_window_game" -> linkEntity.link?.let { link ->
|
||||||
|
if (PackageUtils.isInstalled(context, Constants.TOOL_MAP_PACKAGE_NAME)) {
|
||||||
|
val intent = Intent(
|
||||||
|
Intent.ACTION_VIEW,
|
||||||
|
Uri.parse("ghtoolmap://floatWindow")
|
||||||
|
).also {
|
||||||
|
it.addCategory(Intent.CATEGORY_DEFAULT)
|
||||||
|
it.addCategory(Intent.CATEGORY_BROWSABLE)
|
||||||
|
it.putExtra("gameId", linkEntity.link)
|
||||||
|
}
|
||||||
|
context.startActivity(intent)
|
||||||
|
} else {
|
||||||
|
directToGameDetail(context, Config.getFloatWindowSettingEntity()?.gameId ?: "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
"" -> {
|
"" -> {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
@ -774,7 +808,12 @@ object DirectUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (traceEvent != null) {
|
if (traceEvent != null) {
|
||||||
val clickEvent = createEvent(GameEntity(id = id, name = name), traceEvent.source, appendTrace(traceEvent), ExposureType.CLICK)
|
val clickEvent = createEvent(
|
||||||
|
GameEntity(id = id, name = name),
|
||||||
|
traceEvent.source,
|
||||||
|
appendTrace(traceEvent),
|
||||||
|
ExposureType.CLICK
|
||||||
|
)
|
||||||
log(clickEvent)
|
log(clickEvent)
|
||||||
bundle.putParcelable(KEY_TRACE_EVENT, clickEvent)
|
bundle.putParcelable(KEY_TRACE_EVENT, clickEvent)
|
||||||
}
|
}
|
||||||
@ -837,12 +876,12 @@ object DirectUtils {
|
|||||||
subjectName: String? = "",
|
subjectName: String? = "",
|
||||||
entrance: String? = null,
|
entrance: String? = null,
|
||||||
exposureEvent: ExposureEvent? = null,
|
exposureEvent: ExposureEvent? = null,
|
||||||
isQQMiniGame: Boolean = false,
|
subjectType: SubjectData.SubjectType = SubjectData.SubjectType.NORMAL
|
||||||
) {
|
) {
|
||||||
if (id.isEmpty()) return
|
if (id.isEmpty()) return
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
val subjectData =
|
val subjectData =
|
||||||
SubjectData(subjectId = id, subjectName = subjectName, isOrder = false, isQQMiniGame = isQQMiniGame)
|
SubjectData(subjectId = id, subjectName = subjectName, isOrder = false, subjectType = subjectType)
|
||||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||||
bundle.putString(KEY_TO, SubjectActivity::class.java.name)
|
bundle.putString(KEY_TO, SubjectActivity::class.java.name)
|
||||||
bundle.putParcelable(EntranceConsts.KEY_SUBJECT_DATA, subjectData)
|
bundle.putParcelable(EntranceConsts.KEY_SUBJECT_DATA, subjectData)
|
||||||
@ -899,12 +938,16 @@ object DirectUtils {
|
|||||||
qaContentId: String? = "",
|
qaContentId: String? = "",
|
||||||
isPlugin: Boolean = false,
|
isPlugin: Boolean = false,
|
||||||
isSmoothGame: Boolean = false,
|
isSmoothGame: Boolean = false,
|
||||||
|
gameId: String? = "",
|
||||||
|
gameName: String? = "",
|
||||||
entrance: String? = null
|
entrance: String? = null
|
||||||
) {
|
) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||||
bundle.putBoolean(KEY_PLUGIN, isPlugin)
|
bundle.putBoolean(KEY_PLUGIN, isPlugin)
|
||||||
bundle.putBoolean(KEY_SMOOTH_GAME, isSmoothGame)
|
bundle.putBoolean(KEY_SMOOTH_GAME, isSmoothGame)
|
||||||
|
bundle.putString(KEY_GAME_ID, gameId)
|
||||||
|
bundle.putString(KEY_GAME_NAME, gameName)
|
||||||
if (isPlugin) {
|
if (isPlugin) {
|
||||||
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【插件问题】")
|
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【插件问题】")
|
||||||
}
|
}
|
||||||
@ -991,7 +1034,13 @@ object DirectUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun directToQuestionDetail(context: Context, id: String, entrance: String? = null, path: String? = null, sourceEntrance: String = "") {
|
fun directToQuestionDetail(
|
||||||
|
context: Context,
|
||||||
|
id: String,
|
||||||
|
entrance: String? = null,
|
||||||
|
path: String? = null,
|
||||||
|
sourceEntrance: String = ""
|
||||||
|
) {
|
||||||
if (id.isEmpty()) return
|
if (id.isEmpty()) return
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||||
@ -1387,47 +1436,6 @@ object DirectUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 跳转分类
|
|
||||||
*/
|
|
||||||
@JvmStatic
|
|
||||||
fun directCategoryDirectory(
|
|
||||||
context: Context,
|
|
||||||
categoryId: String,
|
|
||||||
categoryTitle: String,
|
|
||||||
entrance: String? = null,
|
|
||||||
path: String? = ""
|
|
||||||
) {
|
|
||||||
if (categoryId.isEmpty()) return
|
|
||||||
val bundle = Bundle()
|
|
||||||
bundle.putString(KEY_TO, CategoryDirectoryActivity::class.java.name)
|
|
||||||
bundle.putString(KEY_CATEGORY_ID, categoryId)
|
|
||||||
bundle.putString(KEY_CATEGORY_TITLE, categoryTitle)
|
|
||||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
|
||||||
bundle.putString(KEY_PATH, path)
|
|
||||||
jumpActivity(context, bundle)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 跳转新分类
|
|
||||||
*/
|
|
||||||
@JvmStatic
|
|
||||||
fun directCatalog(
|
|
||||||
context: Context,
|
|
||||||
catalogId: String,
|
|
||||||
catalogTitle: String,
|
|
||||||
entrance: String? = null,
|
|
||||||
path: String? = "",
|
|
||||||
) {
|
|
||||||
if (catalogId.isEmpty()) return
|
|
||||||
val bundle = Bundle()
|
|
||||||
bundle.putString(KEY_TO, CatalogActivity::class.java.name)
|
|
||||||
bundle.putString(KEY_CATALOG_ID, catalogId)
|
|
||||||
bundle.putString(KEY_CATALOG_TITLE, catalogTitle)
|
|
||||||
bundle.putString(KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
|
||||||
jumpActivity(context, bundle)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转新分类2.0
|
* 跳转新分类2.0
|
||||||
*/
|
*/
|
||||||
@ -1935,7 +1943,7 @@ object DirectUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun directToQGameSearch(
|
fun directToMiniGameSearch(
|
||||||
context: Context,
|
context: Context,
|
||||||
hint: String,
|
hint: String,
|
||||||
sourceEntrance: String,
|
sourceEntrance: String,
|
||||||
@ -1947,7 +1955,7 @@ object DirectUtils {
|
|||||||
searchBoxPattern: String = ""
|
searchBoxPattern: String = ""
|
||||||
) {
|
) {
|
||||||
context.startActivity(
|
context.startActivity(
|
||||||
QGameSearchActivity.getIntent(
|
MiniGameSearchActivity.getIntent(
|
||||||
context,
|
context,
|
||||||
hint,
|
hint,
|
||||||
sourceEntrance,
|
sourceEntrance,
|
||||||
@ -1963,11 +1971,10 @@ object DirectUtils {
|
|||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun directToQGameById(
|
fun directToQQGameById(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
qqGameId: String
|
qqAppId: String
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (activity !is AppCompatActivity || activity.supportFragmentManager.isDestroyed) {
|
if (activity !is AppCompatActivity || activity.supportFragmentManager.isDestroyed) {
|
||||||
ToastUtils.toast("启动QQ小游戏失败,请稍后再试")
|
ToastUtils.toast("启动QQ小游戏失败,请稍后再试")
|
||||||
return
|
return
|
||||||
@ -1978,35 +1985,57 @@ object DirectUtils {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckLoginUtils.checkLogin(
|
val qGameProvider = ARouter
|
||||||
activity, null, true, "QQ小游戏-秒开"
|
.getInstance()
|
||||||
) {
|
.build(RouteConsts.provider.qGame)
|
||||||
|
.navigation() as? IQGameProvider
|
||||||
|
|
||||||
|
if (qGameProvider == null) return
|
||||||
|
|
||||||
|
// 下载广点通广告插件,供 QQ 小游戏启动使用 (当次启动不保证能用,但是下一次就大概率就能了)
|
||||||
|
AdPluginDownloadHelper.downloadPluginIfNeeded(isGdt = true)
|
||||||
|
|
||||||
|
CheckLoginUtils.checkLogin(activity, null, true, "QQ小游戏-秒开") {
|
||||||
val userToken = UserManager.getInstance().token
|
val userToken = UserManager.getInstance().token
|
||||||
val userId = UserManager.getInstance().userId
|
val userId = UserManager.getInstance().userId
|
||||||
val userName = UserManager.getInstance().userInfoEntity?.name ?: "unknown"
|
val userName = UserManager.getInstance().userInfoEntity?.name ?: "unknown"
|
||||||
|
|
||||||
val qGameProvider = ARouter
|
|
||||||
.getInstance()
|
|
||||||
.build(RouteConsts.provider.qGame)
|
|
||||||
.navigation() as IQGameProvider<*>
|
|
||||||
qGameProvider.setLoginInfo(activity, userId, userName, userToken)
|
qGameProvider.setLoginInfo(activity, userId, userName, userToken)
|
||||||
qGameProvider.launchGame(activity, qqGameId) { _, _ ->
|
qGameProvider.launchGame(activity, qqAppId) { _, _ ->
|
||||||
RetrofitManager
|
MiniGameRecentlyPlayUseCase.submitRecentPlayedQGame(qqAppId, userId)
|
||||||
.getInstance()
|
|
||||||
.newApi
|
|
||||||
.postQGamePlay(qqGameId, userId)
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe(
|
|
||||||
{
|
|
||||||
QGameViewModel.notifyQGameSubjectUpdate() // 通知QQ小游戏首页列表刷新
|
|
||||||
},
|
|
||||||
{}
|
|
||||||
) // 秒玩记录上报
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
fun directToWechatGameById(
|
||||||
|
activity: Activity,
|
||||||
|
wechatAppId: String,
|
||||||
|
wechatAppPath: String = "",
|
||||||
|
wechatAppExtData: String = ""
|
||||||
|
) {
|
||||||
|
|
||||||
|
val wxApiProxy = WXAPIFactory.createWXAPI(
|
||||||
|
activity,
|
||||||
|
Config.WECHAT_APPID
|
||||||
|
)
|
||||||
|
if (!wxApiProxy.isWXAppInstalled) {
|
||||||
|
ToastUtils.toast("请安装微信客户端")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
wxApiProxy.sendReq(
|
||||||
|
WXLaunchMiniProgram.Req().apply {
|
||||||
|
userName = wechatAppId
|
||||||
|
path = wechatAppPath.ifEmpty { Constants.WECHAT_MINI_GAME_PCS }
|
||||||
|
extData = wechatAppExtData
|
||||||
|
miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
MiniGameRecentlyPlayUseCase.submitRecentPlayedWGame(wechatAppId, HaloApp.getInstance().gid)
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun directToMessageCenter(defaultTabIndex: Int) {
|
fun directToMessageCenter(defaultTabIndex: Int) {
|
||||||
ARouter.getInstance().build(RouteConsts.activity.messageWrapperActivity)
|
ARouter.getInstance().build(RouteConsts.activity.messageWrapperActivity)
|
||||||
@ -2082,7 +2111,7 @@ object DirectUtils {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
BottomTab.SearchStyle.TYPE_QQ_MINI_GAME -> directToQGameSearch(
|
BottomTab.SearchStyle.TYPE_MINI_GAME -> directToMiniGameSearch(
|
||||||
context,
|
context,
|
||||||
"请输入小游戏关键词",
|
"请输入小游戏关键词",
|
||||||
sourceEntrance,
|
sourceEntrance,
|
||||||
|
|||||||
@ -27,7 +27,8 @@ import com.gh.download.server.BrowserInstallHelper
|
|||||||
import com.gh.gamecenter.R
|
import com.gh.gamecenter.R
|
||||||
import com.gh.gamecenter.WebActivity
|
import com.gh.gamecenter.WebActivity
|
||||||
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
|
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
|
||||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
|
||||||
|
import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
|
||||||
import com.gh.gamecenter.common.callback.CancelListener
|
import com.gh.gamecenter.common.callback.CancelListener
|
||||||
import com.gh.gamecenter.common.constant.Constants
|
import com.gh.gamecenter.common.constant.Constants
|
||||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||||
@ -38,6 +39,7 @@ import com.gh.gamecenter.core.utils.*
|
|||||||
import com.gh.gamecenter.feature.entity.GameEntity
|
import com.gh.gamecenter.feature.entity.GameEntity
|
||||||
import com.gh.gamecenter.feature.entity.PluginLocation
|
import com.gh.gamecenter.feature.entity.PluginLocation
|
||||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||||
|
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
|
||||||
import com.gh.gamecenter.feature.view.DownloadButton
|
import com.gh.gamecenter.feature.view.DownloadButton
|
||||||
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
|
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
|
||||||
import com.gh.gamecenter.manager.PackagesManager
|
import com.gh.gamecenter.manager.PackagesManager
|
||||||
@ -128,6 +130,7 @@ object DownloadItemUtils {
|
|||||||
holder.gameDownloadBtn.text = "已预约"
|
holder.gameDownloadBtn.text = "已预约"
|
||||||
holder.gameDownloadBtn.visibility = View.VISIBLE
|
holder.gameDownloadBtn.visibility = View.VISIBLE
|
||||||
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.RESERVED
|
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.RESERVED
|
||||||
|
holder.multiVersionDownloadTv.visibility = View.GONE
|
||||||
updateItemViewStatus(holder, null, null)
|
updateItemViewStatus(holder, null, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,26 +244,25 @@ object DownloadItemUtils {
|
|||||||
if (RegionSettingHelper.getGameH5DownloadByGameId(gameEntity.id) != null) {
|
if (RegionSettingHelper.getGameH5DownloadByGameId(gameEntity.id) != null) {
|
||||||
downloadBtn.apply {
|
downloadBtn.apply {
|
||||||
isClickable = true
|
isClickable = true
|
||||||
text = context.getString(R.string.check)
|
text = context.getString(com.gh.gamecenter.feature.R.string.check)
|
||||||
setBackgroundResource(R.drawable.download_button_normal_style)
|
setBackgroundResource(com.gh.gamecenter.common.R.drawable.download_button_normal_style)
|
||||||
setTextColor(R.color.white.toColor(context))
|
setTextColor(com.gh.gamecenter.common.R.color.white.toColor(context))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (gameEntity.isQQMiniGame()) {
|
if (gameEntity.isMiniGame()) {
|
||||||
val isQQMiniGameOffShelve = gameEntity.qqMiniGameAppStatus == 1 // QQ小游戏是否下架
|
if (gameEntity.isMiniGameOffShelve()) {
|
||||||
if (isQQMiniGameOffShelve) {
|
|
||||||
downloadBtn.apply {
|
downloadBtn.apply {
|
||||||
isClickable = false
|
isClickable = false
|
||||||
text = context.getString(R.string.off_shelve)
|
text = context.getString(com.gh.gamecenter.feature.R.string.off_shelve)
|
||||||
buttonStyle = DownloadButton.ButtonStyle.NONE
|
buttonStyle = DownloadButton.ButtonStyle.NONE
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
downloadBtn.apply {
|
downloadBtn.apply {
|
||||||
isClickable = true
|
isClickable = true
|
||||||
setBackgroundResource(R.drawable.download_button_normal_style)
|
setBackgroundResource(com.gh.gamecenter.common.R.drawable.download_button_normal_style)
|
||||||
setTextColor(R.color.white.toColor(context))
|
setTextColor(com.gh.gamecenter.common.R.color.white.toColor(context))
|
||||||
text = context.getString(R.string.quick_play)
|
text = context.getString(com.gh.gamecenter.feature.R.string.quick_play)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@ -271,21 +273,21 @@ object DownloadItemUtils {
|
|||||||
downloadBtn.apply {
|
downloadBtn.apply {
|
||||||
if (h5LinkEntity != null) {
|
if (h5LinkEntity != null) {
|
||||||
text = if ("play" == h5LinkEntity.type) {
|
text = if ("play" == h5LinkEntity.type) {
|
||||||
context.getString(R.string.start_playing)
|
context.getString(com.gh.gamecenter.feature.R.string.start_playing)
|
||||||
} else {
|
} else {
|
||||||
context.getString(R.string.check)
|
context.getString(com.gh.gamecenter.feature.R.string.check)
|
||||||
}
|
}
|
||||||
isClickable = true
|
isClickable = true
|
||||||
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||||
} else {
|
} else {
|
||||||
if ("dialog" == offStatus) {
|
if ("dialog" == offStatus) {
|
||||||
text = context.getString(R.string.check)
|
text = context.getString(com.gh.gamecenter.feature.R.string.check)
|
||||||
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||||
} else if ("updating" == offStatus) {
|
} else if ("updating" == offStatus) {
|
||||||
text = context.getString(R.string.updating)
|
text = context.getString(com.gh.gamecenter.feature.R.string.updating)
|
||||||
buttonStyle = DownloadButton.ButtonStyle.UPDATING
|
buttonStyle = DownloadButton.ButtonStyle.UPDATING
|
||||||
} else {
|
} else {
|
||||||
text = context.getString(R.string.none)
|
text = context.getString(com.gh.gamecenter.feature.R.string.none)
|
||||||
buttonStyle = DownloadButton.ButtonStyle.NONE
|
buttonStyle = DownloadButton.ButtonStyle.NONE
|
||||||
if (hideDownloadBtnIfNoAvailableContent) {
|
if (hideDownloadBtnIfNoAvailableContent) {
|
||||||
visibility = View.GONE
|
visibility = View.GONE
|
||||||
@ -298,11 +300,13 @@ object DownloadItemUtils {
|
|||||||
// 来自于下载管理的实体快照
|
// 来自于下载管理的实体快照
|
||||||
val entityFromDownloadManager = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
|
val entityFromDownloadManager = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
|
||||||
// 是否正在下载中
|
// 是否正在下载中
|
||||||
val isDownloading = entityFromDownloadManager != null && entityFromDownloadManager.status != DownloadStatus.done
|
val isDownloading =
|
||||||
|
entityFromDownloadManager != null && entityFromDownloadManager.status != DownloadStatus.done
|
||||||
// 是否已安装至本地
|
// 是否已安装至本地
|
||||||
val isInstalledLocally = PackagesManager.isInstalled(gameEntity.getUniquePackageName())
|
val isInstalledLocally = PackagesManager.isInstalled(gameEntity.getUniquePackageName())
|
||||||
// 来自于畅玩安装列表的实体快照,若存在,代表游戏已下载并成功安装
|
// 来自于畅玩安装列表的实体快照,若存在,代表游戏已下载并成功安装
|
||||||
val entityFromInstalledVGame = VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
|
val entityFromInstalledVGame =
|
||||||
|
VHelper.getVDownloadEntitySnapshot(gameEntity.id, gameEntity.getUniquePackageName())
|
||||||
// 是否已安装至畅玩
|
// 是否已安装至畅玩
|
||||||
val isInstalledToVSpace = entityFromInstalledVGame != null
|
val isInstalledToVSpace = entityFromInstalledVGame != null
|
||||||
// 是否处于待安装状态 (仅本地安装有这个状态)
|
// 是否处于待安装状态 (仅本地安装有这个状态)
|
||||||
@ -319,19 +323,20 @@ object DownloadItemUtils {
|
|||||||
// 3. 存在待安装任务时,待安装任务优先
|
// 3. 存在待安装任务时,待安装任务优先
|
||||||
// 4. 存在一个已安装,已安装的显示优先
|
// 4. 存在一个已安装,已安装的显示优先
|
||||||
// 5. 都已安装,按后台配置显示的状态优先
|
// 5. 都已安装,按后台配置显示的状态优先
|
||||||
val isVGamePreferred = if (!isInstalledLocally && !isInstalledToVSpace && entityFromDownloadManager == null) {
|
val isVGamePreferred =
|
||||||
gameEntity.isVGamePreferred()
|
if (!isInstalledLocally && !isInstalledToVSpace && entityFromDownloadManager == null) {
|
||||||
} else if (isDownloading || isPendingToInstall) {
|
gameEntity.isVGamePreferred()
|
||||||
entityFromDownloadManager?.isVGameDownloadInDualDownloadMode() == true
|
} else if (isDownloading || isPendingToInstall) {
|
||||||
} else if (isInstalledLocally && isInstalledToVSpace) {
|
entityFromDownloadManager?.isVGameDownloadInDualDownloadMode() == true
|
||||||
gameEntity.isVGamePreferred()
|
} else if (isInstalledLocally && isInstalledToVSpace) {
|
||||||
} else if (isInstalledLocally) {
|
gameEntity.isVGamePreferred()
|
||||||
false
|
} else if (isInstalledLocally) {
|
||||||
} else if (isInstalledToVSpace) {
|
false
|
||||||
true
|
} else if (isInstalledToVSpace) {
|
||||||
} else {
|
true
|
||||||
gameEntity.isVGamePreferred()
|
} else {
|
||||||
}
|
gameEntity.isVGamePreferred()
|
||||||
|
}
|
||||||
|
|
||||||
val downloadEntity: DownloadEntity? = if (isDownloading) {
|
val downloadEntity: DownloadEntity? = if (isDownloading) {
|
||||||
entityFromDownloadManager
|
entityFromDownloadManager
|
||||||
@ -359,17 +364,17 @@ object DownloadItemUtils {
|
|||||||
asVGame = true
|
asVGame = true
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
setText(R.string.update)
|
setText(com.gh.gamecenter.feature.R.string.update)
|
||||||
DownloadButton.ButtonStyle.NORMAL
|
DownloadButton.ButtonStyle.NORMAL
|
||||||
} else {
|
} else {
|
||||||
setText(R.string.launch)
|
setText(com.gh.gamecenter.feature.R.string.launch)
|
||||||
DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
|
DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val xapkStatus = downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS]
|
val xapkStatus = downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS]
|
||||||
if (XapkUnzipStatus.SUCCESS.name == xapkStatus && isInstalling(downloadEntity.path)) {
|
if (XapkUnzipStatus.SUCCESS.name == xapkStatus && isInstalling(downloadEntity.path)) {
|
||||||
progress = 100
|
progress = 100
|
||||||
setText(R.string.installing)
|
setText(com.gh.gamecenter.feature.R.string.installing)
|
||||||
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -380,23 +385,27 @@ object DownloadItemUtils {
|
|||||||
buttonStyle = DownloadButton.ButtonStyle.XAPK_UNZIPPING
|
buttonStyle = DownloadButton.ButtonStyle.XAPK_UNZIPPING
|
||||||
return
|
return
|
||||||
} else if (XapkUnzipStatus.FAILURE.name == xapkStatus) {
|
} else if (XapkUnzipStatus.FAILURE.name == xapkStatus) {
|
||||||
setText(R.string.install)
|
setText(com.gh.gamecenter.feature.R.string.install)
|
||||||
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PackagesManager.isInstalled(downloadEntity.packageName) && !downloadEntity.isUpdate) {
|
if (PackagesManager.isInstalled(downloadEntity.packageName) && !downloadEntity.isUpdate) {
|
||||||
// 双下载按钮快速安装时存在已下载的安装包过时,需要重新下载的情况
|
// 双下载按钮快速安装时存在已下载的安装包过时,需要重新下载的情况
|
||||||
if (PackagesManager.isCanUpdate(downloadEntity.gameId, downloadEntity.packageName)) {
|
if (PackagesManager.isCanUpdate(
|
||||||
|
downloadEntity.gameId,
|
||||||
|
downloadEntity.packageName
|
||||||
|
)
|
||||||
|
) {
|
||||||
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||||
setText(R.string.update)
|
setText(com.gh.gamecenter.feature.R.string.update)
|
||||||
} else {
|
} else {
|
||||||
buttonStyle = DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
|
buttonStyle = DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
|
||||||
setText(R.string.launch)
|
setText(com.gh.gamecenter.feature.R.string.launch)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
||||||
setText(R.string.install)
|
setText(com.gh.gamecenter.feature.R.string.install)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buttonStyle =
|
buttonStyle =
|
||||||
@ -415,7 +424,7 @@ object DownloadItemUtils {
|
|||||||
DownloadStatus.diskioerror,
|
DownloadStatus.diskioerror,
|
||||||
DownloadStatus.overflow -> {
|
DownloadStatus.overflow -> {
|
||||||
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||||
setText(R.string.resume)
|
setText(com.gh.gamecenter.feature.R.string.resume)
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadStatus.cancel -> {
|
DownloadStatus.cancel -> {
|
||||||
@ -501,13 +510,13 @@ object DownloadItemUtils {
|
|||||||
DownloadStatus.downloading -> {
|
DownloadStatus.downloading -> {
|
||||||
if (isMultiVersion) {
|
if (isMultiVersion) {
|
||||||
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||||
val darkMode = (holder.gameDownloadTips?.getTag(R.string.is_dark_mode_on_id) as? Boolean) ?: false
|
val darkMode = (holder.gameDownloadTips?.getTag(com.gh.gamecenter.common.R.string.is_dark_mode_on_id) as? Boolean) ?: false
|
||||||
val isDarkModeChanged = DarkModeUtils.isDarkModeOn(context) != darkMode
|
val isDarkModeChanged = DarkModeUtils.isDarkModeOn(context) != darkMode
|
||||||
if (holder.gameDownloadTips?.visibility == View.GONE || holder.gameDownloadTips?.isAnimating == false || isDarkModeChanged) {
|
if (holder.gameDownloadTips?.visibility == View.GONE || holder.gameDownloadTips?.isAnimating == false || isDarkModeChanged) {
|
||||||
holder.gameDownloadTips?.visibility = View.VISIBLE
|
holder.gameDownloadTips?.visibility = View.VISIBLE
|
||||||
holder.gameDownloadTips?.setDownloadTipsAnimation(true)
|
holder.gameDownloadTips?.setDownloadTipsAnimation(true)
|
||||||
}
|
}
|
||||||
holder.gameDownloadTips?.setTag(R.string.is_dark_mode_on_id, DarkModeUtils.isDarkModeOn(context))
|
holder.gameDownloadTips?.setTag(com.gh.gamecenter.common.R.string.is_dark_mode_on_id, DarkModeUtils.isDarkModeOn(context))
|
||||||
} else {
|
} else {
|
||||||
holder.gameDownloadTips?.visibility = View.GONE
|
holder.gameDownloadTips?.visibility = View.GONE
|
||||||
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_NORMAL
|
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_NORMAL
|
||||||
@ -522,7 +531,7 @@ object DownloadItemUtils {
|
|||||||
holder.gameDownloadTips?.setDownloadTipsAnimation(false)
|
holder.gameDownloadTips?.setDownloadTipsAnimation(false)
|
||||||
}
|
}
|
||||||
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.WAITING
|
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.WAITING
|
||||||
holder.gameDownloadBtn.text = context.getString(R.string.waiting)
|
holder.gameDownloadBtn.text = context.getString(com.gh.gamecenter.feature.R.string.waiting)
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadStatus.pause,
|
DownloadStatus.pause,
|
||||||
@ -537,7 +546,7 @@ object DownloadItemUtils {
|
|||||||
holder.gameDownloadTips?.setDownloadTipsAnimation(false)
|
holder.gameDownloadTips?.setDownloadTipsAnimation(false)
|
||||||
}
|
}
|
||||||
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||||
holder.gameDownloadBtn.text = context.getString(R.string.resume)
|
holder.gameDownloadBtn.text = context.getString(com.gh.gamecenter.feature.R.string.resume)
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadStatus.done -> {
|
DownloadStatus.done -> {
|
||||||
@ -552,7 +561,7 @@ object DownloadItemUtils {
|
|||||||
holder.gameDownloadBtn.text = "$percent%"
|
holder.gameDownloadBtn.text = "$percent%"
|
||||||
return
|
return
|
||||||
} else if (XapkUnzipStatus.FAILURE.name == xapkStatus) {
|
} else if (XapkUnzipStatus.FAILURE.name == xapkStatus) {
|
||||||
holder.gameDownloadBtn.setText(R.string.install)
|
holder.gameDownloadBtn.setText(com.gh.gamecenter.feature.R.string.install)
|
||||||
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
holder.gameDownloadBtn.buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -627,7 +636,17 @@ object DownloadItemUtils {
|
|||||||
location: String,
|
location: String,
|
||||||
sourceEntrance: String = "其他"
|
sourceEntrance: String = "其他"
|
||||||
) {
|
) {
|
||||||
setOnClickListener(context, downloadBtn, gameEntity, position, adapter, entrance, sourceEntrance, location, null)
|
setOnClickListener(
|
||||||
|
context,
|
||||||
|
downloadBtn,
|
||||||
|
gameEntity,
|
||||||
|
position,
|
||||||
|
adapter,
|
||||||
|
entrance,
|
||||||
|
sourceEntrance,
|
||||||
|
location,
|
||||||
|
null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@ -642,7 +661,18 @@ object DownloadItemUtils {
|
|||||||
location: String,
|
location: String,
|
||||||
traceEvent: ExposureEvent?,
|
traceEvent: ExposureEvent?,
|
||||||
) {
|
) {
|
||||||
setOnClickListener(context, downloadBtn, gameEntity, position, adapter, entrance, sourceEntrance, location, traceEvent, null)
|
setOnClickListener(
|
||||||
|
context,
|
||||||
|
downloadBtn,
|
||||||
|
gameEntity,
|
||||||
|
position,
|
||||||
|
adapter,
|
||||||
|
entrance,
|
||||||
|
sourceEntrance,
|
||||||
|
location,
|
||||||
|
traceEvent,
|
||||||
|
null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -698,7 +728,7 @@ object DownloadItemUtils {
|
|||||||
// 为 downloadButton 添加游戏实体,供点击的时候上报用
|
// 为 downloadButton 添加游戏实体,供点击的时候上报用
|
||||||
downloadBtn.putObject(gameEntity)
|
downloadBtn.putObject(gameEntity)
|
||||||
|
|
||||||
val gamePermissionDialogFragment = (context as AppCompatActivity).supportFragmentManager.findFragmentByTag(
|
val gamePermissionDialogFragment = (context as? AppCompatActivity)?.supportFragmentManager?.findFragmentByTag(
|
||||||
GamePermissionDialogFragment::class.java.name
|
GamePermissionDialogFragment::class.java.name
|
||||||
) as GamePermissionDialogFragment?
|
) as GamePermissionDialogFragment?
|
||||||
gamePermissionDialogFragment?.dismissAllowingStateLoss()
|
gamePermissionDialogFragment?.dismissAllowingStateLoss()
|
||||||
@ -780,14 +810,18 @@ object DownloadItemUtils {
|
|||||||
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.id)) {
|
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.id)) {
|
||||||
SensorsBridge.trackEvent(
|
SensorsBridge.trackEvent(
|
||||||
"AppointmentGame",
|
"AppointmentGame",
|
||||||
"game_name",
|
"game_name", gameEntity.name ?: "",
|
||||||
gameEntity.name ?: "",
|
"game_id", gameEntity.id,
|
||||||
"game_id",
|
"game_type", gameEntity.categoryChinese,
|
||||||
gameEntity.id,
|
"source_entrance", sourceEntrance,
|
||||||
"game_type",
|
"page_name", getCurrentPageEntity().pageName,
|
||||||
gameEntity.categoryChinese,
|
"page_id", getCurrentPageEntity().pageId,
|
||||||
"source_entrance",
|
"page_business_id", getCurrentPageEntity().pageBusinessId,
|
||||||
sourceEntrance
|
"last_page_name", getLastPageEntity().pageName,
|
||||||
|
"last_page_id", getLastPageEntity().pageId,
|
||||||
|
"last_page_business_id", getLastPageEntity().pageBusinessId,
|
||||||
|
"source", gameEntity.exposureEvent?.source?.toString() ?: "",
|
||||||
|
*gameEntity.customPageTrackData?.toKV() ?: arrayOf()
|
||||||
)
|
)
|
||||||
allStateClickCallback?.onCallback()
|
allStateClickCallback?.onCallback()
|
||||||
CheckLoginUtils.checkLogin(context, entrance) {
|
CheckLoginUtils.checkLogin(context, entrance) {
|
||||||
@ -813,7 +847,7 @@ object DownloadItemUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ReservationHelper.showCancelReservationDialog(context, {
|
ReservationHelper.showCancelReservationDialog(context, gameEntity,{
|
||||||
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
|
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
|
||||||
"确定取消",
|
"确定取消",
|
||||||
gameEntity.id,
|
gameEntity.id,
|
||||||
@ -844,12 +878,11 @@ object DownloadItemUtils {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (gameEntity.isQQMiniGame()) {
|
if (gameEntity.isMiniGame()) {
|
||||||
downloadBtn.setOnClickListener {
|
downloadBtn.setOnClickListener {
|
||||||
NewFlatLogUtils.logQGameClick(gameEntity.qqMiniGameAppId, gameEntity.name)
|
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||||
GlobalActivityManager.currentActivity?.let { activity ->
|
clickCallback?.onCallback()
|
||||||
DirectUtils.directToQGameById(activity, gameEntity.qqMiniGameAppId)
|
allStateClickCallback?.onCallback()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -889,7 +922,7 @@ object DownloadItemUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 启动不需要请求存储权限
|
// 启动不需要请求存储权限
|
||||||
if (downloadBtn is DownloadButton && downloadBtn.text == context.getString(R.string.launch)) {
|
if (downloadBtn is DownloadButton && downloadBtn.text == context.getString(com.gh.gamecenter.feature.R.string.launch)) {
|
||||||
clickRunnable.onCallback()
|
clickRunnable.onCallback()
|
||||||
} else {
|
} else {
|
||||||
PermissionHelper.checkStoragePermissionBeforeAction(
|
PermissionHelper.checkStoragePermissionBeforeAction(
|
||||||
@ -912,7 +945,7 @@ object DownloadItemUtils {
|
|||||||
addHandler(CheckStoragePermissionHandler())
|
addHandler(CheckStoragePermissionHandler())
|
||||||
addHandler(VersionNumberHandler())
|
addHandler(VersionNumberHandler())
|
||||||
}
|
}
|
||||||
.setProcessEndCallback { _, _ ->
|
.setProcessEndCallback(gameEntity.id) { _, _ ->
|
||||||
DownloadDialog.showDownloadDialog(view.context, gameEntity, traceEvent, entrance, location)
|
DownloadDialog.showDownloadDialog(view.context, gameEntity, traceEvent, entrance, location)
|
||||||
}
|
}
|
||||||
.buildHandlerChain()
|
.buildHandlerChain()
|
||||||
@ -937,13 +970,13 @@ object DownloadItemUtils {
|
|||||||
traceEvent: ExposureEvent? = null,
|
traceEvent: ExposureEvent? = null,
|
||||||
refreshCallback: EmptyCallback? = null
|
refreshCallback: EmptyCallback? = null
|
||||||
) {
|
) {
|
||||||
val str = if (downloadBtn is DownloadButton) downloadBtn.text else context.getString(R.string.download)
|
val str = if (downloadBtn is DownloadButton) downloadBtn.text else context.getString(com.gh.gamecenter.feature.R.string.download)
|
||||||
if (gameEntity.getApk().isEmpty()) return
|
if (gameEntity.getApk().isEmpty()) return
|
||||||
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
|
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
|
||||||
|
|
||||||
val shouldPerformAsVGame = GameUtils.shouldPerformAsVGame(gameEntity)
|
val shouldPerformAsVGame = GameUtils.shouldPerformAsVGame(gameEntity)
|
||||||
|
|
||||||
if (str == context.getString(R.string.download)) {
|
if (str == context.getString(com.gh.gamecenter.feature.R.string.download)) {
|
||||||
DownloadChainBuilder().apply {
|
DownloadChainBuilder().apply {
|
||||||
addHandler(UnsupportedFeatureHandler())
|
addHandler(UnsupportedFeatureHandler())
|
||||||
addHandler(UpdateNewSimulatorHandler())
|
addHandler(UpdateNewSimulatorHandler())
|
||||||
@ -955,13 +988,13 @@ object DownloadItemUtils {
|
|||||||
addHandler(LandPageAddressHandler())
|
addHandler(LandPageAddressHandler())
|
||||||
addHandler(CheckDownloadHandler())
|
addHandler(CheckDownloadHandler())
|
||||||
}
|
}
|
||||||
.setProcessEndCallback { asVGame, isSubscribe ->
|
.setProcessEndCallback(gameEntity.id) { asVGame, isSubscribe ->
|
||||||
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
|
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
|
||||||
}
|
}
|
||||||
.buildHandlerChain()
|
.buildHandlerChain()
|
||||||
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
|
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
|
||||||
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
|
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
|
||||||
} else if (str == context.getString(R.string.attempt)) {
|
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.attempt)) {
|
||||||
DownloadChainBuilder().apply {
|
DownloadChainBuilder().apply {
|
||||||
addHandler(UnsupportedFeatureHandler())
|
addHandler(UnsupportedFeatureHandler())
|
||||||
addHandler(UpdateNewSimulatorHandler())
|
addHandler(UpdateNewSimulatorHandler())
|
||||||
@ -974,13 +1007,13 @@ object DownloadItemUtils {
|
|||||||
addHandler(OverseaDownloadHandler())
|
addHandler(OverseaDownloadHandler())
|
||||||
addHandler(CheckDownloadHandler())
|
addHandler(CheckDownloadHandler())
|
||||||
}
|
}
|
||||||
.setProcessEndCallback { asVGame, isSubscribe ->
|
.setProcessEndCallback(gameEntity.id) { asVGame, isSubscribe ->
|
||||||
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
|
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
|
||||||
}
|
}
|
||||||
.buildHandlerChain()
|
.buildHandlerChain()
|
||||||
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
|
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
|
||||||
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
|
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
|
||||||
} else if (str == context.getString(R.string.smooth)) {
|
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.smooth)) {
|
||||||
DownloadChainBuilder().apply {
|
DownloadChainBuilder().apply {
|
||||||
addHandler(UnsupportedFeatureHandler())
|
addHandler(UnsupportedFeatureHandler())
|
||||||
addHandler(GamePermissionHandler())
|
addHandler(GamePermissionHandler())
|
||||||
@ -993,7 +1026,7 @@ object DownloadItemUtils {
|
|||||||
addHandler(ValidateVSpaceHandler())
|
addHandler(ValidateVSpaceHandler())
|
||||||
addHandler(CheckDownloadHandler())
|
addHandler(CheckDownloadHandler())
|
||||||
}
|
}
|
||||||
.setProcessEndCallback { asVGame, isSubscribe ->
|
.setProcessEndCallback(gameEntity.id) { asVGame, isSubscribe ->
|
||||||
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
|
download(context, gameEntity, downloadBtn, entrance, location, asVGame, isSubscribe as Boolean, traceEvent)
|
||||||
}
|
}
|
||||||
.buildHandlerChain()
|
.buildHandlerChain()
|
||||||
@ -1006,13 +1039,13 @@ object DownloadItemUtils {
|
|||||||
addHandler(DownloadDialogHelperHandler())
|
addHandler(DownloadDialogHelperHandler())
|
||||||
addHandler(CheckDownloadHandler())
|
addHandler(CheckDownloadHandler())
|
||||||
}
|
}
|
||||||
.setProcessEndCallback { _, isSubscribe ->
|
.setProcessEndCallback(gameEntity.id) { _, isSubscribe ->
|
||||||
plugin(context, gameEntity, downloadBtn, entrance, location, isSubscribe as Boolean, traceEvent)
|
plugin(context, gameEntity, downloadBtn, entrance, location, isSubscribe as Boolean, traceEvent)
|
||||||
}
|
}
|
||||||
.buildHandlerChain()
|
.buildHandlerChain()
|
||||||
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
|
?.handleRequest(context, gameEntity, shouldPerformAsVGame)
|
||||||
}
|
}
|
||||||
} else if (str == context.getString(R.string.install)) {
|
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.install)) {
|
||||||
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apk.url)
|
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apk.url)
|
||||||
|
|
||||||
com.gh.gamecenter.common.utils.NewFlatLogUtils.logGameInstall(
|
com.gh.gamecenter.common.utils.NewFlatLogUtils.logGameInstall(
|
||||||
@ -1052,14 +1085,15 @@ object DownloadItemUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install(context, gameEntity, position, adapter, refreshCallback)
|
install(context, gameEntity, position, adapter, refreshCallback)
|
||||||
} else if (str == context.getString(R.string.launch)) {
|
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.launch)) {
|
||||||
//启动模拟器游戏
|
//启动模拟器游戏
|
||||||
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
|
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
|
||||||
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
|
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
|
||||||
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
|
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().firstOrNull()?.url)
|
val downloadEntity =
|
||||||
|
SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().firstOrNull()?.url)
|
||||||
if (downloadEntity != null) {
|
if (downloadEntity != null) {
|
||||||
val file = File(downloadEntity.path)
|
val file = File(downloadEntity.path)
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
@ -1082,7 +1116,7 @@ object DownloadItemUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PackageLauncher.launch(context, gameEntity)
|
PackageLauncher.launch(context, gameEntity)
|
||||||
} else if (str == context.getString(R.string.update)) {
|
} else if (str == context.getString(com.gh.gamecenter.feature.R.string.update)) {
|
||||||
if (shouldPerformAsVGame) {
|
if (shouldPerformAsVGame) {
|
||||||
VHelper.updateOrReDownload(gameEntity)
|
VHelper.updateOrReDownload(gameEntity)
|
||||||
return
|
return
|
||||||
@ -1091,7 +1125,7 @@ object DownloadItemUtils {
|
|||||||
DownloadChainBuilder()
|
DownloadChainBuilder()
|
||||||
.apply {
|
.apply {
|
||||||
addHandler(LandPageAddressHandler())
|
addHandler(LandPageAddressHandler())
|
||||||
}.setProcessEndCallback { asVGame, _ ->
|
}.setProcessEndCallback(gameEntity.id) { asVGame, _ ->
|
||||||
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk) {
|
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk) {
|
||||||
DialogUtils.checkDownload(
|
DialogUtils.checkDownload(
|
||||||
context,
|
context,
|
||||||
@ -1124,11 +1158,11 @@ object DownloadItemUtils {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
when (str) {
|
when (str) {
|
||||||
context.getString(R.string.resume) -> {
|
context.getString(com.gh.gamecenter.feature.R.string.resume) -> {
|
||||||
DownloadManager.getInstance().resume(downloadEntity, false)
|
DownloadManager.getInstance().resume(downloadEntity, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
context.getString(R.string.waiting) -> {
|
context.getString(com.gh.gamecenter.feature.R.string.waiting) -> {
|
||||||
Utils.toast(context, "最多只能同时下载三个任务,请稍等")
|
Utils.toast(context, "最多只能同时下载三个任务,请稍等")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1164,7 +1198,11 @@ object DownloadItemUtils {
|
|||||||
isSubscribe,
|
isSubscribe,
|
||||||
traceEvent
|
traceEvent
|
||||||
)
|
)
|
||||||
ToastUtils.toast(gameEntity.name + "已加入下载队列")
|
if (asVGame) {
|
||||||
|
ToastUtils.toast(gameEntity.name + "已加入加载队列")
|
||||||
|
} else {
|
||||||
|
ToastUtils.toast(gameEntity.name + "已加入下载队列")
|
||||||
|
}
|
||||||
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
|
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
|
||||||
val toast = context.getString(R.string.unsupported_browser_install_hint)
|
val toast = context.getString(R.string.unsupported_browser_install_hint)
|
||||||
AppExecutor.uiExecutor.executeWithDelay({
|
AppExecutor.uiExecutor.executeWithDelay({
|
||||||
@ -1202,7 +1240,7 @@ object DownloadItemUtils {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
if (downloadBtn is DownloadButton) {
|
if (downloadBtn is DownloadButton) {
|
||||||
downloadBtn.setText(R.string.downloading)
|
downloadBtn.setText(com.gh.gamecenter.feature.R.string.downloading)
|
||||||
downloadBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN
|
downloadBtn.buttonStyle = DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1224,7 +1262,7 @@ object DownloadItemUtils {
|
|||||||
val path = downloadEntity.path
|
val path = downloadEntity.path
|
||||||
when {
|
when {
|
||||||
FileUtils.isEmptyFile(path) -> {
|
FileUtils.isEmptyFile(path) -> {
|
||||||
Utils.toast(context, R.string.install_failure_hint)
|
Utils.toast(context, com.gh.gamecenter.common.R.string.install_failure_hint)
|
||||||
DownloadManager.getInstance().cancel(downloadEntity.url)
|
DownloadManager.getInstance().cancel(downloadEntity.url)
|
||||||
gameEntity.getEntryMap().remove(apkEntity?.getPlatform())
|
gameEntity.getEntryMap().remove(apkEntity?.getPlatform())
|
||||||
adapter?.notifyItemChanged(position)
|
adapter?.notifyItemChanged(position)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user