Compare commits
694 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c807922d6 | |||
| d7f5b573c6 | |||
| f9d624b077 | |||
| a22fa59975 | |||
| e68ad6489a | |||
| ccd3a98799 | |||
| 96026ef9fa | |||
| 777e05733c | |||
| cbf6f34a9c | |||
| 23c0f12ed3 | |||
| da91dcab59 | |||
| ee846bc620 | |||
| aa3db9330e | |||
| 2393dc2291 | |||
| cb94bc9f29 | |||
| a60442db41 | |||
| 9691344e67 | |||
| 41ba8c3e5a | |||
| b203d3a756 | |||
| 28bca22d93 | |||
| 905571a637 | |||
| dc9ac67e6e | |||
| 8c1d4a3778 | |||
| 7189261c01 | |||
| 86c1781426 | |||
| 4812e9258b | |||
| b906fe7b47 | |||
| 846fd7222e | |||
| 1afabdfd94 | |||
| 8ed2a13884 | |||
| cd13c98ac2 | |||
| 2c49b468e6 | |||
| d175e895c3 | |||
| 1c0af1be7d | |||
| 62f5a479c9 | |||
| a87011d5b0 | |||
| c6c2213a88 | |||
| 9ede98deea | |||
| e46ec7c416 | |||
| d49c6bc3ca | |||
| 2bba43cf26 | |||
| 19f54bb8d2 | |||
| a167e7ff58 | |||
| ddd9032dbf | |||
| 1062522388 | |||
| b631c3437c | |||
| 5de5b005bf | |||
| 7d99db505b | |||
| 3b3e2e572e | |||
| 56eb40740a | |||
| d697bc7b8a | |||
| 95beddc194 | |||
| 5e3e4a88f5 | |||
| 75dabfef6b | |||
| e51e976385 | |||
| 28b9e14487 | |||
| 5ee1e823c5 | |||
| 11eee2eb0a | |||
| 42fa273d06 | |||
| 69dcd407b1 | |||
| 66722a313f | |||
| 81b0404999 | |||
| 79dadfeae6 | |||
| 601733f257 | |||
| 48a6bd0d2e | |||
| dfb89980fe | |||
| e7d4c598a3 | |||
| d6d0bea491 | |||
| 1f05d6e0ba | |||
| c995846db7 | |||
| 964b2afaae | |||
| 7cd4a45915 | |||
| 707361e660 | |||
| b427418ec6 | |||
| 580a00e1a9 | |||
| 1e13ae4815 | |||
| e18aeb92dd | |||
| 24aaeeee7f | |||
| a70a397199 | |||
| 7f4d06fbe1 | |||
| 690ca33702 | |||
| cf6a80dd0d | |||
| c409b755cf | |||
| 0399a0cc91 | |||
| c28d6f3080 | |||
| 56501f9f33 | |||
| ebcf2aaa9e | |||
| 0f9f3dc073 | |||
| 8c92da2ceb | |||
| 671c59a9de | |||
| adcb8a4693 | |||
| 95d87858f1 | |||
| 0a463b0ddd | |||
| 2da4230d8c | |||
| b00fda2289 | |||
| 86790e7b69 | |||
| 80ea7303f8 | |||
| 700831ba26 | |||
| e35950ad89 | |||
| 7be72e76f2 | |||
| 6d5b0eb1e8 | |||
| 0dcf5d2097 | |||
| 32e584c04c | |||
| f726a4629f | |||
| fbe29d82be | |||
| a6c2254db3 | |||
| 3d4977dc87 | |||
| 4d0fda6157 | |||
| 34fb8ccf93 | |||
| 49b9c3a135 | |||
| bc04dcc94b | |||
| eb0bba47f9 | |||
| 9ba4e9c2cf | |||
| 3a69bb4452 | |||
| 0581ebf409 | |||
| 44607a9039 | |||
| 00db8c00c6 | |||
| c64713117e | |||
| 28e28d0775 | |||
| 6f53a67554 | |||
| f2b965b447 | |||
| 0ae4f745ee | |||
| bcfd9cdfef | |||
| 94ffe5a86f | |||
| c3ddd28bad | |||
| eab8bc846c | |||
| 05268442f8 | |||
| 55521e6f29 | |||
| db5b09cc11 | |||
| b0922b4c29 | |||
| 455ed32ac6 | |||
| fd92979481 | |||
| 3d322b29c1 | |||
| dcfc2f44cb | |||
| b809ae6687 | |||
| c575e589ae | |||
| 2af47af681 | |||
| b1228bdd2a | |||
| 4008c7fa4d | |||
| f2d714280b | |||
| 6862609bba | |||
| 3afae78477 | |||
| b03df595bc | |||
| c6f0825fb5 | |||
| cbc2902613 | |||
| db725a417d | |||
| 4270924d0f | |||
| 69fc206377 | |||
| 8468ec45c2 | |||
| 256a4c2b0a | |||
| 7d01e47c26 | |||
| 5814f468b3 | |||
| a5730e0ffd | |||
| 0dfd87db25 | |||
| 31aa16f155 | |||
| b22c6b9a5b | |||
| ffae0d1b1d | |||
| 5d8a31c725 | |||
| 1c35982db0 | |||
| 52f71dc79e | |||
| f1c0155379 | |||
| 19dc23d98a | |||
| 69c82ec0e6 | |||
| b1a9d96c3b | |||
| a88500576f | |||
| 058eaf0a4a | |||
| 1b326a0515 | |||
| 3fc1fd821a | |||
| b3af44cc4c | |||
| 44c1711be7 | |||
| c616df87ea | |||
| dd7072eea4 | |||
| 4ee463f03e | |||
| d3dc31eeaf | |||
| 08b364a626 | |||
| 9e6d1e5fbd | |||
| 75a21ee04e | |||
| 27d13d4ce9 | |||
| 16526ddfbd | |||
| d6e676300e | |||
| 7852972e01 | |||
| 6ff76ea1ed | |||
| 39d51ceeb3 | |||
| 00fc6e447c | |||
| 76fff608ed | |||
| 460409ac30 | |||
| 80403e1684 | |||
| ef32fd946b | |||
| 23d57c8bbd | |||
| c46b93769d | |||
| 2305229919 | |||
| 0e9453b1b2 | |||
| 420290bc87 | |||
| 91be2cea1d | |||
| 4dc3a8edc3 | |||
| 5ba9c74583 | |||
| a694e401d3 | |||
| a6cb0b9fa0 | |||
| 9b599fd28d | |||
| f04fecc11e | |||
| 471e28099b | |||
| 5a3031ae87 | |||
| 1421f27bd3 | |||
| e9e152eeee | |||
| aae6904e4b | |||
| db7fbe057e | |||
| 042508e8e6 | |||
| af5736f54d | |||
| 56816fa682 | |||
| 05e0609f94 | |||
| 7a080851ae | |||
| e1ce989d43 | |||
| 6e00a0c2a6 | |||
| 71318fa9ef | |||
| 05b4896d6e | |||
| 7f40e45ef2 | |||
| 2928c59b87 | |||
| ceb2442f3f | |||
| cec684c325 | |||
| b5e4bf772b | |||
| 9f3fe9e30d | |||
| c7174bbaec | |||
| de013e0129 | |||
| 412ea87668 | |||
| dc40f81ff2 | |||
| 25c849ccad | |||
| 927c846bcb | |||
| fcd13ba8b0 | |||
| bccd161762 | |||
| 776dfddc34 | |||
| b31b529ca7 | |||
| 1cc2f5387a | |||
| 5c79a01cc6 | |||
| 1e3704c1ed | |||
| 41340f7333 | |||
| e73fc09d9b | |||
| d593c54262 | |||
| b1e5d48098 | |||
| f9d652d629 | |||
| 77ee092b5b | |||
| 0a61d29f37 | |||
| c65147e309 | |||
| 1ff2bb0bcc | |||
| f8ce9ffc90 | |||
| 42366a8591 | |||
| 5dbf29a09d | |||
| 9621a62ed6 | |||
| 07f320db27 | |||
| 89ecf09b55 | |||
| 2cfb227c22 | |||
| 285ec88d01 | |||
| 1f86e7b32d | |||
| f34adc8e6d | |||
| 8606c8f87a | |||
| caf2dbacf9 | |||
| df6c87eed2 | |||
| 2894a964ea | |||
| 421baf2889 | |||
| 040901f9df | |||
| 9587336b31 | |||
| e1c2b2027a | |||
| c5ff26c879 | |||
| 9690a695d4 | |||
| 78e9c43f24 | |||
| 2d9af85b62 | |||
| 35c71c70c9 | |||
| 70e63ed8e3 | |||
| b7a36074ed | |||
| 0cb7e4c9a1 | |||
| 152b9add80 | |||
| ab27ca5256 | |||
| 90545415ae | |||
| 8018517207 | |||
| c79128d6f4 | |||
| 141d179a64 | |||
| 0a9471fc2e | |||
| 7cfa26ff02 | |||
| a7335d21c5 | |||
| ce3d594a4e | |||
| 553f84daa1 | |||
| 70f782cb5c | |||
| 28725ae76f | |||
| b0972f1a80 | |||
| 585660e52d | |||
| 0fd84f8b44 | |||
| 43bcf78dea | |||
| fb44391500 | |||
| 4c4de337cd | |||
| 20998852b6 | |||
| 929a2c4d29 | |||
| f0fd323107 | |||
| 00892e831a | |||
| 625e448928 | |||
| 2bfefc5082 | |||
| a55fcdcb28 | |||
| 1538d77960 | |||
| 9f77e70c16 | |||
| 548a34c66d | |||
| 55f51284c8 | |||
| 079dac80f8 | |||
| b33fee6ec0 | |||
| 2c1fdae6c7 | |||
| 6a935b18e8 | |||
| 91c363fb55 | |||
| 630f78e62d | |||
| dc7b103cbc | |||
| d30f51123d | |||
| 00f625c350 | |||
| 95f63bd4f2 | |||
| e1a65c5fce | |||
| 9fd6ce4e74 | |||
| 46df9cdccc | |||
| 339665f90f | |||
| 07a1b2a63b | |||
| 96d9d05eb9 | |||
| b1c848a7a6 | |||
| eb4d84bb48 | |||
| 04f72091e4 | |||
| 5d21d62140 | |||
| 0a7b646779 | |||
| 6a36874ef8 | |||
| 285e0caafe | |||
| 9f9a675f04 | |||
| 0e0c6c48af | |||
| 238220548a | |||
| 38c02380ad | |||
| dfc023a0cd | |||
| cbd9a5708b | |||
| bf5608492d | |||
| 267f03fd42 | |||
| 8b0a639196 | |||
| 75f164249f | |||
| fd72f01b1d | |||
| c17a55e33c | |||
| d39a62d4e0 | |||
| 5d02c40227 | |||
| 910d1eb6b7 | |||
| 1aded5ecf4 | |||
| 755a2a0633 | |||
| d86dc7a03c | |||
| 1a33e24a85 | |||
| 9a9c219082 | |||
| 9741334c2e | |||
| 48f762140b | |||
| 3e9c3027f2 | |||
| c895965822 | |||
| eba7f31b32 | |||
| 8dff7f3e69 | |||
| 5abb229fcc | |||
| d0b6d4ae5c | |||
| 772a21210d | |||
| b81df5b2ad | |||
| 07c44ef6a1 | |||
| 6aa1a0a00e | |||
| c6890cee19 | |||
| 38d91af306 | |||
| f83a4035c3 | |||
| 5fc03780a9 | |||
| ac7828c9f2 | |||
| 270a02366d | |||
| 25d96aba67 | |||
| f6558e1e13 | |||
| 7784cecdbc | |||
| ad3301e0a8 | |||
| 8f2ee5d323 | |||
| 9a999eefb7 | |||
| cdb274229b | |||
| b20a3717e1 | |||
| 3ef8dea4d2 | |||
| 17ee9752d3 | |||
| f2bf3df304 | |||
| c2b46ea5f2 | |||
| a5992750ed | |||
| 8b76b72222 | |||
| f12c0f8066 | |||
| 5f158f74e8 | |||
| ad6b7228cf | |||
| 9a0873cf67 | |||
| 503376edc2 | |||
| 7490617191 | |||
| 6cf461dbf7 | |||
| f33595c4c4 | |||
| f6f2db4b6f | |||
| 68252a4375 | |||
| c57a9f44a2 | |||
| 2fb90cb5d4 | |||
| 9925022660 | |||
| 5972b8b4bf | |||
| 13949e86c4 | |||
| f31507ae9f | |||
| 1207d53314 | |||
| f02b232589 | |||
| ab984d133a | |||
| 7440998d5f | |||
| 1e6351a11c | |||
| 78d9bde4c7 | |||
| dec546238e | |||
| 5715d36ad1 | |||
| 351e1d2eba | |||
| 0a067eb9dd | |||
| c62021ee64 | |||
| 7bab11d2a1 | |||
| 5bb2451750 | |||
| ef0341ad6d | |||
| a97a0d64a4 | |||
| 627190ddb7 | |||
| f1139add2a | |||
| ba59291932 | |||
| d3a8bafe8b | |||
| 4cfc98ec5a | |||
| 86b7924a55 | |||
| f645964bdf | |||
| e420b261bb | |||
| 1781f4c665 | |||
| ee79ed528b | |||
| d61abd1174 | |||
| fc9137a48d | |||
| a460ae0788 | |||
| 37a6dae3b5 | |||
| 4cbd4fe629 | |||
| 44df5dc061 | |||
| 9f144a638b | |||
| 18276c5941 | |||
| 385d197e31 | |||
| 2dceaeec3e | |||
| f59bc42539 | |||
| 5b7c98224c | |||
| 2542311341 | |||
| f4d001a821 | |||
| 2710c03112 | |||
| 3341d55f5a | |||
| bbca9c17e7 | |||
| d84cca5ab9 | |||
| 99d1185333 | |||
| 9f6611f877 | |||
| f81d315800 | |||
| 33f5badfd9 | |||
| 0407244cca | |||
| 64449ec38b | |||
| fb937e8ced | |||
| 96f9e8aceb | |||
| be294fbba5 | |||
| aabc676f94 | |||
| 24e6f93eae | |||
| 9a75e242e6 | |||
| 4c867390c2 | |||
| f9c6bb1e56 | |||
| 3a15f9af33 | |||
| 6920d682b2 | |||
| b0493502e4 | |||
| 723202d4ce | |||
| 33ed2796c8 | |||
| 6e0628b478 | |||
| 7f14555886 | |||
| c2477d2a3f | |||
| 8ff4945cfa | |||
| fcc65fdbfe | |||
| d4b0ecce98 | |||
| c4fb785e55 | |||
| 848ca0b5c6 | |||
| 8d5e6c8940 | |||
| 4f0c81420e | |||
| 0c437d32bd | |||
| 25d9771a3c | |||
| 668b54ac6d | |||
| 92b0f8fe73 | |||
| f258b71648 | |||
| f3679aa041 | |||
| 3b02c9df23 | |||
| 1034254613 | |||
| bc3e92c4a1 | |||
| c7dabaa37b | |||
| 69866eaf91 | |||
| f689dfce07 | |||
| 5a8f1d663d | |||
| 42d5d46e53 | |||
| cdccc35703 | |||
| d3e2fea019 | |||
| f343841233 | |||
| f62083eff2 | |||
| 8594e998c2 | |||
| 6865706b0f | |||
| bfb8b46ce8 | |||
| b6d8ca4d84 | |||
| 455e1f0432 | |||
| ba27c09096 | |||
| 15276cc4b3 | |||
| 130a7cdf2a | |||
| 164ec0c368 | |||
| 2be72776ce | |||
| d92f6ff164 | |||
| 756bc66f26 | |||
| e589bce5c6 | |||
| 991bd22511 | |||
| df1ab5221d | |||
| 9aaeee9b3d | |||
| 70916fd0f7 | |||
| 226d6c4f2c | |||
| 896adc9d36 | |||
| 0e33abebdd | |||
| b4e94eeabb | |||
| 6f86dd7eef | |||
| c8ed126605 | |||
| b510a329b6 | |||
| 04d001a055 | |||
| 2de1ba4e1d | |||
| e4a0f0e68b | |||
| f10b08e152 | |||
| c064f9d3a6 | |||
| 759401d9ae | |||
| e56209d15e | |||
| c466ff1f21 | |||
| e09cf299f0 | |||
| 25352ba609 | |||
| 3cd065cb6e | |||
| 5a483bb5db | |||
| 3b380c6fe3 | |||
| 919a98ffe6 | |||
| eff84218a8 | |||
| 7c9c363422 | |||
| add6448f44 | |||
| efccfaaa7f | |||
| a61057ae10 | |||
| 9472cafe48 | |||
| be83e1a2b4 | |||
| e48d7745b4 | |||
| 8b1a38214c | |||
| 2acde0af00 | |||
| daab20424e | |||
| 63f2adade2 | |||
| 201c1207f9 | |||
| 75d86b5a91 | |||
| f30d647936 | |||
| c7dd449899 | |||
| 56c8885030 | |||
| 0e9f7feff9 | |||
| 3697cd720e | |||
| 07a3c06804 | |||
| 2fce492689 | |||
| d87d12e1ec | |||
| a595730c50 | |||
| 7976355e34 | |||
| a9097793ac | |||
| 86e4ddd3f7 | |||
| b9abf2009d | |||
| a7dfd6c16c | |||
| 07dcb4aca2 | |||
| 48123ff991 | |||
| 8312d8e5fe | |||
| 98b4901d55 | |||
| a6a411f2e3 | |||
| 59976dcccd | |||
| e22a3ddcdb | |||
| ecfd133ce2 | |||
| d13ef56eb8 | |||
| 66f2d1df99 | |||
| 8555673d71 | |||
| cfe4c243e6 | |||
| c999ddf914 | |||
| f9004bf884 | |||
| 7794ef4acf | |||
| 1ef9c1fc23 | |||
| 1b1b753feb | |||
| 2561767b9a | |||
| 8bda0e178e | |||
| f634d60605 | |||
| 1dcc7654e8 | |||
| 3579b9d808 | |||
| c74663c082 | |||
| 848d352c60 | |||
| 5176766b29 | |||
| 0a90a7ddd9 | |||
| 27ca5073d7 | |||
| e3eb8178a3 | |||
| 10104812d6 | |||
| 12cb9a4883 | |||
| a30cc8c273 | |||
| 0f0620586b | |||
| b9e86dd67a | |||
| 9ce793d47e | |||
| 43cb18d6e0 | |||
| 1e87610899 | |||
| d04d486425 | |||
| 843aa4d1c8 | |||
| 1745ac91b7 | |||
| 20bc4a0dc8 | |||
| 1105f1b92a | |||
| 53f00f00d3 | |||
| b66827e216 | |||
| 485c34d402 | |||
| 330bcd72d7 | |||
| b04231772b | |||
| ec1bbdc7d5 | |||
| c685a02653 | |||
| 6594bf14df | |||
| 5a4f19dd8a | |||
| b54be8cb79 | |||
| 655380d547 | |||
| da3948228f | |||
| 5c03119c32 | |||
| 2a496b680b | |||
| db535cf281 | |||
| c199582efc | |||
| b53677a118 | |||
| 76ba3a5938 | |||
| db596a6c75 | |||
| 043f3c5d17 | |||
| 68006dda38 | |||
| b5cab193be | |||
| 6f2692296c | |||
| 0bb7a53046 | |||
| 25fe362912 | |||
| 6749d94c34 | |||
| 51f5ea1cd9 | |||
| 50a6d5e204 | |||
| 044e5646ec | |||
| 0ebf3d191d | |||
| bb81d91fd5 | |||
| 7442da80e0 | |||
| 96c28907ec | |||
| e9e7c2043e | |||
| eb5c55f046 | |||
| 8f2a1ecaa1 | |||
| 8dbe9c5772 | |||
| 6c911e09d3 | |||
| df557099ec | |||
| fedc91d37e | |||
| 27484a8306 | |||
| 42193d222a | |||
| 0a433566b1 | |||
| ff02ccd839 | |||
| d1cc0853d4 | |||
| 51eb814a42 | |||
| 6534c17cc0 | |||
| 749a76a09e | |||
| 0f59f79495 | |||
| af66a967b5 | |||
| 9a9095bcf0 | |||
| 225f2becf3 | |||
| a502fb64cb | |||
| 724fe8142c | |||
| dee5a0822d | |||
| e826346ca9 | |||
| 06b43cde77 | |||
| ae5edad87b | |||
| c8916f5f33 | |||
| 04cca95435 | |||
| 1bd3d8b044 | |||
| 4e79466cca | |||
| 88093d0a8e | |||
| 26adcc48f8 | |||
| e94e86d901 | |||
| 73355a4103 | |||
| 794377fdad | |||
| 1bff098369 | |||
| 45c7638dee | |||
| 4c57092300 | |||
| 1ddf9a667e | |||
| 84972e7ba7 | |||
| 03692ad753 | |||
| bb138fa25f | |||
| c5024e670a | |||
| fe5c92e988 | |||
| 9b31bf4164 | |||
| c670ab722f | |||
| fd4f3c25e7 | |||
| a14ea3708a | |||
| c003240f16 | |||
| 891e3d93fb | |||
| af5ec74b9e | |||
| d2c4483455 | |||
| 3a156aa8c1 | |||
| 60bd3ee9b2 | |||
| dacda1a858 | |||
| 265b5f6b57 | |||
| b4bd6f250b | |||
| 0f3ae5f085 | |||
| 3ab6cc202e | |||
| 7a154bc130 | |||
| 7cd6f2b0f4 | |||
| 8db2519f61 | |||
| 6b2902a73b | |||
| df7618bbda | |||
| 246983a097 | |||
| ca6146ad9a | |||
| c647320abc | |||
| afd738454e | |||
| 134cb327ec | |||
| f50ce741ae | |||
| 4547ba969e | |||
| 0a4af78ac8 | |||
| d38e1d1637 | |||
| 0d3456cf97 | |||
| f56529aa5b |
@ -61,7 +61,7 @@ android_build:
|
||||
script:
|
||||
- export GRADLE_USER_HOME=/home/gitlab-runner/ci-build-cache/$CI_PROJECT_PATH/.gradle
|
||||
- chmod +x ./gradlew
|
||||
- ./scripts/jenkins_build.sh -c
|
||||
- ./scripts/jenkins_build.sh $CI_COMMIT_REF_NAME $BEFORE_COMMIT_SHA $CI_COMMIT_SHA
|
||||
#设置打包后的产物,用于job之间共享
|
||||
artifacts:
|
||||
paths:
|
||||
@ -71,8 +71,7 @@ android_build:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.26.0
|
||||
- dev-5.27.0
|
||||
- dev-5.32.0
|
||||
|
||||
# 代码检查
|
||||
sonarqube_analysis:
|
||||
@ -103,8 +102,7 @@ sonarqube_analysis:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.26.0
|
||||
- dev-5.27.0
|
||||
- dev-5.32.0
|
||||
|
||||
## 发送简易检测结果报告
|
||||
send_sonar_report:
|
||||
@ -122,12 +120,11 @@ send_sonar_report:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.26.0
|
||||
- dev-5.27.0
|
||||
- dev-5.32.0
|
||||
|
||||
oss-upload&send-email:
|
||||
tags:
|
||||
- rancher-k8s
|
||||
- sysadm-devops
|
||||
stage: oss-upload&send-email
|
||||
image: hub.shanqu.cc/devops/android-apk-oss-upload:latest
|
||||
variables:
|
||||
@ -135,9 +132,9 @@ oss-upload&send-email:
|
||||
VAULT_ADDR: https://vault.shanqu.cc # 固定值
|
||||
VAULT_SECRET_PATH: prod/devops/android-apk-oss-upload # 固定值
|
||||
VAULT_ROLE: android-apk-oss-upload # 固定值
|
||||
ENDPOINT: "oss-cn-shenzhen-internal.aliyuncs.com" # 固定值
|
||||
BUCKET: "shanqu" # 固定值
|
||||
FILE_PATH: "app/build/tmp/" # APK 存放路径
|
||||
ENDPOINT: "tos-cn-guangzhou.ivolces.com" # 固定值
|
||||
BUCKET: "sysadm-public" # 固定值
|
||||
FILE_PATH: "app/build/tmp/" # APK 存放路径
|
||||
Email_To_List: $EMAIL_TO_LIST # 邮件接受人列表
|
||||
Email_Title: "光环助手 $CI_COMMIT_BRANCH" # 邮件标题
|
||||
PIPELINE_ID: $CI_PIPELINE_ID # 流水线id
|
||||
@ -152,8 +149,7 @@ oss-upload&send-email:
|
||||
### 开启上传 ###
|
||||
- /usr/local/bin/python /upload.py
|
||||
### 发送邮件
|
||||
- /usr/local/bin/python /ci-android-mail.py
|
||||
- /usr/local/bin/python /ci-android-mail-jira-comment.py
|
||||
only:
|
||||
- dev
|
||||
- dev-5.26.0
|
||||
- dev-5.27.0
|
||||
- dev-5.32.0
|
||||
20
README.md
20
README.md
@ -30,14 +30,7 @@
|
||||
|
||||
### git 版本管理
|
||||
|
||||
本项目使用简化版的 git flow 来管理分支,细节请看 [光环安卓简单 git 规范](https://git.ghzs.com/halo/android/assistant-android/-/wikis/%E5%85%89%E7%8E%AF%E5%AE%89%E5%8D%93%E7%AE%80%E5%8D%95-git-%E8%A7%84%E8%8C%83)
|
||||
|
||||
### API 环境配置
|
||||
|
||||
本项目使用 Build Variants 来切换 API 环境
|
||||
|
||||
* internal 为测试环境
|
||||
* publish 为正式环境
|
||||
本项目使用简化版的 git flow 来管理分支,细节请看 [光环安卓简单 git 规范](https://git.shanqu.cc/halo/android/assistant-android/-/wikis/%E5%85%89%E7%8E%AF%E5%AE%89%E5%8D%93%E7%AE%80%E5%8D%95-git-%E8%A7%84%E8%8C%83)
|
||||
|
||||
### 图片资源配置
|
||||
|
||||
@ -53,14 +46,3 @@
|
||||
|
||||
* 本项目使用了微信的 [AndResGuard](https://github.com/shwenzhang/AndResGuard) 作为资源混淆压缩方案,新增需要使用 `getIdentifier` 获取的资源文件时需要添加至白名单
|
||||
* 本项目默认使用 R8 作为混淆工具,往 proguard-rules.txt 添加 proguard 新配置项时请检查可用性(如语法等)
|
||||
|
||||
### APK打包配置
|
||||
|
||||
> 打内部测试包:`./scripts/test_build.sh`
|
||||
> 打邮件测试包:`./scripts/jenkins_build.sh`
|
||||
|
||||
### TODO
|
||||
|
||||
* 把原有 EventBus 的消息 Type 统一到一个文件内
|
||||
* 将实现细节从 View(Fragment、Activity) 剥离并以 MVVM 结构改造
|
||||
* 重构 MainActivity
|
||||
|
||||
@ -11,7 +11,11 @@ android {
|
||||
|
||||
String CONFIG_ID = ""
|
||||
String FIRST_LAUNCH = ""
|
||||
int ACTIVATE_REPORTING_RATIO = 0
|
||||
String SDK_VERSION = ""
|
||||
String SDK_APP_ID = ""
|
||||
String SDK_APP_NAME = ""
|
||||
boolean USE_DEFAULT_CHANNEL_SDK = true
|
||||
int ACTIVATE_REPORTING_RATIO = 100
|
||||
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
@ -71,9 +75,20 @@ android {
|
||||
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard-fresco.txt'
|
||||
|
||||
String CORE_EVENT_GAME_CATEGORY = ""
|
||||
|
||||
// 推广用的关键事件游戏类型
|
||||
buildConfigField "String", "CORE_EVENT_GAME_CATEGORY", "\"${CORE_EVENT_GAME_CATEGORY}\""
|
||||
|
||||
// 推广用的配置 id
|
||||
buildConfigField "String", "CONFIG_ID", "\"${CONFIG_ID}\""
|
||||
|
||||
// 推广用的 SDK 版本 (仅记录使用)
|
||||
buildConfigField "String", "SDK_VERSION", "\"${SDK_VERSION}\""
|
||||
buildConfigField "String", "SDK_APP_ID", "\"${SDK_APP_ID}\""
|
||||
buildConfigField "String", "SDK_APP_NAME", "\"${SDK_APP_NAME}\""
|
||||
buildConfigField "boolean", "USE_DEFAULT_CHANNEL_SDK", "${USE_DEFAULT_CHANNEL_SDK}"
|
||||
|
||||
// 首次启动的跳转配置
|
||||
buildConfigField "String", "FIRST_LAUNCH", "\"${FIRST_LAUNCH}\""
|
||||
|
||||
@ -173,6 +188,8 @@ android {
|
||||
buildConfigField "String", "DEV_VAPI_HOST", "\"${DEV_VAPI_HOST}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPID", "\"${DEV_QUICK_LOGIN_APPID}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${DEV_QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${DEV_CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
}
|
||||
|
||||
// publish, 发布时候使用的 flavor,接口仅包含正式环境
|
||||
@ -184,6 +201,8 @@ android {
|
||||
buildConfigField "String", "DEV_VAPI_HOST", "\"${VAPI_HOST}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPID", "\"${QUICK_LOGIN_APPID}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
}
|
||||
|
||||
tea {
|
||||
@ -194,6 +213,8 @@ android {
|
||||
buildConfigField "String", "DEV_VAPI_HOST", "\"${VAPI_HOST}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPID", "\"${QUICK_LOGIN_APPID}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
|
||||
manifestPlaceholders.put("APPLOG_SCHEME", "rangersapplog.byAx6uYt".toLowerCase())
|
||||
}
|
||||
@ -201,17 +222,13 @@ android {
|
||||
kuaishou {
|
||||
dimension "env"
|
||||
|
||||
String KUAI_SHOU_APP_ID = ""
|
||||
String KUAI_SHOU_APP_NAME = ""
|
||||
|
||||
buildConfigField "String", "DEV_API_HOST", "\"${API_HOST}\""
|
||||
buildConfigField "String", "NEW_DEV_API_HOST", "\"${NEW_API_HOST}\""
|
||||
buildConfigField "String", "DEV_VAPI_HOST", "\"${VAPI_HOST}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPID", "\"${QUICK_LOGIN_APPID}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
|
||||
buildConfigField "String", "KUAI_SHOU_APP_ID", "\"${KUAI_SHOU_APP_ID}\""
|
||||
buildConfigField "String", "KUAI_SHOU_APP_NAME", "\"${KUAI_SHOU_APP_NAME}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
}
|
||||
|
||||
gdt {
|
||||
@ -222,6 +239,8 @@ android {
|
||||
buildConfigField "String", "DEV_VAPI_HOST", "\"${VAPI_HOST}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPID", "\"${QUICK_LOGIN_APPID}\""
|
||||
buildConfigField "String", "QUICK_LOGIN_APPKEY", "\"${QUICK_LOGIN_APPKEY}\""
|
||||
buildConfigField "String", "DEV_CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
buildConfigField "String", "CSJ_APPID", "\"${CSJ_APPID}\""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -323,17 +342,29 @@ dependencies {
|
||||
implementation(project(':module_core_feature')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
implementation(project(':module_feedback')) {
|
||||
// implementation(project(':module_feedback')) {
|
||||
// exclude group: 'androidx.swiperefreshlayout'
|
||||
// }
|
||||
implementation(project(':feature:new_feedback',)) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
implementation(project(':module_sensors_data')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
implementation(project(':module_message')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
// implementation(project(':feature:vpn'))
|
||||
implementation(project(':feature:pkg'))
|
||||
implementation(project(':feature:oaid'))
|
||||
implementation(project(':feature:floating-window'))
|
||||
implementation(project(':feature:beizi_startup_ad'))
|
||||
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'
|
||||
}
|
||||
internalImplementation(project(':module_internal_test'))
|
||||
}
|
||||
|
||||
File propFile = file('sign.properties')
|
||||
|
||||
@ -20,12 +20,13 @@
|
||||
-keep class com.gh.gamecenter.db.info.* {*;}
|
||||
-keep class com.gh.gamecenter.entity.** {<fields>;}
|
||||
-keep class com.gh.gamecenter.qa.entity.** {<fields>;}
|
||||
-keep class com.gh.download.DownloadDataSimpleEntity {<fields>;}
|
||||
-keep class com.gh.gamecenter.floatingwindow.FloatingWindowEntity {<fields>;}
|
||||
-keep class com.gh.gamecenter.BR
|
||||
-keep class com.gh.gamecenter.retrofit.* {*;}
|
||||
-keep class com.gh.gamecenter.eventbus.* {*;}
|
||||
-keep class com.gh.gamecenter.home.gamecollection.GameCollectionStackLayout {*;}
|
||||
-keep class com.gh.gamecenter.home.gamecollection.GameCollectionStackAnimation {*;}
|
||||
-keep class com.gh.gamecenter.home.gamecollection.carousel.GameCollectionStackLayout {*;}
|
||||
-keep class com.gh.gamecenter.home.gamecollection.carousel.GameCollectionStackAnimation {*;}
|
||||
|
||||
# Prevent R8 from leaving Data object members always null
|
||||
-keepclassmembers,allowobfuscation class * {
|
||||
@ -91,3 +92,7 @@
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
-keepclassmembernames class com.contrarywind.view.WheelView {
|
||||
private int itemsVisible;
|
||||
}
|
||||
|
||||
|
||||
@ -33,4 +33,8 @@ class FlavorProviderImp : IFlavorProvider {
|
||||
override fun logEvent(content: String) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun logCoreEvent() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@ -42,6 +42,10 @@ class FlavorProviderImp : IFlavorProvider {
|
||||
GdtHelper.logAction(content)
|
||||
}
|
||||
|
||||
override fun logCoreEvent() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val GDT_DEFAULT_CHANNEL = "GDT_GHZS_01"
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
app/src/gdt/libs/GDTActionSDK.min.1.8.7.aar
Normal file
BIN
app/src/gdt/libs/GDTActionSDK.min.1.8.7.aar
Normal file
Binary file not shown.
32
app/src/internal/java/com/gh/vspace/ExternalGameUsage.kt
Normal file
32
app/src/internal/java/com/gh/vspace/ExternalGameUsage.kt
Normal file
@ -0,0 +1,32 @@
|
||||
package com.gh.vspace
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.Keep
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.databinding.LayoutPersonalOtherItemBinding
|
||||
import com.gh.vspace.installexternalgames.InstallExternalGameActivity
|
||||
|
||||
@Keep
|
||||
class ExternalGameUsage : IExternalGamesUsage {
|
||||
override fun addInstallExternalGameButton(viewParent: ViewGroup) {
|
||||
val context = viewParent.context
|
||||
viewParent.findViewById<View>(R.id.install_game_from_external) ?: run {
|
||||
val binding = LayoutPersonalOtherItemBinding.inflate(LayoutInflater.from(context)).apply {
|
||||
root.id = R.id.install_game_from_external
|
||||
titleTv.text = context.getString(R.string.title_install_external_game)
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.gh.vspace.installexternalgames;
|
||||
|
||||
public class Constants {
|
||||
public static final String TAG = "从SD卡安装";
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.gh.vspace.installexternalgames
|
||||
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
|
||||
class ExternalGameAdapter(private val games: List<ExternalGameUiState>, private val onItemClickListener: OnItemClickListener) :
|
||||
RecyclerView.Adapter<ExternalGameViewHolder>() {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ExternalGameViewHolder {
|
||||
return ExternalGameViewHolder(parent.toBinding())
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return games.size
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ExternalGameViewHolder, position: Int) {
|
||||
val item = games[position]
|
||||
holder.apkInfo.text = item.externalGameEntity.let { item ->
|
||||
"""
|
||||
应用程序名:${item.appName}
|
||||
版本号:${item.apkVersion}
|
||||
包名: ${item.apkPackageName}
|
||||
路径:${item.apkPath}
|
||||
""".trimIndent()
|
||||
}
|
||||
holder.install.goneIf(item.isInstalled) {
|
||||
holder.install.setOnClickListener {
|
||||
onItemClickListener.onItemClick(item, OnItemClickListener.ClickType.CLICK_INSTALL)
|
||||
}
|
||||
}
|
||||
holder.uninstall.goneIf(!item.isInstalled) {
|
||||
holder.uninstall.setOnClickListener {
|
||||
onItemClickListener.onItemClick(
|
||||
item,
|
||||
OnItemClickListener.ClickType.CLICK_UNINSTALL
|
||||
)
|
||||
}
|
||||
}
|
||||
holder.start.goneIf(!item.isInstalled) {
|
||||
holder.start.setOnClickListener {
|
||||
onItemClickListener.onItemClick(item, OnItemClickListener.ClickType.CLICK_START)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.gh.vspace.installexternalgames
|
||||
|
||||
data class ExternalGameEntity(
|
||||
val cpuAbi: Set<String>,
|
||||
val apkPath: String,
|
||||
val apkFileName: String,
|
||||
val appName: String,
|
||||
val apkVersion: String,
|
||||
val apkPackageName: String,
|
||||
val lastModified: Long,
|
||||
)
|
||||
@ -0,0 +1,6 @@
|
||||
package com.gh.vspace.installexternalgames
|
||||
|
||||
data class ExternalGameUiState(
|
||||
val externalGameEntity: ExternalGameEntity,
|
||||
val isInstalled: Boolean
|
||||
)
|
||||
@ -0,0 +1,11 @@
|
||||
package com.gh.vspace.installexternalgames
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.databinding.LayoutExternalGameItemBinding
|
||||
|
||||
class ExternalGameViewHolder(binding: LayoutExternalGameItemBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
val apkInfo = binding.apkFileInfo
|
||||
val install = binding.btnInstall
|
||||
val uninstall = binding.btnUninstall
|
||||
val start = binding.btnStart
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.gh.vspace.installexternalgames
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
|
||||
class InstallExternalGameActivity : ToolBarActivity() {
|
||||
companion object {
|
||||
fun getIntent(context: Context): Intent {
|
||||
return getTargetIntent(context, InstallExternalGameActivity::class.java, InstallExternalGameFragment::class.java, Bundle())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,153 @@
|
||||
package com.gh.vspace.installexternalgames
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.common.utils.viewModelProvider
|
||||
import com.gh.gamecenter.common.view.divider.HorizontalDividerItemDecoration
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.databinding.FragmentInstallExternalGamesBinding
|
||||
import com.gh.vspace.VHelper
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lg.vspace.VirtualAppManager
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
class InstallExternalGameFragment : ToolbarFragment(), OnItemClickListener {
|
||||
|
||||
private val mViewModel: InstallExternalGameViewModel by lazy { viewModelProvider() }
|
||||
|
||||
private lateinit var mBinding: FragmentInstallExternalGamesBinding
|
||||
|
||||
private val games = mutableListOf<ExternalGameUiState>()
|
||||
private var adapter = ExternalGameAdapter(games, this)
|
||||
|
||||
private var uninstallDisposable: Disposable? = null
|
||||
|
||||
override fun getLayoutId() = 0
|
||||
|
||||
override fun getInflatedLayout() =
|
||||
FragmentInstallExternalGamesBinding.inflate(layoutInflater).apply { mBinding = this }.root
|
||||
|
||||
private lateinit var dialog: Dialog
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setNavigationTitle(getString(com.gh.gamecenter.R.string.title_install_external_game))
|
||||
initView()
|
||||
mViewModel.gamesList.observe(this) {
|
||||
if (dialog.isShowing) {
|
||||
dialog.dismiss()
|
||||
}
|
||||
games.clear()
|
||||
games.addAll(
|
||||
it.map {
|
||||
ExternalGameUiState(it, VHelper.isInstalled(it.apkPackageName))
|
||||
}
|
||||
)
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
mViewModel.scanPaths()
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
dialog = DialogUtils.showWaitDialog(requireContext(), "")
|
||||
mBinding.externalGamesList.let {
|
||||
it.adapter = adapter
|
||||
it.layoutManager = LinearLayoutManager(requireContext())
|
||||
val itemDecoration = HorizontalDividerItemDecoration.Builder(requireContext())
|
||||
.size(2F.dip2px())
|
||||
.color(R.color.divider.toColor(requireContext()))
|
||||
.build()
|
||||
if (it.itemDecorationCount != 0) {
|
||||
it.removeItemDecorationAt(0)
|
||||
}
|
||||
it.addItemDecoration(itemDecoration)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (dialog.isShowing) {
|
||||
dialog.dismiss()
|
||||
}
|
||||
if (uninstallDisposable?.isDisposed != true) {
|
||||
uninstallDisposable?.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onItemClick(externalGameUiState: ExternalGameUiState, clickType: OnItemClickListener.ClickType) {
|
||||
when (clickType) {
|
||||
OnItemClickListener.ClickType.CLICK_INSTALL -> {
|
||||
install(externalGameUiState)
|
||||
}
|
||||
OnItemClickListener.ClickType.CLICK_UNINSTALL -> {
|
||||
uninstall(externalGameUiState)
|
||||
}
|
||||
OnItemClickListener.ClickType.CLICK_START -> {
|
||||
start(externalGameUiState)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun install(externalGameUiState: ExternalGameUiState) {
|
||||
val bit =
|
||||
externalGameUiState.externalGameEntity.cpuAbi.let { if (it.size == 1 && it.contains("armeabi-v7a")) "32" else "64" }
|
||||
if (VHelper.showDialogIfVSpaceIsNeeded(
|
||||
requireContext(),
|
||||
"",
|
||||
externalGameUiState.externalGameEntity.appName,
|
||||
"",
|
||||
bit = bit
|
||||
)
|
||||
) return
|
||||
dialog.show()
|
||||
externalGameUiState.externalGameEntity.let {
|
||||
val intent = VirtualAppManager.getInstallIntent(context, it.apkPath, it.apkPackageName)
|
||||
requireActivity().startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
private fun uninstall(externalGameUiState: ExternalGameUiState) {
|
||||
dialog.show()
|
||||
uninstallDisposable = Single.create<Void> {
|
||||
VHelper.uninstall(externalGameUiState.externalGameEntity.apkPackageName)
|
||||
}.subscribeOn(Schedulers.from(AppExecutor.lightWeightIoExecutor)).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { t1, t2 ->
|
||||
if (dialog.isShowing) {
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun start(externalGameUiState: ExternalGameUiState) {
|
||||
val intent = VirtualAppManager.get().getStartGameIntent(
|
||||
externalGameUiState.externalGameEntity.apkPackageName,
|
||||
"",
|
||||
externalGameUiState.externalGameEntity.appName,
|
||||
"",
|
||||
MetaUtil.getBase64EncodedAndroidId(),
|
||||
HaloApp.getInstance().gid,
|
||||
com.gh.gamecenter.BuildConfig.VERSION_NAME,
|
||||
HaloApp.getInstance().channel,
|
||||
"",
|
||||
""
|
||||
)
|
||||
requireActivity().startActivity(intent)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.gh.vspace.installexternalgames
|
||||
|
||||
import android.app.Application
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Environment
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.vspace.VHelper
|
||||
import com.lg.vspace.helper.compat.NativeLibraryHelperCompat
|
||||
import com.lightgame.utils.Utils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
class InstallExternalGameViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private val _gamesList = MutableLiveData<List<ExternalGameEntity>>(listOf())
|
||||
val gamesList: LiveData<List<ExternalGameEntity>> = _gamesList
|
||||
private val pkgManger = getApplication<Application>().packageManager
|
||||
private var disposable: Disposable = VHelper.callSite.observeOn(AndroidSchedulers.mainThread()).subscribe {
|
||||
scanPaths()
|
||||
}
|
||||
|
||||
fun scanPaths() {
|
||||
runOnIoThread {
|
||||
_gamesList.postValue(Environment.getExternalStorageDirectory().walk().maxDepth(1)
|
||||
.filter { it.isHidden.not() }
|
||||
.filter { it.isFile }
|
||||
.onEach {
|
||||
Utils.log(Constants.TAG, "获得文件: ${it.name}")
|
||||
}
|
||||
.filter { it.extension == "apk" }
|
||||
.map {
|
||||
val packageInfo = pkgManger.getPackageArchiveInfo(
|
||||
it.absolutePath,
|
||||
PackageManager.GET_META_DATA or PackageManager.GET_ACTIVITIES
|
||||
)
|
||||
packageInfo?.let { packageInfo ->
|
||||
val applicationInfo = packageInfo.applicationInfo
|
||||
applicationInfo.publicSourceDir = it.absolutePath
|
||||
applicationInfo.sourceDir = it.absolutePath
|
||||
ExternalGameEntity(
|
||||
cpuAbi = NativeLibraryHelperCompat.getPackageAbiList(it.absolutePath),
|
||||
apkPath = it.absolutePath,
|
||||
apkFileName = it.name,
|
||||
apkPackageName = packageInfo.packageName,
|
||||
apkVersion = packageInfo.versionName,
|
||||
appName = pkgManger.getApplicationLabel(applicationInfo).toString(),
|
||||
lastModified = it.lastModified()
|
||||
)
|
||||
}
|
||||
}.filterNotNull()
|
||||
.toList().sortedByDescending { it.lastModified }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
disposable.dispose()
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.gh.vspace.installexternalgames
|
||||
|
||||
interface OnItemClickListener {
|
||||
|
||||
enum class ClickType {
|
||||
CLICK_INSTALL, CLICK_UNINSTALL, CLICK_START
|
||||
}
|
||||
|
||||
fun onItemClick(externalGameUiState: ExternalGameUiState, clickType: ClickType)
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/external_games_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
43
app/src/internal/res/layout/layout_external_game_item.xml
Normal file
43
app/src/internal/res/layout/layout_external_game_item.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/apk_file_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
tools:text="文件名:\n路径:" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_install"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/text_install"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_uninstall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/text_uninstall"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/text_start"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
4
app/src/internal/res/values/ids.xml
Normal file
4
app/src/internal/res/values/ids.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="install_game_from_external" type="id" />
|
||||
</resources>
|
||||
7
app/src/internal/res/values/strings.xml
Normal file
7
app/src/internal/res/values/strings.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="title_install_external_game">从SD卡安装</string>
|
||||
<string name="text_install">安装</string>
|
||||
<string name="text_uninstall">卸载</string>
|
||||
<string name="text_start">启动</string>
|
||||
</resources>
|
||||
@ -5,8 +5,8 @@ import com.kwai.monitor.log.TurboAgent
|
||||
import com.kwai.monitor.log.TurboConfig
|
||||
|
||||
object KuaishouHelper {
|
||||
private val mAppId by lazy { BuildConfig.KUAI_SHOU_APP_ID.ifEmpty { "81537" } }
|
||||
private val mAppName by lazy { BuildConfig.KUAI_SHOU_APP_NAME.ifEmpty { "guanghuanzhushou_1" } }
|
||||
private val mAppId by lazy { BuildConfig.SDK_APP_ID.ifEmpty { "81537" } }
|
||||
private val mAppName by lazy { BuildConfig.SDK_APP_NAME.ifEmpty { "guanghuanzhushou_1" } }
|
||||
|
||||
@JvmStatic
|
||||
fun init(context: Context, channel: String) {
|
||||
|
||||
@ -3,12 +3,16 @@ package com.gh.gamecenter.provider
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.text.TextUtils
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.KuaishouHelper
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.provider.IFlavorProvider
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.TimeUtils
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.kwai.monitor.payload.TurboHelper
|
||||
import com.leon.channel.helper.ChannelReaderUtil
|
||||
|
||||
class FlavorProviderImp : IFlavorProvider {
|
||||
|
||||
@ -31,7 +35,11 @@ class FlavorProviderImp : IFlavorProvider {
|
||||
}
|
||||
|
||||
override fun getChannelStr(application: Application): String {
|
||||
var channel = TurboHelper.getChannel(application)
|
||||
var channel = if (BuildConfig.USE_DEFAULT_CHANNEL_SDK) {
|
||||
ChannelReaderUtil.getChannel(application)
|
||||
} else {
|
||||
TurboHelper.getChannel(application)
|
||||
}
|
||||
if (channel == null || TextUtils.isEmpty(channel.trim())) {
|
||||
channel = KUAISHOU_CHANNEL
|
||||
}
|
||||
@ -42,6 +50,15 @@ class FlavorProviderImp : IFlavorProvider {
|
||||
KuaishouHelper.onEvent(content)
|
||||
}
|
||||
|
||||
override fun logCoreEvent() {
|
||||
logEvent("EVENT_KEY_PATH_OPTIMIZATION")
|
||||
if (BuildConfig.ACTIVATE_REPORTING_RATIO == 1) {
|
||||
AppExecutor.uiExecutor.executeWithDelay({
|
||||
ToastUtils.toast("关键行为 EVENT_KEY_PATH_OPTIMIZATION")
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val KUAISHOU_CHANNEL = "KS-GHZS-01"
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
app/src/kuaishou/libs/channelsdk-0.2.2.aar
Normal file
BIN
app/src/kuaishou/libs/channelsdk-0.2.2.aar
Normal file
Binary file not shown.
@ -77,7 +77,14 @@
|
||||
androidx.compose.animation.core,
|
||||
androidx.constraintlayout.compose,
|
||||
androidx.compose.ui.test.manifest,
|
||||
androidx.compose.ui.tooling.preview" />
|
||||
com.bytedance.sdk.openadsdk,
|
||||
com.bykv.vk.openvk,
|
||||
com.bytedance.tools,
|
||||
androidx.compose.ui.tooling.preview,
|
||||
com.tencent.qqmini,
|
||||
com.tencent.qqmini.minigame.external,
|
||||
com.tencent.qqmini.minigame.opensdk,
|
||||
com.tencent.qqmini.union.ad" />
|
||||
|
||||
<!-- 去掉 SDK 一些流氓权限 -->
|
||||
<uses-permission
|
||||
@ -106,8 +113,8 @@
|
||||
android:icon="@mipmap/logo"
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:resizeableActivity="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:resizeableActivity="true"
|
||||
android:theme="@style/AppCompatTheme.APP"
|
||||
tools:replace="android:name,android:allowBackup"
|
||||
tools:targetApi="n">
|
||||
@ -270,7 +277,7 @@
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.VoteActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.WeiBoShareActivity"
|
||||
@ -297,10 +304,6 @@
|
||||
android:name="com.gh.gamecenter.CollectionActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.UserInfoEditActivity"
|
||||
android:screenOrientation="portrait"
|
||||
@ -314,26 +317,10 @@
|
||||
android:name="com.gh.gamecenter.qa.answer.edit.AnswerEditActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.ConcernInfoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.InfoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageKeFuActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageInviteActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.MessageVoteActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".qa.questions.invite.QuestionsInviteActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@ -489,6 +476,14 @@
|
||||
android:name="com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".gamedetail.fuli.kaifu.ServersCalendarManagementActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".gamedetail.fuli.kaifu.ServersSubscribedGameListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".qa.answer.draft.AnswerDraftActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@ -756,6 +751,26 @@
|
||||
android:name=".servers.gametest2.GameServerTestV2Activity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.gamecollection.hotlist.GameCollectionHotListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.qgame.QGameHomeWrapperActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.qgame.QGameSearchActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.gamecollection.hotlist.GameCollectionListDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.UserAuthActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
|
||||
<!-- <activity-->
|
||||
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
|
||||
@ -826,6 +841,11 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name="com.gh.common.xapk.XapkInstallReceiver"
|
||||
android:theme="@style/Theme.Transparent"
|
||||
android:exported="false" />
|
||||
|
||||
<receiver
|
||||
android:name="com.gh.gamecenter.receiver.ActivitySkipReceiver"
|
||||
android:exported="true">
|
||||
@ -834,39 +854,6 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- 梦工厂配置 开始 -->
|
||||
<!--<meta-data
|
||||
android:name="MGC_APPID"
|
||||
android:value="1001276" />
|
||||
|
||||
<provider
|
||||
android:name="com.leto.game.base.provider.LetoFileProvider"
|
||||
android:authorities="${applicationId}.leto.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/leto_file_path"
|
||||
tools:replace="android:resource" />
|
||||
</provider>-->
|
||||
<!-- 梦工厂配置 结束 -->
|
||||
|
||||
<!-- 穿山甲配置 开始 -->
|
||||
<!--<provider
|
||||
android:name="com.bytedance.sdk.openadsdk.TTFileProvider"
|
||||
android:authorities="${applicationId}.TTFileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<provider
|
||||
android:name="com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"
|
||||
android:authorities="${applicationId}.TTMultiProvider"
|
||||
android:exported="false" />-->
|
||||
<!-- 穿山甲配置 结束 -->
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
1
app/src/main/assets/lottie/icon_fab_change.json
Normal file
1
app/src/main/assets/lottie/icon_fab_change.json
Normal file
@ -0,0 +1 @@
|
||||
{"v":"5.9.1","fr":60,"ip":0,"op":60,"w":144,"h":144,"nm":"icon_change","ddd":0,"assets":[{"id":"comp_0","nm":"icon_change_detail","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"stroke1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[37.04,52.994,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.533,-0.143],[0.143,-0.533],[1.487,-1.304],[1.961,-0.258],[1.774,0.875],[0.709,0.661],[0,0],[0,0.445],[0,0],[-0.276,0],[0,0],[-0.013,0],[0,0],[0.315,-0.315],[0,0],[-0.682,-0.336],[-1.569,0.207],[-1.19,1.043],[-0.41,1.528]],"o":[[0.533,0.143],[-0.512,1.91],[-1.487,1.304],[-1.961,0.258],[-0.879,-0.433],[0,0],[-0.315,0.315],[0,0],[0,-0.276],[0,0],[0.013,0],[0,0],[0.445,0],[0,0],[0.555,0.508],[1.419,0.7],[1.569,-0.207],[1.19,-1.043],[0.143,-0.533]],"v":[[8.605,-4.301],[9.312,-3.076],[6.247,1.854],[0.958,4.25],[-4.77,3.304],[-7.163,1.652],[-8.493,2.982],[-9.347,2.628],[-9.347,-1.665],[-8.847,-2.165],[-8.161,-2.165],[-8.122,-2.165],[-4.554,-2.165],[-4.2,-1.311],[-5.748,0.237],[-3.885,1.51],[0.697,2.267],[4.928,0.35],[7.381,-3.594]],"c":true},"ix":2},"nm":"stroke1","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,1,1,1,0.5,1,1,1,1,1,1,1,0,1,0.5,0.8,1,0.6],"ix":9}},"s":{"a":0,"k":[-5.347,-4.665],"ix":5},"e":{"a":0,"k":[8.653,-4.665],"ix":6},"t":1,"nm":"color1","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":"stroke1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"stroke2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[34.96,19.006,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.961,0.258],[-1.774,-0.875],[-0.709,-0.661],[0,0],[0,-0.445],[0,0],[0.276,0],[0,0],[0.012,0],[0,0],[-0.315,0.315],[0,0],[0.682,0.336],[1.569,-0.207],[1.19,-1.043],[0.41,-1.528],[0.533,0.143],[-0.143,0.533],[-1.487,1.304]],"o":[[1.961,-0.258],[0.879,0.433],[0,0],[0.315,-0.315],[0,0],[0,0.276],[0,0],[-0.012,0],[0,0],[-0.445,0],[0,0],[-0.555,-0.508],[-1.419,-0.7],[-1.569,0.207],[-1.19,1.043],[-0.143,0.533],[-0.533,-0.143],[0.512,-1.91],[1.487,-1.304]],"v":[[-0.958,-4.25],[4.77,-3.304],[7.163,-1.652],[8.493,-2.982],[9.347,-2.628],[9.347,1.665],[8.847,2.165],[8.16,2.165],[8.123,2.165],[4.554,2.165],[4.2,1.311],[5.748,-0.237],[3.885,-1.51],[-0.697,-2.267],[-4.928,-0.35],[-7.381,3.594],[-8.605,4.301],[-9.312,3.076],[-6.247,-1.854]],"c":true},"ix":2},"nm":"stroke2","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,1,1,1,0.5,1,1,1,1,1,1,1,0,1,0.5,0.8,1,0.6],"ix":9}},"s":{"a":0,"k":[5.347,4.665],"ix":5},"e":{"a":0,"k":[-8.653,4.665],"ix":6},"t":1,"nm":"color2","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":"stroke2","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"icon_change_detail","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[0]},{"t":36,"s":[360]}],"ix":10},"p":{"a":0,"k":[72,72,0],"ix":2,"l":2},"a":{"a":0,"k":[36,36,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":72,"h":72,"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}
|
||||
1
app/src/main/assets/lottie/icon_title_change_dark.json
Normal file
1
app/src/main/assets/lottie/icon_title_change_dark.json
Normal file
@ -0,0 +1 @@
|
||||
{"v":"5.9.1","fr":60,"ip":0,"op":60,"w":72,"h":72,"nm":"icon_title_change","ddd":0,"assets":[{"id":"comp_0","nm":"arrow","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"arrow_e_dark","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[29.25,30,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.701,0.456],[-1.627,-0.674],[-0.705,-0.667],[0,0],[-0.552,0],[0,-0.552],[0,0],[0.552,0],[0,0],[0.012,0],[0,0],[0,0.552],[-0.552,0],[0,0],[0.615,0.255],[1.276,-0.342],[0.804,-1.048],[0,-1.321],[-0.804,-1.048],[-1.276,-0.342],[-1.22,0.505],[-0.66,1.144],[-0.478,-0.276],[0.276,-0.478],[1.627,-0.674],[1.701,0.456],[1.072,1.397],[0,1.761],[-1.072,1.397]],"o":[[1.701,-0.456],[0.909,0.376],[0,0],[0,-0.552],[0.552,0],[0,0],[0,0.552],[0,0],[-0.012,0],[0,0],[-0.552,0],[0,-0.552],[0,0],[-0.493,-0.435],[-1.22,-0.505],[-1.276,0.342],[-0.804,1.048],[0,1.321],[0.804,1.048],[1.276,0.342],[1.22,-0.505],[0.276,-0.478],[0.478,0.276],[-0.881,1.525],[-1.627,0.674],[-1.701,-0.456],[-1.072,-1.397],[0,-1.761],[1.072,-1.397]],"v":[[-1.821,-7.727],[3.311,-7.391],[5.75,-5.809],[5.75,-6.5],[6.75,-7.5],[7.75,-6.5],[7.75,-3.5],[6.75,-2.5],[6.331,-2.5],[6.295,-2.5],[3.75,-2.5],[2.75,-3.5],[3.75,-4.5],[4.219,-4.5],[2.546,-5.543],[-1.303,-5.796],[-4.51,-3.653],[-5.75,0],[-4.51,3.653],[-1.303,5.796],[2.546,5.543],[5.446,3],[6.812,2.634],[7.178,4],[3.311,7.391],[-1.821,7.727],[-6.097,4.87],[-7.75,0],[-6.097,-4.87]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.158117651939,0.532358944416,0.878431379795,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":"arrow_e_dark","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"arrow","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[0]},{"t":36,"s":[360]}],"ix":10},"p":{"a":0,"k":[36,36,0],"ix":2,"l":2},"a":{"a":0,"k":[30,30,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":60,"h":60,"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}
|
||||
1
app/src/main/assets/lottie/icon_title_change_light.json
Normal file
1
app/src/main/assets/lottie/icon_title_change_light.json
Normal file
@ -0,0 +1 @@
|
||||
{"v":"5.9.1","fr":60,"ip":0,"op":60,"w":72,"h":72,"nm":"icon_title_change","ddd":0,"assets":[{"id":"comp_0","nm":"arrow","fr":60,"layers":[{"ddd":0,"ind":2,"ty":4,"nm":"arrow_e_light","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[29.25,30,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-1.701,0.456],[-1.627,-0.674],[-0.705,-0.667],[0,0],[-0.552,0],[0,-0.552],[0,0],[0.552,0],[0,0],[0.012,0],[0,0],[0,0.552],[-0.552,0],[0,0],[0.615,0.255],[1.276,-0.342],[0.804,-1.048],[0,-1.321],[-0.804,-1.048],[-1.276,-0.342],[-1.22,0.505],[-0.66,1.144],[-0.478,-0.276],[0.276,-0.478],[1.627,-0.674],[1.701,0.456],[1.072,1.397],[0,1.761],[-1.072,1.397]],"o":[[1.701,-0.456],[0.909,0.376],[0,0],[0,-0.552],[0.552,0],[0,0],[0,0.552],[0,0],[-0.012,0],[0,0],[-0.552,0],[0,-0.552],[0,0],[-0.493,-0.435],[-1.22,-0.505],[-1.276,0.342],[-0.804,1.048],[0,1.321],[0.804,1.048],[1.276,0.342],[1.22,-0.505],[0.276,-0.478],[0.478,0.276],[-0.881,1.525],[-1.627,0.674],[-1.701,-0.456],[-1.072,-1.397],[0,-1.761],[1.072,-1.397]],"v":[[-1.821,-7.727],[3.311,-7.391],[5.75,-5.809],[5.75,-6.5],[6.75,-7.5],[7.75,-6.5],[7.75,-3.5],[6.75,-2.5],[6.331,-2.5],[6.295,-2.5],[3.75,-2.5],[2.75,-3.5],[3.75,-4.5],[4.219,-4.5],[2.546,-5.543],[-1.303,-5.796],[-4.51,-3.653],[-5.75,0],[-4.51,3.653],[-1.303,5.796],[2.546,5.543],[5.446,3],[6.812,2.634],[7.178,4],[3.311,7.391],[-1.821,7.727],[-6.097,4.87],[-7.75,0],[-6.097,-4.87]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.141176477075,0.588235318661,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":"arrow_e_light","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"arrow","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.5],"y":[0]},"t":0,"s":[0]},{"t":36,"s":[360]}],"ix":10},"p":{"a":0,"k":[36,36,0],"ix":2,"l":2},"a":{"a":0,"k":[30,30,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":60,"h":60,"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}
|
||||
1
app/src/main/assets/lottie/video.json
Normal file
1
app/src/main/assets/lottie/video.json
Normal file
File diff suppressed because one or more lines are too long
@ -205,14 +205,17 @@ RE.setOutdent = function() {
|
||||
|
||||
RE.setJustifyLeft = function() {
|
||||
document.execCommand('justifyLeft', false, null);
|
||||
RE.enabledEditingItems()
|
||||
}
|
||||
|
||||
RE.setJustifyCenter = function() {
|
||||
document.execCommand('justifyCenter', false, null);
|
||||
RE.enabledEditingItems()
|
||||
}
|
||||
|
||||
RE.setJustifyRight = function() {
|
||||
document.execCommand('justifyRight', false, null);
|
||||
RE.enabledEditingItems()
|
||||
}
|
||||
|
||||
RE.setBlockquote = function() {
|
||||
@ -227,6 +230,16 @@ RE.insertImage = function(url) {
|
||||
RE.insertHTML(html);
|
||||
}
|
||||
|
||||
// 设置分割线
|
||||
RE.insertHorizontalRule = function() {
|
||||
document.execCommand('insertHorizontalRule', false, null);
|
||||
}
|
||||
|
||||
// 设置编辑器默认换行符
|
||||
RE.setDefaultParagraphSeparator = function(separator) {
|
||||
document.execCommand('defaultParagraphSeparator', false, separator);
|
||||
}
|
||||
|
||||
// 替换成缩略图
|
||||
RE.replaceTbImage = function(imgRuleFlag, gifRuleFlag) {
|
||||
var imgs = document.getElementsByTagName("img");
|
||||
@ -574,6 +587,10 @@ document.addEventListener("selectionchange", function(e) {
|
||||
RE.sendElementNameToNative()
|
||||
});
|
||||
|
||||
document.addEventListener("selectionchange", function(e) {
|
||||
RE.enabledEditingItems(e)
|
||||
});
|
||||
|
||||
RE.recursion = function(dom) {
|
||||
var parenDom = dom.parentElement
|
||||
if (parenDom && parenDom instanceof Element &&
|
||||
@ -616,7 +633,6 @@ RE.sendElementNameToNative = function() {
|
||||
// android function to open link
|
||||
function customLinkgo(self) {
|
||||
var datas = self.dataset.datas
|
||||
// console.log(datas)
|
||||
window.OnLinkClickListener.onClick(datas)
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,6 @@ body {
|
||||
}
|
||||
|
||||
#editor {
|
||||
display: table-cell;
|
||||
outline: 0px solid transparent;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
|
||||
455
app/src/main/java/com/gh/ad/AdDelegateHelper.kt
Normal file
455
app/src/main/java/com/gh/ad/AdDelegateHelper.kt
Normal file
@ -0,0 +1,455 @@
|
||||
package com.gh.ad
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.util.DirectUtils.directToLinkPage
|
||||
import com.gh.common.util.LogUtils
|
||||
import com.gh.common.util.NewFlatLogUtils.logOpenScreenAdSkip
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.MainActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.provider.IBeiziAdProvider
|
||||
import com.gh.gamecenter.core.provider.ICsjAdProvider
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.TimeUtils.getToday
|
||||
import com.gh.gamecenter.entity.AdConfig
|
||||
import com.gh.gamecenter.entity.StartupAdEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
/**
|
||||
* 广告实现代理类
|
||||
*
|
||||
* 由它来分发功能实现到具体的实现
|
||||
*
|
||||
* 以最复杂的开屏广告为例,有三种实现(1. 自有的广告实现 2. 穿山甲的开屏广告实现 3. Beizi 的开屏广告实现)
|
||||
*
|
||||
* 由于两个广告 SDK 有可能在一次启动中都被使用,所以会根据获取到的广告配置 config 来决定是否需要出是很好两个 SDK
|
||||
*/
|
||||
object AdDelegateHelper {
|
||||
|
||||
private var mCsjAdImpl: ICsjAdProvider? = null
|
||||
private var mBeiziAdImpl: IBeiziAdProvider? = null
|
||||
|
||||
private var mAdConfigList: ArrayList<AdConfig>? = null
|
||||
|
||||
private var mSplashAd: AdConfig? = null
|
||||
private var mDownloadManagerAd: AdConfig? = null
|
||||
private val mGameSearchAdList: ArrayList<AdConfig> by lazy { arrayListOf() }
|
||||
private var mVGameLaunchAd: AdConfig? = null
|
||||
|
||||
val vGameLaunchAd: AdConfig?
|
||||
get() = mVGameLaunchAd
|
||||
|
||||
private const val AD_SDK_CSJ = "穿山甲"
|
||||
private const val AD_SDK_BEIZI = "倍孜"
|
||||
const val AD_TYPE_SDK = "third_party_ads" // 第三方 SDK 广告
|
||||
|
||||
private const val KEY_CACHE_CONFIG = "cache_config" // 放在 SP 里的广告缓存(避免接口加载问题)
|
||||
|
||||
private val mAdConfigSp: SharedPreferences by lazy {
|
||||
HaloApp.getInstance().getSharedPreferences("AdConfig", Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
var gameSearchKeyword = ""
|
||||
|
||||
fun initAdSdk(context: Context) {
|
||||
// 初始化 Beizi
|
||||
if (mBeiziAdImpl == null) {
|
||||
mBeiziAdImpl =
|
||||
ARouter.getInstance().build(RouteConsts.provider.beiziAd).navigation() as? IBeiziAdProvider
|
||||
mBeiziAdImpl?.initSDK(context)
|
||||
}
|
||||
|
||||
// 初始化穿山甲
|
||||
if (mCsjAdImpl == null) {
|
||||
mCsjAdImpl =
|
||||
ARouter.getInstance().build(RouteConsts.provider.csjAd).navigation() as? ICsjAdProvider
|
||||
val csjAppId = if (EnvHelper.isDevEnv) BuildConfig.DEV_CSJ_APPID else BuildConfig.CSJ_APPID
|
||||
mCsjAdImpl?.initSDK(context, csjAppId, HaloApp.getInstance().oaid)
|
||||
// 监听亮色/暗色模式切换
|
||||
DarkModeUtils.registerModeChangeListener {
|
||||
val topActivity = CurrentActivityHolder.getCurrentActivity() ?: return@registerModeChangeListener
|
||||
updateThemeStatus(context, DarkModeUtils.isDarkModeOn(topActivity))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求接口获取广告相关配置
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
fun requestAdConfig(isFromRetry: Boolean, keyword: String = "", callback: (() -> Unit)? = null) {
|
||||
// mAdConfigList 不为空不需要重试
|
||||
if (isFromRetry && mAdConfigList != null) {
|
||||
return
|
||||
}
|
||||
val paramsMap = if (keyword.isNotEmpty()) mapOf("keyword" to keyword) else mapOf()
|
||||
RetrofitManager.getInstance()
|
||||
.newApi
|
||||
.getAdConfig(paramsMap)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : BiResponse<List<AdConfig>>() {
|
||||
override fun onSuccess(data: List<AdConfig>) {
|
||||
gameSearchKeyword = keyword
|
||||
handleAdConfig(data)
|
||||
callback?.invoke()
|
||||
|
||||
// 缓存数据到 SP 供接口请求失败用
|
||||
SPUtils.setString(mAdConfigSp, KEY_CACHE_CONFIG, data.toJson())
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
|
||||
// 若接口请求失败时,从 SP 里获取上次缓存的数据
|
||||
val cachedConfig: List<AdConfig>? = SPUtils.getString(mAdConfigSp, KEY_CACHE_CONFIG).toObject()
|
||||
if (cachedConfig != null) {
|
||||
handleAdConfig(cachedConfig)
|
||||
}
|
||||
|
||||
callback?.invoke()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取搜索页的广告列表
|
||||
*/
|
||||
fun getGameSearchAdList(): ArrayList<AdConfig> {
|
||||
return mGameSearchAdList
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载管理页的广告
|
||||
*/
|
||||
fun getDownloadManagerAd(): AdConfig? {
|
||||
return mDownloadManagerAd
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理广告配置
|
||||
*/
|
||||
fun handleAdConfig(configList: List<AdConfig>) {
|
||||
mGameSearchAdList.clear()
|
||||
mSplashAd = null
|
||||
mDownloadManagerAd = null
|
||||
mVGameLaunchAd = null
|
||||
for (config in configList) {
|
||||
// 处理返回的数据
|
||||
when (config.location) {
|
||||
"halo_launch" -> {
|
||||
config.ownerAd?.startAd?.let { it.id = config.ownerAd.id }
|
||||
mSplashAd = config
|
||||
}
|
||||
|
||||
"download_manager" -> mDownloadManagerAd = config
|
||||
"game_search" -> config.let { mGameSearchAdList.add(it) }
|
||||
"helper_launch" -> mVGameLaunchAd = config
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要显示开屏广告
|
||||
*/
|
||||
fun shouldShowStartUpAd(): Boolean {
|
||||
return mSplashAd != null
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主题样式
|
||||
*/
|
||||
private fun updateThemeStatus(context: Context, isDarkMode: Boolean) {
|
||||
mCsjAdImpl?.updateThemeStatus(context, isDarkMode)
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求开屏广告
|
||||
*/
|
||||
@JvmStatic
|
||||
fun requestSplashAd(
|
||||
activity: Activity,
|
||||
adViewWidthInPx: Int,
|
||||
adViewHeightInPx: Int,
|
||||
adViewWidthInDp: Float,
|
||||
adViewHeightInDp: Float,
|
||||
startAdContainer: ViewGroup,
|
||||
sdkStartAdContainer: ViewGroup,
|
||||
adsViewGroup: FrameLayout,
|
||||
handler: BaseActivity.BaseHandler,
|
||||
hideCallback: () -> Unit
|
||||
) {
|
||||
if (mSplashAd != null) {
|
||||
if (mSplashAd!!.displayRule.adSource == AD_TYPE_SDK) {
|
||||
// 第三方开屏广告回调,失败时根据接口配置选项决定是否显示自有开屏广告
|
||||
val sdkSplashCallback: (isSuccess: Boolean) -> Unit = { isSuccess ->
|
||||
if (isSuccess) {
|
||||
hideCallback.invoke()
|
||||
} else {
|
||||
if (mSplashAd?.displayRule?.onFailedAction == "show") {
|
||||
sdkStartAdContainer.visibility = View.GONE
|
||||
requestStandardSplashAd(
|
||||
mSplashAd!!.ownerAd?.startAd,
|
||||
startAdContainer,
|
||||
handler,
|
||||
hideCallback
|
||||
)
|
||||
} else {
|
||||
hideCallback.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 第三方广告的数据为空,按加载失败处理
|
||||
if (mSplashAd?.thirdPartyAd == null) {
|
||||
sdkSplashCallback.invoke(false)
|
||||
return
|
||||
}
|
||||
|
||||
if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_BEIZI) {
|
||||
sdkStartAdContainer.visibility = View.VISIBLE
|
||||
requestBeiziSplashAd(sdkStartAdContainer, adsViewGroup, adViewWidthInPx, adViewHeightInPx, sdkSplashCallback)
|
||||
} else if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_CSJ) {
|
||||
sdkStartAdContainer.visibility = View.VISIBLE
|
||||
requestCsjSplashAd(
|
||||
activity,
|
||||
mSplashAd?.thirdPartyAd?.slotId ?: "unknown",
|
||||
adViewWidthInPx,
|
||||
adViewHeightInPx,
|
||||
adViewWidthInDp,
|
||||
adViewHeightInDp,
|
||||
sdkStartAdContainer,
|
||||
sdkSplashCallback
|
||||
)
|
||||
}
|
||||
} else {
|
||||
requestStandardSplashAd(mSplashAd!!.ownerAd?.startAd, startAdContainer, handler, hideCallback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取穿山甲的开屏广告
|
||||
*/
|
||||
private fun requestCsjSplashAd(
|
||||
activity: Activity,
|
||||
slotId: String,
|
||||
adViewWidthInPx: Int,
|
||||
adViewHeightInPx: Int,
|
||||
adViewWidthInDp: Float,
|
||||
adViewHeightInDp: Float,
|
||||
startAdContainer: ViewGroup,
|
||||
callback: (isSuccess: Boolean) -> Unit,
|
||||
) {
|
||||
if (mCsjAdImpl == null) {
|
||||
callback.invoke(false)
|
||||
} else {
|
||||
mCsjAdImpl?.requestSplashAd(
|
||||
activity,
|
||||
slotId,
|
||||
adViewWidthInPx,
|
||||
adViewHeightInPx,
|
||||
adViewWidthInDp,
|
||||
adViewHeightInDp,
|
||||
startAdContainer,
|
||||
callback,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Beizi 的开屏广告
|
||||
*/
|
||||
private fun requestBeiziSplashAd(
|
||||
startAdContainer: View,
|
||||
adsFl: FrameLayout,
|
||||
adViewWidthInPx: Int,
|
||||
adViewHeightInPx: Int,
|
||||
callback: (isSuccess: Boolean) -> Unit,
|
||||
) {
|
||||
if (mBeiziAdImpl == null) {
|
||||
callback.invoke(false)
|
||||
} else {
|
||||
mBeiziAdImpl?.requestSplashAd(startAdContainer, adsFl, adViewWidthInPx, adViewHeightInPx, callback)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示自有的开屏广告
|
||||
*/
|
||||
private fun requestStandardSplashAd(
|
||||
splashAd: StartupAdEntity?,
|
||||
startAdContainer: ViewGroup,
|
||||
handler: BaseActivity.BaseHandler,
|
||||
hideCallback: () -> Unit
|
||||
) {
|
||||
if (splashAd == null) {
|
||||
hideCallback.invoke()
|
||||
return
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(splashAd.img)) {
|
||||
val showedTodayTimestamp = SPUtils.getString(Constants.SP_STARTUP_AD_TIMESTAMP, "") ?: ""
|
||||
when (splashAd.rule) {
|
||||
"each" -> showStandardSplashAd(splashAd, startAdContainer, handler, hideCallback)
|
||||
"once" -> if (TextUtils.isEmpty(showedTodayTimestamp)
|
||||
|| !showedTodayTimestamp.contains(splashAd.id)
|
||||
) {
|
||||
showStandardSplashAd(splashAd, startAdContainer, handler, hideCallback)
|
||||
} else {
|
||||
hideCallback.invoke()
|
||||
}
|
||||
|
||||
"everyday" -> {
|
||||
val today = getToday()
|
||||
if (TextUtils.isEmpty(showedTodayTimestamp)
|
||||
|| !showedTodayTimestamp.contains(today)
|
||||
|| !showedTodayTimestamp.contains(splashAd.id)
|
||||
) {
|
||||
showStandardSplashAd(splashAd, startAdContainer, handler, hideCallback)
|
||||
} else {
|
||||
hideCallback.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
else -> hideCallback.invoke()
|
||||
}
|
||||
SPUtils.setString(Constants.SP_STARTUP_AD_TIMESTAMP, splashAd.id + getToday())
|
||||
} else {
|
||||
hideCallback.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showStandardSplashAd(
|
||||
ad: StartupAdEntity,
|
||||
startAdContainer: ViewGroup,
|
||||
handler: BaseActivity.BaseHandler,
|
||||
hideCallback: () -> Unit
|
||||
) {
|
||||
val jumpBtn: View = startAdContainer.findViewById(R.id.jumpBtn)
|
||||
val jumpDetailBtn: TextView = startAdContainer.findViewById(R.id.jumpDetailBtn)
|
||||
val adImage: SimpleDraweeView = startAdContainer.findViewById(R.id.adImage)
|
||||
val icpContainer: View? = startAdContainer.findViewById(R.id.startAdIcpContainer)
|
||||
startAdContainer.visibility = View.VISIBLE
|
||||
icpContainer?.visibility = View.VISIBLE
|
||||
jumpDetailBtn.text = ad.desc
|
||||
jumpDetailBtn.setDrawableEnd(
|
||||
AppCompatResources.getDrawable(
|
||||
startAdContainer.context,
|
||||
R.drawable.ic_startup_ad_arrow
|
||||
), null, null
|
||||
)
|
||||
ImageUtils.display(adImage, ad.img)
|
||||
startAdContainer.setOnClickListener {
|
||||
// 拦截点击事件传递
|
||||
}
|
||||
jumpBtn.setOnClickListener {
|
||||
handler.removeMessages(MainActivity.COUNTDOWN_AD)
|
||||
hideCallback.invoke()
|
||||
val linkEntity = ad.jump
|
||||
logOpenScreenAdSkip(
|
||||
ad.id,
|
||||
(if (linkEntity.text != null) linkEntity.text else "")!!,
|
||||
(if (linkEntity.type != null) linkEntity.type else "")!!,
|
||||
(if (linkEntity.link != null) linkEntity.link else "")!!
|
||||
)
|
||||
}
|
||||
val sources: MutableList<ExposureSource> = ArrayList()
|
||||
sources.add(ExposureSource("开屏广告", ad.id))
|
||||
val event = createEvent(null, sources, null, ExposureType.EXPOSURE)
|
||||
ExposureManager.log(event)
|
||||
if (ad.button) {
|
||||
jumpDetailBtn.setOnClickListener { v: View ->
|
||||
directToLinkPage(v.context, ad.jump, "(启动广告)", "", event)
|
||||
v.postDelayed({
|
||||
handler.removeMessages(MainActivity.COUNTDOWN_AD)
|
||||
hideCallback.invoke()
|
||||
}, 1000)
|
||||
}
|
||||
jumpDetailBtn.visibility = View.VISIBLE
|
||||
LogUtils.logStartAd("watch_start_ads", ad)
|
||||
} else {
|
||||
LogUtils.logStartAd("start_ads", ad)
|
||||
}
|
||||
handler.sendEmptyMessageDelayed(MainActivity.COUNTDOWN_AD, 1000)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取第三方信息流广告
|
||||
*/
|
||||
fun requestThirdPartyFlowAd(
|
||||
fragment: Fragment,
|
||||
slotId: String,
|
||||
adContainerView: ViewGroup,
|
||||
expressViewWidth: Float,
|
||||
callback: (isSuccess: Boolean) -> Unit,
|
||||
) {
|
||||
mCsjAdImpl?.requestFlowAd(fragment, adContainerView, slotId, expressViewWidth, callback)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取第三方 Banner 广告
|
||||
*/
|
||||
fun requestThirdPartyBannerAd(
|
||||
fragment: Fragment,
|
||||
containerView: ViewGroup,
|
||||
ad: AdConfig.ThirdPartyAd,
|
||||
expressViewWidthInDp: Float,
|
||||
callback: (isSuccess: Boolean) -> Unit
|
||||
) {
|
||||
|
||||
val slotId = ad.slotId
|
||||
val displayRatio: Float = if (ad.displaySize.isEmpty()) {
|
||||
2F
|
||||
} else {
|
||||
val array = ad.displaySize.split("*")
|
||||
if (array.size == 2) {
|
||||
array[0].toFloat() / array[1].toFloat()
|
||||
} else {
|
||||
2F
|
||||
}
|
||||
}
|
||||
val expressViewHeightInDp = expressViewWidthInDp / displayRatio
|
||||
|
||||
mCsjAdImpl?.requestBannerAd(
|
||||
fragment,
|
||||
containerView,
|
||||
slotId,
|
||||
expressViewWidthInDp,
|
||||
expressViewHeightInDp,
|
||||
callback
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消开屏广告
|
||||
*/
|
||||
fun cancelSplashAd(context: Context) {
|
||||
mBeiziAdImpl?.cancelSplashAd(context)
|
||||
mCsjAdImpl?.cancelSplashAd(context)
|
||||
}
|
||||
|
||||
}
|
||||
@ -57,11 +57,16 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
private lateinit var mEditorFontItalic: CheckableImageView
|
||||
private lateinit var mEditorFontStrikeThrough: CheckableImageView
|
||||
private lateinit var mEditorFontUnderline: CheckableImageView
|
||||
private lateinit var mEditorParagraphDivider: CheckableImageView
|
||||
private lateinit var mEditorParagraphH1: CheckableImageView
|
||||
private lateinit var mEditorParagraphH2: CheckableImageView
|
||||
private lateinit var mEditorParagraphH3: CheckableImageView
|
||||
private lateinit var mEditorParagraphH4: CheckableImageView
|
||||
private lateinit var mEditorParagraphQuote: CheckableImageView
|
||||
private lateinit var mEditorAlignLeft: CheckableImageView
|
||||
private lateinit var mEditorAlignCenter: CheckableImageView
|
||||
private lateinit var mEditorAlignRight: CheckableImageView
|
||||
private lateinit var mEditorAlignContainer: View
|
||||
private lateinit var mEditorFontContainer: View
|
||||
private lateinit var mEditorParagraphContainer: View
|
||||
private lateinit var mEditorLinkContainer: View
|
||||
@ -97,6 +102,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
mRichEditor.insertCustomStyleLink(insertData)
|
||||
}
|
||||
}
|
||||
|
||||
INSERT_ARTICLE_CODE -> {
|
||||
val article =
|
||||
data?.getParcelableExtra<ArticleEntity>(ArticleEntity::class.java.simpleName)
|
||||
@ -106,6 +112,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
mRichEditor.insertCustomStyleLink(insertData)
|
||||
}
|
||||
}
|
||||
|
||||
INSERT_GAME_CODE -> {
|
||||
val game = data?.getParcelableExtra<GameEntity>(GameEntity::class.java.simpleName)
|
||||
if (game != null) {
|
||||
@ -114,6 +121,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
mRichEditor.insertCustomStyleLink(insertData)
|
||||
}
|
||||
}
|
||||
|
||||
INSERT_GAME_COLLECTION_CODE -> {
|
||||
val gameCollectionEntity =
|
||||
data?.getParcelableExtra<GamesCollectionEntity>(GamesCollectionEntity::class.java.simpleName)
|
||||
@ -123,9 +131,11 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
mRichEditor.insertCustomStyleLink(insertData)
|
||||
}
|
||||
}
|
||||
|
||||
REQUEST_CODE_IMAGE -> {
|
||||
if (data != null) mViewModel.uploadPic(data)
|
||||
}
|
||||
|
||||
INSERT_MEDIA_VIDEO_CODE -> {
|
||||
val localVideoList =
|
||||
data?.getParcelableArrayListExtra<LocalVideoEntity>(LocalVideoEntity::class.java.name)
|
||||
@ -135,12 +145,14 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
uploadVideo(localVideoList)
|
||||
}
|
||||
}
|
||||
|
||||
REQUEST_CODE_IMAGE_CROP -> {
|
||||
val imagePath = data?.getStringExtra(CropImageActivity.RESULT_CLIP_PATH)
|
||||
if (!imagePath.isNullOrEmpty()) {
|
||||
mViewModel.uploadPoster(imagePath)
|
||||
}
|
||||
}
|
||||
|
||||
INSERT_VIDEO_CODE -> {
|
||||
val videoEntity = data?.getParcelableExtra<MyVideoEntity>(MyVideoEntity::class.java.simpleName)
|
||||
if (videoEntity != null) {
|
||||
@ -194,7 +206,12 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
mEditorParagraphH2 = findViewById(R.id.editor_paragraph_h2)
|
||||
mEditorParagraphH3 = findViewById(R.id.editor_paragraph_h3)
|
||||
mEditorParagraphH4 = findViewById(R.id.editor_paragraph_h4)
|
||||
mEditorParagraphDivider = findViewById(R.id.editor_paragraph_divider)
|
||||
mEditorParagraphQuote = findViewById(R.id.editor_paragraph_quote)
|
||||
mEditorAlignLeft = findViewById(R.id.editor_align_left)
|
||||
mEditorAlignCenter = findViewById(R.id.editor_align_center)
|
||||
mEditorAlignRight = findViewById(R.id.editor_align_right)
|
||||
mEditorAlignContainer = findViewById(R.id.editor_align_container)
|
||||
mEditorFontContainer = findViewById(R.id.editor_font_container)
|
||||
mEditorParagraphContainer = findViewById(R.id.editor_paragraph_container)
|
||||
mEditorLinkContainer = findViewById(R.id.editor_link_container)
|
||||
@ -241,6 +258,13 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
mRichEditor.hasFocus()
|
||||
} else false
|
||||
}
|
||||
|
||||
mRichEditor.setOnDecorationChangeListener { _, types ->
|
||||
mEditorAlignLeft.isChecked = types.contains(RichEditor.Type.JUSTIFYLEFT)
|
||||
mEditorAlignCenter.isChecked = types.contains(RichEditor.Type.JUSTIFYCENTER)
|
||||
mEditorAlignRight.isChecked = types.contains(RichEditor.Type.JUSTIFYRIGHT)
|
||||
}
|
||||
|
||||
mOriginalCb.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (isChecked) {
|
||||
mOriginalTipsContainer.alpha = 0f
|
||||
@ -325,6 +349,9 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-下滑线")
|
||||
}
|
||||
}
|
||||
mEditorParagraphDivider.setOnClickListener {
|
||||
mRichEditor.insertDivider()
|
||||
}
|
||||
mEditorParagraphH1.setOnClickListener {
|
||||
if (mEditorParagraphH1.isChecked) {
|
||||
mRichEditor.formatBlock()
|
||||
@ -370,6 +397,27 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
}
|
||||
mEditorParagraphQuote.isChecked = !mEditorParagraphQuote.isChecked
|
||||
}
|
||||
mEditorAlignLeft.setOnClickListener {
|
||||
if (!mEditorAlignLeft.isChecked) {
|
||||
mRichEditor.setAlignLeft()
|
||||
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠左")
|
||||
mEditorAlignLeft.isChecked = !mEditorAlignLeft.isChecked
|
||||
}
|
||||
}
|
||||
mEditorAlignCenter.setOnClickListener {
|
||||
if (!mEditorAlignCenter.isChecked) {
|
||||
mRichEditor.setAlignCenter()
|
||||
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠中")
|
||||
mEditorAlignCenter.isChecked = !mEditorAlignCenter.isChecked
|
||||
}
|
||||
}
|
||||
mEditorAlignRight.setOnClickListener {
|
||||
if (!mEditorAlignRight.isChecked) {
|
||||
mRichEditor.setAlignRight()
|
||||
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠右")
|
||||
mEditorAlignRight.isChecked = !mEditorAlignRight.isChecked
|
||||
}
|
||||
}
|
||||
findViewById<View>(R.id.editor_link_answer).setOnClickListener {
|
||||
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-回答")
|
||||
startActivityForResult(
|
||||
@ -449,25 +497,22 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
return
|
||||
}
|
||||
try {
|
||||
PermissionHelper.checkStoragePermissionBeforeAction(this,
|
||||
object : EmptyCallback {
|
||||
override fun onCallback() {
|
||||
val maxChooseCount = if (videoCount + 3 <= MAX_MEDIA_COUNT) 3 else MAX_MEDIA_COUNT - videoCount
|
||||
startActivityForResult(
|
||||
LocalMediaActivity.getIntent(
|
||||
this@BaseRichEditorActivity,
|
||||
LocalMediaActivity.ChooseType.VIDEO,
|
||||
maxChooseCount,
|
||||
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
|
||||
), INSERT_MEDIA_VIDEO_CODE
|
||||
)
|
||||
NewLogUtils.logChooseMedia(
|
||||
"view_media",
|
||||
if (mtaEventName() == "提问帖") "提问帖" else "帖子",
|
||||
"视频"
|
||||
)
|
||||
}
|
||||
})
|
||||
PermissionHelper.checkStoragePermissionBeforeAction(this) {
|
||||
val maxChooseCount = if (videoCount + 3 <= MAX_MEDIA_COUNT) 3 else MAX_MEDIA_COUNT - videoCount
|
||||
startActivityForResult(
|
||||
LocalMediaActivity.getIntent(
|
||||
this@BaseRichEditorActivity,
|
||||
LocalMediaActivity.ChooseType.VIDEO,
|
||||
maxChooseCount,
|
||||
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
|
||||
), INSERT_MEDIA_VIDEO_CODE
|
||||
)
|
||||
NewLogUtils.logChooseMedia(
|
||||
"view_media",
|
||||
if (mtaEventName() == "提问帖") "提问帖" else "帖子",
|
||||
"视频"
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
toast(R.string.media_image_hint)
|
||||
e.printStackTrace()
|
||||
@ -482,18 +527,16 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
return
|
||||
}
|
||||
try {
|
||||
PermissionHelper.checkStoragePermissionBeforeAction(this, object : EmptyCallback {
|
||||
override fun onCallback() {
|
||||
val maxChooseCount = if (imageCount + 10 <= MAX_IMAGE_COUNT) 10 else MAX_IMAGE_COUNT - imageCount
|
||||
val intent = LocalMediaActivity.getIntent(
|
||||
this@BaseRichEditorActivity,
|
||||
LocalMediaActivity.ChooseType.IMAGE,
|
||||
maxChooseCount,
|
||||
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
|
||||
)
|
||||
startActivityForResult(intent, REQUEST_CODE_IMAGE)
|
||||
}
|
||||
})
|
||||
PermissionHelper.checkStoragePermissionBeforeAction(this) {
|
||||
val maxChooseCount = if (imageCount + 10 <= MAX_IMAGE_COUNT) 10 else MAX_IMAGE_COUNT - imageCount
|
||||
val intent = LocalMediaActivity.getIntent(
|
||||
this@BaseRichEditorActivity,
|
||||
LocalMediaActivity.ChooseType.IMAGE,
|
||||
maxChooseCount,
|
||||
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
|
||||
)
|
||||
startActivityForResult(intent, REQUEST_CODE_IMAGE)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
toast(R.string.media_image_hint)
|
||||
e.printStackTrace()
|
||||
@ -516,6 +559,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
mEditorFontContainer.visibility = if (mEditorFont.isChecked) View.VISIBLE else View.GONE
|
||||
mEditorParagraphContainer.visibility =
|
||||
if (mEditorFont.isChecked) View.VISIBLE else View.GONE
|
||||
mEditorAlignContainer.visibility = if (mEditorFont.isChecked) View.VISIBLE else View.GONE
|
||||
mEditorLinkContainer.visibility = View.GONE
|
||||
mTagsContainer.visibility = View.GONE
|
||||
mIsExtendedKeyboardShow = mEditorFont.isChecked
|
||||
@ -537,6 +581,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
if (mEditorLink.isChecked) View.VISIBLE else View.GONE
|
||||
mEditorLinkContainer.visibility = if (mEditorLink.isChecked) View.VISIBLE else View.GONE
|
||||
mEditorFontContainer.visibility = View.GONE
|
||||
mEditorAlignContainer.visibility = View.GONE
|
||||
mEditorParagraphContainer.visibility = View.GONE
|
||||
mTagsContainer.visibility = View.GONE
|
||||
mIsExtendedKeyboardShow = mEditorLink.isChecked
|
||||
@ -776,7 +821,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
|
||||
const val INSERT_VIDEO_CODE = 415
|
||||
const val MAX_INPUT_TEXT_NUM = 10000
|
||||
const val MAX_MEDIA_COUNT = 20
|
||||
const val MAX_IMAGE_COUNT = 35
|
||||
const val MAX_IMAGE_COUNT = 70
|
||||
|
||||
const val REQUEST_CODE_IMAGE = 120
|
||||
const val INSERT_MEDIA_VIDEO_CODE = 121
|
||||
|
||||
@ -28,6 +28,7 @@ import com.gh.gamecenter.retrofit.service.ApiService
|
||||
import com.gh.gamecenter.video.upload.OnUploadListener
|
||||
import com.gh.gamecenter.video.upload.UploadManager
|
||||
import com.google.gson.JsonObject
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.Utils
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zhihu.matisse.internal.utils.PathUtils
|
||||
@ -38,6 +39,10 @@ import okhttp3.ResponseBody
|
||||
import retrofit2.HttpException
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.collections.LinkedHashMap
|
||||
import kotlin.collections.set
|
||||
|
||||
// TODO: 移动到module_bbs模块
|
||||
@ -124,8 +129,17 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
|
||||
}
|
||||
val map = LinkedHashMap<String, String>()
|
||||
for (key in imageUrlMap.keys) {
|
||||
map[MD5Utils.getUrlMD5(key)] = FILE_HOST + key.decodeURI()
|
||||
mapImages[TextUtils.htmlEncode(key).decodeURI()] = imageUrlMap[key] ?: ""
|
||||
val localFileUri = FILE_HOST + key.decodeURI()
|
||||
|
||||
// 文件格式为 HEIC 时,使用经 OSS 转码的图片作为预览图片
|
||||
if (FileUtils.getFileMimeType(getApplication(), key.decodeURI())?.lowercase(Locale.CHINA)?.contains("heic") == true) {
|
||||
val transformedImgUrl = ImageUtils.getTransformedUrl(imageUrlMap[key], 5000) ?: ""
|
||||
map[MD5Utils.getUrlMD5(key)] = transformedImgUrl
|
||||
mapImages[transformedImgUrl.decodeURI()] = imageUrlMap[key] ?: ""
|
||||
} else {
|
||||
map[MD5Utils.getUrlMD5(key)] = localFileUri
|
||||
mapImages[TextUtils.htmlEncode(key).decodeURI()] = imageUrlMap[key] ?: ""
|
||||
}
|
||||
}
|
||||
chooseImagesUploadSuccess.value = map
|
||||
}
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
package com.gh.base
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.DownloadManagerActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.viewModelProvider
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils.getBoolean
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
@ -58,6 +60,7 @@ abstract class DownloadToolbarActivity : ToolBarActivity() {
|
||||
}
|
||||
val downloadMenuView = mActionMenuView.menu.findItem(R.id.menu_download).actionView
|
||||
mDownloadCountHint = downloadMenuView?.findViewById(R.id.menu_download_count_hint)
|
||||
mDownloadCountHint?.typeface = Typeface.createFromAsset(assets, "fonts/d_din_bold_only_number.ttf")
|
||||
}
|
||||
|
||||
override fun onMenuItemClick(item: MenuItem?): Boolean {
|
||||
@ -74,19 +77,27 @@ abstract class DownloadToolbarActivity : ToolBarActivity() {
|
||||
if (mDownloadCountHint == null) return
|
||||
val count = DownloadManager.getInstance().getDownloadOrUpdateCount(updateList)
|
||||
if (count != null) {
|
||||
mDownloadCountHint!!.visibility = View.VISIBLE
|
||||
mDownloadCountHint!!.text = count
|
||||
val params = mDownloadCountHint!!.layoutParams
|
||||
if (TextUtils.isEmpty(count)) {
|
||||
params.width = DisplayUtils.dip2px(6f)
|
||||
params.height = DisplayUtils.dip2px(6f)
|
||||
} else {
|
||||
params.width = DisplayUtils.dip2px(12f)
|
||||
params.height = DisplayUtils.dip2px(12f)
|
||||
}
|
||||
mDownloadCountHint!!.layoutParams = params
|
||||
mDownloadCountHint?.visibility = View.VISIBLE
|
||||
mDownloadCountHint?.text = count
|
||||
val params = mDownloadCountHint?.layoutParams
|
||||
params?.width = if (count.isEmpty()) 6F.dip2px() else ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
params?.height = if (count.isEmpty()) 6F.dip2px() else 14F.dip2px()
|
||||
(params as? ViewGroup.MarginLayoutParams)?.setMargins(
|
||||
0,
|
||||
if (count.isEmpty()) 0 else (-4F).dip2px(),
|
||||
if (count.isEmpty()) (-4F).dip2px() else (-8F).dip2px(),
|
||||
0
|
||||
)
|
||||
mDownloadCountHint?.setPadding(
|
||||
if (count.isEmpty()) 0 else 4F.dip2px(),
|
||||
0,
|
||||
if (count.isEmpty()) 0 else 4F.dip2px(),
|
||||
0
|
||||
)
|
||||
mDownloadCountHint?.minWidth = if (count.isEmpty()) 0 else 14F.dip2px()
|
||||
mDownloadCountHint?.layoutParams = params
|
||||
} else {
|
||||
mDownloadCountHint!!.visibility = View.GONE
|
||||
mDownloadCountHint?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import android.app.Application
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.common.util.FloatingBackViewManager
|
||||
import com.gh.common.xapk.XapkInstaller
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.SingletonWebActivity
|
||||
import com.gh.gamecenter.SkipActivity
|
||||
@ -61,6 +62,8 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
||||
) {
|
||||
VHelper.showFeedbackDialogIfLastSuccessfulLaunchedGameExitUnexpectedly(activity)
|
||||
}
|
||||
|
||||
XapkInstaller.updateCurrentInstallStatus()
|
||||
}
|
||||
|
||||
override fun onActivityPaused(activity: Activity) {
|
||||
|
||||
@ -12,6 +12,7 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.util.LogUtils
|
||||
import com.gh.download.DownloadManager
|
||||
@ -23,10 +24,12 @@ import com.gh.gamecenter.common.callback.BiCallback
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.entity.NotificationUgc
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.loghub.LoghubUtils
|
||||
import com.gh.gamecenter.common.provider.IHelpAndFeedbackProvider
|
||||
import com.gh.gamecenter.common.tracker.Tracker
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.utils.NewFlatLogUtils
|
||||
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
@ -37,6 +40,7 @@ import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.entity.Badge
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.login.user.LoginTag
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.login.user.UserRepository
|
||||
@ -65,12 +69,19 @@ class DefaultJsApi(
|
||||
val entrance: String = "",
|
||||
private var mFragment: Fragment? = null,
|
||||
private var mBbsId: String? = "",
|
||||
private var mOriginUrl: String? = "",
|
||||
private val mForumName: String? = ""
|
||||
) {
|
||||
|
||||
companion object {
|
||||
private const val SOURCE_ENTRANCE = "webView"
|
||||
}
|
||||
|
||||
private var mLoginHandler: CompletionHandler<Any>? = null
|
||||
private var mDownloadWatcher: DataWatcher? = null // 下载观察者
|
||||
private var mDownloadUrlSet: HashSet<String>? = null // 下载的 url 集合
|
||||
private var mDownloadHandler: CompletionHandler<Any>? = null // 下载信息回调
|
||||
private var mExposureEvent: ExposureEvent? = null // 活动曝光实体
|
||||
|
||||
init {
|
||||
if (mFragment != null) {
|
||||
@ -213,7 +224,7 @@ class DefaultJsApi(
|
||||
VHelper.launch(context, packageName)
|
||||
}
|
||||
} else {
|
||||
PackageUtils.launchApplicationByPackageName(context, packageName)
|
||||
PackageLauncher.launchApp(context, packageName = packageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -224,7 +235,14 @@ class DefaultJsApi(
|
||||
|
||||
val context = CurrentActivityHolder.getCurrentActivity()
|
||||
|
||||
context?.startActivity(ImageViewerActivity.getIntent(context, imageEvent.imageList, imageEvent.position, "浏览器"))
|
||||
context?.startActivity(
|
||||
ImageViewerActivity.getIntent(
|
||||
context,
|
||||
imageEvent.imageList,
|
||||
imageEvent.position,
|
||||
"浏览器"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
@ -273,11 +291,18 @@ class DefaultJsApi(
|
||||
|
||||
/**
|
||||
* 打开论坛搜索页
|
||||
* 如果用户是从 webView跳转到论坛搜索页,则sourceEntrance为空
|
||||
*/
|
||||
@JavascriptInterface
|
||||
fun openForumSearch(msg: Any) {
|
||||
runOnUiThread {
|
||||
DirectUtils.directToForumOrUserSearch(context, mBbsId ?: "", entrance.ifBlank { "内部网页" })
|
||||
DirectUtils.directToForumOrUserSearch(
|
||||
context,
|
||||
mBbsId ?: "",
|
||||
entrance.ifBlank { "内部网页" },
|
||||
SOURCE_ENTRANCE,
|
||||
mForumName ?: ""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,7 +404,7 @@ class DefaultJsApi(
|
||||
|
||||
@JavascriptInterface
|
||||
fun showQaFeedbackDialog(msg: Any) {
|
||||
val mHelpAndFeedbackHelp =
|
||||
val mHelpAndFeedbackHelp =
|
||||
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback).navigation() as? IHelpAndFeedbackProvider
|
||||
mHelpAndFeedbackHelp?.showQaFeedbackDialogFragment(context as AppCompatActivity, msg.toString())
|
||||
}
|
||||
@ -525,13 +550,24 @@ class DefaultJsApi(
|
||||
@JavascriptInterface
|
||||
fun installDownloadedGame(event: Any) {
|
||||
val url = event.toString()
|
||||
val vUrl = VHelper.getVUrl(url)
|
||||
|
||||
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(url, null, false)
|
||||
?: DownloadManager.getInstance().getDownloadEntitySnapshot(vUrl, null, false)
|
||||
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(url, null)
|
||||
?: DownloadManager.getInstance().getDownloadEntitySnapshot(url, null)
|
||||
|
||||
NewFlatLogUtils.logGameInstall(
|
||||
gameId = downloadEntity?.gameId ?: "",
|
||||
gameName = downloadEntity?.name ?: "",
|
||||
trigger = "主动安装"
|
||||
)
|
||||
|
||||
SensorsBridge.trackInstallGameClick(
|
||||
gameId = downloadEntity?.gameId ?: "",
|
||||
gameName = downloadEntity?.name ?: "",
|
||||
action = "主动安装"
|
||||
)
|
||||
|
||||
downloadEntity?.let {
|
||||
PackageInstaller.install(context, it, showUnzipToast = false)
|
||||
PackageInstaller.install(context, it, showUnzipToast = false, ignoreAsVGame = false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -624,6 +660,33 @@ class DefaultJsApi(
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun logExposure(event: Any) {
|
||||
val simpleExposureEvent = event.toString().toObject() ?: SimpleExposureEvent()
|
||||
if (simpleExposureEvent.id.isNotEmpty()) {
|
||||
val sourceKey = if (mOriginUrl?.contains(Constants.URL_QUERY_FROM_FLOATING_WINDOW) == true) {
|
||||
"落地页"
|
||||
} else {
|
||||
"游戏活动"
|
||||
}
|
||||
|
||||
val exposureSource = ExposureSource(sourceKey, "${simpleExposureEvent.title}+${simpleExposureEvent.id}")
|
||||
mExposureEvent = ExposureEvent.createEvent(
|
||||
gameEntity = null,
|
||||
source = arrayListOf(exposureSource),
|
||||
)
|
||||
ExposureManager.log(mExposureEvent!!)
|
||||
ExposureManager.commitSavedExposureEvents(true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 ExposureEvent,可能为空
|
||||
*/
|
||||
fun getExposureEvent(): ExposureEvent? {
|
||||
return mExposureEvent
|
||||
}
|
||||
|
||||
private fun autoUnregisterDownloadObserverIfNeeded(fragment: Fragment?) {
|
||||
fragment?.parentFragmentManager?.registerFragmentLifecycleCallbacks(
|
||||
object : FragmentManager.FragmentLifecycleCallbacks() {
|
||||
@ -676,6 +739,9 @@ class DefaultJsApi(
|
||||
@Keep
|
||||
internal class TextShareEvent(var text: String = "", var type: String = "")
|
||||
|
||||
@Keep
|
||||
internal class SimpleExposureEvent(var title: String = "", var id: String = "")
|
||||
|
||||
@Keep
|
||||
internal class InviteFriendsEvent(
|
||||
var type: String = "",
|
||||
@ -702,6 +768,7 @@ class DefaultJsApi(
|
||||
var status: String = "" // DOWNLOADING, PAUSED, DOWNLOADED, ERROR, UNKNOWN
|
||||
) {
|
||||
companion object {
|
||||
|
||||
fun fromDownloadEntity(downloadEntity: DownloadEntity): SimpleDownloadEntity {
|
||||
val status: String = when (downloadEntity.status) {
|
||||
add,
|
||||
|
||||
@ -36,6 +36,7 @@ import com.gh.gamecenter.entity.SubjectRecommendEntity
|
||||
import com.gh.gamecenter.entity.VideoLinkEntity
|
||||
import com.gh.gamecenter.eventbus.EBSkip
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils
|
||||
import com.gh.gamecenter.fragment.MainWrapperFragment
|
||||
import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity
|
||||
@ -51,14 +52,21 @@ object DefaultUrlHandler {
|
||||
|
||||
@JvmStatic
|
||||
fun interceptUrl(context: Context, url: String, entrance: String): Boolean {
|
||||
return interceptUrl(context, url, entrance, false)
|
||||
return interceptUrl(context, url, null, entrance, false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查并拦截部分内部处理的 url
|
||||
* @param traceEvent 供一些页面用于登记曝光来源的实体
|
||||
* @param bringAppToFront 是否需要在不匹配 host 的时候把 APP 调回到前台 (如微信调起)
|
||||
*
|
||||
* @return 是否已拦截处理
|
||||
*/
|
||||
@JvmStatic
|
||||
fun interceptUrl(context: Context, url: String, entrance: String, bringAppToFront: Boolean = false): Boolean {
|
||||
fun interceptUrl(context: Context, url: String,
|
||||
traceEvent: ExposureEvent? = null,
|
||||
entrance: String,
|
||||
bringAppToFront: Boolean = false): Boolean {
|
||||
val uri = Uri.parse(url)
|
||||
if ("ghzhushou" == uri.scheme) {
|
||||
Utils.log("url = $url")
|
||||
@ -82,6 +90,7 @@ object DefaultUrlHandler {
|
||||
id = id,
|
||||
tab = uri.getQueryParameter("to"),
|
||||
autoDownload = uri.getQueryParameter("auto_download") == "true",
|
||||
traceEvent = traceEvent,
|
||||
entrance = entrance
|
||||
)
|
||||
|
||||
@ -90,6 +99,7 @@ object DefaultUrlHandler {
|
||||
id,
|
||||
uri.getQueryParameter("name"),
|
||||
false,
|
||||
null,
|
||||
entrance
|
||||
)
|
||||
|
||||
@ -340,7 +350,8 @@ object DefaultUrlHandler {
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_FORUM_DETAIL -> {
|
||||
DirectUtils.directForumDetail(context, id, entrance)
|
||||
val sectionId = uri.getQueryParameter("section_id") ?: ""
|
||||
DirectUtils.directForumDetailSection(context, id, sectionId, entrance)
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_GAME_RATING_DETAIL -> {
|
||||
@ -428,17 +439,17 @@ object DefaultUrlHandler {
|
||||
directToFeedback(
|
||||
context,
|
||||
content,
|
||||
null,
|
||||
isQaFeedback,
|
||||
qaContentId,
|
||||
isPlugin = false,
|
||||
isSmoothGame = false,
|
||||
EntranceConsts.ENTRANCE_BROWSER
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_HELP_AND_FEEDBACK -> {
|
||||
val position = uri.getQueryParameter("position") ?: ""
|
||||
DirectUtils.directToHelpAndFeedback(context, position.toInt())
|
||||
DirectUtils.directToHelpAndFeedback(context)
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_HELP_DETAIL -> {
|
||||
@ -467,7 +478,7 @@ object DefaultUrlHandler {
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_GAME_COLLECTION_DETAIL -> {
|
||||
DirectUtils.directToGameCollectionDetail(context, id, entrance)
|
||||
DirectUtils.directToGameCollectionDetail(context, id, entrance, traceEvent = traceEvent)
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_GAME_COLLECTION_SQUARE -> {
|
||||
@ -479,12 +490,13 @@ object DefaultUrlHandler {
|
||||
val activityName = uri.getQueryParameter("activity_name") ?: ""
|
||||
val gameId = uri.getQueryParameter("game_id") ?: ""
|
||||
context.startActivity(
|
||||
GameCollectionEditActivity.getIntent(
|
||||
GameCollectionEditActivity.getCreateIntent(
|
||||
context,
|
||||
activityId,
|
||||
activityName,
|
||||
gameId,
|
||||
entrance
|
||||
entrance,
|
||||
"其他"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ object FixedRateJobHelper {
|
||||
private const val CHECKER_PERIOD: Long = 15 * 1000L
|
||||
private const val TIME_PERIOD: Long = 10 * 60 * 1000L
|
||||
private const val LOGHUB_PERIOD: Long = 2 * 60 * 1000L
|
||||
private const val EXPOSURE_PERIOD: Long = 5 * 60 * 1000L
|
||||
private const val EXPOSURE_PERIOD: Long = 1 * 60 * 1000L
|
||||
private const val REGION_SETTING_PERIOD: Long = 60 * 1000L
|
||||
private const val VIDEO_RECORD_PERIOD: Long = 60 * 1000L
|
||||
|
||||
@ -84,11 +84,6 @@ object FixedRateJobHelper {
|
||||
VideoRecordUtils.commitVideoRecord()
|
||||
}
|
||||
|
||||
// 获取启动广告 (第一次不需要获取)
|
||||
if (elapsedTime % STARTUP_AD == 0L && mExecuteCount != 0) {
|
||||
AdHelper.getSettingAdCache()
|
||||
}
|
||||
|
||||
mExecuteCount++
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,20 +2,21 @@ package com.gh.common.chain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.download.server.BrowserInstallHelper
|
||||
import com.gh.gamecenter.core.utils.EmptyCallback
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class BrowserInstallHandler : ChainHandler() {
|
||||
class BrowserInstallHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
BrowserInstallHelper.showBrowserInstallHintDialog(context, gameEntity.isVGame(), object : EmptyCallback {
|
||||
override fun onCallback() {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
}
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
BrowserInstallHelper.showBrowserInstallHintDialog(
|
||||
context,
|
||||
gameEntity,
|
||||
asVGame || gameEntity.isSplitXApk()
|
||||
) {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,14 +4,14 @@ import android.content.Context
|
||||
import com.gh.common.dialog.CertificationDialog
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class CertificationHandler : ChainHandler() {
|
||||
class CertificationHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
CertificationDialog.showCertificationDialog(context, gameEntity) {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
package com.gh.common.chain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
abstract class ChainHandler {
|
||||
private var next: ChainHandler? = null
|
||||
var processEndCallback: ((Any?) -> Unit)? = null
|
||||
|
||||
fun setNext(next: ChainHandler?) {
|
||||
this.next = next
|
||||
}
|
||||
|
||||
fun getNext(): ChainHandler? {
|
||||
return next
|
||||
}
|
||||
|
||||
fun hasNext(): Boolean {
|
||||
return next != null
|
||||
}
|
||||
|
||||
abstract fun handleRequest(context: Context, gameEntity: GameEntity)
|
||||
|
||||
}
|
||||
@ -5,15 +5,15 @@ import com.gh.common.util.DialogUtils
|
||||
import com.gh.gamecenter.common.utils.safelyGetInRelease
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class CheckDownloadHandler : ChainHandler() {
|
||||
class CheckDownloadHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
|
||||
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
|
||||
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(isSubscribe)
|
||||
processEndCallback?.invoke(asVGame, isSubscribe)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,20 +2,22 @@ package com.gh.common.chain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.gamecenter.common.utils.PermissionHelper
|
||||
import com.gh.gamecenter.core.utils.EmptyCallback
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class CheckStoragePermissionHandler : ChainHandler() {
|
||||
class CheckStoragePermissionHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
PermissionHelper.checkStoragePermissionBeforeAction(context, object : EmptyCallback {
|
||||
override fun onCallback() {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
}
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
PermissionHelper.checkStoragePermissionBeforeAction(
|
||||
context,
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: "",
|
||||
gameEntity.categoryChinese
|
||||
) {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,22 +1,22 @@
|
||||
package com.gh.common.chain
|
||||
|
||||
class ChainBuilder {
|
||||
class DownloadChainBuilder {
|
||||
|
||||
private val handlers: MutableList<ChainHandler> = ArrayList()
|
||||
private val handlers: MutableList<DownloadChainHandler> = ArrayList()
|
||||
|
||||
private var processEndCallback: ((Any?) -> Unit)? = null
|
||||
private var processEndCallback: ((asVGame: Boolean, Any?) -> Unit)? = null
|
||||
|
||||
fun setProcessEndCallback(callback: (Any?) -> Unit): ChainBuilder {
|
||||
fun setProcessEndCallback(callback: (asVGame: Boolean, Any?) -> Unit): DownloadChainBuilder {
|
||||
processEndCallback = callback
|
||||
return this
|
||||
}
|
||||
|
||||
fun addHandler(handler: ChainHandler): ChainBuilder {
|
||||
fun addHandler(handler: DownloadChainHandler): DownloadChainBuilder {
|
||||
handlers.add(handler)
|
||||
return this
|
||||
}
|
||||
|
||||
fun buildHandlerChain(): ChainHandler? {
|
||||
fun buildHandlerChain(): DownloadChainHandler? {
|
||||
for (i in handlers.indices) {
|
||||
handlers[i].processEndCallback = processEndCallback
|
||||
if (i + 1 < handlers.size) {
|
||||
@ -0,0 +1,40 @@
|
||||
package com.gh.common.chain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
abstract class DownloadChainHandler {
|
||||
private var next: DownloadChainHandler? = null
|
||||
|
||||
// asVGame: 当前下载是否以畅玩游戏来进行
|
||||
var processEndCallback: ((asVGame: Boolean, Any?) -> Unit)? = null
|
||||
|
||||
/**
|
||||
* 设置下一个处理者
|
||||
*/
|
||||
fun setNext(next: DownloadChainHandler?) {
|
||||
this.next = next
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下一个处理者
|
||||
*/
|
||||
fun getNext(): DownloadChainHandler? {
|
||||
return next
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否存在下一个处理者
|
||||
*/
|
||||
fun hasNext(): Boolean {
|
||||
return next != null
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理请求
|
||||
* @param gameEntity 游戏实体
|
||||
* @param asVGame 是否作为畅玩游戏进行
|
||||
*/
|
||||
abstract fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean)
|
||||
|
||||
}
|
||||
@ -3,21 +3,18 @@ package com.gh.common.chain
|
||||
import android.content.Context
|
||||
import com.gh.common.util.DownloadDialogHelper
|
||||
import com.gh.gamecenter.common.utils.safelyGetInRelease
|
||||
import com.gh.gamecenter.core.utils.EmptyCallback
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class DownloadDialogHelperHandler : ChainHandler() {
|
||||
class DownloadDialogHelperHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
|
||||
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, object : EmptyCallback {
|
||||
override fun onCallback() {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
}
|
||||
DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk) {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,14 +5,14 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
|
||||
|
||||
class GamePermissionHandler : ChainHandler() {
|
||||
class GamePermissionHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package com.gh.common.chain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class LandPageAddressHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
if (gameEntity.isLandPageAddressDialog()) {
|
||||
DialogUtils.showLandPageAddressDialog(context, gameEntity) {// 跳转第三方落地页
|
||||
DirectUtils.directToExternalBrowser(context, gameEntity.landPageAddressDialog!!.link!!)
|
||||
}
|
||||
} else {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,14 +4,22 @@ import android.content.Context
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class OverseaDownloadHandler : ChainHandler() {
|
||||
class OverseaDownloadHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
DialogUtils.showOverseaDownloadDialog(context, gameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
if (gameEntity.isOverseaAddressDialog()) {
|
||||
DialogUtils.showOverseaDownloadDialog(context, gameEntity) {// 跳转海外下载地址弹窗
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,14 +5,14 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.common.dialog.PackageCheckDialogFragment
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class PackageCheckHandler : ChainHandler() {
|
||||
class PackageCheckHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
PackageCheckDialogFragment.show((context as AppCompatActivity), gameEntity) {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package com.gh.common.chain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.gamecenter.common.utils.DialogHelper
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class UnsupportedFeatureHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(
|
||||
context: Context,
|
||||
gameEntity: GameEntity,
|
||||
asVGame: Boolean
|
||||
) {
|
||||
if (shouldShowUnsupportedFeatureDialog()) {
|
||||
DialogHelper.showUnsupportedFeatureDialog(context)
|
||||
} else {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 检查某个版本是否支持指定的功能
|
||||
*/
|
||||
private fun shouldShowUnsupportedFeatureDialog(): Boolean = false
|
||||
}
|
||||
@ -5,31 +5,27 @@ import com.gh.common.simulator.NewSimulatorGameManager
|
||||
import com.gh.common.simulator.SimulatorGameManager
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class UpdateNewSimulatorHandler: ChainHandler() {
|
||||
class UpdateNewSimulatorHandler: DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
|
||||
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
|
||||
NewSimulatorGameManager.showUpdateNewsSimulator(context) {
|
||||
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity) {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -4,15 +4,23 @@ import android.content.Context
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.vspace.VHelper
|
||||
|
||||
class ValidateVSpaceHandler : ChainHandler() {
|
||||
class ValidateVSpaceHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
VHelper.validateVSpaceBeforeAction(context, gameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
val closure = {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
|
||||
if (asVGame) {
|
||||
VHelper.validateVSpaceBeforeAction(context, gameEntity) {
|
||||
closure.invoke()
|
||||
}
|
||||
} else {
|
||||
closure.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,29 +3,59 @@ package com.gh.common.chain
|
||||
import android.content.Context
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.DialogHelper
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.common.utils.toResString
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class VersionNumberHandler : ChainHandler() {
|
||||
class VersionNumberHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity) {
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
val confirmCallback = {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity)
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(null)
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
if (!gameEntity.isShowVersionNumber()) {
|
||||
confirmCallback.invoke()
|
||||
} else {
|
||||
SensorsBridge.trackGameDemoDialogShow(
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "",
|
||||
gameType = gameEntity.categoryChinese
|
||||
)
|
||||
DialogHelper.showGuideDialog(
|
||||
context,
|
||||
"温馨提示",
|
||||
gameEntity.getVersionNumberString(),
|
||||
"继续下载",
|
||||
R.string.cancel.toResString(),
|
||||
{ confirmCallback.invoke() },
|
||||
{
|
||||
confirmCallback.invoke()
|
||||
SensorsBridge.trackGameDemoDialogClick(
|
||||
buttonName = "继续下载",
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "",
|
||||
gameType = gameEntity.categoryChinese
|
||||
)
|
||||
},
|
||||
cancelClickCallback = {
|
||||
SensorsBridge.trackGameDemoDialogClick(
|
||||
buttonName = R.string.cancel.toResString(),
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "",
|
||||
gameType = gameEntity.categoryChinese
|
||||
)
|
||||
},
|
||||
touchOutsideCallback = {
|
||||
SensorsBridge.trackGameDemoDialogClick(
|
||||
buttonName = "关闭弹窗",
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "",
|
||||
gameType = gameEntity.categoryChinese
|
||||
)
|
||||
},
|
||||
extraConfig = DialogHelper.Config(titleIcon = R.drawable.ic_dialog_tips)
|
||||
)
|
||||
}
|
||||
|
||||
@ -205,9 +205,6 @@ public class Config {
|
||||
|
||||
// 加载完设置后刷新下
|
||||
PackageHelper.initList();
|
||||
|
||||
// 初始化畅玩相关的东西
|
||||
VHelper.init(HaloApp.getInstance());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -308,6 +305,26 @@ public class Config {
|
||||
return mVSetting;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求网络数据,尝试刷新畅玩相关配置
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public static void refreshVSettingEntity() {
|
||||
RetrofitManager.getInstance()
|
||||
.getVApi().getSettings(BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BiResponse<VSetting>() {
|
||||
@Override
|
||||
public void onSuccess(VSetting data) {
|
||||
mVSetting = data;
|
||||
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
|
||||
|
||||
VHelper.init(HaloApp.getInstance());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static GameGuidePopupEntity getGameGuidePopupEntity() {
|
||||
return mGameGuidePopupEntity;
|
||||
@ -385,16 +402,7 @@ public class Config {
|
||||
}
|
||||
});
|
||||
|
||||
RetrofitManager.getInstance()
|
||||
.getVApi().getSettings(BuildConfig.VERSION_NAME)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new BiResponse<VSetting>() {
|
||||
@Override
|
||||
public void onSuccess(VSetting data) {
|
||||
mVSetting = data;
|
||||
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
|
||||
}
|
||||
});
|
||||
refreshVSettingEntity();
|
||||
|
||||
RetrofitManager.getInstance()
|
||||
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)
|
||||
@ -451,7 +459,6 @@ public class Config {
|
||||
DarkModeUtils.INSTANCE.updateFollowSystemDarkModeToSp(true);
|
||||
DarkModeUtils.INSTANCE.initDarkMode();
|
||||
}
|
||||
AdHelper.prefetchStartUpAd(mNewApiSettingsEntity);
|
||||
SPUtils.setString(Constants.SP_NEW_API_SETTINGS, GsonUtils.toJson(data));
|
||||
}
|
||||
});
|
||||
|
||||
@ -13,14 +13,14 @@ import android.widget.PopupWindow
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.databinding.BindingAdapter
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.callback.OnViewClickListener
|
||||
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.toDrawable
|
||||
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.databinding.KaifuAddItemBinding
|
||||
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupBinding
|
||||
import com.gh.gamecenter.databinding.LayoutPopupContainerBinding
|
||||
import com.gh.gamecenter.feature.entity.ServerCalendarEntity
|
||||
import com.gh.gamecenter.servers.add.AddKaiFuPopupAdapter
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
@ -1,34 +1,31 @@
|
||||
package com.gh.common.databind;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.common.chain.BrowserInstallHandler;
|
||||
import com.gh.common.chain.CertificationHandler;
|
||||
import com.gh.common.chain.ChainBuilder;
|
||||
import com.gh.common.chain.ChainHandler;
|
||||
import com.gh.common.chain.DownloadChainBuilder;
|
||||
import com.gh.common.chain.DownloadChainHandler;
|
||||
import com.gh.common.chain.CheckDownloadHandler;
|
||||
import com.gh.common.chain.CheckStoragePermissionHandler;
|
||||
import com.gh.common.chain.DownloadDialogHelperHandler;
|
||||
import com.gh.common.chain.GamePermissionHandler;
|
||||
import com.gh.common.chain.LandPageAddressHandler;
|
||||
import com.gh.common.chain.OverseaDownloadHandler;
|
||||
import com.gh.common.chain.PackageCheckHandler;
|
||||
import com.gh.common.chain.UnsupportedFeatureHandler;
|
||||
import com.gh.common.chain.ValidateVSpaceHandler;
|
||||
import com.gh.common.chain.VersionNumberHandler;
|
||||
import com.gh.common.constant.Config;
|
||||
@ -43,32 +40,26 @@ import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.GameUtils;
|
||||
import com.gh.common.util.GameViewUtils;
|
||||
import com.gh.common.util.LogUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.common.util.PackageInstaller;
|
||||
import com.gh.common.util.PackageLauncher;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.ReservationHelper;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.dialog.DownloadDialog;
|
||||
import com.gh.download.server.BrowserInstallHelper;
|
||||
import com.gh.gamecenter.DownloadManagerActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.common.baselist.LoadStatus;
|
||||
import com.gh.gamecenter.common.callback.OnViewClickListener;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.common.utils.DarkModeUtils;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.common.view.DrawableView;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.core.utils.NumberUtils;
|
||||
import com.gh.gamecenter.databinding.KaifuDetailItemRowBinding;
|
||||
import com.gh.gamecenter.core.utils.ToastUtils;
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity;
|
||||
import com.gh.gamecenter.feature.entity.CommunityVideoEntity;
|
||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation;
|
||||
import com.gh.gamecenter.feature.entity.ServerCalendarEntity;
|
||||
import com.gh.gamecenter.feature.entity.TagStyleEntity;
|
||||
import com.gh.gamecenter.feature.entity.TestEntity;
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent;
|
||||
@ -77,14 +68,11 @@ import com.gh.gamecenter.feature.view.DownloadButton;
|
||||
import com.gh.gamecenter.feature.view.GameIconView;
|
||||
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.gh.vspace.VDownloadManagerActivity;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.FileUtils;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -92,134 +80,8 @@ import java.util.List;
|
||||
/**
|
||||
* Created by khy on 12/02/18.
|
||||
*/
|
||||
|
||||
public class BindingAdapters {
|
||||
|
||||
public static void loadIcon(SimpleDraweeView view, String imageUrl) {
|
||||
ImageUtils.displayIcon(view, imageUrl);
|
||||
}
|
||||
|
||||
public static void loadImage(SimpleDraweeView view, String imageUrl) {
|
||||
ImageUtils.display(view, imageUrl);
|
||||
}
|
||||
|
||||
public static void setTextSize(TextView view, int number) {
|
||||
view.setTextSize(number);
|
||||
}
|
||||
|
||||
public static void setTypeface(TextView view, String type) {
|
||||
if (type == null) return;
|
||||
|
||||
switch (type) {
|
||||
case "bold":
|
||||
view.setTypeface(null, Typeface.BOLD);
|
||||
break;
|
||||
case "italic":
|
||||
view.setTypeface(null, Typeface.ITALIC);
|
||||
break;
|
||||
case "bold_italic":
|
||||
view.setTypeface(null, Typeface.BOLD_ITALIC);
|
||||
break;
|
||||
default:
|
||||
view.setTypeface(null, Typeface.NORMAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void addDetailKaiFuView(LinearLayout view, List<ServerCalendarEntity> list
|
||||
, OnViewClickListener listener, Boolean isReadyPatch) {
|
||||
if (list == null) return;
|
||||
view.removeAllViews();
|
||||
for (int i = 0; i < list.size() + 1; i++) { // 1 is Title
|
||||
View inflate = LayoutInflater.from(view.getContext()).inflate(R.layout.kaifu_detail_item_row, null);
|
||||
KaifuDetailItemRowBinding binding = KaifuDetailItemRowBinding.bind(inflate);
|
||||
binding.getRoot().setBackgroundColor(isReadyPatch != null && isReadyPatch ? ExtensionsKt.toColor(R.color.theme) : ExtensionsKt.toColor(R.color.white));
|
||||
binding.getRoot().setPadding(DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), i == list.size() ? DisplayUtils.dip2px(1) : 0);
|
||||
ServerCalendarEntity serverEntity = list.get(i - 1);
|
||||
binding.timeTv.setText(i == 0 ? "时间" : serverEntity.getFormatTime("HH:mm"));
|
||||
binding.remarkTv.setText(i == 0 ? "备注" : serverEntity.getRemark());
|
||||
binding.nameTv.setText(i == 0 ? "名字" : (TextUtils.isEmpty(serverEntity.getNote()) ? "-" : serverEntity.getNote()));
|
||||
if (i != 0) {
|
||||
binding.getRoot().setOnClickListener(v -> {
|
||||
listener.onClick(v, isReadyPatch != null && isReadyPatch ? serverEntity : null);
|
||||
});
|
||||
|
||||
// 滑动冲突处理
|
||||
binding.getRoot().setOnTouchListener((v, event) -> {
|
||||
if (list.size() > 5) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
EventBus.getDefault().post(new EBReuse("CalenderDown"));
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
EventBus.getDefault().post(new EBReuse("CalenderCancel"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
view.addView(inflate);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果超过10000,则转换为1.0W
|
||||
public static void transSimpleCount(TextView view, int count) {
|
||||
view.setText(NumberUtils.transSimpleCount(count));
|
||||
}
|
||||
|
||||
public static void textColorFromString(TextView tv, String hexString) {
|
||||
if (TextUtils.isEmpty(hexString)) return;
|
||||
|
||||
try {
|
||||
tv.setTextColor(Color.parseColor(hexString));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void showHide(View view, Boolean show) {
|
||||
if (show != null && show) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void goneIf(View view, Boolean gone) {
|
||||
if (gone != null && gone) {
|
||||
view.setVisibility(View.GONE);
|
||||
} else {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* lazy 的 paddingTop
|
||||
*/
|
||||
public static void lazyPaddingLeft(View view, int paddingLeftInDp) {
|
||||
view.setPadding(DisplayUtils.dip2px(paddingLeftInDp), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
|
||||
}
|
||||
|
||||
/**
|
||||
* lazy 的 paddingTop
|
||||
*/
|
||||
public static void lazyPaddingTop(View view, int paddingTopInDp) {
|
||||
view.setPadding(view.getPaddingLeft(), DisplayUtils.dip2px(paddingTopInDp), view.getPaddingRight(), view.getPaddingBottom());
|
||||
}
|
||||
|
||||
/**
|
||||
* lazy 的 paddingBottom
|
||||
*/
|
||||
public static void lazyPaddingBottom(View view, int paddingBottomInDp) {
|
||||
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), DisplayUtils.dip2px(paddingBottomInDp));
|
||||
}
|
||||
|
||||
public static void visibleInvisible(View view, Boolean show) {
|
||||
if (show != null && show) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setMessageUnread(TextView view, int unreadCount) {
|
||||
if (unreadCount < 100) {
|
||||
view.setText(String.valueOf(unreadCount));
|
||||
@ -228,119 +90,12 @@ public class BindingAdapters {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setServerTypePadding(TextView view, String serverType) {
|
||||
int paddRight = 0;
|
||||
if (TextUtils.isEmpty(serverType)) {
|
||||
} else {
|
||||
if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) {
|
||||
if ("删档内测".equals(serverType)) {
|
||||
paddRight = DisplayUtils.dip2px(view.getContext(), 50);
|
||||
} else {
|
||||
paddRight = DisplayUtils.dip2px(view.getContext(), 60);
|
||||
}
|
||||
} else {
|
||||
paddRight = DisplayUtils.dip2px(view.getContext(), 30);
|
||||
}
|
||||
}
|
||||
view.setPadding(0, 0, paddRight, 0);
|
||||
}
|
||||
|
||||
public static void setServerType(TextView view, String serverType) {
|
||||
view.setText(serverType);
|
||||
if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) {
|
||||
view.setBackgroundResource(R.drawable.textview_server_tag);
|
||||
} else {
|
||||
view.setBackgroundResource(R.drawable.textview_orange_up);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGame(View view, GameEntity gameEntity) {
|
||||
if (gameEntity != null && view instanceof GameIconView) {
|
||||
((GameIconView) view).displayGameIcon(gameEntity);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGameIcon(View view, GameEntity gameEntity) {
|
||||
if (gameEntity != null && view instanceof GameIconView) {
|
||||
((GameIconView) view).displayGameIcon(gameEntity.getIcon(), gameEntity.getIconSubscript(), gameEntity.getIconFloat());
|
||||
}
|
||||
}
|
||||
|
||||
public static void setArticleType(TextView view, String articleType) {
|
||||
NewsUtils.setNewsType(view, articleType, 0, 0);
|
||||
}
|
||||
|
||||
public static void setDetailDownloadText(TextView view, GameEntity gameEntity) {
|
||||
if (gameEntity == null || gameEntity.getApk().isEmpty()) {
|
||||
view.setBackgroundResource(R.drawable.game_item_btn_pause_style);
|
||||
view.setTextColor(0xFF999999);
|
||||
view.setClickable(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setLiBaoBtn(TextView view, String status) {
|
||||
if (TextUtils.isEmpty(status)) return;
|
||||
switch (status) {
|
||||
case "coming":
|
||||
view.setText(R.string.libao_coming);
|
||||
view.setBackgroundResource(R.drawable.textview_blue_style);
|
||||
break;
|
||||
case "ling":
|
||||
view.setText(R.string.libao_ling);
|
||||
view.setBackgroundResource(R.drawable.textview_green_style);
|
||||
break;
|
||||
case "tao":
|
||||
view.setText(R.string.libao_tao);
|
||||
view.setBackgroundResource(R.drawable.textview_orange_style);
|
||||
break;
|
||||
case "used_up":
|
||||
view.setText(R.string.libao_used_up);
|
||||
view.setBackgroundResource(R.drawable.textview_cancel_up);
|
||||
break;
|
||||
case "finish":
|
||||
view.setText(R.string.libao_finish);
|
||||
view.setBackgroundResource(R.drawable.textview_cancel_up);
|
||||
break;
|
||||
case "linged":
|
||||
view.setText(R.string.libao_linged);
|
||||
view.setBackgroundResource(R.drawable.libao_linged_style);
|
||||
view.setTextColor(ContextCompat.getColorStateList(view.getContext(), R.color.libao_linged_selector));
|
||||
break;
|
||||
case "taoed":
|
||||
view.setText(R.string.libao_taoed);
|
||||
view.setBackgroundResource(R.drawable.libao_taoed_style);
|
||||
view.setTextColor(ContextCompat.getColorStateList(view.getContext(), R.color.libao_taoed_selector));
|
||||
break;
|
||||
case "copy":
|
||||
view.setText(R.string.libao_copy);
|
||||
view.setBackgroundResource(R.drawable.textview_blue_style);
|
||||
break;
|
||||
case "repeatLing":
|
||||
view.setText(R.string.libao_repeat_ling);
|
||||
view.setBackgroundResource(R.drawable.textview_cancel_up);
|
||||
break;
|
||||
case "repeatLinged":
|
||||
view.setText(R.string.libao_repeat_ling);
|
||||
view.setBackgroundResource(R.drawable.textview_green_style);
|
||||
break;
|
||||
case "repeatTao":
|
||||
view.setText(R.string.libao_repeat_tao);
|
||||
view.setBackgroundResource(R.drawable.textview_cancel_up);
|
||||
break;
|
||||
case "repeatTaoed":
|
||||
view.setText(R.string.libao_repeat_tao);
|
||||
view.setBackgroundResource(R.drawable.textview_orange_style);
|
||||
break;
|
||||
case "unshelve":
|
||||
view.setBackgroundResource(R.drawable.textview_cancel_style);
|
||||
view.setText(R.string.libao_unshelve);
|
||||
break;
|
||||
default:
|
||||
view.setBackgroundResource(R.drawable.textview_cancel_style);
|
||||
view.setText("异常");
|
||||
}
|
||||
}
|
||||
|
||||
// 大图下的进度条
|
||||
public static void setDownloadButton(DownloadButton progressBar,
|
||||
GameEntity gameEntity,
|
||||
@ -368,13 +123,9 @@ public class BindingAdapters {
|
||||
switch (progressBar.getButtonStyle()) {
|
||||
case DOWNLOADING_PLUGIN:
|
||||
case DOWNLOADING_NORMAL:
|
||||
if (gameEntity.isVGame()) {
|
||||
v.getContext().startActivity(VDownloadManagerActivity.getIntent(v.getContext(), true));
|
||||
} else {
|
||||
Intent intent = DownloadManagerActivity.getDownloadMangerIntent(v.getContext(),
|
||||
gameEntity.getApk().get(0).getUrl(), entrance);
|
||||
v.getContext().startActivity(intent);
|
||||
}
|
||||
Intent intent = DownloadManagerActivity.getDownloadMangerIntent(v.getContext(),
|
||||
gameEntity.getApk().get(0).getUrl(), entrance);
|
||||
v.getContext().startActivity(intent);
|
||||
break;
|
||||
case NONE:
|
||||
Utils.toast(v.getContext(), "该游戏已关闭下载");
|
||||
@ -392,12 +143,13 @@ public class BindingAdapters {
|
||||
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(v.getContext(), gameEntity.getSimulator().getApk().getPackageName());
|
||||
if (downloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled) {
|
||||
SimulatorDownloadManager.getInstance().showDownloadDialog(v.getContext(), gameEntity.getSimulator(),
|
||||
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.getId(), gameEntity.getName(), null);
|
||||
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.getId(), gameEntity.getName(), gameEntity.getCategoryChinese(), null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ChainBuilder builder = new ChainBuilder();
|
||||
DownloadChainBuilder builder = new DownloadChainBuilder();
|
||||
builder.addHandler(new UnsupportedFeatureHandler());
|
||||
builder.addHandler(new GamePermissionHandler());
|
||||
builder.addHandler(new CheckStoragePermissionHandler());
|
||||
builder.addHandler(new ValidateVSpaceHandler());
|
||||
@ -406,24 +158,37 @@ public class BindingAdapters {
|
||||
builder.addHandler(new DownloadDialogHelperHandler());
|
||||
builder.addHandler(new CertificationHandler());
|
||||
builder.addHandler(new VersionNumberHandler());
|
||||
builder.addHandler(new LandPageAddressHandler());
|
||||
builder.addHandler(new OverseaDownloadHandler());
|
||||
builder.addHandler(new CheckDownloadHandler());
|
||||
|
||||
builder.setProcessEndCallback(o -> {
|
||||
download(progressBar, gameEntity, traceEvent, (boolean) o, entrance, location);
|
||||
builder.setProcessEndCallback((asVGame, isSubscribe) -> {
|
||||
download(v.getContext(),
|
||||
progressBar,
|
||||
gameEntity,
|
||||
traceEvent,
|
||||
asVGame,
|
||||
(boolean) isSubscribe,
|
||||
entrance,
|
||||
location);
|
||||
return null;
|
||||
});
|
||||
final ChainHandler chainHandler = builder.buildHandlerChain();
|
||||
final DownloadChainHandler chainHandler = builder.buildHandlerChain();
|
||||
if (chainHandler != null) {
|
||||
chainHandler.handleRequest(v.getContext(), gameEntity);
|
||||
chainHandler.handleRequest(
|
||||
v.getContext(),
|
||||
gameEntity,
|
||||
GameUtils.shouldPerformAsVGame(gameEntity)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ChainBuilder builder = new ChainBuilder();
|
||||
DownloadChainBuilder builder = new DownloadChainBuilder();
|
||||
builder.addHandler(new UnsupportedFeatureHandler());
|
||||
builder.addHandler(new GamePermissionHandler());
|
||||
builder.addHandler(new CertificationHandler());
|
||||
builder.addHandler(new VersionNumberHandler());
|
||||
|
||||
builder.setProcessEndCallback(o -> {
|
||||
builder.setProcessEndCallback((asVGame, isSubscribe) -> {
|
||||
DownloadDialog.showDownloadDialog(
|
||||
v.getContext(),
|
||||
gameEntity,
|
||||
@ -432,9 +197,13 @@ public class BindingAdapters {
|
||||
location + ":" + gameEntity.getName());
|
||||
return null;
|
||||
});
|
||||
final ChainHandler chainHandler = builder.buildHandlerChain();
|
||||
final DownloadChainHandler chainHandler = builder.buildHandlerChain();
|
||||
if (chainHandler != null) {
|
||||
chainHandler.handleRequest(v.getContext(), gameEntity);
|
||||
chainHandler.handleRequest(
|
||||
v.getContext(),
|
||||
gameEntity,
|
||||
GameUtils.shouldPerformAsVGame(gameEntity)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -447,7 +216,14 @@ public class BindingAdapters {
|
||||
if (downloadEntity != null) {
|
||||
File file = new File(downloadEntity.getPath());
|
||||
if (!file.exists()) {
|
||||
download(progressBar, gameEntity, traceEvent, false, entrance, location);
|
||||
download(v.getContext(),
|
||||
progressBar,
|
||||
gameEntity,
|
||||
traceEvent,
|
||||
false,
|
||||
false,
|
||||
entrance,
|
||||
location);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -456,12 +232,7 @@ public class BindingAdapters {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch((AppCompatActivity) v.getContext(), gameEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
PackageUtils.launchApplicationByPackageName(v.getContext(), gameEntity.getApk().get(0).getPackageName());
|
||||
PackageLauncher.launch(v.getContext(), gameEntity, null);
|
||||
} else {
|
||||
DownloadDialog.showDownloadDialog(
|
||||
v.getContext(),
|
||||
@ -474,15 +245,27 @@ public class BindingAdapters {
|
||||
case INSTALL_PLUGIN:
|
||||
case INSTALL_NORMAL:
|
||||
if (gameEntity.getApk().size() == 1) {
|
||||
|
||||
NewFlatLogUtils.INSTANCE.logGameInstall(
|
||||
gameEntity.getId(),
|
||||
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||
"主动安装"
|
||||
);
|
||||
|
||||
SensorsBridge.trackInstallGameClick(
|
||||
gameEntity.getId(),
|
||||
gameEntity.getName() != null ? gameEntity.getName() : "",
|
||||
"主动安装"
|
||||
);
|
||||
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
|
||||
|
||||
if (gameEntity.isVGame()) {
|
||||
VHelper.installOrLaunch(v.getContext(), gameEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
if (downloadEntity != null) {
|
||||
PackageInstaller.install(v.getContext(), downloadEntity);
|
||||
if (ExtensionsKt.isLocalDownloadInDualDownloadMode(downloadEntity)) {
|
||||
PackageInstaller.install(v.getContext(), downloadEntity);
|
||||
} else {
|
||||
VHelper.installOrLaunch(v.getContext(), gameEntity, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -568,7 +351,7 @@ public class BindingAdapters {
|
||||
}
|
||||
|
||||
} else {
|
||||
String status = GameUtils.getDownloadBtnText(progressBar.getContext(), gameEntity, PluginLocation.only_game);
|
||||
String status = GameUtils.getDownloadBtnText(progressBar.getContext(), gameEntity, true, false, PluginLocation.only_game);
|
||||
switch (status) {
|
||||
case "插件化":
|
||||
progressBar.setButtonStyle(DownloadButton.ButtonStyle.PLUGIN);
|
||||
@ -640,24 +423,6 @@ public class BindingAdapters {
|
||||
}
|
||||
}
|
||||
|
||||
/*private static void download(DownloadProgressBar progressBar, GameEntity gameEntity, ExposureEvent traceEvent, @Nullable String entrance, @Nullable String location, View v) {
|
||||
if (gameEntity.getApk().size() == 1) {
|
||||
ApkEntity apk = gameEntity.getApk().get(0);
|
||||
DownloadDialogHelper.findAvailableDialogAndShow(
|
||||
v.getContext(),
|
||||
gameEntity,
|
||||
apk,
|
||||
() -> {
|
||||
DialogUtils.checkDownload(v.getContext(), apk.getSize(),
|
||||
isSubscribe -> download(progressBar, gameEntity, traceEvent, isSubscribe, entrance, location));
|
||||
});
|
||||
} else {
|
||||
DownloadDialog.getInstance(v.getContext()).showPopupWindow(v, gameEntity,
|
||||
entrance, location + gameEntity.getName(), traceEvent);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
private static void updateReservation(DownloadButton progressBar, GameEntity gameEntity) {
|
||||
// 显示预约
|
||||
if (gameEntity.isReservable()) {
|
||||
@ -673,45 +438,39 @@ public class BindingAdapters {
|
||||
|
||||
|
||||
// 开始下载
|
||||
private static void download(DownloadButton progressBar,
|
||||
private static void download(Context context,
|
||||
DownloadButton progressBar,
|
||||
GameEntity gameEntity,
|
||||
ExposureEvent traceEvent,
|
||||
boolean asVGame,
|
||||
boolean isSubscribe,
|
||||
String entrance,
|
||||
String location) {
|
||||
String str = progressBar.getText().toString();
|
||||
String method;
|
||||
if (str.contains("更新")) {
|
||||
method = "更新";
|
||||
} else if (str.contains("插件化")) {
|
||||
method = "插件化";
|
||||
} else {
|
||||
method = progressBar.getContext().getString(R.string.download);
|
||||
if (BrowserInstallHelper.shouldAutoSwitchAssistantInstall(gameEntity)) {
|
||||
ToastUtils.toast(context.getString(R.string.unsupported_browser_install_hint));
|
||||
}
|
||||
String buttonText = progressBar.getText();
|
||||
ApkEntity apkEntity = gameEntity.getApk().get(0);
|
||||
String msg = FileUtils.isCanDownload(progressBar.getContext(), apkEntity.getSize());
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
DownloadManager.createDownload(progressBar.getContext(),
|
||||
apkEntity,
|
||||
gameEntity,
|
||||
method,
|
||||
asVGame,
|
||||
gameEntity.isDualBtnModeEnabled(),
|
||||
entrance,
|
||||
location + gameEntity.getName(),
|
||||
isSubscribe,
|
||||
traceEvent);
|
||||
|
||||
progressBar.setProgress(0);
|
||||
progressBar.setButtonStyle("插件化".equals(method) ?
|
||||
progressBar.setButtonStyle(buttonText.contains("插件化") ?
|
||||
DownloadButton.ButtonStyle.DOWNLOADING_PLUGIN : DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
|
||||
} else {
|
||||
Utils.toast(progressBar.getContext(), msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGameLabelList(LinearLayout layout, List<TagStyleEntity> tagStyle) {
|
||||
GameViewUtils.setLabelList(layout.getContext(), layout, tagStyle);
|
||||
}
|
||||
|
||||
// 包含测试开服标签
|
||||
public static void setGameTags(LinearLayout layout, GameEntity gameEntity) {
|
||||
try {
|
||||
@ -781,12 +540,6 @@ public class BindingAdapters {
|
||||
}
|
||||
}
|
||||
|
||||
public static void isRefreshing(SwipeRefreshLayout layout, LoadStatus status) {
|
||||
if (status != LoadStatus.INIT_LOADING && status != LoadStatus.LIST_LOADING) {
|
||||
layout.setRefreshing(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGameName(TextView view, GameEntity game, boolean isShowPlatform, @Nullable Boolean isShowSuffix) {
|
||||
if (isShowSuffix == null) isShowSuffix = true; // 默认显示
|
||||
String gameName;
|
||||
@ -808,30 +561,6 @@ public class BindingAdapters {
|
||||
|
||||
}
|
||||
|
||||
public static void setCommunityImage(SimpleDraweeView imageView, List<String> images, List<CommunityVideoEntity> videos) {
|
||||
if (videos.size() > 0) {
|
||||
CommunityVideoEntity videoEntity = videos.get(0);
|
||||
ImageUtils.display(imageView, videoEntity.getPoster());
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
} else if (images.size() > 0) {
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
ImageUtils.display(imageView, images.get(0));
|
||||
} else {
|
||||
imageView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setCommunityVideoDuration(TextView mVideoDuration, List<CommunityVideoEntity> videos) {
|
||||
if (videos != null && videos.size() > 0) {
|
||||
CommunityVideoEntity videoEntity = videos.get(0);
|
||||
mVideoDuration.setBackground(DrawableView.getOvalDrawable(R.color.black_alpha_50, 999F));
|
||||
mVideoDuration.setText(videoEntity.getDuration());
|
||||
mVideoDuration.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mVideoDuration.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGameTags(TextView view, List<TagStyleEntity> tags, int maxTags) {
|
||||
if (tags == null) {
|
||||
view.setText("");
|
||||
@ -859,16 +588,4 @@ public class BindingAdapters {
|
||||
}
|
||||
view.setText(span);
|
||||
}
|
||||
|
||||
public static void setVideoData(TextView view, int count) {
|
||||
if (count > 0) {
|
||||
ExtensionsKt.setDrawableStart(view, ContextCompat.getDrawable(view.getContext(), R.drawable.ic_video_data_up), null, null);
|
||||
view.setTextColor(ContextCompat.getColor(view.getContext(), R.color.text_EA3333));
|
||||
view.setText(count + "");
|
||||
} else {
|
||||
ExtensionsKt.removeDrawable(view);
|
||||
view.setTextColor(ContextCompat.getColor(view.getContext(), R.color.text_subtitleDesc));
|
||||
view.setText("-");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.common.dialog
|
||||
|
||||
import android.app.Activity.RESULT_OK
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
@ -18,13 +19,10 @@ import com.gh.common.xapk.XapkInstaller
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.PermissionHelper
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.utils.PermissionHelper.INSTALL_PERMISSION_CODE
|
||||
import com.gh.gamecenter.common.utils.getExtension
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.utils.Utils
|
||||
import kotlin.random.Random
|
||||
|
||||
class InstallPermissionDialogFragment : BaseDialogFragment() {
|
||||
@ -34,8 +32,11 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
|
||||
var url: String = ""
|
||||
var gameId: String = ""
|
||||
var gameName: String = ""
|
||||
var gameType: String = ""
|
||||
var mCallBack: ((isFromPermissionGrantedCallback: Boolean) -> Unit)? = null
|
||||
|
||||
private var dismissByTouchInside = false
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
mView = inflater.inflate(R.layout.dialog_install_permission, null, false)
|
||||
return mView
|
||||
@ -55,6 +56,12 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
|
||||
|
||||
if (isXapk) NewFlatLogUtils.logXApkInstallPermissionDialogShowed(gameId, gameName)
|
||||
|
||||
SensorsBridge.trackInstallPermissionDialogShow(
|
||||
gameId = gameId,
|
||||
gameName = gameName,
|
||||
gameType = gameType
|
||||
)
|
||||
|
||||
val randomNumber = if (isXapk) 1 else Random.nextInt(2)
|
||||
closeTv.goneIf(randomNumber == 0)
|
||||
closeIv.goneIf(randomNumber != 0)
|
||||
@ -64,18 +71,38 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
|
||||
}
|
||||
|
||||
closeTv.setOnClickListener {
|
||||
dismissByTouchInside = true
|
||||
if (isXapk) {
|
||||
NewFlatLogUtils.logXApkInstallPermissionDialogClick("尝试解压", false, gameId, gameName)
|
||||
mCallBack?.invoke(false)
|
||||
}
|
||||
SensorsBridge.trackInstallPermissionDialogClick(
|
||||
buttonName = "尝试解压",
|
||||
gameId = gameId,
|
||||
gameName = gameName,
|
||||
gameType = gameType
|
||||
)
|
||||
dismiss()
|
||||
}
|
||||
closeIv.setOnClickListener {
|
||||
dismissByTouchInside = true
|
||||
if (isXapk) NewFlatLogUtils.logXApkInstallPermissionDialogClick("关闭", false, gameId, gameName)
|
||||
SensorsBridge.trackInstallPermissionDialogClick(
|
||||
buttonName = "关闭",
|
||||
gameId = gameId,
|
||||
gameName = gameName,
|
||||
gameType = gameType
|
||||
)
|
||||
dismiss()
|
||||
}
|
||||
activateTv.setOnClickListener {
|
||||
NewFlatLogUtils.logXApkInstallPermissionDialogClick("立即开启", false, gameId, gameName)
|
||||
SensorsBridge.trackInstallPermissionDialogClick(
|
||||
buttonName = "立即开启",
|
||||
gameId = gameId,
|
||||
gameName = gameName,
|
||||
gameType = gameType
|
||||
)
|
||||
PermissionHelper.toInstallPermissionSetting(requireActivity())
|
||||
if (isXapk) {
|
||||
SPUtils.setString(Constants.SP_XAPK_UNZIP_ACTIVITY, requireActivity().javaClass.name)
|
||||
@ -84,9 +111,23 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
if (!dismissByTouchInside) {
|
||||
SensorsBridge.trackInstallPermissionDialogClick(
|
||||
buttonName = "关闭弹窗",
|
||||
gameId = gameId,
|
||||
gameName = gameName,
|
||||
gameType = gameType
|
||||
)
|
||||
}
|
||||
super.onDismiss(dialog)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (resultCode == RESULT_OK && requestCode == INSTALL_PERMISSION_CODE) {
|
||||
dismissByTouchInside = true
|
||||
|
||||
NewFlatLogUtils.logXApkInstallPermissionDialogClick("立即开启", true, gameId, gameName)
|
||||
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||
@ -136,6 +177,7 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
|
||||
installPermissionDialogFragment.url = downloadEntity.url
|
||||
installPermissionDialogFragment.gameId = downloadEntity.gameId
|
||||
installPermissionDialogFragment.gameName = downloadEntity.name
|
||||
installPermissionDialogFragment.gameType = downloadEntity.categoryChinese
|
||||
val transaction: FragmentTransaction = activity.supportFragmentManager.beginTransaction()
|
||||
transaction.show(installPermissionDialogFragment)
|
||||
transaction.commit()
|
||||
@ -146,6 +188,7 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
|
||||
this.url = downloadEntity.url
|
||||
this.gameId = downloadEntity.gameId
|
||||
this.gameName = downloadEntity.name
|
||||
this.gameType = downloadEntity.categoryChinese
|
||||
}
|
||||
installPermissionDialogFragment.show(
|
||||
activity.supportFragmentManager,
|
||||
|
||||
@ -2,6 +2,7 @@ package com.gh.common.dialog
|
||||
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.pm.PackageInfo
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
@ -11,6 +12,7 @@ import android.view.animation.LinearInterpolator
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@ -61,6 +63,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
||||
var gameEntity: GameEntity? = null
|
||||
var callBack: ConfirmListener? = null
|
||||
|
||||
private var mDismissByTouchInside = false
|
||||
|
||||
private val dataWatcher = object : DataWatcher() {
|
||||
override fun onDataChanged(downloadEntity: DownloadEntity) {
|
||||
val packageName = downloadEntity.packageName
|
||||
@ -90,6 +94,11 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
||||
EventBus.getDefault().register(this)
|
||||
gameEntity?.let {
|
||||
LogUtils.uploadPackageCheck("pkg_check_pop_click", "出现弹窗", it, "", "", "", "")
|
||||
SensorsBridge.trackPkgCheckDialogShow(
|
||||
gameId = it.id,
|
||||
gameName = it.name ?: "",
|
||||
gameType = it.categoryChinese
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +137,18 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
||||
"",
|
||||
""
|
||||
)
|
||||
SensorsBridge.trackPkgCheckDialogClick(
|
||||
buttonName = "点击链接",
|
||||
gameId = gameEntity?.id ?: "",
|
||||
gameName = gameEntity?.name ?: "",
|
||||
gameType = gameEntity?.categoryChinese ?: "",
|
||||
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
|
||||
binding.noRemindAgainCb.isChecked
|
||||
} else null,
|
||||
linkId = link.link ?: "",
|
||||
linkType = link.type ?: "",
|
||||
linkText = link.linkText ?: ""
|
||||
)
|
||||
DirectUtils.directToLinkPage(requireContext(), link, "包名检测弹窗", "")
|
||||
}.build()
|
||||
spanBuilder.append(linkSpan)
|
||||
@ -176,6 +197,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
||||
}
|
||||
val isAllPackageInstalled = isAllPackageInstalled(mAllInstalledPackages, entity)
|
||||
if (isAllPackageInstalled) {
|
||||
mDismissByTouchInside = true
|
||||
callBack?.onConfirm()
|
||||
dismissAllowingStateLoss()
|
||||
} else {
|
||||
@ -193,6 +215,15 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
||||
"",
|
||||
""
|
||||
)
|
||||
SensorsBridge.trackPkgCheckDialogClick(
|
||||
buttonName = "点击前往下载",
|
||||
gameId = gameEntity?.id ?: "",
|
||||
gameName = gameEntity?.name ?: "",
|
||||
gameType = gameEntity?.categoryChinese ?: "",
|
||||
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
|
||||
binding.noRemindAgainCb.isChecked
|
||||
} else null
|
||||
)
|
||||
DirectUtils.directToLinkPage(requireContext(), packageLink, "包名检测弹窗", "")
|
||||
}
|
||||
}
|
||||
@ -206,6 +237,19 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
||||
saveRecord(entity)
|
||||
LogUtils.uploadPackageCheck("pkg_check_pop_click", "不再提示", gameEntity, "", "", "", "")
|
||||
}
|
||||
|
||||
mDismissByTouchInside = true
|
||||
|
||||
SensorsBridge.trackPkgCheckDialogClick(
|
||||
buttonName = binding.cancelTv.text.toString(),
|
||||
gameId = gameEntity?.id ?: "",
|
||||
gameName = gameEntity?.name ?: "",
|
||||
gameType = gameEntity?.categoryChinese ?: "",
|
||||
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
|
||||
binding.noRemindAgainCb.isChecked
|
||||
} else null
|
||||
)
|
||||
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
}
|
||||
@ -300,6 +344,21 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
|
||||
DownloadManager.getInstance().removeObserver(dataWatcher)
|
||||
}
|
||||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
if (!mDismissByTouchInside) {
|
||||
SensorsBridge.trackPkgCheckDialogClick(
|
||||
buttonName = "关闭弹窗",
|
||||
gameId = gameEntity?.id ?: "",
|
||||
gameName = gameEntity?.name ?: "",
|
||||
gameType = gameEntity?.categoryChinese ?: "",
|
||||
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
|
||||
binding.noRemindAgainCb.isChecked
|
||||
} else null
|
||||
)
|
||||
}
|
||||
super.onDismiss(dialog)
|
||||
}
|
||||
|
||||
//安装、卸载事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
|
||||
@ -4,6 +4,8 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.LayoutManager
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import io.reactivex.functions.Consumer
|
||||
|
||||
@ -18,7 +20,7 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
|
||||
Consumer(Throwable::printStackTrace)
|
||||
)
|
||||
}
|
||||
var layoutManager: LinearLayoutManager? = null
|
||||
var layoutManager: LayoutManager? = null
|
||||
var visibleState: ExposureThrottleBus.VisibleState? = null
|
||||
|
||||
init {
|
||||
@ -47,12 +49,28 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
super.onScrolled(recyclerView, dx, dy)
|
||||
|
||||
if (layoutManager == null) layoutManager = recyclerView.layoutManager as LinearLayoutManager
|
||||
layoutManager = recyclerView.layoutManager
|
||||
|
||||
layoutManager?.run {
|
||||
visibleState =
|
||||
ExposureThrottleBus.VisibleState(findFirstVisibleItemPosition(), findLastVisibleItemPosition())
|
||||
throttleBus.postVisibleState(visibleState!!)
|
||||
if (layoutManager != null) {
|
||||
if (layoutManager is LinearLayoutManager) {
|
||||
(layoutManager as LinearLayoutManager).run {
|
||||
visibleState =
|
||||
ExposureThrottleBus.VisibleState(findFirstVisibleItemPosition(), findLastVisibleItemPosition())
|
||||
throttleBus.postVisibleState(visibleState!!)
|
||||
}
|
||||
} else if (layoutManager is StaggeredGridLayoutManager) {
|
||||
(recyclerView.layoutManager as StaggeredGridLayoutManager).run {
|
||||
val firstVisibleItemArray = IntArray(2)
|
||||
val lastVisibleItemArray = IntArray(2)
|
||||
|
||||
findFirstVisibleItemPositions(firstVisibleItemArray)
|
||||
findLastVisibleItemPositions(lastVisibleItemArray)
|
||||
|
||||
visibleState =
|
||||
ExposureThrottleBus.VisibleState(firstVisibleItemArray.first(), lastVisibleItemArray.first())
|
||||
throttleBus.postVisibleState(visibleState!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ object ExposureManager {
|
||||
fun log(eventList: List<ExposureEvent>) {
|
||||
AppExecutor.logExecutor.execute {
|
||||
for (event in eventList) {
|
||||
if (!exposureCache.contains(event.id)) {
|
||||
if (event != null && !exposureCache.contains(event.id)) {
|
||||
exposureSet.add(event)
|
||||
exposureCache.add(event.id)
|
||||
} else {
|
||||
|
||||
@ -48,6 +48,7 @@ object ExposureUtils {
|
||||
}
|
||||
if (!TextUtils.isEmpty(entity.id)) {
|
||||
ExposureManager.log(exposureEvent)
|
||||
ExposureManager.commitSavedExposureEvents(forcedUpload = true)
|
||||
}
|
||||
return exposureEvent
|
||||
}
|
||||
@ -61,17 +62,17 @@ object ExposureUtils {
|
||||
host: String? = "unknown",
|
||||
path: String? = "unknown",
|
||||
downloadType: DownloadType
|
||||
) {
|
||||
): ExposureEvent? {
|
||||
val gameEntity = entity.copy()
|
||||
gameEntity.platform = platform
|
||||
gameEntity.downloadCompleteType = downloadType.toString()
|
||||
val traceEvent = trace?.toObject<ExposureEvent>()
|
||||
|
||||
if (TextUtils.isEmpty(entity.id)) return
|
||||
if (TextUtils.isEmpty(entity.id)) return null
|
||||
|
||||
// 避免生成 trace 相同的下载完成事件,根据日志看下载完成的同一秒有可能生成两条
|
||||
if (mDownloadCompleteTraceEventIdSet.contains(traceEvent?.id)) {
|
||||
return
|
||||
return null
|
||||
}
|
||||
|
||||
traceEvent?.payload?.gameId?.let { mDownloadCompleteTraceEventIdSet.add(it) }
|
||||
@ -90,12 +91,14 @@ object ExposureUtils {
|
||||
|
||||
ExposureManager.log(exposureEvent)
|
||||
ExposureManager.commitSavedExposureEvents(forcedUpload = true)
|
||||
|
||||
return exposureEvent
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getDownloadType(apkEntity: ApkEntity, gameId: String, isVGame: Boolean): DownloadType {
|
||||
fun getDownloadType(apkEntity: ApkEntity, gameId: String, asVGame: Boolean): DownloadType {
|
||||
return when {
|
||||
isVGame -> getVGameDownloadType(apkEntity, gameId)
|
||||
asVGame -> getVGameDownloadType(apkEntity, gameId)
|
||||
PackageUtils.isInstalled(
|
||||
HaloApp.getInstance().application,
|
||||
apkEntity.packageName
|
||||
@ -106,7 +109,7 @@ object ExposureUtils {
|
||||
|
||||
private fun getVGameDownloadType(apkEntity: ApkEntity, gameId: String): DownloadType {
|
||||
return when {
|
||||
PackagesManager.isCanUpdate(gameId, apkEntity.packageName) -> DownloadType.FUN_UPDATE
|
||||
PackagesManager.isCanUpdate(gameId, apkEntity.packageName, asVGame = true) -> DownloadType.FUN_UPDATE
|
||||
else -> DownloadType.FUN_DOWNLOAD
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.gh.gamecenter.feature.entity.AnswerEntity
|
||||
import com.gh.gamecenter.feature.entity.ArticleEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.NewsEntity
|
||||
import com.gh.gamecenter.feature.entity.User
|
||||
import com.gh.gamecenter.qa.entity.AnswerDetailEntity
|
||||
import com.gh.gamecenter.qa.entity.ArticleDetailEntity
|
||||
|
||||
|
||||
@ -0,0 +1,135 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import android.app.Activity
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
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.view.BugFixedPopupWindow
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.databinding.PopupAccelerateNotificationBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.fragment.MainWrapperViewModel
|
||||
|
||||
class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private var mActivity: Activity? = null
|
||||
private var mBaseHandler: BaseFragment.BaseHandler? = null
|
||||
private var mGameList: List<GameEntity>? = null
|
||||
private var mViewModel: MainWrapperViewModel? = null
|
||||
|
||||
/**
|
||||
* 提前预处理显示弹窗的内容
|
||||
*/
|
||||
fun doPreProcess(
|
||||
activity: Activity,
|
||||
baseHandler: BaseFragment.BaseHandler,
|
||||
gameEntityList: List<GameEntity>?,
|
||||
viewModel: MainWrapperViewModel
|
||||
) {
|
||||
mActivity = activity
|
||||
mGameList = gameEntityList
|
||||
mBaseHandler = baseHandler
|
||||
mViewModel = viewModel
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (gameEntityList == null) {
|
||||
processNext()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
}
|
||||
} else {
|
||||
if (gameEntityList == null) {
|
||||
updateStatus(STATUS_INVALID)
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
val accelerateSet =
|
||||
HashSet(SPUtils.getStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET))
|
||||
if (!mGameList.isNullOrEmpty() && !accelerateSet.contains(mGameList!![0].messageId)) {
|
||||
showAccelerateNotificationPopupWindow(mActivity!!, mViewModel, mBaseHandler, mGameList!![0]) {
|
||||
processNext()
|
||||
}
|
||||
accelerateSet.add(mGameList!![0].messageId)
|
||||
SPUtils.setStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET, accelerateSet)
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun showAccelerateNotificationPopupWindow(
|
||||
activity: Activity,
|
||||
viewModel: MainWrapperViewModel?,
|
||||
baseHandler: BaseFragment.BaseHandler?,
|
||||
gameEntity: GameEntity?,
|
||||
dismissCallback: (() -> Unit)?
|
||||
) {
|
||||
val binding: PopupAccelerateNotificationBinding =
|
||||
PopupAccelerateNotificationBinding.inflate(LayoutInflater.from(activity))
|
||||
if (gameEntity != null) {
|
||||
binding.gameIconView.displayGameIcon(gameEntity)
|
||||
binding.gameNameTv.text = gameEntity.name
|
||||
binding.root.setOnClickListener {
|
||||
NewFlatLogUtils.logMessageInformClickPluginVersion(
|
||||
gameEntity.id,
|
||||
gameEntity.name!!
|
||||
)
|
||||
if (gameEntity.messageId.isNotEmpty()) {
|
||||
// 把对应系统消息设为已读
|
||||
viewModel?.postMessageRead(gameEntity.messageId)
|
||||
}
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
context = activity,
|
||||
gameId = gameEntity.id,
|
||||
entrance = "首页插件上架弹窗",
|
||||
defaultTab = -1,
|
||||
isSkipGameComment = false,
|
||||
scrollToLibao = false,
|
||||
openVideoStreaming = false,
|
||||
openPlatformWindow = true,
|
||||
traceEvent = null
|
||||
)
|
||||
}
|
||||
}
|
||||
BugFixedPopupWindow(
|
||||
binding.root,
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
).apply {
|
||||
isTouchable = true
|
||||
isFocusable = true
|
||||
isOutsideTouchable = true
|
||||
animationStyle = R.style.popup_window_ease_in_and_out_anim_style
|
||||
showAtLocation(
|
||||
activity.window.decorView,
|
||||
Gravity.TOP,
|
||||
0,
|
||||
DisplayUtils.getStatusBarHeight(activity.resources) + DisplayUtils.dip2px(42f)
|
||||
)
|
||||
setOnDismissListener {
|
||||
dismissCallback?.invoke()
|
||||
}
|
||||
baseHandler?.postDelayed({ dismiss() }, 5000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IFloatingWindowProvider
|
||||
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
|
||||
import com.gh.gamecenter.floatingwindow.FloatingWindowEntity
|
||||
import com.gh.gamecenter.fragment.WelcomeDialogFragment
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
class FloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private var mFragment: BaseLazyFragment? = null
|
||||
private var mRecyclerView: RecyclerView? = null
|
||||
private var mWindowList: ArrayList<FloatingWindowEntity>? = null
|
||||
|
||||
fun setData(windowList: ArrayList<FloatingWindowEntity>?) {
|
||||
mWindowList = windowList
|
||||
|
||||
if (mFragment != null) {
|
||||
doPreProcess()
|
||||
}
|
||||
}
|
||||
|
||||
fun setView(
|
||||
fragment: BaseLazyFragment,
|
||||
recyclerView: RecyclerView
|
||||
) {
|
||||
mFragment = fragment
|
||||
mRecyclerView = recyclerView
|
||||
|
||||
if (mWindowList != null) {
|
||||
doPreProcess()
|
||||
}
|
||||
}
|
||||
|
||||
private fun doPreProcess() {
|
||||
Utils.log(TAG, "FloatingWindowHandler preProcess windowSize is -> ${mWindowList?.size}")
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (!mWindowList.isNullOrEmpty()) {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
} else {
|
||||
if (!mWindowList.isNullOrEmpty()) {
|
||||
updateStatus(STATUS_VALID)
|
||||
} else {
|
||||
updateStatus(STATUS_INVALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
val floatingWindowProvider =
|
||||
ARouter.getInstance().build(RouteConsts.provider.floatingwindow)
|
||||
.navigation() as? IFloatingWindowProvider<WelcomeDialogEntity>
|
||||
|
||||
// 强校验所有条件均通过才能显示
|
||||
if (floatingWindowProvider == null || mFragment == null || mFragment?.isAdded == false || mRecyclerView == null) {
|
||||
processNext()
|
||||
return
|
||||
}
|
||||
|
||||
floatingWindowProvider.showFloatingWindowOnly(
|
||||
mFragment!!,
|
||||
mRecyclerView!!,
|
||||
mWindowList!!,
|
||||
) {
|
||||
val welcomeDialog = WelcomeDialogFragment.getInstance(it, true, mFragment)
|
||||
welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
|
||||
}
|
||||
}
|
||||
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import com.gh.gamecenter.fragment.HomeSearchToolWrapperFragment
|
||||
|
||||
class HomePushHandler(priority: Int): PriorityChainHandler(priority) {
|
||||
|
||||
private var mHomeFragment: HomeSearchToolWrapperFragment? = null
|
||||
|
||||
/**
|
||||
* 提前预处理显示弹窗的内容
|
||||
*/
|
||||
fun doPreProcess(homeFragment: HomeSearchToolWrapperFragment?, shouldShow: Boolean) {
|
||||
mHomeFragment = homeFragment
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (shouldShow && homeFragment != null) {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
} else {
|
||||
if (shouldShow && homeFragment != null) {
|
||||
updateStatus(STATUS_VALID)
|
||||
} else {
|
||||
updateStatus(STATUS_INVALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
// 目前首页下拉二楼是首页最后一个弹窗类的东西,还没实现回调,如果有其它要在它后面弹出的,需要自行在它的实现结果后添加回调
|
||||
mHomeFragment?.popUpHomePushIfNeeded {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import com.gh.gamecenter.common.entity.NotificationUgc
|
||||
import com.gh.gamecenter.common.utils.NotificationHelper
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
|
||||
class NotificationPermissionDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
override fun onProcess() {
|
||||
// 仅登录后再启动光环时请求一次权限
|
||||
if (UserManager.getInstance().isLoggedIn) {
|
||||
NotificationHelper.showNotificationHintDialog(NotificationUgc.LOGIN) {
|
||||
processNext()
|
||||
}
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import java.util.*
|
||||
import java.util.concurrent.PriorityBlockingQueue
|
||||
|
||||
class PriorityChain {
|
||||
|
||||
private val mHandlerQueue: Queue<PriorityChainHandler> = PriorityBlockingQueue()
|
||||
|
||||
fun addHandler(handler: PriorityChainHandler) {
|
||||
mHandlerQueue.add(handler.also {
|
||||
it.setPriorityChain(this)
|
||||
})
|
||||
}
|
||||
|
||||
fun start() {
|
||||
mHandlerQueue.poll()?.process(mHandlerQueue)
|
||||
}
|
||||
|
||||
fun isHandlerQueueEmpty() = mHandlerQueue.isEmpty()
|
||||
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import com.lightgame.utils.Utils
|
||||
import java.util.*
|
||||
|
||||
abstract class PriorityChainHandler(private val mPriority: Int) : Comparable<PriorityChainHandler> {
|
||||
|
||||
private var mStatus = STATUS_UNKNOWN
|
||||
private var mQueue: Queue<PriorityChainHandler>? = null
|
||||
|
||||
private var mPriorityChain: PriorityChain? = null
|
||||
|
||||
/**
|
||||
* 获取当前 handler 的状态
|
||||
* - 等待结果返回 (STATUS_PENDING)
|
||||
* - 无需执行 (STATUS_INVALID)
|
||||
* - 可执行 (STATUS_VALID)
|
||||
* - 未知 (STATUS_UNKNOWN)
|
||||
*/
|
||||
fun getStatus(): Int = mStatus
|
||||
|
||||
fun updateStatus(status: Int) {
|
||||
Utils.log(TAG, "${javaClass.simpleName} updateStatus $status")
|
||||
|
||||
mStatus = status
|
||||
}
|
||||
|
||||
fun setPriorityChain(priorityChain: PriorityChain) {
|
||||
mPriorityChain = priorityChain
|
||||
}
|
||||
|
||||
fun process(queue: Queue<PriorityChainHandler>) {
|
||||
Utils.log(TAG, "${javaClass.simpleName} process $mStatus")
|
||||
|
||||
mQueue = queue
|
||||
// 若当前 handler 未经处理,将其状态改为 pending
|
||||
if (mStatus == STATUS_UNKNOWN) {
|
||||
updateStatus(STATUS_PENDING)
|
||||
}
|
||||
|
||||
onProcess()
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行相关功能的地方
|
||||
*/
|
||||
abstract fun onProcess()
|
||||
|
||||
/**
|
||||
* 分发给下一个 handler 处理
|
||||
*/
|
||||
fun processNext() {
|
||||
Utils.log(TAG, "${javaClass.simpleName} processNext $mStatus")
|
||||
|
||||
mQueue?.poll()?.process(mQueue!!)
|
||||
}
|
||||
|
||||
override fun compareTo(other: PriorityChainHandler): Int {
|
||||
return (mPriority - other.mPriority)
|
||||
}
|
||||
|
||||
companion object {
|
||||
internal const val STATUS_PENDING = 0
|
||||
internal const val STATUS_INVALID = 1
|
||||
internal const val STATUS_VALID = 2
|
||||
internal const val STATUS_UNKNOWN = 3
|
||||
|
||||
const val TAG = "PriorityChainHandler"
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.gh.common.dialog.PrivacyPolicyDialogFragment
|
||||
import com.gh.gamecenter.entity.DialogEntity
|
||||
|
||||
class PrivacyPolicyDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private var mActivity: FragmentActivity? = null
|
||||
private var mPrivacyPolicyEntity: DialogEntity.PrivacyPolicyEntity? = null
|
||||
|
||||
/**
|
||||
* 提前预处理显示弹窗的内容
|
||||
*/
|
||||
fun doPreProcess(fragmentActivity: FragmentActivity, privacyPolicyEntity: DialogEntity.PrivacyPolicyEntity?) {
|
||||
mActivity = fragmentActivity
|
||||
mPrivacyPolicyEntity = privacyPolicyEntity
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (privacyPolicyEntity == null) {
|
||||
processNext()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
}
|
||||
} else {
|
||||
if (privacyPolicyEntity == null) {
|
||||
updateStatus(STATUS_INVALID)
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when(getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
PrivacyPolicyDialogFragment.show(mActivity!!, mPrivacyPolicyEntity) { _: Boolean? ->
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.gh.common.dialog.ReserveDialog
|
||||
import com.gh.gamecenter.common.entity.SimpleGameEntity
|
||||
import com.gh.gamecenter.message.MessageUnreadRepository
|
||||
|
||||
class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private var mFragment: Fragment? = null
|
||||
private var mReserveData: List<SimpleGameEntity>? = null
|
||||
|
||||
/**
|
||||
* 提前预处理显示弹窗的内容
|
||||
*/
|
||||
fun doPreProcess(fragment: Fragment, reserveData: List<SimpleGameEntity>?) {
|
||||
mFragment = fragment
|
||||
mReserveData = reserveData
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (reserveData.isNullOrEmpty()) {
|
||||
processNext()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
}
|
||||
} else {
|
||||
if (reserveData.isNullOrEmpty()) {
|
||||
updateStatus(STATUS_INVALID)
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
val reserveDialog = ReserveDialog.getInstance(mReserveData!!)
|
||||
reserveDialog.setOnDismissListener {
|
||||
MessageUnreadRepository.loadMessageUnreadData()
|
||||
processNext()
|
||||
}
|
||||
reserveDialog.show(mFragment!!.childFragmentManager, "reserveDialog")
|
||||
}
|
||||
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.gamecenter.manager.UpdateManager
|
||||
|
||||
class UpdateDialogHandler(context: Context, priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private val mUpdateManager = UpdateManager.getInstance(context)
|
||||
|
||||
override fun onProcess() {
|
||||
mUpdateManager.checkUpdate(true, null)
|
||||
mUpdateManager.setDismissCallback {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.gh.gamecenter.common.callback.BiCallback
|
||||
import com.gh.gamecenter.common.utils.ImageUtils
|
||||
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
|
||||
import com.gh.gamecenter.fragment.MainWrapperViewModel
|
||||
import com.gh.gamecenter.fragment.WelcomeDialogFragment
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
class WelcomeDialogHandler(priority: Int): PriorityChainHandler(priority) {
|
||||
|
||||
private var mFragment: Fragment? = null
|
||||
private var mWelcomeDialogEntity: WelcomeDialogEntity? = null
|
||||
|
||||
fun doPreProcess(fragment: Fragment, welcomeDialogEntity: WelcomeDialogEntity?) {
|
||||
mFragment = fragment
|
||||
mWelcomeDialogEntity = welcomeDialogEntity
|
||||
|
||||
val preLoadClosure = {
|
||||
// 判断启动本次应用是否已经弹窗,不是的话弹启动弹窗
|
||||
if (HaloApp.get(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false) == null) {
|
||||
HaloApp.put(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false)
|
||||
ImageUtils.getBitmap(mWelcomeDialogEntity!!.icon, object : BiCallback<Bitmap, Boolean> {
|
||||
override fun onFirst(first: Bitmap) {
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSecond(second: Boolean) {
|
||||
processNext()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (welcomeDialogEntity == null) {
|
||||
processNext()
|
||||
} else {
|
||||
preLoadClosure.invoke()
|
||||
}
|
||||
} else {
|
||||
if (welcomeDialogEntity == null) {
|
||||
updateStatus(STATUS_INVALID)
|
||||
} else {
|
||||
preLoadClosure.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
if (mFragment == null || !mFragment!!.isAdded) {
|
||||
updateStatus(STATUS_INVALID)
|
||||
processNext()
|
||||
} else {
|
||||
val welcomeDialog = WelcomeDialogFragment.getInstance(mWelcomeDialogEntity)
|
||||
welcomeDialog.setOnDismissListener {
|
||||
processNext()
|
||||
}
|
||||
welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
|
||||
}
|
||||
}
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IAppProvider
|
||||
@ -18,6 +19,10 @@ class AppProviderImpl : IAppProvider {
|
||||
return HaloApp.getInstance().getString(R.string.app_name)
|
||||
}
|
||||
|
||||
override fun getAppVersion(): String {
|
||||
return BuildConfig.VERSION_NAME
|
||||
}
|
||||
|
||||
override fun getGid(): String {
|
||||
return HaloApp.getInstance().gid ?: ""
|
||||
}
|
||||
@ -70,6 +75,10 @@ class AppProviderImpl : IAppProvider {
|
||||
return HaloApp.getInstance().flavorProvider
|
||||
}
|
||||
|
||||
override fun getFlavor(): String {
|
||||
return BuildConfig.FLAVOR
|
||||
}
|
||||
|
||||
override fun getIsBrandNewInstall(): Boolean {
|
||||
return HaloApp.getInstance().isBrandNewInstall
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
@ -24,6 +25,14 @@ class BindingAdaptersProviderImpl : IBindingAdaptersProvider {
|
||||
BindingAdapters.setGameTags(layout, gameEntity)
|
||||
}
|
||||
|
||||
override fun setMessageUnread(view: TextView, unreadCount: Int) {
|
||||
BindingAdapters.setMessageUnread(view, unreadCount)
|
||||
}
|
||||
|
||||
override fun setGame(view: View, gameEntity: GameEntity) {
|
||||
BindingAdapters.setGame(view, gameEntity)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Parcelable
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.CommentDetailActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ICommentDetailProvider
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity
|
||||
|
||||
@Route(path = RouteConsts.provider.commentDetail, name = "CommentDetailActivity暴露服务")
|
||||
class CommentDetailProviderImpl : ICommentDetailProvider {
|
||||
|
||||
override fun getIntent(context: Context, commentId: String?, message: Parcelable): Intent {
|
||||
return CommentDetailActivity.getIntent(context, commentId, message as MessageEntity.Article)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.ICommentManagerProvider
|
||||
import com.gh.gamecenter.manager.CommentManager
|
||||
|
||||
@Route(path = RouteConsts.provider.commentManager, name = "CommentManager暴露服务")
|
||||
class CommentManagerProviderImpl : ICommentManagerProvider {
|
||||
override fun addUrl(ids: String) {
|
||||
CommentManager.getInstance().addUrl(ids)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.CommentUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ICommentUtilsProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.commentUtils, name = "CommentUtils暴露服务")
|
||||
class CommentUtilsProviderImpl : ICommentUtilsProvider {
|
||||
override fun setCommentTime(textView: TextView, time: Long) {
|
||||
CommentUtils.setCommentTime(textView, time)
|
||||
}
|
||||
|
||||
override fun getCommentTime(timestamp: Long): String {
|
||||
return CommentUtils.getCommentTime(timestamp)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
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,20 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.ConcernActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IConcernProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.concernActivity, name = "ConcernActivity暴露服务")
|
||||
class ConcernProviderImpl : IConcernProvider {
|
||||
|
||||
override fun getIntent(context: Context, entrance: String): Intent {
|
||||
return ConcernActivity.getIntent(context, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -56,6 +56,22 @@ class ConfigProviderImpl : IConfigProvider {
|
||||
return Config.getSettings()?.image?.oss?.gifWaterMark ?: ""
|
||||
}
|
||||
|
||||
override fun getVideoSnapshotSuffix(): String {
|
||||
return Config.getSettings()?.image?.oss?.snapshot ?: ""
|
||||
}
|
||||
|
||||
override fun getImageCropSuffix(): String {
|
||||
return Config.getSettings()?.image?.oss?.crop ?: ""
|
||||
}
|
||||
|
||||
override fun getImageInfoSuffix(): String {
|
||||
return Config.getSettings()?.image?.oss?.info ?: ""
|
||||
}
|
||||
|
||||
override fun getImageResizeSuffix(): String {
|
||||
return Config.getSettings()?.image?.oss?.resize ?: ""
|
||||
}
|
||||
|
||||
override fun getQQ(): String {
|
||||
return Config.getSettings()?.support?.qq ?: ""
|
||||
}
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity
|
||||
import com.gh.gamecenter.feature.provider.IConfigSettingProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.configSetting, name = "Config.getSettings暴露服务")
|
||||
class ConfigSettingProviderImpl : IConfigSettingProvider {
|
||||
override fun getSettings(): SettingsEntity? {
|
||||
return Config.getSettings()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DataCollectionUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.IDataCollectionProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.dataCollection, name = "DataCollectionUtils暴露服务")
|
||||
class DataCollectionProviderImpl : IDataCollectionProvider {
|
||||
override fun uploadClick(context: Context, vararg args: String) {
|
||||
DataCollectionUtils.uploadClick(context, *args)
|
||||
}
|
||||
|
||||
override fun uploadConcern(context: Context, vararg args: String) {
|
||||
DataCollectionUtils.uploadConcern(context, *args)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -15,7 +15,7 @@ class DefaultUrlHandlerProviderImpl : IDefaultUrlHandlerProvider {
|
||||
entrance: String,
|
||||
bringAppToFront: Boolean
|
||||
): Boolean {
|
||||
return DefaultUrlHandler.interceptUrl(context, url, entrance, bringAppToFront)
|
||||
return DefaultUrlHandler.interceptUrl(context, url, null, entrance, bringAppToFront)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
@ -53,22 +54,76 @@ class DirectProviderImpl : IDirectProvider {
|
||||
DirectUtils.directDouyin(context, userId)
|
||||
}
|
||||
|
||||
override fun directToSuggestionFromDiagnosis(context: Context, diagnosis: String) {
|
||||
DirectUtils.directToSuggestion(context, diagnosis = diagnosis)
|
||||
override fun directToSuggestionFromDiagnosis(context: Context, content: String, diagnosis: String) {
|
||||
DirectUtils.directToSuggestion(context, content = content, diagnosis = diagnosis)
|
||||
}
|
||||
|
||||
override fun directToQa(context: Context, text: String?, id: String) {
|
||||
DirectUtils.directToQa(context, text, id)
|
||||
}
|
||||
|
||||
override fun directToHelpAndFeedback(context: Context, position: Int) {
|
||||
DirectUtils.directToHelpAndFeedback(context, position)
|
||||
override fun directToHelpAndFeedback(context: Context, bundle: Bundle?) {
|
||||
DirectUtils.directToHelpAndFeedback(context, bundle)
|
||||
}
|
||||
|
||||
override fun directToQqGroup(context: Context, groupNumber: String?): Boolean {
|
||||
return DirectUtils.directToQqGroup(context, groupNumber)
|
||||
}
|
||||
|
||||
override fun directToHomeActivity(context: Context, userId: String?, entrance: String?, path: String?) {
|
||||
DirectUtils.directToHomeActivity(context, userId, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToAnswerDetail(context: Context, id: String, entrance: String?, path: String?) {
|
||||
DirectUtils.directToAnswerDetail(context, id, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToCommunityArticle(
|
||||
context: Context,
|
||||
articleId: String?,
|
||||
communityId: String?,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
) {
|
||||
DirectUtils.directToCommunityArticle(context, articleId, communityId, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToVideoDetail(context: Context, videoId: String, entrance: String?, path: String?) {
|
||||
DirectUtils.directToVideoDetail(context, videoId, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToAmway(context: Context, fixedTopAmwayCommentId: String?, entrance: String?, path: String?) {
|
||||
DirectUtils.directToAmway(context, fixedTopAmwayCommentId, entrance, path)
|
||||
}
|
||||
|
||||
override fun directToOrderCenter(context: Context) {
|
||||
DirectUtils.directToOrderCenter(context)
|
||||
}
|
||||
|
||||
override fun directToOrderDetail(context: Context, orderId: String) {
|
||||
DirectUtils.directToOrderDetail(context, orderId)
|
||||
}
|
||||
|
||||
override fun directToEnergyRecord(context: Context, position: Int) {
|
||||
DirectUtils.directToEnergyRecord(context, position)
|
||||
}
|
||||
|
||||
override fun directToMyPrizePage(context: Context) {
|
||||
DirectUtils.directToMyPrizePage(context)
|
||||
}
|
||||
|
||||
override fun directToWinOrderDetail(context: Context, orderId: String, activityId: String) {
|
||||
DirectUtils.directToWinOrderDetail(context, orderId, activityId)
|
||||
}
|
||||
|
||||
override fun directToQGame(context: Context) {
|
||||
return DirectUtils.directToQGameHome(context)
|
||||
}
|
||||
|
||||
override fun directToExternalBrowser(context: Context, url: String) {
|
||||
DirectUtils.directToExternalBrowser(context, url)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,139 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.provider.IDownloadButtonClickedProvider
|
||||
import com.gh.gamecenter.feature.view.DownloadButton
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
@Route(path = RouteConsts.provider.downloadButtonClickedHandler, name = "DownloadButton点击事件暴露服务")
|
||||
class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
override fun onClicked(downloadButton: DownloadButton) {
|
||||
var gameId = ""
|
||||
var gameName = ""
|
||||
var gameCategory = ""
|
||||
var gameTypeInChinese = ""
|
||||
var downloadStatus = ""
|
||||
var downloadStatusInChinese = ""
|
||||
var gameSchemaType = ""
|
||||
var packageName = ""
|
||||
var exposureSourceList: List<ExposureSource>? = null
|
||||
|
||||
val boundedObject = downloadButton.getObject()
|
||||
|
||||
Utils.log("DownloadButtonClickedProviderImpl", "$downloadButton onClicked ${boundedObject?.javaClass}")
|
||||
|
||||
if (boundedObject != null) {
|
||||
when (boundedObject) {
|
||||
is GameEntity -> {
|
||||
gameId = boundedObject.id
|
||||
gameName = boundedObject.name ?: ""
|
||||
gameCategory = boundedObject.category ?: ""
|
||||
downloadStatus =
|
||||
if (boundedObject.isVGamePreferred()) {
|
||||
"畅玩"
|
||||
} else {
|
||||
if (boundedObject.downloadStatus == "demo") {
|
||||
"试玩"
|
||||
} else {
|
||||
"下载"
|
||||
}
|
||||
}
|
||||
gameTypeInChinese = boundedObject.categoryChinese
|
||||
downloadStatusInChinese = boundedObject.downloadStatusChinese
|
||||
gameSchemaType = boundedObject.gameBitChinese
|
||||
packageName = boundedObject.getUniquePackageName() ?: ""
|
||||
exposureSourceList = boundedObject.exposureEvent?.source
|
||||
}
|
||||
|
||||
is GameUpdateEntity -> {
|
||||
gameId = boundedObject.id
|
||||
gameName = boundedObject.name ?: ""
|
||||
// 下载管理-更新页面,把下载状态都置为下载
|
||||
downloadStatus = "下载"
|
||||
gameTypeInChinese = boundedObject.categoryChinese
|
||||
downloadStatusInChinese = boundedObject.downloadStatusChinese
|
||||
packageName = boundedObject.packageName
|
||||
exposureSourceList = boundedObject.exposureEvent?.source
|
||||
}
|
||||
|
||||
is DownloadEntity -> {
|
||||
gameId = boundedObject.gameId
|
||||
gameName = boundedObject.name ?: ""
|
||||
gameCategory = boundedObject.getGameCategory()
|
||||
downloadStatus = if (boundedObject.asVGame()) "畅玩" else "下载"
|
||||
packageName = boundedObject.packageName
|
||||
exposureSourceList = boundedObject.exposureTrace?.toObject<ExposureEvent>()?.source
|
||||
}
|
||||
}
|
||||
|
||||
// 上报 UI 状态为启动的点击事件 (样式为启动,或者文案包含启动都算能启动)
|
||||
if (downloadButton.buttonStyle == DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
|
||||
|| downloadButton.text.contains("启动")) {
|
||||
|
||||
// boundedObject 里找不到游戏类型时,尝试从已安装列表中获取
|
||||
if (gameCategory.isEmpty() && packageName.isNotEmpty()) {
|
||||
gameCategory = PackageRepository.gameInstalled.find { it.packageName == packageName }?.category ?: ""
|
||||
}
|
||||
|
||||
NewFlatLogUtils.logGameLaunchButtonClicked(
|
||||
gameId = gameId,
|
||||
gameName = gameName,
|
||||
location = downloadButton.getWidgetBusinessName(),
|
||||
gameCategory = gameCategory,
|
||||
downloadStatus = downloadStatus
|
||||
)
|
||||
}
|
||||
|
||||
// 预约状态不上报
|
||||
if (downloadButton.buttonStyle == DownloadButton.ButtonStyle.NORMAL
|
||||
|| downloadButton.buttonStyle == DownloadButton.ButtonStyle.PLUGIN) {
|
||||
|
||||
val text = downloadButton.text.ifEmpty {
|
||||
downloadButton.getTag(R.string.download) ?: ""
|
||||
}.toString()
|
||||
|
||||
val downloadType = if (text.contains("畅玩")) {
|
||||
"畅玩下载"
|
||||
} else {
|
||||
"本地下载"
|
||||
}
|
||||
|
||||
// 上报神策点击事件
|
||||
SensorsBridge.trackEventWithExposureSource(
|
||||
"DownLoadbuttonClick",
|
||||
exposureSourceList,
|
||||
"game_id", gameId,
|
||||
"game_name", gameName,
|
||||
"game_type", gameTypeInChinese,
|
||||
"download_status", downloadStatusInChinese,
|
||||
"button_name", downloadButton.text,
|
||||
"game_schema_type", gameSchemaType,
|
||||
"download_type", downloadType,
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
"page_id", GlobalActivityManager.getCurrentPageEntity().pageId,
|
||||
"page_business_id", GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
|
||||
"last_page_name", GlobalActivityManager.getLastPageEntity().pageName,
|
||||
"last_page_id", GlobalActivityManager.getLastPageEntity().pageId,
|
||||
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.IGameCollectionDetailProvider
|
||||
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
||||
|
||||
@Route(path = RouteConsts.provider.gameCollectionDetail, name = "GameCollectionDetailActivity暴露服务")
|
||||
class GameCollectionDetailProviderImpl : IGameCollectionDetailProvider {
|
||||
override fun getIntent(context: Context, gameCollectionId: String, isFromSquare: Boolean): Intent {
|
||||
return GameCollectionDetailActivity.getIntent(context, gameCollectionId, isFromSquare)
|
||||
}
|
||||
|
||||
override fun getSpecifiedCommentIntent(context: Context, gameCollectionId: String, topCommentId: String): Intent {
|
||||
return GameCollectionDetailActivity.getSpecifiedCommentIntent(context, gameCollectionId, topCommentId)
|
||||
}
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,15 @@ import com.gh.gamecenter.feature.provider.IGameDetailProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.gameDetail, name = "GameDetailActivity暴露服务")
|
||||
class GameDetailProviderImpl : IGameDetailProvider {
|
||||
override fun startGameDetailActivity(
|
||||
context: Context,
|
||||
gameEntity: GameEntity?,
|
||||
entrance: String,
|
||||
traceEvent: ExposureEvent?
|
||||
) {
|
||||
GameDetailActivity.startGameDetailActivity(context, gameEntity, entrance, traceEvent)
|
||||
}
|
||||
|
||||
override fun startGameDetailActivity(
|
||||
context: Context,
|
||||
gameId: String,
|
||||
@ -18,6 +27,7 @@ class GameDetailProviderImpl : IGameDetailProvider {
|
||||
) {
|
||||
GameDetailActivity.startGameDetailActivity(context, gameId, entrance, traceEvent)
|
||||
}
|
||||
|
||||
override fun startGameDetailActivity(
|
||||
context: Context,
|
||||
gameEntity: GameEntity?,
|
||||
@ -40,6 +50,30 @@ class GameDetailProviderImpl : IGameDetailProvider {
|
||||
)
|
||||
}
|
||||
|
||||
override fun startGameDetailActivity(
|
||||
context: Context,
|
||||
gameId: String,
|
||||
entrance: String?,
|
||||
defaultTab: Int,
|
||||
isSkipGameComment: Boolean,
|
||||
scrollToLibao: Boolean,
|
||||
openVideoStreaming: Boolean,
|
||||
openPlatformWindow: Boolean,
|
||||
traceEvent: ExposureEvent?
|
||||
) {
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
context,
|
||||
gameId,
|
||||
entrance,
|
||||
defaultTab,
|
||||
isSkipGameComment,
|
||||
scrollToLibao,
|
||||
openVideoStreaming,
|
||||
openPlatformWindow,
|
||||
traceEvent
|
||||
)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.GameTrendsHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IGameTrendsHelperProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.gameTrendsHelper, name = "GameTrendsHelper暴露服务")
|
||||
class GameTrendsHelperProviderImpl : IGameTrendsHelperProvider {
|
||||
override fun updateReadPostTime() {
|
||||
GameTrendsHelper.updateReadPostTime()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.LibaoUtils
|
||||
import com.gh.common.util.LibaoUtils.PostLibaoListener
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.ILibaoUtilsProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.libaoUtils, name = "LibaoUtils暴露服务")
|
||||
class LibaoUtilsProviderImpl : ILibaoUtilsProvider {
|
||||
override fun getLibaoStatus(ids: String, successCallback: ((Any?) -> Unit)?, failureCallback: (() -> Unit)?) {
|
||||
LibaoUtils.getLibaoStatus(ids, object : PostLibaoListener {
|
||||
override fun postSucceed(response: Any?) {
|
||||
successCallback?.invoke(response)
|
||||
}
|
||||
|
||||
override fun postFailed(error: Throwable?) {
|
||||
failureCallback?.invoke()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,8 @@ import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.entity.SimpleGameEntity
|
||||
import com.gh.gamecenter.common.entity.SuggestType
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider
|
||||
@ -47,21 +47,20 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
|
||||
DirectUtils.directToSuggestion(context, type, suggestHintType, content, isQaFeedback, qaContentId)
|
||||
}
|
||||
|
||||
override fun directToSuggestion(
|
||||
context: Context,
|
||||
type: SuggestType,
|
||||
suggestHintType: String?,
|
||||
content: String?,
|
||||
game: SimpleGameEntity,
|
||||
platform: String
|
||||
) {
|
||||
DirectUtils.directToSuggestion(context, type, suggestHintType, content, game, platform)
|
||||
}
|
||||
|
||||
override fun directToSuggestion(context: Context, type: SuggestType, hiddenHint: String) {
|
||||
DirectUtils.directToSuggestion(context, type, hiddenHint)
|
||||
}
|
||||
|
||||
override fun directToCommunityColumn(
|
||||
context: Context,
|
||||
community: CommunityEntity?,
|
||||
subjectId: String,
|
||||
entrance: String?,
|
||||
path: String?
|
||||
) {
|
||||
DirectUtils.directToCommunityColumn(context, community, subjectId, entrance, path)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.MessageDetailActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.ConcernEntity
|
||||
import com.gh.gamecenter.feature.provider.IMessageDetailProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.messageDetail, name = "MessageDetailActivity暴露服务")
|
||||
class MessageDetailProviderImpl : IMessageDetailProvider {
|
||||
|
||||
override fun getIntentById(
|
||||
context: Context,
|
||||
newsId: String,
|
||||
commentNum: Int,
|
||||
openSoftInput: Boolean,
|
||||
entrance: String
|
||||
): Intent {
|
||||
return MessageDetailActivity.getIntentById(context, newsId, commentNum, openSoftInput, entrance)
|
||||
}
|
||||
|
||||
override fun getIntentByEntity(context: Context, concernEntity: ConcernEntity, entrance: String): Intent? {
|
||||
return MessageDetailActivity.getIntentByEntity(context, concernEntity, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IMessageUnreadRepositoryProvider
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadCount
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.feature.provider.IMessageUnreadRepositoryProvider
|
||||
import com.gh.gamecenter.message.MessageUnreadRepository
|
||||
|
||||
@Route(path = RouteConsts.provider.messageUnreadRepository, name = "MessageUnreadRepository暴露服务")
|
||||
@ -13,6 +17,22 @@ class MessageUnreadRepositoryProviderImpl : IMessageUnreadRepositoryProvider {
|
||||
MessageUnreadRepository.loadMessageUnreadData()
|
||||
}
|
||||
|
||||
override fun loadMessageUnreadTotal(isRecordData: Boolean) {
|
||||
MessageUnreadRepository.loadMessageUnreadTotal(isRecordData)
|
||||
}
|
||||
|
||||
override fun getUnreadLiveData(): MediatorLiveData<MessageUnreadEntity> {
|
||||
return MessageUnreadRepository.unreadLiveData
|
||||
}
|
||||
|
||||
override fun getZixunConcernLiveData(): MutableLiveData<Boolean> {
|
||||
return MessageUnreadRepository.zixunConcern
|
||||
}
|
||||
|
||||
override fun getMessageUnreadCountLiveData(): MutableLiveData<MessageUnreadCount?> {
|
||||
return MessageUnreadRepository.messageUnreadCountLiveData
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.INewCommentDetailProvider
|
||||
import com.gh.gamecenter.qa.comment.NewCommentDetailActivity
|
||||
|
||||
@Route(path = RouteConsts.provider.newCommentDetail, name = "NewCommentDetailActivity暴露服务")
|
||||
class NewCommentDetailProviderImpl : INewCommentDetailProvider {
|
||||
|
||||
override fun getAnswerCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
questionId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent {
|
||||
return NewCommentDetailActivity.getAnswerCommentIntent(
|
||||
context,
|
||||
commentId,
|
||||
questionId,
|
||||
topCommentId,
|
||||
entrance,
|
||||
path
|
||||
)
|
||||
}
|
||||
|
||||
override fun getArticleCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
communityId: String,
|
||||
articleId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent {
|
||||
return NewCommentDetailActivity.getArticleCommentIntent(
|
||||
context,
|
||||
commentId,
|
||||
communityId,
|
||||
articleId,
|
||||
topCommentId,
|
||||
entrance,
|
||||
path
|
||||
)
|
||||
}
|
||||
|
||||
override fun getVideoCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
videoId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent {
|
||||
return NewCommentDetailActivity.getVideoCommentIntent(context, commentId, videoId, topCommentId, entrance, path)
|
||||
}
|
||||
|
||||
override fun getGameCollectionCommentIntent(
|
||||
context: Context,
|
||||
commentId: String,
|
||||
gameCollectionId: String,
|
||||
topCommentId: String,
|
||||
entrance: String,
|
||||
path: String
|
||||
): Intent {
|
||||
return NewCommentDetailActivity.getGameCollectionCommentIntent(
|
||||
context,
|
||||
commentId,
|
||||
gameCollectionId,
|
||||
topCommentId,
|
||||
entrance,
|
||||
path
|
||||
)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,7 @@ import com.lightgame.download.DownloadEntity
|
||||
class PackageInstallerProviderImpl : IPackageInstallerProvider {
|
||||
|
||||
override fun install(context: Context, downloadEntity: DownloadEntity, showUnzipToast: Boolean) {
|
||||
PackageInstaller.install(context, downloadEntity, showUnzipToast)
|
||||
PackageInstaller.install(context, downloadEntity, showUnzipToast, false)
|
||||
}
|
||||
|
||||
override fun uninstall(context: Context, path: String) {
|
||||
|
||||
@ -33,6 +33,18 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
|
||||
return PackageUtils.getSideLoadedInfo()
|
||||
}
|
||||
|
||||
override fun isSignedByGh(context: Context, packageName: String): Boolean {
|
||||
return PackageUtils.isSignedByGh(context, packageName)
|
||||
}
|
||||
|
||||
override fun getInstalledTime(context: Context, packageName: String): Long {
|
||||
return PackageUtils.getInstalledTime(context, packageName)
|
||||
}
|
||||
|
||||
override fun getVersionNameByPackageName(packageName: String): String {
|
||||
return PackageUtils.getVersionNameByPackageName(packageName) ?: ""
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -3,7 +3,8 @@ package com.gh.common.provider
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IPackagesManagerProvider
|
||||
import com.gh.gamecenter.feature.entity.GameInstall
|
||||
import com.gh.gamecenter.feature.provider.IPackagesManagerProvider
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
|
||||
@Route(path = RouteConsts.provider.packagesManager, name = "PackagesManager暴露服务")
|
||||
@ -12,6 +13,10 @@ class PackagesManagerProviderImpl: IPackagesManagerProvider {
|
||||
return PackagesManager.isCanPluggable(gameId, packageName)
|
||||
}
|
||||
|
||||
override fun getFilterSameApkInstalledList(): ArrayList<GameInstall> {
|
||||
return PackagesManager.getFilterSameApkInstalledList()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user