Compare commits
219 Commits
v4.1.0
...
v4.2.0-202
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ce04241f6 | |||
| f29b8da6d0 | |||
| de968a4820 | |||
| ddddda10a5 | |||
| 30d6dabe4f | |||
| 7655cc25be | |||
| 52824e5baa | |||
| 014c80cd18 | |||
| 99eddec84a | |||
| 6b382ab080 | |||
| d492cfdace | |||
| 256f0af0e9 | |||
| 58d2290e12 | |||
| 547e6da027 | |||
| c3e34ba644 | |||
| 077e17c5aa | |||
| f264875b7d | |||
| 351b8a331c | |||
| 479f7c464b | |||
| e04a7fc4b9 | |||
| 595f7747f4 | |||
| 8c1343fdba | |||
| c3717869bd | |||
| 1e56dc533d | |||
| 1444531830 | |||
| 4e759e446b | |||
| ef6c09d27b | |||
| efc241429c | |||
| 07be540ba1 | |||
| 50479d2e87 | |||
| 2934c9dc38 | |||
| 30a60797e6 | |||
| 53562297d5 | |||
| 144ee3ea8c | |||
| e0c8697e75 | |||
| 6aba2906f6 | |||
| 7bb468a1b1 | |||
| 871be728bf | |||
| bbac0c8d93 | |||
| 6b361ed077 | |||
| 1cfa54f8e8 | |||
| 5bd028cbe9 | |||
| b8f8711ba4 | |||
| c1f899f0d5 | |||
| e4fd74da7d | |||
| bf9cc93daa | |||
| 3b974268a9 | |||
| 822853a4be | |||
| f699841427 | |||
| c700910b15 | |||
| 3c8d0cb3ec | |||
| 8492c762b5 | |||
| b2d70392bb | |||
| eb9cb08624 | |||
| a4ca2628dc | |||
| 727d78d0e5 | |||
| 693d8c4385 | |||
| d46e3fac2d | |||
| 7f0ec7f128 | |||
| 73eb2f6ecb | |||
| 6bd7ced28c | |||
| 086c31a7d4 | |||
| 3a839f6770 | |||
| b67c7e2803 | |||
| b7dbf30845 | |||
| ec86970cbe | |||
| 956755b985 | |||
| fe2779196d | |||
| 9eeeba93d0 | |||
| d7df019d6d | |||
| 68bfc26ddc | |||
| 94a1cfe4b2 | |||
| 936c3b00bb | |||
| b34229e4c4 | |||
| b51322b473 | |||
| e0657ccdcc | |||
| 4b67d8b5aa | |||
| 5b8cc49349 | |||
| 612f71e18c | |||
| 6239ccb8ab | |||
| 9680bea412 | |||
| a21d9096c8 | |||
| e6f3ad5cc2 | |||
| c41e996add | |||
| 58f230038c | |||
| bda41d8a26 | |||
| e3f41543a4 | |||
| 78c4d7acef | |||
| 8c884b6d23 | |||
| a5f9af2df2 | |||
| e2fd6dbf97 | |||
| e430b4e2de | |||
| caa3f46c5c | |||
| b2beba4d36 | |||
| 3a9c7fc71d | |||
| a5f8275f64 | |||
| 8fa3f3d832 | |||
| 97472b8259 | |||
| ee07889b30 | |||
| 8582860116 | |||
| b8903e7814 | |||
| b47bcfc2c3 | |||
| 35a987a835 | |||
| 6f413b27d4 | |||
| 92173b4794 | |||
| 89e79154aa | |||
| de9145cd70 | |||
| 8bf509ee2d | |||
| d7144265e1 | |||
| cc6c759658 | |||
| 8e5d482f9e | |||
| 5ed8f2499a | |||
| a8c9bcc1b0 | |||
| 21aabcc561 | |||
| a2b86a9e21 | |||
| 74882f56ee | |||
| 1eb9ec1dd3 | |||
| 9e95c0cc7e | |||
| 877238d2d5 | |||
| 9c6f69b16a | |||
| 64af456182 | |||
| 1a84477700 | |||
| a0b6285596 | |||
| 951c139062 | |||
| 99efcd6bbf | |||
| 3482f58b1b | |||
| 6b4f751a16 | |||
| 3be1308230 | |||
| b7710cffa3 | |||
| dc4fe89521 | |||
| c33eb6829a | |||
| e1793d57eb | |||
| cc4c48f718 | |||
| aa20ed9744 | |||
| b6d8688a40 | |||
| d1da2bb7fa | |||
| 7828bce732 | |||
| 026a8d7093 | |||
| 6a9a29c5ff | |||
| 16b4b6cc81 | |||
| 863e570b61 | |||
| c9e8408804 | |||
| 31984f1737 | |||
| ad2a0debdd | |||
| 4c45657092 | |||
| 5d7fc94d51 | |||
| 641b430fe5 | |||
| e1bb02f4e0 | |||
| 36fd8cf408 | |||
| e48b47b315 | |||
| 46935e4cad | |||
| b8a6b4baea | |||
| 8a8f0a95ed | |||
| cdbefd2d4f | |||
| 7e79b4e328 | |||
| 11dc9f9be0 | |||
| ec255099eb | |||
| 64738dceaf | |||
| 7d518696f0 | |||
| fcd97b66df | |||
| 47f5c3b7c1 | |||
| b64fee9d25 | |||
| 498efdf5ea | |||
| 59d6450ded | |||
| 7da206af7e | |||
| 8bd669e11a | |||
| 62570aed9e | |||
| bfe9c04384 | |||
| b27d007d47 | |||
| 7e50e6570d | |||
| 336d449889 | |||
| 3dfea1e6f9 | |||
| 3c1780d9b5 | |||
| 35ee7cf03d | |||
| 72e8c18f9c | |||
| f3f876d213 | |||
| 398907db90 | |||
| 5dd251eaa8 | |||
| 2c73e55f43 | |||
| f4406d7960 | |||
| 3e0a620ac5 | |||
| 9ea8c32608 | |||
| e2ea197f9e | |||
| f92038b5bf | |||
| fa9eee2c4a | |||
| 3e62fb61e1 | |||
| 5d71e0ccc1 | |||
| 4699923058 | |||
| 9206938938 | |||
| 46ac569f70 | |||
| b90d1b4f38 | |||
| 592b7bbc5e | |||
| 3ccb8b3772 | |||
| 422abe1b87 | |||
| a14f35a4f0 | |||
| 3bebc92106 | |||
| 21413cf250 | |||
| 04a34af370 | |||
| e1e6924b6e | |||
| fbd3a42e81 | |||
| 80a2cbb8cd | |||
| 96fc6cc183 | |||
| b5ff891db1 | |||
| d2171e7a3b | |||
| c3a06f57b1 | |||
| 18f41743bf | |||
| fcc647a1f8 | |||
| e80b198aa5 | |||
| 52efa96e2c | |||
| 816dd60298 | |||
| a181292f80 | |||
| 1b946c325c | |||
| befb323721 | |||
| e62c0aaaad | |||
| 4ecc0c073b | |||
| faa41248eb | |||
| 6dca13e80b | |||
| 553ebc137b | |||
| dd2338021e |
@ -67,6 +67,8 @@ android {
|
||||
buildConfigField "String", "TD_APPID", "\"${TD_APPID}\""
|
||||
buildConfigField "String", "LETO_APPID", "\"${LETO_APPID}\""
|
||||
buildConfigField "String", "TTAD_APPID", "\"${TTAD_APPID}\""
|
||||
buildConfigField "String", "DOUYIN_CLIENTKEY", "\"${DOUYIN_CLIENTKEY}\""
|
||||
buildConfigField "String", "DOUYIN_CLIENTSECRET", "\"${DOUYIN_CLIENTSECRET}\""
|
||||
|
||||
buildConfigField "String", "MIPUSH_APPID", "\"${MIPUSH_APPID}\""
|
||||
buildConfigField "String", "MIPUSH_APPKEY", "\"${MIPUSH_APPKEY}\""
|
||||
@ -284,6 +286,8 @@ dependencies {
|
||||
debugImplementation "com.github.nichbar.chucker:library:$chucker"
|
||||
releaseImplementation "com.github.nichbar.chucker:library-no-op:$chucker"
|
||||
implementation "com.bytedance.applog:RangersAppLog-Lite-cn:$bytedanceApplog"
|
||||
implementation "com.bytedance.ies.ugc.aweme:opensdk-china-external:$bytedanceAweme"
|
||||
implementation "com.bytedance.ies.ugc.aweme:opensdk-common:$bytedanceAweme"
|
||||
|
||||
implementation "com.aliyun.dpa:oss-android-sdk:${oss}"
|
||||
|
||||
@ -336,7 +340,7 @@ if (propFile.exists()) {
|
||||
android.buildTypes.release.signingConfig = null
|
||||
}
|
||||
|
||||
// 用于测试读取 META-INF 里的 JSON 的代码
|
||||
// 用于测试读取 META-INF 里的文件
|
||||
//task generateMetaJson {
|
||||
// def resDir = new File(buildDir, 'generated/FILES_FOR_META_INF/')
|
||||
// def destDir = new File(resDir, 'META-INF/')
|
||||
|
||||
Binary file not shown.
BIN
app/libs/gid-1.1.jar
Normal file
BIN
app/libs/gid-1.1.jar
Normal file
Binary file not shown.
@ -40,7 +40,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<!--可选,穿山甲提供“获取地理位置权限”和“不给予地理位置权限,开发者传入地理位置参数”两种方式上报用户位置,两种方式均可不选,添加位置权限或参数将帮助投放定位广告-->
|
||||
<!--请注意:无论通过何种方式提供给穿山甲用户地理位置,均需向用户声明地理位置权限将应用于穿山甲广告投放,穿山甲不强制获取地理位置信息-->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<!--<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />-->
|
||||
|
||||
<!-- 如果有视频相关的广告且使用textureView播放,请务必添加,否则黑屏 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
@ -52,14 +52,8 @@
|
||||
com.shuyu.gsy.base,
|
||||
com.google.android.exoplayer2,
|
||||
tv.danmaku.ijk.media.exo2,
|
||||
shuyu.com.androidvideocache,
|
||||
pl.droidsonroids.gif,
|
||||
com.ledong.lib.minigame,
|
||||
com.ledong.lib.leto,
|
||||
com.leto.game.base.glide4,
|
||||
com.leto.game.ad.gdt,
|
||||
com.leto.game.fcm,
|
||||
com.leto.game.ad.toutiao" />
|
||||
com.donkingliang.consecutivescroller" />
|
||||
|
||||
<!-- 去掉 SDK 一些流氓权限 -->
|
||||
<uses-permission
|
||||
@ -170,6 +164,10 @@
|
||||
android:name="com.gh.gamecenter.WebActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.FullScreenWebActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.ShareCardPicActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@ -208,6 +206,14 @@
|
||||
android:name="com.gh.gamecenter.AboutActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.security.SecurityActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.security.BindPhoneActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.CommentDetailActivity"
|
||||
android:screenOrientation="portrait"
|
||||
@ -391,6 +397,10 @@
|
||||
android:name="com.gh.gamecenter.qa.article.detail.ArticleDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.qa.article.detail.comment.ArticleDetailCommentActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.qa.draft.CommunityDraftWrapperActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@ -451,7 +461,8 @@
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.video.upload.view.UploadVideoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateHidden"/>
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.video.game.GameVideoActivity"
|
||||
@ -531,6 +542,26 @@
|
||||
android:name=".video.poster.PosterClipActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".forum.select.ForumSelectActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".forum.follow.ForumMyFollowActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".forum.detail.ForumDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".forum.moderator.ModeratorListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".video.label.VideoLabelActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<!-- 使用小米/华为推送弹窗功能提高推送成功率-->
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.PushProxyActivity"
|
||||
@ -558,6 +589,12 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity>
|
||||
|
||||
<activity
|
||||
android:name="${applicationId}.douyinapi.DouYinEntryActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity="${applicationId}"
|
||||
android:exported="true" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}"
|
||||
|
||||
1
app/src/main/assets/lottie/tab_forum.json
Normal file
1
app/src/main/assets/lottie/tab_forum.json
Normal file
@ -0,0 +1 @@
|
||||
{"v":"5.6.9","fr":30,"ip":0,"op":20,"w":66,"h":66,"nm":"bottom bar tab/论坛/选中/E","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"矩形","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":0,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":4,"s":[80,80,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":9,"s":[110,110,100]},{"t":13,"s":[100,100,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":0,"s":[{"i":[[-0.55,0],[0,0],[0,-0.55],[0,0],[1.38,0],[0,1.38],[0,0]],"o":[[0,0],[0.55,0],[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.55]],"v":[[-1.5,-2.5],[1.5,-2.5],[2.5,-1.5],[2.5,0],[0,2.5],[-2.5,0],[-2.5,-1.5]],"c":true}]},{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"t":4,"s":[{"i":[[-0.55,0],[0,0],[0,-0.55],[0,0],[1.38,0],[0,1.38],[0,0]],"o":[[0,0],[0.55,0],[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.55]],"v":[[-1.5,-1.25],[1.5,-1.25],[2.5,-0.25],[2.5,0],[0,1.896],[-2.5,0],[-2.5,-0.25]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":1,"y":0},"t":9,"s":[{"i":[[-0.55,0],[0,0],[0,-0.55],[0,0],[1.38,0],[0,1.38],[0,0]],"o":[[0,0],[0.55,0],[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.55]],"v":[[-1.5,-2.938],[1.5,-2.938],[2.5,-1.938],[2.5,0],[0,2.833],[-2.5,0],[-2.5,-1.938]],"c":true}]},{"t":13,"s":[{"i":[[-0.55,0],[0,0],[0,-0.55],[0,0],[1.38,0],[0,1.38],[0,0]],"o":[[0,0],[0.55,0],[0,0],[0,1.38],[-1.38,0],[0,0],[0,-0.55]],"v":[[-1.5,-2.5],[1.5,-2.5],[2.5,-1.5],[2.5,0],[0,2.5],[-2.5,0],[-2.5,-1.5]],"c":true}]}],"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":20,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"路径 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,34.599,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[2.2,0],[2.19,-0.35],[0,-1.82],[0,0],[0,0],[-1.98,0],[0,0],[0,0],[0,0],[-0.72,0.53],[0,0],[0,0],[0,2.05],[0,0],[1.8,0.28]],"o":[[-2.19,0],[-1.8,0.28],[0,0],[0,0],[0.1,1.96],[0,0],[0,0],[0,0],[0.58,0.65],[0,0],[0,0],[2.05,0],[0,0],[0,-1.82],[-2.2,-0.35]],"v":[[-0.003,-9.745],[-6.583,-9.215],[-9.712,-5.555],[-9.712,3.465],[-9.702,3.665],[-6.003,7.175],[-3.383,7.175],[-2.122,9.065],[-2.023,9.185],[0.277,9.405],[3.238,7.175],[5.997,7.175],[9.717,3.465],[9.717,-5.555],[6.587,-9.215]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"bm":0,"g":{"p":3,"k":{"a":0,"k":[0,0.266,0.638,1,0.5,0.242,0.595,1,1,0.217,0.552,1],"ix":9}},"s":{"a":0,"k":[-9.712,-9.745],"ix":5},"e":{"a":0,"k":[9.712,9.745],"ix":6},"t":1,"nm":"color","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"路径","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":150,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"预合成 1","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,33,0],"ix":2},"a":{"a":0,"k":[33,33,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":0,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":4,"s":[70,70,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":9,"s":[110,110,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":13,"s":[90,90,100]},{"t":16,"s":[100,100,100]}],"ix":6}},"ao":0,"w":66,"h":66,"ip":0,"op":20,"st":0,"bm":0}],"markers":[]}
|
||||
132
app/src/main/assets/notification_style.json
Normal file
132
app/src/main/assets/notification_style.json
Normal file
@ -0,0 +1,132 @@
|
||||
[
|
||||
{
|
||||
"login": {
|
||||
"title": "开启消息通知",
|
||||
"content": "新游上线、互动回复,重要推送不错过",
|
||||
"image": "bg_notification_login_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景1"
|
||||
},
|
||||
"question": {
|
||||
"title": "开启消息通知",
|
||||
"content": "及时查看大神回答",
|
||||
"image": "bg_notification_question_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景2"
|
||||
},
|
||||
"answer": {
|
||||
"title": "开启消息通知",
|
||||
"content": "及时查看点赞与评论",
|
||||
"image": "bg_notification_answer_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景3"
|
||||
},
|
||||
"article": {
|
||||
"title": "开启消息通知",
|
||||
"content": "及时查看点赞与评论",
|
||||
"image": "bg_notification_article_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景4"
|
||||
},
|
||||
"video": {
|
||||
"title": "开启消息通知",
|
||||
"content": "实时获取审核与推荐进度",
|
||||
"image": "bg_notification_video_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景5"
|
||||
},
|
||||
"rating": {
|
||||
"title": "开启消息通知",
|
||||
"content": "成功上墙立即知道",
|
||||
"image": "bg_notification_rating_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景6"
|
||||
},
|
||||
"gift": {
|
||||
"title": "开启消息通知",
|
||||
"content": "新上礼包不再错过",
|
||||
"image": "bg_notification_gift_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景7"
|
||||
},
|
||||
"reserveGame": {
|
||||
"title": "开启消息通知",
|
||||
"content": "新游上线即时体验",
|
||||
"image": "bg_notification_reserve_game_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景8"
|
||||
},
|
||||
"feedback": {
|
||||
"title": "开启消息通知",
|
||||
"content": "及时查看客服回复",
|
||||
"image": "bg_notification_feedback_style_1",
|
||||
"styleNo": "样式A",
|
||||
"scenes": "场景9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"login": {
|
||||
"title": "咦!是新的小伙伴耶!",
|
||||
"content": "打开<font color=\"#1383EB\">通知开关</font>,游戏、礼包、抽奖活动不错过",
|
||||
"image": "bg_notification_login_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景1"
|
||||
},
|
||||
"question": {
|
||||
"title": "发布成功!答案马上来!",
|
||||
"content": "为了第一时间通知您,需要打开<font color=\"#1383EB\">通知开关</font>",
|
||||
"image": "bg_notification_question_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景2"
|
||||
},
|
||||
"answer": {
|
||||
"title": "精彩的回答!大佬牛啤!",
|
||||
"content": "打开<font color=\"#1383EB\">通知开关</font>,可以第一时间收获赞美和感谢哟!",
|
||||
"image": "bg_notification_answer_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景3"
|
||||
},
|
||||
"article": {
|
||||
"title": "发布成功!不愧是你!",
|
||||
"content": "打开<font color=\"#1383EB\">通知开关</font>,可以第一时间收获赞美和互动哟!",
|
||||
"image": "bg_notification_article_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景4"
|
||||
},
|
||||
"video": {
|
||||
"title": "“百万”播放预定!",
|
||||
"content": "<font color=\"#1383EB\">打开通知!</font>第一时间知道审核结果和互动信息哟!",
|
||||
"image": "bg_notification_video_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景5"
|
||||
},
|
||||
"rating": {
|
||||
"title": "这游戏超好玩,我说的!",
|
||||
"content": "想知道有多少人吃下安利?<font color=\"#1383EB\">打开通知</font>,马上知道!",
|
||||
"image": "bg_notification_rating_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景6"
|
||||
},
|
||||
"gift": {
|
||||
"title": "获得道具:神奇的游戏礼包!",
|
||||
"content": "<font color=\"#1383EB\">打开通知!</font>礼包上线,马上知道!",
|
||||
"image": "bg_notification_gift_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景7"
|
||||
},
|
||||
"reserveGame": {
|
||||
"title": "玩最新的游戏,做游戏圈最靓的仔",
|
||||
"content": "<font color=\"#1383EB\">打开通知!</font>游戏上线,更快知道!",
|
||||
"image": "bg_notification_reserve_game_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景8"
|
||||
},
|
||||
"feedback": {
|
||||
"title": "真是重要的反馈!",
|
||||
"content": "感恩有你,光环更精彩!<font color=\"#1383EB\">打开通知</font>,客服回复,马上知道!",
|
||||
"image": "bg_notification_feedback_style_2",
|
||||
"styleNo": "样式B",
|
||||
"scenes": "场景9"
|
||||
}
|
||||
}
|
||||
]
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
@ -27,6 +27,8 @@ import com.gh.base.fragment.BaseFragment;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.ExtensionsKt;
|
||||
import com.gh.common.util.MtaHelper;
|
||||
import com.gh.common.util.PackageInstaller;
|
||||
import com.gh.common.util.RunningUtils;
|
||||
@ -98,10 +100,13 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == com.tencent.connect.common.Constants.REQUEST_QQ_SHARE
|
||||
|| requestCode == com.tencent.connect.common.Constants.REQUEST_QZONE_SHARE) {
|
||||
Tencent.onActivityResultData(requestCode, resultCode, data, ShareUtils.getInstance(this).QqShareListener);
|
||||
}
|
||||
ExtensionsKt.tryCatchInRelease(() -> {
|
||||
if (requestCode == com.tencent.connect.common.Constants.REQUEST_QQ_SHARE
|
||||
|| requestCode == com.tencent.connect.common.Constants.REQUEST_QZONE_SHARE) {
|
||||
Tencent.onActivityResultData(requestCode, resultCode, data, ShareUtils.getInstance(this).QqShareListener);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -169,14 +174,15 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
|
||||
LinearLayout ll = new LinearLayout(this);
|
||||
TextView tv = new TextView(this);
|
||||
String envText = "正式环境";
|
||||
tv.setBackground(ContextCompat.getDrawable(this, R.color.theme));
|
||||
if (BuildConfig.FLAVOR.equals("internal")) {
|
||||
envText = "测试环境";
|
||||
tv.setBackground(ContextCompat.getDrawable(this, R.color.red));
|
||||
}
|
||||
tv.setText(envText);
|
||||
tv.setGravity(Gravity.CENTER);
|
||||
tv.setTextColor(Color.WHITE);
|
||||
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
||||
tv.setBackground(ContextCompat.getDrawable(this, R.color.red));
|
||||
tv.measure(0, 0);
|
||||
tv.setAlpha(0.15F);
|
||||
int height = tv.getMeasuredHeight();
|
||||
@ -187,6 +193,13 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
|
||||
ll.addView(tv);
|
||||
ll.setPadding(0, (width - height) / 2, 0, (width - height) / 2);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
tv.setOnLongClickListener(v -> {
|
||||
EntranceUtils.saveShortcut(this.getClass().getName(), getIntent().getExtras());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
screenRootView.addView(view);
|
||||
screenRootView.addView(ll);
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ abstract class BaseRichEditorActivity : ToolBarActivity() {
|
||||
|
||||
mDraftBtn.text = if (this is AnswerEditActivity) {
|
||||
"回答草稿"
|
||||
} else "文章草稿"
|
||||
} else "帖子草稿"
|
||||
}
|
||||
|
||||
@OnClick(R.id.editor_image, R.id.editor_font, R.id.editor_link, R.id.editor_paragraph,
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.gh.common
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.webkit.JavascriptInterface
|
||||
import androidx.annotation.Keep
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.base.CurrentActivityHolder
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.view.dsbridge.CompletionHandler
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
@ -13,10 +15,10 @@ import com.gh.gamecenter.ImageViewerActivity
|
||||
import com.gh.gamecenter.LoginActivity
|
||||
import com.gh.gamecenter.entity.Badge
|
||||
import com.gh.gamecenter.entity.MtaEvent
|
||||
import com.gh.gamecenter.entity.NotificationUgc
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.retrofit.BiResponse
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.room.AppDatabase
|
||||
import com.gh.gamecenter.user.LoginTag
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Utils
|
||||
@ -25,6 +27,8 @@ import io.reactivex.schedulers.Schedulers
|
||||
import okhttp3.ResponseBody
|
||||
import org.json.JSONObject
|
||||
import retrofit2.HttpException
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class DefaultJsApi(var context: Context) {
|
||||
|
||||
@ -47,7 +51,7 @@ class DefaultJsApi(var context: Context) {
|
||||
|
||||
@JavascriptInterface
|
||||
fun getUserInfo(msg: Any): String {
|
||||
return UserManager.getInstance().userInfoEntity.toJson()
|
||||
return UserManager.getInstance().userInfoEntity?.toJson() ?: ""
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
@ -66,9 +70,9 @@ class DefaultJsApi(var context: Context) {
|
||||
val userInfoEntity = UserManager.getInstance().userInfoEntity
|
||||
if (msg.toString().isNotEmpty()) {
|
||||
val badge = msg.toString().toObject() ?: Badge()
|
||||
userInfoEntity.badge = badge
|
||||
userInfoEntity?.badge = badge
|
||||
} else {
|
||||
userInfoEntity.badge = null
|
||||
userInfoEntity?.badge = null
|
||||
}
|
||||
UserManager.getInstance().userInfoEntity = userInfoEntity
|
||||
}
|
||||
@ -83,6 +87,11 @@ class DefaultJsApi(var context: Context) {
|
||||
return BuildConfig.VERSION_NAME
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun getAppVersionCode(msg: Any): Int {
|
||||
return PackageUtils.getVersionCode()
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun bindWechat(msg: Any, handler: CompletionHandler<Any>) {
|
||||
context.ifLogin("浏览器") {
|
||||
@ -166,8 +175,44 @@ class DefaultJsApi(var context: Context) {
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun openNotificationSetting(msg: Any){
|
||||
NotificationHelper.show(context as AppCompatActivity)
|
||||
fun openNotificationSetting(msg: Any) {
|
||||
NotificationHelper.show(context as AppCompatActivity, NotificationUgc.LOGIN)
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun useDarkStatusBarText(msg: Any) {
|
||||
runOnUiThread {
|
||||
DisplayUtils.transparentStatusBar(context as AppCompatActivity)
|
||||
DisplayUtils.setLightStatusBar(context as AppCompatActivity, msg.toString() == "true")
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun exitWebView(msg: Any) {
|
||||
runOnUiThread { (context as Activity).finish() }
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun updateRegulationTestStatus(msg: Any) {
|
||||
if (msg.toString().toLowerCase(Locale.getDefault()) == "pass") {
|
||||
SPUtils.setString(Constants.SP_REGULATION_TEST_PASS_STATUS, "pass")
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun getStatusBarHeight(msg: Any): String {
|
||||
val statusBarHeight = DisplayUtils.getStatusBarHeight(context.resources)
|
||||
return "$statusBarHeight"
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun getGid(msg: Any): String {
|
||||
return HaloApp.getInstance().gid
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun showIncompatibleVersionDialog(msg: Any) {
|
||||
DialogUtils.showLowVersionDialog(context)
|
||||
}
|
||||
|
||||
@Keep
|
||||
|
||||
@ -4,19 +4,23 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
import android.util.Base64
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.util.DirectUtils.directToGameDetailVideoStreaming
|
||||
import com.gh.common.util.DirectUtils.directToGameServerCalendar
|
||||
import com.gh.common.util.DirectUtils.directToGameVideo
|
||||
import com.gh.common.util.DirectUtils.directToLinkPage
|
||||
import com.gh.common.util.DirectUtils.directToVideoDetail
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.gamecenter.*
|
||||
import com.gh.gamecenter.entity.CommunityEntity
|
||||
import com.gh.gamecenter.entity.SimpleGameEntity
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity
|
||||
import com.gh.gamecenter.entity.VideoLinkEntity
|
||||
import com.gh.common.util.GsonUtils.gson
|
||||
import com.gh.gamecenter.LibaoDetailActivity
|
||||
import com.gh.gamecenter.MainActivity
|
||||
import com.gh.gamecenter.NewsDetailActivity
|
||||
import com.gh.gamecenter.WebActivity
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.subject.SubjectActivity
|
||||
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel
|
||||
import com.lightgame.utils.Utils
|
||||
import java.nio.charset.Charset
|
||||
|
||||
object DefaultUrlHandler {
|
||||
|
||||
@ -36,7 +40,7 @@ object DefaultUrlHandler {
|
||||
when (host) {
|
||||
"article" -> context.startActivity(NewsDetailActivity.getIntentById(context, id, entrance))
|
||||
|
||||
"game" -> GameDetailActivity.startGameDetailActivity(context, id, "libao" == uri.getQueryParameter("to"), entrance)
|
||||
"game" -> DirectUtils.directToGameDetail(context, id = id, tab = uri.getQueryParameter("to"), autoDownload = uri.getQueryParameter("auto_download") == "true", entrance = entrance)
|
||||
|
||||
"column" -> SubjectActivity.startSubjectActivity(context, id, uri.getQueryParameter("name"), false, entrance)
|
||||
|
||||
@ -123,9 +127,11 @@ object DefaultUrlHandler {
|
||||
val title = if (titleParameter.isNullOrEmpty()) "" else "#$titleParameter#"
|
||||
val categoryId = uri.getQueryParameter("category_id") ?: ""
|
||||
val link = uri.getQueryParameter("link") ?: ""
|
||||
val linkEntity = VideoLinkEntity(title, categoryId, link)
|
||||
val gameId = uri.getQueryParameter("gameId") ?: ""
|
||||
val gameName = uri.getQueryParameter("gameName") ?: ""
|
||||
val tagActivityId = uri.getQueryParameter("tagActivityId") ?: ""
|
||||
val tagActivityName = uri.getQueryParameter("tagActivityName") ?: ""
|
||||
val linkEntity = VideoLinkEntity(title, categoryId, link, tagActivityId, tagActivityName)
|
||||
val simpleGameEntity = SimpleGameEntity(gameId, gameName)
|
||||
CheckLoginUtils.checkLogin(context, null, true, EntranceUtils.ENTRANCE_BROWSER) {
|
||||
DirectUtils.directToVideoManager(context, linkEntity, simpleGameEntity, EntranceUtils.ENTRANCE_BROWSER, "")
|
||||
@ -142,6 +148,8 @@ object DefaultUrlHandler {
|
||||
val gameId = uri.getQueryParameter("gameId") ?: ""
|
||||
val fieldId = uri.getQueryParameter("fieldId") ?: ""
|
||||
val sectionName = uri.getQueryParameter("sectionName") ?: ""
|
||||
val paginationType = uri.getQueryParameter("paginationType")
|
||||
?: "page"//活动分页方式 page filter
|
||||
val location = if (!TextUtils.isEmpty(act)) {
|
||||
VideoDetailContainerViewModel.Location.VIDEO_ACTIVITY.value
|
||||
} else if (!TextUtils.isEmpty(fieldId)) {
|
||||
@ -149,7 +157,7 @@ object DefaultUrlHandler {
|
||||
} else {
|
||||
id
|
||||
}
|
||||
directToVideoDetail(context, id, location, false, gameId, entrance, "", referer, type, act, fieldId, sectionName)
|
||||
directToVideoDetail(context, id, location, false, gameId, entrance, "", referer, type, act, paginationType, fieldId, sectionName)
|
||||
}
|
||||
EntranceUtils.HOST_VIDEO_SINGLE -> {
|
||||
val referer = uri.getQueryParameter("referer") ?: ""
|
||||
@ -230,6 +238,47 @@ object DefaultUrlHandler {
|
||||
DirectUtils.directGameZone(context, id, zoneUrl, entrance)
|
||||
}
|
||||
|
||||
EntranceUtils.HOST_LINK -> {
|
||||
try {
|
||||
val dataString = uri.getQueryParameter("data")
|
||||
if (!TextUtils.isEmpty(dataString)) {
|
||||
val linkData = Base64.decode(dataString, Base64.DEFAULT)
|
||||
val linkDataString = String(linkData, Charset.defaultCharset())
|
||||
val le = gson.fromJson(linkDataString, LinkEntity::class.java)
|
||||
directToLinkPage(context, le, entrance, "")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
EntranceUtils.HOST_GAME_NEWS -> {
|
||||
DirectUtils.directToGameNews(
|
||||
context,
|
||||
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
|
||||
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
|
||||
entrance);
|
||||
}
|
||||
|
||||
EntranceUtils.HOST_GAME_CALENDAR -> {
|
||||
directToGameServerCalendar(context, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID))
|
||||
}
|
||||
|
||||
EntranceUtils.HOST_HISTORY_APK -> {
|
||||
DirectUtils.directToHistoryApk(context, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID))
|
||||
}
|
||||
|
||||
EntranceUtils.HOST_FORUM_DETAIL -> {
|
||||
DirectUtils.directForumDetail(context, id, entrance)
|
||||
}
|
||||
|
||||
EntranceUtils.HOST_GAME_RATING_DETAIL -> {
|
||||
DirectUtils.directToGameRatingDetail(context, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID), uri.getQueryParameter(EntranceUtils.KEY_COMMENT_ID), EntranceUtils.ENTRANCE_BROWSER)
|
||||
}
|
||||
|
||||
EntranceUtils.HOST_FORUM -> {
|
||||
DirectUtils.directToForum(context);
|
||||
}
|
||||
else -> DialogUtils.showLowVersionDialog(context)
|
||||
}
|
||||
return true
|
||||
@ -274,13 +323,17 @@ object DefaultUrlHandler {
|
||||
@JvmStatic
|
||||
fun transformNormalScheme(context: Context, url: String, entrance: String): Boolean {
|
||||
val uri = Uri.parse(url)
|
||||
if (uri.host == "www.ghzs666.com" || uri.host == "www.ghzs.com" || uri.host == "ask.ghzs.com" || uri.host == "m.ghzs.com") {
|
||||
if (uri.host == "www.ghzs666.com"
|
||||
|| uri.host == "www.ghzs.com"
|
||||
|| uri.host == "ask.ghzs.com"
|
||||
|| uri.host == "m.ghzs.com"
|
||||
|| uri.host == "m.ghzs666.com") {
|
||||
Utils.log(uri.path)
|
||||
uri.path?.apply {
|
||||
when {
|
||||
contains("game") -> {
|
||||
val gameId = uri.getQueryParameter("gameId") ?: ""
|
||||
DirectUtils.directToGameDetail(context, gameId, entrance, autoDownload = false, scrollToLibao = false, traceEvent = null)
|
||||
DirectUtils.directToGameDetail(context, gameId, entrance, autoDownload = false, traceEvent = null)
|
||||
}
|
||||
contains("question") -> {
|
||||
val questionId = split("/")[2]
|
||||
|
||||
@ -4,7 +4,9 @@ import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.common.loghub.LoghubUtils
|
||||
import com.gh.common.util.doOnMainProcessOnly
|
||||
import com.gh.common.util.tryCatchInRelease
|
||||
import com.gh.common.videolog.VideoRecordUtils
|
||||
import com.gh.download.DownloadDataHelper
|
||||
import com.gh.gamecenter.entity.TimeEntity
|
||||
import com.gh.gamecenter.retrofit.Response
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
@ -12,13 +14,16 @@ import com.halo.assistant.HaloApp
|
||||
import kotlin.concurrent.fixedRateTimer
|
||||
|
||||
object FixedRateJobHelper {
|
||||
private const val CHECKER_PERIOD: Long = 60 * 1000L
|
||||
private const val CHECKER_PERIOD: Long = 15 * 1000L
|
||||
private const val TIME_PERIOD: Long = 600 * 1000L
|
||||
private const val LOGHUB_PERIOD: Long = 120 * 1000L
|
||||
private const val EXPOSURE_PERIOD: Long = 300 * 1000L
|
||||
private const val REGION_SETTING_PERIOD: Long = 300 * 1000L
|
||||
private const val VIDEO_RECORD_PERIOD: Long = 60 * 1000L
|
||||
|
||||
private const val DOWNLOAD_HEARTBEAT_PERIOD: Long = 60 * 1000L
|
||||
private const val DOWNLOAD_HEARTBEAT_SHEET_PERIOD: Long = 15 * 1000L
|
||||
|
||||
private var mExecuteCount: Int = 0
|
||||
|
||||
var timeDeltaBetweenServerAndClient: Long = 0
|
||||
@ -44,6 +49,14 @@ object FixedRateJobHelper {
|
||||
ExposureManager.commitSavedExposureEvents(true)
|
||||
}
|
||||
|
||||
// 分片检测下载进度
|
||||
if ((mExecuteCount * CHECKER_PERIOD) % DOWNLOAD_HEARTBEAT_SHEET_PERIOD == 0L) {
|
||||
tryCatchInRelease {
|
||||
val upload = (mExecuteCount * CHECKER_PERIOD) % DOWNLOAD_HEARTBEAT_PERIOD == 0L
|
||||
DownloadDataHelper.uploadDownloadHeartbeat(upload)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交普通 loghub 数据
|
||||
if ((mExecuteCount * CHECKER_PERIOD) % LOGHUB_PERIOD == 0L) {
|
||||
LoghubUtils.commitSavedLoghubEvents()
|
||||
|
||||
@ -95,6 +95,7 @@ object PushManager {
|
||||
jsonObject.put("os", meta.os)
|
||||
jsonObject.put("os_version", meta.android_version)
|
||||
jsonObject.put("mac", meta.mac)
|
||||
jsonObject.put("gid", meta.gid)
|
||||
|
||||
val body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString())
|
||||
|
||||
|
||||
@ -51,6 +51,8 @@ public class Config {
|
||||
public static final String BUGLY_APPID = BuildConfig.BUGLY_APPID;
|
||||
public static final String LETO_APPID = BuildConfig.LETO_APPID;
|
||||
public static final String TTAD_APPID = BuildConfig.TTAD_APPID;
|
||||
public static final String DOUYIN_CLIENTKEY = BuildConfig.DOUYIN_CLIENTKEY;
|
||||
public static final String DOUYIN_CLIENTSECRET = BuildConfig.DOUYIN_CLIENTSECRET;
|
||||
// http://www.ghzs666.com/article/${articleId}.html
|
||||
public static final String URL_ARTICLE = "http://www.ghzs666.com/article/"; // ghzs/ghzs666 统一
|
||||
public static final String PATCHES = "patches";
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.common.constant;
|
||||
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.halo.assistant.HaloApp;
|
||||
|
||||
public class Constants {
|
||||
|
||||
@ -48,6 +49,10 @@ public class Constants {
|
||||
public static final String RAW_GAME_ICON = "raw_game_icon";
|
||||
public static final String GAME_ICON_SUBSCRIPT = "game_icon_subscript";
|
||||
|
||||
public static final String EXTRA_DOWNLOAD_TYPE = "extra_download_type";
|
||||
public static final String SILENT_UPDATE = "静默更新";
|
||||
public static final String LAST_GHZS_UPDATE_FILE_SIZE = "last_ghzs_update_file_size";
|
||||
|
||||
// 新用户首次启动光环的时间
|
||||
public static final String SP_INITIAL_USAGE_TIME = "initial_usage_time";
|
||||
|
||||
@ -58,6 +63,9 @@ public class Constants {
|
||||
public static final String SP_SHOWED_NOTIFICATION_ARTICLE = "show_notification_article_hint";
|
||||
public static final String SP_SHOWED_NOTIFICATION_VIDEO = "show_notification_video_hint";
|
||||
public static final String SP_SHOWED_NOTIFICATION_RATING = "show_notification_rating_hint";
|
||||
public static final String SP_SHOWED_NOTIFICATION_GIFT = "show_notification_gift_hint";
|
||||
public static final String SP_SHOWED_NOTIFICATION_RESERVE_GAME = "show_notification_reserve_game_hint";
|
||||
public static final String SP_SHOWED_NOTIFICATION_FEEDBACK = "show_notification_feedback_hint";
|
||||
// 新版本 也要触发一次“通知管理” 引导弹窗
|
||||
public static final String SP_SHOWED_NOTIFICATION_NEW_VERSION = "show_notification_new_version";
|
||||
// 今天是否已经触发了 “通知管理” 引导弹窗
|
||||
@ -96,6 +104,17 @@ public class Constants {
|
||||
public static final String SP_TOP_VIDEO_SCHEDULE = "top_video_schedule";
|
||||
//我的光环小红点提示
|
||||
public static final String SP_GH_RED_POINT_REMIND = "gh_red_point_remind";
|
||||
//论坛首页引导
|
||||
public static final String SP_FORUM_GUIDE = "forum_guide";
|
||||
//礼仪考试开启状态
|
||||
public static final String SP_REGULATION_TEST_LAST_REMIND_TIME = "regulation_test_last_remind_time";
|
||||
public static final String SP_REGULATION_TEST_STATUS = "regulation_test_status";
|
||||
public static final String SP_REGULATION_TEST_PASS_STATUS = "regulation_test_pass_status";
|
||||
//相同设备号,每一种第三方登录方式登录后弹出绑定手机页面的次数
|
||||
public static final String SP_QQ_SHOW_BIND_PHONE_TIME = "qq_show_bind_phone_time" + HaloApp.getInstance().getGid();
|
||||
public static final String SP_WECHAT_SHOW_BIND_PHONE_TIME = "wechat_show_bind_phone_time" + HaloApp.getInstance().getGid();
|
||||
public static final String SP_WEIBO_SHOW_BIND_PHONE_TIME = "weibo_show_bind_phone_time" + HaloApp.getInstance().getGid();
|
||||
public static final String SP_DOUYIN_SHOW_BIND_PHONE_TIME = "douyin_show_bind_phone_time" + HaloApp.getInstance().getGid();
|
||||
|
||||
//手机号码匹配规则
|
||||
public static final String REGEX_MOBILE = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
|
||||
@ -105,10 +124,14 @@ public class Constants {
|
||||
//输入规则
|
||||
public static final String INPUT_RULE = "0123456789abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ_";
|
||||
|
||||
// 微信绑定地址地址
|
||||
// 微信绑定地址
|
||||
public static final String WECHAT_BIND_ADDRESS_DEV = "https://resource.ghzs.com/page/wechat_dev/index.html#/";
|
||||
public static final String WECHAT_BIND_ADDRESS = "https://resource.ghzs.com/page/wechat_pro/index.html#/";
|
||||
|
||||
// 礼仪考试地址
|
||||
public static final String REGULATION_TEST_ADDRESS_DEV = "https://static-web.ghzs.com/etiquette-dev/index.html#/";
|
||||
public static final String REGULATION_TEST_ADDRESS = "https://static-web.ghzs.com/etiquette/index.html#/";
|
||||
|
||||
// 徽章
|
||||
public static final String BADGE_ADDRESS_DEV = "http://resource.ghzs.com/page/badge_dev/index.html#/";
|
||||
public static final String BADGE_ADDRESS = "http://resource.ghzs.com/page/badge_pro/index.html#/";
|
||||
@ -116,6 +139,9 @@ public class Constants {
|
||||
// 腾讯企点地址
|
||||
public static final String TENCENT_QIDIAN_ADDRESS = "https://url.cn/D80iyMVV?_type=wpa&qidian=true";
|
||||
|
||||
//版规声明
|
||||
public static final String FORUM_REGULATIONS_NEWS_ID = "5f4db9cc34d44d01b92fd670";
|
||||
|
||||
//最少需要多少数据才能上传
|
||||
public static final int DATA_AMOUNT = 20;
|
||||
|
||||
|
||||
@ -318,7 +318,7 @@ public class BindingAdapters {
|
||||
@BindingAdapter("game")
|
||||
public static void setGame(View view, GameEntity gameEntity) {
|
||||
if (gameEntity != null && view instanceof GameIconView) {
|
||||
((GameIconView) view).setGameEntity(gameEntity);
|
||||
((GameIconView) view).displayGameIcon(gameEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,28 +2,34 @@ package com.gh.common.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.content.res.AssetManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.gh.common.util.DisplayUtils
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.gh.common.util.GsonUtils
|
||||
import com.gh.common.util.MtaHelper
|
||||
import com.gh.common.util.PermissionHelper
|
||||
import com.gh.common.util.fromHtml
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.entity.NotificationHint
|
||||
import com.gh.gamecenter.entity.NotificationStyleEntity
|
||||
import com.gh.gamecenter.entity.NotificationUgc
|
||||
import com.lightgame.utils.Utils
|
||||
import kotlinx.android.synthetic.main.dialog_notification_hint.*
|
||||
import org.json.JSONArray
|
||||
import java.io.BufferedReader
|
||||
import java.io.IOException
|
||||
import java.io.InputStreamReader
|
||||
import kotlin.random.Random
|
||||
|
||||
// 通知权限弹窗
|
||||
class NotificationHintDialogFragment : BaseTrackableDialogFragment() {
|
||||
|
||||
private var mNotificationHint: NotificationHint? = null
|
||||
private var mNotificationUgc: NotificationUgc? = null
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.dialog_notification_hint, null)
|
||||
@ -34,23 +40,34 @@ class NotificationHintDialogFragment : BaseTrackableDialogFragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
titleTv.text = mNotificationHint?.title
|
||||
|
||||
contentContainer.removeAllViews()
|
||||
for (item in mNotificationHint?.content ?: arrayListOf()) {
|
||||
val tv = TextView(context)
|
||||
|
||||
tv.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply {
|
||||
topMargin = if (contentContainer.childCount == 0) 0 else DisplayUtils.dip2px(12f)
|
||||
}
|
||||
tv.text = item
|
||||
tv.setTextColor(Color.parseColor("#1383EB"))
|
||||
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
|
||||
contentContainer.addView(tv)
|
||||
val jsonString = getJsonFromAssets()
|
||||
if (jsonString.isNullOrEmpty()) {
|
||||
Utils.log("Failed to obtain configuration file")
|
||||
return
|
||||
}
|
||||
val index = Random.nextInt(2)
|
||||
val jsonArray = JSONArray(jsonString)
|
||||
val jsonObj = jsonArray.getJSONObject(index)
|
||||
if (!jsonObj.has(mNotificationUgc?.value)) {
|
||||
Utils.log("ugc type error")
|
||||
return
|
||||
}
|
||||
val styleEntityJson = jsonObj.getJSONObject(mNotificationUgc!!.value)
|
||||
val styleEntity = GsonUtils.fromJson(styleEntityJson.toString(), NotificationStyleEntity::class.java)
|
||||
val drawableId = resources.getIdentifier(styleEntity.image, "drawable", requireContext().packageName)
|
||||
notificationIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), drawableId))
|
||||
notificationTitle.text = styleEntity.title
|
||||
notificationContent.text = styleEntity.content.fromHtml()
|
||||
if (index == 0) {
|
||||
closeIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_notification_close_1))
|
||||
} else {
|
||||
activateTv.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_notification_open_btn_style_1)
|
||||
activateTv.text = "优雅的开启"
|
||||
}
|
||||
|
||||
activateTv.setOnClickListener {
|
||||
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击立即开启")
|
||||
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击立即开启")
|
||||
dismiss()
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
//这种方案适用于 API 26, 即8.0(含8.0)以上可以用
|
||||
@ -63,9 +80,10 @@ class NotificationHintDialogFragment : BaseTrackableDialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
laterTv.setOnClickListener {
|
||||
closeIv.setOnClickListener {
|
||||
dismiss()
|
||||
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击以后再说")
|
||||
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击关闭")
|
||||
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击关闭")
|
||||
}
|
||||
|
||||
dialog?.setCanceledOnTouchOutside(true)
|
||||
@ -81,10 +99,30 @@ class NotificationHintDialogFragment : BaseTrackableDialogFragment() {
|
||||
|
||||
override fun trackWithBasicDeviceInfo() = true
|
||||
|
||||
private fun getJsonFromAssets(): String? {
|
||||
val stringBuilder = StringBuilder()
|
||||
var bufferedReader: BufferedReader? = null
|
||||
var inputStreamReader: InputStreamReader? = null
|
||||
try {
|
||||
inputStreamReader = InputStreamReader(requireContext().assets.open("notification_style.json"))
|
||||
bufferedReader = BufferedReader(inputStreamReader)
|
||||
var line: String?
|
||||
while (bufferedReader.readLine().also { line = it } != null) {
|
||||
stringBuilder.append(line)
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
inputStreamReader?.close()
|
||||
bufferedReader?.close()
|
||||
}
|
||||
return stringBuilder.toString()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(hint: NotificationHint) = NotificationHintDialogFragment().apply {
|
||||
mNotificationHint = hint
|
||||
fun getInstance(ugc: NotificationUgc) = NotificationHintDialogFragment().apply {
|
||||
mNotificationUgc = ugc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,12 +15,14 @@ import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import butterknife.OnClick
|
||||
import com.gh.base.fragment.BaseDialogFragment
|
||||
import com.gh.common.AppExecutor
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.history.HistoryHelper
|
||||
import com.gh.common.repository.ReservationRepository
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.NotificationUgc
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.retrofit.BiResponse
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
@ -168,7 +170,7 @@ class ReserveDialogFragment
|
||||
}
|
||||
|
||||
private fun setMobileIndexHint(reserveMobile: String?) {
|
||||
var userMobile = UserManager.getInstance().userInfoEntity.mobile
|
||||
var userMobile = UserManager.getInstance().userInfoEntity?.mobile
|
||||
if (reserveMobile == userMobile) userMobile = null
|
||||
|
||||
if (!reserveMobile.isNullOrEmpty()) {
|
||||
@ -231,6 +233,9 @@ class ReserveDialogFragment
|
||||
R.id.close_btn -> {
|
||||
// MtaHelper.onEvent("预约游戏", "预约功能操作", "点击关闭")
|
||||
dismissAllowingStateLoss()
|
||||
AppExecutor.uiExecutor.executeWithDelay(Runnable {
|
||||
NotificationHelper.showNotificationHintDialog(NotificationUgc.RESERVE_GAME)
|
||||
}, 1000)
|
||||
}
|
||||
R.id.content_container -> {
|
||||
mobileIndexContainer.visibility = View.GONE
|
||||
|
||||
@ -4,15 +4,16 @@ import android.annotation.SuppressLint
|
||||
import com.gh.common.AppExecutor
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.util.SPUtils
|
||||
import com.gh.common.util.debounceActionWithInterval
|
||||
import com.gh.common.util.toJson
|
||||
import com.gh.common.util.toObject
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.retrofit.BiResponse
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.functions.Function
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
object RegionSettingHelper {
|
||||
|
||||
@ -50,7 +51,7 @@ object RegionSettingHelper {
|
||||
list
|
||||
}
|
||||
|
||||
fun shouldGameOfThisCategoryUseMirrorInfo(category: String) : Boolean {
|
||||
fun shouldGameOfThisCategoryUseMirrorInfo(category: String): Boolean {
|
||||
return if (mChannelControl == null || mChannelControl?.effect == false || !isUserUsedLessThan24Hours()) {
|
||||
false
|
||||
} else {
|
||||
@ -61,24 +62,26 @@ object RegionSettingHelper {
|
||||
@SuppressLint("CheckResult")
|
||||
@JvmStatic
|
||||
fun getRegionSetting() {
|
||||
// 使用默认的 Schdulers.io() 可能会触发 OOM
|
||||
RetrofitManager.getInstance(HaloApp.getInstance().application)
|
||||
.sensitiveApi
|
||||
.getRegionSetting(HaloApp.getInstance().channel)
|
||||
.subscribeOn(AppExecutor.cachedScheduler)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<RegionSetting>() {
|
||||
override fun onSuccess(data: RegionSetting) {
|
||||
updateSettingsInMemory(data)
|
||||
SPUtils.setString(SP_SETTING, data.toJson())
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
SPUtils.getString(SP_SETTING).toObject<RegionSetting>()?.let {
|
||||
updateSettingsInMemory(it)
|
||||
debounceActionWithInterval(R.string.name, 3000) {
|
||||
// 使用默认的 Schdulers.io() 可能会触发 OOM
|
||||
RetrofitManager.getInstance(HaloApp.getInstance().application)
|
||||
.sensitiveApi
|
||||
.getRegionSetting(HaloApp.getInstance().channel)
|
||||
.subscribeOn(AppExecutor.cachedScheduler)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<RegionSetting>() {
|
||||
override fun onSuccess(data: RegionSetting) {
|
||||
updateSettingsInMemory(data)
|
||||
SPUtils.setString(SP_SETTING, data.toJson())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
SPUtils.getString(SP_SETTING).toObject<RegionSetting>()?.let {
|
||||
updateSettingsInMemory(it)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateSettingsInMemory(data: RegionSetting) {
|
||||
|
||||
@ -110,6 +110,7 @@ object HistoryHelper {
|
||||
clearHtmlFormatCompletely().
|
||||
replace(" +".toRegex()," ")
|
||||
articleEntity.count = articleDetailEntity.count
|
||||
articleDetailEntity.community.id = articleDetailEntity.communityId
|
||||
articleEntity.community = articleDetailEntity.community
|
||||
articleEntity.time = articleDetailEntity.time
|
||||
articleEntity.title = articleDetailEntity.title
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
package com.gh.common.iinterface
|
||||
|
||||
interface IScrollable {
|
||||
fun scrollToTop()
|
||||
}
|
||||
@ -45,7 +45,7 @@ object ImManager {
|
||||
HaloApp.getInstance().application,
|
||||
ImReceiver.UNIQUE_BROADCAST_ACTION,
|
||||
IM_KEY,
|
||||
UserManager.getInstance().userInfoEntity.name + "(" + UserManager.getInstance().userId + ")",
|
||||
UserManager.getInstance().userInfoEntity?.name + "(" + UserManager.getInstance().userId + ")",
|
||||
UserManager.getInstance().userId)
|
||||
|
||||
shouldShowFloatingWindow = SPUtils.getBoolean(SP_FLOATING_WINDOW_KEY + UserManager.getInstance().userId)
|
||||
@ -75,11 +75,11 @@ object ImManager {
|
||||
try {
|
||||
SPUtils.setBoolean(SP_FLOATING_WINDOW_DOT_KEY + UserManager.getInstance().userId, false)
|
||||
shouldShowFloatingWindowDot = false
|
||||
val chatHelper = KfStartHelper(activity, UserManager.getInstance().userInfoEntity.icon, inputContent, requestCode)
|
||||
val chatHelper = KfStartHelper(activity, UserManager.getInstance().userInfoEntity?.icon, inputContent, requestCode)
|
||||
chatHelper.initSdkChat(
|
||||
ImReceiver.UNIQUE_BROADCAST_ACTION,
|
||||
IM_KEY,
|
||||
UserManager.getInstance().userInfoEntity.name + "(" + UserManager.getInstance().userId + ")"
|
||||
UserManager.getInstance().userInfoEntity?.name + "(" + UserManager.getInstance().userId + ")"
|
||||
+ "[" + BuildConfig.VERSION_NAME + "]",
|
||||
UserManager.getInstance().userId)
|
||||
} catch (e: Exception) {
|
||||
|
||||
@ -5,14 +5,17 @@ object SyncFieldConstants {
|
||||
// 是否点赞
|
||||
const val ANSWER_VOTE = "ANSWER_VOTE"
|
||||
const val ARTICLE_VOTE = "ARTICLE_VOTE"
|
||||
const val ARTICLE_COMMENT_VOTE = "ARTICLE_COMMENT_VOTE"
|
||||
|
||||
// 赞同数量
|
||||
const val ANSWER_VOTE_COUNT = "ANSWER_VOTE_COUNT"
|
||||
const val ARTICLE_VOTE_COUNT = "ARTICLE_VOTE_COUNT"
|
||||
const val ARTICLE_COMMENT_VOTE_COUNT = "ARTICLE_COMMENT_VOTE_COUNT"
|
||||
|
||||
// 评论数量
|
||||
const val ANSWER_COMMENT_COUNT = "ANSWER_COMMENT_COUNT"
|
||||
const val ARTICLE_COMMENT_COUNT = "ARTICLE_COMMENT_COUNT"
|
||||
const val ARTICLE_COMMENT_REPLY_COUNT = "ARTICLE_COMMENT_REPLY_COUNT"
|
||||
|
||||
// 回答数量
|
||||
const val ANSWER_COUNT = "ANSWER_COUNT"
|
||||
|
||||
@ -21,9 +21,7 @@ object ActivationHelper {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun sendActivationInfo() {
|
||||
// 能获取到 IMEI 并且之前没发送过激活信息才发
|
||||
if (!mHasSentActivatedInfo
|
||||
&& Util_System_Phone_State.canGetImei(HaloApp.getInstance().application)) {
|
||||
if (!mHasSentActivatedInfo) {
|
||||
RetrofitManager.getInstance(HaloApp.getInstance().application)
|
||||
.api.postActivationInfo()
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import com.gh.gamecenter.room.AppDatabase
|
||||
import com.gh.gamecenter.room.dao.CommentDraftDao
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
object CommentDraftContainer {
|
||||
val commentDraftDao: CommentDraftDao by lazy { AppDatabase.getInstance(HaloApp.getInstance().application).commentDraftDao() }
|
||||
}
|
||||
@ -33,12 +33,14 @@ object CommentHelper {
|
||||
showConversation: Boolean,
|
||||
articleId: String,
|
||||
communityId: String,
|
||||
ignoreModerator: Boolean = false,
|
||||
listener: OnCommentOptionClickListener?) {
|
||||
showCommentOptions(view = view,
|
||||
commentEntity = commentEntity,
|
||||
showConversation = showConversation,
|
||||
articleId = articleId,
|
||||
communityId = communityId,
|
||||
ignoreModerator = ignoreModerator,
|
||||
listener = listener)
|
||||
}
|
||||
|
||||
@ -77,6 +79,7 @@ object CommentHelper {
|
||||
communityId: String? = null,
|
||||
answerId: String? = null,
|
||||
videoId: String? = null,
|
||||
ignoreModerator: Boolean = false,
|
||||
isVideoAuthor: Boolean = false,
|
||||
listener: OnCommentOptionClickListener? = null) {
|
||||
val context = view.context
|
||||
@ -88,6 +91,8 @@ object CommentHelper {
|
||||
dialogOptions.add("投诉")
|
||||
|
||||
commentEntity.me?.let {
|
||||
if (ignoreModerator) return@let
|
||||
|
||||
if (it.isModerator || (it.moderatorPermissions.hideAnswerComment > Permissions.GUEST
|
||||
|| it.moderatorPermissions.topAnswerComment > Permissions.GUEST
|
||||
|| it.moderatorPermissions.hideCommunityArticleComment > Permissions.GUEST
|
||||
|
||||
@ -12,6 +12,8 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.gh.gamecenter.CommentDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
|
||||
@ -38,7 +40,6 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
@ -50,9 +51,13 @@ import retrofit2.HttpException;
|
||||
public class CommentUtils {
|
||||
|
||||
public static void setCommentTime(TextView textView, long time) {
|
||||
textView.setText(getCommentTime(time));
|
||||
}
|
||||
|
||||
public static String getCommentTime(long timestamp) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
|
||||
try {
|
||||
long day = time * 1000;
|
||||
long day = timestamp * 1000;
|
||||
String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
|
||||
format.applyPattern("yyyy");
|
||||
String currentYear = format.format(day);
|
||||
@ -63,35 +68,34 @@ public class CommentUtils {
|
||||
int hour = (int) (min / (60 * 60));
|
||||
if (hour == 0) {
|
||||
if (min < 60) {
|
||||
textView.setText("刚刚");
|
||||
return "刚刚";
|
||||
} else {
|
||||
textView.setText(String.format(Locale.getDefault(), "%d分钟前", (int) (min / 60)));
|
||||
return String.format(Locale.getDefault(), "%d分钟前", (int) (min / 60));
|
||||
}
|
||||
} else {
|
||||
textView.setText(String.format(Locale.getDefault(), "%d小时前", hour));
|
||||
return String.format(Locale.getDefault(), "%d小时前", hour);
|
||||
}
|
||||
} else if (day >= today - 86400 * 1000 && day < today) {
|
||||
format.applyPattern("HH:mm");
|
||||
textView.setText("昨天 ");
|
||||
return "昨天 ";
|
||||
} else if (day >= today - 86400 * 1000 * 7 && day < today - 86400 * 1000) {
|
||||
format.applyPattern("HH:mm");
|
||||
long days = (today - day) / 86400000 + 1;
|
||||
textView.setText(String.format(Locale.getDefault(), "%d天前 ", days));
|
||||
return String.format(Locale.getDefault(), "%d天前 ", days);
|
||||
} else if (day < today - 86400 * 1000 * 7 && year.equals(currentYear)) {
|
||||
format.applyPattern("MM-dd");
|
||||
textView.setText(format.format(day));
|
||||
return format.format(day);
|
||||
} else {
|
||||
format.applyPattern("yyyy-MM-dd");
|
||||
textView.setText(format.format(day));
|
||||
return format.format(day);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
format.applyPattern("yyyy-MM-dd");
|
||||
textView.setText(format.format(time * 1000));
|
||||
return format.format(timestamp * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void showReportDialog(final CommentEntity commentEntity,
|
||||
final Context context,
|
||||
final boolean showConversation,
|
||||
|
||||
@ -141,7 +141,7 @@ public class DataUtils {
|
||||
|
||||
@Override
|
||||
public void onFailure(String s) {
|
||||
Utils.log(s);
|
||||
MtaHelper.onEventWithBasicDeviceInfo("开发辅助", "GID 获取异常", s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -29,6 +29,12 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.facebook.drawee.generic.GenericDraweeHierarchy;
|
||||
import com.gh.common.AppExecutor;
|
||||
import com.gh.common.constant.Config;
|
||||
@ -56,18 +62,13 @@ import com.halo.assistant.fragment.SettingsFragment;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.utils.AppManager;
|
||||
import com.lightgame.utils.Util_System_Keyboard;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class DialogUtils {
|
||||
|
||||
public static Dialog showWaitDialog(Context context, String msg) {
|
||||
@ -84,7 +85,6 @@ public class DialogUtils {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
public static void showInstallHintDialog(Context context, final ConfirmListener cmListener) {
|
||||
context = checkDialogContext(context);
|
||||
|
||||
@ -543,8 +543,6 @@ public class DialogUtils {
|
||||
clListener.onCancel();
|
||||
});
|
||||
dialog.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -588,7 +586,6 @@ public class DialogUtils {
|
||||
dialog.setContentView(contentView);
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -669,7 +666,6 @@ public class DialogUtils {
|
||||
TextPaint tp = mesage.getPaint();
|
||||
tp.setFakeBoldText(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void showSignDialog(Context context, String title, CharSequence message, CharSequence message2
|
||||
@ -1471,6 +1467,56 @@ public class DialogUtils {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showRegulationTestDialog(Context context, @NonNull ConfirmListener confirmListener, @NonNull CancelListener cancelListener) {
|
||||
context = checkDialogContext(context);
|
||||
|
||||
final Dialog dialog = new TrackableDialog(
|
||||
context,
|
||||
R.style.GhAlertDialog,
|
||||
"礼仪考试",
|
||||
"礼仪考试弹窗",
|
||||
null, null, null,
|
||||
true);
|
||||
|
||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_regulation_test, null);
|
||||
|
||||
View cancelBtn = contentView.findViewById(R.id.cancel);
|
||||
View confirmBtn = contentView.findViewById(R.id.confirm);
|
||||
View linkTv = contentView.findViewById(R.id.link);
|
||||
|
||||
Context finalContext = context;
|
||||
linkTv.setOnClickListener(v -> {
|
||||
|
||||
MtaHelper.onEvent("礼仪考试", "礼仪考试弹窗", "了解更多");
|
||||
DirectUtils.directToArticle(finalContext, "5f4477be25e07e19be4e2a22", "(礼仪测试弹窗)");
|
||||
});
|
||||
|
||||
cancelBtn.setOnClickListener(v -> {
|
||||
cancelListener.onCancel();
|
||||
|
||||
MtaHelper.onEvent("礼仪考试", "礼仪考试弹窗", "跳过");
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
Context finalContext1 = context;
|
||||
confirmBtn.setOnClickListener(v -> {
|
||||
Util_System_Keyboard.hideSoftKeyboard((Activity) finalContext1);
|
||||
|
||||
MtaHelper.onEvent("礼仪考试", "礼仪考试弹窗", "确定");
|
||||
confirmListener.onConfirm();
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
if (window != null) {
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
}
|
||||
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(contentView);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showUnzipFailureDialog(Context context, DownloadEntity downloadEntity) {
|
||||
final Context activityContext = checkDialogContext(context);
|
||||
|
||||
@ -1501,6 +1547,62 @@ public class DialogUtils {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showNoticeDialog(Context context, String title, String content, @NonNull ConfirmListener listener) {
|
||||
context = checkDialogContext(context);
|
||||
|
||||
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
|
||||
|
||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_notice, null);
|
||||
TextView titleTv = contentView.findViewById(R.id.dialog_title);
|
||||
TextView contentTv = contentView.findViewById(R.id.dialog_content);
|
||||
|
||||
if (title == null) {
|
||||
titleTv.setVisibility(View.GONE);
|
||||
} else {
|
||||
titleTv.setVisibility(View.VISIBLE);
|
||||
titleTv.setText(title);
|
||||
}
|
||||
contentTv.setText(content);
|
||||
|
||||
contentView.findViewById(R.id.dialog_ok).setOnClickListener(v -> {
|
||||
listener.onConfirm();
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(contentView);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showUploadVideoChangeLabelDialog(Context context, @NonNull ConfirmListener confirmListener) {
|
||||
context = checkDialogContext(context);
|
||||
|
||||
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
|
||||
|
||||
View contentView = LayoutInflater.from(context).inflate(R.layout.dialog_upload_video_change_label, null);
|
||||
|
||||
View cancelBtn = contentView.findViewById(R.id.cancel);
|
||||
View confirmBtn = contentView.findViewById(R.id.confirm);
|
||||
|
||||
cancelBtn.setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
confirmBtn.setOnClickListener(v -> {
|
||||
confirmListener.onConfirm();
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
if (window != null) {
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
}
|
||||
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(contentView);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context may be is application context
|
||||
* @return activity context
|
||||
|
||||
@ -12,6 +12,7 @@ import com.gh.base.ToolBarActivity
|
||||
import com.gh.base.fragment.BaseFragment_TabLayout
|
||||
import com.gh.common.AppExecutor
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.exposure.ExposureEvent
|
||||
import com.gh.common.exposure.ExposureEvent.Companion.createEvent
|
||||
import com.gh.common.exposure.ExposureManager.log
|
||||
@ -25,12 +26,15 @@ import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.eventbus.EBReuse
|
||||
import com.gh.gamecenter.eventbus.EBSkip
|
||||
import com.gh.gamecenter.forum.detail.ForumDetailActivity
|
||||
import com.gh.gamecenter.fragment.MainWrapperFragment
|
||||
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailActivity
|
||||
import com.gh.gamecenter.game.upload.GameSubmissionActivity
|
||||
import com.gh.gamecenter.gamedetail.GameDetailFragment
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
|
||||
import com.gh.gamecenter.gamedetail.history.HistoryApkListActivity
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.mvvm.Resource
|
||||
import com.gh.gamecenter.mygame.PlayedGameActivity
|
||||
import com.gh.gamecenter.personalhome.UserHomeActivity
|
||||
import com.gh.gamecenter.qa.CommunityFragment
|
||||
@ -94,9 +98,6 @@ object DirectUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到特定页面,只支持App内部跳转
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToLinkPage(context: Context, linkEntity: LinkEntity, entrance: String, path: String) {
|
||||
directToLinkPage(context, linkEntity, entrance, path, null)
|
||||
@ -238,6 +239,8 @@ object DirectUtils {
|
||||
|
||||
"game_upload", "游戏投稿" -> directGameUpload(context, entrance, path)
|
||||
|
||||
"bbs_detail" -> directForumDetail(context, linkEntity.link ?: "", entrance)
|
||||
|
||||
//"h5_game_center" -> directLetoGameCenter(context)
|
||||
|
||||
"" -> {
|
||||
@ -294,6 +297,45 @@ object DirectUtils {
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转至资讯文章列表
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToGameNews(context: Context, gameId: String?, gameName: String?, entrance: String?) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, GameNewsActivity::class.java.name)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_GAMEID, gameId)
|
||||
bundle.putString(KEY_GAMENAME, gameName)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转至游戏日历表
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToGameServerCalendar(context: Context, gameId: String?) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, ServersCalendarActivity::class.java.name)
|
||||
bundle.putParcelable(GameEntity::class.java.simpleName, GameEntity().apply {
|
||||
id = gameId ?: ""
|
||||
})
|
||||
bundle.putParcelable(GameDetailServer::class.java.simpleName, GameDetailServer())
|
||||
bundle.putParcelable(MeEntity::class.java.simpleName, MeEntity())
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转至游戏历史版本页面
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToHistoryApk(context: Context, gameId: String?) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, HistoryApkListActivity::class.java.name)
|
||||
bundle.putString(KEY_GAMEID, gameId)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到新闻详情
|
||||
*/
|
||||
@ -342,15 +384,19 @@ object DirectUtils {
|
||||
* 跳转到游戏详情
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToGameDetail(context: Context, id: String, entrance: String? = null, autoDownload: Boolean? = null, scrollToLibao: Boolean = false, traceEvent: ExposureEvent? = null) {
|
||||
fun directToGameDetail(context: Context, id: String, entrance: String? = null, autoDownload: Boolean? = null, tab: String? = "", traceEvent: ExposureEvent? = null) {
|
||||
if (id.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_TO, GameDetailActivity::class.java.simpleName)
|
||||
bundle.putString(KEY_GAMEID, id)
|
||||
if (scrollToLibao) {
|
||||
bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_TRENDES)
|
||||
bundle.putBoolean(KEY_SCROLL_TO_LIBAO, scrollToLibao)
|
||||
if (!TextUtils.isEmpty(tab)) {
|
||||
when (tab) {
|
||||
"comment" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_RATING)
|
||||
"desc" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_DESC)
|
||||
"forum" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_BBS)
|
||||
"zone" -> bundle.putInt(KEY_TARGET, GameDetailFragment.INDEX_TRENDES)
|
||||
}
|
||||
}
|
||||
if (traceEvent != null) {
|
||||
val clickEvent = createEvent(GameEntity(id), traceEvent.source, appendTrace(traceEvent), ExposureType.CLICK)
|
||||
@ -361,6 +407,19 @@ object DirectUtils {
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到游戏评分详情
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToGameRatingDetail(context: Context, gameId: String? = "", commentId: String? = "", entrance: String? = null) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_GAMEID, gameId)
|
||||
bundle.putString(KEY_COMMENTID, commentId)
|
||||
bundle.putString(KEY_TO, RatingReplyActivity::class.java.name)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转视频流-游戏介绍进入
|
||||
*/
|
||||
@ -582,6 +641,7 @@ object DirectUtils {
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_TO, LibaoDetailActivity::class.java.simpleName)
|
||||
bundle.putString(EntranceUtils.KEY_ID, giftId)
|
||||
HaloApp.put(LibaoEntity.TAG, null)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -662,7 +722,7 @@ object DirectUtils {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToVideoDetail(context: Context, videoId: String, fromLocation: String, showComment: Boolean = false, gameId: String = "", entrance: String? = null,
|
||||
path: String? = "", referer: String = "", type: String = "", act: String = "", fieldId: String = "", sectionName: String = "") {
|
||||
path: String? = "", referer: String = "", type: String = "", act: String = "", paginationType: String = "", fieldId: String = "", sectionName: String = "") {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
@ -675,6 +735,7 @@ object DirectUtils {
|
||||
bundle.putString(KEY_REFERER, referer)
|
||||
bundle.putString(KEY_TYPE, type)
|
||||
bundle.putString(KEY_ACTIVITY_NAME, act)
|
||||
bundle.putString(KEY_PAGINATION_TYPE, paginationType)
|
||||
bundle.putString(KEY_FIELD_ID, fieldId)
|
||||
bundle.putString(KEY_SECTION_NAME, sectionName)
|
||||
jumpActivity(context, bundle)
|
||||
@ -724,6 +785,21 @@ object DirectUtils {
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToFullScreenWebPage(context: Context, url: String, webViewHandleBackPressed: Boolean = false) {
|
||||
context.startActivity(FullScreenWebActivity.getIntent(context, url, webViewHandleBackPressed))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToRegulationTestPage(context: Context) {
|
||||
val url = if ("internal" == BuildConfig.FLAVOR) {
|
||||
Constants.REGULATION_TEST_ADDRESS_DEV
|
||||
} else {
|
||||
Constants.REGULATION_TEST_ADDRESS
|
||||
}
|
||||
directToFullScreenWebPage(context, url, true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转视频合集
|
||||
*/
|
||||
@ -900,4 +976,33 @@ object DirectUtils {
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directForumDetail(context: Context, bbsId: String? = "", entrance: String? = null) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, ForumDetailActivity::class.java.name)
|
||||
bundle.putString(KEY_BBS_ID, bbsId)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 到首页论坛 tab
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToForum(context: Context) {
|
||||
if (RunningUtils.isRunning(context)
|
||||
&& MainActivity::class.java.name == RunningUtils.getBaseActivity(context)) {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
context.startActivity(intent)
|
||||
|
||||
// 这里换个线程操作是为了做一点延时
|
||||
AppExecutor.ioExecutor.execute {
|
||||
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_ASK))
|
||||
}
|
||||
} else {
|
||||
jumpActivity(context, Bundle().apply { putInt(KEY_POSITION, MainWrapperFragment.INDEX_ASK) })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,7 @@ import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@ -272,13 +273,23 @@ public class DisplayUtils {
|
||||
}
|
||||
|
||||
public static int getToastOffset() {
|
||||
int i = Resources.getSystem().getIdentifier("toast_y_offset", "dimen", "android");
|
||||
return HaloApp.getInstance().getApplication().getResources().getDimensionPixelSize(i);
|
||||
try {
|
||||
int i = Resources.getSystem().getIdentifier("toast_y_offset", "dimen", "android");
|
||||
return HaloApp.getInstance().getApplication().getResources().getDimensionPixelSize(i);
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return dip2px(24);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getToastDefaultGravity() {
|
||||
int i = Resources.getSystem().getIdentifier("config_toastDefaultGravity", "integer", "android");
|
||||
return HaloApp.getInstance().getApplication().getResources().getInteger(i);
|
||||
try {
|
||||
int i = Resources.getSystem().getIdentifier("config_toastDefaultGravity", "integer", "android");
|
||||
return HaloApp.getInstance().getApplication().getResources().getInteger(i);
|
||||
} catch (Resources.NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasSoftKeys(Context context) {
|
||||
|
||||
@ -42,6 +42,8 @@ object DownloadNotificationHelper {
|
||||
val downloadNotificationId = (entity.gameId + entity.packageName).hashCode()
|
||||
val xapkStatus = entity.meta[XapkInstaller.XAPK_UNZIP_STATUS]
|
||||
|
||||
if (entity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) == Constants.SILENT_UPDATE) return
|
||||
|
||||
val intent = Intent()
|
||||
if (entity.status == DownloadStatus.done && xapkStatus != XapkUnzipStatus.FAILURE.name) {
|
||||
intent.putExtra(EntranceUtils.KEY_DATA, entity.toJson())
|
||||
@ -56,7 +58,6 @@ object DownloadNotificationHelper {
|
||||
PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// importance == IMPORTANCE_DEFAULT 时每次更新都会触发震动
|
||||
val channel = NotificationChannel(DOWNLOAD_CHANNEL_ID, DOWNLOAD_CHANNEL_ID, NotificationManager.IMPORTANCE_LOW)
|
||||
notificationManager.createNotificationChannel(channel)
|
||||
}
|
||||
@ -69,7 +70,6 @@ object DownloadNotificationHelper {
|
||||
.setGroup(DOWNLOAD_GROUP_KEY)
|
||||
.setWhen(whenTime)
|
||||
|
||||
|
||||
if (xapkStatus == XapkUnzipStatus.FAILURE.name) {
|
||||
builder.setContentText("《" + entity.name + "》解压失败,点击查看详情~")
|
||||
} else {
|
||||
@ -139,32 +139,35 @@ object DownloadNotificationHelper {
|
||||
}
|
||||
|
||||
private fun updateNotificationGroup() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
val notificationManager = getNotificationManager()
|
||||
val activeNotifications = notificationManager.activeNotifications
|
||||
var downloadNotificationSize = 0
|
||||
var downloadGroupNotificationSize = 0
|
||||
for (activeNotification in activeNotifications) {
|
||||
if (activeNotification.id == DOWNLOAD_NOTIFICATION_ID) {
|
||||
downloadNotificationSize++
|
||||
// 部分华为设备调用 getActiveNotifications() 方法时会触发方法内的空指针,这里整体包裹处理了
|
||||
tryCatchInRelease {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
val notificationManager = getNotificationManager()
|
||||
val activeNotifications = notificationManager.activeNotifications
|
||||
var downloadNotificationSize = 0
|
||||
var downloadGroupNotificationSize = 0
|
||||
for (activeNotification in activeNotifications) {
|
||||
if (activeNotification.id == DOWNLOAD_NOTIFICATION_ID) {
|
||||
downloadNotificationSize++
|
||||
}
|
||||
if (activeNotification.id == DOWNLOAD_NOTIFICATION_FOLD_ID) {
|
||||
downloadGroupNotificationSize++
|
||||
}
|
||||
}
|
||||
if (activeNotification.id == DOWNLOAD_NOTIFICATION_FOLD_ID) {
|
||||
downloadGroupNotificationSize++
|
||||
}
|
||||
}
|
||||
|
||||
if (downloadNotificationSize == 0 && downloadGroupNotificationSize != 0) {
|
||||
// 删除组可能会把组内所有通知一并删除
|
||||
notificationManager.cancel(DOWNLOAD_NOTIFICATION_FOLD_ID)
|
||||
} else if (downloadNotificationSize != 0 && downloadGroupNotificationSize == 0) {
|
||||
val groupBuilder = NotificationCompat.Builder(HaloApp.getInstance().application, DOWNLOAD_CHANNEL_ID)
|
||||
.setSmallIcon(R.mipmap.logo)
|
||||
.setGroup(DOWNLOAD_GROUP_KEY)
|
||||
.setGroupSummary(true)
|
||||
.setStyle(NotificationCompat.BigTextStyle().bigText("下载任务"))
|
||||
val groupNotification = groupBuilder.build()
|
||||
groupNotification.flags = groupNotification.flags or Notification.FLAG_NO_CLEAR
|
||||
notificationManager.notify(DOWNLOAD_NOTIFICATION_FOLD_ID, groupNotification)
|
||||
if (downloadNotificationSize == 0 && downloadGroupNotificationSize != 0) {
|
||||
// 删除组可能会把组内所有通知一并删除
|
||||
notificationManager.cancel(DOWNLOAD_NOTIFICATION_FOLD_ID)
|
||||
} else if (downloadNotificationSize != 0 && downloadGroupNotificationSize == 0) {
|
||||
val groupBuilder = NotificationCompat.Builder(HaloApp.getInstance().application, DOWNLOAD_CHANNEL_ID)
|
||||
.setSmallIcon(R.mipmap.logo)
|
||||
.setGroup(DOWNLOAD_GROUP_KEY)
|
||||
.setGroupSummary(true)
|
||||
.setStyle(NotificationCompat.BigTextStyle().bigText("下载任务"))
|
||||
val groupNotification = groupBuilder.build()
|
||||
groupNotification.flags = groupNotification.flags or Notification.FLAG_NO_CLEAR
|
||||
notificationManager.notify(DOWNLOAD_NOTIFICATION_FOLD_ID, groupNotification)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,11 +107,13 @@ object DownloadObserver {
|
||||
if (DownloadStatus.done == downloadEntity.status) {
|
||||
if (downloadEntity.name.contains(mApplication.getString(R.string.app_name))) {
|
||||
MtaHelper.onEvent("软件更新", "下载完成")
|
||||
// 会有 ActivityNotFoundException 异常,catch 掉不管了
|
||||
tryWithDefaultCatch {
|
||||
// 会有 ActivityNotFoundException 异常,catch 掉不管了
|
||||
PackageInstaller.install(mApplication, downloadEntity)
|
||||
if (Constants.SILENT_UPDATE != downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE)) {
|
||||
PackageInstaller.install(mApplication, downloadEntity)
|
||||
DataLogUtils.uploadUpgradeLog(mApplication, "install") //上传更新安装数据
|
||||
}
|
||||
}
|
||||
DataLogUtils.uploadUpgradeLog(mApplication, "install") //上传更新安装数据
|
||||
} else {
|
||||
statDoneEvent(downloadEntity)
|
||||
|
||||
|
||||
@ -1,18 +1,32 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.avoidcallback.AvoidOnResultManager;
|
||||
import com.gh.common.avoidcallback.Callback;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.MainActivity;
|
||||
import com.gh.gamecenter.NormalActivity;
|
||||
import com.gh.gamecenter.SplashScreenActivity;
|
||||
import com.gh.gamecenter.normal.NormalFragment;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
|
||||
/**
|
||||
* @author CsHeng
|
||||
* @Date 2017/4/25
|
||||
@ -25,8 +39,10 @@ public class EntranceUtils {
|
||||
public static final String KEY_NEXT_TO = "next_to";
|
||||
public static final String KEY_NEWSID = "newsId";
|
||||
public static final String KEY_GAMEID = "gameId";
|
||||
public static final String KEY_GAME_ID = "game_id";
|
||||
public static final String KEY_ID = "id";
|
||||
public static final String KEY_URL = "url";
|
||||
public static final String KEY_BUNDLE = "bundle";
|
||||
public static final String KEY_GAMENAME = "gameName";
|
||||
public static final String KEY_PACKAGE_MD5 = "package_md5";
|
||||
public static final String HOST_ARTICLE = "article";
|
||||
@ -38,6 +54,7 @@ public class EntranceUtils {
|
||||
public static final String HOST_VIDEO_COLLECTION = "video_collection";//视频合集
|
||||
public static final String HOST_USERHOME = "userhome";//个人主页
|
||||
public static final String HOST_VIDEO = "video";
|
||||
public static final String HOST_FORUM = "forum";
|
||||
public static final String HOST_CATEGORY = "category";//分类
|
||||
public static final String HOST_COLUMN_COLLECTION = "column_collection";//专题合集
|
||||
public static final String HOST_COMMUNITY_QUESTION_LABEL_DETAIL = "community_question_label_detail";//问题标签详情
|
||||
@ -45,6 +62,8 @@ public class EntranceUtils {
|
||||
public static final String HOST_BLOCK = "block";//板块
|
||||
public static final String HOST_SERVER_BLOCK = "server";//开服表板块
|
||||
public static final String HOST_AMWAY_BLOCK = "amway";//安利墙板块
|
||||
public static final String HOST_GAME_CALENDAR = "game_calendar";// 指定游戏的开服表页面
|
||||
public static final String HOST_HISTORY_APK = "history_apk"; // 历史版本页面
|
||||
public static final String HOST_HELP = "help";//Q&A
|
||||
public static final String HOST_HELP_COLLECTION = "help_collection";//Q&A合集
|
||||
public static final String HOST_GAME_UPLOAD = "game_upload";//游戏上传
|
||||
@ -53,6 +72,7 @@ public class EntranceUtils {
|
||||
public static final String HOST_COMMUNITY_COLUMN = "community_column";
|
||||
public static final String HOST_GAME = "game";
|
||||
public static final String HOST_GAME_DOWNLOAD = "game_download";
|
||||
public static final String HOST_GAME_NEWS = "game_news";
|
||||
public static final String HOST_COLUMN = "column";
|
||||
public static final String HOST_WEB = "web";
|
||||
public static final String HOST_QQ = "qq";
|
||||
@ -60,12 +80,15 @@ public class EntranceUtils {
|
||||
public static final String HOST_QQ_QUN = "qqqun";
|
||||
public static final String HOST_DOWNLOAD = "download";
|
||||
public static final String HOST_UPDATE = "update";
|
||||
public static final String HOST_LINK = "link";
|
||||
public static final String HOST_LIBAO = "libao";
|
||||
public static final String HOST_COMMUNITY = "community";
|
||||
public static final String HOST_SUGGESTION = "suggestion";
|
||||
public static final String HOST_ANSWER = "answer";
|
||||
public static final String HOST_QUESTION = "question";
|
||||
public static final String HOST_TOOLBOX = "toolbox";
|
||||
public static final String HOST_FORUM_DETAIL = "forum_detail";
|
||||
public static final String HOST_GAME_RATING_DETAIL = "game_rating_detail";
|
||||
public static final String KEY_DATA = "data";
|
||||
public static final String KEY_MESSAGE = "message";
|
||||
public static final String KEY_MESSAGE_ID = "message_id";
|
||||
@ -94,6 +117,7 @@ public class EntranceUtils {
|
||||
public static final String KEY_LOCATION = "location";
|
||||
public static final String KEY_CURRENTITEM = "currentItem";
|
||||
public static final String KEY_COMMENTID = "commentId";
|
||||
public static final String KEY_COMMENT_ID = "comment_id";
|
||||
public static final String KEY_SHOW_KEYBOARD_IF_NEEDED = "show_key_board_if_needed";
|
||||
public static final String KEY_PATH = "path";
|
||||
public static final String KEY_OUTER_INFO = "outerInfo";
|
||||
@ -143,6 +167,7 @@ public class EntranceUtils {
|
||||
public static final String KEY_COMMUNITY_ARTICLE_ID = "communityArticleId";
|
||||
public static final String KEY_ARTICLE_COMMENT_ID = "articleCommentId";
|
||||
public static final String KEY_SHOW_ARTICLE_COMMENT = "showArticleComment";
|
||||
public static final String KEY_SCROLL_TO_COMMENT_AREA = "scroll_to_comment_area";
|
||||
public static final String KEY_RATING_STAR_COUNT = "ratingStarCount";
|
||||
public static final String KEY_QUESTION_MODERATOR_PATCH = "questionModeratorPatch";
|
||||
public static final String KEY_SKIP_GAME_COMMENT = "skipGameComment";
|
||||
@ -164,6 +189,7 @@ public class EntranceUtils {
|
||||
public static final String KEY_IS_HOME = "isHome";
|
||||
public static final String KEY_WEB_SHARE = "webShare";
|
||||
public static final String KEY_ACTIVITY_NAME = "activityName";//活动名称
|
||||
public static final String KEY_PAGINATION_TYPE = "paginationType";//活动分页方式
|
||||
public static final String KEY_REQUIRE_REDIRECT = "require_redirect"; // 标记需要再跳转
|
||||
public static final String KEY_FIELD_ID = "field_id"; // 专区板块id
|
||||
public static final String KEY_SECTION_NAME = "section_name"; // 专区专题名
|
||||
@ -176,6 +202,11 @@ public class EntranceUtils {
|
||||
public static final String KEY_KAIFU_SELECT_TIME = "kaifuSelectTime";
|
||||
public static final String KEY_POSTER_PATH = "posterPath";
|
||||
public static final String KEY_BLACK_THEME = "blackTheme";
|
||||
public static final String KEY_FROM_LOGIN = "fromLogin";
|
||||
public static final String KEY_CHANGE_PHONE = "changePhone";
|
||||
public static final String KEY_CONFLICT_PHONE = "conflictPhone";
|
||||
public static final String KEY_CONFLICT_USER = "conflictUser";
|
||||
public static final String KEY_BBS_ID = "bbs_id";
|
||||
|
||||
public static void jumpActivity(Context context, Bundle bundle) {
|
||||
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
|
||||
@ -231,4 +262,82 @@ public class EntranceUtils {
|
||||
context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveShortcut(String activityName, @Nullable Bundle bundle) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
JSONObject json = new JSONObject();
|
||||
|
||||
if (activityName.contains("MainActivity")) {
|
||||
SPUtils.setString(EntranceUtils.KEY_BUNDLE, "");
|
||||
return;
|
||||
}
|
||||
|
||||
if (bundle == null) bundle = new Bundle();
|
||||
try {
|
||||
Set<String> keys = bundle.keySet();
|
||||
json.put(KEY_TO, activityName);
|
||||
for (String key : keys) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Object object = bundle.get(key);
|
||||
if (object instanceof Parcelable) {
|
||||
if (object.toString().toLowerCase().contains("gameentity")) {
|
||||
Utils.toast(HaloApp.getInstance().getApplication(), "暂不支持带游戏实体的页面保存捷径");
|
||||
return;
|
||||
}
|
||||
|
||||
String parcelableName = key + ":parcelable";
|
||||
String parcelableType = object.getClass().getName();
|
||||
String objectJsonString = GsonUtils.toJson(object);
|
||||
JSONObject jObject = new JSONObject(objectJsonString);
|
||||
json.put(parcelableName, parcelableType);
|
||||
json.put(key, jObject);
|
||||
} else {
|
||||
json.put(key, JSONObject.wrap(bundle.get(key)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Utils.toast(HaloApp.getInstance().getApplication(), "保存捷径成功");
|
||||
SPUtils.setString(EntranceUtils.KEY_BUNDLE, json.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
SPUtils.setString(EntranceUtils.KEY_BUNDLE, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void jumpShortcut(Activity activity) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (!hasShortcut()) return;
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(SPUtils.getString(EntranceUtils.KEY_BUNDLE));
|
||||
Iterator iter = jsonObject.keys();
|
||||
String parcelableName = "";
|
||||
while (iter.hasNext()) {
|
||||
String key = (String) iter.next();
|
||||
String value = jsonObject.getString(key);
|
||||
if (key.contains(":parcelable")) {
|
||||
parcelableName = value;
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(parcelableName)) {
|
||||
Class<?> gClass = Class.forName(parcelableName);
|
||||
bundle.putParcelable(key, ((Parcelable) GsonUtils.fromJson(value, gClass)));
|
||||
} else {
|
||||
bundle.putString(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
jumpActivity(activity, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasShortcut() {
|
||||
return !TextUtils.isEmpty(SPUtils.getString(EntranceUtils.KEY_BUNDLE));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -116,6 +116,8 @@ object ErrorHelper {
|
||||
403078 -> Utils.toast(context, "已点赞")
|
||||
403072 -> Utils.toast(context, R.string.comment_failed_userblocked)
|
||||
403082 -> Utils.toast(context, "作者已关闭评论")
|
||||
403022 -> Utils.toast(context, "不能回复自己")
|
||||
403056 -> Utils.toast(context, "发布失败,字数已达上限")
|
||||
|
||||
403020 -> if (showHighPriorityHint) {
|
||||
DialogUtils.showAlertDialog(context,
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.common.util
|
||||
import android.animation.Animator
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Build
|
||||
import android.text.*
|
||||
import android.text.style.ClickableSpan
|
||||
@ -11,6 +12,8 @@ import android.text.style.URLSpan
|
||||
import android.util.TypedValue
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.EditText
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.ColorRes
|
||||
@ -33,6 +36,7 @@ import com.gh.common.view.ExpandTextView
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.WebActivity
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DownloadEntity
|
||||
@ -64,6 +68,14 @@ inline fun <reified VM : ViewModel> Fragment.viewModelProviderFromParent(
|
||||
) =
|
||||
ViewModelProviders.of(requireActivity(), provider).get(VM::class.java)
|
||||
|
||||
/**
|
||||
* 创建以 activity 为观察者上下文的 viewModel
|
||||
*/
|
||||
inline fun <reified VM : ViewModel> FragmentActivity.viewModelProviderFromParent(
|
||||
provider: ViewModelProvider.Factory? = null
|
||||
) =
|
||||
ViewModelProviders.of(this, provider).get(VM::class.java)
|
||||
|
||||
/**
|
||||
* 创建以 fragment 为观察者上下文的 viewModel
|
||||
*/
|
||||
@ -162,6 +174,17 @@ fun View.removeSelectableItemBackground() {
|
||||
background = null
|
||||
}
|
||||
|
||||
fun View.setRoundedColorBackground(@ColorRes color: Int, radius: Float) {
|
||||
val shape = GradientDrawable()
|
||||
shape.cornerRadius = radius.dip2px().toFloat()
|
||||
shape.setColor(ContextCompat.getColor(context, color))
|
||||
background = shape
|
||||
}
|
||||
|
||||
fun View.setDebouncedClickListener(action: () -> Unit) {
|
||||
setOnClickListener { debounceActionWithInterval(interval = 300L) { action.invoke() } }
|
||||
}
|
||||
|
||||
/**
|
||||
* LiveData Extensions
|
||||
*/
|
||||
@ -223,6 +246,28 @@ fun String.containHtmlTag(): Boolean {
|
||||
return matcher.find()
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户行为相关
|
||||
*/
|
||||
fun Fragment.showRegulationTestDialogIfNeeded(action: (() -> Unit)) {
|
||||
if (UserManager.getInstance().userShouldTakeRegulationBaseOnLastRemind()) {
|
||||
DialogUtils.showRegulationTestDialog(requireContext(),
|
||||
{ DirectUtils.directToRegulationTestPage(requireContext()) },
|
||||
{ action.invoke() })
|
||||
} else {
|
||||
action()
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.showRegulationTestDialogIfNeeded(action: (() -> Unit)) {
|
||||
if (UserManager.getInstance().userShouldTakeRegulationBaseOnLastRemind()) {
|
||||
DialogUtils.showRegulationTestDialog(this,
|
||||
{ DirectUtils.directToRegulationTestPage(this) },
|
||||
{ action.invoke() })
|
||||
} else {
|
||||
action()
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 在限定 interval 里只触发一次 action
|
||||
*/
|
||||
@ -380,6 +425,11 @@ fun Float.px2dip(): Int {
|
||||
return (this / scale + 0.5f).toInt()
|
||||
}
|
||||
|
||||
fun Float.sp2px():Int{
|
||||
val scale: Float = HaloApp.getInstance().application.resources.displayMetrics.scaledDensity
|
||||
return (this * scale + 0.5f).toInt()
|
||||
}
|
||||
|
||||
/**
|
||||
* PopupWindow 自动适配方向
|
||||
* 弹出与锚点右对齐
|
||||
@ -460,6 +510,15 @@ fun FragmentActivity.checkStoragePermissionBeforeAction(action: (() -> Unit)) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* List related.
|
||||
*/
|
||||
|
||||
// Returns the second element, or `null` if the list is empty.
|
||||
fun <T> List<T>.secondOrNull(): T? {
|
||||
return if (isEmpty() || size == 1) null else this[1]
|
||||
}
|
||||
|
||||
/**
|
||||
* TextView related.
|
||||
*/
|
||||
@ -589,10 +648,14 @@ fun DownloadEntity.addMetaExtra(key: String, value: String?) {
|
||||
value?.let { meta[key] = value }
|
||||
}
|
||||
|
||||
fun DownloadEntity.getMetaExtra(key: String) : String {
|
||||
fun DownloadEntity.getMetaExtra(key: String): String {
|
||||
return meta[key] ?: ""
|
||||
}
|
||||
|
||||
fun DownloadEntity.isSilentUpdate(): Boolean {
|
||||
return Constants.SILENT_UPDATE == getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE)
|
||||
}
|
||||
|
||||
/**
|
||||
* Process related
|
||||
*/
|
||||
@ -744,4 +807,15 @@ fun List<String>?.checkSameFromStringArray(check2: List<String>?): Boolean {
|
||||
if (!this.contains(tag)) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* EditText弹出软键盘
|
||||
*/
|
||||
fun EditText.showKeyBoard() {
|
||||
this.postDelayed({
|
||||
this.requestFocus()
|
||||
val inputMethodManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
inputMethodManager.showSoftInput(this, 0)
|
||||
}, 300)
|
||||
}
|
||||
@ -23,7 +23,7 @@ object GdtHelper {
|
||||
const val PLATFORM = "PLATFORM"
|
||||
|
||||
fun init(application: Application) {
|
||||
GDTAction.init(application, "1110071928", "7fe03caa04ed382e9dce401312b1d0ae")
|
||||
GDTAction.init(application, "1110680399", "f5ddaafbf520d7d7385499232a408d0a")
|
||||
}
|
||||
|
||||
fun logAction(type: String) {
|
||||
|
||||
@ -32,6 +32,10 @@ object ImageUtils {
|
||||
|
||||
private const val PIC_MAX_FILE_SIZE: Long = 10 * 1024 * 1024
|
||||
|
||||
private val TINY_GIF_SIZE = 30F.dip2px()
|
||||
private val LARGE_GIF_SIZE = 80F.dip2px()
|
||||
private val STANDARD_GIF_SIZE = 60F.dip2px()
|
||||
|
||||
@JvmStatic
|
||||
fun getUploadFileMaxSize(): Long {
|
||||
val uploadLimitSize = Config.getSettings()?.image?.uploadLimitSize
|
||||
@ -245,12 +249,23 @@ object ImageUtils {
|
||||
// 图片是以 gif 结尾的就
|
||||
if (it.endsWith(".gif") && view?.getTag(R.id.tag_show_gif) != false) {
|
||||
if (view?.tag == url) return@let
|
||||
|
||||
val controller = Fresco.newDraweeControllerBuilder()
|
||||
.setUri(url)
|
||||
.setAutoPlayAnimations(true)
|
||||
.build()
|
||||
view?.controller = controller
|
||||
val width = view?.layoutParams?.width
|
||||
val height = view?.layoutParams?.height
|
||||
if (width != null && width > 0) {
|
||||
val controller = Fresco.newDraweeControllerBuilder()
|
||||
.setUri(resizeGif(url, width, height ?: 0))
|
||||
.setAutoPlayAnimations(true)
|
||||
.build()
|
||||
view.controller = controller
|
||||
} else {
|
||||
view?.post {
|
||||
val controller = Fresco.newDraweeControllerBuilder()
|
||||
.setUri(resizeGif(url, view.width, view.height))
|
||||
.setAutoPlayAnimations(true)
|
||||
.build()
|
||||
view.controller = controller
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val width = view?.layoutParams?.width
|
||||
if (width != null && width > 0) {
|
||||
@ -338,6 +353,23 @@ object ImageUtils {
|
||||
imagePipeline.prefetchToDiskCache(imageRequest, HaloApp.getInstance().application)
|
||||
}
|
||||
|
||||
private fun resizeGif(url: String, width: Int, height: Int): String {
|
||||
val idealSize = getIdealGifSize(width, height)
|
||||
return "$url?x-oss-process=image/resize,h_$idealSize,w_$idealSize"
|
||||
}
|
||||
|
||||
private fun getIdealGifSize(width: Int, height: Int): String {
|
||||
return if (width > LARGE_GIF_SIZE || height > LARGE_GIF_SIZE) {
|
||||
"256"
|
||||
} else if (width >= STANDARD_GIF_SIZE || height >= STANDARD_GIF_SIZE) {
|
||||
"192"
|
||||
} else if (width > TINY_GIF_SIZE || height > TINY_GIF_SIZE) {
|
||||
"128"
|
||||
} else {
|
||||
"64"
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnImageloadListener {
|
||||
fun onLoadFinal(imageInfo: ImageInfo?)
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.LibaoEntity;
|
||||
import com.gh.gamecenter.entity.LibaoStatusEntity;
|
||||
import com.gh.gamecenter.entity.MeEntity;
|
||||
import com.gh.gamecenter.entity.NotificationUgc;
|
||||
import com.gh.gamecenter.entity.UserDataLibaoEntity;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.eventbus.EBUISwitch;
|
||||
@ -455,20 +456,26 @@ public class LibaoUtils {
|
||||
|
||||
adapter.initLibaoCode(new UserDataLibaoEntity(libaoCode, "ling", Utils.getTime(context)));
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
final String finalLibaoCode = libaoCode;
|
||||
DialogUtils.showWarningDialog(context, "领取成功", Html.fromHtml(context.getString(R.string.linged_dialog, libaoCode))
|
||||
, "关闭", " 复制礼包码"
|
||||
, () -> {
|
||||
copyLink(finalLibaoCode, context);
|
||||
if (isInstallRequired) {
|
||||
libaoBtn.postDelayed(() -> {
|
||||
Spanned msg = Html.fromHtml(context.getString(R.string.linged_copy_dialog, finalLibaoCode));
|
||||
lunningAppDialog(context
|
||||
, msg, libaoEntity);
|
||||
}, 300);
|
||||
}
|
||||
}, null);
|
||||
NotificationHelper.showNotificationHintDialog(NotificationUgc.GIFT, isShow -> {
|
||||
if (!isShow){
|
||||
DialogUtils.showWarningDialog(context, "领取成功", Html.fromHtml(context.getString(R.string.linged_dialog, finalLibaoCode))
|
||||
, "关闭", " 复制礼包码"
|
||||
, () -> {
|
||||
copyLink(finalLibaoCode, context);
|
||||
if (isInstallRequired) {
|
||||
libaoBtn.postDelayed(() -> {
|
||||
Spanned msg = Html.fromHtml(context.getString(R.string.linged_copy_dialog, finalLibaoCode));
|
||||
lunningAppDialog(context
|
||||
, msg, libaoEntity);
|
||||
}, 300);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
@ -19,9 +20,12 @@ import com.gh.common.loghub.SimpleLogContainerEntity;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.ShareResultEntity;
|
||||
import com.gh.gamecenter.entity.SpecialColumn;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
import com.gh.gamecenter.qa.entity.Questions;
|
||||
import com.gh.gamecenter.retrofit.EmptyResponse;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.utils.Util_System_Phone_State;
|
||||
import com.lightgame.utils.Utils;
|
||||
@ -32,6 +36,10 @@ import org.json.JSONObject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* Created by khy on 2/01/18.
|
||||
*/
|
||||
@ -487,6 +495,7 @@ public class LogUtils {
|
||||
uploadShare(object);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public static void uploadShareResult(String shareType, String entrance, String shareResult, String url, String title, String summary, String resourceId) {
|
||||
JSONObject object = new JSONObject();
|
||||
JSONObject payloadObject = new JSONObject();
|
||||
@ -504,5 +513,13 @@ public class LogUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
uploadShare(object);
|
||||
|
||||
ShareResultEntity entity = new ShareResultEntity(new ShareResultEntity.Content(url, title, summary), shareType, shareResult);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), GsonUtils.toJson(entity));
|
||||
|
||||
RetrofitManager.getInstance(HaloApp.getInstance().getApplication()).getApi()
|
||||
.postShareResult(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new EmptyResponse<>());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,9 @@ package com.gh.common.util
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.widget.Toast
|
||||
import com.bytedance.sdk.open.aweme.authorize.model.Authorization
|
||||
import com.bytedance.sdk.open.douyin.DouYinOpenApiFactory
|
||||
import com.bytedance.sdk.open.douyin.DouYinOpenConfig
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.user.LoginTag
|
||||
@ -89,6 +91,8 @@ object LoginHelper {
|
||||
|
||||
WbSdk.install(context, AuthInfo(context, Config.WEIBO_APPKEY, "http://www.sina.com", WEIBO_SCOPE))
|
||||
|
||||
DouYinOpenApiFactory.init(DouYinOpenConfig(Config.DOUYIN_CLIENTKEY))
|
||||
|
||||
Utils.log("LoginHelper initialization")
|
||||
}
|
||||
|
||||
@ -107,6 +111,16 @@ object LoginHelper {
|
||||
mLoginCallback?.get()?.onLoginFailure(LoginTag.wechat, error)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun onDouYinLoginSuccess(content: JSONObject) {
|
||||
mLoginCallback?.get()?.onLoginSuccess(LoginTag.douyin, content)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun onDouYinLoginFailure(error: String) {
|
||||
mLoginCallback?.get()?.onLoginFailure(LoginTag.douyin, error)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun onWeiboLoginCallback(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
mSsoHandler?.get()?.authorizeCallBack(requestCode, resultCode, data)
|
||||
@ -187,6 +201,19 @@ object LoginHelper {
|
||||
mAccessToken = AccessTokenKeeper.readAccessToken(context)
|
||||
}
|
||||
|
||||
// 抖音登录
|
||||
@JvmStatic
|
||||
fun loginWithDouYin(loginCallback: LoginCallback, context: Activity) {
|
||||
mLoginCallback = WeakReference(loginCallback)
|
||||
val douYinOpenApi = DouYinOpenApiFactory.create(context)
|
||||
|
||||
val request = Authorization.Request()
|
||||
request.scope = "user_info" // 用户授权时必选权限
|
||||
//request.state = "ww"; // 用于保持请求和回调的状态,授权请求后原样带回给第三方。
|
||||
//request.callerLocalEntry = "com.xxx.xxx...activity";
|
||||
douYinOpenApi.authorize(request)
|
||||
}
|
||||
|
||||
interface LoginCallback {
|
||||
fun onLoginSuccess(loginType: LoginTag, jsonContent: JSONObject)
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ import io.reactivex.schedulers.Schedulers
|
||||
object NotificationHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun showNotificationHintDialog(ugc: NotificationUgc) {
|
||||
fun showNotificationHintDialog(ugc: NotificationUgc, callBack: ((isShow: Boolean) -> Unit)? = null) {
|
||||
val showedNewVersion = SPUtils.getInt(Constants.SP_SHOWED_NOTIFICATION_NEW_VERSION, 0)
|
||||
val currentVersion = PackageUtils.getVersionCode()
|
||||
// 版本升级后重置数据
|
||||
@ -29,6 +29,9 @@ object NotificationHelper {
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_ARTICLE, false)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_VIDEO, false)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_RATING, false)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_GIFT, false)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_RESERVE_GAME, false)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_FEEDBACK, false)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, "")
|
||||
|
||||
SPUtils.setInt(Constants.SP_SHOWED_NOTIFICATION_NEW_VERSION, currentVersion)
|
||||
@ -37,7 +40,10 @@ object NotificationHelper {
|
||||
|
||||
val isShowedToday = SPUtils.getString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, "")
|
||||
// 每天最多只需提示一次
|
||||
if (isShowedToday == TimeUtils.getToday()) return
|
||||
if (isShowedToday == TimeUtils.getToday()){
|
||||
callBack?.invoke(false)
|
||||
return
|
||||
}
|
||||
|
||||
val isShowedLogin = SPUtils.getBoolean(Constants.SP_SHOWED_NOTIFICATION_LOGIN, false)
|
||||
val isShowedQuestion = SPUtils.getBoolean(Constants.SP_SHOWED_NOTIFICATION_QUESTION, false)
|
||||
@ -45,78 +51,115 @@ object NotificationHelper {
|
||||
val isShowedArticle = SPUtils.getBoolean(Constants.SP_SHOWED_NOTIFICATION_ARTICLE, false)
|
||||
val isShowedVideo = SPUtils.getBoolean(Constants.SP_SHOWED_NOTIFICATION_VIDEO, false)
|
||||
val isShowedRating = SPUtils.getBoolean(Constants.SP_SHOWED_NOTIFICATION_RATING, false)
|
||||
val isShowedGift = SPUtils.getBoolean(Constants.SP_SHOWED_NOTIFICATION_GIFT, false)
|
||||
val isShowedReserveGame = SPUtils.getBoolean(Constants.SP_SHOWED_NOTIFICATION_RESERVE_GAME, false)
|
||||
val isShowedFeedback = SPUtils.getBoolean(Constants.SP_SHOWED_NOTIFICATION_FEEDBACK, false)
|
||||
|
||||
if (isShowedLogin && isShowedQuestion && isShowedAnswer && isShowedArticle && isShowedVideo && isShowedRating) return
|
||||
if (isShowedLogin && isShowedQuestion && isShowedAnswer && isShowedArticle && isShowedVideo && isShowedRating && isShowedGift && isShowedReserveGame && isShowedFeedback) {
|
||||
callBack?.invoke(false)
|
||||
return
|
||||
}
|
||||
|
||||
when (ugc) {
|
||||
NotificationUgc.LOGIN -> {
|
||||
if (!isShowedLogin) {
|
||||
show(AppManager.getInstance().currentActivity() as AppCompatActivity)
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_LOGIN, true)
|
||||
// 设置今天的时间,表示今天已经触发过了
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
NotificationUgc.QUESTION -> {
|
||||
if (!isShowedQuestion) {
|
||||
show(AppManager.getInstance().currentActivity() as AppCompatActivity)
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_QUESTION, true)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
NotificationUgc.ANSWER -> {
|
||||
if (!isShowedAnswer) {
|
||||
show(AppManager.getInstance().currentActivity() as AppCompatActivity)
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_ANSWER, true)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
NotificationUgc.ARTICLE -> {
|
||||
if (!isShowedArticle) {
|
||||
show(AppManager.getInstance().currentActivity() as AppCompatActivity)
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_ARTICLE, true)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
NotificationUgc.VIDEO -> {
|
||||
if (!isShowedVideo) {
|
||||
show(AppManager.getInstance().currentActivity() as AppCompatActivity)
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_VIDEO, true)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
NotificationUgc.RATING -> {
|
||||
if (!isShowedRating) {
|
||||
show(AppManager.getInstance().currentActivity() as AppCompatActivity)
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_RATING, true)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
NotificationUgc.GIFT -> {
|
||||
if (!isShowedGift) {
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_GIFT, true)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
NotificationUgc.RESERVE_GAME -> {
|
||||
if (!isShowedReserveGame) {
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_RESERVE_GAME, true)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
NotificationUgc.FEEDBACK -> {
|
||||
if (!isShowedFeedback) {
|
||||
show(AppManager.getInstance().recentActiveActivity as AppCompatActivity, ugc, callBack)
|
||||
SPUtils.setBoolean(Constants.SP_SHOWED_NOTIFICATION_FEEDBACK, true)
|
||||
SPUtils.setString(Constants.SP_IS_SHOWED_NOTIFICATION_TODAY, TimeUtils.getToday())
|
||||
} else {
|
||||
callBack?.invoke(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun show(activity: AppCompatActivity?) {
|
||||
fun show(activity: AppCompatActivity?, ugc: NotificationUgc, callBack: ((isShow: Boolean) -> Unit)? = null) {
|
||||
if (activity == null) return
|
||||
RetrofitManager.getInstance(activity).api.bootPopup
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<NotificationHint>() {
|
||||
override fun onSuccess(data: NotificationHint) {
|
||||
try {
|
||||
showEnableNotificationDialogIfItsDisabled(activity, data)
|
||||
} catch (ignore: Exception) {
|
||||
}
|
||||
}
|
||||
})
|
||||
showEnableNotificationDialogIfItsDisabled(activity, ugc, callBack)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showEnableNotificationDialogIfItsDisabled(activity: AppCompatActivity, notificationHint: NotificationHint) {
|
||||
fun showEnableNotificationDialogIfItsDisabled(activity: AppCompatActivity, ugc: NotificationUgc, callBack: ((isShow: Boolean) -> Unit)? = null) {
|
||||
if (notificationIsEnable()) {
|
||||
Utils.log("notification is enable")
|
||||
callBack?.invoke(false)
|
||||
} else {
|
||||
NotificationHintDialogFragment.getInstance(notificationHint).show(activity.supportFragmentManager, "notification")
|
||||
callBack?.invoke(true)
|
||||
NotificationHintDialogFragment.getInstance(ugc).show(activity.supportFragmentManager, "notification")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +120,6 @@ public class PostCommentUtils {
|
||||
final String commentId,
|
||||
final PostCommentListener listener) {
|
||||
|
||||
|
||||
Observable<ResponseBody> observable;
|
||||
|
||||
if (!TextUtils.isEmpty(answerId)) {
|
||||
@ -260,7 +259,6 @@ public class PostCommentUtils {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public interface PostCommentListener {
|
||||
void postSuccess(JSONObject response);
|
||||
|
||||
|
||||
@ -27,10 +27,6 @@ import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.facebook.common.references.CloseableReference;
|
||||
import com.facebook.datasource.DataSource;
|
||||
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber;
|
||||
import com.facebook.imagepipeline.image.CloseableImage;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.WeiBoShareActivity;
|
||||
@ -72,7 +68,6 @@ public class ShareUtils {
|
||||
private String mTitle;
|
||||
private String mSummary;
|
||||
|
||||
|
||||
private int[] arrLogo = {
|
||||
R.drawable.share_wechat_logo,
|
||||
R.drawable.share_wechatmoments_logo,
|
||||
|
||||
@ -22,6 +22,12 @@ class SpanBuilder(content: String) {
|
||||
return this
|
||||
}
|
||||
|
||||
fun color(start: Int, end: Int, colorRes: Int): SpanBuilder {
|
||||
val colorSpan = ForegroundColorSpan(ContextCompat.getColor(HaloApp.getInstance().application, colorRes))
|
||||
spannableString.setSpan(colorSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
return this
|
||||
}
|
||||
|
||||
fun color(start: Int, end: Int, colorHexInString: String): SpanBuilder {
|
||||
tryWithDefaultCatch {
|
||||
val colorSpan = ForegroundColorSpan(Color.parseColor(colorHexInString))
|
||||
|
||||
@ -47,7 +47,7 @@ public class ClearEditTextNormal extends androidx.appcompat.widget.AppCompatEdit
|
||||
mClearDrawable = getCompoundDrawables()[2];
|
||||
if (mClearDrawable == null) {
|
||||
// throw new NullPointerException("You can add drawableRight attribute in XML");
|
||||
mClearDrawable = getResources().getDrawable(R.drawable.icon_close);
|
||||
mClearDrawable = getResources().getDrawable(R.drawable.icon_input_close);
|
||||
}
|
||||
|
||||
// mClearDrawable.setBounds(0, 0, mClearDrawable.getIntrinsicWidth(), mClearDrawable.getIntrinsicHeight());
|
||||
|
||||
@ -13,8 +13,8 @@ import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.gh.common.util.DisplayUtils
|
||||
import com.gh.common.view.ConfigFilterView.SortSize.Companion.SORT_SIZE_LIST
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.entity.SubjectSettingEntity
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
|
||||
class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)
|
||||
@ -26,6 +26,8 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
var ratingTv: TextView //目前只在专题页面显示
|
||||
var recommendedTv: TextView
|
||||
|
||||
var sizeFilterArray: ArrayList<SubjectSettingEntity.Size>? = null
|
||||
|
||||
private var mOnConfigFilterSetupListener: OnConfigFilterSetupListener? = null
|
||||
|
||||
init {
|
||||
@ -37,6 +39,7 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
recommendedTv = findViewById(R.id.recommended_tv)
|
||||
|
||||
mSizeTv.setOnClickListener {
|
||||
mOnConfigFilterSetupListener?.onShowSortSize()
|
||||
showSelectionPopupWindow(this, mSizeTv, mSizeTv.text.toString())
|
||||
}
|
||||
|
||||
@ -98,12 +101,21 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
val flexboxLayout = layout.findViewById<FlexboxLayout>(R.id.flexbox)
|
||||
val backgroundView = layout.findViewById<View>(R.id.background)
|
||||
|
||||
sizeFilterArray = if (sizeFilterArray == null) {
|
||||
getDefaultSizeFilterArray()
|
||||
} else {
|
||||
sizeFilterArray?.apply {
|
||||
if (firstOrNull()?.text != "全部大小") {
|
||||
add(0, SubjectSettingEntity.Size(min = -1, max = -1, text = "全部大小"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
backgroundView.setOnClickListener {
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
|
||||
for ((index, sortSizeText) in SORT_SIZE_LIST.withIndex()) {
|
||||
|
||||
for (size in sizeFilterArray!!) {
|
||||
val item = inflater.inflate(R.layout.item_filter_size, flexboxLayout, false)
|
||||
|
||||
// 单列 4 个,强行设置宽度为屏幕的 1/4
|
||||
@ -114,22 +126,22 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
flexboxLayout.addView(item)
|
||||
|
||||
val tv = item.findViewById<TextView>(R.id.size_tv)
|
||||
tv.text = sortSizeText
|
||||
tv.text = size.text
|
||||
|
||||
if (sizeText == sortSizeText) {
|
||||
if (sizeText == size.text) {
|
||||
toggleHighlightedTextView(tv, true)
|
||||
} else {
|
||||
toggleHighlightedTextView(tv, false)
|
||||
}
|
||||
|
||||
tv.tag = SortSize.values()[index]
|
||||
tv.tag = size.text
|
||||
|
||||
item.setOnClickListener {
|
||||
toggleHighlightedTextView(tv, true)
|
||||
popupWindow.dismiss()
|
||||
sizeTv.text = sortSizeText
|
||||
sizeTv.text = size.text
|
||||
|
||||
mOnConfigFilterSetupListener?.onSetupSortSize(tv.tag as SortSize)
|
||||
mOnConfigFilterSetupListener?.onSetupSortSize(size)
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,8 +157,20 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
popupWindow.showAsDropDown(containerView, 0, 0)
|
||||
}
|
||||
|
||||
private fun getDefaultSizeFilterArray(): ArrayList<SubjectSettingEntity.Size> {
|
||||
return arrayListOf<SubjectSettingEntity.Size>().apply {
|
||||
add(SubjectSettingEntity.Size(min = -1, max = -1, text = "全部大小"))
|
||||
add(SubjectSettingEntity.Size(min = -1, max = 20, text = "20M以下"))
|
||||
add(SubjectSettingEntity.Size(min = 20, max = 50, text = "20-50M"))
|
||||
add(SubjectSettingEntity.Size(min = 50, max = 100, text = "50-100M"))
|
||||
add(SubjectSettingEntity.Size(min = 100, max = 500, text = "100-500M"))
|
||||
add(SubjectSettingEntity.Size(min = 500, max = -1, text = "500M以上"))
|
||||
}
|
||||
}
|
||||
|
||||
interface OnConfigFilterSetupListener {
|
||||
fun onSetupSortSize(sortSize: SortSize)
|
||||
fun onShowSortSize()
|
||||
fun onSetupSortSize(sortSize: SubjectSettingEntity.Size)
|
||||
fun onSetupSortType(sortType: SortType)
|
||||
}
|
||||
|
||||
@ -156,41 +180,4 @@ class ConfigFilterView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
RATING
|
||||
}
|
||||
|
||||
enum class SortSize(val value: String) {
|
||||
UNSPECIFIED("全部大小"),
|
||||
|
||||
SMALLER_THAN_20M("20M以下"),
|
||||
|
||||
BETWEEN_20M_AND_50M("20-50M"),
|
||||
|
||||
BETWEEN_50M_AND_100M("50-100M"),
|
||||
|
||||
BETWEEN_100M_AND_500M("100-500M"),
|
||||
|
||||
LARGER_THAN_500M("500M以上");
|
||||
|
||||
override fun toString() = value
|
||||
|
||||
fun toSize(): Size {
|
||||
return when (this) {
|
||||
UNSPECIFIED -> Size(minSize = -1, maxSize = -1)
|
||||
SMALLER_THAN_20M -> Size(minSize = -1, maxSize = 20)
|
||||
BETWEEN_20M_AND_50M -> Size(minSize = 20, maxSize = 50)
|
||||
BETWEEN_50M_AND_100M -> Size(minSize = 50, maxSize = 100)
|
||||
BETWEEN_100M_AND_500M -> Size(minSize = 100, maxSize = 500)
|
||||
LARGER_THAN_500M -> Size(minSize = 500, maxSize = -1)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val SORT_SIZE_LIST = arrayListOf<String>().apply {
|
||||
values().iterator().forEach {
|
||||
this.add(it.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class Size(var minSize: Int = -1, var maxSize: Int = -1)
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.common.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.LinearLayout
|
||||
|
||||
/**
|
||||
* 自定义ViewGroup中child绘制顺序
|
||||
*/
|
||||
class CustomOrderDrawChildLinearLayout(context: Context?, attrs: AttributeSet?) : LinearLayout(context, attrs) {
|
||||
|
||||
override fun isChildrenDrawingOrderEnabled(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getChildDrawingOrder(childCount: Int, i: Int): Int {
|
||||
return childCount - i - 1//倒序
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,8 @@ public class FixLinearLayoutManager extends LinearLayoutManager {
|
||||
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
try {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (Exception ignore) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
app/src/main/java/com/gh/common/view/FixedScrollView.kt
Normal file
24
app/src/main/java/com/gh/common/view/FixedScrollView.kt
Normal file
@ -0,0 +1,24 @@
|
||||
package com.gh.common.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.widget.ScrollView
|
||||
|
||||
/**
|
||||
* 不能滑动的 ScrollView
|
||||
*/
|
||||
class FixedScrollView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ScrollView(context, attrs) {
|
||||
|
||||
override fun onTouchEvent(ev: MotionEvent?): Boolean {
|
||||
return when (ev?.action) {
|
||||
MotionEvent.ACTION_DOWN -> true
|
||||
else -> super.onTouchEvent(ev)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@ -9,6 +9,7 @@ import com.facebook.drawee.generic.RoundingParams
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.gh.common.util.DisplayUtils
|
||||
import com.gh.common.util.ImageUtils
|
||||
import com.gh.common.util.goneIf
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import kotlinx.android.synthetic.main.layout_game_icon.view.*
|
||||
@ -16,11 +17,14 @@ import kotlinx.android.synthetic.main.layout_game_icon.view.*
|
||||
class GameIconView : ConstraintLayout {
|
||||
|
||||
private var mCornerRadius = 10
|
||||
private var mBorderColor = 0
|
||||
private var mBorderWidth = 1
|
||||
|
||||
constructor(context: Context) : super(context, null)
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs, 0) {
|
||||
initView(attrs)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
initView(attrs)
|
||||
}
|
||||
@ -30,22 +34,33 @@ class GameIconView : ConstraintLayout {
|
||||
|
||||
val ta = context.obtainStyledAttributes(attrs, R.styleable.GameIconView)
|
||||
mCornerRadius = ta.getDimensionPixelSize(R.styleable.GameIconView_gameIconCornerRadius, DisplayUtils.dip2px(10F))
|
||||
mBorderColor = ta.getColor(R.styleable.GameIconView_gameIconBorderColor, 0)
|
||||
mBorderWidth = ta.getDimensionPixelSize(R.styleable.GameIconView_gameIconBorderWidth, 1)
|
||||
ta.recycle()
|
||||
|
||||
val roundingParams = RoundingParams.fromCornersRadius(mCornerRadius.toFloat())
|
||||
|
||||
if (mBorderColor != 0) {
|
||||
roundingParams.setBorder(mBorderColor, mBorderWidth.toFloat())
|
||||
}
|
||||
gameIconIv.hierarchy.roundingParams = roundingParams
|
||||
gameIconDecoratorIv.hierarchy.roundingParams = roundingParams
|
||||
}
|
||||
|
||||
fun setGameEntity(game: GameEntity) {
|
||||
fun displayGameIcon(game: GameEntity) {
|
||||
if (!TextUtils.isEmpty(game.rawIcon)) {
|
||||
ImageUtils.display(gameIconIv, game.rawIcon)
|
||||
ImageUtils.display(gameIconDecoratorIv, game.iconSubscript)
|
||||
displayGameIcon(game.rawIcon ?: "", game.iconSubscript)
|
||||
} else {
|
||||
ImageUtils.display(gameIconIv, game.icon)
|
||||
displayGameIcon(game.icon ?: "", null)
|
||||
}
|
||||
}
|
||||
|
||||
fun displayGameIcon(icon: String?, iconSubscript: String?) {
|
||||
ImageUtils.display(gameIconIv, icon)
|
||||
ImageUtils.display(gameIconDecoratorIv, iconSubscript)
|
||||
gameIconDecoratorIv.goneIf(TextUtils.isEmpty(iconSubscript))
|
||||
}
|
||||
|
||||
fun getIconIv(): SimpleDraweeView = gameIconIv
|
||||
|
||||
fun getIconDecoratorIv(): SimpleDraweeView = gameIconDecoratorIv
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.gh.common.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
public class NoScrollFocusScrollView extends ScrollView {
|
||||
|
||||
public NoScrollFocusScrollView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public NoScrollFocusScrollView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public NoScrollFocusScrollView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -14,11 +14,11 @@ import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import com.gh.common.DefaultJsApi;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.DeviceUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.EmptyCallback;
|
||||
import com.gh.common.util.GsonUtils;
|
||||
import com.gh.common.util.HtmlUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
@ -69,6 +69,10 @@ public class RichEditor extends WebView {
|
||||
private int mDefaultImageWidth;
|
||||
private int mThumbnailImageWidth;
|
||||
|
||||
private EmptyCallback mInitialLayoutCallback;
|
||||
|
||||
private String mCurrentContent = "";
|
||||
|
||||
public enum Type {
|
||||
BOLD,
|
||||
ITALIC,
|
||||
@ -173,6 +177,10 @@ public class RichEditor extends WebView {
|
||||
mChromeClientListener = chromeClientListener;
|
||||
}
|
||||
|
||||
public void setLayoutCallback(EmptyCallback layoutCallback) {
|
||||
mInitialLayoutCallback = layoutCallback;
|
||||
}
|
||||
|
||||
private void callback(String text) {
|
||||
mContents = text.replaceFirst(CALLBACK_SCHEME, "");
|
||||
if (mTextChangeListener != null) {
|
||||
@ -594,6 +602,10 @@ public class RichEditor extends WebView {
|
||||
this.mContentOwner = contentOwner;
|
||||
}
|
||||
|
||||
public String getCurrentContent() {
|
||||
return mCurrentContent;
|
||||
}
|
||||
|
||||
public interface WebChromeClientListener {
|
||||
void onPageFinished(WebView view, String url);
|
||||
|
||||
@ -720,4 +732,15 @@ public class RichEditor extends WebView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
if (mInitialLayoutCallback != null &&getHeight() > 0) {
|
||||
// 仅初次 layout 完成会有回调
|
||||
mInitialLayoutCallback.onCallback();
|
||||
mInitialLayoutCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -407,7 +407,17 @@ public class DWebView extends WebView {
|
||||
|
||||
private void _evaluateJavascript(String script) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
DWebView.super.evaluateJavascript(script, null);
|
||||
try {
|
||||
DWebView.super.evaluateJavascript(script, null);
|
||||
} catch (Exception e) {
|
||||
// 部分机型把自己伪装成 Android 4.4 然后没 evaluateJavascript 方法!
|
||||
e.printStackTrace();
|
||||
try {
|
||||
super.loadUrl("javascript:" + script);
|
||||
} catch (Exception ignored){
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.loadUrl("javascript:" + script);
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package com.gh.common.view.vertical_recycler
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.PointF
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.LinearSmoothScroller
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.util.tryWithDefaultCatch
|
||||
|
||||
class SnappingLinearLayoutManager(val context: Context) : LinearLayoutManager(context) {
|
||||
override fun smoothScrollToPosition(recyclerView: RecyclerView?, state: RecyclerView.State?, position: Int) {
|
||||
tryWithDefaultCatch {
|
||||
val smoothScroller = object : LinearSmoothScroller(context) {
|
||||
override fun getVerticalSnapPreference(): Int = SNAP_TO_START
|
||||
override fun computeScrollVectorForPosition(targetPosition: Int): PointF =
|
||||
this@SnappingLinearLayoutManager.computeScrollVectorForPosition(targetPosition)
|
||||
?: PointF(0F, 0F)
|
||||
}
|
||||
smoothScroller.targetPosition = position
|
||||
startSmoothScroll(smoothScroller)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLayoutChildren(recycler: RecyclerView.Recycler?, state: RecyclerView.State?) {
|
||||
tryWithDefaultCatch { super.onLayoutChildren(recycler, state) }
|
||||
}
|
||||
}
|
||||
@ -28,6 +28,9 @@ object DownloadDataHelper {
|
||||
|
||||
private val mDownloadSpeedMap = HashMap<String, MutableList<Long>>()
|
||||
|
||||
private val mDownloadHeartbeatList = mutableListOf<JSONObject>()
|
||||
private val mDownloadHeartbeatSheet = HashMap<String, JSONObject>()
|
||||
|
||||
@JvmStatic
|
||||
fun getDownloadStatusAlias(downloadEntity: DownloadEntity, downloadStatus: DownloadStatus? = null): String {
|
||||
val status = downloadStatus ?: downloadEntity.status
|
||||
@ -221,6 +224,63 @@ object DownloadDataHelper {
|
||||
LoghubUtils.log(jsonObject, "download_debug", false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分片检测下载进度,每隔15秒内记录一次,60秒上传一次
|
||||
*
|
||||
* 请见:https://gitlab.ghzs.com/stats/stats-issues/-/issues/188#note_66919
|
||||
*/
|
||||
fun uploadDownloadHeartbeat(upload: Boolean) {
|
||||
val allDownloadEntity = DownloadManager.getInstance(HaloApp.getInstance().application).allDownloadEntity
|
||||
for (downloadEntity in allDownloadEntity) {
|
||||
if (downloadEntity.status == DownloadStatus.downloading) {
|
||||
var sheet = mDownloadHeartbeatSheet[downloadEntity.url]
|
||||
if (sheet == null) {
|
||||
sheet = JSONObject()
|
||||
val host = downloadEntity.meta[DownloadEntity.DOWNLOAD_HOST_KEY] ?: "unknown"
|
||||
sheet.put("host", host)
|
||||
sheet.put("game_id", downloadEntity.gameId)
|
||||
sheet.put("platform", downloadEntity.platform)
|
||||
sheet.put("package", downloadEntity.packageName)
|
||||
sheet.put("filename", downloadEntity.path.substring(downloadEntity.path.lastIndexOf("/") + 1))
|
||||
sheet.put("total_size", downloadEntity.size / 1024 / 1024)
|
||||
sheet.put("current_progress_size", downloadEntity.progress / 1024)
|
||||
mDownloadHeartbeatSheet[downloadEntity.url] = sheet
|
||||
} else {
|
||||
val progressSize = sheet.getLong("current_progress_size")
|
||||
sheet.put("total_size", downloadEntity.size / 1024 / 1024) // 初始化记录的 total_size 有可能为0
|
||||
sheet.put("progress_size", downloadEntity.progress / 1024 - progressSize)
|
||||
sheet.put("current_progress_size", downloadEntity.progress / 1024)
|
||||
mDownloadHeartbeatList.add(JSONObject(sheet.toString()))
|
||||
}
|
||||
} else {
|
||||
mDownloadHeartbeatSheet.remove(downloadEntity.url)
|
||||
}
|
||||
}
|
||||
|
||||
if (upload && mDownloadHeartbeatList.isNotEmpty()) {
|
||||
val jsonObject = JSONObject()
|
||||
try {
|
||||
jsonObject.put("event", "progress")
|
||||
jsonObject.put("meta", getMetaJson())
|
||||
jsonObject.put("timestamp", System.currentTimeMillis() / 1000)
|
||||
|
||||
val payloads = JSONArray()
|
||||
for (heartbeatData in mDownloadHeartbeatList) {
|
||||
heartbeatData.remove("current_progress_size")
|
||||
payloads.put(heartbeatData)
|
||||
}
|
||||
jsonObject.put("payloads", payloads)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
if (BuildConfig.DEBUG) {
|
||||
Utils.log("LogUtils->$jsonObject")
|
||||
}
|
||||
mDownloadHeartbeatList.clear()
|
||||
LoghubUtils.log(jsonObject, "download_debug", false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getMetaJson(): JSONObject {
|
||||
val context = HaloApp.getInstance().application
|
||||
val meta = getMeta()
|
||||
|
||||
@ -186,7 +186,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
}
|
||||
};
|
||||
|
||||
List<DownloadEntity> list = getAll();
|
||||
List<DownloadEntity> list = getAllDownloadEntity();
|
||||
for (DownloadEntity downloadEntity : list) {
|
||||
statusMap.put(downloadEntity.getUrl(), downloadEntity.getStatus());
|
||||
if (!DownloadStatus.done.equals(downloadEntity.getStatus())) {
|
||||
@ -476,7 +476,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
|
||||
public void initGameMap() {
|
||||
gameMap.clear();
|
||||
List<DownloadEntity> list = getAll();
|
||||
List<DownloadEntity> list = getAllDownloadEntity();
|
||||
if (list != null && list.size() != 0) {
|
||||
String name;
|
||||
for (DownloadEntity downloadEntity : list) {
|
||||
@ -493,11 +493,9 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
|
||||
/**
|
||||
* 获取所有下载列表中的任务
|
||||
*
|
||||
* @return null表示没有下载任务
|
||||
*/
|
||||
@NonNull
|
||||
public List<DownloadEntity> getAll() {
|
||||
public List<DownloadEntity> getAllDownloadEntity() {
|
||||
if (CommonDebug.IS_DEBUG) {
|
||||
CommonDebug.logMethodName(this);
|
||||
}
|
||||
@ -505,6 +503,31 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
return all != null ? all : new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有下载列表中的任务排除静默更新
|
||||
*/
|
||||
public List<DownloadEntity> getAllDownloadEntityExcludeSilentUpdate() {
|
||||
if (CommonDebug.IS_DEBUG) {
|
||||
CommonDebug.logMethodName(this);
|
||||
}
|
||||
List<DownloadEntity> all = mDownloadDao.getAll();
|
||||
return filterSilentDownloadTask(all);
|
||||
}
|
||||
|
||||
private ArrayList<DownloadEntity> filterSilentDownloadTask(List<DownloadEntity> downloadEntityList) {
|
||||
ArrayList<DownloadEntity> filteredDownloadEntityList = new ArrayList<>();
|
||||
|
||||
if (downloadEntityList == null) return filteredDownloadEntityList;
|
||||
|
||||
for (DownloadEntity downloadEntity : downloadEntityList) {
|
||||
if (!Constants.SILENT_UPDATE.equals(ExtensionsKt.getMetaExtra(downloadEntity, Constants.EXTRA_DOWNLOAD_TYPE))) {
|
||||
filteredDownloadEntityList.add(downloadEntity);
|
||||
}
|
||||
}
|
||||
|
||||
return filteredDownloadEntityList;
|
||||
}
|
||||
|
||||
public ArrayMap<String, DownloadEntity> getEntryMap(String name) {
|
||||
return gameMap.get(name);
|
||||
}
|
||||
@ -622,7 +645,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
*/
|
||||
public void initDownloadService() {
|
||||
final List<String> urlList = new ArrayList<>(DataChanger.INSTANCE.getDownloadingTasks().keySet());
|
||||
for (DownloadEntity downloadEntity : getAll()) {
|
||||
for (DownloadEntity downloadEntity : getAllDownloadEntity()) {
|
||||
if (!urlList.contains(downloadEntity.getUrl()) &&
|
||||
(downloadEntity.getStatus().equals(DownloadStatus.downloading)
|
||||
|| downloadEntity.getStatus().equals(DownloadStatus.waiting))) {
|
||||
@ -690,7 +713,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
public void checkRetryDownload() {
|
||||
if (!NetworkUtils.isWifiConnected(mContext)) return;
|
||||
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(mContext).getAll()) {
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(mContext).getAllDownloadEntityExcludeSilentUpdate()) {
|
||||
if (DownloadStatus.neterror.equals(downloadEntity.getStatus()) ||
|
||||
DownloadStatus.timeout.equals(downloadEntity.getStatus()) ||
|
||||
DownloadStatus.subscribe.equals(downloadEntity.getStatus())) {
|
||||
@ -714,7 +737,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
boolean showRedPoint = false;
|
||||
int downloadingSize = 0;
|
||||
|
||||
for (DownloadEntity downloadEntity : getAll()) {
|
||||
for (DownloadEntity downloadEntity : getAllDownloadEntityExcludeSilentUpdate()) {
|
||||
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
|
||||
String mark = downloadEntity.getMeta().get(DOWNLOADED_IS_READ_MARK);
|
||||
if (TextUtils.isEmpty(mark)) showRedPoint = true;
|
||||
@ -772,7 +795,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
}
|
||||
|
||||
public boolean isContainsUnreadDownloadedTask() {
|
||||
for (DownloadEntity downloadEntity : getAll()) {
|
||||
for (DownloadEntity downloadEntity : getAllDownloadEntityExcludeSilentUpdate()) {
|
||||
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
|
||||
String mark = downloadEntity.getMeta().get(DOWNLOADED_IS_READ_MARK);
|
||||
if (TextUtils.isEmpty(mark)) {
|
||||
@ -790,7 +813,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
AppExecutor.getIoExecutor().execute(() -> {
|
||||
boolean markHasChanged = false;
|
||||
|
||||
List<DownloadEntity> all = getAll();
|
||||
List<DownloadEntity> all = getAllDownloadEntityExcludeSilentUpdate();
|
||||
for (DownloadEntity downloadEntity : all) {
|
||||
DownloadStatus status = downloadEntity.getStatus();
|
||||
if (status == DownloadStatus.done) {
|
||||
@ -830,7 +853,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
AppExecutor.getIoExecutor().execute(() -> {
|
||||
boolean markHasChanged = false;
|
||||
|
||||
List<DownloadEntity> all = getAll();
|
||||
List<DownloadEntity> all = getAllDownloadEntityExcludeSilentUpdate();
|
||||
for (DownloadEntity downloadEntity : all) {
|
||||
if (downloadEntity.getStatus() != DownloadStatus.done) {
|
||||
if (isRead) {
|
||||
|
||||
39
app/src/main/java/com/gh/gamecenter/FullScreenWebActivity.kt
Normal file
39
app/src/main/java/com/gh/gamecenter/FullScreenWebActivity.kt
Normal file
@ -0,0 +1,39 @@
|
||||
package com.gh.gamecenter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.gh.base.BaseActivity
|
||||
import com.gh.common.util.DisplayUtils
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.halo.assistant.fragment.WebFragment
|
||||
|
||||
class FullScreenWebActivity : BaseActivity() {
|
||||
|
||||
private var mWebFragment: WebFragment? = null
|
||||
|
||||
override fun getLayoutId() = R.layout.activity_amway
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
DisplayUtils.transparentStatusBar(this)
|
||||
|
||||
mWebFragment = supportFragmentManager.findFragmentByTag("webFragment") as? WebFragment ?: WebFragment().apply { with(intent.extras) }
|
||||
supportFragmentManager.beginTransaction().replace(R.id.placeholder, mWebFragment!!).commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
override fun handleBackPressed(): Boolean {
|
||||
return mWebFragment?.onBackPressed() ?: super.handleBackPressed()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, url: String, webViewHandleBackPressed: Boolean = false): Intent {
|
||||
val intent = Intent(context, FullScreenWebActivity::class.java)
|
||||
intent.putExtra(EntranceUtils.KEY_URL, url)
|
||||
intent.putExtra(WebFragment.KEY_LEAVE_WEB_PAGE_TO_HANDLE_BACK_PRESSED, webViewHandleBackPressed)
|
||||
return intent
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -197,6 +197,14 @@ public class GameDetailActivity extends NormalActivity {
|
||||
context.startActivity(getTargetIntent(context, GameDetailActivity.class, GameDetailFragment.class, bundle));
|
||||
}
|
||||
|
||||
public static void startGameDetailByShortcut(Context context, String gameId, int tab, String entrance) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceUtils.KEY_GAMEID, gameId);
|
||||
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
|
||||
bundle.putInt(EntranceUtils.KEY_TARGET, tab);
|
||||
context.startActivity(getTargetIntent(context, GameDetailActivity.class, GameDetailFragment.class, bundle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动游戏详情页面并定位到 介绍tab,并打开视频流
|
||||
*/
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.gamecenter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
@ -25,4 +26,9 @@ public class GameNewsActivity extends NormalActivity {
|
||||
return getTargetIntent(context, GameNewsActivity.class, GameNewsSearchFragment.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent provideNormalIntent() {
|
||||
return getTargetIntent(this, GameNewsActivity.class, GameNewsSearchFragment.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,11 +2,11 @@ package com.gh.gamecenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.gamecenter.fragment.LoginFragment;
|
||||
|
||||
@ -31,8 +31,8 @@ public class LoginActivity extends NormalActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mTitleTv.setText("登录光环助手");
|
||||
mTitleTv.setTextSize(18);
|
||||
mTitleTv.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
hideToolbar(true);
|
||||
DisplayUtils.setLightStatusBar(this, true);
|
||||
DisplayUtils.setStatusBarColor(this, R.color.transparent, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ import com.gh.base.AppUncaughtHandler;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.base.fragment.BaseFragment_ViewPager;
|
||||
import com.gh.common.AppExecutor;
|
||||
import com.gh.common.DefaultUrlHandler;
|
||||
import com.gh.common.avoidcallback.AvoidOnResultManager;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
@ -178,14 +179,14 @@ public class MainActivity extends BaseActivity {
|
||||
isNewFirstLaunch = mSp.getBoolean("isNewFirstLaunchV" + PackageUtils.getVersionName(), true);
|
||||
if (isNewFirstLaunch) {
|
||||
final LunchType lunchType = DeviceTokenUtils.getLaunchType();
|
||||
// 延时两秒提交 APP 启动日志的,避免提交时还没获取到 GID
|
||||
// 延时两秒提交,避免提交时还没获取到 GID/OAID
|
||||
AppExecutor.getUiExecutor().executeWithDelay(() -> {
|
||||
if (!this.isFinishing()) {
|
||||
LogUtils.uploadDevice(lunchType);
|
||||
ActivationHelper.sendActivationInfo();
|
||||
}
|
||||
}, 2000L);
|
||||
getPluginUpdate();
|
||||
ActivationHelper.sendActivationInfo();
|
||||
mSp.edit().putBoolean("isNewFirstLaunchV" + PackageUtils.getVersionName(), false).apply();
|
||||
|
||||
checkDevice(); // 根据设备信息判断用户是否是新用户
|
||||
@ -244,6 +245,12 @@ public class MainActivity extends BaseActivity {
|
||||
doSkip();
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
handler.postDelayed(() -> {
|
||||
EntranceUtils.jumpShortcut(this);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
handler.postDelayed(() -> {
|
||||
PushHelper.postPushClickAction(this.getApplicationContext(), null);
|
||||
}, 2000);
|
||||
@ -388,6 +395,12 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Utils.log(bundle);
|
||||
if (bundle.getInt(EntranceUtils.KEY_POSITION) != -1) {
|
||||
Utils.log("abc");
|
||||
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, bundle.getInt(EntranceUtils.KEY_POSITION)));
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
@ -395,7 +408,7 @@ public class MainActivity extends BaseActivity {
|
||||
private void checkNotificationPermission() {
|
||||
// 仅登录后再启动光环时请求一次权限
|
||||
if (UserManager.getInstance().isLoggedIn()) {
|
||||
NotificationHelper.showNotificationHintDialog(NotificationUgc.LOGIN);
|
||||
NotificationHelper.showNotificationHintDialog(NotificationUgc.LOGIN, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,7 +429,7 @@ public class MainActivity extends BaseActivity {
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && !mMainWrapperFragment.onHandleBackPressed()) {
|
||||
DownloadEntity downloadEntity = null;
|
||||
for (DownloadEntity entity : DownloadManager.getInstance(getApplicationContext()).getAll()) {
|
||||
for (DownloadEntity entity : DownloadManager.getInstance(getApplicationContext()).getAllDownloadEntityExcludeSilentUpdate()) {
|
||||
if (entity.getStatus().equals(DownloadStatus.done)) {
|
||||
if (PackageUtils.isInstalled(getApplicationContext(), entity.getPackageName())
|
||||
&& (!entity.isPlugin()
|
||||
@ -653,6 +666,17 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (entryName.contains("halo_skip.dat")) {
|
||||
InputStream in = zipfile.getInputStream(entry);
|
||||
if (in != null) {
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
String content = "";
|
||||
for (String line; (line = reader.readLine()) != null; content += line) ;
|
||||
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
DefaultUrlHandler.interceptUrl(this, content, "(特定包启动跳转)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -688,7 +712,7 @@ public class MainActivity extends BaseActivity {
|
||||
String gameId = "";
|
||||
|
||||
DownloadEntity mDownloadEntity = null;
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(getApplicationContext()).getAll()) {
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(getApplicationContext()).getAllDownloadEntity()) {
|
||||
if (packageName.equals(downloadEntity.getPackageName())) {
|
||||
mDownloadEntity = downloadEntity;
|
||||
gameId = mDownloadEntity.getRealGameId(Constants.GAME_ID_DIVIDER);
|
||||
|
||||
@ -95,7 +95,7 @@ public abstract class NormalActivity extends ToolBarActivity {
|
||||
if (TextUtils.isEmpty(fraName)) return;
|
||||
}
|
||||
mTargetFragment = Fragment.instantiate(this, fraName, bundle);
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.normal_content, mTargetFragment).commitNowAllowingStateLoss();
|
||||
getSupportFragmentManager().beginTransaction().replace(getFragmentPlaceholderId(), mTargetFragment).commitNowAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,4 +122,8 @@ public abstract class NormalActivity extends ToolBarActivity {
|
||||
}
|
||||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
|
||||
public int getFragmentPlaceholderId() {
|
||||
return R.id.normal_content;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,14 +4,17 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.util.CheckLoginUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.GsonUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.RunningUtils;
|
||||
import com.gh.gamecenter.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.entity.LinkEntity;
|
||||
import com.gh.gamecenter.entity.SimpleGameEntity;
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity;
|
||||
import com.gh.gamecenter.entity.VideoLinkEntity;
|
||||
@ -35,8 +38,8 @@ import static com.gh.common.util.EntranceUtils.HOST_DOWNLOAD;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_GAME;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_LIBAO;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_QQ;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_QQ_QUN;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_QQ_GROUP;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_QQ_QUN;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_QUESTION;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_SUGGESTION;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_TOOLBOX;
|
||||
@ -99,7 +102,7 @@ public class SkipActivity extends BaseActivity {
|
||||
DirectUtils.directToArticle(this, path, ENTRANCE_BROWSER);
|
||||
break;
|
||||
case HOST_GAME:
|
||||
DirectUtils.directToGameDetail(this, path, ENTRANCE_BROWSER, false, "libao".equals(to), null);
|
||||
DirectUtils.directToGameDetail(this, path, ENTRANCE_BROWSER, "true".equals(uri.getQueryParameter("auto_download")), to, null);
|
||||
break;
|
||||
case HOST_COLUMN:
|
||||
DirectUtils.directToSubject(this, path, uri.getQueryParameter(KEY_NAME), ENTRANCE_BROWSER);
|
||||
@ -183,10 +186,13 @@ public class SkipActivity extends BaseActivity {
|
||||
String title = TextUtils.isEmpty(titleParameter) ? "" : "#" + titleParameter + "#";
|
||||
String categoryId = uri.getQueryParameter("category_id");
|
||||
String link = uri.getQueryParameter("link");
|
||||
VideoLinkEntity linkEntity = new VideoLinkEntity(title, categoryId, link);
|
||||
gameId = uri.getQueryParameter("gameId");
|
||||
String gameName = uri.getQueryParameter("gameName");
|
||||
SimpleGameEntity simpleGameEntity = new SimpleGameEntity(gameId, gameName, "");
|
||||
String tagActivityId = uri.getQueryParameter("tagActivityId");
|
||||
String tagActivityName = uri.getQueryParameter("tagActivityName");
|
||||
VideoLinkEntity linkEntity = new VideoLinkEntity(title, categoryId, link, tagActivityId, tagActivityName);
|
||||
|
||||
SimpleGameEntity simpleGameEntity = new SimpleGameEntity(gameId != null ? gameId : "", gameName != null ? gameName : "", "");
|
||||
Bundle nextToBundle = VideoManagerActivity.getVideoManagerBundle(linkEntity, simpleGameEntity, EntranceUtils.ENTRANCE_BROWSER, "");
|
||||
CheckLoginUtils.checkLogin(this, nextToBundle, true, EntranceUtils.ENTRANCE_BROWSER, () ->
|
||||
DirectUtils.directToVideoManager(SkipActivity.this, linkEntity, simpleGameEntity, EntranceUtils.ENTRANCE_BROWSER, "浏览器"));
|
||||
@ -200,6 +206,7 @@ public class SkipActivity extends BaseActivity {
|
||||
String act = uri.getQueryParameter("act");
|
||||
String fieldId = uri.getQueryParameter("fieldId");
|
||||
String sectionName = uri.getQueryParameter("sectionName");
|
||||
String paginationType = uri.getQueryParameter("paginationType");//活动分页方式 page filter
|
||||
String location;
|
||||
if (!TextUtils.isEmpty(act)) {
|
||||
location = VideoDetailContainerViewModel.Location.VIDEO_ACTIVITY.getValue();
|
||||
@ -210,7 +217,7 @@ public class SkipActivity extends BaseActivity {
|
||||
}
|
||||
DirectUtils.directToVideoDetail(this, path, location,
|
||||
false, TextUtils.isEmpty(gameId) ? "" : gameId, ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer,
|
||||
TextUtils.isEmpty(type) ? "" : type, TextUtils.isEmpty(act) ? "" : act, TextUtils.isEmpty(fieldId) ? "" : fieldId,
|
||||
TextUtils.isEmpty(type) ? "" : type, TextUtils.isEmpty(act) ? "" : act, TextUtils.isEmpty(paginationType) ? "page" : paginationType, TextUtils.isEmpty(fieldId) ? "" : fieldId,
|
||||
TextUtils.isEmpty(sectionName) ? "" : sectionName);
|
||||
break;
|
||||
case HOST_VIDEO_STREAMING_HOME:
|
||||
@ -328,7 +335,42 @@ public class SkipActivity extends BaseActivity {
|
||||
String zoneUrl = uri.getQueryParameter("url");
|
||||
DirectUtils.directGameZone(this, path, zoneUrl, ENTRANCE_BROWSER);
|
||||
break;
|
||||
|
||||
case EntranceUtils.HOST_LINK:
|
||||
try {
|
||||
String dataString = uri.getQueryParameter("data");
|
||||
if (!TextUtils.isEmpty(dataString)) {
|
||||
byte[] linkData = Base64.decode(dataString, Base64.DEFAULT);
|
||||
String linkDataString = new String(linkData, "UTF-8");
|
||||
LinkEntity le = GsonUtils.INSTANCE.getGson().fromJson(linkDataString, LinkEntity.class);
|
||||
DirectUtils.directToLinkPage(this, le, ENTRANCE_BROWSER, "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
toast(e.getMessage());
|
||||
}
|
||||
break;
|
||||
case EntranceUtils.HOST_GAME_NEWS:
|
||||
DirectUtils.directToGameNews(
|
||||
this,
|
||||
uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
|
||||
uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
|
||||
EntranceUtils.ENTRANCE_BROWSER);
|
||||
break;
|
||||
case EntranceUtils.HOST_GAME_CALENDAR:
|
||||
DirectUtils.directToGameServerCalendar(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID));
|
||||
break;
|
||||
case EntranceUtils.HOST_HISTORY_APK:
|
||||
DirectUtils.directToHistoryApk(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID));
|
||||
break;
|
||||
case EntranceUtils.HOST_FORUM_DETAIL:
|
||||
DirectUtils.directForumDetail(this, id, ENTRANCE_BROWSER);
|
||||
break;
|
||||
case EntranceUtils.HOST_GAME_RATING_DETAIL:
|
||||
DirectUtils.directToGameRatingDetail(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID), uri.getQueryParameter(EntranceUtils.KEY_COMMENT_ID), ENTRANCE_BROWSER);
|
||||
break;
|
||||
case EntranceUtils.HOST_FORUM:
|
||||
DirectUtils.directToForum(this);
|
||||
break;
|
||||
default:
|
||||
EntranceUtils.jumpActivity(this, new Bundle()); // 跳转至首页
|
||||
return;
|
||||
|
||||
@ -55,6 +55,7 @@ import com.lightgame.download.FileUtils;
|
||||
import com.qq.gdt.action.ActionType;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -65,6 +66,7 @@ import java.util.Locale;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.ResponseBody;
|
||||
import pub.devrel.easypermissions.AfterPermissionGranted;
|
||||
import pub.devrel.easypermissions.EasyPermissions;
|
||||
|
||||
@ -109,7 +111,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
// 判断是不是这个版本的新用户
|
||||
if (isNewFirstLaunch) {
|
||||
// 删除更新后的光环助手包
|
||||
List<DownloadEntity> all = DownloadManager.getInstance(this).getAll();
|
||||
List<DownloadEntity> all = DownloadManager.getInstance(this).getAllDownloadEntity();
|
||||
for (DownloadEntity downloadEntity : all) {
|
||||
if (downloadEntity.getPackageName().equals(getPackageName())) {
|
||||
DownloadManager.getInstance(this).cancel(downloadEntity.getUrl(), true, true);
|
||||
@ -144,6 +146,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
deviceDialogSetting();
|
||||
getFilterDetailTags();
|
||||
getAuthDialog();
|
||||
getRegulationTestStatus();
|
||||
UsageStatsHelper.checkAndPostUsageStats();
|
||||
GameSubstituteRepositoryHelper.updateGameSubstituteRepository();
|
||||
|
||||
@ -192,6 +195,23 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void getRegulationTestStatus() {
|
||||
RetrofitManager.getInstance(HaloApp.getInstance().getApplication())
|
||||
.getApi().getRegulationTestStatus()
|
||||
.subscribe(new BiResponse<ResponseBody>() {
|
||||
@Override
|
||||
public void onSuccess(ResponseBody data) {
|
||||
try {
|
||||
JSONObject object = new JSONObject(data.string());
|
||||
SPUtils.setString(Constants.SP_REGULATION_TEST_STATUS, object.getString("status"));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getFilterDetailTags() {
|
||||
RetrofitManager.getInstance(HaloApp.getInstance().getApplication())
|
||||
.getSensitiveApi().getFilterDetailTags()
|
||||
|
||||
@ -26,10 +26,17 @@ import android.widget.RadioGroup;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.gh.base.OnListClickListener;
|
||||
import com.gh.base.OnRequestCallBackListener;
|
||||
import com.gh.base.ToolBarActivity;
|
||||
import com.gh.base.fragment.WaitingDialogFragment;
|
||||
import com.gh.common.AppExecutor;
|
||||
import com.gh.common.dialog.TrackableDialog;
|
||||
import com.gh.common.filter.RegionSettingHelper;
|
||||
import com.gh.common.im.ImManager;
|
||||
@ -44,6 +51,7 @@ import com.gh.common.util.GsonUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.MtaHelper;
|
||||
import com.gh.common.util.NetworkUtils;
|
||||
import com.gh.common.util.NotificationHelper;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.ShareUtils;
|
||||
import com.gh.common.util.TextHelper;
|
||||
@ -54,6 +62,7 @@ import com.gh.common.view.FixLinearLayoutManager;
|
||||
import com.gh.gamecenter.entity.ErrorEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.InstallGameEntity;
|
||||
import com.gh.gamecenter.entity.NotificationUgc;
|
||||
import com.gh.gamecenter.entity.SettingsEntity;
|
||||
import com.gh.gamecenter.entity.SimpleGameEntity;
|
||||
import com.gh.gamecenter.entity.UserInfoEntity;
|
||||
@ -87,11 +96,6 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@ -431,6 +435,18 @@ public class SuggestionActivity extends ToolBarActivity implements OnRequestCall
|
||||
showHintDialog(onlineGame);
|
||||
}
|
||||
break;
|
||||
case "gjlocal_game":
|
||||
List<String> internationalLocalGame = typeEntity.getInternationalLocalGame();
|
||||
if (internationalLocalGame != null && internationalLocalGame.size() > 0) {
|
||||
showHintDialog(internationalLocalGame);
|
||||
}
|
||||
break;
|
||||
case "gjonline_game":
|
||||
List<String> internationalOnlineGame = typeEntity.getInternationalOnlineGame();
|
||||
if (internationalOnlineGame != null && internationalOnlineGame.size() > 0) {
|
||||
showHintDialog(internationalOnlineGame);
|
||||
}
|
||||
break;
|
||||
case "libao":
|
||||
List<String> libao = typeEntity.getLibao();
|
||||
if (libao != null && libao.size() > 0) {
|
||||
@ -449,6 +465,13 @@ public class SuggestionActivity extends ToolBarActivity implements OnRequestCall
|
||||
showHintDialog(report);
|
||||
}
|
||||
break;
|
||||
|
||||
case "video":
|
||||
List<String> video = typeEntity.getVideo();
|
||||
if (video != null && video.size() > 0) {
|
||||
showHintDialog(video);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -574,7 +597,7 @@ public class SuggestionActivity extends ToolBarActivity implements OnRequestCall
|
||||
mEmailName.setText(Html.fromHtml(getString(R.string.suggestion_contact)));
|
||||
mCopyrightContainer.setVisibility(View.GONE);
|
||||
} else if (type == SuggestType.articleCollect) {
|
||||
mSuggestContentEt.setHint("简单介绍文章内容,别忘了填写文章链接哦 \n ↓↓你还可以上传截图");
|
||||
mSuggestContentEt.setHint("简单介绍帖子内容,别忘了填写帖子链接哦 \n ↓↓你还可以上传截图");
|
||||
mSuggestTypeContainer.setVisibility(View.GONE);
|
||||
mSuggestGameLl.setVisibility(View.GONE);
|
||||
mCopyrightContainer.setVisibility(View.GONE);
|
||||
@ -1122,6 +1145,7 @@ public class SuggestionActivity extends ToolBarActivity implements OnRequestCall
|
||||
}*/
|
||||
toast("感谢您的反馈!");
|
||||
finish();
|
||||
AppExecutor.getUiExecutor().executeWithDelay(() -> NotificationHelper.showNotificationHintDialog(NotificationUgc.FEEDBACK, null), 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -15,7 +15,6 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.gh.base.OnRequestCallBackListener;
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.LibaoUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
@ -179,10 +178,9 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
});
|
||||
|
||||
if (mLibaoEntity.getGame() != null) {
|
||||
ImageUtils.display(holder.libaoGameIcon.getIconIv(), mLibaoEntity.getGame().getIcon());
|
||||
ImageUtils.display(holder.libaoGameIcon.getIconDecoratorIv(), mLibaoEntity.getGame().getIconSubscript());
|
||||
holder.libaoGameIcon.displayGameIcon(mLibaoEntity.getGame().getIcon(), mLibaoEntity.getGame().getIconSubscript());
|
||||
} else {
|
||||
ImageUtils.display(holder.libaoGameIcon.getIconIv(), mLibaoEntity.getIcon());
|
||||
holder.libaoGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null);
|
||||
}
|
||||
holder.libaoName.setText(mLibaoEntity.getName());
|
||||
if (TextUtils.isEmpty(mLibaoEntity.getPlatform())) {
|
||||
|
||||
@ -13,7 +13,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.databind.BindingAdapters;
|
||||
import com.gh.common.util.CheckLoginUtils;
|
||||
import com.gh.common.util.CommentUtils;
|
||||
import com.gh.common.util.ConcernContentUtils;
|
||||
@ -61,6 +60,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import kotlin.text.StringsKt;
|
||||
import retrofit2.HttpException;
|
||||
|
||||
/**
|
||||
@ -279,12 +279,11 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
}
|
||||
|
||||
if (mConcernEntity.getGame() != null) {
|
||||
ImageUtils.display(viewHolder.thumb.getIconIv(), mConcernEntity.getGame().getIcon());
|
||||
ImageUtils.display(viewHolder.thumb.getIconDecoratorIv(), mConcernEntity.getGame().getIconSubscript());
|
||||
viewHolder.thumb.displayGameIcon(mConcernEntity.getGame().getIcon(), mConcernEntity.getGame().getIconSubscript());
|
||||
} else {
|
||||
ImageUtils.display(viewHolder.thumb.getIconIv(), mConcernEntity.getGameIcon());
|
||||
viewHolder.thumb.displayGameIcon(mConcernEntity.getGameIcon(), null);
|
||||
}
|
||||
viewHolder.title.setText(mConcernEntity.getGameName());
|
||||
viewHolder.title.setText(StringsKt.removeSuffix(mConcernEntity.getGameName(), "."));
|
||||
NewsUtils.setNewsPublishOn(viewHolder.time, mConcernEntity.getTime());
|
||||
|
||||
viewHolder.share.setOnClickListener(v -> {
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.gh.gamecenter.adapter.viewholder;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.gh.base.BaseRecyclerViewHolder;
|
||||
import com.gh.base.OnListClickListener;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -88,6 +89,35 @@ public class FooterViewHolder extends BaseRecyclerViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
public void bindFooterDefaultEmpty(ListViewModel viewModel, boolean isLoading, boolean isNetworkError, boolean isOver) {
|
||||
if (isNetworkError) {
|
||||
lineLeft.setVisibility(View.GONE);
|
||||
lineRight.setVisibility(View.GONE);
|
||||
loading.setVisibility(View.GONE);
|
||||
hint.setVisibility(View.VISIBLE);
|
||||
hint.setText(R.string.loading_failed_retry);
|
||||
} else if (isOver) {
|
||||
lineLeft.setVisibility(View.GONE);
|
||||
lineRight.setVisibility(View.GONE);
|
||||
loading.setVisibility(View.GONE);
|
||||
hint.setVisibility(View.VISIBLE);
|
||||
hint.setText(R.string.ask_loadover_hint);
|
||||
} else if (isLoading) {
|
||||
lineLeft.setVisibility(View.GONE);
|
||||
lineRight.setVisibility(View.GONE);
|
||||
loading.setVisibility(View.VISIBLE);
|
||||
hint.setVisibility(View.VISIBLE);
|
||||
hint.setText(R.string.loading);
|
||||
} else {
|
||||
lineLeft.setVisibility(View.GONE);
|
||||
lineRight.setVisibility(View.GONE);
|
||||
loading.setVisibility(View.GONE);
|
||||
hint.setVisibility(View.GONE);
|
||||
}
|
||||
itemView.setOnClickListener(v -> {
|
||||
if (isNetworkError) viewModel.load(LoadType.RETRY);
|
||||
});
|
||||
}
|
||||
|
||||
public void initFooterViewHolder(boolean isLoading, boolean isNetworkError, boolean isOver, @StringRes int loadOverHint) {
|
||||
if (isNetworkError) {
|
||||
|
||||
@ -191,8 +191,7 @@ class AmwayAdapter(context: Context,
|
||||
MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_游戏")
|
||||
}
|
||||
|
||||
ImageUtils.display(binding.gameIconView.getIconIv(), amway.game.rawIcon ?: amway.game.icon)
|
||||
ImageUtils.display(binding.gameIconView.getIconDecoratorIv(), amway.game.iconSubscript)
|
||||
binding.gameIconView.displayGameIcon(amway.game.rawIcon ?: amway.game.icon, amway.game.iconSubscript)
|
||||
|
||||
amway.game.tag?.let {
|
||||
val tags = it.take(3)
|
||||
|
||||
@ -41,23 +41,24 @@ class AmwaySearchViewHolder(var binding: AmwaySearchItemBinding, val mViewModel:
|
||||
// 已评论过此游戏
|
||||
GameDetailActivity.startGameDetailCommentActivity(binding.root.context, gameEntity, "安利墙")
|
||||
} else {
|
||||
val installPackageName = mViewModel.canUserCommentThisGame(gameEntity)
|
||||
if (gameEntity.directComment || !installPackageName.isNullOrEmpty()) {
|
||||
PermissionHelper.checkReadPhoneStatePermissionBeforeAction(activity, object : EmptyCallback {
|
||||
override fun onCallback() {
|
||||
MtaHelper.onEvent("发表评论", "进入", "选中游戏_${gameEntity.name}")
|
||||
val intent = RatingEditActivity.getIntent(binding.root.context, gameEntity, 0.0F, installPackageName, true)
|
||||
activity.startActivity(intent)
|
||||
activity.finish()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Utils.toast(activity, "安装游戏后才能评论哦")
|
||||
it.context.showRegulationTestDialogIfNeeded {
|
||||
val installPackageName = mViewModel.canUserCommentThisGame(gameEntity)
|
||||
if (gameEntity.directComment || !installPackageName.isNullOrEmpty()) {
|
||||
PermissionHelper.checkReadPhoneStatePermissionBeforeAction(activity, object : EmptyCallback {
|
||||
override fun onCallback() {
|
||||
MtaHelper.onEvent("发表评论", "进入", "选中游戏_${gameEntity.name}")
|
||||
val intent = RatingEditActivity.getIntent(binding.root.context, gameEntity, 0.0F, installPackageName, true)
|
||||
activity.startActivity(intent)
|
||||
activity.finish()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Utils.toast(activity, "安装游戏后才能评论哦")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CommentUtils.isUserCommentedOnThisGame(gameEntity.id, WeakReference(callback))
|
||||
} else {
|
||||
Utils.toast(HaloApp.getInstance().application, "该游戏暂不支持发表评论哦")
|
||||
|
||||
@ -4,13 +4,13 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
|
||||
/**
|
||||
* Created by khy on 10/11/17.
|
||||
*/
|
||||
@ -138,4 +138,7 @@ public abstract class ListAdapter<DataType> extends BaseRecyclerAdapter {
|
||||
notifyItemChanged(getItemCount() - 1);
|
||||
}
|
||||
|
||||
public List<DataType> getEntityList() {
|
||||
return mEntityList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,10 +42,13 @@ public abstract class ListFragment<T, VM extends BaseListViewModel /* 该泛型
|
||||
@Nullable
|
||||
@BindView(R.id.list_refresh)
|
||||
protected SwipeRefreshLayout mListRefresh;
|
||||
@Nullable
|
||||
@BindView(R.id.reuse_ll_loading)
|
||||
protected View mListLoading;
|
||||
@Nullable
|
||||
@BindView(R.id.reuse_no_connection)
|
||||
protected LinearLayout mReuseNoConn;
|
||||
@Nullable
|
||||
@BindView(R.id.reuse_none_data)
|
||||
protected LinearLayout mReuseNoData;
|
||||
|
||||
@ -146,7 +149,7 @@ public abstract class ListFragment<T, VM extends BaseListViewModel /* 该泛型
|
||||
}
|
||||
}
|
||||
});
|
||||
mReuseNoConn.setOnClickListener(view1 -> onLoadRefresh());
|
||||
if (mReuseNoConn != null) mReuseNoConn.setOnClickListener(view1 -> onLoadRefresh());
|
||||
}
|
||||
|
||||
private Class<VM> getViewModelClass() {
|
||||
@ -179,9 +182,11 @@ public abstract class ListFragment<T, VM extends BaseListViewModel /* 该泛型
|
||||
|
||||
public void onLoadRefresh() {
|
||||
showSkeleton(true);
|
||||
mReuseNoConn.setVisibility(View.GONE);
|
||||
mReuseNoData.setVisibility(View.GONE);
|
||||
mListLoading.setVisibility(mListRefresh == null || !mListRefresh.isRefreshing() ? View.VISIBLE : View.GONE);
|
||||
if (mReuseNoConn != null) mReuseNoConn.setVisibility(View.GONE);
|
||||
if (mListLoading != null)
|
||||
mListLoading.setVisibility(mListRefresh == null || !mListRefresh.isRefreshing() ? View.VISIBLE : View.GONE);
|
||||
if (mReuseNoData != null) mReuseNoData.setVisibility(View.GONE);
|
||||
|
||||
mListRv.setVisibility(View.GONE);
|
||||
mBaseHandler.postDelayed(() -> {
|
||||
mListViewModel.load(LoadType.REFRESH);
|
||||
@ -190,9 +195,10 @@ public abstract class ListFragment<T, VM extends BaseListViewModel /* 该泛型
|
||||
|
||||
public void onLoadDone() {
|
||||
showSkeleton(false);
|
||||
mReuseNoConn.setVisibility(View.GONE);
|
||||
mReuseNoData.setVisibility(View.GONE);
|
||||
mListLoading.setVisibility(View.GONE);
|
||||
if (mReuseNoConn != null) mReuseNoConn.setVisibility(View.GONE);
|
||||
if (mReuseNoData != null) mReuseNoData.setVisibility(View.GONE);
|
||||
if (mListLoading != null) mListLoading.setVisibility(View.GONE);
|
||||
|
||||
mListRv.setVisibility(View.VISIBLE);
|
||||
hideRefreshingLayout();
|
||||
|
||||
@ -205,18 +211,20 @@ public abstract class ListFragment<T, VM extends BaseListViewModel /* 该泛型
|
||||
|
||||
public void onLoadError() {
|
||||
showSkeleton(false);
|
||||
mReuseNoConn.setVisibility(View.VISIBLE);
|
||||
mReuseNoData.setVisibility(View.GONE);
|
||||
mListLoading.setVisibility(View.GONE);
|
||||
if (mReuseNoConn != null) mReuseNoConn.setVisibility(View.VISIBLE);
|
||||
if (mReuseNoData != null) mReuseNoData.setVisibility(View.GONE);
|
||||
if (mListLoading != null) mListLoading.setVisibility(View.GONE);
|
||||
|
||||
mListRv.setVisibility(View.GONE);
|
||||
hideRefreshingLayout();
|
||||
}
|
||||
|
||||
public void onLoadEmpty() {
|
||||
showSkeleton(false);
|
||||
mReuseNoConn.setVisibility(View.GONE);
|
||||
mReuseNoData.setVisibility(View.VISIBLE);
|
||||
mListLoading.setVisibility(View.GONE);
|
||||
if (mReuseNoConn != null) mReuseNoConn.setVisibility(View.GONE);
|
||||
if (mReuseNoData != null) mReuseNoData.setVisibility(View.VISIBLE);
|
||||
if (mListLoading != null) mListLoading.setVisibility(View.GONE);
|
||||
|
||||
mListRv.setVisibility(View.GONE);
|
||||
hideRefreshingLayout();
|
||||
}
|
||||
|
||||
@ -21,11 +21,11 @@ import com.gh.gamecenter.baselist.ListAdapter
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.CategoryEntity
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.SubjectSettingEntity
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.utils.Utils
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
@ -84,7 +84,9 @@ class NewCategoryListFragment : ListFragment<GameEntity, NewCategoryListViewMode
|
||||
configFilterView.visibility = View.VISIBLE
|
||||
|
||||
configFilterView.setOnConfigSetupListener(object : ConfigFilterView.OnConfigFilterSetupListener {
|
||||
override fun onSetupSortSize(sortSize: ConfigFilterView.SortSize) {
|
||||
override fun onShowSortSize() {}
|
||||
|
||||
override fun onSetupSortSize(sortSize: SubjectSettingEntity.Size) {
|
||||
mViewModel.updateSortConfig(sortSize = sortSize)
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import com.gh.common.view.ConfigFilterView
|
||||
import com.gh.gamecenter.baselist.ListViewModel
|
||||
import com.gh.gamecenter.entity.CategoryEntity
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.SubjectSettingEntity
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
@ -22,7 +23,7 @@ class NewCategoryListViewModel(application: Application)
|
||||
var selectedCategory = CategoryEntity()
|
||||
|
||||
private var mSortType = ConfigFilterView.SortType.RECOMMENDED
|
||||
private var mSortSize = ConfigFilterView.SortSize.UNSPECIFIED
|
||||
private var mSortSize = SubjectSettingEntity.Size()
|
||||
|
||||
override fun provideDataObservable(page: Int): Observable<List<GameEntity>>? {
|
||||
return null
|
||||
@ -46,7 +47,7 @@ class NewCategoryListViewModel(application: Application)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateSortConfig(sortSize: ConfigFilterView.SortSize? = null,
|
||||
fun updateSortConfig(sortSize: SubjectSettingEntity.Size? = null,
|
||||
sortType: ConfigFilterView.SortType? = null) {
|
||||
if (sortSize != null && sortSize != mSortSize) {
|
||||
mSortSize = sortSize
|
||||
@ -59,8 +60,8 @@ class NewCategoryListViewModel(application: Application)
|
||||
|
||||
private fun getSortSize(): String? {
|
||||
return UrlFilterUtils.getFilterQuery(
|
||||
"min_size", mSortSize.toSize().minSize.toString(),
|
||||
"max_size", mSortSize.toSize().maxSize.toString())
|
||||
"min_size", mSortSize.min.toString(),
|
||||
"max_size", mSortSize.max.toString())
|
||||
}
|
||||
|
||||
fun getSortType(): String? {
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
package com.gh.gamecenter.douyinapi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bytedance.sdk.open.aweme.CommonConstants;
|
||||
import com.bytedance.sdk.open.aweme.authorize.model.Authorization;
|
||||
import com.bytedance.sdk.open.aweme.common.handler.IApiEventHandler;
|
||||
import com.bytedance.sdk.open.aweme.common.model.BaseReq;
|
||||
import com.bytedance.sdk.open.aweme.common.model.BaseResp;
|
||||
import com.bytedance.sdk.open.douyin.DouYinOpenApiFactory;
|
||||
import com.bytedance.sdk.open.douyin.api.DouYinOpenApi;
|
||||
import com.gh.common.util.LoginHelper;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class DouYinEntryActivity extends Activity implements IApiEventHandler, DouYinUserInfoThread.OnUserInfoCallBackListener {
|
||||
|
||||
DouYinOpenApi douYinOpenApi;
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
douYinOpenApi = DouYinOpenApiFactory.create(this);
|
||||
douYinOpenApi.handleIntent(getIntent(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReq(BaseReq req) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResp(BaseResp resp) {
|
||||
// 授权成功可以获得authCode
|
||||
if (resp.getType() == CommonConstants.ModeType.SEND_AUTH_RESPONSE) {
|
||||
Authorization.Response response = (Authorization.Response) resp;
|
||||
if (resp.isSuccess()) {
|
||||
new DouYinUserInfoThread(DouYinEntryActivity.this, response.authCode, DouYinEntryActivity.this)
|
||||
.start();
|
||||
// Toast.makeText(this, "授权成功,获得权限:" + response.grantedPermissions,
|
||||
// Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(this, "授权成功", Toast.LENGTH_SHORT).show();
|
||||
|
||||
} else {
|
||||
// Toast.makeText(this, "授权失败" + response.grantedPermissions,
|
||||
// Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(this, "授权失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorIntent(Intent intent) {
|
||||
// 错误数据
|
||||
Toast.makeText(this, "intent出错啦", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete(JSONObject content) {
|
||||
runOnUiThread(() -> {
|
||||
LoginHelper.onDouYinLoginSuccess(content);
|
||||
finishActivity();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
LoginHelper.onDouYinLoginFailure("登录失败");
|
||||
finishActivity();
|
||||
}
|
||||
|
||||
private void finishActivity() {
|
||||
this.finish();
|
||||
overridePendingTransition(0, 0);//禁止退出Activity 动画
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
package com.gh.gamecenter.douyinapi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Created by khy on 30/06/17.
|
||||
* 获取微信 accessToken 和 userInfo
|
||||
*/
|
||||
|
||||
public class DouYinUserInfoThread extends Thread {
|
||||
|
||||
private Context mContext;
|
||||
private OnUserInfoCallBackListener listener;
|
||||
|
||||
private String mCode;
|
||||
|
||||
//刷新access_token有效期
|
||||
private String refresh_token = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=APPID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN";
|
||||
|
||||
public DouYinUserInfoThread(OnUserInfoCallBackListener listener, String code, Context context) {
|
||||
this.listener = listener;
|
||||
this.mCode = code;
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
try {
|
||||
String tokenUrl = "https://open.douyin.com/oauth/access_token?client_key=" +
|
||||
Config.DOUYIN_CLIENTKEY + "&client_secret=" +
|
||||
Config.DOUYIN_CLIENTSECRET + "&code=" +
|
||||
mCode + "&grant_type=authorization_code";
|
||||
String jsonResult = getJsonResultByUrlPath(tokenUrl);
|
||||
JSONObject jsonObject = new JSONObject(jsonResult);
|
||||
JSONObject data = jsonObject.optJSONObject("data");
|
||||
|
||||
String accessToken = data.optString("access_token");
|
||||
String refreshToken = data.optString("refresh_token");
|
||||
String openid = data.optString("open_id");
|
||||
String unionid = data.optString("unionid");
|
||||
long expiresIn = Long.parseLong(data.optString("expires_in"));
|
||||
|
||||
if (!TextUtils.isEmpty(accessToken) && !TextUtils.isEmpty(openid) && !TextUtils.isEmpty(refreshToken) && listener != null) {
|
||||
// String userInfoUrl = "https://api.weixin.qq.com/sns/userinfo?access_token=" + accessToken + "&openid=" + openid;
|
||||
// String userInfo = getJsonResultByUrlPath(userInfoUrl);
|
||||
JSONObject content = new JSONObject();
|
||||
content.put("openid", openid);
|
||||
content.put("access_token", accessToken);
|
||||
content.put("access_token_expire", Utils.getTime(mContext) + expiresIn); // 有效期
|
||||
content.put("refresh_token", refreshToken);
|
||||
// content.put("refresh_token_expire", Utils.getTime(mContext) + 86400 * 30); // 有效期 30天
|
||||
content.put("unionid", unionid);
|
||||
|
||||
listener.onComplete(content);
|
||||
} else {
|
||||
if (listener != null) {
|
||||
listener.onError();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (listener != null) {
|
||||
listener.onError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getJsonResultByUrlPath(String path) throws Exception {
|
||||
URL url = new URL(path);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(5000);
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setDoInput(true);
|
||||
int code = conn.getResponseCode();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
Utils.log(DouYinUserInfoThread.class.getSimpleName(), "DouYinUserInfoThread-getJsonResultByUrlPath::" + code);
|
||||
if (code == 200) {
|
||||
InputStream is = conn.getInputStream();
|
||||
while ((len = is.read(buffer)) != -1) {
|
||||
baos.write(buffer, 0, len);
|
||||
}
|
||||
String str = new String(baos.toByteArray());
|
||||
Utils.log(DouYinUserInfoThread.class.getSimpleName(), "DouYinUserInfoThread-Body::" + str);
|
||||
return str;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public interface OnUserInfoCallBackListener {
|
||||
void onComplete(JSONObject content);
|
||||
|
||||
void onError();
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
|
||||
private fun updateDownloadHint() {
|
||||
if (!::mDownloadNumber.isInitialized) return
|
||||
|
||||
val downloadData = DownloadManager.getInstance(context).all
|
||||
val downloadData = DownloadManager.getInstance(context).allDownloadEntityExcludeSilentUpdate
|
||||
if (downloadData.size > 0) {
|
||||
mDownloadNumber.visibility = View.VISIBLE
|
||||
} else {
|
||||
|
||||
@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.gh.base.fragment.BaseFragment;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.ExtensionsKt;
|
||||
import com.gh.common.util.NetworkUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.view.RecyclerViewExtended;
|
||||
@ -173,6 +174,11 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
|
||||
if (status.equals(DownloadStatus.downloading)
|
||||
|| status.equals(DownloadStatus.waiting)
|
||||
|| status.equals(DownloadStatus.subscribe)) {
|
||||
// 静默更新任务不需要添加
|
||||
if (ExtensionsKt.isSilentUpdate(downloadEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (adapter.getDownloadingList().isEmpty()) {
|
||||
adapter.getDownloadingList().add(0, downloadEntity);
|
||||
adapter.initLocationMap();
|
||||
|
||||
@ -118,11 +118,11 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
if (!TextUtils.isEmpty(icon)) {
|
||||
if (!TextUtils.isEmpty(rawIcon)) {
|
||||
icon = rawIcon;
|
||||
ImageUtils.display(viewHolder.dmIcon.getIconDecoratorIv(), ExtensionsKt.getMetaExtra(downloadEntity, Constants.GAME_ICON_SUBSCRIPT));
|
||||
}
|
||||
ImageUtils.display(viewHolder.dmIcon.getIconIv(), icon);
|
||||
viewHolder.dmIcon.displayGameIcon(icon, ExtensionsKt.getMetaExtra(downloadEntity, Constants.GAME_ICON_SUBSCRIPT));
|
||||
} else {
|
||||
ImageUtils.display(viewHolder.dmIcon.getIconIv(), R.mipmap.logo);
|
||||
viewHolder.dmIcon.getIconDecoratorIv().setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
String downloadTitle;
|
||||
@ -483,7 +483,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
// 显示插件化
|
||||
void showPluginDialog(final String path) {
|
||||
DialogUtils.showPluginDialog(mContext, () -> {
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(mContext).getAll()) {
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(mContext).getAllDownloadEntityExcludeSilentUpdate()) {
|
||||
if (downloadEntity.isPluggable()
|
||||
&& downloadEntity.getPath().equals(path)) {
|
||||
Map<String, Object> kv6 = new HashMap<>();
|
||||
@ -637,7 +637,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
doneList.clear();
|
||||
statusMap.clear();
|
||||
urlMap.clear();
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(mContext).getAll()) {
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(mContext).getAllDownloadEntityExcludeSilentUpdate()) {
|
||||
statusMap.put(downloadEntity.getUrl(), downloadEntity.getStatus().name());
|
||||
if (DownloadStatus.done.equals(downloadEntity.getStatus())) {
|
||||
urlMap.put(PackageUtils.getPackageNameByPath(mContext,
|
||||
|
||||
@ -316,6 +316,7 @@ class GameUpdateFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> implemen
|
||||
|
||||
if (updateEntity.getName().contains("光环助手")) {
|
||||
ImageUtils.display(viewHolder.guIcon.getIconIv(), R.mipmap.logo);
|
||||
viewHolder.guIcon.getIconDecoratorIv().setVisibility(View.GONE);
|
||||
} else {
|
||||
BindingAdapters.setGame(viewHolder.guIcon, updateEntity.transformGameEntity());
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.gamecenter.download;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@ -9,7 +10,6 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.gh.common.AppExecutor;
|
||||
import com.gh.common.constant.ItemViewType;
|
||||
import com.gh.common.databind.BindingAdapters;
|
||||
import com.gh.common.exposure.ExposureEvent;
|
||||
import com.gh.common.exposure.ExposureSource;
|
||||
import com.gh.common.exposure.ExposureType;
|
||||
@ -18,7 +18,9 @@ import com.gh.common.filter.RegionSettingHelper;
|
||||
import com.gh.common.util.ApkActiveUtils;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.common.util.DownloadItemUtils;
|
||||
import com.gh.common.util.ExtensionsKt;
|
||||
import com.gh.common.util.GameUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.ThirdPartyPackageHelper;
|
||||
@ -283,11 +285,14 @@ public class InstalledGameFragmentAdapter extends BaseRecyclerAdapter<ViewHolder
|
||||
if (gameEntity.getApk().size() > 0) {
|
||||
name = String.format("%s - %s", gameEntity.getName(),
|
||||
PlatformUtils.getInstance(mContext).getPlatformName(gameEntity.getApk().get(0).getPlatform()));
|
||||
binding.gameIcon.getIconIv().setImageDrawable(PackageUtils.getIconByPackage(mContext, gameEntity.getApk().get(0).getPackageName()));
|
||||
binding.gameIconIv.setImageDrawable(PackageUtils.getIconByPackage(mContext, gameEntity.getApk().get(0).getPackageName()));
|
||||
binding.gameIconDecoratorIv.setVisibility(View.GONE);
|
||||
binding.gameDes.setText(String.format("V%s", PackageUtils.getVersionByPackage(gameEntity.getApk().get(0).getPackageName())));
|
||||
} else {
|
||||
name = gameEntity.getName();
|
||||
BindingAdapters.setGame(binding.gameIcon, gameEntity);
|
||||
ImageUtils.display(binding.gameIconIv, gameEntity.getRawIconInAdvanced());
|
||||
ImageUtils.display(binding.gameIconDecoratorIv, gameEntity.getIconSubscript());
|
||||
ExtensionsKt.goneIf(binding.gameIconDecoratorIv, TextUtils.isEmpty(gameEntity.getIconSubscript()));
|
||||
binding.gameDes.setText(gameEntity.getBrief());
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class ActivityLabelEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String = "",
|
||||
var name: String = "",
|
||||
var desc: String = ""
|
||||
) : Parcelable
|
||||
@ -2,6 +2,7 @@ package com.gh.gamecenter.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.android.parcel.IgnoredOnParcel
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
@ -21,11 +22,17 @@ data class AmwayCommentEntity(
|
||||
var rawIcon: String? = null,
|
||||
@SerializedName("icon_subscript")
|
||||
var iconSubscript: String? = "",
|
||||
var name: String,
|
||||
@SerializedName(value="new_tag_style")
|
||||
@SerializedName("name")
|
||||
private var mName: String,
|
||||
@SerializedName(value = "new_tag_style")
|
||||
var tag: List<TagStyleEntity>? = arrayListOf(),
|
||||
var star: Float) : Parcelable {
|
||||
fun toGameEntity() : GameEntity {
|
||||
|
||||
@IgnoredOnParcel
|
||||
val name: String?
|
||||
get() = mName.removeSuffix(".")
|
||||
|
||||
fun toGameEntity(): GameEntity {
|
||||
val gameEntity = GameEntity()
|
||||
gameEntity.id = id
|
||||
gameEntity.name = name
|
||||
|
||||
@ -7,7 +7,8 @@ import kotlinx.android.parcel.Parcelize
|
||||
@Parcelize
|
||||
data class ArticleCommentParent(val user: User = User(),
|
||||
val active: Boolean = true,
|
||||
val comment: String = "") : Parcelable
|
||||
val comment: String = "",
|
||||
var me: MeEntity? = MeEntity()) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class User(
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.gh.common.annotation.SyncPage
|
||||
import com.gh.common.syncpage.SyncFieldConstants
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@ -12,11 +14,23 @@ data class CommentEntity(@SerializedName("_id")
|
||||
@SerializedName("parent_user")
|
||||
var parentUser: CommentParentEntity? = null,
|
||||
var content: String? = null,
|
||||
@SyncPage(syncNames = [SyncFieldConstants.ARTICLE_COMMENT_VOTE, SyncFieldConstants.ARTICLE_COMMENT_VOTE_COUNT])
|
||||
var vote: Int = 0,
|
||||
@SyncPage(syncNames = [SyncFieldConstants.ARTICLE_COMMENT_REPLY_COUNT])
|
||||
var reply: Int = 0,
|
||||
var time: Long = 0,
|
||||
var priority: Int = 0,
|
||||
@SerializedName("me")
|
||||
var me: MeEntity? = null) : Parcelable {
|
||||
var me: MeEntity? = null,
|
||||
// 楼数,本地字段
|
||||
var floor: Int = 0,
|
||||
@SerializedName("attached") // 楼中楼
|
||||
var subCommentList: ArrayList<CommentEntity>? = null) : Parcelable {
|
||||
|
||||
fun clone() : CommentEntity {
|
||||
return CommentEntity(id, user, parent, parentUser, content, vote, reply, time, priority, me, floor, subCommentList)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "CommentEntity"
|
||||
}
|
||||
|
||||
@ -14,4 +14,5 @@ data class CommentParentEntity(
|
||||
var name: String? = null,
|
||||
var comment: String? = null,
|
||||
var active: Boolean = true,
|
||||
var badge: Badge? = null) : Parcelable
|
||||
var badge: Badge? = null,
|
||||
var me: MeEntity? = null) : Parcelable
|
||||
@ -13,8 +13,8 @@ data class CommunityEntity(
|
||||
@SerializedName("icon", alternate = ["ori_icon"])
|
||||
var icon: String? = "",
|
||||
@SerializedName("icon_subscript")
|
||||
var iconSubscript: String? = null
|
||||
) : Parcelable {
|
||||
var iconSubscript: String? = null,
|
||||
var game: SimpleGame? = null) : Parcelable {
|
||||
constructor(id: String = "", name: String = "") : this(id, name, "choiceness")
|
||||
|
||||
companion object {
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Keep
|
||||
@Parcelize
|
||||
data class ConflictUserEntity(
|
||||
val user: User? = null,
|
||||
@SerializedName("register_type")
|
||||
var registerType: String = ""
|
||||
) : Parcelable
|
||||
@ -0,0 +1,18 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.gamedetail.entity.ZoneEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class ForumDetailEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String = "",
|
||||
var game: SimpleGame = SimpleGame(),
|
||||
var background: String = "",
|
||||
var name: String = "",
|
||||
var moderator: ArrayList<UserEntity> = arrayListOf(),
|
||||
@SerializedName("top")
|
||||
var topLink: ArrayList<LinkEntity> = arrayListOf(),
|
||||
@SerializedName("zone_tab")
|
||||
var zone: ZoneEntity? = null,
|
||||
var me: MeEntity = MeEntity()
|
||||
)
|
||||
19
app/src/main/java/com/gh/gamecenter/entity/ForumEntity.kt
Normal file
19
app/src/main/java/com/gh/gamecenter/entity/ForumEntity.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class ForumEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String = "",
|
||||
var game: SimpleGame = SimpleGame(),
|
||||
var name: String = "",
|
||||
@SerializedName("is_follow")
|
||||
var isFollow: Boolean = false
|
||||
|
||||
)
|
||||
|
||||
data class ForumCategoryEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String = "",
|
||||
var name: String = ""
|
||||
)
|
||||
@ -356,8 +356,8 @@ data class GameEntity(
|
||||
}
|
||||
|
||||
fun setWelcomeDialogInfoIfAvailable() {
|
||||
welcomeDialogId = HaloApp.get(Constants.WELCOME_DIALOG_ID, false) as String
|
||||
welcomeDialogTitle = HaloApp.get(Constants.WELCOME_DIALOG_LINK_TITLE, false) as String
|
||||
welcomeDialogId = HaloApp.get(Constants.WELCOME_DIALOG_ID, false) as? String
|
||||
welcomeDialogTitle = HaloApp.get(Constants.WELCOME_DIALOG_LINK_TITLE, false) as? String
|
||||
}
|
||||
|
||||
fun getTag(): ArrayList<String> {
|
||||
@ -405,6 +405,10 @@ data class GameEntity(
|
||||
return entryMap!!
|
||||
}
|
||||
|
||||
fun getRawIconInAdvanced(): String {
|
||||
return rawIcon ?: icon ?: ""
|
||||
}
|
||||
|
||||
fun setEntryMap(entryMap: androidx.collection.ArrayMap<String, DownloadEntity>?) {
|
||||
if (entryMap != null) {
|
||||
this.entryMap = entryMap
|
||||
@ -416,6 +420,8 @@ data class GameEntity(
|
||||
isWelfareGame() -> GameCategory.WELFARE_GAME
|
||||
isOnlineGame() -> GameCategory.ONLINE_GAME
|
||||
isLocalGame() -> GameCategory.LOCAL_GAME
|
||||
isInternationalLocalGame() -> GameCategory.INTERNATIONAL_LOCAL_GAME
|
||||
isInternationalOnlineGame() -> GameCategory.INTERNATIONAL_ONLINE_GAME
|
||||
else -> GameCategory.LOCAL_GAME
|
||||
}
|
||||
}
|
||||
@ -438,6 +444,14 @@ data class GameEntity(
|
||||
return category.equals("welfare")
|
||||
}
|
||||
|
||||
private fun isInternationalLocalGame(): Boolean {
|
||||
return category.equals("gjlocal")
|
||||
}
|
||||
|
||||
private fun isInternationalOnlineGame(): Boolean {
|
||||
return category.equals("gjonline")
|
||||
}
|
||||
|
||||
fun shouldUseMirrorInfo(): Boolean {
|
||||
return ((mirrorStatus == "on")
|
||||
&& (useMirrorInfo || RegionSettingHelper.shouldThisGameDisplayMirrorInfo(id)))
|
||||
@ -562,8 +576,9 @@ data class GameEntity(
|
||||
enum class GameCategory(val value: String) {
|
||||
ONLINE_GAME("online_game"),
|
||||
LOCAL_GAME("local_game"),
|
||||
WELFARE_GAME("welfare_game");
|
||||
|
||||
WELFARE_GAME("welfare_game"),
|
||||
INTERNATIONAL_LOCAL_GAME("gjlocal_game"),
|
||||
INTERNATIONAL_ONLINE_GAME("gjonline_game");
|
||||
override fun toString() = value
|
||||
}
|
||||
|
||||
@ -580,7 +595,8 @@ data class GameEntity(
|
||||
data class SimpleGame(
|
||||
@SerializedName("_id")
|
||||
var id: String? = null,
|
||||
var name: String? = "",
|
||||
@SerializedName("name")
|
||||
var mName: String? = "",
|
||||
@SerializedName("name_suffix")
|
||||
var nameSuffix: String? = null,
|
||||
@SerializedName("icon")
|
||||
@ -588,7 +604,13 @@ data class SimpleGame(
|
||||
@SerializedName("ori_icon")
|
||||
private var mRawIcon: String? = null,
|
||||
@SerializedName("icon_subscript")
|
||||
var iconSubscript: String? = null) : Parcelable {
|
||||
var iconSubscript: String? = null,
|
||||
var active: Boolean = false) : Parcelable {
|
||||
|
||||
@IgnoredOnParcel
|
||||
val name: String?
|
||||
get() = mName?.removeSuffix(".")
|
||||
|
||||
fun getIcon(): String {
|
||||
return mRawIcon ?: mIcon ?: ""
|
||||
}
|
||||
@ -597,7 +619,7 @@ data class SimpleGame(
|
||||
return mIcon ?: ""
|
||||
}
|
||||
|
||||
fun toGameEntity() : GameEntity {
|
||||
fun toGameEntity(): GameEntity {
|
||||
val gameEntity = GameEntity(id = id, name = name)
|
||||
gameEntity.nameSuffix = nameSuffix ?: ""
|
||||
gameEntity.icon = mIcon
|
||||
|
||||
@ -76,7 +76,7 @@ data class LibaoEntity(
|
||||
val libaoEntity = LibaoEntity()
|
||||
libaoEntity.id = concernEntity.id
|
||||
libaoEntity.content = concernEntity.content
|
||||
libaoEntity.game = SimpleGame(id = concernEntity.gameId!!, name = concernEntity.gameName!!)
|
||||
libaoEntity.game = concernEntity.game
|
||||
libaoEntity.icon = concernEntity.gameIcon
|
||||
libaoEntity.name = concernEntity.name
|
||||
libaoEntity.platform = concernEntity.platform
|
||||
|
||||
@ -56,13 +56,14 @@ class MeEntity(@SerializedName("is_community_voted")
|
||||
@SerializedName("is_comment_own", alternate = ["is_answer_commented", "is_community_article_commented", "is_video_commented"])
|
||||
var isCommentOwner: Boolean = false, // 是否是当前评论的拥有者
|
||||
|
||||
@SyncPage(syncNames = [SyncFieldConstants.ARTICLE_COMMENT_VOTE])
|
||||
@SerializedName("is_comment_voted", alternate = ["is_answer_comment_voted", "is_video_comment_voted", "is_community_article_comment_voted"])
|
||||
var isCommentVoted: Boolean = false, // 是否已经点赞过当前评论
|
||||
|
||||
@SerializedName("is_version_requested")
|
||||
var isVersionRequested: Boolean = false,
|
||||
|
||||
@SerializedName("is_follower")
|
||||
@SerializedName("is_follower", alternate = ["is_follow"])
|
||||
var isFollower: Boolean = false, // 是否已经关注该用户
|
||||
|
||||
@SerializedName("is_favorite")
|
||||
|
||||
@ -39,6 +39,8 @@ class MessageEntity {
|
||||
|
||||
var fold: Fold? = null
|
||||
|
||||
var activity: Activity = Activity()
|
||||
|
||||
|
||||
class Article() : Parcelable {
|
||||
@SerializedName("_id")
|
||||
@ -158,6 +160,9 @@ class MessageEntity {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
@SerializedName("top_id")
|
||||
var topId: String? = null
|
||||
|
||||
var content: String? = null
|
||||
}
|
||||
|
||||
@ -165,6 +170,9 @@ class MessageEntity {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
@SerializedName("top_id")
|
||||
var topId: String? = null
|
||||
|
||||
var content: String? = null
|
||||
}
|
||||
|
||||
@ -194,4 +202,18 @@ class MessageEntity {
|
||||
var commentId: String? = null
|
||||
}
|
||||
|
||||
class Activity {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
var title: String? = null
|
||||
|
||||
@SerializedName("image_url")
|
||||
var imageUrl: String? = null
|
||||
|
||||
var url: String? = null
|
||||
|
||||
@SerializedName("url_comment")
|
||||
var urlComment: String? = null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
data class NotificationStyleEntity(
|
||||
var title: String = "",
|
||||
var content: String = "",
|
||||
var image: String = "",
|
||||
var styleNo: String = "",
|
||||
var scenes: String = ""
|
||||
)
|
||||
@ -3,11 +3,14 @@ package com.gh.gamecenter.entity
|
||||
/**
|
||||
* 引导设置 “通知管理” UGC行为
|
||||
*/
|
||||
enum class NotificationUgc {
|
||||
LOGIN,
|
||||
QUESTION,
|
||||
ANSWER,
|
||||
ARTICLE,
|
||||
VIDEO,
|
||||
RATING,
|
||||
enum class NotificationUgc(val value: String) {
|
||||
LOGIN("login"),
|
||||
QUESTION("question"),
|
||||
ANSWER("answer"),
|
||||
ARTICLE("article"),
|
||||
VIDEO("video"),
|
||||
RATING("rating"),
|
||||
GIFT("gift"),
|
||||
RESERVE_GAME("reserveGame"),
|
||||
FEEDBACK("feedback")
|
||||
}
|
||||
@ -111,6 +111,7 @@ data class PersonalHistoryEntity(
|
||||
answer.commentCount = count.comment
|
||||
answer.me = me
|
||||
answer.commentable = commentable
|
||||
answer.articleCommunityId = community.id
|
||||
if (type.contains("article")) {
|
||||
answer.type = "community_article"
|
||||
}
|
||||
|
||||
@ -112,7 +112,12 @@ data class SettingsEntity(
|
||||
@SerializedName("local_game")
|
||||
var localGame: List<String>? = listOf(),
|
||||
@SerializedName("welfare_game")
|
||||
var welfareGame: List<String>? = listOf())
|
||||
var welfareGame: List<String>? = listOf(),
|
||||
@SerializedName("gjlocal_game")
|
||||
var internationalLocalGame: List<String>? = listOf(),
|
||||
@SerializedName("gjonline_game")
|
||||
var internationalOnlineGame: List<String>? = listOf(),
|
||||
var video: List<String>? = listOf())
|
||||
|
||||
data class Download(
|
||||
var game: String? = "",
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
data class ShareEntity(var shareUrl: String = "", var shareTitle: String = "", var summary: String = "")
|
||||
import androidx.annotation.Keep
|
||||
|
||||
data class ShareEntity(var shareUrl: String = "", var shareTitle: String = "", var summary: String = "")
|
||||
|
||||
@Keep
|
||||
data class ShareResultEntity(var content: Content, var method: String, var result: String) {
|
||||
data class Content(var url: String, var title: String, var summary: String)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user