Compare commits
110 Commits
CWZS-113-r
...
v5.34.7-10
| Author | SHA1 | Date | |
|---|---|---|---|
| e5dbdb154f | |||
| 2b91545d34 | |||
| f8703b9fe1 | |||
| 58cc8c7f3c | |||
| 79cf1566b2 | |||
| 47a98f22b5 | |||
| 71453054d9 | |||
| 61ae86e40a | |||
| 89de5f24bf | |||
| 4c79c49506 | |||
| 1214a6fb13 | |||
| e90053bdc9 | |||
| c199487c51 | |||
| a1ac427540 | |||
| 1e2755c82c | |||
| a05e31705f | |||
| 62f2bb40df | |||
| eabb277c7b | |||
| 7be6af5f08 | |||
| 982f5faf97 | |||
| 1a99fec286 | |||
| 3d77c1ed3a | |||
| c312d616da | |||
| 8f1affeb74 | |||
| fdbfdecb2d | |||
| e84b814d2c | |||
| 14c8591a99 | |||
| 95d073a50d | |||
| edec43aea2 | |||
| 188b5bdd7f | |||
| c454b092b2 | |||
| c70b1c962b | |||
| e71b2b0a56 | |||
| c010b7aba4 | |||
| 2c23c4f0eb | |||
| 2c2031f623 | |||
| 41ddf53e23 | |||
| b911edb83c | |||
| 7524144c3d | |||
| aef5bb0021 | |||
| 1e45790280 | |||
| 907f840537 | |||
| 07dfd58538 | |||
| 4491865aef | |||
| 9dabe9fa03 | |||
| 79349d51ee | |||
| a3319b71d2 | |||
| b06341959d | |||
| 089e552e0f | |||
| 16e0da0c7c | |||
| e1a9879ea4 | |||
| b610e1619d | |||
| 6977e99269 | |||
| b7cadbce50 | |||
| 44569233e9 | |||
| d1962cf363 | |||
| dbf35afa3f | |||
| 1dcdb81529 | |||
| fb9d0d01d8 | |||
| f449a41257 | |||
| ef41245a1a | |||
| c2aae6d5f9 | |||
| 700a56c6f9 | |||
| 6673805ba1 | |||
| 6130fa345b | |||
| 38a9bf0bfa | |||
| bdb2180af6 | |||
| a4b8feb7ef | |||
| 6c58b3b102 | |||
| 28014190f3 | |||
| 76843829aa | |||
| ef3a243bc5 | |||
| fc8766f2e7 | |||
| 278423cfad | |||
| 8e2f06c19b | |||
| bf4f270c37 | |||
| d406cba6c2 | |||
| 6c4d17ab9e | |||
| 8fc9134402 | |||
| babb7d3f7b | |||
| 0972e90049 | |||
| df2382609a | |||
| b61fdd0a0e | |||
| 0662ecd86b | |||
| 3c6920520e | |||
| 03bbcc2af3 | |||
| 5efd61d5f6 | |||
| 737e14a6ce | |||
| 68931b5d9c | |||
| dac1f207f2 | |||
| dd48585bca | |||
| b4a8c07d8a | |||
| 7a417bc655 | |||
| 6efb8ee700 | |||
| 1d58dcc998 | |||
| 5647b9c0b0 | |||
| ba0eb38ee8 | |||
| 3406addd87 | |||
| 52f7120157 | |||
| ee742213e6 | |||
| 3816ce44a5 | |||
| 37c6c7bb26 | |||
| a0bc96fa2b | |||
| 5375901813 | |||
| 816c37ed6f | |||
| a3c603490d | |||
| 2e18460f22 | |||
| 6482bb31e9 | |||
| 1822177e2c | |||
| 3af3d4255f |
@ -71,7 +71,7 @@ android_build:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.33.0
|
||||
- release
|
||||
|
||||
# 代码检查
|
||||
sonarqube_analysis:
|
||||
@ -102,7 +102,7 @@ sonarqube_analysis:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.33.0
|
||||
- release
|
||||
|
||||
## 发送简易检测结果报告
|
||||
send_sonar_report:
|
||||
@ -120,7 +120,7 @@ send_sonar_report:
|
||||
exit_codes: 137
|
||||
only:
|
||||
- dev
|
||||
- dev-5.33.0
|
||||
- release
|
||||
|
||||
oss-upload&send-email:
|
||||
tags:
|
||||
@ -152,4 +152,4 @@ oss-upload&send-email:
|
||||
- /usr/local/bin/python /ci-android-mail-jira-comment.py
|
||||
only:
|
||||
- dev
|
||||
- dev-5.33.0
|
||||
- release
|
||||
@ -310,7 +310,6 @@ dependencies {
|
||||
|
||||
// debugImplementation "com.gu.android:toolargetool:${toolargetool}" // 需要使用调试时才启用
|
||||
debugImplementation "com.github.nichbar:WhatTheStack:${whatTheStack}"
|
||||
// debugImplementation "io.github.didi.dokit:dokitx:${dokit}"
|
||||
|
||||
implementation "androidx.multidex:multidex:${multiDex}"
|
||||
implementation "androidx.fragment:fragment-ktx:${fragment}"
|
||||
@ -413,6 +412,13 @@ dependencies {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
internalImplementation(project(':module_internal_test'))
|
||||
|
||||
// 根据BUILD_PUSH_TYPE决定使用哪个推送SDK,目前默认使用阿里云推送
|
||||
def pushProject = findProperty('BUILD_PUSH_TYPE') == 'jg'
|
||||
? project(':feature:jg_push') : project(':feature:acloud_push')
|
||||
implementation(pushProject) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
}
|
||||
|
||||
File propFile = file('sign.properties')
|
||||
|
||||
@ -80,9 +80,6 @@
|
||||
### EasyFloat
|
||||
-keep class com.lzf.easyfloat.* {*;}
|
||||
|
||||
### dokit
|
||||
-keep class com.didichuxing.** {*;}
|
||||
|
||||
### 广点通SDK
|
||||
-dontwarn com.qq.gdt.action.**
|
||||
-keep class com.qq.gdt.action.** {*;}
|
||||
|
||||
@ -8,7 +8,7 @@ import com.gh.gamecenter.core.provider.IFlavorProvider
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.TimeUtils
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.leon.channel.helper.ChannelReaderUtil
|
||||
import com.tencent.vasdolly.helper.ChannelReaderUtil
|
||||
|
||||
class FlavorProviderImp : IFlavorProvider {
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import com.gh.gamecenter.core.utils.TimeUtils
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.kwai.monitor.payload.TurboHelper
|
||||
import com.leon.channel.helper.ChannelReaderUtil
|
||||
import com.tencent.vasdolly.helper.ChannelReaderUtil
|
||||
|
||||
class FlavorProviderImp : IFlavorProvider {
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
<package android:name="com.lg.vspace" />
|
||||
</queries>
|
||||
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
tools:ignore="ScopedStorage" />
|
||||
<!-- 允许应用程序访问网络连接 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- 允许应用程序写入外部存储,如SD卡上写文件 -->
|
||||
@ -99,8 +101,9 @@
|
||||
android:name="android.permission.GET_TASKS"
|
||||
tools:node="remove" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
|
||||
tools:node="remove"/>
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_COARSE_LOCATION"
|
||||
tools:node="remove" />
|
||||
|
||||
<supports-screens
|
||||
android:anyDensity="true"
|
||||
@ -117,10 +120,12 @@
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:preserveLegacyExternalStorage="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:resizeableActivity="true"
|
||||
android:theme="@style/AppCompatTheme.APP"
|
||||
tools:replace="android:name,android:allowBackup"
|
||||
tools:targetApi="n">
|
||||
tools:targetApi="r">
|
||||
|
||||
<meta-data
|
||||
android:name="EasyGoClient"
|
||||
@ -193,7 +198,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.NewsDetailActivity"
|
||||
android:name="com.gh.gamecenter.newsdetail.NewsDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
@ -248,7 +253,7 @@
|
||||
android:windowSoftInputMode="stateHidden" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.LibaoDetailActivity"
|
||||
android:name="com.gh.gamecenter.libao.LibaoDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
@ -610,6 +615,10 @@
|
||||
android:name=".game.commoncollection.detail.CommonCollectionDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".game.commoncollection.detail.CustomCommonCollectionDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".gamecollection.detail.GameCollectionDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@ -701,7 +710,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.toolbox.ToolBoxBlockActivity"
|
||||
android:name="com.gh.gamecenter.toolbox.ToolBoxActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
@ -778,6 +787,12 @@
|
||||
android:name="com.gh.gamecenter.SplashAdActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.wrapper.ToolbarWrapperActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity android:name=".forum.home.CommunityActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
<!-- <activity-->
|
||||
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
|
||||
@ -833,7 +848,7 @@
|
||||
<!-- tools:node="remove" />-->
|
||||
<!-- </provider>-->
|
||||
|
||||
<service android:name = "com.gh.gamecenter.install.InstallService" />
|
||||
<service android:name="com.gh.gamecenter.install.InstallService" />
|
||||
|
||||
<receiver
|
||||
android:name="com.gh.gamecenter.receiver.DownloadReceiver"
|
||||
@ -852,8 +867,8 @@
|
||||
|
||||
<activity
|
||||
android:name="com.gh.common.xapk.XapkInstallReceiver"
|
||||
android:theme="@style/Theme.Transparent"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:theme="@style/Theme.Transparent" />
|
||||
|
||||
<receiver
|
||||
android:name="com.gh.gamecenter.receiver.ActivitySkipReceiver"
|
||||
@ -862,7 +877,6 @@
|
||||
<action android:name="com.gh.gamecenter.ACTIVITYSKIP" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
1
app/src/main/assets/lottie/tab_mine.json
Normal file
1
app/src/main/assets/lottie/tab_mine.json
Normal file
@ -0,0 +1 @@
|
||||
{"v":"5.12.2","fr":60,"ip":0,"op":40,"w":66,"h":66,"nm":"icon_tab_my","ddd":0,"assets":[{"id":"comp_0","nm":"icon","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"highlight","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33.134,34.5,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.667,"y":0.733},"o":{"x":0.333,"y":0},"t":0,"s":[{"i":[[0,-0.004],[0.493,0],[0,0.004],[-0.493,0]],"o":[[0,0.004],[-0.493,0],[0,-0.004],[0.493,0]],"v":[[0.893,1.488],[0,1.496],[-0.893,1.488],[0,1.483]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0.267},"t":10,"s":[{"i":[[0,-1.018],[1.793,0],[0,1.018],[-1.793,0]],"o":[[0,1.018],[-1.793,0],[0,-1.018],[1.793,0]],"v":[[2.914,-0.344],[0,1.5],[-2.914,-0.344],[0,-1.5]],"c":true}]},{"i":{"x":0.333,"y":1},"o":{"x":0.667,"y":0},"t":18,"s":[{"i":[[0,-1.181],[1.407,0],[0,1.181],[-1.407,0]],"o":[[0,1.181],[-1.407,0],[0,-1.181],[1.407,0]],"v":[[2.226,-0.341],[0,1.74],[-2.211,-0.341],[0,-1.74]],"c":true}]},{"i":{"x":0.333,"y":1},"o":{"x":0.667,"y":0},"t":26,"s":[{"i":[[0,-0.905],[1.381,0],[0,0.905],[-1.381,0]],"o":[[0,0.905],[-1.381,0],[0,-0.905],[1.381,0]],"v":[[2.5,-0.306],[0,1.333],[-2.5,-0.306],[0,-1.333]],"c":true}]},{"t":32,"s":[{"i":[[0,-1.018],[1.381,0],[0,1.018],[-1.381,0]],"o":[[0,1.018],[-1.381,0],[0,-1.018],[1.381,0]],"v":[[2.5,-0.344],[0,1.5],[-2.5,-0.344],[0,-1.5]],"c":true}]}],"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"color","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[300,300],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆形","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"body","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[33,34.204,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-3.866,0],[0,3.866],[3.866,0],[0,-3.866]],"o":[[3.866,0],[0,-3.866],[-3.866,0],[0,3.866]],"v":[[0,4.599],[7,-2.401],[0,-9.401],[-7,-2.401]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0.207,0.359],[2.438,0],[1.189,-2.104],[-0.361,-0.204],[-0.204,0.361],[-1.915,0],[-0.932,-1.613],[-0.359,0.207]],"o":[[-1.198,-2.072],[-2.462,0],[-0.204,0.361],[0.361,0.204],[0.925,-1.638],[1.897,0],[0.207,0.359],[0.359,-0.207]],"v":[[5.848,8.225],[0,4.849],[-5.88,8.282],[-5.596,9.304],[-4.574,9.02],[0,6.349],[4.549,8.976],[5.574,9.25]],"c":true},"ix":2},"nm":"路径 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"合并路径 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"bm":0,"g":{"p":3,"k":{"a":0,"k":[0,0.267,0.639,1,0.5,0.241,0.596,1,1,0.216,0.553,1],"ix":9}},"s":{"a":0,"k":[-3.812,-4.384],"ix":5},"e":{"a":0,"k":[6.345,8.129],"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":"Union","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60,"st":0,"ct":1,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"icon","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,"l":2},"a":{"a":0,"k":[33,33,0],"ix":1,"l":2},"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":8,"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":18,"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":26,"s":[90,90,100]},{"t":32,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"w":66,"h":66,"ip":0,"op":60,"st":0,"bm":0}],"markers":[],"props":{}}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB |
@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -54,7 +55,7 @@ object AdDelegateHelper {
|
||||
private var mCsjAdImpl: ICsjAdProvider? = null
|
||||
private var mBeiziAdImpl: IBeiziAdProvider? = null
|
||||
|
||||
private var mAdConfigList: ArrayList<AdConfig>? = null
|
||||
private val mAdConfigList: ArrayList<AdConfig> by lazy { arrayListOf() }
|
||||
|
||||
private var mSplashAd: AdConfig? = null
|
||||
private var mDownloadManagerAd: AdConfig? = null
|
||||
@ -106,7 +107,7 @@ object AdDelegateHelper {
|
||||
@SuppressLint("CheckResult")
|
||||
fun requestAdConfig(isFromRetry: Boolean, keyword: String = "", callback: (() -> Unit)? = null) {
|
||||
// mAdConfigList 不为空不需要重试
|
||||
if (isFromRetry && mAdConfigList != null) {
|
||||
if (isFromRetry && mAdConfigList.isNotEmpty()) {
|
||||
return
|
||||
}
|
||||
val paramsMap = if (keyword.isNotEmpty()) mapOf("keyword" to keyword) else mapOf()
|
||||
@ -129,7 +130,7 @@ object AdDelegateHelper {
|
||||
|
||||
// 若接口请求失败时,从 SP 里获取上次缓存的数据
|
||||
val cachedConfig: List<AdConfig>? = SPUtils.getString(mAdConfigSp, KEY_CACHE_CONFIG).toObject()
|
||||
if (cachedConfig != null) {
|
||||
if (cachedConfig != null && mAdConfigList.isEmpty()) {
|
||||
handleAdConfig(cachedConfig)
|
||||
}
|
||||
|
||||
@ -156,11 +157,13 @@ object AdDelegateHelper {
|
||||
* 处理广告配置
|
||||
*/
|
||||
fun handleAdConfig(configList: List<AdConfig>) {
|
||||
mAdConfigList.clear()
|
||||
mGameSearchAdList.clear()
|
||||
mSplashAd = null
|
||||
mDownloadManagerAd = null
|
||||
mVGameLaunchAd = null
|
||||
for (config in configList) {
|
||||
mAdConfigList.add(config)
|
||||
// 处理返回的数据
|
||||
when (config.location) {
|
||||
"halo_launch" -> {
|
||||
@ -190,7 +193,8 @@ object AdDelegateHelper {
|
||||
/**
|
||||
* 热启动是否需要显示开屏广告
|
||||
*/
|
||||
private fun shouldShowStartUpAdWhenHotLaunch() = mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK
|
||||
private fun shouldShowStartUpAdWhenHotLaunch() =
|
||||
mSplashAd?.displayRule?.hotStartSplashAd?.type == AD_TYPE_SDK && mSplashAd?.hotStartThirdPartyAd != null
|
||||
|
||||
/**
|
||||
* 是否需要显示下载管理广告
|
||||
@ -357,11 +361,6 @@ object AdDelegateHelper {
|
||||
isHotLaunch: Boolean,
|
||||
hideCallback: () -> Unit
|
||||
) {
|
||||
val timeout = if (isHotLaunch) {
|
||||
((mSplashAd!!.displayRule.hotStartSplashAd?.timeout ?: 3.5F) * 1000).toInt()
|
||||
} else {
|
||||
(mSplashAd!!.displayRule.timeout * 1000).toInt()
|
||||
}
|
||||
// 第三方开屏广告回调,失败时根据接口配置选项决定是否显示自有开屏广告
|
||||
val sdkSplashCallback: (isSuccess: Boolean) -> Unit = { isSuccess ->
|
||||
if (isSuccess) {
|
||||
@ -389,20 +388,28 @@ object AdDelegateHelper {
|
||||
}
|
||||
}
|
||||
|
||||
val thirdPartyAd = if (isHotLaunch) mSplashAd?.hotStartThirdPartyAd else mSplashAd?.thirdPartyAd
|
||||
|
||||
// 第三方广告的数据为空,按加载失败处理
|
||||
if (mSplashAd?.thirdPartyAd == null) {
|
||||
if (mSplashAd == null || thirdPartyAd == null) {
|
||||
sdkSplashCallback.invoke(false)
|
||||
return
|
||||
}
|
||||
|
||||
if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_BEIZI) {
|
||||
val timeout = if (isHotLaunch) {
|
||||
((mSplashAd?.displayRule?.hotStartSplashAd?.timeout ?: 3.5F) * 1000).toInt()
|
||||
} else {
|
||||
((mSplashAd?.displayRule?.timeout ?: 3.5F) * 1000).toInt()
|
||||
}
|
||||
|
||||
if (thirdPartyAd.sourceName == AD_SDK_BEIZI) {
|
||||
sdkStartAdContainer.visibility = View.VISIBLE
|
||||
requestBeiziSplashAd(sdkStartAdContainer, adsViewGroup, adViewWidthInPx, adViewHeightInPx, timeout.toLong(), sdkSplashCallback)
|
||||
} else if (mSplashAd?.thirdPartyAd?.sourceName == AD_SDK_CSJ) {
|
||||
} else if (thirdPartyAd.sourceName == AD_SDK_CSJ) {
|
||||
sdkStartAdContainer.visibility = View.VISIBLE
|
||||
requestCsjSplashAd(
|
||||
activity,
|
||||
mSplashAd?.thirdPartyAd?.slotId ?: "unknown",
|
||||
thirdPartyAd.slotId,
|
||||
adViewWidthInPx,
|
||||
adViewHeightInPx,
|
||||
adViewWidthInDp,
|
||||
@ -570,6 +577,17 @@ object AdDelegateHelper {
|
||||
(if (linkEntity.type != null) linkEntity.type else "")!!,
|
||||
(if (linkEntity.link != null) linkEntity.link else "")!!
|
||||
)
|
||||
SensorsBridge.trackEvent(
|
||||
"SplashAdOwnSkip",
|
||||
"splash_ad_id",
|
||||
ad.id,
|
||||
"link_type",
|
||||
linkEntity.type ?: "",
|
||||
"link_id",
|
||||
linkEntity.link ?: "",
|
||||
"link_text",
|
||||
linkEntity.text ?: ""
|
||||
)
|
||||
}
|
||||
val sources: MutableList<ExposureSource> = ArrayList()
|
||||
sources.add(ExposureSource("开屏广告", ad.id))
|
||||
@ -577,7 +595,19 @@ object AdDelegateHelper {
|
||||
ExposureManager.log(event)
|
||||
if (ad.button) {
|
||||
jumpDetailBtn.setOnClickListener { v: View ->
|
||||
directToLinkPage(v.context, ad.jump, "(启动广告)", "", event)
|
||||
val linkEntity = ad.jump
|
||||
directToLinkPage(v.context, linkEntity, "(启动广告)", "", event)
|
||||
SensorsBridge.trackEvent(
|
||||
"SplashAdOwnClick",
|
||||
"splash_ad_id",
|
||||
ad.id,
|
||||
"link_type",
|
||||
linkEntity.type ?: "",
|
||||
"link_id",
|
||||
linkEntity.link ?: "",
|
||||
"link_text",
|
||||
linkEntity.text ?: ""
|
||||
)
|
||||
v.postDelayed({
|
||||
handler.removeMessages(MainActivity.COUNTDOWN_AD)
|
||||
hideCallback.invoke()
|
||||
@ -589,7 +619,10 @@ object AdDelegateHelper {
|
||||
LogUtils.logStartAd("start_ads", ad)
|
||||
}
|
||||
SPUtils.setLong(Constants.SP_LAST_SPLASH_AD_SHOW_TIME, System.currentTimeMillis())
|
||||
handler.sendEmptyMessageDelayed(MainActivity.COUNTDOWN_AD, 1000)
|
||||
val msg = Message.obtain()
|
||||
msg.what = MainActivity.COUNTDOWN_AD
|
||||
msg.obj = ad
|
||||
handler.sendMessageDelayed(msg, 1000)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -44,7 +44,7 @@ import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
// TODO: 移动到module_bbs模块
|
||||
abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarActivity(),
|
||||
abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor() : ToolBarActivity(),
|
||||
KeyboardHeightObserver, UploadVideoListener {
|
||||
|
||||
lateinit var mRichEditor: RichEditor
|
||||
|
||||
@ -12,13 +12,13 @@ import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
|
||||
import com.gh.gamecenter.common.entity.ErrorEntity
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.runOnUiThread
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.common.entity.ErrorEntity
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.entity.ForumDetailEntity
|
||||
import com.gh.gamecenter.entity.LocalVideoEntity
|
||||
import com.gh.gamecenter.entity.QuoteCountEntity
|
||||
@ -28,7 +28,6 @@ import com.gh.gamecenter.retrofit.service.ApiService
|
||||
import com.gh.gamecenter.video.upload.OnUploadListener
|
||||
import com.gh.gamecenter.video.upload.UploadManager
|
||||
import com.google.gson.JsonObject
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.Utils
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zhihu.matisse.internal.utils.PathUtils
|
||||
@ -62,7 +61,6 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
|
||||
val TITLE_MIN_LENGTH = 6
|
||||
val MIN_TEXT_LENGTH = 6
|
||||
val MAX_TEXT_LENGTH = 10000
|
||||
val FILE_HOST = "file:///"
|
||||
var id = ""//视频标记
|
||||
var videoId = ""//更改封面视频id
|
||||
val quoteCountEntity = QuoteCountEntity()//数据上报用
|
||||
@ -129,15 +127,13 @@ abstract class BaseRichEditorViewModel(application: Application) : AndroidViewMo
|
||||
}
|
||||
val map = LinkedHashMap<String, String>()
|
||||
for (key in imageUrlMap.keys) {
|
||||
val localFileUri = FILE_HOST + key.decodeURI()
|
||||
|
||||
// 文件格式为 HEIC 时,使用经 OSS 转码的图片作为预览图片
|
||||
if (FileUtils.getFileMimeType(getApplication(), key.decodeURI())?.lowercase(Locale.CHINA)?.contains("heic") == true) {
|
||||
val transformedImgUrl = ImageUtils.getTransformedUrl(imageUrlMap[key], 5000) ?: ""
|
||||
map[MD5Utils.getUrlMD5(key)] = transformedImgUrl
|
||||
mapImages[transformedImgUrl.decodeURI()] = imageUrlMap[key] ?: ""
|
||||
} else {
|
||||
map[MD5Utils.getUrlMD5(key)] = localFileUri
|
||||
map[MD5Utils.getUrlMD5(key)] = imageUrlMap[key] ?: ""
|
||||
mapImages[TextUtils.htmlEncode(key).decodeURI()] = imageUrlMap[key] ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ abstract class DownloadToolbarActivity : ToolBarActivity() {
|
||||
|
||||
override fun inflateMenu(res: Int) {
|
||||
super.inflateMenu(res)
|
||||
if (showDownloadMenu()) {
|
||||
if (!getBoolean(Constants.SP_TEENAGER_MODE) && showDownloadMenu()) {
|
||||
createDownloadMenu(res)
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ abstract class DownloadToolbarActivity : ToolBarActivity() {
|
||||
}
|
||||
val downloadMenuView = mActionMenuView.menu.findItem(R.id.menu_download).actionView
|
||||
mDownloadCountHint = downloadMenuView?.findViewById(R.id.menu_download_count_hint)
|
||||
mDownloadCountHint?.typeface = Typeface.createFromAsset(assets, "fonts/d_din_bold_only_number.ttf")
|
||||
mDownloadCountHint?.typeface = Typeface.createFromAsset(assets, Constants.DIN_FONT_PATH)
|
||||
}
|
||||
|
||||
override fun onMenuItemClick(item: MenuItem?): Boolean {
|
||||
|
||||
@ -329,6 +329,11 @@ class DefaultJsApi(
|
||||
return HaloApp.getInstance().gid
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun getOaid(msg: Any): String {
|
||||
return HaloApp.getInstance().oaid
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun showIncompatibleVersionDialog(msg: Any) {
|
||||
DialogHelper.showUpgradeDialog(context)
|
||||
|
||||
@ -15,9 +15,6 @@ import com.gh.common.util.DirectUtils.directToLegacyVideoDetail
|
||||
import com.gh.common.util.DirectUtils.directToLinkPage
|
||||
import com.gh.common.util.DirectUtils.directToQa
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.gamecenter.LibaoDetailActivity
|
||||
import com.gh.gamecenter.MainActivity
|
||||
import com.gh.gamecenter.NewsDetailActivity
|
||||
import com.gh.gamecenter.WebActivity
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
@ -34,12 +31,12 @@ import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.entity.ActivityLabelEntity
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity
|
||||
import com.gh.gamecenter.entity.VideoLinkEntity
|
||||
import com.gh.gamecenter.eventbus.EBSkip
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils
|
||||
import com.gh.gamecenter.fragment.MainWrapperFragment
|
||||
import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity
|
||||
import com.gh.gamecenter.libao.LibaoDetailActivity
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailActivity
|
||||
import com.gh.gamecenter.qa.BbsType
|
||||
import com.gh.gamecenter.qa.video.publish.VideoPublishActivity
|
||||
import com.gh.gamecenter.subject.SubjectActivity
|
||||
@ -262,10 +259,7 @@ object DefaultUrlHandler {
|
||||
)
|
||||
}
|
||||
EntranceConsts.HOST_VIDEO_STREAMING_HOME -> {
|
||||
intent = Intent(context, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
intent.putExtra(MainActivity.SWITCH_TO_VIDEO, true)
|
||||
context.startActivity(intent)
|
||||
DirectUtils.directToHomeVideoTab(context)
|
||||
}
|
||||
EntranceConsts.HOST_VIDEO_STREAMING_DESC -> {
|
||||
directToGameDetailVideoStreaming(context, id, entrance)
|
||||
@ -366,9 +360,8 @@ object DefaultUrlHandler {
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_FORUM -> {
|
||||
val position = uri.getQueryParameter(EntranceConsts.KEY_POSITION)?.toInt()
|
||||
|
||||
DirectUtils.directToForum(context, position ?: 0)
|
||||
DirectUtils.directToHomeCommunityTab(context)
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_UPLOAD_VIDEO_NEW -> {
|
||||
@ -505,13 +498,11 @@ object DefaultUrlHandler {
|
||||
|
||||
EntranceConsts.HOST_GAME_LIBRARY -> {
|
||||
DirectUtils.directToMainActivity(context)
|
||||
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_GAME))
|
||||
}
|
||||
|
||||
EntranceConsts.HOST_HOME_GAME_COLLECTION_SQUARE -> {
|
||||
DirectUtils.directToMainActivity(context)
|
||||
EventBus.getDefault()
|
||||
.post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_HOME))
|
||||
DirectUtils.directToHomeDefaultTab(context)
|
||||
EventBus.getDefault().post(EBReuse(host))
|
||||
}
|
||||
|
||||
@ -598,6 +589,7 @@ object DefaultUrlHandler {
|
||||
DirectUtils.directToGameDetail(
|
||||
context,
|
||||
gameId,
|
||||
"",
|
||||
entrance,
|
||||
autoDownload = false,
|
||||
traceEvent = null
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
package com.gh.common.chain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.common.dialog.CertificationDialog
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
class CertificationHandler : DownloadChainHandler() {
|
||||
|
||||
override fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean) {
|
||||
CertificationDialog.showCertificationDialog(context, gameEntity) {
|
||||
if (hasNext()) {
|
||||
getNext()?.handleRequest(context, gameEntity, asVGame)
|
||||
} else {
|
||||
processEndCallback?.invoke(asVGame, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,6 @@ import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.gh.common.util.AdHelper;
|
||||
import com.gh.common.util.PackageHelper;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
@ -26,21 +25,18 @@ import com.gh.gamecenter.entity.GameGuidePopupEntity;
|
||||
import com.gh.gamecenter.entity.NewApiSettingsEntity;
|
||||
import com.gh.gamecenter.entity.NewSettingsEntity;
|
||||
import com.gh.gamecenter.entity.VSetting;
|
||||
import com.gh.gamecenter.feature.entity.NewsEntity;
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity;
|
||||
import com.gh.gamecenter.feature.entity.SimulatorEntity;
|
||||
import com.gh.gamecenter.feature.utils.ContentBlockedHelper;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@ -76,51 +72,10 @@ public class Config {
|
||||
private static GameGuidePopupEntity mGameGuidePopupEntity;
|
||||
private static SharedPreferences mDefaultSharedPreferences;
|
||||
|
||||
public static final String FIX_DOWNLOAD_KEY = "isFixDownload";
|
||||
public static final String FIX_PLUGIN_KEY = "isFixPlugin";
|
||||
|
||||
public static final int VIDEO_PAGE_SIZE = 21; // 视频列表大多都是一行3个
|
||||
|
||||
public static boolean isShow() {
|
||||
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) return false;
|
||||
|
||||
if (getPreferences().getBoolean(FIX_DOWNLOAD_KEY, false)) return true;
|
||||
|
||||
if (!isExistDownloadFilter()) return false;
|
||||
|
||||
for (SettingsEntity.Download entity : getSettings().getDownload()) {
|
||||
if ("all".equals(entity.getGame())) {
|
||||
if (entity.getPluginfy() && "normal".equals(entity.getPolicy()) && filterTime(entity.getTime())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isShowDownload(String gameId) {
|
||||
|
||||
if (getPreferences().getBoolean(FIX_DOWNLOAD_KEY, false)) return true;
|
||||
|
||||
if (TextUtils.isEmpty(gameId) || !isExistDownloadFilter())
|
||||
return false;
|
||||
|
||||
for (SettingsEntity.Download entity : getSettings().getDownload()) {
|
||||
if (gameId.equals(entity.getGame())) {
|
||||
if ("normal".equals(entity.getPolicy()) && filterTime(entity.getTime())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if ("all".equals(entity.getGame())) {
|
||||
if ("normal".equals(entity.getPolicy()) && filterTime(entity.getTime())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return !SPUtils.getBoolean(Constants.SP_TEENAGER_MODE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,74 +91,10 @@ public class Config {
|
||||
return mNewApiSettingsEntity.getInstall().getVpnRequired().getShouldShowVpnOption();
|
||||
}
|
||||
|
||||
public static boolean isShowPlugin(String gameId) {
|
||||
SharedPreferences preferences = getPreferences();
|
||||
boolean isFixPlugin = preferences.getBoolean(FIX_PLUGIN_KEY, false);
|
||||
if (isFixPlugin) return true;
|
||||
|
||||
if (TextUtils.isEmpty(gameId) || !isExistDownloadFilter())
|
||||
return false;
|
||||
|
||||
for (SettingsEntity.Download entity : getSettings().getDownload()) {
|
||||
if (gameId.equals(entity.getGame())) {
|
||||
if (entity.getPluginfy() && filterTime(entity.getTime())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ("all".equals(entity.getGame())) {
|
||||
if (entity.getPluginfy() && filterTime(entity.getTime())) {
|
||||
preferences.edit().putBoolean(FIX_PLUGIN_KEY, true).apply();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isShowPlugin() {
|
||||
SharedPreferences preferences = getPreferences();
|
||||
boolean isFixPlugin = preferences.getBoolean(FIX_PLUGIN_KEY, false);
|
||||
if (isFixPlugin) return true;
|
||||
|
||||
if (!isExistDownloadFilter())
|
||||
return false;
|
||||
|
||||
for (SettingsEntity.Download entity : getSettings().getDownload()) {
|
||||
if ("all".equals(entity.getGame())) {
|
||||
if (entity.getPluginfy() && filterTime(entity.getTime())) {
|
||||
preferences.edit().putBoolean(FIX_PLUGIN_KEY, true).apply();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean filterTime(SettingsEntity.Download.TimeEntity timeEntity) {
|
||||
long end = timeEntity.getEnd();
|
||||
long start = timeEntity.getStart();
|
||||
long curTime = Utils.getTime(HaloApp.getInstance().getApplication());
|
||||
|
||||
if ((start == 0 || curTime >= start) && (end == 0 || curTime <= end)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void setSettings(SettingsEntity settingsEntity) {
|
||||
getPreferences().edit().putString(SETTINGS_KEY, GsonUtils.toJson(settingsEntity)).apply();
|
||||
mSettingsEntity = settingsEntity;
|
||||
|
||||
// 更新设置状态
|
||||
mSettingsEntity.showArticleEntrance();
|
||||
mSettingsEntity.showCommunityEntrance();
|
||||
|
||||
// 加载完设置后刷新下
|
||||
PackageHelper.initList();
|
||||
}
|
||||
@ -331,27 +222,6 @@ public class Config {
|
||||
return mGameGuidePopupEntity;
|
||||
}
|
||||
|
||||
private static boolean isExistDownloadFilter() {
|
||||
if (getSettings() == null || getSettings().getDownload() == null || getSettings().getDownload().size() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void filterPluginArticle(List<NewsEntity> list) {
|
||||
if (isShowPlugin() || list == null) return;
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
NewsEntity newsEntity = list.get(i);
|
||||
String title = newsEntity.getTitle();
|
||||
if (!TextUtils.isEmpty(title) && title.contains("插件")) {
|
||||
list.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static SharedPreferences getPreferences() {
|
||||
if (mDefaultSharedPreferences == null) {
|
||||
mDefaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance().getApplication());
|
||||
@ -382,9 +252,6 @@ public class Config {
|
||||
GsonUtils.toJson(response.getSuggestion()));
|
||||
edit.apply();
|
||||
|
||||
if (!getPreferences().getBoolean(Config.FIX_DOWNLOAD_KEY, false) && Config.isShow()) {
|
||||
getPreferences().edit().putBoolean(Config.FIX_DOWNLOAD_KEY, true).apply();
|
||||
}
|
||||
if (!SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
|
||||
EventBus.getDefault().post(new EBReuse("Refresh"));
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.gh.common.chain.BrowserInstallHandler;
|
||||
import com.gh.common.chain.CertificationHandler;
|
||||
import com.gh.common.chain.DownloadChainBuilder;
|
||||
import com.gh.common.chain.DownloadChainHandler;
|
||||
import com.gh.common.chain.CheckDownloadHandler;
|
||||
@ -53,6 +52,8 @@ import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.common.utils.DarkModeUtils;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.FileUtils;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
@ -70,13 +71,14 @@ import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.FileUtils;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import kotlin.collections.CollectionsKt;
|
||||
|
||||
/**
|
||||
* Created by khy on 12/02/18.
|
||||
*/
|
||||
@ -119,7 +121,6 @@ public class BindingAdapters {
|
||||
|
||||
// 判断是否显示按钮
|
||||
if (gameEntity != null
|
||||
&& Config.isShowDownload(gameEntity.getId())
|
||||
&& !"光环助手".equals(gameEntity.getName())) {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
@ -134,7 +135,7 @@ public class BindingAdapters {
|
||||
case DOWNLOADING_PLUGIN:
|
||||
case DOWNLOADING_NORMAL:
|
||||
Intent intent = DownloadManagerActivity.getDownloadMangerIntent(v.getContext(),
|
||||
gameEntity.getApk().get(0).getUrl(), entrance);
|
||||
gameEntity.getApk().isEmpty() ? "" : gameEntity.getApk().get(0).getUrl(), entrance);
|
||||
v.getContext().startActivity(intent);
|
||||
break;
|
||||
case NONE:
|
||||
@ -166,7 +167,6 @@ public class BindingAdapters {
|
||||
builder.addHandler(new BrowserInstallHandler());
|
||||
builder.addHandler(new PackageCheckHandler());
|
||||
builder.addHandler(new DownloadDialogHelperHandler());
|
||||
builder.addHandler(new CertificationHandler());
|
||||
builder.addHandler(new VersionNumberHandler());
|
||||
builder.addHandler(new LandPageAddressHandler());
|
||||
builder.addHandler(new OverseaDownloadHandler());
|
||||
@ -195,7 +195,6 @@ public class BindingAdapters {
|
||||
DownloadChainBuilder builder = new DownloadChainBuilder();
|
||||
builder.addHandler(new UnsupportedFeatureHandler());
|
||||
builder.addHandler(new GamePermissionHandler());
|
||||
builder.addHandler(new CertificationHandler());
|
||||
builder.addHandler(new VersionNumberHandler());
|
||||
|
||||
builder.setProcessEndCallback((asVGame, isSubscribe) -> {
|
||||
@ -222,7 +221,7 @@ public class BindingAdapters {
|
||||
if (gameEntity.getApk().size() == 1) {
|
||||
//启动模拟器游戏
|
||||
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
|
||||
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().get(0).getUrl());
|
||||
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().isEmpty() ? "" : gameEntity.getApk().get(0).getUrl());
|
||||
if (downloadEntity != null) {
|
||||
File file = new File(downloadEntity.getPath());
|
||||
if (!file.exists()) {
|
||||
@ -460,9 +459,9 @@ public class BindingAdapters {
|
||||
ToastUtils.toast(context.getString(R.string.unsupported_browser_install_hint));
|
||||
}
|
||||
String buttonText = progressBar.getText();
|
||||
ApkEntity apkEntity = gameEntity.getApk().get(0);
|
||||
String msg = FileUtils.isCanDownload(progressBar.getContext(), apkEntity.getSize());
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
ApkEntity apkEntity = CollectionsKt.firstOrNull(gameEntity.getApk());
|
||||
String msg = FileUtils.isCanDownload(progressBar.getContext(), apkEntity == null ? "" : apkEntity.getSize());
|
||||
if (apkEntity != null && TextUtils.isEmpty(msg)) {
|
||||
DownloadManager.createDownload(progressBar.getContext(),
|
||||
apkEntity,
|
||||
gameEntity,
|
||||
@ -550,11 +549,10 @@ public class BindingAdapters {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setGameName(TextView view, GameEntity game, boolean isShowPlatform, @Nullable Boolean isShowSuffix) {
|
||||
if (isShowSuffix == null) isShowSuffix = true; // 默认显示
|
||||
public static void setGameName(TextView view, GameEntity game, boolean isShowPlatform) {
|
||||
String gameName;
|
||||
if (isShowPlatform && game.getApk().size() > 0) {
|
||||
gameName = String.format("%s - %s", !isShowSuffix ? game.getNameWithoutSuffix() : game.getName(),
|
||||
gameName = String.format("%s - %s", game.getName(),
|
||||
PlatformUtils.getInstance(view.getContext()).getPlatformName(
|
||||
game.getApk().get(0).getPlatform()));
|
||||
if (!gameName.equals((String) view.getTag(R.string.tag_game_name_id))) {
|
||||
@ -562,7 +560,7 @@ public class BindingAdapters {
|
||||
view.setTag(R.string.tag_game_name_id, gameName);
|
||||
}
|
||||
} else {
|
||||
gameName = !isShowSuffix ? game.getNameWithoutSuffix() : game.getName();
|
||||
gameName = game.getName();
|
||||
if (gameName != null && !gameName.equals((String) view.getTag(R.string.tag_game_name_id))) {
|
||||
view.setText(gameName);
|
||||
view.setTag(R.string.tag_game_name_id, gameName);
|
||||
|
||||
@ -1,220 +0,0 @@
|
||||
package com.gh.common.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.CheckBox
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.gamecenter.common.avoidcallback.AvoidOnResultManager
|
||||
import com.gh.gamecenter.common.avoidcallback.Callback
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.ShellActivity
|
||||
import com.gh.gamecenter.common.callback.ConfirmListener
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.core.utils.GsonUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.feature.entity.AuthDialogEntity
|
||||
import com.gh.gamecenter.feature.entity.AuthDialogLevel
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.halo.assistant.fragment.user.UserInfoEditFragment
|
||||
import com.lightgame.utils.AppManager
|
||||
|
||||
class CertificationDialog(
|
||||
context: Context,
|
||||
private val authDialogEntity: AuthDialogEntity,
|
||||
val gameEntity: GameEntity,
|
||||
val listener: ConfirmListener
|
||||
) :
|
||||
Dialog(context, R.style.GhAlertDialog) {
|
||||
|
||||
private lateinit var view: View
|
||||
private lateinit var detailedDesTv: TextView
|
||||
private lateinit var noRemindAgainCb: CheckBox
|
||||
private lateinit var actionLeftTv: TextView
|
||||
private lateinit var actionRightTv: TextView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
view = LayoutInflater.from(context).inflate(R.layout.dialog_sertification, null)
|
||||
setContentView(view)
|
||||
detailedDesTv = view.findViewById(R.id.detailedDesTv)
|
||||
noRemindAgainCb = view.findViewById(R.id.noRemindAgainCb)
|
||||
actionLeftTv = view.findViewById(R.id.actionLeftTv)
|
||||
actionRightTv = view.findViewById(R.id.actionRightTv)
|
||||
|
||||
detailedDesTv.paint.flags = Paint.UNDERLINE_TEXT_FLAG
|
||||
detailedDesTv.paint.isAntiAlias = true
|
||||
|
||||
detailedDesTv.setOnClickListener {
|
||||
DirectUtils.directToWebView(context, authDialogEntity.link)
|
||||
}
|
||||
|
||||
when (authDialogEntity.level) {
|
||||
AuthDialogLevel.MUST_PASS.value -> {
|
||||
actionLeftTv.text = "暂不下载"
|
||||
actionRightTv.text = "去实名认证"
|
||||
noRemindAgainCb.visibility = View.GONE
|
||||
actionLeftTv.setOnClickListener {
|
||||
SensorsBridge.trackVerificationPopupClick(actionLeftTv.text.toString())
|
||||
dismiss()
|
||||
}
|
||||
actionRightTv.setOnClickListener {
|
||||
SensorsBridge.trackVerificationPopupClick(actionRightTv.text.toString())
|
||||
if (UserManager.getInstance().isLoggedIn) {
|
||||
gotoAuthPage()
|
||||
} else {
|
||||
gotoLoginPage()
|
||||
}
|
||||
}
|
||||
}
|
||||
AuthDialogLevel.ALWAYS_HINT.value -> {
|
||||
actionLeftTv.text = "去实名认证"
|
||||
actionRightTv.text = "继续下载"
|
||||
noRemindAgainCb.visibility = View.GONE
|
||||
actionLeftTv.setOnClickListener {
|
||||
SensorsBridge.trackVerificationPopupClick(actionLeftTv.text.toString())
|
||||
if (UserManager.getInstance().isLoggedIn) {
|
||||
gotoAuthPage()
|
||||
} else {
|
||||
gotoLoginPage()
|
||||
}
|
||||
}
|
||||
actionRightTv.setOnClickListener {
|
||||
SensorsBridge.trackVerificationPopupClick(actionRightTv.text.toString())
|
||||
listener.onConfirm()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
AuthDialogLevel.OPTIONAL_HINT.value -> {
|
||||
actionLeftTv.text = "去实名认证"
|
||||
actionRightTv.text = "继续下载"
|
||||
noRemindAgainCb.visibility = View.VISIBLE
|
||||
actionLeftTv.setOnClickListener {
|
||||
SensorsBridge.trackVerificationPopupClick(actionLeftTv.text.toString())
|
||||
if (noRemindAgainCb.isChecked) {
|
||||
SPUtils.setBoolean(gameEntity.id, true)
|
||||
}
|
||||
if (UserManager.getInstance().isLoggedIn) {
|
||||
gotoAuthPage()
|
||||
} else {
|
||||
gotoLoginPage()
|
||||
}
|
||||
}
|
||||
actionRightTv.setOnClickListener {
|
||||
SensorsBridge.trackVerificationPopupClick(actionRightTv.text.toString())
|
||||
if (noRemindAgainCb.isChecked) {
|
||||
SPUtils.getBoolean(gameEntity.id, true)
|
||||
}
|
||||
listener.onConfirm()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SensorsBridge.trackVerificationDialogShow(
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "",
|
||||
gameType = gameEntity.categoryChinese,
|
||||
articleType = "",
|
||||
verificationType = "游戏实名"
|
||||
)
|
||||
}
|
||||
|
||||
//跳转登录页面
|
||||
private fun gotoLoginPage() {
|
||||
val currentActivity = AppManager.getInstance().currentActivity() ?: return
|
||||
|
||||
CheckLoginUtils.checkLogin(
|
||||
currentActivity as AppCompatActivity,
|
||||
null, true, "实名认证弹窗"
|
||||
) {
|
||||
if (UserManager.getInstance().isAuth) {
|
||||
listener.onConfirm()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//跳转实名认证页面
|
||||
private fun gotoAuthPage() {
|
||||
val currentActivity = AppManager.getInstance().currentActivity() ?: return
|
||||
|
||||
AvoidOnResultManager.getInstance(currentActivity as AppCompatActivity)
|
||||
.startForResult(
|
||||
ShellActivity.getIntent(
|
||||
context,
|
||||
ShellActivity.Type.REAL_NAME_INFO,
|
||||
).apply {
|
||||
putExtra(EntranceConsts.KEY_SOURCE_ENTRANCE, "游戏实名")
|
||||
putExtra(EntranceConsts.KEY_GAME_ID, gameEntity.id)
|
||||
}, object : Callback {
|
||||
override fun onActivityResult(resultCode: Int, data: Intent?) {
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
val isAuthSuccess =
|
||||
data.getBooleanExtra(UserInfoEditFragment.AUTH_SUCCESS, false)
|
||||
if (isAuthSuccess) {
|
||||
listener.onConfirm()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun showCertificationDialog(context: Context, game: GameEntity, listener: ConfirmListener) {
|
||||
//1.先判断是否登录 是执行2 否执行3
|
||||
//2.判断是否实名认证 是终止 否执行3
|
||||
//3.判断是否需要弹出认证弹窗接口
|
||||
if (UserManager.getInstance().isLoggedIn) {
|
||||
if (UserManager.getInstance().isAuth) {//已实名认证
|
||||
listener.onConfirm()
|
||||
} else {
|
||||
authDialog(context, game, listener)
|
||||
}
|
||||
} else {
|
||||
authDialog(context, game, listener)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun authDialog(context: Context, game: GameEntity, listener: ConfirmListener) {
|
||||
var authDialog: AuthDialogEntity? = null
|
||||
if (game.authDialog != null) {
|
||||
authDialog = game.authDialog
|
||||
}
|
||||
if (authDialog == null) {
|
||||
val datas = SPUtils.getString(Constants.SP_AUTH_DIALOG)
|
||||
val type = object : TypeToken<List<AuthDialogEntity>>() {}.type
|
||||
val authDialogs = GsonUtils.gson.fromJson<List<AuthDialogEntity>>(datas, type)
|
||||
if (!authDialogs.isNullOrEmpty()) {
|
||||
authDialog = authDialogs.find { it.gameCategory == game.category }
|
||||
}
|
||||
}
|
||||
val isCloseAuthDialog = SPUtils.getBoolean(game.id, false)
|
||||
if (authDialog != null && (authDialog.level != AuthDialogLevel.OPTIONAL_HINT.value || !isCloseAuthDialog)) {
|
||||
val dialog = CertificationDialog(context, authDialog, game, listener)
|
||||
dialog.show()
|
||||
} else {
|
||||
listener.onConfirm()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.gh.common.dialog
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.provider.Settings
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.gamecenter.common.databinding.DialogAlertDefaultBinding
|
||||
import com.lightgame.dialog.BaseDialogFragment
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
class ManagerAllFilesPermissionDialogFragment : BaseDialogFragment() {
|
||||
private val mBinding by lazy { DialogAlertDefaultBinding.inflate(layoutInflater) }
|
||||
private var mCallBack: (() -> Unit)? = null
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
return mBinding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mBinding.run {
|
||||
titleTv.text = "请求权限"
|
||||
titleTv.gravity = Gravity.CENTER
|
||||
contentTv.text = "需要所有文件访问权限,请打开权限设置页面"
|
||||
|
||||
confirmTv.setOnClickListener {
|
||||
val intent = Intent().apply {
|
||||
action = Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
|
||||
data = Uri.fromParts("package", requireContext().packageName, null)
|
||||
}
|
||||
requireActivity().startActivityForResult(intent, REQUEST_CODE)
|
||||
}
|
||||
cancelTv.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == REQUEST_CODE && Environment.isExternalStorageManager()) {
|
||||
mCallBack?.invoke()
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val REQUEST_CODE = 1000
|
||||
|
||||
@JvmStatic
|
||||
fun show(activity: AppCompatActivity, callback: () -> Unit) {
|
||||
ManagerAllFilesPermissionDialogFragment().apply {
|
||||
mCallBack = callback
|
||||
}.show(
|
||||
activity.supportFragmentManager,
|
||||
ManagerAllFilesPermissionDialogFragment::class.java.name
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -29,6 +29,15 @@ class PrivacyPolicyDialogFragment : BaseDialogFragment() {
|
||||
private var mCallBack: ((isSuccess: Boolean) -> Unit)? = null
|
||||
private val mBinding by lazy { DialogPrivacyProtocolBinding.inflate(layoutInflater) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
dismiss()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
|
||||
@ -24,6 +24,15 @@ class ReserveDialog : BaseDialogFragment() {
|
||||
private lateinit var mReserveList: List<SimpleGameEntity>
|
||||
private var mDismissListener: (() -> Unit)? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
dismiss()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
val binding: DialogReserveBinding = DialogReserveBinding.inflate(layoutInflater, null, false)
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ object ExposureUtils {
|
||||
): ExposureEvent {
|
||||
val gameEntity = entity.copy()
|
||||
gameEntity.id = if (entity.id.contains(DownloadEntity.GAME_ID_DIVIDER)) {
|
||||
entity.id.split(DownloadEntity.GAME_ID_DIVIDER).toTypedArray()[0]
|
||||
entity.id.split(DownloadEntity.GAME_ID_DIVIDER).toTypedArray().firstOrNull() ?: ""
|
||||
} else {
|
||||
entity.id
|
||||
}
|
||||
|
||||
@ -71,7 +71,6 @@ object HistoryHelper {
|
||||
historyGame.iconFloat = gameEntity.iconFloat
|
||||
historyGame.name = gameEntity.name
|
||||
historyGame.tagStyle = gameEntity.tagStyle
|
||||
historyGame.tag = gameEntity.getTag()
|
||||
historyGame.subtitle = gameEntity.subtitle
|
||||
historyGame.subtitleStyle = gameEntity.subtitleStyle
|
||||
return historyGame
|
||||
|
||||
10
app/src/main/java/com/gh/common/iinterface/IMultiTab.kt
Normal file
10
app/src/main/java/com/gh/common/iinterface/IMultiTab.kt
Normal file
@ -0,0 +1,10 @@
|
||||
package com.gh.common.iinterface
|
||||
|
||||
import com.gh.gamecenter.entity.MultiTabNav
|
||||
|
||||
interface IMultiTab {
|
||||
fun provideMultiTabId(): String
|
||||
fun provideMultiTabName(): String
|
||||
fun provideCurrentTabEntity(): MultiTabNav.LinkMultiTabNav?
|
||||
fun provideLastSelectedPosition(): Int
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.gh.common.iinterface
|
||||
|
||||
import com.gh.gamecenter.entity.BottomTab
|
||||
|
||||
interface ISearchToolbarTab {
|
||||
fun onScrollChanged(totalHeight: Int, offset: Int, isDarkModeChanged: Boolean)
|
||||
fun changeAppBarColor(color: Int, pageId: String)
|
||||
fun setSearchStyle(searchStyle: BottomTab.SearchStyle)
|
||||
fun getCurrentTabIndex(): Int?
|
||||
}
|
||||
12
app/src/main/java/com/gh/common/iinterface/ISmartRefresh.kt
Normal file
12
app/src/main/java/com/gh/common/iinterface/ISmartRefresh.kt
Normal file
@ -0,0 +1,12 @@
|
||||
package com.gh.common.iinterface
|
||||
|
||||
import com.gh.common.prioritychain.PullDownPushHandler
|
||||
import com.gh.gamecenter.entity.PullDownPush
|
||||
|
||||
interface ISmartRefresh {
|
||||
fun setSmartRefreshEnabled(isEnable: Boolean)
|
||||
fun finishTwoLevel(action: String)
|
||||
fun finishRefresh()
|
||||
fun popupPullDownPush(finishCallback: () -> Unit)
|
||||
fun setPullDownPush(pullDownPush: PullDownPush?, pullDownPushHandler: PullDownPushHandler?)
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.gh.common.iinterface
|
||||
|
||||
interface ISmartRefreshContent {
|
||||
/**
|
||||
* 启用/关闭 页面滑动
|
||||
* @param isScrollEnabled 是否启用
|
||||
*/
|
||||
fun setScrollEnabled(isScrollEnabled: Boolean)
|
||||
|
||||
fun onRefresh()
|
||||
|
||||
/**
|
||||
* 启用/关闭 SwipeRefreshLayout 的下拉刷新
|
||||
* @param isSwipeRefreshEnabled 是否启用
|
||||
*/
|
||||
fun setSwipeRefreshEnabled(isSwipeRefreshEnabled: Boolean)
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.gh.common.iinterface
|
||||
|
||||
import com.gh.common.prioritychain.PriorityChain
|
||||
|
||||
interface ISuperiorChain {
|
||||
fun registerInferiorChain(chain: PriorityChain)
|
||||
|
||||
fun unregisterInferiorChain(chain: PriorityChain)
|
||||
}
|
||||
@ -14,7 +14,7 @@ import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.databinding.PopupAccelerateNotificationBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.fragment.MainWrapperViewModel
|
||||
import com.gh.gamecenter.wrapper.MainWrapperViewModel
|
||||
|
||||
class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
@ -42,7 +42,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
||||
processNext()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
process()
|
||||
}
|
||||
} else {
|
||||
if (gameEntityList == null) {
|
||||
@ -53,7 +53,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
override fun onProcess() : Boolean {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
val accelerateSet =
|
||||
@ -64,6 +64,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
||||
}
|
||||
accelerateSet.add(mGameList!![0].messageId)
|
||||
SPUtils.setStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET, accelerateSet)
|
||||
return true
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
@ -73,6 +74,8 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.gh.gamecenter.floatingwindow.FloatingWindowEntity
|
||||
import com.gh.gamecenter.livedata.Event
|
||||
|
||||
class CustomFloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private val data = arrayListOf<FloatingWindowEntity>()
|
||||
|
||||
private val _showFloatingAction = MutableLiveData<Event<ArrayList<FloatingWindowEntity>>>()
|
||||
val showFloatingAction: LiveData<Event<ArrayList<FloatingWindowEntity>>> = _showFloatingAction
|
||||
|
||||
fun setData(newData: List<FloatingWindowEntity>) {
|
||||
data.clear()
|
||||
data.addAll(newData)
|
||||
doPreProcess()
|
||||
}
|
||||
|
||||
private fun doPreProcess() {
|
||||
// debugOnly {
|
||||
// data.clear()
|
||||
// data.add(
|
||||
// FloatingWindowEntity(
|
||||
// id = "audire",
|
||||
// image = "https://jira.shanqu.cc/secure/attachment/57822/57822_image-2023-12-01-17-53-04-492.png",
|
||||
// link = WelcomeDialogEntity(
|
||||
// id = null,
|
||||
// time = null,
|
||||
// packages = null,
|
||||
// floatingWindowId = null,
|
||||
// shouldShowExitAnimation = false
|
||||
// ),
|
||||
// pushType = "maiorum",
|
||||
// expandable = false,
|
||||
// expandedImage = "fermentum",
|
||||
// bigPopupNotice = "dignissim"
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (data.isNotEmpty()) {
|
||||
updateStatus(STATUS_VALID)
|
||||
process()
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
} else {
|
||||
if (data.isNotEmpty()) {
|
||||
updateStatus(STATUS_VALID)
|
||||
} else {
|
||||
updateStatus(STATUS_INVALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess(): Boolean {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
_showFloatingAction.value = Event(data)
|
||||
processNext()
|
||||
// floatingWindowProvider.showFloatingWindowOnly(
|
||||
// mFragment!!,
|
||||
// mRecyclerView!!,
|
||||
// mWindowList!!,
|
||||
// ) {
|
||||
// val welcomeDialog = WelcomeDialogFragment.getInstance(it, true, mFragment)
|
||||
// welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
|
||||
// }
|
||||
}
|
||||
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -42,7 +42,7 @@ class FloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (!mWindowList.isNullOrEmpty()) {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
process()
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
@ -55,7 +55,7 @@ class FloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
override fun onProcess(): Boolean {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
val floatingWindowProvider =
|
||||
@ -65,7 +65,7 @@ class FloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
// 强校验所有条件均通过才能显示
|
||||
if (floatingWindowProvider == null || mFragment == null || mFragment?.isAdded == false || mRecyclerView == null) {
|
||||
processNext()
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
floatingWindowProvider.showFloatingWindowOnly(
|
||||
@ -82,6 +82,8 @@ class FloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,244 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.Application.ActivityLifecycleCallbacks
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.gh.common.iinterface.ISuperiorChain
|
||||
import com.gh.common.util.CheckLoginUtils
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.gamecenter.SplashScreenActivity
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.entity.SimpleGameEntity
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.entity.DialogEntity
|
||||
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
/**
|
||||
* 全局的 APP 优先级弹窗链管理器
|
||||
*
|
||||
* 弹窗的优先级为
|
||||
* 启动跳转(-101) > 更新弹窗(-100) > 隐私政策弹窗(-99) > 消息通知权限弹窗(0) > 预约弹窗(1) > 启动弹窗(2)
|
||||
*/
|
||||
object GlobalPriorityChainHelper : ISuperiorChain {
|
||||
|
||||
private val api = RetrofitManager.getInstance().api
|
||||
private var inferiorChain: PriorityChain? = null
|
||||
private val mainChain: PriorityChain by lazy { PriorityChain { inferiorChain?.start() } }
|
||||
|
||||
/**
|
||||
* 当前 activity 是否使用于应用全局弹窗的弹出
|
||||
* 排除启动页和其它非 FragmentActivity
|
||||
*/
|
||||
fun isThisActivityValid(activity: Activity?): Boolean {
|
||||
return activity is FragmentActivity
|
||||
&& !activity.isFinishing
|
||||
&& activity !is SplashScreenActivity
|
||||
}
|
||||
|
||||
/**
|
||||
* 预启动所有的优先级弹窗管理链
|
||||
*/
|
||||
fun preStart() {
|
||||
val launchRedirectHandler = LaunchRedirectHandler(-101)
|
||||
val updateDialogHandler = UpdateDialogHandler(-100)
|
||||
val privacyPolicyDialogHandler = PrivacyPolicyDialogHandler(-99)
|
||||
val notificationPermissionDialogHandler = NotificationPermissionDialogHandler(0)
|
||||
val reserveDialogHandler = ReserveDialogHandler(1)
|
||||
val welcomeDialogHandler = WelcomeDialogHandler(2)
|
||||
|
||||
mainChain.addHandler(launchRedirectHandler)
|
||||
mainChain.addHandler(updateDialogHandler)
|
||||
mainChain.addHandler(privacyPolicyDialogHandler)
|
||||
mainChain.addHandler(welcomeDialogHandler)
|
||||
mainChain.addHandler(reserveDialogHandler)
|
||||
mainChain.addHandler(notificationPermissionDialogHandler)
|
||||
|
||||
launchRedirectHandler.doPreProcess()
|
||||
updateDialogHandler.doPreProcess()
|
||||
requestOpeningDialogData(welcomeDialogHandler, privacyPolicyDialogHandler)
|
||||
requestReserveDialogData(reserveDialogHandler)
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动优先级弹窗管理链的执行
|
||||
*/
|
||||
fun start() {
|
||||
if (mainChain.isHandlerQueueEmpty()) return
|
||||
|
||||
mainChain.start()
|
||||
|
||||
observeLifecycle()
|
||||
}
|
||||
|
||||
private fun observeLifecycle() {
|
||||
HaloApp.getInstance().registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
|
||||
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun onActivityStarted(activity: Activity) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun onActivityResumed(activity: Activity) {
|
||||
// 优先级弹窗管理链为空时取消注册,避免无用调用
|
||||
if (mainChain.isHandlerQueueEmpty()) {
|
||||
HaloApp.getInstance().unregisterActivityLifecycleCallbacks(this)
|
||||
} else {
|
||||
resume()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityPaused(activity: Activity) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun onActivityStopped(activity: Activity) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
override fun onActivityDestroyed(activity: Activity) {
|
||||
// do nothing
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复链的处理
|
||||
*/
|
||||
fun resume() {
|
||||
mainChain.resume()
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求首页启动弹窗相关的数据并执行相关 handler 的 preProcess
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private fun requestOpeningDialogData(
|
||||
welcomeDialogHandler: WelcomeDialogHandler,
|
||||
privacyPolicyDialogHandler: PrivacyPolicyDialogHandler
|
||||
) {
|
||||
val sp = PreferenceManager.getDefaultSharedPreferences(HaloApp.getInstance())
|
||||
|
||||
val lastId = SPUtils.getString(sp, Constants.SP_LAST_OPENING_ID, "")
|
||||
val lastTime = SPUtils.getLong(sp, Constants.SP_LAST_OPENING_TIME, 0)
|
||||
val openType = if (HaloApp.getInstance().isNewForThisVersion) "first" else "not_first_time"
|
||||
|
||||
api.getOpeningDialog(HaloApp.getInstance().channel, lastId, lastTime, openType)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : BiResponse<DialogEntity>() {
|
||||
override fun onSuccess(data: DialogEntity) {
|
||||
var welcomeDialogEntity: WelcomeDialogEntity? = null
|
||||
var privacyPolicyDialogEntity: DialogEntity.PrivacyPolicyEntity? = null
|
||||
|
||||
// 全新安装忽略隐私弹窗
|
||||
if (data.privacyPolicyDialog != null) {
|
||||
val id = data.privacyPolicyDialog.id
|
||||
val lastAcceptedId = SPUtils.getString(Constants.SP_LAST_ACCEPTED_PRIVACY_DIALOG_ID, "")
|
||||
if (HaloApp.getInstance().isBrandNewInstall) {
|
||||
SPUtils.setString(Constants.SP_LAST_ACCEPTED_PRIVACY_DIALOG_ID, id)
|
||||
} else {
|
||||
if (id != lastAcceptedId) {
|
||||
privacyPolicyDialogEntity = data.privacyPolicyDialog
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// debugOnly {
|
||||
// privacyPolicyDialogEntity = DialogEntity.PrivacyPolicyEntity(
|
||||
// "5f6f5f3d9d9b4e0001c3b3a5",
|
||||
// "privacy_policy",
|
||||
// "ONCE",
|
||||
// "INFORM",
|
||||
// "隐私政策",
|
||||
// 1601116800000)
|
||||
// }
|
||||
|
||||
privacyPolicyDialogHandler.doPreProcess(privacyPolicyDialogEntity)
|
||||
|
||||
// 类型为游戏时判断是否本地已安装该游戏,已安装不弹弹窗
|
||||
if (data.welcomeDialog != null) {
|
||||
welcomeDialogEntity = data.welcomeDialog
|
||||
|
||||
if (data.welcomeDialog.type == "game") {
|
||||
if (data.welcomeDialog.packages != null) {
|
||||
for (packageName in data.welcomeDialog.packages!!) {
|
||||
if (PackageUtils.isInstalled(HaloApp.getInstance(), packageName)) {
|
||||
welcomeDialogEntity = null
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
welcomeDialogHandler.doPreProcess(welcomeDialogEntity)
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
privacyPolicyDialogHandler.doPreProcess(null)
|
||||
welcomeDialogHandler.doPreProcess(null)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求预约弹窗相关的数据
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private fun requestReserveDialogData(reserveDialogHandler: ReserveDialogHandler) {
|
||||
// debugOnly {
|
||||
// reserveDialogHandler.doPreProcess(arrayListOf(SimpleGameEntity(
|
||||
// "5f6f5f3d9d9b4e0001c3b3a5",
|
||||
// "5f6f5f3d9d9b4e0001c3b3a5",
|
||||
// "https://and-static.ghzs.com/image/game/icon/2022/11/18/63772b0d398daaa7c5067298.png",
|
||||
// "5f6f5f3d9d9b4e0001c3b3a5",
|
||||
// )))
|
||||
// return
|
||||
// }
|
||||
|
||||
if (CheckLoginUtils.isLogin()) {
|
||||
api.getReserveDialog(UserManager.getInstance().userId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<List<SimpleGameEntity>>() {
|
||||
override fun onSuccess(data: List<SimpleGameEntity>) {
|
||||
reserveDialogHandler.doPreProcess(data)
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
reserveDialogHandler.doPreProcess(null)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
reserveDialogHandler.doPreProcess(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun registerInferiorChain(chain: PriorityChain) {
|
||||
inferiorChain = chain
|
||||
if (mainChain.isHandlerQueueEmpty()) {
|
||||
inferiorChain?.resume()
|
||||
}
|
||||
}
|
||||
|
||||
override fun unregisterInferiorChain(chain: PriorityChain) {
|
||||
if (inferiorChain == chain) {
|
||||
inferiorChain = null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import com.gh.gamecenter.fragment.HomeSearchToolWrapperFragment
|
||||
|
||||
class HomePushHandler(priority: Int): PriorityChainHandler(priority) {
|
||||
|
||||
private var mHomeFragment: HomeSearchToolWrapperFragment? = null
|
||||
|
||||
/**
|
||||
* 提前预处理显示弹窗的内容
|
||||
*/
|
||||
fun doPreProcess(homeFragment: HomeSearchToolWrapperFragment?, shouldShow: Boolean) {
|
||||
mHomeFragment = homeFragment
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (shouldShow && homeFragment != null) {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
} else {
|
||||
if (shouldShow && homeFragment != null) {
|
||||
updateStatus(STATUS_VALID)
|
||||
} else {
|
||||
updateStatus(STATUS_INVALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
// 目前首页下拉二楼是首页最后一个弹窗类的东西,还没实现回调,如果有其它要在它后面弹出的,需要自行在它的实现结果后添加回调
|
||||
mHomeFragment?.popUpHomePushIfNeeded {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.entity.LaunchRedirect
|
||||
import com.gh.gamecenter.common.entity.LaunchRedirectWrapper
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.utils.singleToMain
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.wrapper.MainWrapperRepository
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
/**
|
||||
* 初次启动跳转
|
||||
*/
|
||||
class LaunchRedirectHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private var launchData: LaunchRedirect? = null
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun doPreProcess() {
|
||||
// if (true) {
|
||||
if (HaloApp.getInstance().isBrandNewInstall) {
|
||||
RetrofitManager.getInstance().newApi
|
||||
.getLaunchRedirect(BuildConfig.VERSION_NAME, HaloApp.getInstance().channel)
|
||||
.compose(singleToMain())
|
||||
.subscribe(object : BiResponse<LaunchRedirectWrapper>() {
|
||||
override fun onSuccess(data: LaunchRedirectWrapper) {
|
||||
launchData = data.launchRedirect
|
||||
|
||||
if (launchData == null) {
|
||||
updateStatus(STATUS_INVALID)
|
||||
processNext()
|
||||
return
|
||||
}
|
||||
|
||||
// 尝试提前设置 tab default 避免首页数据加载完成,tab 选中会闪烁
|
||||
if (launchData?.type == "bottom_tab") {
|
||||
MainWrapperRepository.getInstance().sendSelectTabEvent(launchData!!)
|
||||
}
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
updateStatus(STATUS_VALID)
|
||||
process()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
updateStatus(STATUS_INVALID)
|
||||
processNext()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
updateStatus(STATUS_INVALID)
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess(): Boolean {
|
||||
val currentActivity = CurrentActivityHolder.getCurrentActivity()
|
||||
|
||||
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
|
||||
if (getStatus() == STATUS_VALID) {
|
||||
// 当 type 为 "bottom_tab" 时上面 doPreProcess 中已经处理过了,但再选中一次好像也没有什么问题,先不特殊处理这个 case 了
|
||||
DirectUtils.directToLinkPage(currentActivity!!, launchData!!, "首次启动跳转", "")
|
||||
// 跳转页面不管回调,延迟 500ms 后执行下一个 handler
|
||||
AppExecutor.uiExecutor.executeWithDelay({
|
||||
processNext()
|
||||
}, 500L)
|
||||
|
||||
return true
|
||||
} else if (getStatus() == STATUS_INVALID) {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,15 +6,18 @@ import com.gh.gamecenter.login.user.UserManager
|
||||
|
||||
class NotificationPermissionDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
override fun onProcess() {
|
||||
override fun onProcess(): Boolean {
|
||||
// 仅登录后再启动光环时请求一次权限
|
||||
if (UserManager.getInstance().isLoggedIn) {
|
||||
NotificationHelper.showNotificationHintDialog(NotificationUgc.LOGIN) {
|
||||
processNext()
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,22 +1,54 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import com.lightgame.utils.Utils
|
||||
import java.util.*
|
||||
import java.util.concurrent.PriorityBlockingQueue
|
||||
|
||||
class PriorityChain {
|
||||
class PriorityChain(private val completeCallback: (() -> Unit)? = null) {
|
||||
|
||||
private val mHandlerQueue: Queue<PriorityChainHandler> = PriorityBlockingQueue()
|
||||
private val handlerQueue: Queue<PriorityChainHandler> = PriorityBlockingQueue()
|
||||
|
||||
/**
|
||||
* 添加 handler 到队列中
|
||||
*/
|
||||
fun addHandler(handler: PriorityChainHandler) {
|
||||
mHandlerQueue.add(handler.also {
|
||||
handlerQueue.add(handler.also {
|
||||
it.setPriorityChain(this)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动队列中的 handler
|
||||
*/
|
||||
fun start() {
|
||||
mHandlerQueue.poll()?.process(mHandlerQueue)
|
||||
handlerQueue.peek()?.let {
|
||||
it.injectQueue(handlerQueue)
|
||||
it.process()
|
||||
}
|
||||
}
|
||||
|
||||
fun isHandlerQueueEmpty() = mHandlerQueue.isEmpty()
|
||||
/**
|
||||
* 恢复队列中的 handler
|
||||
*/
|
||||
fun resume() {
|
||||
val handler = handlerQueue.peek()
|
||||
|
||||
if (handler?.getStatus() == PriorityChainHandler.STATUS_HANDLING) {
|
||||
Utils.log(PriorityChainHandler.TAG, "${handler.javaClass.simpleName} 处于执行中状态,不用恢复")
|
||||
} else {
|
||||
handler?.injectQueue(handlerQueue)
|
||||
handler?.process()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 队列是否为空
|
||||
*/
|
||||
fun isHandlerQueueEmpty() = handlerQueue.isEmpty()
|
||||
|
||||
|
||||
fun onHandleComplete() {
|
||||
completeCallback?.invoke()
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,54 +5,76 @@ import java.util.*
|
||||
|
||||
abstract class PriorityChainHandler(private val mPriority: Int) : Comparable<PriorityChainHandler> {
|
||||
|
||||
private var mStatus = STATUS_UNKNOWN
|
||||
private var mQueue: Queue<PriorityChainHandler>? = null
|
||||
private var status = STATUS_UNKNOWN
|
||||
private var queue: Queue<PriorityChainHandler>? = null
|
||||
|
||||
private var mPriorityChain: PriorityChain? = null
|
||||
private var priorityChain: PriorityChain? = null
|
||||
|
||||
/**
|
||||
* 获取当前 handler 的状态
|
||||
* - 等待结果返回 (STATUS_PENDING)
|
||||
* - 无需执行 (STATUS_INVALID)
|
||||
* - 可执行 (STATUS_VALID)
|
||||
* - 执行中 (STATUS_HANDLING)
|
||||
* - 未知 (STATUS_UNKNOWN)
|
||||
*/
|
||||
fun getStatus(): Int = mStatus
|
||||
fun getStatus(): Int = status
|
||||
|
||||
fun updateStatus(status: Int) {
|
||||
Utils.log(TAG, "${javaClass.simpleName} updateStatus $status")
|
||||
Utils.log(TAG, "${javaClass.simpleName} updateStatus ${this.status} $status")
|
||||
|
||||
mStatus = status
|
||||
this.status = status
|
||||
}
|
||||
|
||||
fun setPriorityChain(priorityChain: PriorityChain) {
|
||||
mPriorityChain = priorityChain
|
||||
this.priorityChain = priorityChain
|
||||
}
|
||||
|
||||
fun process(queue: Queue<PriorityChainHandler>) {
|
||||
Utils.log(TAG, "${javaClass.simpleName} process $mStatus")
|
||||
fun injectQueue(queue: Queue<PriorityChainHandler>) {
|
||||
this.queue = queue
|
||||
}
|
||||
|
||||
fun process() {
|
||||
Utils.log(TAG, "${javaClass.simpleName} process $status")
|
||||
|
||||
mQueue = queue
|
||||
// 若当前 handler 未经处理,将其状态改为 pending
|
||||
if (mStatus == STATUS_UNKNOWN) {
|
||||
if (status == STATUS_UNKNOWN) {
|
||||
updateStatus(STATUS_PENDING)
|
||||
}
|
||||
|
||||
onProcess()
|
||||
if (status == STATUS_HANDLING) {
|
||||
Utils.log(TAG, "${javaClass.simpleName} 已经处于执行中状态,不用再次执行")
|
||||
return
|
||||
}
|
||||
|
||||
val isHandling = onProcess()
|
||||
|
||||
if (isHandling) {
|
||||
updateStatus(STATUS_HANDLING)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行相关功能的地方
|
||||
* @return 是否满足执行条件并处于执行中状态
|
||||
*/
|
||||
abstract fun onProcess()
|
||||
abstract fun onProcess(): Boolean
|
||||
|
||||
/**
|
||||
* 分发给下一个 handler 处理
|
||||
*/
|
||||
fun processNext() {
|
||||
Utils.log(TAG, "${javaClass.simpleName} processNext $mStatus")
|
||||
Utils.log(TAG, "${javaClass.simpleName} processNext")
|
||||
|
||||
mQueue?.poll()?.process(mQueue!!)
|
||||
queue?.remove(this)
|
||||
if (queue?.isEmpty() == true) {
|
||||
priorityChain?.onHandleComplete()
|
||||
} else {
|
||||
queue?.peek()?.let {
|
||||
it.injectQueue(queue!!)
|
||||
it.process()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun compareTo(other: PriorityChainHandler): Int {
|
||||
@ -64,6 +86,7 @@ abstract class PriorityChainHandler(private val mPriority: Int) : Comparable<Pri
|
||||
internal const val STATUS_INVALID = 1
|
||||
internal const val STATUS_VALID = 2
|
||||
internal const val STATUS_UNKNOWN = 3
|
||||
internal const val STATUS_HANDLING = 4
|
||||
|
||||
const val TAG = "PriorityChainHandler"
|
||||
}
|
||||
|
||||
@ -2,18 +2,17 @@ package com.gh.common.prioritychain
|
||||
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.gh.common.dialog.PrivacyPolicyDialogFragment
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.entity.DialogEntity
|
||||
|
||||
class PrivacyPolicyDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private var mActivity: FragmentActivity? = null
|
||||
private var mPrivacyPolicyEntity: DialogEntity.PrivacyPolicyEntity? = null
|
||||
|
||||
/**
|
||||
* 提前预处理显示弹窗的内容
|
||||
*/
|
||||
fun doPreProcess(fragmentActivity: FragmentActivity, privacyPolicyEntity: DialogEntity.PrivacyPolicyEntity?) {
|
||||
mActivity = fragmentActivity
|
||||
fun doPreProcess(privacyPolicyEntity: DialogEntity.PrivacyPolicyEntity?) {
|
||||
mPrivacyPolicyEntity = privacyPolicyEntity
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
@ -21,7 +20,7 @@ class PrivacyPolicyDialogHandler(priority: Int) : PriorityChainHandler(priority)
|
||||
processNext()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
process()
|
||||
}
|
||||
} else {
|
||||
if (privacyPolicyEntity == null) {
|
||||
@ -32,17 +31,26 @@ class PrivacyPolicyDialogHandler(priority: Int) : PriorityChainHandler(priority)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when(getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
PrivacyPolicyDialogFragment.show(mActivity!!, mPrivacyPolicyEntity) { _: Boolean? ->
|
||||
override fun onProcess(): Boolean {
|
||||
val currentActivity = CurrentActivityHolder.getCurrentActivity()
|
||||
|
||||
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
PrivacyPolicyDialogFragment.show(currentActivity as FragmentActivity, mPrivacyPolicyEntity) { _: Boolean? ->
|
||||
processNext()
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import com.gh.common.iinterface.ISmartRefresh
|
||||
|
||||
class PullDownPushHandler(priority: Int): PriorityChainHandler(priority) {
|
||||
|
||||
private var mSmartRefreshFragment: ISmartRefresh? = null
|
||||
|
||||
/**
|
||||
* 提前预处理显示弹窗的内容
|
||||
*/
|
||||
fun doPreProcess(smartRefreshFragment: ISmartRefresh?, shouldShow: Boolean) {
|
||||
mSmartRefreshFragment = smartRefreshFragment
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (shouldShow && smartRefreshFragment != null) {
|
||||
updateStatus(STATUS_VALID)
|
||||
process()
|
||||
} else {
|
||||
processNext()
|
||||
}
|
||||
} else {
|
||||
if (shouldShow && smartRefreshFragment != null) {
|
||||
updateStatus(STATUS_VALID)
|
||||
} else {
|
||||
updateStatus(STATUS_INVALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess(): Boolean {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
mSmartRefreshFragment?.popupPullDownPush {
|
||||
processNext()
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,20 +1,18 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.gh.common.dialog.ReserveDialog
|
||||
import com.gh.gamecenter.common.entity.SimpleGameEntity
|
||||
import com.gh.gamecenter.message.MessageUnreadRepository
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
|
||||
class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private var mFragment: Fragment? = null
|
||||
private var mReserveData: List<SimpleGameEntity>? = null
|
||||
|
||||
/**
|
||||
* 提前预处理显示弹窗的内容
|
||||
*/
|
||||
fun doPreProcess(fragment: Fragment, reserveData: List<SimpleGameEntity>?) {
|
||||
mFragment = fragment
|
||||
fun doPreProcess(reserveData: List<SimpleGameEntity>?) {
|
||||
mReserveData = reserveData
|
||||
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
@ -22,7 +20,7 @@ class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
processNext()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
process()
|
||||
}
|
||||
} else {
|
||||
if (reserveData.isNullOrEmpty()) {
|
||||
@ -33,21 +31,28 @@ class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
val reserveDialog = ReserveDialog.getInstance(mReserveData!!)
|
||||
reserveDialog.setOnDismissListener {
|
||||
MessageUnreadRepository.loadMessageUnreadData()
|
||||
override fun onProcess(): Boolean {
|
||||
val currentActivity = CurrentActivityHolder.getCurrentActivity()
|
||||
|
||||
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
val reserveDialog = ReserveDialog.getInstance(mReserveData!!)
|
||||
reserveDialog.setOnDismissListener {
|
||||
processNext()
|
||||
}
|
||||
reserveDialog.show((currentActivity as FragmentActivity).supportFragmentManager, "reserveDialog")
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
reserveDialog.show(mFragment!!.childFragmentManager, "reserveDialog")
|
||||
}
|
||||
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,17 +1,47 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import android.content.Context
|
||||
import com.gh.gamecenter.manager.UpdateManager
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.update.UpdateHelper
|
||||
|
||||
class UpdateDialogHandler(context: Context, priority: Int) : PriorityChainHandler(priority) {
|
||||
class UpdateDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private val mUpdateManager = UpdateManager.getInstance(context)
|
||||
|
||||
override fun onProcess() {
|
||||
mUpdateManager.checkUpdate(true, null)
|
||||
mUpdateManager.setDismissCallback {
|
||||
processNext()
|
||||
fun doPreProcess() {
|
||||
UpdateHelper.getUpdate(false) {
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
if (UpdateHelper.isUpdateValid(false)) {
|
||||
updateStatus(STATUS_VALID)
|
||||
process()
|
||||
} else {
|
||||
updateStatus(STATUS_INVALID)
|
||||
processNext()
|
||||
}
|
||||
} else {
|
||||
if (UpdateHelper.isUpdateValid(false)) {
|
||||
updateStatus(STATUS_VALID)
|
||||
} else {
|
||||
updateStatus(STATUS_INVALID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess(): Boolean {
|
||||
val currentActivity = CurrentActivityHolder.getCurrentActivity()
|
||||
|
||||
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
|
||||
if (getStatus() == STATUS_VALID) {
|
||||
UpdateHelper.showUpdateDialog(currentActivity as FragmentActivity) {
|
||||
processNext()
|
||||
}
|
||||
|
||||
return true
|
||||
} else if (getStatus() == STATUS_INVALID) {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,32 +1,31 @@
|
||||
package com.gh.common.prioritychain
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.gh.gamecenter.common.callback.BiCallback
|
||||
import com.gh.gamecenter.common.utils.ImageUtils
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
|
||||
import com.gh.gamecenter.fragment.MainWrapperViewModel
|
||||
import com.gh.gamecenter.fragment.WelcomeDialogFragment
|
||||
import com.gh.gamecenter.wrapper.MainWrapperViewModel
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
class WelcomeDialogHandler(priority: Int): PriorityChainHandler(priority) {
|
||||
class WelcomeDialogHandler(priority: Int) : PriorityChainHandler(priority) {
|
||||
|
||||
private var mFragment: Fragment? = null
|
||||
private var mWelcomeDialogEntity: WelcomeDialogEntity? = null
|
||||
private var welcomeDialogEntity: WelcomeDialogEntity? = null
|
||||
|
||||
fun doPreProcess(fragment: Fragment, welcomeDialogEntity: WelcomeDialogEntity?) {
|
||||
mFragment = fragment
|
||||
mWelcomeDialogEntity = welcomeDialogEntity
|
||||
fun doPreProcess(welcomeDialogEntity: WelcomeDialogEntity?) {
|
||||
this.welcomeDialogEntity = welcomeDialogEntity
|
||||
|
||||
val preLoadClosure = {
|
||||
// 判断启动本次应用是否已经弹窗,不是的话弹启动弹窗
|
||||
if (HaloApp.get(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false) == null) {
|
||||
HaloApp.put(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false)
|
||||
ImageUtils.getBitmap(mWelcomeDialogEntity!!.icon, object : BiCallback<Bitmap, Boolean> {
|
||||
ImageUtils.getBitmap(this.welcomeDialogEntity!!.icon, object : BiCallback<Bitmap, Boolean> {
|
||||
override fun onFirst(first: Bitmap) {
|
||||
if (getStatus() == STATUS_PENDING) {
|
||||
updateStatus(STATUS_VALID)
|
||||
onProcess()
|
||||
process()
|
||||
} else {
|
||||
updateStatus(STATUS_VALID)
|
||||
}
|
||||
@ -56,24 +55,28 @@ class WelcomeDialogHandler(priority: Int): PriorityChainHandler(priority) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProcess() {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
if (mFragment == null || !mFragment!!.isAdded) {
|
||||
updateStatus(STATUS_INVALID)
|
||||
processNext()
|
||||
} else {
|
||||
val welcomeDialog = WelcomeDialogFragment.getInstance(mWelcomeDialogEntity)
|
||||
override fun onProcess(): Boolean {
|
||||
val currentActivity = CurrentActivityHolder.getCurrentActivity()
|
||||
|
||||
if (GlobalPriorityChainHelper.isThisActivityValid(currentActivity)) {
|
||||
when (getStatus()) {
|
||||
STATUS_VALID -> {
|
||||
val welcomeDialog = WelcomeDialogFragment.getInstance(welcomeDialogEntity)
|
||||
welcomeDialog.setOnDismissListener {
|
||||
processNext()
|
||||
}
|
||||
welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
|
||||
welcomeDialog.show((currentActivity as FragmentActivity).supportFragmentManager, "WelcomeDialog")
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
STATUS_INVALID -> {
|
||||
processNext()
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@ -16,9 +16,8 @@ class BindingAdaptersProviderImpl : IBindingAdaptersProvider {
|
||||
view: TextView,
|
||||
game: GameEntity,
|
||||
isShowPlatform: Boolean,
|
||||
isShowSuffix: Boolean
|
||||
) {
|
||||
BindingAdapters.setGameName(view, game, isShowPlatform, isShowSuffix)
|
||||
BindingAdapters.setGameName(view, game, isShowPlatform)
|
||||
}
|
||||
|
||||
override fun setGameTags(layout: LinearLayout, gameEntity: GameEntity) {
|
||||
|
||||
@ -100,10 +100,6 @@ class ConfigProviderImpl : IConfigProvider {
|
||||
return Config.getNightModeSetting()?.setting ?: false
|
||||
}
|
||||
|
||||
override fun isShowPlugin(gameId: String): Boolean {
|
||||
return Config.isShowPlugin(gameId)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.provider.IDownloadButtonClickedProvider
|
||||
@ -29,6 +30,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
var gameSchemaType = ""
|
||||
var packageName = ""
|
||||
var exposureSourceList: List<ExposureSource>? = null
|
||||
var customPageTrackData: CustomPageTrackData? = null
|
||||
|
||||
val boundedObject = downloadButton.getObject()
|
||||
|
||||
@ -55,6 +57,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
gameSchemaType = boundedObject.gameBitChinese
|
||||
packageName = boundedObject.getUniquePackageName() ?: ""
|
||||
exposureSourceList = boundedObject.exposureEvent?.source
|
||||
customPageTrackData = boundedObject.customPageTrackData
|
||||
}
|
||||
|
||||
is GameUpdateEntity -> {
|
||||
@ -80,11 +83,13 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
|
||||
// 上报 UI 状态为启动的点击事件 (样式为启动,或者文案包含启动都算能启动)
|
||||
if (downloadButton.buttonStyle == DownloadButton.ButtonStyle.LAUNCH_OR_OPEN
|
||||
|| downloadButton.text.contains("启动")) {
|
||||
|| downloadButton.text.contains("启动")
|
||||
) {
|
||||
|
||||
// boundedObject 里找不到游戏类型时,尝试从已安装列表中获取
|
||||
if (gameCategory.isEmpty() && packageName.isNotEmpty()) {
|
||||
gameCategory = PackageRepository.gameInstalled.find { it.packageName == packageName }?.category ?: ""
|
||||
gameCategory =
|
||||
PackageRepository.gameInstalled.find { it.packageName == packageName }?.category ?: ""
|
||||
}
|
||||
|
||||
NewFlatLogUtils.logGameLaunchButtonClicked(
|
||||
@ -98,7 +103,8 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
|
||||
// 预约状态不上报
|
||||
if (downloadButton.buttonStyle == DownloadButton.ButtonStyle.NORMAL
|
||||
|| downloadButton.buttonStyle == DownloadButton.ButtonStyle.PLUGIN) {
|
||||
|| downloadButton.buttonStyle == DownloadButton.ButtonStyle.PLUGIN
|
||||
) {
|
||||
|
||||
val text = downloadButton.text.ifEmpty {
|
||||
downloadButton.getTag(R.string.download) ?: ""
|
||||
@ -111,6 +117,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
}
|
||||
|
||||
// 上报神策点击事件
|
||||
val customPageKV = customPageTrackData?.toKV() ?: arrayOf()
|
||||
SensorsBridge.trackEventWithExposureSource(
|
||||
"DownLoadbuttonClick",
|
||||
exposureSourceList,
|
||||
@ -127,6 +134,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
"last_page_name", GlobalActivityManager.getLastPageEntity().pageName,
|
||||
"last_page_id", GlobalActivityManager.getLastPageEntity().pageId,
|
||||
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId,
|
||||
*customPageKV
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.GameSubstituteRepositoryHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IGameSubstituteRepositoryProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.gameSubstituteRepository, name = "GameSubstituteRepositoryHelper暴露服务")
|
||||
class GameSubstituteRepositoryProviderImpl : IGameSubstituteRepositoryProvider {
|
||||
|
||||
override fun updateHistoricInstalledGameSet() {
|
||||
GameSubstituteRepositoryHelper.updateHistoricInstalledGameSet()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,14 +2,15 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.MainActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IMainProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.mainActivity, name = "MainActivity暴露服务")
|
||||
class MainProviderImpl : IMainProvider {
|
||||
override fun skipToMainActivity(context: Context, position: Int) {
|
||||
MainActivity.skipToMainActivity(context, position)
|
||||
override fun skipToMainActivity(context: Context, type: String) {
|
||||
DirectUtils.directToHomeDefaultTab(context)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
@ -1,16 +1,30 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IUpdateManagerProvider
|
||||
import com.gh.gamecenter.manager.UpdateManager
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.update.UpdateHelper
|
||||
|
||||
@Route(path = RouteConsts.provider.updateManager, name = "UpdateManager暴露服务")
|
||||
class UpdateManagerProviderImpl: IUpdateManagerProvider {
|
||||
override fun checkUpdate(context: Context, isAutoCheck: Boolean, handler: Handler?) {
|
||||
UpdateManager.getInstance(context).checkUpdate(isAutoCheck, handler)
|
||||
override fun checkUpdate(activity: FragmentActivity, ignoreSuppressOption: Boolean) {
|
||||
val dialog = DialogUtils.showWaitDialog(activity, "检查更新中...")
|
||||
|
||||
UpdateHelper.getUpdate(ignoreSuppressOption) {
|
||||
dialog.dismiss()
|
||||
|
||||
if (UpdateHelper.isUpdateValid(ignoreSuppressOption)) {
|
||||
UpdateHelper.showUpdateDialog(activity) {
|
||||
// Do nothing
|
||||
}
|
||||
} else {
|
||||
ToastUtils.toast("您的光环助手已是最新版本")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
@ -20,15 +20,14 @@ import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.AppExecutor.uiExecutor
|
||||
import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.entity.TrackableEntity
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity
|
||||
import com.gh.gamecenter.feature.entity.SimulatorEntity
|
||||
import com.gh.gamecenter.entity.TrackableEntity
|
||||
import com.gh.ndownload.NDataChanger
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.DownloadStatus
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.Utils
|
||||
import java.lang.ref.WeakReference
|
||||
import java.text.DecimalFormat
|
||||
|
||||
@ -8,7 +8,6 @@ import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.common.util.LogUtils
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.download.DownloadManager
|
||||
@ -24,13 +23,13 @@ import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.SimulatorGameRecordEntity
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.room.AppDatabase
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DownloadDao
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.AppManager
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@ -39,7 +38,6 @@ import okhttp3.ResponseBody
|
||||
import org.json.JSONArray
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
object SimulatorGameManager {
|
||||
|
||||
@ -185,8 +183,8 @@ object SimulatorGameManager {
|
||||
val intent = Intent()
|
||||
intent.data = Uri.fromFile(File(downloadEntity.path))
|
||||
if (gameEntity.simulatorType == "FBA" || gameEntity.simulatorType == "FBN") {
|
||||
val apkEntity = gameEntity.getApk()[0]
|
||||
intent.putExtra("rom_name", apkEntity.packageName)
|
||||
val apkEntity = gameEntity.getApk().firstOrNull()
|
||||
intent.putExtra("rom_name", apkEntity?.packageName ?: "")
|
||||
}
|
||||
intent.putExtra("default_path", downloadEntity.path.substring(0, downloadEntity.path.lastIndexOf('/')))
|
||||
intent.putExtra("game_type", gameEntity.simulatorType)
|
||||
|
||||
@ -18,7 +18,6 @@ import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
@ -130,11 +129,6 @@ public class DataUtils {
|
||||
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
|
||||
});
|
||||
|
||||
// 避免重复调用
|
||||
if (!TextUtils.isEmpty(gid)) {
|
||||
GameSubstituteRepositoryHelper.updateHistoricInstalledGameSet();
|
||||
}
|
||||
|
||||
getDeviceCertification(gid);
|
||||
|
||||
// 避免初始化顺序问题导致 MetaUtil 一直持有空的 gid
|
||||
@ -154,6 +148,10 @@ public class DataUtils {
|
||||
@Override
|
||||
public void onFailure(String s) {
|
||||
MtaHelper.onEventWithBasicDeviceInfo("开发辅助", "GID 获取异常", s);
|
||||
// 更新广告配置
|
||||
ExtensionsKt.doOnMainProcessOnly(HaloApp.getInstance(), () -> {
|
||||
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -200,9 +198,8 @@ public class DataUtils {
|
||||
RealNameHelper.updateCertificationStatus(0);
|
||||
}
|
||||
|
||||
EventBus.getDefault().post(new EBReuse(Constants.EB_REALNAME_RESULT));
|
||||
RealNameHelper.INSTANCE.onRealNameInfoUpdated();
|
||||
|
||||
// new GhContentProvider().localInsert( HaloApp.getInstance().getApplication(),values);
|
||||
try {
|
||||
// Unknown URL content://com.gh.gamecenter.provider/certification
|
||||
// TODO 将 com.gh.gamecenter 改成 BuildConfig.ApplicationID
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.view.animation.AlphaAnimation
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.ScaleAnimation
|
||||
import android.widget.TextView
|
||||
import com.gh.common.constant.Config
|
||||
|
||||
/**
|
||||
* 光环游戏搜索栏默认文案轮换
|
||||
*/
|
||||
object DefaultSearchHintHelper {
|
||||
private val hintList = ArrayList<String>()
|
||||
|
||||
init {
|
||||
loadData()
|
||||
}
|
||||
|
||||
fun loadData() {
|
||||
hintList.clear()
|
||||
Config.getSettings()?.search?.defaultData?.also {
|
||||
if (it.isNotEmpty()) {
|
||||
for (h in it) {
|
||||
hintList.add(h.removeSuffix("."))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setSearchHint(searchTv: TextView) {
|
||||
var hintIndex = 0
|
||||
val scaleAnimation = ScaleAnimation(
|
||||
0.4F, 1.0F, 0.4F, 1.0F,
|
||||
Animation.RELATIVE_TO_SELF, 0.5F, Animation.RELATIVE_TO_SELF, 0.5F
|
||||
)
|
||||
scaleAnimation.duration = 500
|
||||
val alphaAnimation = AlphaAnimation(1F, 0.2F)
|
||||
alphaAnimation.duration = 300
|
||||
alphaAnimation.startOffset = 5000
|
||||
scaleAnimation.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationStart(animation: Animation) {}
|
||||
override fun onAnimationEnd(animation: Animation) {
|
||||
searchTv.animation = alphaAnimation
|
||||
alphaAnimation.start()
|
||||
}
|
||||
|
||||
override fun onAnimationRepeat(animation: Animation) {}
|
||||
})
|
||||
alphaAnimation.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationStart(animation: Animation) {}
|
||||
override fun onAnimationEnd(animation: Animation) {
|
||||
// 切换数据
|
||||
if (hintList.isNotEmpty()) {
|
||||
if (hintIndex > hintList.size - 1) {
|
||||
hintIndex = 0
|
||||
}
|
||||
searchTv.hint = hintList[hintIndex]
|
||||
hintIndex++
|
||||
searchTv.animation = scaleAnimation
|
||||
scaleAnimation.start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAnimationRepeat(animation: Animation) {}
|
||||
})
|
||||
|
||||
if (hintList.isEmpty()) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
if (hintList.isNotEmpty()) {
|
||||
if (hintList.size > 1) {
|
||||
searchTv.animation = alphaAnimation
|
||||
} else {
|
||||
val hint = hintList[0]
|
||||
searchTv.hint = hint
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,9 +12,6 @@ import com.gh.common.repository.ReservationRepository;
|
||||
import com.gh.common.simulator.SimulatorGameManager;
|
||||
import com.gh.common.xapk.XapkInstaller;
|
||||
import com.gh.common.xapk.XapkUnzipStatus;
|
||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation;
|
||||
import com.gh.gamecenter.feature.view.DownloadButton;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.DetailViewHolder;
|
||||
@ -22,6 +19,9 @@ import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation;
|
||||
import com.gh.gamecenter.feature.view.DownloadButton;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
@ -259,7 +259,7 @@ public class DetailDownloadUtils {
|
||||
|
||||
if (showDualDownloadButton && viewHolder.getLocalDownloadSizeTv() != null) {
|
||||
viewHolder.getLocalDownloadSizeTv().setVisibility(View.GONE);
|
||||
String size = viewHolder.getGameEntity().getApk().get(0).getSize();
|
||||
String size = viewHolder.getGameEntity().getApk().isEmpty() ? "" : viewHolder.getGameEntity().getApk().get(0).getSize();
|
||||
if (size != null) {
|
||||
String sizeWithoutDigit = size.replaceAll("(?<=\\d)\\.[0-9]+(?!\\d)", "");
|
||||
viewHolder.getLocalDownloadSizeTv().setText(sizeWithoutDigit);
|
||||
@ -367,8 +367,7 @@ public class DetailDownloadUtils {
|
||||
String downloadAddWord = gameEntity.getDownloadAddWord();
|
||||
|
||||
// 不满足条件的部分游戏隐藏下载按钮
|
||||
if (Config.isShowDownload(gameEntity.getId())
|
||||
&& !"光环助手".equals(gameEntity.getName())) {
|
||||
if (!"光环助手".equals(gameEntity.getName())) {
|
||||
viewHolder.getDownloadBottom().setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
viewHolder.getDownloadBottom().setVisibility(View.GONE);
|
||||
@ -443,7 +442,7 @@ public class DetailDownloadUtils {
|
||||
}
|
||||
|
||||
private static String getDownloadSizeText(DetailViewHolder viewHolder) {
|
||||
return String.format("(%s)", viewHolder.getGameEntity().getApk().get(0).getSize());
|
||||
return String.format("(%s)", viewHolder.getGameEntity().getApk().isEmpty() ? "" : viewHolder.getGameEntity().getApk().get(0).getSize());
|
||||
}
|
||||
|
||||
private static void updateVStyleDownloadButton(DetailViewHolder viewHolder,
|
||||
|
||||
@ -82,6 +82,7 @@ import java.util.ArrayList;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
|
||||
public class DialogUtils {
|
||||
@ -578,11 +579,15 @@ public class DialogUtils {
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
ApkEntity apkEntity = CollectionsKt.firstOrNull(gameEntity.getApk());
|
||||
String size = apkEntity == null ? "" : apkEntity.getSize();
|
||||
if ("show&download".equals(gameEntity.getOverseasAddressDialog().getStatus())) {
|
||||
gameEntity.getApk().get(0).setUrl(gameEntity.getOverseasAddressDialog().getLink());
|
||||
if (apkEntity != null) {
|
||||
apkEntity.setUrl(gameEntity.getOverseasAddressDialog().getLink());
|
||||
}
|
||||
}
|
||||
binding.urlTv.setText(gameEntity.getOverseasAddressDialog().getLink());
|
||||
binding.downloadBtn.setText("下载(" + gameEntity.getApk().get(0).getSize() + ")");
|
||||
binding.downloadBtn.setText("下载(" + size + ")");
|
||||
binding.downloadBtn.setOnClickListener(v -> {
|
||||
dismissByTouchInside.set(true);
|
||||
SensorsBridge.trackOverseasAddressDialogClick(
|
||||
|
||||
@ -33,29 +33,22 @@ import com.gh.gamecenter.common.entity.*
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.provider.IQGameProvider
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.discovery.DiscoveryActivity
|
||||
import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
|
||||
import com.gh.gamecenter.entity.GameCollectionListEntity
|
||||
import com.gh.gamecenter.entity.SubjectData
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity
|
||||
import com.gh.gamecenter.entity.VideoLinkEntity
|
||||
import com.gh.gamecenter.eventbus.EBSkip
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.feature.entity.GameDetailServer
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.LibaoEntity
|
||||
import com.gh.gamecenter.feature.entity.MeEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.feature.provider.IConcernInfoProvider
|
||||
import com.gh.gamecenter.forum.detail.ForumDetailActivity
|
||||
import com.gh.gamecenter.forum.home.CommunityHomeFragment
|
||||
import com.gh.gamecenter.forum.home.CommunityActivity
|
||||
import com.gh.gamecenter.forum.search.ForumOrUserSearchActivity
|
||||
import com.gh.gamecenter.fragment.MainWrapperFragment
|
||||
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailActivity
|
||||
import com.gh.gamecenter.game.commoncollection.detail.CommonCollectionDetailActivity
|
||||
import com.gh.gamecenter.game.commoncollection.detail.CustomCommonCollectionDetailActivity
|
||||
import com.gh.gamecenter.game.upload.GameSubmissionActivity
|
||||
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
||||
import com.gh.gamecenter.gamecollection.hotlist.GameCollectionHotListActivity
|
||||
@ -68,7 +61,9 @@ import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersSubscribedGameListActivity
|
||||
import com.gh.gamecenter.gamedetail.history.HistoryApkListActivity
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
|
||||
import com.gh.gamecenter.help.HelpAndFeedbackBridge
|
||||
import com.gh.gamecenter.libao.LibaoDetailActivity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailActivity
|
||||
import com.gh.gamecenter.personalhome.UserHomeActivity
|
||||
import com.gh.gamecenter.personalhome.background.PersonalityBackgroundActivity
|
||||
import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
|
||||
@ -88,19 +83,20 @@ import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity
|
||||
import com.gh.gamecenter.setting.SettingBridge
|
||||
import com.gh.gamecenter.subject.SubjectActivity
|
||||
import com.gh.gamecenter.tag.TagsActivity
|
||||
import com.gh.gamecenter.toolbox.ToolBoxBlockActivity
|
||||
import com.gh.gamecenter.toolbox.ToolBoxActivity
|
||||
import com.gh.gamecenter.video.data.VideoDataActivity
|
||||
import com.gh.gamecenter.video.detail.VideoDetailActivity
|
||||
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel
|
||||
import com.gh.gamecenter.video.game.GameVideoActivity
|
||||
import com.gh.gamecenter.video.videomanager.VideoManagerActivity
|
||||
import com.gh.gamecenter.wrapper.MainWrapperRepository
|
||||
import com.gh.gamecenter.wrapper.ToolbarWrapperActivity
|
||||
import com.gh.vspace.VDownloadManagerActivity
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.halo.assistant.fragment.WebFragment
|
||||
import com.lightgame.utils.Utils
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import retrofit2.HttpException
|
||||
import java.net.URLEncoder
|
||||
import java.util.*
|
||||
@ -160,7 +156,21 @@ object DirectUtils {
|
||||
"explore_column",
|
||||
"game_explore",
|
||||
"column_test_v2",
|
||||
"game_list_collection"
|
||||
"game_list_collection",
|
||||
"multi_tab_nav",
|
||||
"custom_page",
|
||||
"bottom_tab",
|
||||
"qq_mini_game_column_detail",
|
||||
"game_hot_list",
|
||||
"libao_center",
|
||||
"article_center",
|
||||
"video_stream",
|
||||
"libao",
|
||||
"community_home",
|
||||
"bbs_section",
|
||||
"qa",
|
||||
"feedback",
|
||||
"toolkit"
|
||||
)
|
||||
|
||||
fun directToLinkPage(
|
||||
@ -185,6 +195,7 @@ object DirectUtils {
|
||||
if (exposureEvent != null) {
|
||||
directToGameDetail(
|
||||
context, linkEntity.link
|
||||
?: "", linkEntity.text
|
||||
?: "", BaseActivity.mergeEntranceAndPath(entrance, path), traceEvent = exposureEvent
|
||||
)
|
||||
} else {
|
||||
@ -299,6 +310,7 @@ object DirectUtils {
|
||||
"",
|
||||
linkEntity.blockId,
|
||||
linkEntity.blockName,
|
||||
"",
|
||||
exposureEvent
|
||||
)
|
||||
|
||||
@ -308,7 +320,7 @@ object DirectUtils {
|
||||
|
||||
"wechat_bind" -> context.startActivity(WebActivity.getBindWechatIntent(context))
|
||||
|
||||
"video", "bbs_video", "video_stream", "视频" -> directToVideoDetail(
|
||||
"video", "bbs_video", "视频" -> directToVideoDetail(
|
||||
context,
|
||||
videoId = linkEntity.link!!,
|
||||
fromLocation = VideoDetailContainerViewModel.Location.VIDEO_CHOICENESS.value,
|
||||
@ -317,6 +329,14 @@ object DirectUtils {
|
||||
sourceEntrance = sourceEntrance
|
||||
)
|
||||
|
||||
"video_stream" -> directToLegacyVideoDetail(
|
||||
context,
|
||||
"",
|
||||
VideoDetailContainerViewModel.Location.VIDEO_ACTIVITY.value,
|
||||
referer = "视频流-$entrance",
|
||||
isHomeVideo = true
|
||||
)
|
||||
|
||||
"game_video" -> directToGameVideo(context, linkEntity.link ?: "", entrance, path)
|
||||
|
||||
"libao", "礼包" -> directToGiftDetail(context, linkEntity.link ?: "", entrance)
|
||||
@ -387,17 +407,17 @@ object DirectUtils {
|
||||
|
||||
"setting" -> context.startActivity(SettingBridge.getSettingIntent(context, false, entrance))
|
||||
|
||||
"index_page" -> directToHomeTab(context)
|
||||
"index_page" -> directToHomeDefaultTab(context)
|
||||
|
||||
"video_upload" -> context.startActivity(VideoManagerActivity.getIntent(context, "", entrance))
|
||||
|
||||
"bbs" -> directToForum(context)
|
||||
"bbs", "community_home" -> directToHomeCommunityTab(context)
|
||||
|
||||
"user_page" -> directToHomeActivity(context, UserManager.getInstance().userId, "", entrance)
|
||||
|
||||
"video_tab" -> directToVideoTab(context)
|
||||
"video_tab" -> directToHomeVideoTab(context)
|
||||
|
||||
"toolkit" -> context.startActivity(ToolBoxBlockActivity.getIntent(context, entrance))
|
||||
"toolkit" -> context.startActivity(ToolBoxActivity.getIntent(context, entrance))
|
||||
|
||||
"column_test" -> context.startActivity(
|
||||
GameServerTestActivity.getIntent(
|
||||
@ -418,7 +438,7 @@ object DirectUtils {
|
||||
} ?: ""
|
||||
}
|
||||
|
||||
"halo_tab" -> directToPersonalTab(context)
|
||||
"halo_tab" -> directToHomeMyHaloTab(context)
|
||||
|
||||
"common_collection" -> directToCommonCollectionDetail(
|
||||
context,
|
||||
@ -457,6 +477,29 @@ object DirectUtils {
|
||||
|
||||
"qq_mini_game_column" -> directToQGameHome(context)
|
||||
|
||||
// QQ游戏专题详情页
|
||||
"qq_mini_game_column_detail" -> {
|
||||
directToSubject(
|
||||
context = context,
|
||||
id = linkEntity.link ?: "",
|
||||
subjectName = linkEntity.text,
|
||||
entrance = BaseActivity.mergeEntranceAndPath(entrance, path),
|
||||
exposureEvent = exposureEvent,
|
||||
isQQMiniGame = true
|
||||
)
|
||||
}
|
||||
|
||||
// 资讯中心
|
||||
"article_center" -> {
|
||||
context.startActivity(InfoActivity.getIntent(context))
|
||||
}
|
||||
// 礼包中心
|
||||
"libao_center" -> {
|
||||
directToGift(context, entrance)
|
||||
}
|
||||
|
||||
"game_hot_list" -> directToGameCollectionHotList(context, entrance)
|
||||
|
||||
"game_list_collection" -> directToGameCollectionListDetail(
|
||||
context,
|
||||
linkEntity.link ?: "",
|
||||
@ -465,6 +508,34 @@ object DirectUtils {
|
||||
entrance
|
||||
)
|
||||
|
||||
"multi_tab_nav" -> context.startActivity(
|
||||
ToolbarWrapperActivity.getMultiTabNavIntent(
|
||||
context,
|
||||
linkEntity.link ?: "",
|
||||
linkEntity.text ?: ""
|
||||
)
|
||||
)
|
||||
|
||||
"custom_page" -> context.startActivity(
|
||||
ToolbarWrapperActivity.getCustomPageIntent(
|
||||
context,
|
||||
linkEntity.link ?: "",
|
||||
linkEntity.text ?: ""
|
||||
)
|
||||
)
|
||||
|
||||
// 选中首页底部 tab
|
||||
"bottom_tab" -> {
|
||||
val intent = Intent(context, MainActivity::class.java).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
}
|
||||
context.startActivity(intent)
|
||||
|
||||
if (linkEntity is LaunchRedirect) {
|
||||
MainWrapperRepository.getInstance().sendSelectTabEvent(linkEntity)
|
||||
}
|
||||
}
|
||||
|
||||
"" -> {
|
||||
// do nothing
|
||||
}
|
||||
@ -519,7 +590,9 @@ object DirectUtils {
|
||||
columnName: String = "",
|
||||
blockId: String = "",
|
||||
blockName: String = "",
|
||||
exposureEvent: ExposureEvent? = null
|
||||
style: String = "",
|
||||
exposureEvent: ExposureEvent? = null,
|
||||
showSubjectTab: Boolean = false
|
||||
) {
|
||||
if (id.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
@ -529,7 +602,9 @@ object DirectUtils {
|
||||
bundle.putString(KEY_COLUMNNAME, columnName)
|
||||
bundle.putString(KEY_BLOCK_ID, blockId)
|
||||
bundle.putString(KEY_BLOCK_NAME, blockName)
|
||||
bundle.putString(KEY_COLUMN_COLLECTION_STYLE, style)
|
||||
bundle.putInt(KEY_POSITION, position)
|
||||
bundle.putBoolean(KEY_SHOW_SUBJECT_TAB, showSubjectTab)
|
||||
if (exposureEvent != null) {
|
||||
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source))
|
||||
}
|
||||
@ -584,7 +659,7 @@ object DirectUtils {
|
||||
if (id.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_TO, NewsDetailActivity::class.java.simpleName)
|
||||
bundle.putString(KEY_TO, NewsDetailActivity::class.java.name)
|
||||
bundle.putString(KEY_NEWSID, id)
|
||||
if (entrance?.contains("隐私政策") == true) {
|
||||
bundle.putBoolean(KEY_HIDE_USELESS_INFO, true)
|
||||
@ -600,7 +675,7 @@ object DirectUtils {
|
||||
if (id.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_TO, NewsDetailActivity::class.java.simpleName)
|
||||
bundle.putString(KEY_TO, NewsDetailActivity::class.java.name)
|
||||
bundle.putString(KEY_NEWSID, id)
|
||||
bundle.putBoolean(KEY_HIDE_USELESS_INFO, hideUselessInfo)
|
||||
jumpActivity(context, bundle)
|
||||
@ -679,6 +754,7 @@ object DirectUtils {
|
||||
fun directToGameDetail(
|
||||
context: Context,
|
||||
id: String,
|
||||
name: String = "",
|
||||
entrance: String? = null,
|
||||
autoDownload: Boolean? = null,
|
||||
tab: String? = "",
|
||||
@ -698,7 +774,7 @@ object DirectUtils {
|
||||
}
|
||||
}
|
||||
if (traceEvent != null) {
|
||||
val clickEvent = createEvent(GameEntity(id), traceEvent.source, appendTrace(traceEvent), ExposureType.CLICK)
|
||||
val clickEvent = createEvent(GameEntity(id = id, name = name), traceEvent.source, appendTrace(traceEvent), ExposureType.CLICK)
|
||||
log(clickEvent)
|
||||
bundle.putParcelable(KEY_TRACE_EVENT, clickEvent)
|
||||
}
|
||||
@ -852,6 +928,31 @@ object DirectUtils {
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToDownloadManager(
|
||||
context: Context,
|
||||
entrance: String = "",
|
||||
bottomTab: String = "",
|
||||
gameColumnId: String = "",
|
||||
gameColumnName: String = "",
|
||||
customPageId: String = "",
|
||||
customPageName: String = "",
|
||||
multiTabId: String = "",
|
||||
multiTabName: String = ""
|
||||
) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_TO, DownloadManagerActivity.TAG)
|
||||
bundle.putString(KEY_BOTTOM_TAB_NAME, bottomTab)
|
||||
bundle.putString(KEY_GAME_COLUMN_ID, gameColumnId)
|
||||
bundle.putString(KEY_GAME_COLUMN_NAME, gameColumnName)
|
||||
bundle.putString(KEY_CUSTOM_PAGE_ID, customPageId)
|
||||
bundle.putString(KEY_CUSTOM_PAGE_NAME, customPageName)
|
||||
bundle.putString(KEY_MULTI_TAB_NAV_ID, multiTabId)
|
||||
bundle.putString(KEY_MULTI_TAB_NAV_NAME, multiTabName)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToDownloadManagerAndStartUpdate(
|
||||
context: Context,
|
||||
@ -872,7 +973,7 @@ object DirectUtils {
|
||||
fun directToToolbox(context: Context, gameId: String, toolboxUrl: String, entrance: String = ENTRANCE_BROWSER) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_TO, ToolBoxBlockActivity::class.java.name)
|
||||
bundle.putString(KEY_TO, ToolBoxActivity::class.java.name)
|
||||
bundle.putString(KEY_GAMEID, gameId)
|
||||
bundle.putString(KEY_URL, toolboxUrl)
|
||||
jumpActivity(context, bundle)
|
||||
@ -996,12 +1097,7 @@ object DirectUtils {
|
||||
@JvmStatic
|
||||
fun directToGiftDetail(context: Context, giftId: String, entrance: String? = null) {
|
||||
if (giftId.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_TO, LibaoDetailActivity::class.java.simpleName)
|
||||
bundle.putString(EntranceConsts.KEY_ID, giftId)
|
||||
HaloApp.put(LibaoEntity.TAG, null)
|
||||
jumpActivity(context, bundle)
|
||||
context.startActivity(LibaoDetailActivity.getIntentById(context, giftId, entrance))
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1018,21 +1114,7 @@ object DirectUtils {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToCommunity(context: Context, community: CommunityEntity?) {
|
||||
// if (MainActivity::class.java.name != RunningUtils.getTopActivity(context)) {
|
||||
// val intent = Intent(context, MainActivity::class.java)
|
||||
// intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
// context.startActivity(intent)
|
||||
//
|
||||
// UserManager.getInstance().setCommunityData(community)
|
||||
//
|
||||
// // 这里换个线程操作是为了做一点延时
|
||||
// AppExecutor.ioExecutor.execute {
|
||||
// EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_BBS))
|
||||
// EventBus.getDefault().post(EBReuse(CommunityFragment.EB_RETRY_PAGE))
|
||||
// }
|
||||
// } else {
|
||||
directForumDetail(context, community?.id)
|
||||
// }
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ -1474,85 +1556,61 @@ object DirectUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 到首页-首页 tab
|
||||
* 到首页-默认选中的 tab
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToHomeTab(context: Context) {
|
||||
fun directToHomeDefaultTab(context: Context) {
|
||||
if (HaloApp.getInstance().isRunningForeground) {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
context.startActivity(intent)
|
||||
|
||||
// 这里换个线程操作是为了做一点延时
|
||||
runOnIoThread {
|
||||
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_HOME))
|
||||
}
|
||||
MainWrapperRepository.getInstance().sendReSelectDefaultTabEvent()
|
||||
} else {
|
||||
jumpActivity(context, Bundle().apply { putInt(KEY_POSITION, MainWrapperFragment.INDEX_HOME) })
|
||||
jumpActivity(context, Bundle())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 到首页-论坛 tab
|
||||
* @param position 论坛的子 tab 位置
|
||||
* 到首页-社区 tab
|
||||
* @param position 社区子 tab 位置
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToForum(context: Context, position: Int = 0) {
|
||||
if (HaloApp.getInstance().isRunningForeground) {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
context.startActivity(intent)
|
||||
|
||||
// 这里换个线程操作是为了做一点延时
|
||||
runOnIoThread {
|
||||
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_BBS))
|
||||
EventBus.getDefault().post(EBSkip(CommunityHomeFragment.EB_TAB, position))
|
||||
}
|
||||
} else {
|
||||
jumpActivity(context, Bundle().apply {
|
||||
putInt(KEY_POSITION, MainWrapperFragment.INDEX_BBS)
|
||||
putInt(KEY_SUB_POSITION, position)
|
||||
})
|
||||
}
|
||||
fun directToHomeCommunityTab(context: Context) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, CommunityActivity::class.java.name)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
* 到首页-视频 tab
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToVideoTab(context: Context) {
|
||||
fun directToHomeVideoTab(context: Context) {
|
||||
if (HaloApp.getInstance().isRunningForeground) {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
context.startActivity(intent)
|
||||
|
||||
// 这里换个线程操作是为了做一点延时
|
||||
runOnIoThread {
|
||||
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_VIDEO))
|
||||
}
|
||||
} else {
|
||||
jumpActivity(context, Bundle().apply { putInt(KEY_POSITION, MainWrapperFragment.INDEX_VIDEO) })
|
||||
jumpActivity(context, Bundle())
|
||||
}
|
||||
|
||||
MainWrapperRepository.getInstance().sendSelectTabEvent(ViewPagerFragmentHelper.TYPE_VIDEO_STREAM)
|
||||
}
|
||||
|
||||
/**
|
||||
* 到首页-我的光环 tab
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToPersonalTab(context: Context) {
|
||||
fun directToHomeMyHaloTab(context: Context) {
|
||||
if (HaloApp.getInstance().isRunningForeground) {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
context.startActivity(intent)
|
||||
|
||||
// 这里换个线程操作是为了做一点延时
|
||||
runOnIoThread {
|
||||
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_PERSONAL))
|
||||
}
|
||||
} else {
|
||||
jumpActivity(context, Bundle().apply { putInt(KEY_POSITION, MainWrapperFragment.INDEX_PERSONAL) })
|
||||
jumpActivity(context, Bundle())
|
||||
}
|
||||
|
||||
MainWrapperRepository.getInstance().sendSelectTabEvent(ViewPagerFragmentHelper.TYPE_MY_HALO)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1851,7 +1909,7 @@ object DirectUtils {
|
||||
) {
|
||||
if (collectionId.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, CommonCollectionDetailActivity::class.java.name)
|
||||
bundle.putString(KEY_TO, CustomCommonCollectionDetailActivity::class.java.name)
|
||||
bundle.putString(KEY_BLOCK_ID, blockId)
|
||||
bundle.putString(KEY_BLOCK_NAME, blockName)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
@ -1989,15 +2047,35 @@ object DirectUtils {
|
||||
bbsId: String,
|
||||
entrance: String,
|
||||
sourceEntrance: String,
|
||||
forumName: String
|
||||
forumName: String,
|
||||
bottomTab: String = "",
|
||||
multiTabId: String = "",
|
||||
multiTabName: String = "",
|
||||
customPageId: String = "",
|
||||
customPageName: String = "",
|
||||
searchBoxPattern: String = ""
|
||||
) {
|
||||
context.startActivity(ForumOrUserSearchActivity.getIntent(context, bbsId, entrance, sourceEntrance, forumName))
|
||||
context.startActivity(
|
||||
ForumOrUserSearchActivity.getIntent(
|
||||
context,
|
||||
bbsId,
|
||||
entrance,
|
||||
sourceEntrance,
|
||||
forumName,
|
||||
bottomTab,
|
||||
multiTabId,
|
||||
multiTabName,
|
||||
customPageId,
|
||||
customPageName,
|
||||
searchBoxPattern
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToVGameDownload(context: Context, switchToDownloadingTab: Boolean = false) {
|
||||
fun directToVGameDownload(context: Context, entrance: String, switchToDownloadingTab: Boolean = false) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_TO, VDownloadManagerActivity::class.java.name)
|
||||
bundle.putInt(KEY_POSITION, if (switchToDownloadingTab) 1 else 0)
|
||||
jumpActivity(context, bundle)
|
||||
@ -2065,9 +2143,27 @@ object DirectUtils {
|
||||
fun directToQGameSearch(
|
||||
context: Context,
|
||||
hint: String,
|
||||
sourceEntrance: String
|
||||
sourceEntrance: String,
|
||||
bottomTab: String = "",
|
||||
multiTabId: String = "",
|
||||
multiTabName: String = "",
|
||||
customPageId: String = "",
|
||||
customPageName: String = "",
|
||||
searchBoxPattern: String = ""
|
||||
) {
|
||||
context.startActivity(QGameSearchActivity.getIntent(context, hint, sourceEntrance))
|
||||
context.startActivity(
|
||||
QGameSearchActivity.getIntent(
|
||||
context,
|
||||
hint,
|
||||
sourceEntrance,
|
||||
bottomTab,
|
||||
multiTabId,
|
||||
multiTabName,
|
||||
customPageId,
|
||||
customPageName,
|
||||
searchBoxPattern
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@ -2160,4 +2256,62 @@ object DirectUtils {
|
||||
context.startActivity(ServersCalendarManagementActivity.getIntent(context))
|
||||
}
|
||||
}
|
||||
|
||||
fun directToSearch(
|
||||
context: Context,
|
||||
searchType: String,
|
||||
searchHint: String,
|
||||
entrance: String,
|
||||
sourceEntrance: String,
|
||||
bottomTab: String = "",
|
||||
multiTabId: String = "",
|
||||
multiTabName: String = "",
|
||||
customPageId: String = "",
|
||||
customPageName: String = "",
|
||||
searchBoxPattern: String = ""
|
||||
) {
|
||||
when (searchType) {
|
||||
BottomTab.SearchStyle.TYPE_HALO_GAME -> context.startActivity(
|
||||
SearchActivity.getIntent(
|
||||
context,
|
||||
false,
|
||||
searchHint,
|
||||
entrance,
|
||||
sourceEntrance,
|
||||
bottomTab,
|
||||
multiTabId,
|
||||
multiTabName,
|
||||
customPageId,
|
||||
customPageName,
|
||||
searchBoxPattern
|
||||
)
|
||||
)
|
||||
|
||||
BottomTab.SearchStyle.TYPE_QQ_MINI_GAME -> directToQGameSearch(
|
||||
context,
|
||||
"请输入小游戏关键词",
|
||||
sourceEntrance,
|
||||
bottomTab,
|
||||
multiTabId,
|
||||
multiTabName,
|
||||
customPageId,
|
||||
customPageName,
|
||||
searchBoxPattern
|
||||
)
|
||||
|
||||
BottomTab.SearchStyle.TYPE_BBS -> directToForumOrUserSearch(
|
||||
context,
|
||||
"",
|
||||
entrance,
|
||||
sourceEntrance,
|
||||
"",
|
||||
bottomTab,
|
||||
multiTabId,
|
||||
multiTabName,
|
||||
customPageId,
|
||||
customPageName,
|
||||
searchBoxPattern
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.collection.ArrayMap
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.chain.*
|
||||
import com.gh.common.constant.Config
|
||||
@ -45,7 +46,6 @@ import com.gh.vspace.VHelper
|
||||
import com.lightgame.download.DownloadConfig
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.DownloadStatus
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.Utils
|
||||
import java.io.File
|
||||
import java.util.concurrent.LinkedBlockingQueue
|
||||
@ -199,7 +199,7 @@ object DownloadItemUtils {
|
||||
holder.gameDownloadTips?.visibility = View.GONE
|
||||
updateNormalItem(context, holder, gameEntity, briefStyle, isShowRecommendStar)
|
||||
} else {
|
||||
holder.multiVersionDownloadTv?.visibility = View.VISIBLE
|
||||
holder.multiVersionDownloadTv?.isVisible = !SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)
|
||||
updatePluginItem(context, holder, gameEntity, briefStyle, isShowRecommendStar)
|
||||
}
|
||||
updateDownloadButton(
|
||||
@ -219,7 +219,7 @@ object DownloadItemUtils {
|
||||
pluginLocation: PluginLocation? = PluginLocation.only_game
|
||||
) {
|
||||
// 控制是否显示下载按钮
|
||||
downloadBtn.goneIf(!Config.isShowDownload(gameEntity.id) || context.getString(R.string.app_name) == gameEntity.name)
|
||||
downloadBtn.goneIf(context.getString(R.string.app_name) == gameEntity.name)
|
||||
// 青少年模式或者需要特殊处理显示查看
|
||||
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE) || gameEntity.isSpecialDownload()) {
|
||||
downloadBtn.text = "查看"
|
||||
@ -443,6 +443,7 @@ object DownloadItemUtils {
|
||||
briefStyle: String?,
|
||||
isShowRecommendStar: Boolean = false
|
||||
) {
|
||||
updateItemViewStatus(holder, briefStyle, gameEntity.columnRecommend, isShowRecommendStar)
|
||||
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
|
||||
if (downloadEntity != null) {
|
||||
if (downloadEntity.isSimulatorGame()) {
|
||||
@ -457,7 +458,6 @@ object DownloadItemUtils {
|
||||
return
|
||||
}
|
||||
}
|
||||
updateItemViewStatus(holder, briefStyle, gameEntity.columnRecommend, isShowRecommendStar)
|
||||
}
|
||||
|
||||
// 更新插件的条目,有多个apk包
|
||||
@ -776,8 +776,8 @@ object DownloadItemUtils {
|
||||
return
|
||||
}
|
||||
if (gameEntity.isReservable) {
|
||||
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.id)) {
|
||||
downloadBtn.setOnClickListener {
|
||||
downloadBtn.setOnClickListener {
|
||||
if (!ReservationRepository.thisGameHasBeenReserved(gameEntity.id)) {
|
||||
SensorsBridge.trackEvent(
|
||||
"AppointmentGame",
|
||||
"game_name",
|
||||
@ -802,9 +802,7 @@ object DownloadItemUtils {
|
||||
refreshCallback?.onCallback()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
downloadBtn.setOnClickListener {
|
||||
} else {
|
||||
allStateClickCallback?.onCallback()
|
||||
clickCallback?.onCallback()
|
||||
if ("download" == gameEntity.reserveStatus) {
|
||||
@ -912,7 +910,6 @@ object DownloadItemUtils {
|
||||
DownloadChainBuilder().apply {
|
||||
addHandler(GamePermissionHandler())
|
||||
addHandler(CheckStoragePermissionHandler())
|
||||
addHandler(CertificationHandler())
|
||||
addHandler(VersionNumberHandler())
|
||||
}
|
||||
.setProcessEndCallback { _, _ ->
|
||||
@ -954,7 +951,6 @@ object DownloadItemUtils {
|
||||
addHandler(BrowserInstallHandler())
|
||||
addHandler(PackageCheckHandler())
|
||||
addHandler(DownloadDialogHelperHandler())
|
||||
addHandler(CertificationHandler())
|
||||
addHandler(OverseaDownloadHandler())
|
||||
addHandler(LandPageAddressHandler())
|
||||
addHandler(CheckDownloadHandler())
|
||||
@ -973,7 +969,6 @@ object DownloadItemUtils {
|
||||
addHandler(BrowserInstallHandler())
|
||||
addHandler(PackageCheckHandler())
|
||||
addHandler(DownloadDialogHelperHandler())
|
||||
addHandler(CertificationHandler())
|
||||
addHandler(VersionNumberHandler())
|
||||
addHandler(LandPageAddressHandler())
|
||||
addHandler(OverseaDownloadHandler())
|
||||
@ -991,7 +986,6 @@ object DownloadItemUtils {
|
||||
addHandler(GamePermissionHandler())
|
||||
addHandler(PackageCheckHandler())
|
||||
addHandler(DownloadDialogHelperHandler())
|
||||
addHandler(CertificationHandler())
|
||||
addHandler(VersionNumberHandler())
|
||||
addHandler(LandPageAddressHandler())
|
||||
addHandler(OverseaDownloadHandler())
|
||||
@ -1010,7 +1004,6 @@ object DownloadItemUtils {
|
||||
} else {
|
||||
DownloadChainBuilder().apply {
|
||||
addHandler(DownloadDialogHelperHandler())
|
||||
addHandler(CertificationHandler())
|
||||
addHandler(CheckDownloadHandler())
|
||||
}
|
||||
.setProcessEndCallback { _, isSubscribe ->
|
||||
@ -1066,7 +1059,7 @@ object DownloadItemUtils {
|
||||
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
|
||||
return
|
||||
}
|
||||
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk()[0].url)
|
||||
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().firstOrNull()?.url)
|
||||
if (downloadEntity != null) {
|
||||
val file = File(downloadEntity.path)
|
||||
if (!file.exists()) {
|
||||
@ -1160,7 +1153,7 @@ object DownloadItemUtils {
|
||||
) {
|
||||
if (gameEntity.getApk().isEmpty()) return
|
||||
|
||||
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size ?: "")
|
||||
val msg = FileUtils.isCanDownload(context, gameEntity.getApk().firstOrNull()?.size ?: "")
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
DownloadManager.createDownload(
|
||||
context,
|
||||
@ -1198,7 +1191,7 @@ object DownloadItemUtils {
|
||||
isSubscribe: Boolean,
|
||||
traceEvent: ExposureEvent?
|
||||
) {
|
||||
val msg = FileUtils.isCanDownload(context, gameEntity.getApk()[0].size ?: "")
|
||||
val msg = FileUtils.isCanDownload(context, gameEntity.getApk().firstOrNull()?.size ?: "")
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
DownloadManager.createDownload(context, gameEntity, false, entrance, location, isSubscribe, traceEvent)
|
||||
ToastUtils.toast(gameEntity.name + "已加入下载队列")
|
||||
@ -1225,7 +1218,7 @@ object DownloadItemUtils {
|
||||
adapter: RecyclerView.Adapter<out RecyclerView.ViewHolder?>?,
|
||||
refreshCallback: EmptyCallback?
|
||||
) {
|
||||
val apkEntity = gameEntity.getApk()[0]
|
||||
val apkEntity = gameEntity.getApk().firstOrNull()
|
||||
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity)
|
||||
if (downloadEntity != null) {
|
||||
val path = downloadEntity.path
|
||||
@ -1233,7 +1226,7 @@ object DownloadItemUtils {
|
||||
FileUtils.isEmptyFile(path) -> {
|
||||
Utils.toast(context, R.string.install_failure_hint)
|
||||
DownloadManager.getInstance().cancel(downloadEntity.url)
|
||||
gameEntity.getEntryMap().remove(apkEntity.getPlatform())
|
||||
gameEntity.getEntryMap().remove(apkEntity?.getPlatform())
|
||||
adapter?.notifyItemChanged(position)
|
||||
refreshCallback?.onCallback()
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import com.gh.gamecenter.core.utils.MtaHelper
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.SimulatorEntity
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils
|
||||
@ -31,7 +32,10 @@ import com.gh.gamecenter.help.HelpAndFeedbackBridge
|
||||
import com.gh.gamecenter.pkg.PkgHelper
|
||||
import com.gh.vspace.VHelper
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.*
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadConfig
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.DownloadStatus
|
||||
import com.lightgame.utils.AppManager
|
||||
import com.lightgame.utils.Utils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@ -190,9 +194,10 @@ object DownloadObserver {
|
||||
confirmClickCallback = {
|
||||
currentActivity.startActivity(
|
||||
ShellActivity.getIntent(
|
||||
currentActivity,
|
||||
ShellActivity.Type.REAL_NAME_INFO,
|
||||
))
|
||||
currentActivity,
|
||||
ShellActivity.Type.REAL_NAME_INFO,
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
@ -328,8 +333,13 @@ object DownloadObserver {
|
||||
simulator = newSimulator ?: simulator
|
||||
}
|
||||
SimulatorDownloadManager.getInstance().showDownloadDialog(
|
||||
currentActivity, simulator,
|
||||
SimulatorDownloadManager.SimulatorLocation.LAUNCH, downloadEntity.gameId, gameName, downloadEntity.categoryChinese, null
|
||||
currentActivity,
|
||||
simulator,
|
||||
SimulatorDownloadManager.SimulatorLocation.LAUNCH,
|
||||
downloadEntity.gameId,
|
||||
gameName,
|
||||
downloadEntity.categoryChinese,
|
||||
null
|
||||
)
|
||||
SimulatorGameManager.recordDownloadSimulatorGame(downloadEntity.gameId, simulator.type)
|
||||
SimulatorGameManager.postPlayedGame(downloadEntity.gameId, downloadEntity.packageName)
|
||||
@ -344,7 +354,8 @@ object DownloadObserver {
|
||||
} else {
|
||||
if (PackageUtils.isCanLaunchSetup(mApplication, downloadEntity.path)
|
||||
|| downloadType == Constants.VGAME
|
||||
|| downloadType == Constants.DUAL_DOWNLOAD_VGAME) {
|
||||
|| downloadType == Constants.DUAL_DOWNLOAD_VGAME
|
||||
) {
|
||||
downloadEntity.meta[Constants.MARK_ALREADY_TRIGGERED_INSTALLATION] = "YES"
|
||||
tryWithDefaultCatch {
|
||||
NewFlatLogUtils.logGameInstall(
|
||||
@ -476,13 +487,20 @@ object DownloadObserver {
|
||||
)
|
||||
|
||||
if (downloadEntity.asVGame()) {
|
||||
val customTrackDataJson = downloadEntity.customPageTrackDataJson
|
||||
val kvs = if (customTrackDataJson.isNullOrBlank()) {
|
||||
arrayOf<String>()
|
||||
} else {
|
||||
GsonUtils.fromJson(customTrackDataJson, CustomPageTrackData::class.java).toKV()
|
||||
}
|
||||
SensorsBridge.trackEventWithExposureSource(
|
||||
"HaloFunGameDownloadDone",
|
||||
exposureEvent?.source,
|
||||
"game_name", downloadEntity.name,
|
||||
"game_id", downloadEntity.gameId,
|
||||
"game_type", downloadEntity.categoryChinese,
|
||||
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位"
|
||||
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
|
||||
*kvs
|
||||
)
|
||||
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
|
||||
SensorsBridge.trackEvent(
|
||||
@ -494,24 +512,32 @@ object DownloadObserver {
|
||||
|
||||
if (downloadEntity.gameId != Constants.GHZS_GAME_ID
|
||||
&& downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD
|
||||
&& downloadEntity.gameId != Constants.HALO_FUN_GAME_ID) {
|
||||
SensorsBridge.trackEventWithExposureSource(
|
||||
"DownloadProcessFinish",
|
||||
exposureEvent?.source,
|
||||
"game_id", downloadEntity.gameId,
|
||||
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
|
||||
"game_type", downloadEntity.meta[Constants.GAME_CATEGORY_IN_CHINESE] ?: "",
|
||||
"game_label", downloadEntity.tags.joinToString(","),
|
||||
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
|
||||
"page_name", getCurrentPageEntity().pageName,
|
||||
"page_id", getCurrentPageEntity().pageId,
|
||||
"page_business_id", getCurrentPageEntity().pageBusinessId,
|
||||
"last_page_name", getLastPageEntity().pageName,
|
||||
"last_page_id", getLastPageEntity().pageId,
|
||||
"last_page_business_id", getLastPageEntity().pageBusinessId,
|
||||
"download_status", downloadEntity.meta[Constants.DOWNLOAD_STATUS_IN_CHINESE] ?: "",
|
||||
"download_type", if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
)
|
||||
&& downloadEntity.gameId != Constants.HALO_FUN_GAME_ID
|
||||
) {
|
||||
val trackJson = downloadEntity.customPageTrackDataJson
|
||||
val kvs = if (!trackJson.isNullOrBlank()) {
|
||||
GsonUtils.fromJson(trackJson, CustomPageTrackData::class.java).toKV()
|
||||
} else {
|
||||
arrayOf()
|
||||
}
|
||||
SensorsBridge.trackEventWithExposureSource(
|
||||
"DownloadProcessFinish",
|
||||
exposureEvent?.source,
|
||||
"game_id", downloadEntity.gameId,
|
||||
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
|
||||
"game_type", downloadEntity.meta[Constants.GAME_CATEGORY_IN_CHINESE] ?: "",
|
||||
"game_label", downloadEntity.tags.joinToString(","),
|
||||
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
|
||||
"page_name", getCurrentPageEntity().pageName,
|
||||
"page_id", getCurrentPageEntity().pageId,
|
||||
"page_business_id", getCurrentPageEntity().pageBusinessId,
|
||||
"last_page_name", getLastPageEntity().pageName,
|
||||
"last_page_id", getLastPageEntity().pageId,
|
||||
"last_page_business_id", getLastPageEntity().pageBusinessId,
|
||||
"download_status", downloadEntity.meta[Constants.DOWNLOAD_STATUS_IN_CHINESE] ?: "",
|
||||
"download_type", if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
*kvs
|
||||
)
|
||||
}
|
||||
|
||||
DataCollectionUtils.uploadDownload(mApplication, downloadEntity, "完成")
|
||||
|
||||
@ -6,7 +6,6 @@ import android.text.TextUtils
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.common.DefaultJsApi
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.dialog.CertificationDialog
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.history.HistoryHelper
|
||||
import com.gh.common.repository.ReservationRepository
|
||||
@ -42,7 +41,6 @@ import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.teenagermode.TeenagerModeActivity
|
||||
import com.gh.vspace.VHelper
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.Utils
|
||||
import java.io.File
|
||||
|
||||
@ -262,10 +260,14 @@ object GameActivityDownloadHelper {
|
||||
traceEvent: ExposureEvent
|
||||
) {
|
||||
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
|
||||
CertificationDialog.showCertificationDialog(context, gameEntity) {
|
||||
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
|
||||
download(context, gameEntity, apk, false, isSubscribe, entrance, location, traceEvent)
|
||||
}
|
||||
DialogUtils.checkDownload(
|
||||
context,
|
||||
apk.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name,
|
||||
gameEntity.categoryChinese
|
||||
) { isSubscribe: Boolean ->
|
||||
download(context, gameEntity, apk, false, isSubscribe, entrance, location, traceEvent)
|
||||
}
|
||||
}
|
||||
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
|
||||
@ -282,16 +284,14 @@ object GameActivityDownloadHelper {
|
||||
) {
|
||||
VHelper.validateVSpaceBeforeAction(context, gameEntity) {
|
||||
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
|
||||
CertificationDialog.showCertificationDialog(context, gameEntity) {
|
||||
DialogUtils.checkDownload(
|
||||
context,
|
||||
apk.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name,
|
||||
gameEntity.categoryChinese
|
||||
) { isSubscribe: Boolean ->
|
||||
download(context, gameEntity, apk, true, isSubscribe, entrance, location, traceEvent)
|
||||
}
|
||||
DialogUtils.checkDownload(
|
||||
context,
|
||||
apk.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name,
|
||||
gameEntity.categoryChinese
|
||||
) { isSubscribe: Boolean ->
|
||||
download(context, gameEntity, apk, true, isSubscribe, entrance, location, traceEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -309,10 +309,14 @@ object GameActivityDownloadHelper {
|
||||
if (gameEntity.pluggableCollection != null) {
|
||||
DownloadDialog.showDownloadDialog(context, gameEntity, traceEvent, entrance, location)
|
||||
} else {
|
||||
CertificationDialog.showCertificationDialog(context, gameEntity) {
|
||||
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
|
||||
plugin(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
|
||||
}
|
||||
DialogUtils.checkDownload(
|
||||
context,
|
||||
apk.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name,
|
||||
gameEntity.categoryChinese
|
||||
) { isSubscribe: Boolean ->
|
||||
plugin(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -380,7 +384,7 @@ object GameActivityDownloadHelper {
|
||||
return
|
||||
}
|
||||
val simulatorDownloadEntity =
|
||||
SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk()[0].url)
|
||||
SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().firstOrNull()?.url)
|
||||
if (simulatorDownloadEntity != null) {
|
||||
val file = File(simulatorDownloadEntity.path)
|
||||
if (!file.exists()) {
|
||||
@ -427,7 +431,7 @@ object GameActivityDownloadHelper {
|
||||
return when {
|
||||
gameEntity.getApk().isEmpty() -> null
|
||||
|
||||
gameEntity.getApk().size == 1 -> gameEntity.getApk()[0]
|
||||
gameEntity.getApk().size == 1 -> gameEntity.getApk().firstOrNull()
|
||||
|
||||
// 找出对应平台版本Apk且移除掉其他平台版本Apk
|
||||
isRemoveOther -> {
|
||||
|
||||
@ -1,21 +1,16 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.common.utils.doOnMainProcessOnly
|
||||
import com.gh.gamecenter.common.utils.toJson
|
||||
import com.gh.gamecenter.common.utils.toObject
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.SubjectEntity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Utils
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import okhttp3.ResponseBody
|
||||
|
||||
/**
|
||||
* 补充游戏库管理类
|
||||
@ -26,15 +21,10 @@ object GameSubstituteRepositoryHelper {
|
||||
private const val KEY_GAME_REPOSITORY = "game_substitute_repository"
|
||||
|
||||
private var mApi = RetrofitManager.getInstance().api
|
||||
private var mHistoricInstalledGameIdSet = hashSetOf<String>() // 历史已安装过的游戏 ID 列表
|
||||
private var mApplicationContext = HaloApp.getInstance().application
|
||||
private val mGameSubSp by lazy { mApplicationContext.getSharedPreferences(SP_GAME_SUB, Context.MODE_PRIVATE) }
|
||||
|
||||
private var mGameCollectionList: List<SubjectEntity> = arrayListOf() // 游戏补充库
|
||||
|
||||
init {
|
||||
loadSavedRepository()
|
||||
}
|
||||
private var mGameCollectionList: List<SubjectEntity>? = null // 游戏补充库
|
||||
|
||||
/**
|
||||
* 获取游戏补充库
|
||||
@ -43,48 +33,26 @@ object GameSubstituteRepositoryHelper {
|
||||
fun updateGameSubstituteRepository() {
|
||||
mApi.reserveColumns
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(object : Response<List<SubjectEntity>>() {
|
||||
override fun onResponse(response: List<SubjectEntity>?) {
|
||||
.subscribe(object : Response<ResponseBody>() {
|
||||
override fun onResponse(response: ResponseBody?) {
|
||||
super.onResponse(response)
|
||||
|
||||
updateGameRepository(response)
|
||||
if (response != null) {
|
||||
updateGameRepository(response)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 联网获取历史已安装过的游戏 ID 列表
|
||||
* 包括根据用户 ID 获取的已玩游戏 ID 列表,以及根据 gid 获取的已下载游戏 ID 列表
|
||||
*/
|
||||
@JvmStatic
|
||||
@SuppressLint("CheckResult")
|
||||
fun updateHistoricInstalledGameSet() {
|
||||
mApplicationContext.doOnMainProcessOnly {
|
||||
val single = if (UserManager.getInstance().isLoggedIn) {
|
||||
mApi.getIdListOfPlayedGames(UserManager.getInstance().userId, Utils.getTime(mApplicationContext))
|
||||
} else {
|
||||
mApi.getIdListOfDownloadedGames(HaloApp.getInstance().gid, Utils.getTime(mApplicationContext))
|
||||
}
|
||||
single.subscribeOn(Schedulers.io()).subscribe(object : BiResponse<List<String>>() {
|
||||
override fun onSuccess(data: List<String>) {
|
||||
mHistoricInstalledGameIdSet = data.toHashSet()
|
||||
}
|
||||
})
|
||||
private fun updateGameRepository(response: ResponseBody) {
|
||||
val responseContent = response.string()
|
||||
SPUtils.setString(mGameSubSp, KEY_GAME_REPOSITORY, responseContent)
|
||||
|
||||
if (mGameCollectionList?.isEmpty() == true) {
|
||||
mGameCollectionList = responseContent.toObject()
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadSavedRepository() {
|
||||
mGameCollectionList = SPUtils.getString(mGameSubSp, KEY_GAME_REPOSITORY).toObject() ?: arrayListOf()
|
||||
}
|
||||
|
||||
private fun updateGameRepository(subjects: List<SubjectEntity>?) {
|
||||
if (subjects == null) return
|
||||
|
||||
SPUtils.setString(mGameSubSp, KEY_GAME_REPOSITORY, subjects.toJson())
|
||||
|
||||
mGameCollectionList = subjects
|
||||
}
|
||||
|
||||
/**
|
||||
* 从补充游戏库相应的专题中取出一个与其它游戏都不相同的游戏,为空时即为游戏用完或不存在该相应专题
|
||||
* @param collectionId 补充游戏库相应专题 ID
|
||||
@ -92,7 +60,7 @@ object GameSubstituteRepositoryHelper {
|
||||
*/
|
||||
private fun getValidGame(collectionId: String?, gameIdList: HashSet<String>): GameEntity? {
|
||||
collectionId?.let {
|
||||
val collection = mGameCollectionList.find { it.id == collectionId }
|
||||
val collection = mGameCollectionList?.find { it.id == collectionId }
|
||||
collection?.let {
|
||||
val game = collection.data?.find { game -> isThisGameValid(game, gameIdList) }
|
||||
game?.let {
|
||||
@ -113,10 +81,12 @@ object GameSubstituteRepositoryHelper {
|
||||
* @param relatedCollectionId 关联的替换合集 ID
|
||||
*/
|
||||
fun replaceGames(
|
||||
gameList: MutableList<GameEntity>,
|
||||
gameList: MutableList<GameEntity>?,
|
||||
displayingGameIdSet: HashSet<String>,
|
||||
relatedCollectionId: String,
|
||||
) {
|
||||
if (gameList == null) return
|
||||
|
||||
// 需要被替换的游戏 position 列表
|
||||
val positionOfGameToBeReplacedList = arrayListOf<Int>()
|
||||
|
||||
@ -131,21 +101,13 @@ object GameSubstituteRepositoryHelper {
|
||||
// 这个 position 的游戏是否需要被替换
|
||||
var thisPositionNeedToBeReplaced = false
|
||||
|
||||
// 从 游戏ID 判断当前游戏是否需要被替换
|
||||
if (mHistoricInstalledGameIdSet.contains(game.id)) {
|
||||
positionOfGameToBeReplacedList.add(index)
|
||||
thisPositionNeedToBeReplaced = true
|
||||
}
|
||||
|
||||
// 检查是否已安装该游戏里同包名的 APK
|
||||
if (!thisPositionNeedToBeReplaced) {
|
||||
for (apk in game.getApk()) {
|
||||
if (PackageHelper.validLocalPackageNameSet.contains(apk.packageName)) {
|
||||
// 将该位置的游戏标记为需要替换
|
||||
positionOfGameToBeReplacedList.add(index)
|
||||
thisPositionNeedToBeReplaced = true
|
||||
break
|
||||
}
|
||||
for (apk in game.getApk()) {
|
||||
if (PackageHelper.validLocalPackageNameSet.contains(apk.packageName)) {
|
||||
// 将该位置的游戏标记为需要替换
|
||||
positionOfGameToBeReplacedList.add(index)
|
||||
thisPositionNeedToBeReplaced = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +130,14 @@ object GameSubstituteRepositoryHelper {
|
||||
}
|
||||
}
|
||||
|
||||
// 若待替换的位置列表不为空,尝试执行替换
|
||||
if (positionOfGameToBeReplacedList.isNotEmpty()) {
|
||||
if (mGameCollectionList == null) {
|
||||
mGameCollectionList = SPUtils.getString(mGameSubSp, KEY_GAME_REPOSITORY).toObject() ?: arrayListOf()
|
||||
}
|
||||
|
||||
if (mGameCollectionList.isNullOrEmpty()) return
|
||||
|
||||
for (position in positionOfGameToBeReplacedList) {
|
||||
val validGame = getValidGame(relatedCollectionId, displayingGameIdSet)
|
||||
validGame?.let {
|
||||
@ -188,9 +157,6 @@ object GameSubstituteRepositoryHelper {
|
||||
game: GameEntity,
|
||||
gameIdList: HashSet<String>
|
||||
): Boolean {
|
||||
// 该游戏是否在历史已安装列表中
|
||||
if (mHistoricInstalledGameIdSet.contains(game.id)) return false
|
||||
|
||||
// 该游戏是否与专题里已包含的游戏存在关联关系
|
||||
for (relatedId in game.relatedGameIds!!) {
|
||||
if (gameIdList.contains(relatedId)) {
|
||||
|
||||
@ -2,20 +2,15 @@ package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.common.view.DrawableView;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.feature.entity.TagStyleEntity;
|
||||
|
||||
@ -75,11 +70,6 @@ public class GameViewUtils {
|
||||
|
||||
// 新的游戏标签样式 version>=4.0.0
|
||||
private static TextView getNewGameTagView(Context context, TagStyleEntity tagEntity, int rightMargin) {
|
||||
// 参数不全,用旧样式实现
|
||||
if (TextUtils.isEmpty(tagEntity.getBackground())) {
|
||||
return getGameTagView(context, tagEntity.getName(), rightMargin, "type", tagEntity);
|
||||
}
|
||||
|
||||
TextView tag = new TextView(context);
|
||||
updateTagStyle(context, tag, tagEntity, rightMargin);
|
||||
return tag;
|
||||
@ -108,57 +98,6 @@ public class GameViewUtils {
|
||||
textView.setBackground(DrawableView.getServerDrawable(ExtensionsKt.hexStringToIntColor("#" + tagEntity.getBackground(), Color.WHITE)));
|
||||
}
|
||||
|
||||
private static TextView getGameTagView(Context context, String tagStr, int rightMargin, String tagType, TagStyleEntity tagEntity) {
|
||||
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
|
||||
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
lparams.rightMargin = rightMargin;
|
||||
TextView tag = new TextView(context);
|
||||
tag.setTextSize(TypedValue.COMPLEX_UNIT_SP, 9);
|
||||
tag.setSingleLine(true);
|
||||
tag.setText(tagStr);
|
||||
if ("官方版".equals(tagStr) || "已关注".equals(tagStr)) {
|
||||
tag.setBackgroundResource(R.drawable.border_green_bg);
|
||||
tag.setTextColor(ContextCompat.getColor(context, R.color.tag_green));
|
||||
} else {
|
||||
String colorStr;
|
||||
|
||||
if (!TextUtils.isEmpty(tagType) && "type".equals(tagType) && tagEntity != null) { // 游戏标签
|
||||
colorStr = "#" + tagEntity.getColor();
|
||||
GradientDrawable gradientDrawable = new GradientDrawable();
|
||||
|
||||
if ("border".equals(tagEntity.getStyle())) {
|
||||
gradientDrawable.setColor(Color.TRANSPARENT);
|
||||
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
|
||||
tag.setTextColor(ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
|
||||
} else {
|
||||
gradientDrawable.setColor(ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
|
||||
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
|
||||
tag.setTextColor(Color.WHITE);
|
||||
}
|
||||
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(3F));
|
||||
tag.setBackgroundDrawable(gradientDrawable);
|
||||
} else {
|
||||
colorStr = TagUtils.getInstance(context).getColor(tagStr);
|
||||
if (colorStr == null) {
|
||||
return null;
|
||||
}
|
||||
int color = ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE);
|
||||
GradientDrawable gradientDrawable = new GradientDrawable();
|
||||
gradientDrawable.setColor(Color.TRANSPARENT);
|
||||
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), color);
|
||||
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(3F));
|
||||
tag.setBackgroundDrawable(gradientDrawable);
|
||||
tag.setTextColor(color);
|
||||
}
|
||||
}
|
||||
tag.setLayoutParams(lparams);
|
||||
tag.setPadding(DisplayUtils.dip2px(context, 4),
|
||||
0,
|
||||
DisplayUtils.dip2px(context, 4),
|
||||
DisplayUtils.dip2px(context, 1));
|
||||
return tag;
|
||||
}
|
||||
|
||||
public static String getGameTestDate(long testTime) {
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
|
||||
|
||||
@ -1,15 +1,20 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import com.gh.common.util.ViewPagerFragmentHelper.TYPE_MY_HALO
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.entity.Display
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.utils.toJson
|
||||
import com.gh.gamecenter.core.utils.GsonUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.entity.BottomTab
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
object HomeBottomBarHelper {
|
||||
private const val GAME_BAR_KEY = "game_bar_key"
|
||||
private const val VIDEO_BAR_KEY = "video_bar_key"
|
||||
private const val KEY_HOME_BOTTOM_TAB = "home_bottom_tab"
|
||||
|
||||
@JvmStatic
|
||||
fun getDefaultGameBarData(): SubjectRecommendEntity {
|
||||
@ -39,41 +44,37 @@ object HomeBottomBarHelper {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getDefaultVideoData(): SubjectRecommendEntity {
|
||||
fun getDefaultBottomTabHomeEntity(): BottomTab {
|
||||
val animationCode = HaloApp.getInstance().application.assets
|
||||
.open("lottie/tab_home.json")
|
||||
.bufferedReader().use { it.readText() }
|
||||
return BottomTab(name = "首页", jsCode = animationCode, iconSelector = R.drawable.selector_ic_home, default = true)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getDefaultBottomTabMineEntity(): BottomTab {
|
||||
val animationCode = HaloApp.getInstance().application.assets
|
||||
.open("lottie/tab_mine.json")
|
||||
.bufferedReader().use { it.readText() }
|
||||
return BottomTab(name = "我的光环", jsCode = animationCode, iconSelector = R.drawable.selector_ic_user, link = LinkEntity(type = TYPE_MY_HALO))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getDefaultHomeBottomTabData(): List<BottomTab> {
|
||||
try {
|
||||
val json = SPUtils.getString(VIDEO_BAR_KEY)
|
||||
val json = SPUtils.getString(KEY_HOME_BOTTOM_TAB)
|
||||
if (json.isNotEmpty()) {
|
||||
return GsonUtils.fromJson(json, SubjectRecommendEntity::class.java)
|
||||
val type = object : TypeToken<List<BottomTab>>() {}.type
|
||||
return GsonUtils.gson.fromJson(json, type)
|
||||
}
|
||||
} catch (ignore: Exception) {
|
||||
|
||||
}
|
||||
return getDefaultVideoEntity()
|
||||
return listOf(getDefaultBottomTabHomeEntity(), getDefaultBottomTabMineEntity())
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getDefaultVideoEntity(): SubjectRecommendEntity {
|
||||
val animationCode = HaloApp.getInstance().application.assets
|
||||
.open("lottie/tab_video.json")
|
||||
.bufferedReader().use { it.readText() }
|
||||
return SubjectRecommendEntity(
|
||||
type = "video_stream",
|
||||
text = "视频",
|
||||
name = "视频",
|
||||
position = 4,
|
||||
animationCode = animationCode,
|
||||
default = false,
|
||||
display = Display()
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun updateDefaultGameBarData(data: SubjectRecommendEntity) {
|
||||
SPUtils.setString(GAME_BAR_KEY, data.toJson())
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun updateDefaultVideoBarData(data: SubjectRecommendEntity) {
|
||||
SPUtils.setString(VIDEO_BAR_KEY, data.toJson())
|
||||
fun updateDefaultHomeBottomTabData(data: List<BottomTab>) {
|
||||
SPUtils.setString(KEY_HOME_BOTTOM_TAB, data.toJson())
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,18 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import com.gh.gamecenter.common.utils.toastInInternalRelease
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.tracker.Tracker
|
||||
import com.gh.gamecenter.common.utils.tryCatchInRelease
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.entity.HomePluggableFilterEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.home.PluginDisplayStatus
|
||||
import com.gh.gamecenter.room.AppDatabase
|
||||
|
||||
/**
|
||||
* 首页插件化区域辅助类
|
||||
* 插件化区域辅助类
|
||||
*/
|
||||
object HomePluggableHelper {
|
||||
|
||||
@ -18,19 +23,67 @@ object HomePluggableHelper {
|
||||
val apkList = gameEntity.getApk()
|
||||
if (apkList.isNotEmpty()) {
|
||||
val apk = apkList.first()
|
||||
val tag = if (isNever) "never" else apk.version ?: ""
|
||||
tryCatchInRelease {
|
||||
mHomePluggableFilterDao.addData(
|
||||
HomePluggableFilterEntity(
|
||||
pkgName = apk.packageName,
|
||||
tag = tag,
|
||||
active = isNever
|
||||
)
|
||||
)
|
||||
val apkHash = MD5Utils.getContentMD5(gameEntity.id + apk.version)
|
||||
val tag = if (isNever) "never" else apkHash
|
||||
runOnIoThread {
|
||||
tryCatchInRelease {
|
||||
val filterData = mHomePluggableFilterDao.getDataByPkgName(apk.packageName)
|
||||
if (filterData != null && !filterData.tag.contains(tag)) {
|
||||
filterData.tag = filterData.tag + "," + tag
|
||||
mHomePluggableFilterDao.addData(filterData)
|
||||
} else {
|
||||
mHomePluggableFilterDao.addData(
|
||||
HomePluggableFilterEntity(
|
||||
pkgName = apk.packageName,
|
||||
tag = tag,
|
||||
active = true
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取插件化区域显示样式
|
||||
*/
|
||||
fun getPluginDisplayedStyle(pluginList: List<Any>?): PluginDisplayStatus {
|
||||
if (pluginList.isNullOrEmpty()) {
|
||||
return PluginDisplayStatus.DEFAULT
|
||||
}
|
||||
|
||||
val shouldShowCollapsedStyle = shouldShowCollapsedStyle()
|
||||
return if (shouldShowCollapsedStyle) {
|
||||
PluginDisplayStatus.CLOSE
|
||||
} else {
|
||||
setPluginAreaShowed()
|
||||
|
||||
if (pluginList.size > 2) {
|
||||
PluginDisplayStatus.OPEN_TWO_AND_BUTTON
|
||||
} else {
|
||||
PluginDisplayStatus.OPEN
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否需要把插件化区域显示为收起样式
|
||||
* https://jira.shanqu.cc/browse/GHZS-4725
|
||||
*/
|
||||
private fun shouldShowCollapsedStyle(): Boolean {
|
||||
val launchId = SPUtils.getString(Constants.SP_PLUGIN_AREA_SHOWED_LAUNCH_ID)
|
||||
return if (launchId.isEmpty()) {
|
||||
false
|
||||
} else {
|
||||
Tracker.launchId != launchId
|
||||
}
|
||||
}
|
||||
|
||||
private fun setPluginAreaShowed() {
|
||||
SPUtils.setString(Constants.SP_PLUGIN_AREA_SHOWED_LAUNCH_ID, Tracker.launchId)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showHomePluggable(gameEntity: GameEntity): Boolean {
|
||||
val apkList = gameEntity.getApk()
|
||||
@ -38,9 +91,9 @@ object HomePluggableHelper {
|
||||
val apk = apkList.first()
|
||||
tryCatchInRelease {
|
||||
val filterData = mHomePluggableFilterDao.getDataByPkgName(apk.packageName)
|
||||
if (filterData?.active == true) {
|
||||
if (filterData != null) {
|
||||
val filterTag = filterData.tag
|
||||
return filterTag != "never" && apk.version != filterTag
|
||||
return !filterTag.contains("never") && !filterTag.contains(MD5Utils.getContentMD5(gameEntity.id + apk.version))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,20 +108,4 @@ object HomePluggableHelper {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun activationFilterData() {
|
||||
try {
|
||||
val filterList = mHomePluggableFilterDao.getDataByActive(false)
|
||||
|
||||
if (filterList != null) {
|
||||
for (entity in filterList) {
|
||||
entity.active = true
|
||||
}
|
||||
mHomePluggableFilterDao.addData(filterList)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
toastInInternalRelease("插件化筛选出现异常")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -566,7 +566,7 @@ public class MessageShareUtils {
|
||||
String path;
|
||||
// 安卓11无法访问Android/data目录
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/ShareImg/";
|
||||
path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath() + "/ShareImg/";
|
||||
} else {
|
||||
path = context.getExternalCacheDir().getPath() + "/ShareImg/";
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ import com.gh.gamecenter.vpn.VpnHelper
|
||||
import com.gh.vspace.VHelper
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.Utils
|
||||
import java.io.File
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@ import androidx.webkit.WebViewCompat;
|
||||
import com.android.apksig.ApkVerifier;
|
||||
import com.android.apksig.internal.apk.ApkSigningBlockUtilsLite;
|
||||
import com.g00fy2.versioncompare.Version;
|
||||
import com.gh.common.filter.RegionSettingHelper;
|
||||
import com.gh.common.xapk.XapkInstaller;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
@ -72,8 +71,6 @@ public class PackageUtils {
|
||||
private static long mLastInstalledPackageListTime = 0L;
|
||||
private static List<PackageInfo> mInstalledPackageList = null;
|
||||
|
||||
public static final String publicKey = "OpenSSLRSAPublicKey{modulus=a8c4bb5748fec8d5c35db1a7a182d41ba4721a91131a417330af79ef4ddb43f9fa0ff4907b0a613bfe152de0ed8fc1b2e6f94a908aa98a5f7adc1ce814ba7ec919d75d9910bdfd8649b4789da6a90ffb61f0d23ac4f828a78fcd0d6f6120c1c43c1f87f7498a89eb40ca8e32dfc2f9d5c10d612b95192870223674e241e53305abf320d7eed76ded398778576e4db7b17b3bc6a792f13de5e43a6a5fae4276c73e6990ce97f68dff0ec16fc9594f175c8d49cd0d7877340d9de60942ca0efc737e50b6c295dfe0713e4532b4e810e1ea11b702b4a27753e41559cbceb247e7f044ec4e3ab2e8bccd8b9fd71286e63307550bcde86deee95adb8133076269135b,publicExponent=10001}";
|
||||
|
||||
private static final String TAG = "PackageUtils";
|
||||
|
||||
// 设备是否支持禁用获取已安装应用列表。-1 代表支持情况未知,0 代表不支持, 1 代表支持
|
||||
@ -151,14 +148,8 @@ public class PackageUtils {
|
||||
}
|
||||
}
|
||||
|
||||
// 镜像游戏,使用镜像 Apk 替换掉原来的 ApkNormal
|
||||
if (RegionSettingHelper.shouldThisGameDisplayMirrorInfo(gameEntity.getId())) {
|
||||
gameEntity.setApkNormal(gameEntity.getApk());
|
||||
}
|
||||
|
||||
// 非插件游戏更新
|
||||
for (ApkEntity apkEntity : gameEntity.getApkNormal()) {
|
||||
|
||||
for (ApkEntity apkEntity : gameEntity.getApk()) {
|
||||
// ghVersion 不存在即是非插件游戏
|
||||
if (TextUtils.isEmpty(apkEntity.getGhVersion())) {
|
||||
int versionCodeFromRequest = apkEntity.getVersionCode();
|
||||
@ -299,11 +290,13 @@ public class PackageUtils {
|
||||
|
||||
|
||||
/*
|
||||
* 判断是否是插件包
|
||||
* 判断是否为光环签名
|
||||
*/
|
||||
public static boolean isSignedByGh(Context context, String packageName) {
|
||||
String signature = getApkSignatureByPackageName(context, packageName)[0];
|
||||
return publicKey.equals(signature);
|
||||
|
||||
// 判断当前已安装应用是否为光环签名。若签名列表为空,直接判断为光环签名
|
||||
return signature == null || SignatureRepository.isSignEmpty() || SignatureRepository.isSignMatched(signature);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -460,7 +453,7 @@ public class PackageUtils {
|
||||
}
|
||||
|
||||
// 判断当前已安装应用是否为光环签名
|
||||
if (publicKey.equals(getApkSignatureByPackageName(context, packageName)[0])) {
|
||||
if (isSignedByGh(context, packageName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.ShellActivity
|
||||
@ -14,10 +16,19 @@ import com.lightgame.download.DownloadStatus
|
||||
|
||||
object RealNameHelper {
|
||||
|
||||
var pendingInstallPkgPath = ""
|
||||
private var pendingInstallPkgPath = ""
|
||||
|
||||
// 0表示未实名,1表示未成年,2表示成年
|
||||
private var mCertificationStatus: Int = 0
|
||||
private var certificationStatus: Int = 0
|
||||
|
||||
private val _realNameInfoUpdateLiveData = MutableLiveData<Any>()
|
||||
val realNameInfoUpdateLiveData = _realNameInfoUpdateLiveData as LiveData<Any>
|
||||
|
||||
fun updatePendingInstallPkgPath(path: String) {
|
||||
pendingInstallPkgPath = path
|
||||
}
|
||||
|
||||
fun getPendingInstallPkgPath() = pendingInstallPkgPath
|
||||
|
||||
/**
|
||||
* 弹未成年人不能下载游戏弹窗
|
||||
@ -130,11 +141,15 @@ object RealNameHelper {
|
||||
}
|
||||
}
|
||||
|
||||
fun onRealNameInfoUpdated() {
|
||||
_realNameInfoUpdateLiveData.postValue(Any())
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实名状态 0表示未实名,1表示未成年,2表示成年
|
||||
*/
|
||||
fun getCertificationStatus(): Int {
|
||||
return mCertificationStatus
|
||||
return certificationStatus
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,7 +157,7 @@ object RealNameHelper {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun updateCertificationStatus(newCertificationStatus: Int) {
|
||||
mCertificationStatus = newCertificationStatus
|
||||
certificationStatus = newCertificationStatus
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.common.dialog.DeviceRemindDialog
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.core.utils.GsonUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.TimeUtils
|
||||
@ -39,7 +39,7 @@ object RecommendPopupHelper {
|
||||
|
||||
//判断是否符合安装包大小限制
|
||||
val minSize = entity.recommendPackage.minSize
|
||||
val sizeStr = gameEntity.getApk()[0].size ?: continue
|
||||
val sizeStr = gameEntity.getApk().firstOrNull()?.size ?: continue
|
||||
val size = sizeStr.substring(0, sizeStr.length - 2).toFloat()
|
||||
if (size < minSize) continue
|
||||
|
||||
|
||||
65
app/src/main/java/com/gh/common/util/SignatureRepository.kt
Normal file
65
app/src/main/java/com/gh/common/util/SignatureRepository.kt
Normal file
@ -0,0 +1,65 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.gh.gamecenter.common.entity.SignatureEntity
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse
|
||||
import com.gh.gamecenter.common.utils.singleToMain
|
||||
import com.gh.gamecenter.common.utils.toJson
|
||||
import com.gh.gamecenter.common.utils.toObject
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
|
||||
/**
|
||||
* 存储光环网游使用的签名
|
||||
*/
|
||||
object SignatureRepository {
|
||||
|
||||
private const val SP_SIGN_DIGEST_LIST = "sign_digest_list"
|
||||
|
||||
private var signDigestList: ArrayList<String>? = null
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun init() {
|
||||
RetrofitManager.getInstance()
|
||||
.newApi
|
||||
.ghSignature
|
||||
.compose(singleToMain())
|
||||
.subscribe(object : BiResponse<ArrayList<SignatureEntity>>() {
|
||||
override fun onSuccess(data: ArrayList<SignatureEntity>) {
|
||||
signDigestList = ArrayList()
|
||||
|
||||
for (i in data) {
|
||||
signDigestList?.add(i.signMd5)
|
||||
}
|
||||
|
||||
SPUtils.setString(SP_SIGN_DIGEST_LIST, signDigestList?.toJson() ?: "")
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
|
||||
signDigestList = SPUtils.getString(SP_SIGN_DIGEST_LIST).toObject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名列表是否为空
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isSignEmpty(): Boolean {
|
||||
return signDigestList.isNullOrEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名是否匹配已知的签名
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isSignMatched(sign: String): Boolean {
|
||||
val signDigest = MD5Utils.getContentMD5(sign)
|
||||
|
||||
return signDigestList?.contains(signDigest) == true
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,94 +0,0 @@
|
||||
package com.gh.common.util;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.collection.ArrayMap;
|
||||
|
||||
import com.gh.gamecenter.entity.TagEntity;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.HttpException;
|
||||
|
||||
public class TagUtils {
|
||||
|
||||
private static TagUtils mInstance;
|
||||
|
||||
private Context context;
|
||||
|
||||
private ArrayMap<String, String> colorMap;
|
||||
private boolean isUpdate = false;
|
||||
|
||||
private TagUtils(Context con) {
|
||||
this.context = con.getApplicationContext();
|
||||
initTag();
|
||||
}
|
||||
|
||||
public static TagUtils getInstance(Context context) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new TagUtils(context);
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
private void initTag() {
|
||||
colorMap = new ArrayMap<>();
|
||||
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences("gh_tag", Context.MODE_PRIVATE);
|
||||
Set<String> set = sharedPreferences.getStringSet("tag", null);
|
||||
if (set == null) {
|
||||
getTag();
|
||||
} else {
|
||||
for (String str : set) {
|
||||
String[] platform = str.split("=");
|
||||
colorMap.put(platform[0], platform[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getColor(String tag) {
|
||||
String color = colorMap.get(tag);
|
||||
if (color == null) {
|
||||
getTag();
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
public void getTag() {
|
||||
if (isUpdate) {
|
||||
return;
|
||||
}
|
||||
isUpdate = true;
|
||||
RetrofitManager.getInstance().getApi().getTags()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<TagEntity>>() {
|
||||
@Override
|
||||
public void onResponse(List<TagEntity> response) {
|
||||
Set<String> tagSet = new HashSet<>();
|
||||
for (TagEntity tagEntity : response) {
|
||||
tagSet.add(tagEntity.getName() + "=" + tagEntity.getColor());
|
||||
}
|
||||
SharedPreferences sp = context.getSharedPreferences("gh_tag", Context.MODE_PRIVATE);
|
||||
sp.edit().putStringSet("tag", tagSet).apply();
|
||||
initTag();
|
||||
|
||||
isUpdate = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException e) {
|
||||
isUpdate = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
256
app/src/main/java/com/gh/common/util/ViewPagerFragmentHelper.kt
Normal file
256
app/src/main/java/com/gh/common/util/ViewPagerFragmentHelper.kt
Normal file
@ -0,0 +1,256 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.gh.common.iinterface.ISuperiorChain
|
||||
import com.gh.gamecenter.amway.AmwayFragment
|
||||
import com.gh.gamecenter.category2.CategoryV2Fragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.discovery.DiscoveryFragment
|
||||
import com.gh.gamecenter.entity.SubjectData
|
||||
import com.gh.gamecenter.feedback.view.help.HelpAndFeedbackFragment
|
||||
import com.gh.gamecenter.feedback.view.qa.HelpContainerFragment
|
||||
import com.gh.gamecenter.forum.detail.ForumDetailFragment
|
||||
import com.gh.gamecenter.forum.home.CommunityHomeFragment
|
||||
import com.gh.gamecenter.fragment.ReloadFragment
|
||||
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailFragment
|
||||
import com.gh.gamecenter.game.commoncollection.detail.CustomCommonCollectionDetailFragment
|
||||
import com.gh.gamecenter.gamecollection.hotlist.GameCollectionHotListWrapperFragment
|
||||
import com.gh.gamecenter.gamecollection.square.GameCollectionSquareFragment
|
||||
import com.gh.gamecenter.gamedetail.GameDetailFragment
|
||||
import com.gh.gamecenter.info.InfoWrapperFragment
|
||||
import com.gh.gamecenter.libao.LibaoDetailFragment
|
||||
import com.gh.gamecenter.libao.LibaoFragment
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailFragment
|
||||
import com.gh.gamecenter.personal.HaloPersonalFragment
|
||||
import com.gh.gamecenter.qa.article.detail.ArticleDetailFragment
|
||||
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailFragment
|
||||
import com.gh.gamecenter.qa.subject.AskSubjectFragment
|
||||
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailFragment
|
||||
import com.gh.gamecenter.servers.GameServersPublishFragment
|
||||
import com.gh.gamecenter.servers.gametest2.GameServerTestV2Fragment
|
||||
import com.gh.gamecenter.subject.SubjectFragment
|
||||
import com.gh.gamecenter.tag.TagsActivity
|
||||
import com.gh.gamecenter.tag.TagsListFragment
|
||||
import com.gh.gamecenter.toolbox.ToolboxFragment
|
||||
import com.gh.gamecenter.video.detail.HomeVideoFragment
|
||||
import com.gh.gamecenter.wrapper.ToolbarWrapperFragment
|
||||
import com.halo.assistant.fragment.WebFragment
|
||||
|
||||
/**
|
||||
* 通用跳转Fragment方法
|
||||
* @see <a href="https://wiki.shanqu.cc/pages/viewpage.action?pageId=102828538">WIKI</a>
|
||||
*/
|
||||
object ViewPagerFragmentHelper {
|
||||
const val WRAPPER_FRAGMENT_NAME = "WrapperFragmentName"
|
||||
|
||||
const val TYPE_MULTI_TAB_NAV = "multi_tab_nav"
|
||||
const val TYPE_CUSTOM_PAGE = "custom_page"
|
||||
|
||||
const val TYPE_GAME = "game" // 游戏详情页
|
||||
const val TYPE_MY_HALO = "my_halo" // 我的光环
|
||||
const val TYPE_COMMUNITY_HOME = "community_home" // 社区首页
|
||||
const val TYPE_COMMUNITY = "community" // 论坛
|
||||
const val TYPE_COMMUNITY_SECTION = "bbs_section" // 论坛子版块
|
||||
const val TYPE_COMMUNITY_ARTICLE = "community_article" // 帖子
|
||||
const val TYPE_QUESTION = "question" // 提问
|
||||
const val TYPE_VIDEO_STREAM = "video_stream" // 视频信息流
|
||||
const val TYPE_VIDEO = "video" // 视频贴
|
||||
const val TYPE_AMWAY = "top_game_comment" // 安利墙
|
||||
const val TYPE_GAME_HOT_LIST = "game_hot_list" // 游戏单热搜榜
|
||||
const val TYPE_GAME_LIST = "game_list" // 游戏单广场
|
||||
const val TYPE_FEEDBACK = "feedback" // 帮助与反馈
|
||||
const val TYPE_COLUMN = "column" // 游戏专题详情页
|
||||
const val TYPE_QQ_MINI_GAME_COLUMN = "qq_mini_game_column_detail" // QQ游戏专题详情页
|
||||
const val TYPE_COLUMN_COLLECTION = "column_collection" // 专题合集详情页
|
||||
const val TYPE_SERVER = "server" // 开服表
|
||||
const val TYPE_COLUMN_TEST = "column_test_v2" // 新游开测
|
||||
const val TYPE_CATEGORY_V2 = "category_v2" // 分类2.0
|
||||
const val TYPE_COMMON_COLLECTION = "common_collection" // 通用内容合集详情页
|
||||
const val TYPE_WEB = "web" // web链接
|
||||
const val TYPE_EXPLORE = "game_explore" // 发现页
|
||||
const val TYPE_LIBAO = "libao" // 礼包详情页
|
||||
const val TYPE_LIBAO_CENTER = "libao_center" // 礼包中心
|
||||
const val TYPE_TAG = "tag" // 游戏标签详情
|
||||
const val TYPE_ARTICLE = "article" // 文章
|
||||
const val TYPE_COMMUNITY_COLUMN = "community_column" // 社区专题
|
||||
const val TYPE_ARTICLE_CENTER = "article_center" // 资讯中心
|
||||
const val TYPE_QA = "qa" // QA
|
||||
const val TYPE_TOOLKIT = "toolkit" // 工具箱
|
||||
|
||||
fun createFragment(parentFragment: Fragment?, bundle: Bundle, linkEntity: LinkEntity, isTabWrapper: Boolean): Fragment {
|
||||
return when (linkEntity.type) {
|
||||
// 游戏详情页
|
||||
TYPE_GAME -> {
|
||||
bundle.putString(EntranceConsts.KEY_GAMEID, linkEntity.link)
|
||||
GameDetailFragment().with(bundle)
|
||||
}
|
||||
// 我的光环
|
||||
TYPE_MY_HALO -> {
|
||||
val superiorChain = if (parentFragment is ISuperiorChain) parentFragment else null
|
||||
HaloPersonalFragment().setSuperiorChain(superiorChain).with(bundle)
|
||||
}
|
||||
// 社区首页
|
||||
TYPE_COMMUNITY_HOME -> CommunityHomeFragment().with(bundle)
|
||||
// 视频信息流
|
||||
TYPE_VIDEO_STREAM -> {
|
||||
bundle.putBoolean(EntranceConsts.KEY_IS_HOME_VIDEO, true)
|
||||
HomeVideoFragment().with(bundle)
|
||||
}
|
||||
// 安利墙
|
||||
TYPE_AMWAY -> {
|
||||
AmwayFragment().with(bundle)
|
||||
}
|
||||
// 论坛
|
||||
TYPE_COMMUNITY -> {
|
||||
bundle.putString(EntranceConsts.KEY_BBS_ID, linkEntity.link)
|
||||
ForumDetailFragment().with(bundle)
|
||||
}
|
||||
// 论坛子版块
|
||||
TYPE_COMMUNITY_SECTION -> {
|
||||
bundle.putString(EntranceConsts.KEY_BBS_ID, linkEntity.community?.id)
|
||||
bundle.putString(EntranceConsts.KEY_BBS_SECTION_ID, linkEntity.link)
|
||||
ForumDetailFragment().with(bundle)
|
||||
}
|
||||
// 游戏单热搜榜
|
||||
TYPE_GAME_HOT_LIST -> {
|
||||
GameCollectionHotListWrapperFragment().with(bundle)
|
||||
}
|
||||
// 视频贴
|
||||
TYPE_VIDEO -> {
|
||||
bundle.putString(EntranceConsts.KEY_VIDEO_ID, linkEntity.link)
|
||||
ForumVideoDetailFragment().with(bundle)
|
||||
}
|
||||
// 帮助与反馈
|
||||
TYPE_FEEDBACK -> {
|
||||
HelpAndFeedbackFragment().with(bundle)
|
||||
}
|
||||
// 帖子
|
||||
TYPE_COMMUNITY_ARTICLE -> {
|
||||
bundle.putString(EntranceConsts.KEY_COMMUNITY_ARTICLE_ID, linkEntity.link)
|
||||
bundle.putParcelable(EntranceConsts.KEY_COMMUNITY_DATA, linkEntity.community)
|
||||
ArticleDetailFragment().with(bundle)
|
||||
}
|
||||
// 提问
|
||||
TYPE_QUESTION -> {
|
||||
bundle.putString(EntranceConsts.KEY_QUESTIONS_ID, linkEntity.link)
|
||||
NewQuestionDetailFragment().with(bundle)
|
||||
}
|
||||
// 其他原来带Toolbar的Fragment
|
||||
else -> createToolbarWrapperFragment(bundle, linkEntity, isTabWrapper)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createToolbarWrapperFragment(bundle: Bundle, entity: LinkEntity, isTabWrapper: Boolean): Fragment {
|
||||
var className = ReloadFragment::class.java.name
|
||||
|
||||
when (entity.type) {
|
||||
// 游戏单广场
|
||||
TYPE_GAME_LIST -> {
|
||||
className = GameCollectionSquareFragment::class.java.name
|
||||
}
|
||||
// 游戏专题详情页/QQ游戏专题详情页
|
||||
TYPE_COLUMN, TYPE_QQ_MINI_GAME_COLUMN -> {
|
||||
className = SubjectFragment::class.java.name
|
||||
bundle.putParcelable(
|
||||
EntranceConsts.KEY_SUBJECT_DATA,
|
||||
SubjectData(entity.link, entity.text, false, isQQMiniGame = entity.type == "qq_mini_game_column_detail")
|
||||
)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SHOW_DOWNLOAD_MENU, !isTabWrapper)
|
||||
}
|
||||
// 专题合集详情页
|
||||
TYPE_COLUMN_COLLECTION -> {
|
||||
className = ColumnCollectionDetailFragment::class.java.name
|
||||
bundle.putString(EntranceConsts.KEY_COLLECTION_ID, entity.link)
|
||||
bundle.putInt(EntranceConsts.KEY_POSITION, 0)
|
||||
bundle.putString(EntranceConsts.KEY_COLUMNNAME, entity.text)
|
||||
bundle.putBoolean(EntranceConsts.KEY_IS_COLUMN_COLLECTION, true)
|
||||
}
|
||||
// 开服表
|
||||
TYPE_SERVER -> {
|
||||
className = GameServersPublishFragment::class.java.name
|
||||
bundle.putBoolean(EntranceConsts.KEY_SHOW_DOWNLOAD_MENU, !isTabWrapper)
|
||||
}
|
||||
// 新游开测
|
||||
TYPE_COLUMN_TEST -> {
|
||||
className = GameServerTestV2Fragment::class.java.name
|
||||
}
|
||||
// 分类2.0
|
||||
TYPE_CATEGORY_V2 -> {
|
||||
className = CategoryV2Fragment::class.java.name
|
||||
bundle.putString(EntranceConsts.KEY_CATEGORY_ID, entity.link)
|
||||
bundle.putString(EntranceConsts.KEY_CATEGORY_TITLE, entity.text)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SHOW_DOWNLOAD_MENU, !isTabWrapper)
|
||||
}
|
||||
// 通用内容合集详情页
|
||||
TYPE_COMMON_COLLECTION -> {
|
||||
className = CustomCommonCollectionDetailFragment::class.java.name
|
||||
bundle.putString(EntranceConsts.KEY_COLLECTION_ID, entity.link)
|
||||
bundle.putString(EntranceConsts.KEY_COLUMNNAME, entity.text)
|
||||
}
|
||||
// web链接
|
||||
TYPE_WEB -> {
|
||||
className = WebFragment::class.java.name
|
||||
bundle.putString(EntranceConsts.KEY_URL, entity.link)
|
||||
bundle.putBoolean(WebFragment.KEY_OPEN_NATIVE_PAGE, false)
|
||||
bundle.putBoolean(WebFragment.KEY_ENABLE_HORIZONTAL_SCROLL_DISPATCH, true)
|
||||
if (entity.link != null && entity.link!!.contains("leave_web_page_handle_back_pressed=true")) {
|
||||
bundle.putBoolean(WebFragment.KEY_LEAVE_WEB_PAGE_TO_HANDLE_BACK_PRESSED, true)
|
||||
}
|
||||
}
|
||||
// 发现页
|
||||
TYPE_EXPLORE -> {
|
||||
className = DiscoveryFragment::class.java.name
|
||||
}
|
||||
// 礼包详情页
|
||||
TYPE_LIBAO -> {
|
||||
className = LibaoDetailFragment::class.java.name
|
||||
bundle.putString(EntranceConsts.KEY_ID, entity.link)
|
||||
}
|
||||
// 游戏标签详情
|
||||
TYPE_TAG -> {
|
||||
className = TagsListFragment::class.java.name
|
||||
bundle.putBoolean(EntranceConsts.KEY_SHOW_DOWNLOAD_MENU, !isTabWrapper)
|
||||
bundle.putString(TagsActivity.TAG, entity.text)
|
||||
}
|
||||
// 文章
|
||||
TYPE_ARTICLE -> {
|
||||
className = NewsDetailFragment::class.java.name
|
||||
bundle.putString(EntranceConsts.KEY_NEWSID, entity.link)
|
||||
}
|
||||
// 社区专题
|
||||
TYPE_COMMUNITY_COLUMN -> {
|
||||
className = AskSubjectFragment::class.java.name
|
||||
bundle.putString(EntranceConsts.KEY_COLUMN_ID, entity.link)
|
||||
bundle.putParcelable(EntranceConsts.KEY_COMMUNITY_DATA, entity.community)
|
||||
}
|
||||
// QA
|
||||
TYPE_QA -> {
|
||||
className = HelpContainerFragment::class.java.name
|
||||
bundle.putString(EntranceConsts.KEY_QA_ID, entity.link)
|
||||
bundle.putString(EntranceConsts.KEY_NAVIGATION_TITLE, entity.text)
|
||||
}
|
||||
// 资讯中心
|
||||
TYPE_ARTICLE_CENTER -> {
|
||||
className = InfoWrapperFragment::class.java.name
|
||||
}
|
||||
// 礼包中心
|
||||
TYPE_LIBAO_CENTER -> {
|
||||
className = LibaoFragment::class.java.name
|
||||
}
|
||||
// 工具箱
|
||||
TYPE_TOOLKIT -> {
|
||||
className = ToolboxFragment::class.java.name
|
||||
}
|
||||
}
|
||||
|
||||
return if (isTabWrapper) {
|
||||
// 多Tab导航页不需要Toolbar
|
||||
(Class.forName(className).getDeclaredConstructor().newInstance() as Fragment).apply { arguments = bundle }
|
||||
} else {
|
||||
bundle.putString(WRAPPER_FRAGMENT_NAME, className)
|
||||
ToolbarWrapperFragment().with(bundle)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,19 +8,19 @@ import android.widget.LinearLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.facebook.drawee.drawable.ScalingUtils
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.ImageViewerActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.ImageUtils
|
||||
import com.gh.gamecenter.common.utils.debounceActionWithInterval
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.toResString
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.common.utils.ImageUtils
|
||||
import com.gh.gamecenter.core.utils.TopCutProcess
|
||||
import com.gh.gamecenter.databinding.ItemCommunityImageBinding
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.feature.entity.AnswerEntity
|
||||
import com.gh.gamecenter.feature.entity.CommunityVideoEntity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel
|
||||
|
||||
class ImageContainerView : LinearLayout {
|
||||
@ -159,10 +159,10 @@ class ImageContainerView : LinearLayout {
|
||||
binding.root.setOnClickListener {
|
||||
debounceActionWithInterval(it.id, 1000) {
|
||||
if (mAnswerEntity == null) return@debounceActionWithInterval
|
||||
val videoEntity = mAnswerEntity!!.getPassVideos()[0]
|
||||
val videoEntity = mAnswerEntity!!.getPassVideos().firstOrNull()
|
||||
DirectUtils.directToVideoDetail(
|
||||
context,
|
||||
videoEntity.id,
|
||||
videoEntity?.id ?: "",
|
||||
VideoDetailContainerViewModel.Location.VIDEO_HOT.value,
|
||||
showComment = false,
|
||||
entrance = mEntrance,
|
||||
|
||||
@ -4,15 +4,22 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.Settings
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.dialog.ManagerAllFilesPermissionDialogFragment
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.DownloadNotificationHelper
|
||||
import com.gh.common.util.PackageInstaller
|
||||
import com.gh.download.DownloadDataHelper
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.core.utils.SentryHelper
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.xapk.XApkUnZipper
|
||||
@ -20,10 +27,7 @@ import com.gh.gamecenter.xapk.core.XApkFile
|
||||
import com.gh.gamecenter.xapk.core.XApkUnZipCallback
|
||||
import com.gh.gamecenter.xapk.core.XApkUnZipEntry
|
||||
import com.gh.gamecenter.xapk.core.XApkUnZipOutputFactory
|
||||
import com.gh.gamecenter.xapk.io.NonSplitApksOutput
|
||||
import com.gh.gamecenter.xapk.io.OBBFileOutput
|
||||
import com.gh.gamecenter.xapk.io.SplitApksOutput
|
||||
import com.gh.gamecenter.xapk.io.XApkFileOutput
|
||||
import com.gh.gamecenter.xapk.io.*
|
||||
import com.gh.gamecenter.xapk.pi.IPackageInstaller
|
||||
import com.gh.ndownload.NDataChanger
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -110,9 +114,14 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
|
||||
return
|
||||
}
|
||||
|
||||
unzipXapkFile(downloadEntity)
|
||||
if (showUnzipToast) {
|
||||
Utils.toast(mContext, "解压过程请勿退出光环助手!")
|
||||
if (checkPermission(downloadEntity, showUnzipToast)) {
|
||||
DownloadManager.getInstance().getDownloadEntitySnapshot(downloadEntity.url, downloadEntity.gameId)
|
||||
?.let {
|
||||
unzipXapkFile(it)
|
||||
if (showUnzipToast) {
|
||||
Utils.toast(mContext, "解压过程请勿退出光环助手!")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throwExceptionInDebug("如果是Apk包请使用PackageInstaller进行安装")
|
||||
@ -120,6 +129,23 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkPermission(downloadEntity: DownloadEntity, showUnzipToast: Boolean = false): Boolean {
|
||||
// 安卓11以上系统需要开启所有文件访问权限
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
|
||||
&& !Environment.isExternalStorageManager()) {
|
||||
CurrentActivityHolder.getCurrentActivity()?.let {
|
||||
ManagerAllFilesPermissionDialogFragment.show(it as AppCompatActivity) {
|
||||
unzipXapkFile(downloadEntity)
|
||||
if (showUnzipToast) {
|
||||
Utils.toast(mContext, "解压过程请勿退出光环助手!")
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun unzipXapkFile(downloadEntity: DownloadEntity) {
|
||||
mXApkUnZipper.unzip(
|
||||
XApkUnZipEntry(
|
||||
|
||||
@ -2,15 +2,11 @@ package com.gh.common.xapk
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import com.gh.gamecenter.common.utils.debounceActionWithInterval
|
||||
import com.gh.gamecenter.common.utils.getExtension
|
||||
import com.gh.gamecenter.common.utils.throwException
|
||||
import com.gh.gamecenter.common.utils.throwExceptionInDebug
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.Utils
|
||||
import net.lingala.zip4j.progress.ProgressMonitor
|
||||
import java.io.File
|
||||
|
||||
@ -21,38 +21,48 @@ import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||
import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.feature.entity.TagStyleEntity;
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData;
|
||||
import com.gh.gamecenter.feature.entity.TagStyleEntity;
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent;
|
||||
import com.gh.common.exposure.ExposureUtils;
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||
import com.gh.common.history.HistoryHelper;
|
||||
import com.gh.common.simulator.SimulatorGameManager;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.gamecenter.common.utils.DeviceUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.common.util.HomePluggableHelper;
|
||||
import com.gh.common.util.LunchType;
|
||||
import com.gh.gamecenter.common.utils.NetworkUtils;
|
||||
import com.gh.common.util.PackageInstaller;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||
import com.gh.gamecenter.common.utils.DeviceUtils;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.FileUtils;
|
||||
import com.gh.gamecenter.common.utils.NetworkUtils;
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||
import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.core.utils.AppDebugConfig;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.core.utils.SentryHelper;
|
||||
import com.gh.gamecenter.download.DownloadedGameIdAndPackageNameDao;
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity;
|
||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.entity.HomePluggableFilterEntity;
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation;
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity;
|
||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation;
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent;
|
||||
import com.gh.gamecenter.login.user.UserManager;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.gh.ndownload.NDataChanger;
|
||||
import com.gh.ndownload.NDownloadBridge;
|
||||
import com.gh.ndownload.NDownloadService;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.download.ConnectionUtils;
|
||||
import com.lightgame.download.DataWatcher;
|
||||
@ -61,7 +71,6 @@ import com.lightgame.download.DownloadDao;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.DownloadStatus;
|
||||
import com.lightgame.download.DownloadStatusListener;
|
||||
import com.lightgame.download.FileUtils;
|
||||
import com.lightgame.download.HttpDnsManager;
|
||||
import com.lightgame.utils.Utils;
|
||||
|
||||
@ -69,6 +78,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -246,7 +256,9 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
String location,
|
||||
boolean isSubscribe,
|
||||
@Nullable ExposureEvent traceEvent) {
|
||||
createDownload(context, gameEntity.getApk().get(0), gameEntity, asVGame, gameEntity.isDualBtnModeEnabled(), entrance, location, isSubscribe, traceEvent);
|
||||
if (!gameEntity.getApk().isEmpty()) {
|
||||
createDownload(context, gameEntity.getApk().get(0), gameEntity, asVGame, gameEntity.isDualBtnModeEnabled(), entrance, location, isSubscribe, traceEvent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -399,6 +411,13 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
}
|
||||
downloadEntity.setTags(tags);
|
||||
|
||||
// 将自定义页面相关埋点数据放入 downloadEntity 中供下载完成时取出使用
|
||||
CustomPageTrackData customPageTrackData = gameEntity.getCustomPageTrackData();
|
||||
if (customPageTrackData != null) {
|
||||
String trackJson = GsonUtils.toJson(customPageTrackData);
|
||||
downloadEntity.setCustomPageTrackData(trackJson);
|
||||
}
|
||||
|
||||
if (isSubscribe) {
|
||||
DownloadManager.getInstance().subscribe(downloadEntity);
|
||||
} else {
|
||||
@ -407,12 +426,19 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
}
|
||||
|
||||
if (asVGame) {
|
||||
SensorsBridge.trackEventWithExposureSource("HaloFunGameDownloadClick",
|
||||
downloadExposureEvent.getSource(),
|
||||
String[] vaKvs = {
|
||||
"game_name", gameEntity.getName(),
|
||||
"game_id", gameEntity.getId(),
|
||||
"game_type", gameEntity.getCategoryChinese(),
|
||||
"game_schema_type", gameEntity.getGameBitChinese());
|
||||
"game_schema_type", gameEntity.getGameBitChinese()
|
||||
};
|
||||
List<String> vaList = new ArrayList<>(Arrays.asList(vaKvs));
|
||||
if (customPageTrackData != null) {
|
||||
vaList.addAll(Arrays.asList(customPageTrackData.toKV()));
|
||||
}
|
||||
SensorsBridge.trackEventWithExposureSource("HaloFunGameDownloadClick",
|
||||
downloadExposureEvent.getSource(),
|
||||
vaList.toArray(new String[0]));
|
||||
}
|
||||
|
||||
String trackDownloadType = "";
|
||||
@ -422,8 +448,8 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
trackDownloadType = "本地下载";
|
||||
}
|
||||
|
||||
SensorsBridge.trackEventWithExposureSource("DownloadProcessBegin",
|
||||
downloadExposureEvent.getSource(),
|
||||
|
||||
String[] arrayKv = {
|
||||
"game_id", gameEntity.getId(),
|
||||
"game_name", gameEntity.getName(),
|
||||
"game_type", gameEntity.getCategoryChinese(),
|
||||
@ -437,6 +463,15 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
"last_page_business_id", GlobalActivityManager.getLastPageEntity().getPageBusinessId(),
|
||||
"download_status", gameEntity.getDownloadStatusChinese(),
|
||||
"download_type", trackDownloadType
|
||||
};
|
||||
|
||||
List<String> kvs = new ArrayList<>(Arrays.asList(arrayKv));
|
||||
if (customPageTrackData != null) {
|
||||
kvs.addAll(Arrays.asList(customPageTrackData.toKV()));
|
||||
}
|
||||
|
||||
SensorsBridge.trackEventWithExposureSource("DownloadProcessBegin",
|
||||
downloadExposureEvent.getSource(), kvs.toArray(new String[0])
|
||||
);
|
||||
|
||||
//TODO remove
|
||||
@ -463,6 +498,7 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
SentryHelper.INSTANCE.onEvent("CLEAR_DELETED_TASK_ERROR", "exception_digest", e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加一个下载任务
|
||||
* <p>
|
||||
|
||||
@ -3,7 +3,9 @@ package com.gh.download
|
||||
import android.annotation.SuppressLint
|
||||
import android.text.TextUtils
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.feature.utils.ConcernUtils
|
||||
import com.gh.common.util.DataCollectionUtils
|
||||
import com.gh.common.util.PackageInstaller
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.common.xapk.XapkInstaller
|
||||
import com.gh.download.server.BrowserInstallHelper
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
@ -18,6 +20,7 @@ import com.gh.gamecenter.core.utils.ThirdPartyPackageHelper
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils
|
||||
import com.gh.gamecenter.entity.GameDigestEntity
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.feature.utils.ConcernUtils
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository
|
||||
|
||||
@ -27,21 +27,13 @@ object ExoCacheManager {
|
||||
if (NetworkUtils.isWifiConnected(HaloApp.getInstance().application)) {
|
||||
10 * 1024 * 1024L
|
||||
} else {
|
||||
when (NetworkUtils.getMobileNetworkType(HaloApp.getInstance().application)) {
|
||||
"5G", "4G" -> 10 * 1024 * 1024L
|
||||
"3G" -> 5 * 1024 * 1024L
|
||||
else -> 0L
|
||||
}
|
||||
10 * 1024 * 1024L
|
||||
}
|
||||
} else {
|
||||
if (NetworkUtils.isWifiConnected(HaloApp.getInstance().application)) {
|
||||
50 * 1024 * 1024L
|
||||
} else {
|
||||
when (NetworkUtils.getMobileNetworkType(HaloApp.getInstance().application)) {
|
||||
"5G", "4G" -> 20 * 1024 * 1024L
|
||||
"3G" -> 5 * 1024 * 1024L
|
||||
else -> 0L
|
||||
}
|
||||
20 * 1024 * 1024L
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,13 +6,13 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.NewsDetailActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.callback.OnViewClickListener
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.databinding.*
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailActivity
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
|
||||
class DownloadDialogAdapter(
|
||||
@ -113,16 +113,16 @@ class DownloadDialogAdapter(
|
||||
holder.binding.run {
|
||||
links?.let {
|
||||
leftLink.setOnClickListener { view ->
|
||||
clickListener.onClick(view, links[0])
|
||||
it.firstOrNull()?.let { link -> clickListener.onClick(view, link) }
|
||||
}
|
||||
rightLink.setOnClickListener { view ->
|
||||
clickListener.onClick(view, links[1])
|
||||
it.getOrNull(1)?.let { link -> clickListener.onClick(view, link) }
|
||||
}
|
||||
}
|
||||
leftLink.visibleIf(!links.isNullOrEmpty())
|
||||
rightLink.visibleIf(links?.size ?: 0 > 1)
|
||||
leftLink.text = if (links.isNullOrEmpty()) "" else links[0].title
|
||||
rightLink.text = if (links?.size ?: 0 > 1) links?.get(1)?.title else ""
|
||||
rightLink.visibleIf((links?.size ?: 0) > 1)
|
||||
leftLink.text = links?.firstOrNull()?.title ?: ""
|
||||
rightLink.text = links?.getOrNull(1)?.title ?: ""
|
||||
leftLink.background = GradientDrawable().apply {
|
||||
cornerRadius = 8F.dip2px().toFloat()
|
||||
setStroke(0.5F.dip2px(), R.color.ui_divider.toColor(mContext))
|
||||
|
||||
@ -7,7 +7,6 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.dialog.CertificationDialog
|
||||
import com.gh.common.dialog.DeviceRemindDialog
|
||||
import com.gh.common.dialog.PackageCheckDialogFragment
|
||||
import com.gh.common.util.*
|
||||
@ -29,7 +28,6 @@ import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.DownloadStatus
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.lightgame.utils.AppManager
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
@ -343,33 +341,28 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
|
||||
context as AppCompatActivity,
|
||||
gameEntity
|
||||
) {
|
||||
CertificationDialog.showCertificationDialog(
|
||||
DialogUtils.checkDownload(
|
||||
context,
|
||||
gameEntity
|
||||
) {
|
||||
DialogUtils.checkDownload(
|
||||
apkEntity.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name,
|
||||
gameEntity.categoryChinese
|
||||
) { isSubscribe ->
|
||||
DownloadManager.createDownload(
|
||||
context,
|
||||
apkEntity.size,
|
||||
gameEntity.id,
|
||||
gameEntity.name,
|
||||
gameEntity.categoryChinese
|
||||
) { isSubscribe ->
|
||||
DownloadManager.createDownload(
|
||||
context,
|
||||
apkEntity,
|
||||
gameEntity,
|
||||
false,
|
||||
false,
|
||||
entrance,
|
||||
location,
|
||||
isSubscribe, traceEvent
|
||||
)
|
||||
apkEntity,
|
||||
gameEntity,
|
||||
false,
|
||||
false,
|
||||
entrance,
|
||||
location,
|
||||
isSubscribe, traceEvent
|
||||
)
|
||||
|
||||
DeviceRemindDialog.showDeviceRemindDialog(
|
||||
context,
|
||||
gameEntity
|
||||
)
|
||||
}
|
||||
DeviceRemindDialog.showDeviceRemindDialog(
|
||||
context,
|
||||
gameEntity
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package com.gh.download.server
|
||||
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.common.utils.FileUtils
|
||||
import com.gh.gamecenter.common.utils.getMetaExtra
|
||||
import com.gh.gamecenter.common.utils.toObject
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.FileUtils
|
||||
import fi.iki.elonen.NanoHTTPD
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
@ -4,7 +4,7 @@ import com.lg.download.*
|
||||
import com.lg.ndownload.DownloadConfig
|
||||
import com.lg.ndownload.DownloadDbManager
|
||||
import com.lg.ndownload.DownloadQueue
|
||||
import com.lightgame.download.FileUtils
|
||||
import com.gh.gamecenter.common.utils.FileUtils
|
||||
import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ public class DownloadManagerActivity extends ToolBarActivity {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
NewFlatLogUtils.logHaloFunManageShow("下载管理");
|
||||
DirectUtils.directToVGameDownload(this, false);
|
||||
DirectUtils.directToVGameDownload(this, "下载管理", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -8,11 +8,13 @@ import android.view.View
|
||||
import com.gh.base.DownloadToolbarActivity
|
||||
import com.gh.common.exposure.ExposureManager.log
|
||||
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.utils.toArrayList
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.entity.GamePlatform
|
||||
import com.gh.gamecenter.feature.entity.CustomPageTrackData
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
|
||||
@ -170,7 +172,12 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun startGameDetailActivity(context: Context, gameId: String, entrance: String?, traceEvent: ExposureEvent?) {
|
||||
fun startGameDetailActivity(
|
||||
context: Context,
|
||||
gameId: String,
|
||||
entrance: String?,
|
||||
traceEvent: ExposureEvent?
|
||||
) {
|
||||
startGameDetailActivity(context, gameId, entrance, -1, traceEvent = traceEvent)
|
||||
}
|
||||
|
||||
@ -226,7 +233,8 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
platformName: String? = null,
|
||||
packageName: String? = null,
|
||||
platforms: List<GamePlatform>? = null,
|
||||
traceEvent: ExposureEvent? = null
|
||||
traceEvent: ExposureEvent? = null,
|
||||
customPageTrackData: CustomPageTrackData? = null
|
||||
) {
|
||||
val bundle = Bundle()
|
||||
|
||||
@ -280,6 +288,13 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
}
|
||||
bundle.putString(EntranceConsts.KEY_GAMEID, gameId)
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
bundle.putParcelable(EntranceConsts.KEY_CUSTOM_PAGE_TRACK_DATA, customPageTrackData)
|
||||
bundle.putString(EntranceConsts.KEY_LAST_PAGE_ID, GlobalActivityManager.getLastPageEntity().pageId)
|
||||
bundle.putString(EntranceConsts.KEY_LAST_PAGE_NAME, GlobalActivityManager.getLastPageEntity().pageName)
|
||||
bundle.putString(
|
||||
EntranceConsts.KEY_LAST_PAGE_BUSINESS_ID,
|
||||
GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||
)
|
||||
context.startActivity(
|
||||
getTargetIntent(
|
||||
context,
|
||||
|
||||
@ -17,7 +17,6 @@ import static com.gh.gamecenter.common.utils.ExtensionsKt.observableToMain;
|
||||
import static com.gh.gamecenter.login.utils.LoginHelper.WEIBO_SCOPE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@ -48,6 +47,7 @@ import com.gh.common.constant.Config;
|
||||
import com.gh.common.filter.RegionSettingHelper;
|
||||
import com.gh.common.history.HistoryDatabase;
|
||||
import com.gh.common.history.HistoryHelper;
|
||||
import com.gh.common.prioritychain.GlobalPriorityChainHelper;
|
||||
import com.gh.common.repository.ReservationRepository;
|
||||
import com.gh.common.simulator.SimulatorGameManager;
|
||||
import com.gh.common.util.AdHelper;
|
||||
@ -56,7 +56,6 @@ import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.ErrorHelper;
|
||||
import com.gh.common.util.HomePluggableHelper;
|
||||
import com.gh.common.util.LogUtils;
|
||||
import com.gh.common.util.LunchType;
|
||||
import com.gh.common.util.PackageInstaller;
|
||||
@ -71,6 +70,7 @@ import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
|
||||
import com.gh.gamecenter.common.constant.CommonConsts;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.common.entity.SuggestType;
|
||||
import com.gh.gamecenter.common.eventbus.EBNetworkState;
|
||||
import com.gh.gamecenter.common.eventbus.EBReuse;
|
||||
@ -79,6 +79,7 @@ import com.gh.gamecenter.common.retrofit.BiResponse;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.DialogHelper;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.FileUtils;
|
||||
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||
import com.gh.gamecenter.common.utils.ShareUtils;
|
||||
@ -92,11 +93,9 @@ import com.gh.gamecenter.core.utils.SentryHelper;
|
||||
import com.gh.gamecenter.core.utils.ToastUtils;
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils;
|
||||
import com.gh.gamecenter.entity.StartupAdEntity;
|
||||
import com.gh.gamecenter.eventbus.EBSkip;
|
||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils;
|
||||
import com.gh.gamecenter.fragment.MainWrapperFragment;
|
||||
import com.gh.gamecenter.fragment.MainWrapperViewModel;
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageShareRepository;
|
||||
import com.gh.gamecenter.home.skip.PackageSkipActivity;
|
||||
import com.gh.gamecenter.login.user.UserManager;
|
||||
import com.gh.gamecenter.login.utils.QuickLoginHelper;
|
||||
@ -105,6 +104,9 @@ import com.gh.gamecenter.packagehelper.PackageViewModel;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.gh.gamecenter.room.AppDatabase;
|
||||
import com.gh.gamecenter.room.dao.SimulatorGameDao;
|
||||
import com.gh.gamecenter.wrapper.MainWrapperFragment;
|
||||
import com.gh.gamecenter.wrapper.MainWrapperRepository;
|
||||
import com.gh.gamecenter.wrapper.MainWrapperViewModel;
|
||||
import com.gh.vspace.VHelper;
|
||||
import com.google.android.exoplayer2.upstream.cache.Cache;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
@ -112,14 +114,11 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.DownloadStatus;
|
||||
import com.lightgame.download.FileUtils;
|
||||
import com.lightgame.utils.AppManager;
|
||||
import com.lightgame.utils.Utils;
|
||||
import com.sina.weibo.sdk.auth.AuthInfo;
|
||||
import com.sina.weibo.sdk.openapi.IWBAPI;
|
||||
import com.sina.weibo.sdk.openapi.WBAPIFactory;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -133,14 +132,11 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.HttpException;
|
||||
@ -148,9 +144,6 @@ import tv.danmaku.ijk.media.exo2.ExoSourceManager;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
|
||||
public static final String EB_SKIP_MAIN = "MainActivity";
|
||||
public static final String SWITCH_TO_COMMUNITY = "switch_to_community";
|
||||
public static final String SWITCH_TO_VIDEO = "switch_to_video";
|
||||
public static final String SHOW_AD = "show_ad";
|
||||
public static final int COUNTDOWN_AD = 100;
|
||||
public static final int COUNTDOWN_MAX_COUNT = 3;
|
||||
@ -179,6 +172,8 @@ public class MainActivity extends BaseActivity {
|
||||
mMainWrapperViewModel = new ViewModelProvider(this, new MainWrapperViewModel.Factory(HaloApp.getInstance()))
|
||||
.get(MainWrapperViewModel.class);
|
||||
|
||||
DisplayUtils.updateGlobalScreen(this);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setStatusBarColor(Color.TRANSPARENT);
|
||||
|
||||
@ -229,7 +224,7 @@ public class MainActivity extends BaseActivity {
|
||||
DialogHelper.showCenterWarningDialog(this, "发生闪退", "光环助手发生了闪退,建议安装到最新版本修复异常"
|
||||
, "马上反馈", "马上安装修复",
|
||||
() -> {
|
||||
DirectUtils.directToGameDetail(this, Constants.GHZS_GAME_ID, "crash", true, "desc", null);
|
||||
DirectUtils.directToGameDetail(this, Constants.GHZS_GAME_ID, "", "crash", true, "desc", null);
|
||||
return null;
|
||||
},
|
||||
() -> {
|
||||
@ -263,10 +258,6 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
ReservationRepository.refreshReservations();
|
||||
|
||||
if (getIntent().getBooleanExtra(SWITCH_TO_VIDEO, false)) {
|
||||
handler.postDelayed(() -> mMainWrapperFragment.setCurrentItem(2), 800);
|
||||
}
|
||||
|
||||
// 跳转至其它页面
|
||||
if (getIntent() != null
|
||||
&& getIntent().getExtras() != null
|
||||
@ -300,7 +291,6 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
// 初始化PlatformUtils
|
||||
PlatformUtils.getInstance(getApplicationContext());
|
||||
HomePluggableHelper.activationFilterData();
|
||||
|
||||
// 启动app删除视频缓存文件
|
||||
try {
|
||||
@ -414,15 +404,12 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
int currentPageIndex = savedInstanceState.getInt(CURRENT_PAGE, -1);
|
||||
if (currentPageIndex >= 0) {
|
||||
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, currentPageIndex));
|
||||
if (currentPageIndex == MainWrapperFragment.INDEX_VIDEO) {
|
||||
DisplayUtils.setLightStatusBar(this, false);
|
||||
}
|
||||
int bottomTabPosition = savedInstanceState.getInt(CURRENT_PAGE, -1);
|
||||
if (bottomTabPosition != -1) {
|
||||
MainWrapperRepository.Companion.getInstance().sendSelectTabEvent(bottomTabPosition, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -453,6 +440,7 @@ public class MainActivity extends BaseActivity {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
CustomPageShareRepository.Companion.getInstance().onClear();
|
||||
AdDelegateHelper.INSTANCE.cancelSplashAd(this);
|
||||
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
@ -506,7 +494,12 @@ public class MainActivity extends BaseActivity {
|
||||
ViewGroup startAdContainer = findViewById(R.id.startAdContainer);
|
||||
ViewGroup sdkStartAdContainer = findViewById(R.id.sdkStartAdContainer);
|
||||
FrameLayout adsFl = findViewById(R.id.adsFl);
|
||||
|
||||
View icpContainer = findViewById(R.id.sdkStartAdIcpContainer);
|
||||
if (icpContainer != null) {
|
||||
icpContainer.setOnClickListener((view) -> {
|
||||
// consume click event
|
||||
});
|
||||
}
|
||||
int screenWidthInPx = DisplayUtils.getScreenWidth(this);
|
||||
int screenHeightInPx = DisplayUtils.getScreenHeight(this)
|
||||
+ DisplayUtils.getStatusBarHeight(this.getResources())
|
||||
@ -547,6 +540,21 @@ public class MainActivity extends BaseActivity {
|
||||
if (COUNTDOWN_MAX_COUNT < mCountdownCount) {
|
||||
AdDelegateHelper.INSTANCE.setShowingSplashAd(false);
|
||||
hideSplashAd();
|
||||
|
||||
if (msg.obj instanceof StartupAdEntity) {
|
||||
StartupAdEntity ad = (StartupAdEntity) msg.obj;
|
||||
LinkEntity linkEntity = ad.getJump();
|
||||
SensorsBridge.trackEvent(
|
||||
"SplashAdOwnSkip",
|
||||
"splash_ad_id",
|
||||
ad.getId(),
|
||||
"link_type",
|
||||
linkEntity.getType(),
|
||||
"link_id",
|
||||
linkEntity.getLink(),
|
||||
"link_text",
|
||||
linkEntity.getText());
|
||||
}
|
||||
} else {
|
||||
TextView jumpBtn = findViewById(R.id.jumpBtn);
|
||||
jumpBtn.setText(String.format(Locale.CHINA, "跳过 %d", COUNTDOWN_MAX_COUNT - mCountdownCount));
|
||||
@ -590,10 +598,12 @@ public class MainActivity extends BaseActivity {
|
||||
ExtensionsKt.removeFromParent(startSdkAdIcpContainer, true);
|
||||
}
|
||||
|
||||
// 通知优先级高的弹窗可以显示了
|
||||
AppExecutor.getUiExecutor().execute(() -> {
|
||||
mMainWrapperFragment.showDialog();
|
||||
});
|
||||
onSplashHidden();
|
||||
}
|
||||
|
||||
private void onSplashHidden() {
|
||||
// 通知全局弹窗可以进行显示
|
||||
AppExecutor.getUiExecutor().execute(GlobalPriorityChainHelper.INSTANCE::start);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -687,15 +697,18 @@ public class MainActivity extends BaseActivity {
|
||||
try {
|
||||
GameEntity gameEntity = GsonUtils.getGson().fromJson(json, new TypeToken<GameEntity>() {
|
||||
}.getType());
|
||||
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk().get(0).getUrl());
|
||||
if (downloadEntity != null) {
|
||||
File file = new File(downloadEntity.getPath());
|
||||
if (!file.exists()) {
|
||||
ToastUtils.showToast("文件已被删除,无法启动");
|
||||
return;
|
||||
}
|
||||
if (gameEntity != null) {
|
||||
String apkUrl = gameEntity.getApk().isEmpty() ? "" : gameEntity.getApk().get(0).getUrl();
|
||||
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apkUrl);
|
||||
if (downloadEntity != null) {
|
||||
File file = new File(downloadEntity.getPath());
|
||||
if (!file.exists()) {
|
||||
ToastUtils.showToast("文件已被删除,无法启动");
|
||||
return;
|
||||
}
|
||||
|
||||
SimulatorGameManager.launchSimulatorGame(downloadEntity, gameEntity);
|
||||
SimulatorGameManager.launchSimulatorGame(downloadEntity, gameEntity);
|
||||
}
|
||||
}
|
||||
} catch (JsonSyntaxException exception) {
|
||||
exception.printStackTrace();
|
||||
@ -742,8 +755,8 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
Utils.log(bundle);
|
||||
if (bundle.getInt(EntranceConsts.KEY_POSITION) != -1) {
|
||||
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, bundle.getInt(EntranceConsts.KEY_POSITION)));
|
||||
if (!TextUtils.isEmpty(bundle.getString(EntranceConsts.KEY_TYPE, ""))) {
|
||||
MainWrapperRepository.Companion.getInstance().sendSelectTabEvent(bundle.getString(EntranceConsts.KEY_TYPE));
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
@ -783,8 +796,6 @@ public class MainActivity extends BaseActivity {
|
||||
} else {
|
||||
toast("抱歉,暂未找到相关内容");
|
||||
}
|
||||
LogUtils.uploadPackageSkip("external_jump", "进入游戏库", "", "");
|
||||
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_GAME));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -879,9 +890,8 @@ public class MainActivity extends BaseActivity {
|
||||
protected void onSaveInstanceState(@NotNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.clear();
|
||||
outState.putInt(CURRENT_PAGE, mMainWrapperFragment.getCurrentItem());
|
||||
if (mMainWrapperFragment != null) {
|
||||
outState.putInt(BaseFragment_ViewPager.ARGS_INDEX, mMainWrapperFragment.getCurrentItem());
|
||||
outState.putInt(CURRENT_PAGE, mMainWrapperFragment.getCurrentItem());
|
||||
}
|
||||
}
|
||||
|
||||
@ -909,10 +919,6 @@ public class MainActivity extends BaseActivity {
|
||||
&& getIntent().getBooleanExtra(EntranceConsts.KEY_REQUIRE_REDIRECT, false)) {
|
||||
doSkip();
|
||||
}
|
||||
|
||||
if (getIntent().getBooleanExtra(SWITCH_TO_VIDEO, false)) {
|
||||
mMainWrapperFragment.setCurrentItem(2);
|
||||
}
|
||||
}
|
||||
|
||||
// 连接上网络事件
|
||||
@ -943,25 +949,6 @@ public class MainActivity extends BaseActivity {
|
||||
return "游戏首页";
|
||||
}
|
||||
|
||||
public static void skipToMainActivity(Context context, int position) {
|
||||
Activity activity = AppManager.getInstance().findActivity(MainActivity.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
|
||||
&& activity != null && !activity.isDestroyed()) {
|
||||
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, position));
|
||||
} else {
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, position));
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
Intent intent = MainActivity.getMainIntent(context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
//需要提前初始化微博sdk,否则第一次分享或授权登录会失败
|
||||
private void initWBSDK() {
|
||||
IWBAPI mWBAPI = WBAPIFactory.createWBAPI(this);
|
||||
|
||||
@ -116,10 +116,23 @@ open class SearchActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
protected open fun trackSearchPageShow(){
|
||||
val bottomTab = intent.getStringExtra(EntranceConsts.KEY_BOTTOM_TAB_NAME) ?: ""
|
||||
val multiTabId = intent.getStringExtra(EntranceConsts.KEY_MULTI_TAB_NAV_ID) ?: ""
|
||||
val multiTabName = intent.getStringExtra(EntranceConsts.KEY_MULTI_TAB_NAV_NAME) ?: ""
|
||||
val customPageId = intent.getStringExtra(EntranceConsts.KEY_CUSTOM_PAGE_ID) ?: ""
|
||||
val customPageName = intent.getStringExtra(EntranceConsts.KEY_CUSTOM_PAGE_NAME) ?: ""
|
||||
val searchBoxPattern = intent.getStringExtra(EntranceConsts.KEY_SEARCH_BOX_PATTERN) ?: ""
|
||||
|
||||
SensorsBridge.trackSearchPageShow(
|
||||
GlobalActivityManager.getCurrentPageEntity().pageId,
|
||||
GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
intent.getStringExtra(EntranceConsts.KEY_SOURCE_ENTRANCE) ?: ""
|
||||
intent.getStringExtra(EntranceConsts.KEY_SOURCE_ENTRANCE) ?: "",
|
||||
bottomTab,
|
||||
multiTabId,
|
||||
multiTabName,
|
||||
customPageId,
|
||||
customPageName,
|
||||
searchBoxPattern
|
||||
)
|
||||
}
|
||||
|
||||
@ -362,12 +375,33 @@ open class SearchActivity : BaseActivity() {
|
||||
hint: String,
|
||||
entrance: String,
|
||||
sourceEntrance: String
|
||||
): Intent = getIntent(context, searchImmediately, hint, entrance, sourceEntrance, "", "", "", "", "", "")
|
||||
|
||||
@JvmStatic
|
||||
fun getIntent(
|
||||
context: Context,
|
||||
searchImmediately: Boolean,
|
||||
hint: String,
|
||||
entrance: String,
|
||||
sourceEntrance: String,
|
||||
bottomTab: String = "",
|
||||
multiTabId: String = "",
|
||||
multiTabName: String = "",
|
||||
customPageId: String = "",
|
||||
customPageName: String = "",
|
||||
searchBoxPattern: String = ""
|
||||
): Intent {
|
||||
val intent = Intent(context, SearchActivity::class.java)
|
||||
intent.putExtra(KEY_SEARCH_IMMEDIATELY, searchImmediately)
|
||||
intent.putExtra(EntranceConsts.KEY_HINT, hint)
|
||||
intent.putExtra(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
intent.putExtra(EntranceConsts.KEY_SOURCE_ENTRANCE, sourceEntrance)
|
||||
intent.putExtra(EntranceConsts.KEY_BOTTOM_TAB_NAME, bottomTab)
|
||||
intent.putExtra(EntranceConsts.KEY_MULTI_TAB_NAV_ID, multiTabId)
|
||||
intent.putExtra(EntranceConsts.KEY_MULTI_TAB_NAV_NAME, multiTabName)
|
||||
intent.putExtra(EntranceConsts.KEY_CUSTOM_PAGE_ID, customPageId)
|
||||
intent.putExtra(EntranceConsts.KEY_CUSTOM_PAGE_NAME, customPageName)
|
||||
intent.putExtra(EntranceConsts.KEY_SEARCH_BOX_PATTERN, searchBoxPattern)
|
||||
return intent
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,6 @@ import com.gh.gamecenter.video.videomanager.VideoManagerActivity;
|
||||
import com.gh.vspace.shortcut.OnCreateShortcutResult;
|
||||
import com.gh.vspace.shortcut.ShortcutManager;
|
||||
import com.gh.vspace.shortcut.ShortcutPermissionTipsDialog;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.config.CommonDebug;
|
||||
import com.lightgame.utils.Utils;
|
||||
import com.muugi.shortcut.core.Executor;
|
||||
@ -145,7 +144,7 @@ public class SkipActivity extends BaseActivity {
|
||||
DirectUtils.directToArticle(this, path, ENTRANCE_BROWSER);
|
||||
break;
|
||||
case HOST_GAME:
|
||||
DirectUtils.directToGameDetail(this, path, ENTRANCE_BROWSER, "true".equals(uri.getQueryParameter("auto_download")), 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, null, false);
|
||||
@ -171,17 +170,7 @@ public class SkipActivity extends BaseActivity {
|
||||
DirectUtils.directToToolbox(this, uri.getQueryParameter("gameId"), uri.getQueryParameter("toolboxUrl"), ENTRANCE_BROWSER);
|
||||
break;
|
||||
case HOST_COMMUNITY:
|
||||
// 把切换放到 MainActivity 处理
|
||||
if (HaloApp.getInstance().isRunningForeground) {
|
||||
intent = new Intent(this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intent.putExtra(MainActivity.SWITCH_TO_COMMUNITY, true);
|
||||
} else {
|
||||
bundle = new Bundle();
|
||||
bundle.putBoolean(MainActivity.SWITCH_TO_COMMUNITY, true);
|
||||
intent = SplashScreenActivity.getSplashScreenIntent(this, bundle);
|
||||
}
|
||||
startActivity(intent);
|
||||
DirectUtils.directToHomeCommunityTab(this);
|
||||
break;
|
||||
// 社区文章格式一
|
||||
case "community.article":
|
||||
@ -254,17 +243,7 @@ public class SkipActivity extends BaseActivity {
|
||||
TextUtils.isEmpty(sectionName) ? "" : sectionName, false, "");
|
||||
break;
|
||||
case HOST_VIDEO_STREAMING_HOME:
|
||||
// 把切换放到 MainActivity 处理
|
||||
if (HaloApp.getInstance().isRunningForeground) {
|
||||
intent = new Intent(this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intent.putExtra(MainActivity.SWITCH_TO_VIDEO, true);
|
||||
} else {
|
||||
bundle = new Bundle();
|
||||
bundle.putBoolean(MainActivity.SWITCH_TO_VIDEO, true);
|
||||
intent = SplashScreenActivity.getSplashScreenIntent(this, bundle);
|
||||
}
|
||||
startActivity(intent);
|
||||
DirectUtils.directToHomeVideoTab(this);
|
||||
break;
|
||||
case HOST_VIDEO_STREAMING_DESC:
|
||||
DirectUtils.directToGameDetailVideoStreaming(this, path, ENTRANCE_BROWSER);
|
||||
@ -324,7 +303,7 @@ public class SkipActivity extends BaseActivity {
|
||||
DirectUtils.directCategoryDirectory(this, path, title, ENTRANCE_BROWSER, "浏览器");
|
||||
break;
|
||||
case HOST_COLUMN_COLLECTION:
|
||||
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "", "", "", null);
|
||||
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "", "", "", "", null,false);
|
||||
break;
|
||||
case EntranceConsts.HOST_BLOCK:
|
||||
name = uri.getQueryParameter("name");
|
||||
@ -397,8 +376,7 @@ public class SkipActivity extends BaseActivity {
|
||||
DirectUtils.directToGameRatingDetail(this, uri.getQueryParameter(EntranceConsts.KEY_GAME_ID), uri.getQueryParameter(EntranceConsts.KEY_COMMENT_ID), ENTRANCE_BROWSER);
|
||||
break;
|
||||
case EntranceConsts.HOST_FORUM:
|
||||
position = uri.getQueryParameter("position");
|
||||
DirectUtils.directToForum(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position));
|
||||
DirectUtils.directToHomeCommunityTab(this);
|
||||
break;
|
||||
case EntranceConsts.HOST_HELP_AND_FEEDBACK:
|
||||
if ("vgame".equals(suggestionType)) {
|
||||
@ -419,7 +397,8 @@ public class SkipActivity extends BaseActivity {
|
||||
JSONObject extJsonObject = new JSONObject(extJson);
|
||||
String qqGameId = extJsonObject.optString("aid");
|
||||
DirectUtils.directToQGameById(this, qqGameId);
|
||||
} catch (JSONException ignored) {}
|
||||
} catch (JSONException ignored) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
EntranceUtils.jumpActivity(this, new Bundle()); // 跳转至首页
|
||||
|
||||
@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Message
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
@ -37,6 +38,11 @@ class SplashAdActivity : BaseActivity() {
|
||||
val startAdContainer = findViewById<ViewGroup>(R.id.startAdContainer)
|
||||
val sdkStartAdContainer = findViewById<ViewGroup>(R.id.sdkStartAdContainer)
|
||||
val adsFl = findViewById<FrameLayout>(R.id.adsFl)
|
||||
val icpContainer = findViewById<View>(R.id.sdkStartAdIcpContainer)
|
||||
|
||||
icpContainer?.setOnClickListener {
|
||||
// consume click event
|
||||
}
|
||||
|
||||
val screenWidthInPx = DisplayUtils.getScreenWidth(this)
|
||||
val screenHeightInPx = (DisplayUtils.getScreenHeight(this)
|
||||
|
||||
@ -11,6 +11,9 @@ import android.preference.PreferenceManager
|
||||
import android.view.KeyEvent
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.text.bold
|
||||
import androidx.core.text.buildSpannedString
|
||||
import androidx.core.text.color
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.common.dialog.NewPrivacyPolicyDialogFragment
|
||||
@ -78,25 +81,37 @@ class SplashScreenActivity : BaseActivity() {
|
||||
if (!PackageFlavorHelper.IS_TEST_FLAVOR) {
|
||||
showPrivacyDialog()
|
||||
} else {
|
||||
val spanBuilder = buildSpannedString {
|
||||
append("这个弹窗只会在右上角有环境标签的测试包出现" +
|
||||
"\n进入应用以后还可以到关于我们页面长按应用图标重新选择")
|
||||
bold {
|
||||
color(R.color.text_theme.toColor(this@SplashScreenActivity)) {
|
||||
append("\n点击这里进行预设置渠道")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test dex2oat
|
||||
executeDex2OatInAdvance()
|
||||
DialogHelper.showDialog(
|
||||
this,
|
||||
"选择接口环境",
|
||||
"这个弹窗只会在右上角有环境标签的测试包出现\n进入应用以后还可以到关于我们页面长按应用图标重新选择",
|
||||
"正式环境",
|
||||
"测试环境",
|
||||
{
|
||||
context = this,
|
||||
title ="选择环境",
|
||||
content = spanBuilder,
|
||||
confirmText = "正式环境",
|
||||
cancelText = "测试环境",
|
||||
confirmClickCallback = {
|
||||
SPUtils.setBoolean(Constants.SP_IS_DEV_ENV, false)
|
||||
showPrivacyDialog()
|
||||
},
|
||||
{
|
||||
cancelClickCallback = {
|
||||
SPUtils.setBoolean(Constants.SP_IS_DEV_ENV, true)
|
||||
showPrivacyDialog()
|
||||
},
|
||||
false,
|
||||
"",
|
||||
""
|
||||
uiModificationCallback = {
|
||||
it.contentTv.setOnClickListener {
|
||||
EnvHelper.showChangeChannelDialog(this@SplashScreenActivity)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
@ -262,7 +277,6 @@ class SplashScreenActivity : BaseActivity() {
|
||||
runOnIoThread {
|
||||
mViewModel?.deviceDialogSetting()
|
||||
mViewModel?.filterDetailTags()
|
||||
mViewModel?.authDialog()
|
||||
mViewModel?.postMark(mIsNewForThisVersion)
|
||||
mViewModel?.regulationTestStatus()
|
||||
checkAndPostUsageStats()
|
||||
@ -279,7 +293,6 @@ class SplashScreenActivity : BaseActivity() {
|
||||
if (today != time) {
|
||||
// 获取版本代码、名称
|
||||
PlatformUtils.getInstance(applicationContext).getPlatform()
|
||||
TagUtils.getInstance(applicationContext).getTag()
|
||||
}
|
||||
|
||||
// 更新本地时间
|
||||
|
||||
@ -13,7 +13,6 @@ import com.gh.gamecenter.common.retrofit.Response
|
||||
import com.gh.gamecenter.common.utils.toRequestBody
|
||||
import com.gh.gamecenter.core.utils.GsonUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.feature.entity.AuthDialogEntity
|
||||
import com.gh.gamecenter.entity.DeviceDialogEntity
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -77,18 +76,6 @@ class SplashScreenViewModel(application: Application) : AndroidViewModel(applica
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏实名认证弹窗
|
||||
*/
|
||||
fun authDialog() {
|
||||
mApi.authDialog()
|
||||
.subscribe(object : Response<List<AuthDialogEntity?>?>() {
|
||||
override fun onResponse(response: List<AuthDialogEntity?>?) {
|
||||
super.onResponse(response)
|
||||
SPUtils.setString(Constants.SP_AUTH_DIALOG, GsonUtils.toJson(response))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断新老用户
|
||||
|
||||
@ -1,283 +0,0 @@
|
||||
//package com.gh.gamecenter;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.content.Intent;
|
||||
//import android.os.Bundle;
|
||||
//import android.text.TextUtils;
|
||||
//import android.view.View;
|
||||
//import android.view.inputmethod.EditorInfo;
|
||||
//import android.widget.EditText;
|
||||
//import android.widget.LinearLayout;
|
||||
//import android.widget.TextView;
|
||||
//
|
||||
//import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
|
||||
//import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
||||
//import com.gh.common.util.EntranceUtils;
|
||||
//import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
//import com.gh.gamecenter.common.utils.TextHelper;
|
||||
//import com.gh.gamecenter.core.utils.UrlFilterUtils;
|
||||
//import com.gh.gamecenter.common.view.VerticalItemDecoration;
|
||||
//import com.gh.gamecenter.adapter.ToolBoxRvAdapter;
|
||||
//import com.gh.gamecenter.common.entity.ToolBoxEntity;
|
||||
//import com.gh.gamecenter.retrofit.Response;
|
||||
//import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
//import com.gh.gamecenter.common.entity.SuggestType;
|
||||
//import com.google.android.material.appbar.AppBarLayout;
|
||||
//import com.lightgame.utils.Util_System_Keyboard;
|
||||
//import com.lightgame.utils.Utils;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import androidx.annotation.NonNull;
|
||||
//import androidx.annotation.Nullable;
|
||||
//import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
//import androidx.recyclerview.widget.RecyclerView;
|
||||
//import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
//import butterknife.BindView;
|
||||
//import butterknife.OnClick;
|
||||
//import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
//import io.reactivex.schedulers.Schedulers;
|
||||
//
|
||||
///**
|
||||
// * Created by khy on 24/05/17.
|
||||
// */
|
||||
//
|
||||
//public class ToolBoxActivity extends ToolBarActivity implements SwipeRefreshLayout.OnRefreshListener, OnRequestCallBackListener {
|
||||
//
|
||||
// @BindView(R.id.et_search)
|
||||
// public EditText searchEt;
|
||||
// @BindView(R.id.tv_search)
|
||||
// public TextView searchTv;
|
||||
// @BindView(R.id.tv_back)
|
||||
// public View backTv;
|
||||
// @BindView(R.id.toolbox_appbar)
|
||||
// AppBarLayout mAppBar;
|
||||
// @BindView(R.id.toolbox_rv)
|
||||
// RecyclerView mToolboxRv;
|
||||
// @BindView(R.id.reuse_none_data)
|
||||
// LinearLayout mNoneData;
|
||||
// @BindView(R.id.reuse_tv_none_data)
|
||||
// TextView mNoneDataTv;
|
||||
// @BindView(R.id.reuse_no_connection)
|
||||
// LinearLayout mNoConnection;
|
||||
// @BindView(R.id.toolbox_refresh)
|
||||
// SwipeRefreshLayout mRefresh;
|
||||
// @BindView(R.id.reuse_ll_loading)
|
||||
// View mLoading;
|
||||
//
|
||||
// private LinearLayoutManager mLayoutManager;
|
||||
// private ToolBoxRvAdapter mRvAdapter;
|
||||
// private ToolBoxRvAdapter mNormalRvAdapter;
|
||||
//
|
||||
// private boolean mIsSearch; // 记录页面状态 搜索页面/普通页面
|
||||
// private String mSearchKey; // 记录搜索关键字
|
||||
//
|
||||
// Runnable runnable = () -> changeAdapter(true);
|
||||
//
|
||||
// @NonNull
|
||||
// public static Intent getIntent(Context context, String entrance) {
|
||||
// Intent intent = new Intent(context, ToolBoxActivity.class);
|
||||
// intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
|
||||
// return intent;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected int getLayoutId() {
|
||||
// return R.layout.activity_toolbox;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// setNavigationTitle("光环工具箱");
|
||||
//
|
||||
// mRefresh.setColorSchemeResources(R.color.theme);
|
||||
// mRefresh.setOnRefreshListener(this);
|
||||
//
|
||||
// // 跳转到工具箱 https://gitlab.ghzs.com/pm/halo-app-issues/issues/636
|
||||
// String gameId = getIntent().getStringExtra(EntranceUtils.KEY_GAMEID);
|
||||
// String targetUrl = getIntent().getStringExtra(EntranceUtils.KEY_URL);
|
||||
// if (!TextUtils.isEmpty(targetUrl) && !TextUtils.isEmpty(gameId)) {
|
||||
// findGameAndOpenItsToolboxWebview(gameId, targetUrl);
|
||||
// }
|
||||
//
|
||||
// mLayoutManager = new LinearLayoutManager(this);
|
||||
// mToolboxRv.setLayoutManager(mLayoutManager);
|
||||
// mRvAdapter = new ToolBoxRvAdapter(this, this, mIsSearch, mSearchKey);
|
||||
// mToolboxRv.addItemDecoration(new VerticalItemDecoration(this, 8, false));
|
||||
// mToolboxRv.setAdapter(mRvAdapter);
|
||||
//
|
||||
// mNormalRvAdapter = mRvAdapter;
|
||||
//
|
||||
// mToolboxRv.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
// @Override
|
||||
// public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
// super.onScrollStateChanged(recyclerView, newState);
|
||||
// if (newState == RecyclerView.SCROLL_STATE_IDLE && mLayoutManager.findLastVisibleItemPosition() + 1 == mRvAdapter
|
||||
// .getItemCount()) {
|
||||
// if (!mRvAdapter.isOver() && !mRvAdapter.isLoading() && !mRvAdapter.isNetworkError()) {
|
||||
// mRvAdapter.loadData();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mAppBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
||||
// if (verticalOffset == 0) {
|
||||
// mRefresh.setEnabled(true);
|
||||
// } else {
|
||||
// mRefresh.setEnabled(false);
|
||||
// }
|
||||
// int totalScrollRange = appBarLayout.getTotalScrollRange();
|
||||
// if (totalScrollRange == -verticalOffset) {
|
||||
// Util_System_Keyboard.hideSoftKeyboard(this);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// initSearch();
|
||||
// }
|
||||
//
|
||||
// private void findGameAndOpenItsToolboxWebview(String gameId, String url) {
|
||||
// RetrofitManager.getInstance()
|
||||
// .getApi()
|
||||
// .getGameToolBoxData(1, UrlFilterUtils.getFilterQuery("game_id", gameId))
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(new Response<List<ToolBoxEntity>>() {
|
||||
// @Override
|
||||
// public void onResponse(@Nullable List<ToolBoxEntity> response) {
|
||||
// if (response == null) return;
|
||||
//
|
||||
// for (ToolBoxEntity toolbox : response) {
|
||||
// if (url.equals(toolbox.getUrl())) {
|
||||
// Intent intent = WebActivity.getWebByCollectionTools(ToolBoxActivity.this, toolbox, false);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// private void initSearch() {
|
||||
// backTv.setOnClickListener(v -> search(false, ""));
|
||||
//
|
||||
// TextHelper.limitTheLengthOfEditText(searchEt, 20, () -> {
|
||||
// Utils.toast(this, "最多输入20字");
|
||||
// });
|
||||
//
|
||||
// searchTv.setOnClickListener(v -> {
|
||||
// MtaHelper.onEvent("我的光环_新", "工具箱", "点击搜索");
|
||||
// if (TextUtils.isEmpty(searchEt.getText().toString())) {
|
||||
// Utils.toast(this, R.string.search_hint);
|
||||
// return;
|
||||
// }
|
||||
// Util_System_Keyboard.hideSoftKeyboard(this,searchEt);
|
||||
// search(true, searchEt.getText().toString());
|
||||
// });
|
||||
//
|
||||
// searchEt.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
// if (!hasFocus) {
|
||||
// Util_System_Keyboard.hideSoftKeyboard(this, searchEt);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// searchEt.setOnEditorActionListener((v, actionId, event) -> {
|
||||
// if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
// searchTv.performClick();
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @OnClick({R.id.reuse_no_connection, R.id.reuse_none_data})
|
||||
// public void onClick(View view) {
|
||||
// if (view.getId() == R.id.reuse_no_connection) {
|
||||
// mLoading.setVisibility(View.VISIBLE);
|
||||
// mNoConnection.setVisibility(View.GONE);
|
||||
// mLoading.postDelayed(runnable, 1000);
|
||||
// } else if (view.getId() == R.id.reuse_none_data) {
|
||||
// if (mIsSearch) {
|
||||
// // TODO反馈
|
||||
// MtaHelper.onEvent("我的光环_新", "工具箱", "点击反馈");
|
||||
// SuggestionActivity.startSuggestionActivity(this, SuggestType.functionSuggest, null, null);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadDone() {
|
||||
// mRefresh.setRefreshing(false);
|
||||
// mNoneData.setVisibility(View.GONE);
|
||||
// mNoConnection.setVisibility(View.GONE);
|
||||
// mLoading.setVisibility(View.GONE);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadDone(Object obj) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadEmpty() {
|
||||
// mRefresh.setRefreshing(false);
|
||||
// mNoneData.setVisibility(View.VISIBLE);
|
||||
// mNoConnection.setVisibility(View.GONE);
|
||||
// mLoading.setVisibility(View.GONE);
|
||||
// if (mIsSearch) {
|
||||
// mNoneDataTv.setText("未找到结果,点我反馈");
|
||||
// } else {
|
||||
// mNoneDataTv.setText(getResources().getString(R.string.game_empty));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loadError() {
|
||||
// mRefresh.setRefreshing(false);
|
||||
// mNoneData.setVisibility(View.GONE);
|
||||
// mNoConnection.setVisibility(View.VISIBLE);
|
||||
// mLoading.setVisibility(View.GONE);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onRefresh() {
|
||||
// mRefresh.postDelayed(runnable, 1000);
|
||||
// }
|
||||
//
|
||||
// public void search(boolean isSearch, String searchKey) {
|
||||
// if (mNoneData.getVisibility() == View.VISIBLE) {
|
||||
// mNoneData.setVisibility(View.GONE);
|
||||
// }
|
||||
// if (isSearch) {
|
||||
// mLoading.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// mIsSearch = isSearch;
|
||||
// mSearchKey = searchKey;
|
||||
// changeAdapter(false);
|
||||
// }
|
||||
//
|
||||
// private void changeAdapter(boolean isRefresh) {
|
||||
// if (mIsSearch) {
|
||||
// mRvAdapter = new ToolBoxRvAdapter(this, this, mIsSearch, mSearchKey);
|
||||
// } else {
|
||||
// if (mNormalRvAdapter != null && !isRefresh) {
|
||||
// mRvAdapter = mNormalRvAdapter;
|
||||
// } else {
|
||||
// mRvAdapter = new ToolBoxRvAdapter(this, this, mIsSearch, null);
|
||||
// mNormalRvAdapter = mRvAdapter;
|
||||
// }
|
||||
// }
|
||||
// mToolboxRv.setAdapter(mRvAdapter);
|
||||
//
|
||||
// if (mSearchKey != null) {
|
||||
// searchEt.setText(mSearchKey);
|
||||
// searchEt.setSelection(searchEt.getText().length());
|
||||
// }
|
||||
//
|
||||
// if (mIsSearch) {
|
||||
// backTv.setVisibility(View.VISIBLE);
|
||||
// } else {
|
||||
// backTv.setVisibility(View.GONE);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -269,9 +269,9 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
|
||||
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.inviteFriends) {
|
||||
IntegralLogHelper.INSTANCE.logInviteResult("成功", "微博");
|
||||
}
|
||||
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
|
||||
if (ShareUtils.additionalParams != null && (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
|
||||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.communityArticle ||
|
||||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
|
||||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video)) {
|
||||
com.gh.gamecenter.common.utils.NewLogUtils.logShareResult(ShareUtils.additionalParams, true);
|
||||
SensorsBridge.trackArticleShareResult(
|
||||
ShareUtils.additionalParams.getCustomerType(),
|
||||
@ -319,9 +319,9 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
|
||||
com.gh.gamecenter.common.utils.NewLogUtils.logShareResult(ShareUtils.additionalParams, false);
|
||||
}
|
||||
|
||||
if(ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video
|
||||
if(ShareUtils.additionalParams != null && (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video
|
||||
|| ShareUtils.shareEntrance == ShareUtils.ShareEntrance.communityArticle
|
||||
|| ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal)
|
||||
|| ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal))
|
||||
{
|
||||
SensorsBridge.trackArticleShareResult(
|
||||
ShareUtils.additionalParams.getCustomerType(),
|
||||
|
||||
@ -7,6 +7,7 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -17,17 +18,17 @@ import android.widget.TextView;
|
||||
import androidx.collection.ArrayMap;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.gh.gamecenter.common.utils.BitmapUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.common.util.PackageInstaller;
|
||||
import com.gh.common.util.PackageUtils;
|
||||
import com.gh.gamecenter.core.utils.TimeUtils;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.adapter.viewholder.KcSelectGameViewHolder;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.BitmapUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.core.utils.TimeUtils;
|
||||
import com.gh.gamecenter.core.utils.ToastUtils;
|
||||
import com.gh.gamecenter.databinding.KcGameSelectItemBinding;
|
||||
import com.gh.gamecenter.feature.entity.InstallGameEntity;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
import com.lightgame.utils.RuntimeUtils;
|
||||
|
||||
@ -84,6 +85,7 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
|
||||
Observable.create(emitter -> {
|
||||
// 扫描和获取apk数据 分步操作 尽量避免 StackoverflowError
|
||||
FindAllAPKPath(Environment.getExternalStorageDirectory());
|
||||
FindAllAPKPath(mContext.getFilesDir());
|
||||
LoadApkData();
|
||||
emitter.onComplete();
|
||||
})
|
||||
@ -213,6 +215,10 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
|
||||
DecimalFormat df = new DecimalFormat("#.00");
|
||||
String sizeName = df.format(size) + "MB";
|
||||
|
||||
View itemView = holder.itemView;
|
||||
Drawable background = ContextCompat.getDrawable(itemView.getContext(), R.drawable.reuse_listview_item_style);
|
||||
itemView.setBackground(background);
|
||||
|
||||
holder.binding.selectGameCbRl.setVisibility(View.VISIBLE);
|
||||
holder.binding.selectGameBtn.setVisibility(View.VISIBLE);
|
||||
if (mSelectPosition.get(position)) {
|
||||
|
||||
@ -12,25 +12,24 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.gamecenter.core.utils.StringUtils;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.NewsSearchActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNewsSearchViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameNewsTypeListViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.NewsTextViewHolder;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.StringUtils;
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils;
|
||||
import com.gh.gamecenter.databinding.GameNewsSearchItemBinding;
|
||||
import com.gh.gamecenter.databinding.GameNewsTypeItemBinding;
|
||||
import com.gh.gamecenter.databinding.NewsTextItemBinding;
|
||||
import com.gh.gamecenter.feature.entity.NewsEntity;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailActivity;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
import com.lightgame.utils.Utils;
|
||||
@ -110,7 +109,6 @@ public class GameNewsAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
@Override
|
||||
public List<NewsEntity> apply(List<NewsEntity> list) {
|
||||
// 去除重复数据
|
||||
Config.filterPluginArticle(list);
|
||||
return NewsUtils.removeDuplicateData(mNewsList, list);
|
||||
}
|
||||
})
|
||||
|
||||
@ -205,7 +205,7 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
GameEntity gameEntity = mLibaoEntity.getGame().toGameEntity();
|
||||
GameItemViewHolder.initGameSubtitleAndAdLabel(gameEntity, holder.binding.gameSubtitleTv, null, null, false, null, false, null);
|
||||
} else {
|
||||
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null, mLibaoEntity.getGame().getIconFloat());
|
||||
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null, null);
|
||||
}
|
||||
holder.binding.libaodetailName.setText(mLibaoEntity.getName());
|
||||
if (TextUtils.isEmpty(mLibaoEntity.getPlatform())) {
|
||||
|
||||
@ -18,35 +18,35 @@ import com.gh.common.util.ConcernContentUtils;
|
||||
import com.gh.common.util.DataCollectionUtils;
|
||||
import com.gh.common.util.DialogUtils;
|
||||
import com.gh.common.util.DirectUtils;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.common.util.NewsUtils;
|
||||
import com.gh.gamecenter.core.utils.NumberUtils;
|
||||
import com.gh.gamecenter.core.utils.StringUtils;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.common.utils.TimestampUtils;
|
||||
import com.gh.gamecenter.NewsDetailActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.ShareCardActivity;
|
||||
import com.gh.gamecenter.ShareCardPicActivity;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentHeadViewHolder;
|
||||
import com.gh.gamecenter.adapter.viewholder.CommentViewHolder;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.common.retrofit.OkHttpCache;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.common.utils.ImageUtils;
|
||||
import com.gh.gamecenter.common.utils.TextHelper;
|
||||
import com.gh.gamecenter.common.utils.TimestampUtils;
|
||||
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
|
||||
import com.gh.gamecenter.feature.databinding.NewsDigestItemBinding;
|
||||
import com.gh.gamecenter.feature.viewholder.NewsDigestViewHolder;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.core.utils.MtaHelper;
|
||||
import com.gh.gamecenter.core.utils.NumberUtils;
|
||||
import com.gh.gamecenter.core.utils.StringUtils;
|
||||
import com.gh.gamecenter.databinding.CommentHeadItemBinding;
|
||||
import com.gh.gamecenter.feature.databinding.NewsDigestItemBinding;
|
||||
import com.gh.gamecenter.feature.entity.ArticleCommentParent;
|
||||
import com.gh.gamecenter.feature.entity.CommentEntity;
|
||||
import com.gh.gamecenter.feature.entity.ConcernEntity;
|
||||
import com.gh.gamecenter.feature.eventbus.EBDeleteComment;
|
||||
import com.gh.gamecenter.feature.viewholder.NewsDigestViewHolder;
|
||||
import com.gh.gamecenter.manager.VisitManager;
|
||||
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.common.retrofit.OkHttpCache;
|
||||
import com.gh.gamecenter.common.retrofit.Response;
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailActivity;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter;
|
||||
import com.lightgame.utils.Utils;
|
||||
@ -297,7 +297,7 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
if (mConcernEntity.getGame() != null) {
|
||||
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGame().getIcon(), mConcernEntity.getGame().getIconSubscript(), mConcernEntity.getGame().getIconFloat());
|
||||
} else {
|
||||
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGameIcon(), null, mConcernEntity.getGame().getIconFloat());
|
||||
viewHolder.binding.newsDigestThumb.displayGameIcon(mConcernEntity.getGameIcon(), null, null);
|
||||
}
|
||||
viewHolder.binding.newsDigestTitle.setText(mConcernEntity.getGameName());
|
||||
NewsUtils.setNewsPublishOn(viewHolder.binding.newsDigestTime, mConcernEntity.getTime());
|
||||
|
||||
@ -47,7 +47,6 @@ import com.gh.gamecenter.teenagermode.TeenagerModeActivity.Companion.getIntent
|
||||
import com.gh.vspace.VHelper
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.DownloadStatus
|
||||
import com.lightgame.download.FileUtils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import java.io.File
|
||||
|
||||
@ -57,7 +56,7 @@ class DetailViewHolder(
|
||||
val gameEntity: GameEntity,
|
||||
val isNewsDetail: Boolean, // 新闻详情不显示下载的游戏名, 只显示下载状态
|
||||
entrance: String?,
|
||||
name: String,
|
||||
name: String?,
|
||||
title: String?,
|
||||
val traceEvent: ExposureEvent?,
|
||||
val isSupportDualButton: Boolean = false // 是否支持双下载按钮,不支持的时候跟普通列表意义选用优先级高的那个来显示
|
||||
@ -104,7 +103,7 @@ class DetailViewHolder(
|
||||
val localDownloadListener = OnDetailDownloadClickListener(
|
||||
mViewHolder = this,
|
||||
mEntrance = entrance,
|
||||
mName = name,
|
||||
mName = name ?: "",
|
||||
mTitle = title ?: "",
|
||||
mAsVGame = false,
|
||||
mShowDualDownloadButton = gameDownloadMode == GameEntity.GAME_DOWNLOAD_BUTTON_MODE_DUAL,
|
||||
@ -114,7 +113,7 @@ class DetailViewHolder(
|
||||
val vGameDownloadListener = OnDetailDownloadClickListener(
|
||||
mViewHolder = this,
|
||||
mEntrance = entrance,
|
||||
mName = name,
|
||||
mName = name ?: "",
|
||||
mTitle = title ?: "",
|
||||
mAsVGame = true,
|
||||
mShowDualDownloadButton = gameDownloadMode == GameEntity.GAME_DOWNLOAD_BUTTON_MODE_DUAL,
|
||||
@ -278,7 +277,7 @@ class DetailViewHolder(
|
||||
NewSimulatorGameManager.showUpdateNewsSimulator(mViewHolder.context, mGameEntity, null)
|
||||
return
|
||||
}
|
||||
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(mGameEntity.getApk()[0].url)
|
||||
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(mGameEntity.getApk().firstOrNull()?.url)
|
||||
if (downloadEntity != null) {
|
||||
val file = File(downloadEntity.path)
|
||||
if (!file.exists()) {
|
||||
@ -331,7 +330,7 @@ class DetailViewHolder(
|
||||
gameName = mGameEntity.name ?: "",
|
||||
action = "主动安装"
|
||||
)
|
||||
val (_, _, _, url) = mGameEntity.getApk()[0]
|
||||
val url = mGameEntity.getApk().firstOrNull()?.url
|
||||
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(url)
|
||||
if (mGameEntity.simulator != null) {
|
||||
val isInstalled = PackageUtils.isInstalledFromAllPackage(
|
||||
@ -523,7 +522,7 @@ class DetailViewHolder(
|
||||
else -> if (mGameEntity.getApk().isNotEmpty()) {
|
||||
val intent = DownloadManagerActivity.getDownloadMangerIntent(
|
||||
mViewHolder.context,
|
||||
mGameEntity.getApk()[0].url,
|
||||
mGameEntity.getApk().firstOrNull()?.url,
|
||||
StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])")
|
||||
)
|
||||
mViewHolder.context.startActivity(intent)
|
||||
@ -545,8 +544,8 @@ class DetailViewHolder(
|
||||
ToastUtils.toast("暂时无法下载,请稍后再试")
|
||||
return
|
||||
}
|
||||
val apkEntity = mGameEntity.getApk()[0]
|
||||
val msg = FileUtils.isCanDownload(mViewHolder.context, apkEntity.size)
|
||||
val apkEntity = mGameEntity.getApk().firstOrNull()
|
||||
val msg = FileUtils.isCanDownload(mViewHolder.context, apkEntity?.size ?: "")
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
val btnContainsUpdateText = mViewHolder.context.getString(R.string.update_v) == buttonText
|
||||
|| buttonText.contains(mViewHolder.context.getString(R.string.update))
|
||||
@ -615,7 +614,6 @@ class DetailViewHolder(
|
||||
builder.addHandler(BrowserInstallHandler())
|
||||
builder.addHandler(PackageCheckHandler())
|
||||
builder.addHandler(DownloadDialogHelperHandler())
|
||||
builder.addHandler(CertificationHandler())
|
||||
builder.addHandler(VersionNumberHandler())
|
||||
builder.addHandler(LandPageAddressHandler())
|
||||
builder.addHandler(OverseaDownloadHandler())
|
||||
@ -624,7 +622,6 @@ class DetailViewHolder(
|
||||
download(asVGame, isSubscribe as Boolean)
|
||||
}
|
||||
} else {
|
||||
builder.addHandler(CertificationHandler())
|
||||
builder.addHandler(VersionNumberHandler())
|
||||
builder.setProcessEndCallback { _: Boolean?, _: Any? ->
|
||||
DownloadDialog.showDownloadDialog(
|
||||
|
||||
@ -19,4 +19,7 @@ class CommonCollectionDetailTwoItemViewHolder(val binding: CommonCollectionDetai
|
||||
BaseRecyclerViewHolder<Any>(binding.root)
|
||||
|
||||
class CommonCollectionImageTextItemViewHolder(val binding: CommonCollectionImageTextItemBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root)
|
||||
|
||||
class CommonCollectionDetailTwoItemHorizontalViewHolder(val binding: CommonCollectionDetailTwoItemHorizontalCustomBinding) :
|
||||
BaseRecyclerViewHolder<Any>(binding.root)
|
||||
@ -272,12 +272,6 @@ class AmwayAdapter(
|
||||
}
|
||||
|
||||
binding.commentContainer.setOnClickListener {
|
||||
val exposureSource = if (useAlternativeLayout) {
|
||||
arrayListOf(ExposureSource("新首页"), ExposureSource("安利墙"))
|
||||
} else {
|
||||
arrayListOf(ExposureSource("安利墙"))
|
||||
}.toJson()
|
||||
|
||||
val intent = RatingReplyActivity.getIntent(
|
||||
context = context,
|
||||
gameId = amway.game.id,
|
||||
@ -285,7 +279,7 @@ class AmwayAdapter(
|
||||
comment = amway.comment,
|
||||
commentId = amway.comment.id,
|
||||
showKeyboardIfReplyListIsEmpty = false,
|
||||
exposureSource = exposureSource,
|
||||
exposureSource = basicExposureSource.toJson(),
|
||||
entrance = viewModel.entrance ?: "",
|
||||
path = EntranceConsts.ENTRANCE_AMWAY
|
||||
)
|
||||
|
||||
@ -4,13 +4,14 @@ import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.ethanhua.skeleton.Skeleton
|
||||
import com.gh.common.exposure.ExposureListener
|
||||
import com.gh.common.iinterface.ISearchToolbarTab
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.xapk.XapkInstaller
|
||||
@ -35,7 +36,6 @@ import com.gh.gamecenter.databinding.FragmentAmwayBinding
|
||||
import com.gh.gamecenter.entity.RatingComment
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.fragment.HomeSearchToolWrapperFragment
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingFragment
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadEntity
|
||||
@ -54,9 +54,9 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
|
||||
private var mAdapter: AmwayAdapter? = null
|
||||
|
||||
private var mIsFromMainWrapper = false
|
||||
private var mUseAlternativeLayout = false
|
||||
private var mIsCollapsed = false
|
||||
private var mTabIndex = -1
|
||||
|
||||
private val dataWatcher = object : DataWatcher() {
|
||||
override fun onDataChanged(downloadEntity: DownloadEntity) {
|
||||
@ -73,9 +73,9 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
mUseAlternativeLayout = arguments?.getBoolean(EntranceConsts.KEY_IS_HOME, false) ?: false
|
||||
mIsFromMainWrapper = arguments?.getBoolean(EntranceConsts.KEY_IS_FROM_MAIN_WRAPPER, false) ?: false
|
||||
mTabIndex = arguments?.getInt(EntranceConsts.KEY_TAB_INDEX, -1) ?: -1
|
||||
super.onCreate(savedInstanceState)
|
||||
mUseAlternativeLayout = mIsFromTabWrapper
|
||||
}
|
||||
|
||||
override fun getStubLayoutId() = R.layout.fragment_stub
|
||||
@ -142,8 +142,8 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
if (mAdapter == null) {
|
||||
val basicExposureSource = arrayListOf<ExposureSource>().apply {
|
||||
arguments?.getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let {
|
||||
add(it)
|
||||
arguments?.getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)?.let {
|
||||
addAll(it)
|
||||
}
|
||||
add(ExposureSource("安利墙", ""))
|
||||
}
|
||||
@ -156,24 +156,28 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
override fun isAutomaticLoad() = false
|
||||
|
||||
private fun initDefaultLayout() {
|
||||
val statusBarHeight = DisplayUtils.getStatusBarHeight(context?.resources)
|
||||
mDefaultBinding?.run {
|
||||
nightMaskView.goneIf(!mIsDarkModeOn)
|
||||
|
||||
// toolbar 消费 fitsSystemWindows 避免在 collapsingToolbar 下面出现多出来的 padding
|
||||
// [https://stackoverflow.com/questions/48137666/viewgroup-inside-collapsingtoolbarlayout-show-extra-bottom-padding-when-set-fits]
|
||||
ViewCompat.setOnApplyWindowInsetsListener(appbar) { _, insets ->
|
||||
(toolbar.layoutParams as ViewGroup.MarginLayoutParams).topMargin = insets.systemWindowInsetTop
|
||||
insets.consumeSystemWindowInsets()
|
||||
(toolbar.layoutParams as MarginLayoutParams).topMargin = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
if (mIsFromMainWrapper) {
|
||||
(toolbar.layoutParams as MarginLayoutParams).topMargin = statusBarHeight
|
||||
}
|
||||
|
||||
val collapsingTrigger = 66F.dip2px() + DisplayUtils.getStatusBarHeight(context?.resources)
|
||||
val collapsingTrigger = 66F.dip2px() + statusBarHeight
|
||||
|
||||
toolbar.setNavigationOnClickListener { requireActivity().finish() }
|
||||
|
||||
collapsingToolbar.scrimVisibleHeightTrigger = collapsingTrigger
|
||||
collapsingToolbar.scrimShownAction = {
|
||||
mIsCollapsed = it
|
||||
DisplayUtils.setLightStatusBar(requireActivity(), !mIsDarkModeOn && it)
|
||||
updateStatusBar()
|
||||
if (it) {
|
||||
titleTv.alpha = 1F
|
||||
titleTv.setTextColor(ContextCompat.getColor(requireContext(), R.color.text_black))
|
||||
@ -181,7 +185,7 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
titleTv.setTextColor(ContextCompat.getColor(requireContext(), R.color.white))
|
||||
}
|
||||
|
||||
if (mIsFromMainWrapper) {
|
||||
if (mIsFromMainWrapper || mIsFromTabWrapper) {
|
||||
toolbar.navigationIcon = null
|
||||
} else {
|
||||
toolbar.setNavigationIcon(if (it) R.drawable.ic_bar_back else R.drawable.ic_toolbar_back_white)
|
||||
@ -207,11 +211,6 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
mListRefresh?.isEnabled = absOffset <= 2
|
||||
}
|
||||
|
||||
if (mIsFromMainWrapper) {
|
||||
fab.layoutParams = (fab.layoutParams as MarginLayoutParams).apply {
|
||||
setMargins(0, 0, 14F.dip2px(), 72F.dip2px())
|
||||
}
|
||||
}
|
||||
fab.setOnClickListener {
|
||||
MtaHelper.onEvent("发表评论", "进入", "上墙")
|
||||
ifLogin("安利墙") {
|
||||
@ -224,7 +223,7 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
mListRefresh?.setProgressViewOffset(
|
||||
false,
|
||||
0,
|
||||
118F.dip2px() + DisplayUtils.getStatusBarHeight(requireContext().resources)
|
||||
118F.dip2px() + statusBarHeight
|
||||
)
|
||||
mSkeletonScreen =
|
||||
Skeleton.bind(mDefaultBinding?.skeletonPlaceholder).shimmer(false).load(R.layout.fragment_amway_skeleton)
|
||||
@ -244,14 +243,7 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
mAlternativeBinding?.listRv?.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
super.onScrolled(recyclerView, dx, dy)
|
||||
val scrollY = recyclerView.computeVerticalScrollOffset()
|
||||
mAlternativeBinding?.headerContainer?.translationY = -scrollY.toFloat()
|
||||
if (parentFragment is HomeSearchToolWrapperFragment && isSupportVisible) {
|
||||
(parentFragment as HomeSearchToolWrapperFragment).onScrollChanged(
|
||||
mAlternativeBinding?.headerContainer?.measuredHeight ?: 0,
|
||||
scrollY
|
||||
)
|
||||
}
|
||||
onScrollChanged()
|
||||
}
|
||||
})
|
||||
|
||||
@ -274,7 +266,12 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
mElapsedHelper.resetCounting()
|
||||
mElapsedHelper.resumeCounting()
|
||||
|
||||
if (mIsFromMainWrapper) {
|
||||
updateStatusBar()
|
||||
}
|
||||
|
||||
private fun updateStatusBar() {
|
||||
if (!mIsFromTabWrapper && isSupportVisible) {
|
||||
DisplayUtils.transparentStatusBar(requireActivity())
|
||||
DisplayUtils.setLightStatusBar(requireActivity(), !mIsDarkModeOn && mIsCollapsed)
|
||||
}
|
||||
}
|
||||
@ -330,17 +327,16 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun onScrollChanged() {
|
||||
if (parentFragment is HomeSearchToolWrapperFragment) {
|
||||
val scrollY = mAlternativeBinding?.listRv?.computeVerticalScrollOffset()
|
||||
if (scrollY != null) {
|
||||
mAlternativeBinding?.headerContainer?.translationY = -scrollY.toFloat()
|
||||
if (parentFragment is HomeSearchToolWrapperFragment && isSupportVisible) {
|
||||
(parentFragment as HomeSearchToolWrapperFragment).onScrollChanged(
|
||||
mAlternativeBinding?.headerContainer?.measuredHeight ?: 0,
|
||||
scrollY
|
||||
)
|
||||
}
|
||||
fun onScrollChanged(isDarkModeChanged: Boolean = false) {
|
||||
val scrollY = mAlternativeBinding?.listRv?.computeVerticalScrollOffset()
|
||||
if (scrollY != null) {
|
||||
mAlternativeBinding?.headerContainer?.translationY = -scrollY.toFloat()
|
||||
if (mTabIndex == (parentFragment as? ISearchToolbarTab)?.getCurrentTabIndex()) {
|
||||
(parentFragment as ISearchToolbarTab).onScrollChanged(
|
||||
mAlternativeBinding?.headerContainer?.measuredHeight ?: 0,
|
||||
scrollY,
|
||||
isDarkModeChanged
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -355,15 +351,13 @@ class AmwayFragment : LazyListFragment<AmwayListItemData, AmwayViewModel>() {
|
||||
mAlternativeBinding?.secondBackground?.goneIf(mIsDarkModeOn)
|
||||
mAlternativeBinding?.topBackgroundView?.goneIf(mIsDarkModeOn)
|
||||
mAlternativeBinding?.listRefresh?.setBackgroundColor(R.color.ui_background.toColor(requireContext()))
|
||||
onScrollChanged()
|
||||
onScrollChanged(true)
|
||||
} else {
|
||||
mDefaultBinding?.nightMaskView?.goneIf(!mIsDarkModeOn)
|
||||
mDefaultBinding?.appbar?.setBackgroundColor(R.color.ui_surface.toColor(requireContext()))
|
||||
mDefaultBinding?.collapsingToolbar?.setContentScrimColor(R.color.ui_surface.toColor(requireContext()))
|
||||
mDefaultBinding?.listRefresh?.setBackgroundColor(R.color.ui_background.toColor(requireContext()))
|
||||
}
|
||||
if (mIsFromMainWrapper) {
|
||||
DisplayUtils.setLightStatusBar(requireActivity(), !mIsDarkModeOn && mIsCollapsed)
|
||||
}
|
||||
updateStatusBar()
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,6 @@ class CategoryV2Activity : DownloadToolbarActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setToolbarMenu(R.menu.menu_search)
|
||||
updateStatusBarColor(R.color.ui_surface, R.color.ui_surface)
|
||||
}
|
||||
|
||||
|
||||
@ -24,13 +24,13 @@ import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.databinding.FragmentCategoryBinding
|
||||
import com.gh.gamecenter.entity.CategoryEntity
|
||||
import com.gh.gamecenter.entity.SidebarsEntity
|
||||
import com.gh.gamecenter.fragment.HomeSearchToolWrapperViewModel
|
||||
import com.gh.gamecenter.wrapper.SearchToolbarTabWrapperViewModel
|
||||
|
||||
class CategoryV2Fragment : LazyFragment() {
|
||||
|
||||
private var mBinding: FragmentCategoryBinding? = null
|
||||
private var mViewModel: CategoryV2ViewModel? = null
|
||||
private var mHomeViewModel: HomeSearchToolWrapperViewModel? = null
|
||||
private var mHomeViewModel: SearchToolbarTabWrapperViewModel? = null
|
||||
private var mEntity: SidebarsEntity? = null
|
||||
private var mSpecialCatalogFragment: SpecialCatalogFragment? = null
|
||||
private var mCategoryV2ListFragment: CategoryV2ListFragment? = null
|
||||
@ -68,8 +68,10 @@ class CategoryV2Fragment : LazyFragment() {
|
||||
|
||||
// 除了这里以外,下面还有一个判断是否为首页 tab 栏的赋值
|
||||
mViewModel?.entrance = if (mEntrance.contains("首页")) "首页" else "板块"
|
||||
if (arguments?.getBoolean(EntranceConsts.KEY_IS_HOME) == true) {
|
||||
mHomeViewModel = viewModelProviderFromParent()
|
||||
|
||||
val multiTabNavId = arguments?.getString(EntranceConsts.KEY_MULTI_TAB_NAV_ID, "") ?: ""
|
||||
if (arguments?.getBoolean(EntranceConsts.KEY_IS_HOME) == true && multiTabNavId.isNotEmpty()) {
|
||||
mHomeViewModel = viewModelProviderFromParent(SearchToolbarTabWrapperViewModel.Factory(multiTabNavId, ""), multiTabNavId)
|
||||
mViewModel?.entrance = "首页Tab栏"
|
||||
}
|
||||
mViewModel?.logAppearance()
|
||||
@ -79,7 +81,7 @@ class CategoryV2Fragment : LazyFragment() {
|
||||
|
||||
override fun initRealView() {
|
||||
super.initRealView()
|
||||
|
||||
initMenu(R.menu.menu_search)
|
||||
setNavigationTitle(mCategoryTitle)
|
||||
|
||||
mBinding?.run {
|
||||
@ -491,6 +493,7 @@ class CategoryV2Fragment : LazyFragment() {
|
||||
|
||||
override fun onDarkModeChanged() {
|
||||
super.onDarkModeChanged()
|
||||
getItemMenu(R.id.menu_search)?.setIcon(R.drawable.ic_column_search)
|
||||
mBinding?.categoryRv?.adapter?.run {
|
||||
mBinding?.categoryRv?.recycledViewPool?.clear()
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user