Compare commits
131 Commits
fix/va-tes
...
hotfix/va-
| Author | SHA1 | Date | |
|---|---|---|---|
| c6f70d1b4c | |||
| 0cd281a53c | |||
| e92d89d498 | |||
| a22858389b | |||
| e9d091043d | |||
| db4ac95094 | |||
| 13be47d440 | |||
| beee098cfe | |||
| d67aaf956b | |||
| 1ed9151b1f | |||
| 13f20f6883 | |||
| 78e320a192 | |||
| e51db47fad | |||
| ac02ea88b9 | |||
| f60004fc81 | |||
| 0cf39a82e2 | |||
| 315f244153 | |||
| f4bdc02d70 | |||
| aef39eb481 | |||
| dc2e7147d9 | |||
| fdcb6342bf | |||
| b0da4f8986 | |||
| f7cc906cc5 | |||
| 795fbabd90 | |||
| e770f8a359 | |||
| dd12b103be | |||
| 21f4a398d5 | |||
| 8dfb1644a8 | |||
| 9744b95126 | |||
| 009608165c | |||
| 98356a7dd7 | |||
| 8389041379 | |||
| 2e63257523 | |||
| fa663cd2f6 | |||
| 19af061311 | |||
| d643795fa3 | |||
| b1f2d0a303 | |||
| bb906f0bb8 | |||
| 6f242dcc95 | |||
| b47a64c63d | |||
| 948df2582c | |||
| 35edcf1d68 | |||
| 286d7650f2 | |||
| e566ab838f | |||
| cae720d4ec | |||
| 925516724f | |||
| a5f807c038 | |||
| f442a70bd3 | |||
| 9b3dab9897 | |||
| d939aae901 | |||
| 028974ec0d | |||
| ecd4610186 | |||
| 21e5f2c98d | |||
| 71c0cfe350 | |||
| 3b8b60bc6b | |||
| ac59158dbb | |||
| 5becdf2095 | |||
| a88b49344f | |||
| f34646cde8 | |||
| 9e8ffce772 | |||
| 008985489a | |||
| 2f3fbd3e7c | |||
| abef224830 | |||
| 8feb9b788e | |||
| 0a059deb44 | |||
| 448160d255 | |||
| 533f93a340 | |||
| d80b8a97a3 | |||
| f2e6d98788 | |||
| 238a83c5fe | |||
| ca71f23363 | |||
| c96b41c621 | |||
| e8ee63d52c | |||
| 90359cfffd | |||
| a3da883033 | |||
| a9f1437a52 | |||
| 8c95286fe5 | |||
| 8a835a94e3 | |||
| 14ec4aed3a | |||
| 07f956a1f0 | |||
| 6ef8d04e57 | |||
| 30248ef205 | |||
| 87b9bb0bf3 | |||
| b346882bfa | |||
| eeddb5ea51 | |||
| 78f9aa3ee4 | |||
| f34ad0675d | |||
| 36abcc9f19 | |||
| ae878eddf1 | |||
| ece519115b | |||
| b9e0a8e37a | |||
| 34ca8896ae | |||
| d6e19bfaff | |||
| 943fb4d4e0 | |||
| 2c5471d524 | |||
| cf527db60e | |||
| f261991a55 | |||
| ab66621751 | |||
| af262c624a | |||
| d2813ecbda | |||
| 0ea932e36d | |||
| 68151ed6f9 | |||
| e6d2361008 | |||
| 570b777c8e | |||
| 0e557b2246 | |||
| f155440814 | |||
| 62ba9fc7bf | |||
| 4637aa8808 | |||
| 81998e3aad | |||
| 82a8aa03ba | |||
| c876711578 | |||
| 41fcee7f4d | |||
| 0ccbc4d581 | |||
| f05fc73e3a | |||
| ca3c545f26 | |||
| 226539328e | |||
| bb7db78b0c | |||
| ede62c5363 | |||
| 12bb6824ea | |||
| 15c0950754 | |||
| f86b7fe12a | |||
| d12cdbd34b | |||
| 8436d4eda3 | |||
| be832037a7 | |||
| b620257825 | |||
| 6c88cace99 | |||
| f875fa1b14 | |||
| 8076c3a70a | |||
| bebab317a3 | |||
| c450ca570d | |||
| d239b0755f |
@ -2,9 +2,7 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android' // kotlin
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
apply plugin: 'com.google.devtools.ksp'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'therouter'
|
||||
|
||||
import groovy.xml.XmlUtil
|
||||
|
||||
@ -53,10 +51,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
ksp {
|
||||
arg("ROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
multiDexEnabled true
|
||||
@ -129,6 +123,12 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
kapt {
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.name)
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
// exclude 部分冗余的文件
|
||||
exclude 'META-INF/gradle/incremental.annotation.processors'
|
||||
@ -197,7 +197,7 @@ android {
|
||||
java.srcDirs = ['src/main/java', "src/default/java"]
|
||||
}
|
||||
internal {
|
||||
java.srcDirs = ['src/main/java', "src/default/java", "src/internal/java"]
|
||||
java.srcDirs = ['src/main/java', "src/default/java"]
|
||||
}
|
||||
tea {
|
||||
java.srcDirs = ['src/main/java', 'src/tea/java']
|
||||
@ -372,15 +372,13 @@ dependencies {
|
||||
// debugImplementation "com.gu.android:toolargetool:${toolargetool}" // 需要使用调试时才启用
|
||||
debugImplementation "com.github.nichbar:WhatTheStack:${whatTheStack}"
|
||||
|
||||
ksp project(":feature:route_doc")
|
||||
|
||||
implementation "androidx.multidex:multidex:${multiDex}"
|
||||
implementation "androidx.fragment:fragment-ktx:${fragment}"
|
||||
|
||||
implementation "androidx.annotation:annotation:${annotation}"
|
||||
|
||||
implementation "androidx.viewpager2:viewpager2:${viewpager2}"
|
||||
ksp("androidx.room:room-compiler:${room}")
|
||||
kapt "androidx.room:room-compiler:${room}"
|
||||
|
||||
implementation "com.tencent.vasdolly:helper:${apkChannelPackage}"
|
||||
implementation "com.tencent.vasdolly:writer:${apkChannelPackage}"
|
||||
@ -430,8 +428,7 @@ dependencies {
|
||||
|
||||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:${desugarJdkLibs}"
|
||||
|
||||
kapt "com.google.auto.service:auto-service:${autoServiceVersion}"
|
||||
ksp "cn.therouter:apt:${routerVersion}"
|
||||
kapt "com.alibaba:arouter-compiler:$arouterVersion"
|
||||
|
||||
implementation project(':ndownload')
|
||||
implementation project(':vspace-bridge:vspace')
|
||||
@ -449,13 +446,13 @@ dependencies {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
|
||||
// implementation(project(':module_setting')) {
|
||||
// exclude group: 'androidx.swiperefreshlayout'
|
||||
// }
|
||||
implementation(project(':module_setting')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
|
||||
implementation(project(':module_setting_compose')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
// implementation(project(':module_setting_compose')) {
|
||||
// exclude group: 'androidx.swiperefreshlayout'
|
||||
// }
|
||||
|
||||
if (!gradle.ext.excludeOptionalModules || gradle.ext.enablePkg) {
|
||||
implementation(project(':feature:pkg'))
|
||||
|
||||
@ -638,7 +638,7 @@
|
||||
<!-- android:theme="@android:style/Theme.Translucent" />-->
|
||||
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.SkipCompatActivity"
|
||||
android:name="com.gh.gamecenter.SkipActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.AppCompat.Light.Fullscreen.Transparent">
|
||||
<intent-filter>
|
||||
@ -663,7 +663,8 @@
|
||||
android:name=".authorization.AuthorizationActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
android:screenOrientation="portrait"
|
||||
android:taskAffinity=".auth">
|
||||
<intent-filter>
|
||||
<data android:scheme="ghzhushou_authorization" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
@ -864,10 +865,6 @@
|
||||
<!-- tools:node="remove" />-->
|
||||
<!-- </provider>-->
|
||||
|
||||
<service android:name="com.gh.gamecenter.install.InstallService" />
|
||||
|
||||
<service android:name="com.gh.download.suspendwindow.DownloadSuspendWindowService" />
|
||||
|
||||
<receiver
|
||||
android:name="com.gh.gamecenter.receiver.DownloadReceiver"
|
||||
android:exported="false">
|
||||
|
||||
@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Animatable
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
@ -12,12 +13,14 @@ import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.therouter.TheRouter
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.facebook.drawee.controller.BaseControllerListener
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.facebook.imagepipeline.image.ImageInfo
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.util.DirectUtils.directToLinkPage
|
||||
import com.gh.common.util.LogUtils
|
||||
import com.gh.common.util.NewFlatLogUtils.logOpenScreenAdSkip
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.MainActivity
|
||||
@ -59,6 +62,8 @@ object AdDelegateHelper {
|
||||
private val mGameSearchAdList: ArrayList<AdConfig> by lazy { arrayListOf() }
|
||||
private var mVGameLaunchAd: AdConfig? = null
|
||||
|
||||
private var ownerSplashAdLoadTime = 0L
|
||||
|
||||
val vGameLaunchAd: AdConfig?
|
||||
get() = mVGameLaunchAd
|
||||
|
||||
@ -76,6 +81,7 @@ object AdDelegateHelper {
|
||||
}
|
||||
|
||||
var isShowingSplashAd = false // 是否正在显示开屏广告
|
||||
var isOwnerSplashAdShown = false // 自有开屏广告是否展示
|
||||
var gameSearchKeyword = ""
|
||||
|
||||
fun initAdSdk(context: Context) {
|
||||
@ -94,7 +100,8 @@ object AdDelegateHelper {
|
||||
private fun initAdSdkInternal(context: Context) {
|
||||
// 初始化穿山甲
|
||||
if (mCsjAdImpl == null) {
|
||||
mCsjAdImpl = TheRouter.get(ICsjAdProvider::class.java)
|
||||
mCsjAdImpl =
|
||||
ARouter.getInstance().build(RouteConsts.provider.csjAd).navigation() as? ICsjAdProvider
|
||||
val csjAppId = if (EnvHelper.isDevEnv) BuildConfig.DEV_CSJ_APPID else BuildConfig.CSJ_APPID
|
||||
mCsjAdImpl?.initSDK(context, csjAppId, HaloApp.getInstance().oaid)
|
||||
// 监听亮色/暗色模式切换
|
||||
@ -302,6 +309,7 @@ object AdDelegateHelper {
|
||||
) {
|
||||
val hideCallback = {
|
||||
isShowingSplashAd = false
|
||||
isOwnerSplashAdShown = false
|
||||
hideAction.invoke()
|
||||
}
|
||||
if (mSplashAd != null) {
|
||||
@ -574,6 +582,8 @@ object AdDelegateHelper {
|
||||
handler: BaseActivity.BaseHandler,
|
||||
hideCallback: () -> Unit
|
||||
) {
|
||||
isOwnerSplashAdShown = false
|
||||
|
||||
val jumpBtn = startAdContainer.findViewById<TextView>(R.id.jumpBtn)
|
||||
val jumpDetailBtn: TextView = startAdContainer.findViewById(R.id.jumpDetailBtn)
|
||||
val adImage: SimpleDraweeView = startAdContainer.findViewById(R.id.adImage)
|
||||
@ -592,38 +602,62 @@ object AdDelegateHelper {
|
||||
)
|
||||
|
||||
adImage.visibleIf(true)
|
||||
ImageUtils.display(adImage, ad.img)
|
||||
ImageUtils.displayWithCallback(adImage, ad.img, true, object : BaseControllerListener<ImageInfo>() {
|
||||
override fun onSubmit(id: String?, callerContext: Any?) {
|
||||
super.onSubmit(id, callerContext)
|
||||
adImage.post {
|
||||
ownerSplashAdLoadTime = System.currentTimeMillis()
|
||||
NewFlatLogUtils.logSplashAdLoad(ad.id)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinalImageSet(id: String?, imageInfo: ImageInfo?, animatable: Animatable?) {
|
||||
isOwnerSplashAdShown = true
|
||||
adImage.post {
|
||||
NewFlatLogUtils.logSplashAdShow(ad.id, System.currentTimeMillis() - ownerSplashAdLoadTime)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(id: String?, throwable: Throwable?) {
|
||||
super.onFailure(id, throwable)
|
||||
NewFlatLogUtils.logSplashAdFail(ad.id, "启动广告图加载失败")
|
||||
}
|
||||
})
|
||||
|
||||
if (ad.isImageType) {
|
||||
adVideo.visibleIf(false)
|
||||
} else {
|
||||
adVideo.visibleIf(true)
|
||||
adVideo.startPlay(ad.video.url)
|
||||
}
|
||||
startAdContainer.setOnClickListener {
|
||||
// 拦截点击事件传递
|
||||
}
|
||||
jumpBtn.setOnClickListener {
|
||||
handler.removeMessages(MainActivity.COUNTDOWN_AD)
|
||||
hideCallback.invoke()
|
||||
val linkEntity = ad.jump
|
||||
logOpenScreenAdSkip(
|
||||
ad.id,
|
||||
(if (linkEntity.text != null) linkEntity.text else "")!!,
|
||||
(if (linkEntity.type != null) linkEntity.type else "")!!,
|
||||
(if (linkEntity.link != null) linkEntity.link else "")!!
|
||||
)
|
||||
SensorsBridge.trackEvent(
|
||||
"SplashAdOwnSkip",
|
||||
"splash_ad_id",
|
||||
ad.id,
|
||||
"link_type",
|
||||
linkEntity.type ?: "",
|
||||
"link_id",
|
||||
linkEntity.link ?: "",
|
||||
"link_text",
|
||||
linkEntity.text ?: ""
|
||||
)
|
||||
it.debounceActionWithInterval(1000L) {
|
||||
if (!isOwnerSplashAdShown) {
|
||||
NewFlatLogUtils.logSplashAdFail(ad.id, "加载过程中点击跳过广告")
|
||||
}
|
||||
handler.removeMessages(MainActivity.COUNTDOWN_AD)
|
||||
hideCallback.invoke()
|
||||
val linkEntity = ad.jump
|
||||
NewFlatLogUtils.logOpenScreenAdSkip(
|
||||
ad.id,
|
||||
(if (linkEntity.text != null) linkEntity.text else "")!!,
|
||||
(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))
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
package com.gh.ad
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewStub
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.provider.ILaunchAd
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
@ -12,8 +15,10 @@ import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.entity.AdConfig
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.vaAd, name = "畅玩启动页广告")
|
||||
class LaunchAdImpl : ILaunchAd {
|
||||
override fun init(context: Context?) {
|
||||
}
|
||||
|
||||
override fun requestAd(fragment: Fragment, container: ViewGroup, maskView: View, topViewStub: ViewStub, bottomViewStub: ViewStub, adClickAction: () -> Unit): View {
|
||||
if (AdDelegateHelper.shouldShowHelperLaunchAd()) {
|
||||
@ -99,4 +104,4 @@ class LaunchAdImpl : ILaunchAd {
|
||||
companion object {
|
||||
private const val AD_PLACEMENT = "畅玩启动"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,6 +44,16 @@ class SplashAdVideoView @JvmOverloads constructor(
|
||||
return R.layout.layout_splash_ad_video
|
||||
}
|
||||
|
||||
override fun touchSurfaceMoveFullLogic(absDeltaX: Float, absDeltaY: Float) {
|
||||
// no nothing
|
||||
}
|
||||
|
||||
override fun onPrepared() {
|
||||
super.onPrepared()
|
||||
|
||||
visibility = VISIBLE
|
||||
}
|
||||
|
||||
override fun onAutoCompletion() {
|
||||
setStateAndUi(CURRENT_STATE_AUTO_COMPLETE);
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.therouter.TheRouter
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.ad.AdDelegateHelper
|
||||
import com.gh.common.util.FloatingBackViewManager
|
||||
import com.gh.common.xapk.XapkInstaller
|
||||
@ -53,7 +53,7 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
||||
if (GlobalActivityManager.activityCount == 1) {
|
||||
// 清除桌面角标
|
||||
if (activity !is SplashScreenActivity && activity !is AuthorizationActivity) {
|
||||
val pushProvider = TheRouter.get(IPushProvider::class.java)
|
||||
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
||||
pushProvider?.cleanBadgeNumber(activity.applicationContext)
|
||||
}
|
||||
}
|
||||
@ -126,7 +126,9 @@ class GlobalActivityLifecycleObserver : Application.ActivityLifecycleCallbacks {
|
||||
}
|
||||
|
||||
private fun isSuggestionActivity(activity: Activity): Boolean {
|
||||
val helpAndFeedbackProvider = TheRouter.get(IHelpAndFeedbackProvider::class.java)
|
||||
val helpAndFeedbackProvider =
|
||||
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback)
|
||||
.navigation() as? IHelpAndFeedbackProvider
|
||||
return helpAndFeedbackProvider?.isSuggestionActivity(activity) ?: false
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import com.therouter.TheRouter
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.util.LogUtils
|
||||
@ -345,7 +345,7 @@ class DefaultJsApi(
|
||||
|
||||
@JavascriptInterface
|
||||
fun getPushId(): String {
|
||||
val pushProvider = TheRouter.get(IPushProvider::class.java)
|
||||
val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
||||
return pushProvider?.getRegistrationId(HaloApp.getInstance()) ?: "unknown"
|
||||
}
|
||||
|
||||
@ -424,7 +424,8 @@ class DefaultJsApi(
|
||||
|
||||
@JavascriptInterface
|
||||
fun showQaFeedbackDialog(msg: Any) {
|
||||
val mHelpAndFeedbackHelp = TheRouter.get(IHelpAndFeedbackProvider::class.java)
|
||||
val mHelpAndFeedbackHelp =
|
||||
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback).navigation() as? IHelpAndFeedbackProvider
|
||||
mHelpAndFeedbackHelp?.showQaFeedbackDialogFragment(context as AppCompatActivity, msg.toString())
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +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.SkipCompatActivity
|
||||
import com.gh.gamecenter.WebActivity
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
@ -67,10 +66,6 @@ object DefaultUrlHandler {
|
||||
bringAppToFront: Boolean = false,
|
||||
sourceEntrance: String = ""): Boolean {
|
||||
val uri = Uri.parse(url)
|
||||
|
||||
// 优先交给新的路由拦截处理
|
||||
if (SkipCompatActivity.handleSkip(context, uri)) return true
|
||||
|
||||
if ("ghzhushou" == uri.scheme) {
|
||||
Utils.log("url = $url")
|
||||
Utils.log("url = " + uri.scheme!!)
|
||||
|
||||
@ -114,8 +114,6 @@ public class Config {
|
||||
if (!TextUtils.isEmpty(json)) {
|
||||
mSettingsEntity = GsonUtils.fromJson(json, SettingsEntity.class);
|
||||
}
|
||||
|
||||
mSettingsEntity.setGameSmooth("off");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -287,19 +287,11 @@ public class BindingAdapters {
|
||||
});
|
||||
break;
|
||||
case RESERVED:
|
||||
if ("download".equals(gameEntity.getReserveStatus())) {
|
||||
ReservationHelper.showDeleteReservationDialog(progressBar.getContext(), () -> {
|
||||
ReservationHelper.deleteReservation(gameEntity, () -> {
|
||||
updateReservation(progressBar, gameEntity);
|
||||
});
|
||||
ReservationHelper.showCancelReservationDialog(progressBar.getContext(),gameEntity, () -> {
|
||||
ReservationHelper.cancelReservation(gameEntity, () -> {
|
||||
updateReservation(progressBar, gameEntity);
|
||||
});
|
||||
} else {
|
||||
ReservationHelper.showCancelReservationDialog(progressBar.getContext(),gameEntity, () -> {
|
||||
ReservationHelper.cancelReservation(gameEntity, () -> {
|
||||
updateReservation(progressBar, gameEntity);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
case H5_GAME:
|
||||
LinkEntity linkEntity = gameEntity.getH5Link();
|
||||
|
||||
@ -17,7 +17,7 @@ import com.gh.gamecenter.common.entity.ErrorEntity
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.databinding.DialogWechatBindingFailedBinding
|
||||
import com.gh.gamecenter.login.user.UserRepository
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
class WechatBindingFailedDialogFragment : BaseDialogFragment() {
|
||||
@ -48,10 +48,10 @@ class WechatBindingFailedDialogFragment : BaseDialogFragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
UserRepository.getInstance().loginUserInfo.observe(viewLifecycleOwner) {
|
||||
currentUserId = it.data.getShortUserId()
|
||||
binding.tvCurrentName.text = it.data.name
|
||||
binding.ivCurrentAvatar.displayAvatar(it.data.icon)
|
||||
UserManager.getInstance().userInfoEntity?.let {
|
||||
currentUserId = it.getShortUserId()
|
||||
binding.tvCurrentName.text = it.name ?: ""
|
||||
binding.ivCurrentAvatar.displayAvatar(it.icon)
|
||||
binding.tvUserId.text = getString(R.string.user_id, currentUserId)
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
|
||||
override fun onFragmentPaused(fm: FragmentManager, f: Fragment) {
|
||||
if (fragment == f) {
|
||||
visibleState?.let { commitExposure(it) }
|
||||
visibleState?.let { commitWXCPMExposure(it) }
|
||||
throttleBus.clear()
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
package com.gh.common.fragment
|
||||
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import java.lang.reflect.Field
|
||||
|
||||
fun FragmentManager.popBackStackAllowStateLoss() {
|
||||
popBackStackAllowStateLoss(-1, 0)
|
||||
}
|
||||
|
||||
fun FragmentManager.popBackStackAllowStateLoss(id: Int, flags: Int) {
|
||||
if (!isStateSaved) {
|
||||
popBackStack(id, flags)
|
||||
}
|
||||
}
|
||||
|
||||
fun FragmentManager.popBackStackAllowStateLoss(name: String?, flags: Int) {
|
||||
if (!isStateSaved) {
|
||||
popBackStack(name, flags)
|
||||
}
|
||||
}
|
||||
|
||||
fun FragmentManager.popBackStackImmediateAllowStateLoss() = popBackStackAllowStateLoss(-1, 0)
|
||||
|
||||
fun FragmentManager.popBackStackImmediateAllowStateLoss(id: Int, flags: Int) =
|
||||
if (!isStateSaved) {
|
||||
popBackStackImmediate(id, flags)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
@Throws(NoSuchFieldException::class)
|
||||
private fun getField(clazz: Class<*>, name: String): Field {
|
||||
var cls: Class<*>? = clazz
|
||||
while (cls != null) {
|
||||
try {
|
||||
val declaredField = cls.getDeclaredField(name)
|
||||
declaredField.isAccessible = true
|
||||
return declaredField
|
||||
} catch (e: NoSuchFieldException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
cls = cls.superclass
|
||||
}
|
||||
throw NoSuchFieldException()
|
||||
}
|
||||
@ -1,12 +1,9 @@
|
||||
package com.gh.common.iinterface
|
||||
|
||||
interface ISmartRefreshContent {
|
||||
/**
|
||||
* 启用/关闭 页面滑动
|
||||
* @param isScrollEnabled 是否启用
|
||||
*/
|
||||
fun setScrollEnabled(isScrollEnabled: Boolean)
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||
import com.scwang.smartrefresh.layout.constant.RefreshState
|
||||
|
||||
interface ISmartRefreshContent {
|
||||
fun onRefresh()
|
||||
|
||||
/**
|
||||
@ -14,4 +11,6 @@ interface ISmartRefreshContent {
|
||||
* @param isSwipeRefreshEnabled 是否启用
|
||||
*/
|
||||
fun setSwipeRefreshEnabled(isSwipeRefreshEnabled: Boolean)
|
||||
|
||||
fun onStateChanged(refreshLayout: RefreshLayout, oldState: RefreshState, newState: RefreshState)
|
||||
}
|
||||
@ -103,6 +103,7 @@ class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priori
|
||||
context = activity,
|
||||
gameId = gameEntity.id,
|
||||
entrance = "首页插件上架弹窗",
|
||||
defaultTab = -1,
|
||||
isSkipGameComment = false,
|
||||
scrollToLibao = false,
|
||||
openVideoStreaming = false,
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.ActivationHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IActivationProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.activation, name = "ActivationHelper暴露服务")
|
||||
class ActivationProviderImpl : IActivationProvider {
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun sendActivationInfo() {
|
||||
ActivationHelper.sendActivationInfo()
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.AdHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity
|
||||
import com.gh.gamecenter.feature.provider.IAdHelperProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.adHelper, name = "AdHelper暴露服务")
|
||||
class AdHelperProviderImpl : IAdHelperProvider {
|
||||
override fun getSuggestionFunctionAd(): SettingsEntity.AD? {
|
||||
return AdHelper.getAd(AdHelper.LOCATION_SUGGESTION_FUNCTION)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,20 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IAppProvider
|
||||
import com.gh.gamecenter.core.provider.IFlavorProvider
|
||||
import com.gh.gamecenter.va.VCore
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.app, name = "Application暴露服务")
|
||||
class AppProviderImpl : IAppProvider {
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun getAppName(): String {
|
||||
return HaloApp.getInstance().getString(R.string.app_name)
|
||||
@ -88,5 +93,4 @@ class AppProviderImpl : IAppProvider {
|
||||
override fun initImageLoaderIfNeeded() {
|
||||
HaloApp.getInstance().initFresco()
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,16 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.databind.BindingAdapters
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.provider.IBindingAdaptersProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.bindingAdapters, name = "BindingAdapters暴露服务")
|
||||
class BindingAdaptersProviderImpl : IBindingAdaptersProvider {
|
||||
override fun setGameName(
|
||||
view: TextView,
|
||||
@ -28,4 +31,8 @@ class BindingAdaptersProviderImpl : IBindingAdaptersProvider {
|
||||
override fun setGame(view: View, gameEntity: GameEntity) {
|
||||
BindingAdapters.setGame(view, gameEntity)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,12 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.download.server.BrowserInstallHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IBrowserInstallHelperProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.browserInstallHelper, name = "BrowserInstallHelper暴露服务")
|
||||
class BrowserInstallHelperProviderImpl : IBrowserInstallHelperProvider {
|
||||
override fun isUseBrowserToInstallEnabled(): Boolean = BrowserInstallHelper.isUseBrowserToInstallEnabled()
|
||||
|
||||
@ -12,4 +15,9 @@ class BrowserInstallHelperProviderImpl : IBrowserInstallHelperProvider {
|
||||
override fun logSwitchInstallSettingEvent() {
|
||||
BrowserInstallHelper.logOrdinaryBrowserEvent(BrowserInstallHelper.Type.SWITCH_INSTALL_SETTING)
|
||||
}
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,17 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IBuildConfigProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.buildConfig, name = "BuildConfig暴露服务")
|
||||
class BuildConfigImpl : IBuildConfigProvider {
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
override fun getApplicationId(): String = BuildConfig.APPLICATION_ID
|
||||
|
||||
override fun getVersionName(): String = BuildConfig.VERSION_NAME
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.CheckLoginUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.ICheckLoginProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.checkLogin, name = "CheckLoginUtils暴露服务")
|
||||
class CheckLoginProviderImpl : ICheckLoginProvider {
|
||||
override fun checkLogin(context: Context, entrance: String, action: (() -> Unit)?) {
|
||||
CheckLoginUtils.checkLogin(context, entrance, action)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -3,16 +3,20 @@ package com.gh.common.provider
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Parcelable
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.CommentDetailActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ICommentDetailProvider
|
||||
import com.gh.gamecenter.feature.entity.MessageEntity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.commentDetail, name = "CommentDetailActivity暴露服务")
|
||||
class CommentDetailProviderImpl : ICommentDetailProvider {
|
||||
|
||||
override fun getIntent(context: Context, commentId: String?, message: Parcelable): Intent {
|
||||
return CommentDetailActivity.getIntent(context, commentId, message as MessageEntity.Article)
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,18 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.ICommentManagerProvider
|
||||
import com.gh.gamecenter.manager.CommentManager
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.commentManager, name = "CommentManager暴露服务")
|
||||
class CommentManagerProviderImpl : ICommentManagerProvider {
|
||||
override fun addUrl(ids: String) {
|
||||
CommentManager.getInstance().addUrl(ids)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,12 +2,12 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.CommentUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ICommentUtilsProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.commentUtils, name = "CommentUtils暴露服务")
|
||||
class CommentUtilsProviderImpl : ICommentUtilsProvider {
|
||||
override fun setCommentTime(textView: TextView, time: Long) {
|
||||
CommentUtils.setCommentTime(textView, time)
|
||||
@ -16,4 +16,8 @@ class CommentUtilsProviderImpl : ICommentUtilsProvider {
|
||||
override fun getCommentTime(timestamp: Long): String {
|
||||
return CommentUtils.getCommentTime(timestamp)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.gh.common.util.ConcernContentUtils
|
||||
import com.gh.common.view.ImageContainerView
|
||||
@ -18,7 +18,7 @@ import com.gh.gamecenter.common.utils.toArrayList
|
||||
import com.gh.gamecenter.core.provider.IConcernArticleUtilsProvider
|
||||
import com.gh.gamecenter.databinding.RecyclerGameArticleBinding
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.concernContentUtils, name = "ConcernContentUtils暴露服务")
|
||||
class ConcernArticleUtilsProviderImpl : IConcernArticleUtilsProvider {
|
||||
override fun addContentPic(
|
||||
context: Context,
|
||||
@ -95,4 +95,8 @@ class ConcernArticleUtilsProviderImpl : IConcernArticleUtilsProvider {
|
||||
override fun getTvComment(binding: ViewBinding): TextView = (binding as RecyclerGameArticleBinding).tvComment
|
||||
|
||||
override fun getTvShare(binding: ViewBinding): TextView = (binding as RecyclerGameArticleBinding).tvShare
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -6,14 +6,14 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.core.provider.IConcernGiftPackUtilsProvider
|
||||
import com.gh.gamecenter.databinding.RecyclerGiftPackBinding
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.concernGiftPackUtils, name = "ConcernGiftPackUtils暴露服务")
|
||||
class ConcernGiftPackUtilsProviderImpl : IConcernGiftPackUtilsProvider {
|
||||
override fun createBinding(parent: ViewGroup): ViewBinding {
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
@ -48,4 +48,7 @@ class ConcernGiftPackUtilsProviderImpl : IConcernGiftPackUtilsProvider {
|
||||
override fun getTvGiftPackContent(viewBinding: ViewBinding) =
|
||||
(viewBinding as RecyclerGiftPackBinding).tvGiftPackContent
|
||||
|
||||
}
|
||||
override fun init(context: Context?) {
|
||||
// Do Nothing
|
||||
}
|
||||
}
|
||||
@ -2,15 +2,19 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.ConcernActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IConcernProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.concernActivity, name = "ConcernActivity暴露服务")
|
||||
class ConcernProviderImpl : IConcernProvider {
|
||||
|
||||
override fun getIntent(context: Context, entrance: String): Intent {
|
||||
return ConcernActivity.getIntent(context, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,14 +2,18 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IConcernShareNewsProvider
|
||||
import com.gh.gamecenter.newsdetail.NewsShareDialog
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.concernShareNews, name = "ConcernShareNews暴露服务")
|
||||
class ConcernShareNewsProviderImpl : IConcernShareNewsProvider {
|
||||
override fun share(activity: AppCompatActivity, shortId: String?, id: String?, gameIcon: String?, title: String?) {
|
||||
NewsShareDialog.show(activity, shortId, id, gameIcon, title)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do Nothing
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,12 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IConfigProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.config, name = "Config暴露服务")
|
||||
class ConfigProviderImpl : IConfigProvider {
|
||||
override fun getTencentAppId(): String {
|
||||
return Config.TENCENT_APPID
|
||||
@ -100,4 +103,8 @@ class ConfigProviderImpl : IConfigProvider {
|
||||
override fun isJiguangSwitch(): Boolean {
|
||||
return Config.getNewApiSettingsEntity()?.jiguangSwitch ?: false
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity
|
||||
import com.gh.gamecenter.feature.provider.IConfigSettingProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.configSetting, name = "Config.getSettings暴露服务")
|
||||
class ConfigSettingProviderImpl : IConfigSettingProvider {
|
||||
override fun getSettings(): SettingsEntity? {
|
||||
return Config.getSettings()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DataCollectionUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.IDataCollectionProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.dataCollection, name = "DataCollectionUtils暴露服务")
|
||||
class DataCollectionProviderImpl : IDataCollectionProvider {
|
||||
override fun uploadClick(context: Context, vararg args: String) {
|
||||
DataCollectionUtils.uploadClick(context, *args)
|
||||
@ -15,4 +15,8 @@ class DataCollectionProviderImpl : IDataCollectionProvider {
|
||||
override fun uploadConcern(context: Context, vararg args: String) {
|
||||
DataCollectionUtils.uploadConcern(context, *args)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,20 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DataUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IDataUtilsProvider
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.dataUtils, name = "DataUtils暴露服务")
|
||||
class DataUtilsProviderImpl : IDataUtilsProvider {
|
||||
|
||||
override fun getDeviceCertification() {
|
||||
DataUtils.getDeviceCertification(HaloApp.getInstance().gid)
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.DefaultUrlHandler
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IDefaultUrlHandlerProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.defaultUrlHandler, name = "DefaultUrlHandler暴露服务")
|
||||
class DefaultUrlHandlerProviderImpl : IDefaultUrlHandlerProvider {
|
||||
|
||||
override fun interceptUrl(
|
||||
@ -19,4 +19,7 @@ class DefaultUrlHandlerProviderImpl : IDefaultUrlHandlerProvider {
|
||||
return DefaultUrlHandler.interceptUrl(context, url, null, entrance, bringAppToFront, sourceEntrance)
|
||||
}
|
||||
|
||||
}
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,12 +2,14 @@ package com.gh.common.provider
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.gamecenter.common.callback.CancelListener
|
||||
import com.gh.gamecenter.common.callback.ConfirmListener
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IDialogUtilsProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.dialogUtils, name = "DialogUtils暴露服务")
|
||||
class DialogUtilsProviderImpl : IDialogUtilsProvider {
|
||||
override fun showRegulationTestDialog(context: Context, confirm: () -> Unit, cancel: () -> Unit) {
|
||||
DialogUtils.showRegulationTestDialog(context, object : ConfirmListener {
|
||||
@ -43,4 +45,8 @@ class DialogUtilsProviderImpl : IDialogUtilsProvider {
|
||||
}
|
||||
|
||||
override fun showBindPhoneDialog(context: Context, confirm: () -> Unit): Dialog = DialogUtils.showBindPhoneDialog(context) { confirm.invoke() }
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -3,12 +3,12 @@ package com.gh.common.provider
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IDirectProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.directUtils, name = "DirectUtils暴露服务")
|
||||
class DirectProviderImpl : IDirectProvider {
|
||||
|
||||
override fun directToWebView(context: Context, url: String, entrance: String?) {
|
||||
@ -96,4 +96,8 @@ class DirectProviderImpl : IDirectProvider {
|
||||
override fun directToExternalBrowser(context: Context, url: String) {
|
||||
DirectUtils.directToExternalBrowser(context, url)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,10 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity
|
||||
@ -14,7 +17,7 @@ import com.gh.gamecenter.packagehelper.PackageRepository
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.downloadButtonClickedHandler, name = "DownloadButton点击事件暴露服务")
|
||||
class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
override fun onClicked(downloadButton: DownloadButton) {
|
||||
var gameId = ""
|
||||
@ -112,6 +115,12 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
"本地下载"
|
||||
}
|
||||
|
||||
// 小游戏的启动不需要上报下载点击事件
|
||||
// @see https://jira.shanqu.cc/browse/GHZSCY-7013
|
||||
if (boundedObject is GameEntity && boundedObject.isMiniGame()) {
|
||||
return
|
||||
}
|
||||
|
||||
// 上报神策点击事件
|
||||
val customPageKV = customPageTrackData?.toKV() ?: arrayOf()
|
||||
SensorsBridge.trackEventWithExposureSource(
|
||||
@ -121,7 +130,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
"game_name", gameName,
|
||||
"game_type", gameTypeInChinese,
|
||||
"download_status", downloadStatusInChinese,
|
||||
"button_name", downloadButton.text,
|
||||
"button_name", text,
|
||||
"game_schema_type", gameSchemaType,
|
||||
"download_type", downloadType,
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
@ -136,4 +145,8 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,13 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IDownloadManagerProvider
|
||||
import com.lightgame.download.DownloadEntity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.downloadManager, name = "DownloadManager暴露服务")
|
||||
class DownloadManagerProviderImpl : IDownloadManagerProvider {
|
||||
|
||||
override fun getDownloadEntityByUrl(url: String): DownloadEntity? {
|
||||
@ -15,4 +18,8 @@ class DownloadManagerProviderImpl : IDownloadManagerProvider {
|
||||
DownloadManager.getInstance().resumeAllInvisiblePendingTask()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,16 +5,15 @@ import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.gamecenter.common.avoidcallback.Callback
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IEntranceUtilsProvider
|
||||
import com.lightgame.utils.AppManager
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.entranceUtils, name = "EntranceUtils暴露服务")
|
||||
class EntranceUtilsProviderImpl : IEntranceUtilsProvider {
|
||||
|
||||
override fun jumpActivity(context: Context, bundle: Bundle) {
|
||||
EntranceUtils.jumpActivity(context, bundle)
|
||||
}
|
||||
@ -33,6 +32,10 @@ class EntranceUtilsProviderImpl : IEntranceUtilsProvider {
|
||||
} else {
|
||||
EntranceUtils.jumpActivityCompat(AppManager.getInstance().currentActivity(), bundle)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,14 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.ErrorHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IErrorHelperProvider
|
||||
import com.gh.gamecenter.login.user.LoginTag
|
||||
import retrofit2.HttpException
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.errorHelper, name = "ErrorHelper暴露服务")
|
||||
class ErrorHelperProviderImpl : IErrorHelperProvider {
|
||||
|
||||
override fun handleError(
|
||||
@ -25,4 +28,7 @@ class ErrorHelperProviderImpl : IErrorHelperProvider {
|
||||
ErrorHelper.handleLoginError(context, httpException, loginTagChinese, isCertificate)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,20 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.provider.IExposureManagerProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.exposureManager, name = "ExposureManager暴露服务")
|
||||
class ExposureManagerProviderImpl: IExposureManagerProvider {
|
||||
override fun logExposure(exposureEvent: ExposureEvent) {
|
||||
ExposureManager.log(exposureEvent)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +1,18 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.FixedRateJobHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IFixedRateJobHelperProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.fixedRateJobHelper, name = "FixedRateJobHelper暴露服务")
|
||||
class FixedRateJobHelperProviderImpl : IFixedRateJobHelperProvider {
|
||||
override fun getTimeDeltaBetweenServerAndClient(): Long {
|
||||
return FixedRateJobHelper.timeDeltaBetweenServerAndClient
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,12 +2,12 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.IGameCollectionDetailProvider
|
||||
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.gameCollectionDetail, name = "GameCollectionDetailActivity暴露服务")
|
||||
class GameCollectionDetailProviderImpl : IGameCollectionDetailProvider {
|
||||
override fun getIntent(context: Context, gameCollectionId: String, isFromSquare: Boolean): Intent {
|
||||
return GameCollectionDetailActivity.getIntent(context, gameCollectionId, isFromSquare)
|
||||
@ -16,4 +16,9 @@ class GameCollectionDetailProviderImpl : IGameCollectionDetailProvider {
|
||||
override fun getSpecifiedCommentIntent(context: Context, gameCollectionId: String, topCommentId: String): Intent {
|
||||
return GameCollectionDetailActivity.getSpecifiedCommentIntent(context, gameCollectionId, topCommentId)
|
||||
}
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,14 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.GameDetailActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.provider.IGameDetailProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.gameDetail, name = "GameDetailActivity暴露服务")
|
||||
class GameDetailProviderImpl : IGameDetailProvider {
|
||||
override fun startGameDetailActivity(
|
||||
context: Context,
|
||||
@ -52,6 +54,7 @@ class GameDetailProviderImpl : IGameDetailProvider {
|
||||
context: Context,
|
||||
gameId: String,
|
||||
entrance: String?,
|
||||
defaultTab: Int,
|
||||
isSkipGameComment: Boolean,
|
||||
scrollToLibao: Boolean,
|
||||
openVideoStreaming: Boolean,
|
||||
@ -62,6 +65,7 @@ class GameDetailProviderImpl : IGameDetailProvider {
|
||||
context,
|
||||
gameId,
|
||||
entrance,
|
||||
defaultTab,
|
||||
isSkipGameComment,
|
||||
scrollToLibao,
|
||||
openVideoStreaming,
|
||||
@ -69,4 +73,8 @@ class GameDetailProviderImpl : IGameDetailProvider {
|
||||
traceEvent
|
||||
)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,18 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.GameTrendsHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IGameTrendsHelperProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.gameTrendsHelper, name = "GameTrendsHelper暴露服务")
|
||||
class GameTrendsHelperProviderImpl : IGameTrendsHelperProvider {
|
||||
override fun updateReadPostTime() {
|
||||
GameTrendsHelper.updateReadPostTime()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,17 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.countOccurrences
|
||||
import com.gh.gamecenter.core.provider.IHandleGameResponseProvider
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.handleGameResponse, name = "处理游戏类型返回")
|
||||
class HandleGameResponseProviderImpl : IHandleGameResponseProvider {
|
||||
|
||||
override fun handleGameResponse(response: List<Any>, entrance: String): List<Any> {
|
||||
@ -34,4 +37,8 @@ class HandleGameResponseProviderImpl : IHandleGameResponseProvider {
|
||||
return response
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +1,18 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.history.HistoryHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IHistoryHelperProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.historyHelper, name = "HistoryHelper暴露服务")
|
||||
class HistoryHelperProviderImpl : IHistoryHelperProvider {
|
||||
override fun emptyDatabase() {
|
||||
HistoryHelper.emptyDatabase()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,13 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.LibaoUtils
|
||||
import com.gh.common.util.LibaoUtils.PostLibaoListener
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.ILibaoUtilsProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.libaoUtils, name = "LibaoUtils暴露服务")
|
||||
class LibaoUtilsProviderImpl : ILibaoUtilsProvider {
|
||||
override fun getLibaoStatus(ids: String, successCallback: ((Any?) -> Unit)?, failureCallback: (() -> Unit)?) {
|
||||
LibaoUtils.getLibaoStatus(ids, object : PostLibaoListener {
|
||||
@ -20,4 +20,8 @@ class LibaoUtilsProviderImpl : ILibaoUtilsProvider {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
@ -10,7 +10,7 @@ import com.gh.gamecenter.common.entity.SuggestType
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.linkDirectUtils, name = "DirectUtils暴露服务,主要是暴露directToLinkPage方法")
|
||||
class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
|
||||
|
||||
override fun directToLinkPage(
|
||||
@ -61,4 +61,7 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
|
||||
DirectUtils.directToCommunityColumn(context, community, subjectId, entrance, path)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.*
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.logUtils, name = "LogUtils暴露服务")
|
||||
class LogUtilsProviderImpl : ILogUtilsProvider {
|
||||
|
||||
override fun login(loginStep: String, loginType: String, entrance: String) {
|
||||
LogUtils.login(loginStep, loginType, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
19
app/src/main/java/com/gh/common/provider/MainProviderImpl.kt
Normal file
19
app/src/main/java/com/gh/common/provider/MainProviderImpl.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.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, type: String) {
|
||||
DirectUtils.directToHomeDefaultTab(context)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,13 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.MessageDetailActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.ConcernEntity
|
||||
import com.gh.gamecenter.feature.provider.IMessageDetailProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.messageDetail, name = "MessageDetailActivity暴露服务")
|
||||
class MessageDetailProviderImpl : IMessageDetailProvider {
|
||||
|
||||
override fun getIntentById(
|
||||
@ -24,4 +24,8 @@ class MessageDetailProviderImpl : IMessageDetailProvider {
|
||||
override fun getIntentByEntity(context: Context, concernEntity: ConcernEntity, entrance: String): Intent? {
|
||||
return MessageDetailActivity.getIntentByEntity(context, concernEntity, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,16 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadCount
|
||||
import com.gh.gamecenter.feature.entity.MessageUnreadEntity
|
||||
import com.gh.gamecenter.feature.provider.IMessageUnreadRepositoryProvider
|
||||
import com.gh.gamecenter.message.MessageUnreadRepository
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.messageUnreadRepository, name = "MessageUnreadRepository暴露服务")
|
||||
class MessageUnreadRepositoryProviderImpl : IMessageUnreadRepositoryProvider {
|
||||
|
||||
override fun loadMessageUnreadData() {
|
||||
@ -30,4 +33,7 @@ class MessageUnreadRepositoryProviderImpl : IMessageUnreadRepositoryProvider {
|
||||
return MessageUnreadRepository.messageUnreadCountLiveData
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,13 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IMiniGameRecentlyPlayedProvider
|
||||
import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.miniGameRecentPlayed, name = "MiniGameRecentlyPlayed暴露服务")
|
||||
class MiniGameRecentlyPlayedProviderImpl : IMiniGameRecentlyPlayedProvider {
|
||||
override fun clearMiniGameRecentlyPlayed(gameType: String) {
|
||||
MiniGameRecentlyPlayUseCase.clearRecentlyPlayedMiniGameList(gameType)
|
||||
@ -16,4 +16,8 @@ class MiniGameRecentlyPlayedProviderImpl : IMiniGameRecentlyPlayedProvider {
|
||||
override fun refreshQQMiniRecentPlayed() {
|
||||
MiniGameRecentlyPlayUseCase.loadRecentlyPlayedMiniGameList(Constants.QQ_MINI_GAME)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// no implement
|
||||
}
|
||||
}
|
||||
@ -2,12 +2,12 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.INewCommentDetailProvider
|
||||
import com.gh.gamecenter.qa.comment.NewCommentDetailActivity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.newCommentDetail, name = "NewCommentDetailActivity暴露服务")
|
||||
class NewCommentDetailProviderImpl : INewCommentDetailProvider {
|
||||
|
||||
override fun getAnswerCommentIntent(
|
||||
@ -76,4 +76,8 @@ class NewCommentDetailProviderImpl : INewCommentDetailProvider {
|
||||
path
|
||||
)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.PackageHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IPackageHelperProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.packageHelper, name = "PackageHelper暴露服务")
|
||||
class PackageHelperProviderImpl : IPackageHelperProvider {
|
||||
|
||||
override fun getLocalPackageNameSet(): Set<String> {
|
||||
return PackageHelper.localPackageNameSet
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,13 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.PackageInstaller
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IPackageInstallerProvider
|
||||
import com.lightgame.download.DownloadEntity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.packageInstaller, name = "PackageInstaller暴露服务")
|
||||
class PackageInstallerProviderImpl : IPackageInstallerProvider {
|
||||
|
||||
override fun install(context: Context, downloadEntity: DownloadEntity, showUnzipToast: Boolean) {
|
||||
@ -16,4 +18,7 @@ class PackageInstallerProviderImpl : IPackageInstallerProvider {
|
||||
PackageInstaller.uninstall(context, path)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,12 +2,14 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageInfo
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.PackageHelper
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
|
||||
import com.gh.gamecenter.core.utils.ProcessUtil
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.packageUtils, name = "PackageUtils暴露服务")
|
||||
class PackageUtilsProviderImpl : IPackageUtilsProvider {
|
||||
override fun obtainProcessName(): String? {
|
||||
return ProcessUtil.getCurrentProcessName()
|
||||
@ -48,4 +50,8 @@ class PackageUtilsProviderImpl : IPackageUtilsProvider {
|
||||
override fun getVersionNameByPackageName(packageName: String): String {
|
||||
return PackageUtils.getVersionNameByPackageName(packageName) ?: ""
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,13 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.GameInstall
|
||||
import com.gh.gamecenter.feature.provider.IPackagesManagerProvider
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.packagesManager, name = "PackagesManager暴露服务")
|
||||
class PackagesManagerProviderImpl: IPackagesManagerProvider {
|
||||
override fun isCanPluggable(gameId: String?, packageName: String?): Boolean {
|
||||
return PackagesManager.isCanPluggable(gameId, packageName)
|
||||
@ -13,4 +16,8 @@ class PackagesManagerProviderImpl: IPackagesManagerProvider {
|
||||
override fun getFilterSameApkInstalledList(): ArrayList<GameInstall> {
|
||||
return PackagesManager.getFilterSameApkInstalledList()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,14 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.IpInfo
|
||||
import com.gh.gamecenter.feature.provider.IRegionSettingHelperProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.regionSettingHelper, name = "RegionSettingHelper暴露服务")
|
||||
class RegionSettingHelperProviderImpl : IRegionSettingHelperProvider {
|
||||
override fun shouldThisGameDisplayMirrorInfo(gameId: String): Boolean {
|
||||
return RegionSettingHelper.shouldThisGameDisplayMirrorInfo(gameId)
|
||||
@ -30,4 +33,8 @@ class RegionSettingHelperProviderImpl : IRegionSettingHelperProvider {
|
||||
override fun shouldThisGameBeFiltered(gameId: String?): Boolean {
|
||||
return RegionSettingHelper.shouldThisGameBeFiltered(gameId)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,12 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.repository.ReservationRepository
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IReservationRepositoryProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.reservationRepository, name = "ReservationRepository暴露服务")
|
||||
class ReservationRepositoryProviderImpl : IReservationRepositoryProvider {
|
||||
|
||||
override fun refreshReservations() {
|
||||
@ -13,4 +16,8 @@ class ReservationRepositoryProviderImpl : IReservationRepositoryProvider {
|
||||
override fun clearReservations() {
|
||||
ReservationRepository.clearReservations()
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -5,12 +5,12 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.ISearchTabUtilsProvider
|
||||
import com.gh.gamecenter.search.viewmodel.SearchTabViewModel
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.searchTabUtils, name = "SearchTabUtils暴露服务")
|
||||
class SearchTabUtilsProviderImpl : ISearchTabUtilsProvider {
|
||||
|
||||
override fun obtainParentViewModel(fragment: Fragment): ViewModel {
|
||||
@ -29,4 +29,8 @@ class SearchTabUtilsProviderImpl : ISearchTabUtilsProvider {
|
||||
null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// no implement
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.ShareCardPicActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.ConcernEntity
|
||||
import com.gh.gamecenter.feature.provider.IShareCardPicProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.shareCardPicActivity, name = "ShareCardPicActivity暴露服务")
|
||||
class ShareCardPicProviderImpl : IShareCardPicProvider {
|
||||
override fun startShareCardPicActivity(context: Context, concernEntity: ConcernEntity, entrance: String) {
|
||||
ShareCardPicActivity.startShareCardPicActivity(context, concernEntity, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.ShareCardActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.ConcernEntity
|
||||
import com.gh.gamecenter.feature.provider.IShareCardProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.shareCardActivity, name = "ShareCardActivity暴露服务")
|
||||
class ShareCardProviderImpl : IShareCardProvider {
|
||||
override fun getIntent(context: Context, concernEntity: ConcernEntity, shareContent: String): Intent {
|
||||
return ShareCardActivity.getIntent(context, concernEntity, shareContent)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@ -3,11 +3,17 @@ package com.gh.common.provider
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Parcelable
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.ShellActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IShellProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.shellActivity, name = "ShellActivity暴露服务")
|
||||
class ShellProviderImpl : IShellProvider {
|
||||
override fun getSwitchInstallMethodIntent(context: Context, extraParcelable: Parcelable?): Intent =
|
||||
ShellActivity.getIntent(context, ShellActivity.Type.SWITCH_INSTALL_METHOD, extraParcelable)
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,15 +2,19 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ISimpleAnswerDetailProvider
|
||||
import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.simpleAnswerDetail, name = "SimpleAnswerDetailActivity暴露服务")
|
||||
class SimpleAnswerDetailProviderImpl : ISimpleAnswerDetailProvider {
|
||||
|
||||
override fun getIntent(context: Context, answerId: String, entrance: String, path: String): Intent {
|
||||
return SimpleAnswerDetailActivity.getIntent(context, answerId, entrance, path)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.ISubjectProvider
|
||||
import com.gh.gamecenter.subject.SubjectActivity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.subject, name = "SubjectActivity暴露服务")
|
||||
class SubjectProviderImpl : ISubjectProvider {
|
||||
override fun startSubjectActivity(
|
||||
context: Context,
|
||||
@ -17,4 +17,8 @@ class SubjectProviderImpl : ISubjectProvider {
|
||||
) {
|
||||
SubjectActivity.startSubjectActivity(context, id, name, isOrder, null, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.feature.exposure.time.TimeUtil
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.ITimeUtilProvider
|
||||
|
||||
@Route(path = RouteConsts.provider.timeUtil, name = "TimeUtil暴露服务")
|
||||
class TimeUtilProviderImpl : ITimeUtilProvider {
|
||||
|
||||
override fun currentTimeMillis() = TimeUtil.currentTimeMillis()
|
||||
|
||||
override fun currentTime() = TimeUtil.currentTime()
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,15 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
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.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.update.UpdateHelper
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.updateManager, name = "UpdateManager暴露服务")
|
||||
class UpdateManagerProviderImpl: IUpdateManagerProvider {
|
||||
override fun checkUpdate(activity: FragmentActivity, ignoreSuppressOption: Boolean) {
|
||||
val dialog = DialogUtils.showWaitDialog(activity, "检查更新中...")
|
||||
@ -23,4 +26,8 @@ class UpdateManagerProviderImpl: IUpdateManagerProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -3,16 +3,20 @@ package com.gh.common.provider
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.UsageStatsHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IUsageStatsHelperProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.usageStatsHelper, name = "UsageStatsHelper暴露服务")
|
||||
class UsageStatsHelperProviderImpl : IUsageStatsHelperProvider {
|
||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP_MR1)
|
||||
override fun checkForPermission(): Boolean = UsageStatsHelper.checkForPermission()
|
||||
override fun skipToUsageStats(context: Context, requestCode: Int) {
|
||||
UsageStatsHelper.skipToUsageStats(context, requestCode)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,13 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.entity.InstallGameEntity
|
||||
import com.gh.gamecenter.feature.provider.IVHelperProvider
|
||||
import com.gh.vspace.VHelper
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.vhelper, name = "VHelper暴露服务")
|
||||
class VHelperProviderImpl: IVHelperProvider {
|
||||
override fun isVGameOn(): Boolean {
|
||||
return VHelper.isVGameOn()
|
||||
@ -18,4 +20,8 @@ class VHelperProviderImpl: IVHelperProvider {
|
||||
override fun launch(context: Context, packageName: String, ignoreGApps: Boolean, showLoading: Boolean) {
|
||||
VHelper.launch(context, packageName, ignoreGApps, showLoading)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IVisitManagerProvider
|
||||
import com.gh.gamecenter.manager.VisitManager
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.visitManager, name = "VisitManager暴露服务")
|
||||
class VisitManagerProviderImpl : IVisitManagerProvider {
|
||||
override fun updateOkhttpCache(context: Context, newsId: String) {
|
||||
VisitManager.updateOkhttpCache(context, newsId)
|
||||
@ -15,4 +15,8 @@ class VisitManagerProviderImpl : IVisitManagerProvider {
|
||||
override fun addUrl(ids: String) {
|
||||
VisitManager.getInstance().addUrl(ids)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -2,10 +2,12 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.WebActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.core.provider.IWebProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
@Route(path = RouteConsts.provider.webActivity, name = "WebActivity暴露服务")
|
||||
class WebProviderImpl : IWebProvider {
|
||||
override fun getIntent(context: Context, url: String, autoCompletionTitle: Boolean): Intent {
|
||||
return WebActivity.getIntent(context, url, autoCompletionTitle)
|
||||
@ -38,4 +40,8 @@ class WebProviderImpl : IWebProvider {
|
||||
): Intent {
|
||||
return WebActivity.getIntentByNews(context, concernLink, concernGameName, concernId, entrance)
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,23 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.common.util.WechatBindHelper
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.entity.WechatConfigEntity
|
||||
import com.gh.gamecenter.core.provider.IWechatBindHelperProvider
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
class WechatHelperProviderImpl : IWechatBindHelperProvider {
|
||||
@Route(path = RouteConsts.provider.wechatHelper, name = "WechatHelper暴露服务")
|
||||
class WechatHelperProviderImpl : IWechatBindHelperProvider<WechatConfigEntity> {
|
||||
|
||||
override fun getWechatConfig(callback: ((Any) -> Unit)?) {
|
||||
override fun getWechatConfig(callback: ((WechatConfigEntity) -> Unit)?) {
|
||||
WechatBindHelper.getWechatConfig {
|
||||
callback?.invoke(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,8 @@ import android.annotation.SuppressLint
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.database.sqlite.SQLiteDiskIOException
|
||||
import android.database.sqlite.SQLiteException
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
@ -284,7 +286,11 @@ object SimulatorGameManager {
|
||||
entity.isRecentlyPlayed = it.id == gameId
|
||||
simulatorGameRecordList.add(entity)
|
||||
}
|
||||
simulatorGameDao.addSimulatorGameList(simulatorGameRecordList)
|
||||
try {
|
||||
simulatorGameDao.addSimulatorGameList(simulatorGameRecordList)
|
||||
} catch (e: SQLiteException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class CheckLoginUtils {
|
||||
}
|
||||
|
||||
if (context != null) {
|
||||
QuickLoginHelper.startLogin(context, entrance, null, callback);
|
||||
QuickLoginHelper.startLogin(context, entrance, callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,13 +9,14 @@ import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.therouter.TheRouter;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.gh.ad.AdDelegateHelper;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.RouteConsts;
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse;
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||
import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.core.provider.ISentryProvider;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
@ -39,6 +40,11 @@ import io.reactivex.schedulers.Schedulers;
|
||||
*/
|
||||
public class DataUtils {
|
||||
|
||||
// 神策 OAID 是否已绑定
|
||||
private static boolean isSensorOAIDBounded = false;
|
||||
// 原始的 OAID 是否已成功获取
|
||||
private static boolean originalOAIDIsReceived = false;
|
||||
|
||||
private DataUtils() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
@ -55,7 +61,7 @@ public class DataUtils {
|
||||
}
|
||||
|
||||
private static void initSentry(Context context, String channel) {
|
||||
ISentryProvider sentryProvider = TheRouter.get(ISentryProvider.class);
|
||||
ISentryProvider sentryProvider = (ISentryProvider) ARouter.getInstance().build(RouteConsts.provider.sentry).navigation();
|
||||
if (sentryProvider != null) {
|
||||
sentryProvider.init(context, channel, BuildConfig.FLAVOR, BuildConfig.VERSION_NAME);
|
||||
}
|
||||
@ -65,7 +71,6 @@ public class DataUtils {
|
||||
// 默认用 APP 级已存储的 GID 来使用,不使用外部 GID
|
||||
String savedGid = SPUtils.getString(Constants.GID);
|
||||
if (!TextUtils.isEmpty(savedGid)) {
|
||||
HaloApp.getInstance().setGid(savedGid);
|
||||
onGidReceived(savedGid);
|
||||
} else {
|
||||
GidHelper.getInstance().registerDevice(HaloApp.getInstance().getApplication(), new GidCallback() {
|
||||
@ -89,6 +94,8 @@ public class DataUtils {
|
||||
}
|
||||
|
||||
private static void onGidReceived(String gid) {
|
||||
bindValidOaidToSensor(false);
|
||||
|
||||
HaloApp.getInstance().setGid(gid);
|
||||
// 更新广告配置
|
||||
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
|
||||
@ -111,6 +118,35 @@ public class DataUtils {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 为神策绑定有效的 OAID
|
||||
*/
|
||||
public static void bindValidOaidToSensor(boolean fromOaidResult) {
|
||||
if (isSensorOAIDBounded) return;
|
||||
|
||||
String oaid = HaloApp.getInstance().getOAID();
|
||||
|
||||
// 来自于 oaid 获取回调,或者说原始 oaid 已经获取成功
|
||||
if (fromOaidResult || originalOAIDIsReceived) {
|
||||
originalOAIDIsReceived = true;
|
||||
// 遇到异常的 OAID
|
||||
if (Constants.INVALID_OAID_1.equals(oaid)
|
||||
|| Constants.INVALID_OAID_2.equals(oaid)
|
||||
|| Constants.INVALID_OAID_3.equals(oaid)
|
||||
|| TextUtils.isEmpty(oaid)) {
|
||||
// 若 gid 不为空,那么整合 gid 作为 oaid https://jira.shanqu.cc/browse/GHZSCY-7004
|
||||
if (HaloApp.getInstance().getGid() != null) {
|
||||
oaid = "GID" + HaloApp.getInstance().getGid();
|
||||
SensorsBridge.INSTANCE.setOAID(oaid);
|
||||
isSensorOAIDBounded = true;
|
||||
}
|
||||
} else {
|
||||
SensorsBridge.INSTANCE.setOAID(oaid);
|
||||
isSensorOAIDBounded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用 gid 绑定的实名信息
|
||||
*/
|
||||
|
||||
@ -139,6 +139,7 @@ public class DetailDownloadUtils {
|
||||
// 游戏包含多 APK 的情况
|
||||
viewHolder.getMultiVersionDownloadTv().setText("选择下载你的版本" + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord));
|
||||
viewHolder.getMultiVersionDownloadTv().setVisibility(View.VISIBLE);
|
||||
viewHolder.getDownloadPb().setTag(com.gh.gamecenter.feature.R.string.download, viewHolder.getMultiVersionDownloadTv().getText());
|
||||
viewHolder.getDownloadPb().setText("");
|
||||
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
|
||||
|
||||
@ -11,7 +11,7 @@ import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.os.bundleOf
|
||||
import com.therouter.TheRouter
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.ad.AdPluginDownloadHelper
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.exposure.ExposureManager.log
|
||||
@ -56,6 +56,7 @@ import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
||||
import com.gh.gamecenter.gamecollection.hotlist.GameCollectionHotListActivity
|
||||
import com.gh.gamecenter.gamecollection.hotlist.GameCollectionListDetailActivity
|
||||
import com.gh.gamecenter.gamecollection.square.GameCollectionSquareActivity
|
||||
import com.gh.gamecenter.gamedetail.GameDetailFragment
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarManagementActivity
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersSubscribedGameListActivity
|
||||
@ -68,6 +69,7 @@ import com.gh.gamecenter.minigame.MiniGameRecentlyPlayUseCase
|
||||
import com.gh.gamecenter.minigame.MiniGameSearchActivity
|
||||
import com.gh.gamecenter.minigame.qq.QGameHomeWrapperActivity
|
||||
import com.gh.gamecenter.newsdetail.NewsDetailActivity
|
||||
import com.gh.gamecenter.personalhome.UserHomeActivity
|
||||
import com.gh.gamecenter.personalhome.background.PersonalityBackgroundActivity
|
||||
import com.gh.gamecenter.personalhome.border.AvatarBorderActivity
|
||||
import com.gh.gamecenter.personalhome.home.UserHistoryViewModel
|
||||
@ -588,16 +590,12 @@ object DirectUtils {
|
||||
@JvmStatic
|
||||
fun directToQa(context: Context, text: String? = "", id: String) {
|
||||
if (id.isEmpty()) return
|
||||
|
||||
val destination = RouteConsts.activity.qaActivity.toDestinationClass()
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, destination?.name ?: "")
|
||||
bundle.putString(KEY_NAVIGATION_TITLE, text)
|
||||
bundle.putString(KEY_QA_ID, id)
|
||||
|
||||
TheRouter.build(RouteConsts.activity.qaActivity)
|
||||
.fillParams {
|
||||
it.putAll(bundle)
|
||||
}
|
||||
.navigation(context)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -606,16 +604,12 @@ object DirectUtils {
|
||||
@JvmStatic
|
||||
fun directToQaCollection(context: Context, text: String, id: String) {
|
||||
if (id.isEmpty()) return
|
||||
|
||||
val destination = RouteConsts.activity.qaActivity.toDestinationClass()
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, destination?.name ?: "")
|
||||
bundle.putString(KEY_NAVIGATION_TITLE, text)
|
||||
bundle.putString(KEY_QA_COLLECTION_ID, id)
|
||||
|
||||
TheRouter.build(RouteConsts.activity.qaActivity)
|
||||
.fillParams {
|
||||
it.putAll(bundle)
|
||||
}
|
||||
.navigation(context)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -726,7 +720,7 @@ object DirectUtils {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToHomeActivity(context: Context, userId: String?, entrance: String? = null, path: String? = null) {
|
||||
directToHomeActivity(context, userId, entrance, path, 0)
|
||||
context.startActivity(UserHomeActivity.getIntent(context, userId ?: "", entrance, path))
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ -765,20 +759,17 @@ object DirectUtils {
|
||||
entrance: String? = null,
|
||||
path: String? = null
|
||||
) {
|
||||
|
||||
IntegralLogHelper.log("view_homepage", "个人主页")
|
||||
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.userHomeActivity)
|
||||
.appendQueryParameter(KEY_USER_ID, userId)
|
||||
.appendQueryParameter(KEY_TAB_INDEX, position.toString())
|
||||
.appendQueryParameter(KEY_PATH, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
.appendQueryParameter(KEY_COMMUNITY_TYPE, UserHistoryViewModel.TYPE.fromValue(type).value)
|
||||
.appendQueryParameter(KEY_GAME_TYPE, gameType)
|
||||
.build()
|
||||
|
||||
TheRouter
|
||||
.build(uri.toString())
|
||||
.navigation(context)
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_USER_ID, userId)
|
||||
bundle.putString(KEY_TO, UserHomeActivity::class.java.name)
|
||||
bundle.putString(KEY_ENTRANCE, BaseActivity.mergeEntranceAndPath(entrance, path))
|
||||
bundle.putString(KEY_PATH, path)
|
||||
bundle.putString(KEY_TYPE, UserHistoryViewModel.TYPE.fromValue(type).value)
|
||||
bundle.putString(KEY_GAME, gameType)
|
||||
bundle.putInt(KEY_POSITION, position ?: 0)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
|
||||
@ -810,10 +801,10 @@ object DirectUtils {
|
||||
bundle.putString(KEY_GAMEID, id)
|
||||
if (!TextUtils.isEmpty(tab)) {
|
||||
when (tab) {
|
||||
"comment" -> bundle.putString(KEY_TARGET, EntranceConsts.TAB_TYPE_RATING)
|
||||
"desc" -> bundle.putString(KEY_TARGET, EntranceConsts.TAB_TYPE_DESC)
|
||||
"forum" -> bundle.putString(KEY_TARGET, EntranceConsts.TAB_TYPE_BBS)
|
||||
"zone" -> bundle.putString(KEY_TARGET, EntranceConsts.TAB_TYPE_TRENDS)
|
||||
"comment" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_RATING)
|
||||
"desc" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
"forum" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_BBS)
|
||||
"zone" -> bundle.putString(KEY_TARGET, GameDetailFragment.TAB_TRENDS)
|
||||
}
|
||||
}
|
||||
if (traceEvent != null) {
|
||||
@ -858,7 +849,7 @@ object DirectUtils {
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_GAMEID, id)
|
||||
bundle.putBoolean(KEY_OPEN_VIDEO_STREAMING, true)
|
||||
bundle.putString(KEY_TARGET, EntranceConsts.TAB_TYPE_DESC)
|
||||
bundle.putString(KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -866,7 +857,7 @@ object DirectUtils {
|
||||
fun directToGameDetail(
|
||||
context: Context,
|
||||
id: String,
|
||||
defaultTab: String = EntranceConsts.TAB_TYPE_DESC,
|
||||
defaultTab: String = GameDetailFragment.TAB_DESC,
|
||||
entrance: String? = null
|
||||
) {
|
||||
val bundle = Bundle()
|
||||
@ -1524,7 +1515,7 @@ object DirectUtils {
|
||||
response?.apply {
|
||||
if (zone.status == "on") {
|
||||
if (zone.style == "link") {
|
||||
directToGameDetail(context, gameId, EntranceConsts.TAB_TYPE_TRENDS, entrance)
|
||||
directToGameDetail(context, gameId, GameDetailFragment.TAB_TRENDS, entrance)
|
||||
} else {
|
||||
directToWebView(context, url, entrance)
|
||||
}
|
||||
@ -1635,11 +1626,11 @@ object DirectUtils {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToHelpAndFeedback(context: Context, bundle: Bundle? = null) {
|
||||
TheRouter.build(RouteConsts.activity.helpAndFeedbackActivity)
|
||||
.fillParams {
|
||||
it.putAll(bundle)
|
||||
}
|
||||
.navigation(context)
|
||||
val destination = RouteConsts.activity.helpAndFeedbackActivity.toDestinationClass()
|
||||
val newBundle = Bundle()
|
||||
newBundle.putString(KEY_TO, destination?.name ?: "")
|
||||
bundle?.let { newBundle.putAll(it) }
|
||||
jumpActivityCompat(context, newBundle)
|
||||
}
|
||||
|
||||
|
||||
@ -1736,7 +1727,8 @@ object DirectUtils {
|
||||
@JvmStatic
|
||||
fun directToConcernInfo(context: Context, entrance: String) {
|
||||
context.startActivity(
|
||||
TheRouter.get(IConcernInfoProvider::class.java)?.getIntent(context, entrance)
|
||||
(ARouter.getInstance().build(RouteConsts.provider.concernInfo)
|
||||
.navigation() as? IConcernInfoProvider)?.getIntent(context, entrance)
|
||||
)
|
||||
}
|
||||
|
||||
@ -1993,7 +1985,10 @@ object DirectUtils {
|
||||
return
|
||||
}
|
||||
|
||||
val qGameProvider = TheRouter.get(IQGameProvider::class.java)
|
||||
val qGameProvider = ARouter
|
||||
.getInstance()
|
||||
.build(RouteConsts.provider.qGame)
|
||||
.navigation() as? IQGameProvider
|
||||
|
||||
if (qGameProvider == null) return
|
||||
|
||||
@ -2042,14 +2037,8 @@ object DirectUtils {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToMessageCenter(defaultTabIndex: Int, source: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.messageWrapperActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.REQUIRE_LOGIN, "true")
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
fun directToMessageCenter(defaultTabIndex: Int) {
|
||||
ARouter.getInstance().build(RouteConsts.activity.messageWrapperActivity)
|
||||
.withInt(BaseActivity_TabLayout.PAGE_INDEX, defaultTabIndex)
|
||||
.navigation()
|
||||
}
|
||||
|
||||
@ -839,34 +839,25 @@ object DownloadItemUtils {
|
||||
} else {
|
||||
allStateClickCallback?.onCallback()
|
||||
clickCallback?.onCallback()
|
||||
if ("download" == gameEntity.reserveStatus) {
|
||||
ReservationHelper.showDeleteReservationDialog(context) {
|
||||
ReservationHelper.deleteReservation(gameEntity) {
|
||||
adapter?.notifyItemChanged(position)
|
||||
refreshCallback?.onCallback()
|
||||
}
|
||||
ReservationHelper.showCancelReservationDialog(context, gameEntity, {
|
||||
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
|
||||
"确定取消",
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: ""
|
||||
)
|
||||
ReservationHelper.cancelReservation(gameEntity) {
|
||||
adapter?.notifyItemChanged(position)
|
||||
refreshCallback?.onCallback()
|
||||
}
|
||||
} else {
|
||||
ReservationHelper.showCancelReservationDialog(context, gameEntity,{
|
||||
}, object : CancelListener {
|
||||
override fun onCancel() {
|
||||
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
|
||||
"确定取消",
|
||||
"关闭弹窗",
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: ""
|
||||
)
|
||||
ReservationHelper.cancelReservation(gameEntity) {
|
||||
adapter?.notifyItemChanged(position)
|
||||
refreshCallback?.onCallback()
|
||||
}
|
||||
}, object : CancelListener {
|
||||
override fun onCancel() {
|
||||
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
|
||||
"关闭弹窗",
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: ""
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
@ -53,6 +53,7 @@ object DownloadObserver {
|
||||
private const val CORE_EVENT_DOWNLOAD_COMPLETE_LOGGED = "CORE_EVENT_DOWNLOAD_COMPLETE_LOGGED"
|
||||
|
||||
private val mRetryableHashMap = hashMapOf<String, Boolean>()
|
||||
private val mRetryableProgressMap = hashMapOf<String, Long>()
|
||||
|
||||
/**
|
||||
* 当下载任务是 预约上线提醒 触发的,则所有弹窗均不显示
|
||||
@ -146,7 +147,8 @@ object DownloadObserver {
|
||||
|| DownloadStatus.timeout == status
|
||||
) {
|
||||
if (mRetryableHashMap[downloadEntity.url] == true
|
||||
&& NetworkUtils.isWifiConnected(HaloApp.getInstance().application)
|
||||
&& (NetworkUtils.isWifiConnected(HaloApp.getInstance().application)
|
||||
|| NDownloadBridge.isDownloadViaTrafficAllowed(downloadEntity))
|
||||
) {
|
||||
downloadManager.resumeDownload(downloadEntity.url)
|
||||
mRetryableHashMap[downloadEntity.url] = false
|
||||
@ -257,6 +259,7 @@ object DownloadObserver {
|
||||
}
|
||||
|
||||
mRetryableHashMap.remove(downloadEntity.url)
|
||||
mRetryableProgressMap.remove(downloadEntity.url)
|
||||
|
||||
EventBus.getDefault().post(EBDownloadStatus("done", "", "", "", downloadEntity.packageName, ""))
|
||||
}
|
||||
@ -264,7 +267,9 @@ object DownloadObserver {
|
||||
DownloadNotificationHelper.addOrUpdateDownloadNotification(downloadEntity)
|
||||
|
||||
// 如果已下载大小发生变化,表示成功恢复下载,则重置重试标记
|
||||
if (status == DownloadStatus.downloading) {
|
||||
if (status == DownloadStatus.downloading
|
||||
&& downloadEntity.progress != mRetryableProgressMap[downloadEntity.url]) {
|
||||
mRetryableProgressMap[downloadEntity.url] = downloadEntity.progress
|
||||
mRetryableHashMap[downloadEntity.url] = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -2778,4 +2778,34 @@ object NewFlatLogUtils {
|
||||
parseAndPutMeta()(this)
|
||||
}.let(::log)
|
||||
}
|
||||
|
||||
// 自有开屏广告加载
|
||||
fun logSplashAdLoad(id: String) {
|
||||
json {
|
||||
KEY_EVENT to "splash_ad_load"
|
||||
"ad_id" to id
|
||||
parseAndPutMeta()(this)
|
||||
}.let(::log)
|
||||
}
|
||||
|
||||
// 自有开屏广告展示
|
||||
fun logSplashAdShow(id: String, duration: Long) {
|
||||
json {
|
||||
KEY_EVENT to "splash_ad_show"
|
||||
"ad_id" to id
|
||||
"duration" to duration
|
||||
parseAndPutMeta()(this)
|
||||
}.let(::log)
|
||||
}
|
||||
|
||||
// 自有开屏广告加载/展示失败
|
||||
@JvmStatic
|
||||
fun logSplashAdFail(id: String, error: String) {
|
||||
json {
|
||||
KEY_EVENT to "splash_ad_fail"
|
||||
"ad_id" to id
|
||||
"error" to error
|
||||
parseAndPutMeta()(this)
|
||||
}.let(::log)
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,6 @@ import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.install.InstallService
|
||||
import com.gh.vspace.VHelper
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DownloadEntity
|
||||
@ -194,12 +193,6 @@ object PackageInstaller {
|
||||
private fun install(context: Context, pkgPath: String, pkgName: String?) {
|
||||
HaloApp.put(Constants.LAST_INSTALL_GAME, pkgPath)
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU && Build.MANUFACTURER.lowercase().contains("xiaomi")) {
|
||||
val foregroundServiceIntent = Intent(context, InstallService::class.java)
|
||||
foregroundServiceIntent.putExtra(InstallService.KEY_SERVICE_ACTION, InstallService.START_FOREGROUND)
|
||||
context.startForegroundService(foregroundServiceIntent)
|
||||
}
|
||||
|
||||
val installIntent = getInstallIntent(context, pkgPath)
|
||||
context.startActivity(installIntent)
|
||||
|
||||
@ -284,7 +277,12 @@ object PackageInstaller {
|
||||
installIntent.setDataAndType(uri, "application/vnd.android.package-archive")
|
||||
}
|
||||
|
||||
updateSystemInstallerIfAvailable(context, installIntent)
|
||||
// 优选系统的安装器(遇到 Exception 就回落到正常的安装器)
|
||||
try {
|
||||
updateSystemInstallerIfAvailable(context, installIntent)
|
||||
} catch (ignored: Exception) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
InstallUtils.getInstance()
|
||||
.addInstall(PackageUtils.getPackageNameByPath(context, path))
|
||||
|
||||
@ -7,7 +7,7 @@ import com.gh.gamecenter.common.utils.isVGameDownloadInDualDownloadMode
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.GameInstall
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.vspace.VHelper
|
||||
|
||||
object PackageLauncher {
|
||||
@ -81,28 +81,11 @@ object PackageLauncher {
|
||||
gameEntity: GameEntity? = null,
|
||||
packageName: String?
|
||||
) {
|
||||
|
||||
if (packageName.isNullOrEmpty()) {
|
||||
ToastUtils.toast("启动失败")
|
||||
return
|
||||
}
|
||||
|
||||
// 获取 GameInstall 实体,用于记录启动日志用
|
||||
val gameInstall = if (gameEntity != null) {
|
||||
GameInstall.transformGameInstall(gameEntity, packageName)
|
||||
} else {
|
||||
PackageRepository.gameInstalled.find { it.packageName == packageName }
|
||||
}
|
||||
|
||||
if (gameInstall != null) {
|
||||
NewFlatLogUtils.logGameLaunch(
|
||||
gameId = gameInstall.id ?: "unknown",
|
||||
gameName = gameInstall.name ?: "unknown",
|
||||
gameCategory = gameInstall.category ?: "unknown",
|
||||
downloadStatus = if (gameInstall.downloadStatus == "demo") "试玩" else "下载"
|
||||
)
|
||||
}
|
||||
|
||||
try {
|
||||
val intent = context.applicationContext.packageManager.getLaunchIntentForPackage(packageName)
|
||||
if (intent != null) {
|
||||
@ -113,6 +96,26 @@ object PackageLauncher {
|
||||
} catch (e: Exception) {
|
||||
ToastUtils.toast( "启动失败")
|
||||
}
|
||||
|
||||
try {
|
||||
// 获取 GameInstall 实体,用于记录启动日志用
|
||||
val gameInstall = if (gameEntity != null) {
|
||||
GameInstall.transformGameInstall(gameEntity, packageName)
|
||||
} else {
|
||||
PackagesManager.getInstalledList().find { it.packageName == packageName }
|
||||
}
|
||||
|
||||
if (gameInstall != null) {
|
||||
NewFlatLogUtils.logGameLaunch(
|
||||
gameId = gameInstall.id ?: "unknown",
|
||||
gameName = gameInstall.name ?: "unknown",
|
||||
gameCategory = gameInstall.category ?: "unknown",
|
||||
downloadStatus = if (gameInstall.downloadStatus == "demo") "试玩" else "下载"
|
||||
)
|
||||
}
|
||||
} catch (e: RuntimeException) {
|
||||
// 都 DeadSystemException 了,还想啥日志上报
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,7 +14,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AndroidException;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -29,9 +28,9 @@ import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.core.utils.MD5Utils;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity;
|
||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.feature.utils.SentryHelper;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.gh.vspace.VHelper;
|
||||
@ -302,7 +301,7 @@ public class PackageUtils {
|
||||
Signature[] signatures = packageInfo.signatures;
|
||||
|
||||
// 使用幸运破解器破解安卓签名认证可能会出现不用签名也能装的情况,这里有可能是空的
|
||||
if (signatures[0] != null) {
|
||||
if (signatures.length > 0 && signatures[0] != null) {
|
||||
return parseSignature(signatures[0].toByteArray());
|
||||
} else {
|
||||
return new String[]{null, null};
|
||||
@ -542,10 +541,8 @@ public class PackageUtils {
|
||||
try {
|
||||
Intent intent = context.getApplicationContext().getPackageManager().getLaunchIntentForPackage(packageName);
|
||||
return intent != null;
|
||||
} catch (IllegalArgumentException exception) {
|
||||
// 一些设备调用获取 intent 的时候会触发 Parcel.readException !
|
||||
exception.printStackTrace();
|
||||
return false;
|
||||
} catch (Exception exception) {
|
||||
return PackageHelper.INSTANCE.getLocalPackageNameSet().contains(packageName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,6 +642,19 @@ public class PackageUtils {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取应用的名称
|
||||
*/
|
||||
public static CharSequence getNameByPackageName(Context context, String packageName) {
|
||||
try {
|
||||
PackageManager packageManager = context.getApplicationContext().getPackageManager();
|
||||
return packageManager.getApplicationLabel(packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 获取应用的 icon
|
||||
|
||||
@ -2,7 +2,7 @@ package com.gh.common.util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.therouter.TheRouter
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.common.repository.ReservationRepository
|
||||
import com.gh.gamecenter.WebActivity
|
||||
@ -29,53 +29,31 @@ import okhttp3.ResponseBody
|
||||
|
||||
object ReservationHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun deleteReservation(game: GameEntity, refreshCallback: EmptyCallback) {
|
||||
deleteOrCancelReservation(game, true, refreshCallback)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun cancelReservation(game: GameEntity, refreshCallback: EmptyCallback) {
|
||||
deleteOrCancelReservation(game, false, refreshCallback)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun deleteOrCancelReservation(
|
||||
@JvmStatic
|
||||
fun cancelReservation(
|
||||
game: GameEntity,
|
||||
deleteReservation: Boolean,
|
||||
refreshCallback: EmptyCallback
|
||||
) {
|
||||
|
||||
val retrofit = RetrofitManager.getInstance()
|
||||
val single = if (deleteReservation) {
|
||||
retrofit.newApi
|
||||
.deleteGameReservation(
|
||||
game.id,
|
||||
getReserveRequestBody(game, context = HaloApp.getInstance().application)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
} else {
|
||||
retrofit.newApi
|
||||
.cancelGameReservation(
|
||||
game.id,
|
||||
getReserveRequestBody(game, context = HaloApp.getInstance().application)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
}
|
||||
retrofit.newApi
|
||||
.cancelGameReservation(
|
||||
game.id,
|
||||
getReserveRequestBody(game, context = HaloApp.getInstance().application)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<ResponseBody>() {
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
ReservationRepository.removeReservationFromMemoryAndRefresh(game.id)
|
||||
refreshCallback.onCallback()
|
||||
}
|
||||
|
||||
single.subscribe(object : BiResponse<ResponseBody>() {
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
ReservationRepository.removeReservationFromMemoryAndRefresh(game.id)
|
||||
refreshCallback.onCallback()
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
Utils.toast(HaloApp.getInstance().application, exception.message)
|
||||
exception.printStackTrace()
|
||||
}
|
||||
})
|
||||
override fun onFailure(exception: Exception) {
|
||||
Utils.toast(HaloApp.getInstance().application, exception.message)
|
||||
exception.printStackTrace()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ -146,21 +124,6 @@ object ReservationHelper {
|
||||
})
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showDeleteReservationDialog(context: Context, emptyCallback: EmptyCallback) {
|
||||
DialogUtils.showCancelOrDeleteReservationDialog(
|
||||
context,
|
||||
"删除预约",
|
||||
"游戏已上线,你可以删除此预约记录,确定删除吗?",
|
||||
"确定删除",
|
||||
"暂不删除", object : ConfirmListener {
|
||||
override fun onConfirm() {
|
||||
emptyCallback.onCallback()
|
||||
}
|
||||
}, null
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showCancelReservationDialog(context: Context, game: GameEntity?, emptyCallback: EmptyCallback) {
|
||||
showCancelReservationDialog(context, game, emptyCallback, null)
|
||||
@ -231,7 +194,7 @@ object ReservationHelper {
|
||||
@JvmStatic
|
||||
fun getReserveRequestBody(game: GameEntity?, context: Context): RequestBody {
|
||||
val jPushId =
|
||||
(TheRouter.get(IPushProvider::class.java))
|
||||
(ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider)
|
||||
?.getRegistrationId(context) ?: ""
|
||||
var mirrorPosition = game?.getMirrorPosition() ?: 0
|
||||
if (mirrorPosition == -1) {
|
||||
|
||||
@ -2,7 +2,7 @@ package com.gh.common.util
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.therouter.TheRouter
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.common.iinterface.ISuperiorChain
|
||||
import com.gh.gamecenter.amway.AmwayFragment
|
||||
import com.gh.gamecenter.category2.CategoryV2Fragment
|
||||
@ -129,7 +129,9 @@ object ViewPagerFragmentHelper {
|
||||
}
|
||||
// 帮助与反馈
|
||||
TYPE_FEEDBACK -> {
|
||||
val helpAndFeedbackProvider = TheRouter.get(IHelpAndFeedbackProvider::class.java)
|
||||
val helpAndFeedbackProvider =
|
||||
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback)
|
||||
.navigation() as? IHelpAndFeedbackProvider
|
||||
if (helpAndFeedbackProvider != null) {
|
||||
helpAndFeedbackProvider.getHelpAndFeedbackFragment().with(bundle)
|
||||
} else {
|
||||
@ -248,7 +250,9 @@ object ViewPagerFragmentHelper {
|
||||
}
|
||||
// QA
|
||||
TYPE_QA -> {
|
||||
val helpAndFeedbackProvider = TheRouter.get(IHelpAndFeedbackProvider::class.java)
|
||||
val helpAndFeedbackProvider =
|
||||
ARouter.getInstance().build(RouteConsts.provider.helpAndFeedback)
|
||||
.navigation() as? IHelpAndFeedbackProvider
|
||||
|
||||
helpAndFeedbackProvider?.let {
|
||||
className = it.getHelpContainerFragmentClass()
|
||||
|
||||
@ -2,6 +2,7 @@ package com.gh.download.simple
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.database.sqlite.SQLiteException
|
||||
import android.database.sqlite.SQLiteFullException
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.lg.download.*
|
||||
import com.lg.download.listener.InnerDownloadListener
|
||||
@ -174,6 +175,9 @@ object DownloadMessageHandler : InnerDownloadListener {
|
||||
DownloadError.CONTENT_LENGTH_IS_ZERO -> {
|
||||
ToastUtils.toast("下载链接异常,请检查")
|
||||
}
|
||||
DownloadError.DISK_IS_FULL -> {
|
||||
ToastUtils.toast("磁盘已满,请清理空间后获得更好的体验")
|
||||
}
|
||||
else -> {
|
||||
// 想怎么处理就怎么处理
|
||||
}
|
||||
@ -264,18 +268,30 @@ object DownloadMessageHandler : InnerDownloadListener {
|
||||
}
|
||||
|
||||
fun insertDownloadToDatabase(downloadEntity: SimpleDownloadEntity) {
|
||||
mDownloadDao.insertDownloadEntity(downloadEntity)
|
||||
updateDownloadList()
|
||||
try {
|
||||
mDownloadDao.insertDownloadEntity(downloadEntity)
|
||||
updateDownloadList()
|
||||
} catch (e: SQLiteException) {
|
||||
if (e is SQLiteFullException) {
|
||||
ToastUtils.showToast("磁盘已满,请清理空间获得更好的体验")
|
||||
}
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateDownloadToDatabase(
|
||||
downloadEntity: SimpleDownloadEntity,
|
||||
updateDownloadList: Boolean = false
|
||||
) {
|
||||
mDownloadDao.updateDownloadEntity(downloadEntity)
|
||||
try {
|
||||
mDownloadDao.updateDownloadEntity(downloadEntity)
|
||||
|
||||
if (updateDownloadList) {
|
||||
updateDownloadList()
|
||||
if (updateDownloadList) {
|
||||
updateDownloadList()
|
||||
}
|
||||
} catch (e: SQLiteFullException) {
|
||||
// 底层的下载服务遇到 SQLiteFullException 时会自动暂停下载任务,上层这里就不用纠结处理方式了
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.therouter.router.Route;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.constant.RouteConsts;
|
||||
|
||||
@ -5,17 +5,12 @@ import android.content.ContextWrapper
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.therouter.router.Autowired
|
||||
import com.therouter.router.Route
|
||||
import com.therouter.TheRouter
|
||||
import com.gh.base.DownloadToolbarActivity
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
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.base.activity.ToolBarActivity.NORMAL_FRAGMENT_BUNDLE
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity.NORMAL_FRAGMENT_NAME
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.toArrayList
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.entity.GamePlatform
|
||||
@ -25,54 +20,15 @@ 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.gamedetail.GameDetailFragment
|
||||
import com.halo.assistant.HaloApp
|
||||
|
||||
@Route(
|
||||
path = RouteConsts.activity.gameDetailActivity,
|
||||
description = "游戏详情页"
|
||||
)
|
||||
/**
|
||||
* Created by khy on 2017/3/24.
|
||||
* 游戏详情页
|
||||
*/
|
||||
class GameDetailActivity : DownloadToolbarActivity() {
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_GAME_ID, description = "游戏 id", required = true)
|
||||
var gameId: String? = null
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_GAME_ENTITY, description = "游戏摘要实体,如果你不懂这个是什么,那么不要用它,直接传入游戏 id 即可")
|
||||
var gameEntity: GameEntity? = null
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_ENTRANCE, description = "入口埋点字段(开发内部使用)")
|
||||
var entrance: String? = ""
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_DEFAULT_TAB, description = "默认选中 tab 的类型(目前可选的有五个类型 `详情`, `专区`,`云存档`,`评价`,`论坛`),首次进入匹配并切换至对应 tab")
|
||||
var defaultTab: String = ""
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_COMMENT_AS_DEFAULT_TAB, description = "跳转到评论 tab,首次进入直接跳转到评论 tab")
|
||||
var commentAsDefaultTab: Boolean = false
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_SCROLL_TO_LIBAO, description = "滚动到礼包区域,首次进入滚动到礼包区域")
|
||||
var scrollToLibao: Boolean = false
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_SCROLL_TO_SERVER, description = "滚动到开服表区域,首次进入滚动到开服表区域")
|
||||
var scrollToServer: Boolean = false
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_OPEN_VIDEO_STREAMING, description = "打开视频流,首次进入打开视频流")
|
||||
var openVideoStreaming: Boolean = false
|
||||
|
||||
@JvmField
|
||||
@Autowired(name = EntranceConsts.KEY_OPEN_PLATFORM_WINDOW, description = "打开多版本窗口,首次进入打开多版本窗口")
|
||||
var openPlatformWindow: Boolean = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
TheRouter.inject(this)
|
||||
|
||||
generateDataFromRoute()
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
DisplayUtils.transparentStatusBar(this)
|
||||
}
|
||||
@ -81,21 +37,37 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
return getTargetIntent(this, GameDetailActivity::class.java, GameDetailFragment::class.java)
|
||||
}
|
||||
|
||||
override fun getLayoutId() = R.layout.activity_game_detail
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.activity_game_detail
|
||||
}
|
||||
|
||||
override fun showToolbarAtLeft() = true
|
||||
override fun showDownloadMenu() = true
|
||||
override fun showToolbarAtLeft(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getActivityNameInChinese() = "游戏详情"
|
||||
override fun showDownloadMenu(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
HaloApp.remove(Constants.GAME_DETAIL_COME_IN)
|
||||
}
|
||||
|
||||
override fun getActivityNameInChinese(): String {
|
||||
return "游戏详情"
|
||||
}
|
||||
|
||||
override fun getBusinessId(): Pair<String, String> {
|
||||
return if (!gameId.isNullOrEmpty()) {
|
||||
Pair(gameId ?: "", "")
|
||||
val fragment = targetFragment as? GameDetailFragment?
|
||||
return if (fragment?.arguments != null) {
|
||||
Pair(fragment.requireArguments().getString(EntranceConsts.KEY_GAMEID) ?: "", "")
|
||||
} else {
|
||||
super.getBusinessId()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun attachBaseContext(newBase: Context) {
|
||||
super.attachBaseContext(object : ContextWrapper(newBase) {
|
||||
override fun getSystemService(name: String): Any? {
|
||||
@ -124,13 +96,6 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
)
|
||||
}
|
||||
|
||||
private fun generateDataFromRoute() {
|
||||
val bundle = intent.extras
|
||||
|
||||
intent?.putExtra(NORMAL_FRAGMENT_NAME, GameDetailFragment::class.java.canonicalName)
|
||||
intent?.putExtra(NORMAL_FRAGMENT_BUNDLE, bundle)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@JvmStatic
|
||||
@ -166,10 +131,9 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
|
||||
if (traceEvent != null) {
|
||||
val clickEvent = createEvent(gameEntity, traceEvent.source, appendTrace(traceEvent), ExposureType.CLICK)
|
||||
ExposureManager.log(clickEvent)
|
||||
log(clickEvent)
|
||||
bundle.putParcelable(EntranceConsts.KEY_TRACE_EVENT, clickEvent)
|
||||
}
|
||||
|
||||
if (gameEntity != null && traceEvent != null && gameEntity.id != traceEvent.payload.gameId) {
|
||||
// 当游戏 ID 跟曝光 traceEvent 的游戏ID 不一样的时候更新 traceEvent 的游戏ID
|
||||
val (payload) = createEvent(
|
||||
@ -180,35 +144,31 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
)
|
||||
traceEvent.payload = payload
|
||||
}
|
||||
|
||||
if (defaultTab.isNotEmpty()) {
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, defaultTab)
|
||||
}
|
||||
|
||||
if (isSkipGameComment) {
|
||||
bundle.putBoolean(EntranceConsts.KEY_COMMENT_AS_DEFAULT_TAB, true)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SKIP_GAME_COMMENT, true)
|
||||
}
|
||||
|
||||
if (scrollToLibao) {
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, EntranceConsts.TAB_TYPE_DESC)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_LIBAO, true)
|
||||
}
|
||||
|
||||
if (scrollToServer) {
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, EntranceConsts.TAB_TYPE_DESC)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_SERVER, true)
|
||||
}
|
||||
|
||||
bundle.putString(EntranceConsts.KEY_GAME_ID, gameEntity?.id)
|
||||
bundle.putString(EntranceConsts.KEY_GAMEID, gameEntity?.id)
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
bundle.putParcelable(EntranceConsts.KEY_GAME_ENTITY, gameEntity)
|
||||
|
||||
TheRouter
|
||||
.build(RouteConsts.activity.gameDetailActivity)
|
||||
.fillParams {
|
||||
it.putAll(bundle)
|
||||
}
|
||||
.navigation(context)
|
||||
bundle.putParcelable(GameEntity.TAG, gameEntity)
|
||||
context.startActivity(
|
||||
getTargetIntent(
|
||||
context,
|
||||
GameDetailActivity::class.java,
|
||||
GameDetailFragment::class.java,
|
||||
bundle
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ -218,7 +178,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
entrance: String?,
|
||||
traceEvent: ExposureEvent?
|
||||
) {
|
||||
startGameDetailActivity(context, gameId, entrance, isSkipGameComment = false, traceEvent = traceEvent)
|
||||
startGameDetailActivity(context, gameId, entrance, -1, traceEvent = traceEvent)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ -226,6 +186,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
context: Context,
|
||||
gameId: String,
|
||||
entrance: String?,
|
||||
defaultTab: Int = -1,
|
||||
isSkipGameComment: Boolean = false,
|
||||
scrollToLibao: Boolean = false,
|
||||
openVideoStreaming: Boolean = false,
|
||||
@ -236,6 +197,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
context,
|
||||
gameId,
|
||||
entrance,
|
||||
defaultTab,
|
||||
isSkipGameComment,
|
||||
scrollToLibao,
|
||||
openVideoStreaming,
|
||||
@ -249,6 +211,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
|
||||
/**
|
||||
* @param gameId 游戏Id
|
||||
* @param defaultTab 默认定位到哪个tab
|
||||
* @param isSkipGameComment 是否跳转到评论tab
|
||||
* @param scrollToLibao 滚动到礼包区域
|
||||
* @param openVideoStreaming 是否打开视频流
|
||||
@ -262,6 +225,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
context: Context,
|
||||
gameId: String,
|
||||
entrance: String?,
|
||||
defaultTab: Int = -1,
|
||||
isSkipGameComment: Boolean = false,
|
||||
scrollToLibao: Boolean = false,
|
||||
openVideoStreaming: Boolean = false,
|
||||
@ -284,7 +248,7 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
appendTrace(traceEvent),
|
||||
ExposureType.CLICK
|
||||
)
|
||||
ExposureManager.log(clickEvent)
|
||||
log(clickEvent)
|
||||
bundle.putParcelable(EntranceConsts.KEY_TRACE_EVENT, clickEvent)
|
||||
}
|
||||
if (traceEvent != null && gameId != traceEvent.payload.gameId) {
|
||||
@ -297,12 +261,15 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
)
|
||||
traceEvent.payload = payload
|
||||
}
|
||||
if (defaultTab != -1) {
|
||||
bundle.putInt(EntranceConsts.KEY_TARGET, defaultTab)
|
||||
}
|
||||
if (isSkipGameComment) {
|
||||
bundle.putBoolean(EntranceConsts.KEY_COMMENT_AS_DEFAULT_TAB, true)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SKIP_GAME_COMMENT, true)
|
||||
}
|
||||
if (openVideoStreaming) {
|
||||
bundle.putBoolean(EntranceConsts.KEY_OPEN_VIDEO_STREAMING, true)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, EntranceConsts.TAB_TYPE_DESC)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
}
|
||||
if (openPlatformWindow) {
|
||||
bundle.putBoolean(EntranceConsts.KEY_OPEN_PLATFORM_WINDOW, true)
|
||||
@ -316,10 +283,10 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
}
|
||||
}
|
||||
if (scrollToLibao) {
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, EntranceConsts.TAB_TYPE_DESC)
|
||||
bundle.putString(EntranceConsts.KEY_TARGET, GameDetailFragment.TAB_DESC)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_LIBAO, true)
|
||||
}
|
||||
bundle.putString(EntranceConsts.KEY_GAME_ID, gameId)
|
||||
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)
|
||||
@ -328,13 +295,14 @@ class GameDetailActivity : DownloadToolbarActivity() {
|
||||
EntranceConsts.KEY_LAST_PAGE_BUSINESS_ID,
|
||||
GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||
)
|
||||
|
||||
TheRouter
|
||||
.build(RouteConsts.activity.gameDetailActivity)
|
||||
.fillParams {
|
||||
it.putAll(bundle)
|
||||
}
|
||||
.navigation(context)
|
||||
context.startActivity(
|
||||
getTargetIntent(
|
||||
context,
|
||||
GameDetailActivity::class.java,
|
||||
GameDetailFragment::class.java,
|
||||
bundle
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ import androidx.transition.*
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||
import com.facebook.drawee.backends.pipeline.Fresco
|
||||
import com.facebook.imagepipeline.core.ImagePipeline
|
||||
|
||||
@ -166,8 +166,13 @@ public class MainActivity extends BaseActivity {
|
||||
private final Handler handler = new Handler();
|
||||
private boolean mShouldShowAd = false; // 是否显示广告
|
||||
|
||||
private Bundle mTempSavedInstanceState;
|
||||
private boolean mFragmentIsCreated = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
mTempSavedInstanceState = savedInstanceState;
|
||||
|
||||
mShouldShowAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null
|
||||
&& !HaloApp.getInstance().isAlreadyUpAndRunning;
|
||||
HaloApp.getInstance().isAlreadyUpAndRunning = true;
|
||||
@ -175,21 +180,12 @@ public class MainActivity extends BaseActivity {
|
||||
mMainWrapperViewModel = new ViewModelProvider(this, new MainWrapperViewModel.Factory(HaloApp.getInstance()))
|
||||
.get(MainWrapperViewModel.class);
|
||||
|
||||
DisplayUtils.transparentStatusBar(this);
|
||||
DisplayUtils.updateGlobalScreen(this);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setStatusBarColor(Color.TRANSPARENT);
|
||||
|
||||
Fragment fragmentFromFM = getSupportFragmentManager().findFragmentById(com.gh.gamecenter.selector.R.id.layout_activity_content);
|
||||
|
||||
mMainWrapperFragment = fragmentFromFM != null ? (MainWrapperFragment) fragmentFromFM : new MainWrapperFragment();
|
||||
if (savedInstanceState != null) {
|
||||
mMainWrapperFragment.setArguments(savedInstanceState);
|
||||
} else if (getIntent() != null) {
|
||||
mMainWrapperFragment.setArguments(getIntent().getExtras());
|
||||
}
|
||||
replaceFragment(mMainWrapperFragment);
|
||||
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (HaloApp.getInstance().isNewForThisVersion) {
|
||||
LunchType lunchType = HaloApp.getInstance().getLaunchType();
|
||||
@ -215,7 +211,6 @@ public class MainActivity extends BaseActivity {
|
||||
DataUtils.getGid();
|
||||
}
|
||||
|
||||
|
||||
mPackageViewModel = ViewModelProviders.of(this, new PackageViewModel.Factory()).get(PackageViewModel.class);
|
||||
|
||||
final boolean containsErrorMsg = com.gh.gamecenter.common.constant.Config.isContainsErrorMsg();
|
||||
@ -273,6 +268,7 @@ public class MainActivity extends BaseActivity {
|
||||
if (mShouldShowAd) {
|
||||
showAd();
|
||||
} else {
|
||||
doInitMainFragment(mTempSavedInstanceState);
|
||||
hideTextAd();
|
||||
hideSplashAd();
|
||||
}
|
||||
@ -328,6 +324,23 @@ public class MainActivity extends BaseActivity {
|
||||
CertificationSwitchHelper.getCertificationSwitch();
|
||||
}
|
||||
|
||||
private void doInitMainFragment(Bundle savedInstanceState) {
|
||||
if (mFragmentIsCreated) return;
|
||||
|
||||
mTempSavedInstanceState = null;
|
||||
Fragment fragmentFromFM = getSupportFragmentManager().findFragmentById(com.gh.gamecenter.selector.R.id.layout_activity_content);
|
||||
|
||||
mMainWrapperFragment = fragmentFromFM != null ? (MainWrapperFragment) fragmentFromFM : new MainWrapperFragment();
|
||||
if (savedInstanceState != null) {
|
||||
mMainWrapperFragment.setArguments(savedInstanceState);
|
||||
} else if (getIntent() != null) {
|
||||
mMainWrapperFragment.setArguments(getIntent().getExtras());
|
||||
}
|
||||
replaceFragment(mMainWrapperFragment);
|
||||
|
||||
mFragmentIsCreated = true;
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void getTeenagerMode() {
|
||||
RetrofitManager.getInstance()
|
||||
@ -541,19 +554,31 @@ public class MainActivity extends BaseActivity {
|
||||
protected void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == COUNTDOWN_AD || msg.what == COUNTDOWN_SDK_AD) {
|
||||
mCountdownCount++;
|
||||
int maxCount;
|
||||
|
||||
if (msg.what == COUNTDOWN_AD) {
|
||||
maxCount = mCountdownMaxCount;
|
||||
} else {
|
||||
maxCount = COUNTDOWN_SDK_MAX_COUNT;
|
||||
}
|
||||
|
||||
// 读秒到一半的时候初始化 MainWrapperFragment
|
||||
if (mCountdownCount == maxCount / 2) {
|
||||
doInitMainFragment(mTempSavedInstanceState);
|
||||
}
|
||||
|
||||
mCountdownCount++;
|
||||
|
||||
if (maxCount < mCountdownCount) {
|
||||
AdDelegateHelper.INSTANCE.setShowingSplashAd(false);
|
||||
hideSplashAd();
|
||||
|
||||
if (msg.what == COUNTDOWN_AD && msg.obj instanceof StartupAdEntity) {
|
||||
StartupAdEntity ad = (StartupAdEntity) msg.obj;
|
||||
if (!AdDelegateHelper.INSTANCE.isOwnerSplashAdShown()) {
|
||||
com.gh.common.util.NewFlatLogUtils.logSplashAdFail(ad.getId(), "广告加载超时");
|
||||
}
|
||||
AdDelegateHelper.INSTANCE.setOwnerSplashAdShown(false);
|
||||
LinkEntity linkEntity = ad.getJump();
|
||||
SensorsBridge.trackEvent(
|
||||
"SplashAdOwnSkip",
|
||||
@ -633,10 +658,11 @@ public class MainActivity extends BaseActivity {
|
||||
ExtensionsKt.removeFromParent(startSdkAdIcpContainer, true);
|
||||
}
|
||||
|
||||
onSplashHidden();
|
||||
onAdHidden();
|
||||
}
|
||||
|
||||
private void onSplashHidden() {
|
||||
private void onAdHidden() {
|
||||
doInitMainFragment(mTempSavedInstanceState);
|
||||
// 通知全局弹窗可以进行显示
|
||||
AppExecutor.getUiExecutor().execute(GlobalPriorityChainHelper.INSTANCE::start);
|
||||
}
|
||||
@ -854,7 +880,9 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && !mMainWrapperFragment.onHandleBackPressed()) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
|
||||
&& mMainWrapperFragment != null
|
||||
&& !mMainWrapperFragment.onHandleBackPressed()) {
|
||||
DownloadEntity downloadEntity = null;
|
||||
for (DownloadEntity entity : DownloadManager.getInstance().getAllDownloadEntityExcludeSilentTask()) {
|
||||
if (entity.getStatus().equals(DownloadStatus.done)) {
|
||||
@ -1045,6 +1073,7 @@ public class MainActivity extends BaseActivity {
|
||||
blackList.add(R.id.historyTv);
|
||||
blackList.add(R.id.myCollectionTv);
|
||||
blackList.add(R.id.searchTv);
|
||||
blackList.add(R.id.subject_tab);
|
||||
updateStaticView(view, blackList);
|
||||
|
||||
View communityHomeWrapper = view.findViewById(R.id.communityHomeContainer);
|
||||
|
||||
@ -15,6 +15,7 @@ import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import com.gh.common.fragment.popBackStackAllowStateLoss
|
||||
import com.gh.common.util.DataCollectionUtils
|
||||
import com.gh.common.util.LogUtils
|
||||
import com.gh.gamecenter.DisplayType.*
|
||||
@ -311,6 +312,19 @@ open class SearchActivity : BaseActivity() {
|
||||
// MtaHelper.onEvent("游戏搜索", "主动搜索", newSearchKey)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
val newSearchKey = searchEt.text.toString().trim { it <= ' ' }
|
||||
if (newSearchKey.isBlank()) {
|
||||
try {
|
||||
popBackToFragment(SearchDefaultFragment::class.java.name)
|
||||
} catch (e: Exception) {
|
||||
// no implement
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun provideDao(): ISearchHistoryDao = SearchHistoryDao(this)
|
||||
|
||||
open fun updateDisplayType(type: DisplayType) {
|
||||
@ -381,7 +395,7 @@ open class SearchActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
protected fun popBackToFragment(tag: String) {
|
||||
supportFragmentManager.popBackStack(tag, 0)
|
||||
supportFragmentManager.popBackStackAllowStateLoss(tag, 0)
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
|
||||
@ -445,6 +445,24 @@ public class SkipActivity extends BaseActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if ("market".equals(uri.getScheme())) {
|
||||
String host = uri.getHost();
|
||||
String id = "";
|
||||
try {
|
||||
id = uri.getQueryParameter("id");
|
||||
} catch (UnsupportedOperationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (host != null) {
|
||||
if ("details".equals(host)) {
|
||||
bundle = new Bundle();
|
||||
bundle.putString(KEY_TO, EntranceConsts.KEY_MARKET_DETAILS);
|
||||
bundle.putString(KEY_DATA, id);
|
||||
EntranceUtils.jumpActivity(this, bundle);
|
||||
} else {
|
||||
EntranceUtils.jumpActivity(this, new Bundle()); // 跳转至首页
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,107 +0,0 @@
|
||||
package com.gh.gamecenter
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import com.therouter.router.Navigator
|
||||
import com.therouter.router.interceptor.NavigationCallback
|
||||
import com.therouter.TheRouter
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.utils.DialogHelper
|
||||
import com.gh.gamecenter.common.utils.dropSchemeAndHost
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
class SkipCompatActivity : SkipActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
val uri = intent.data
|
||||
if (handleSkip(this, uri)) {
|
||||
intent.setData(null)
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
finish()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "SkipCompat"
|
||||
|
||||
const val HOST = "app"
|
||||
|
||||
const val SCHEME = "ghzhushou"
|
||||
const val MARKET = "market"
|
||||
|
||||
fun handleSkip(context: Context, uri: Uri?): Boolean {
|
||||
if (uri == null) return false
|
||||
|
||||
// Handle skip
|
||||
if (uri.scheme == SCHEME) {
|
||||
Utils.log(TAG, "handleSkip: $uri")
|
||||
|
||||
val host = uri.host
|
||||
if (host == HOST) {
|
||||
TheRouter
|
||||
.build(uri.dropSchemeAndHost())
|
||||
.navigation(context, object : NavigationCallback() {
|
||||
override fun onFound(postcard: Navigator) {
|
||||
Utils.log(TAG, "navigate to postcard ${postcard.originalUrl} onFound" )
|
||||
}
|
||||
|
||||
override fun onLost(postcard: Navigator, requestCode: Int) {
|
||||
Utils.log(TAG, "navigate to postcard ${postcard.originalUrl} onLost" )
|
||||
|
||||
if (HaloApp.getInstance().isAlreadyUpAndRunning) {
|
||||
// 在光环应用内时,显示不支持弹窗
|
||||
// 显示不支持弹窗
|
||||
DialogHelper.showUpgradeDialog(context)
|
||||
} else {
|
||||
// 在光环应用外跳转时,重定向至首页
|
||||
EntranceUtils.jumpActivity(context, Bundle())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onArrival(postcard: Navigator) {
|
||||
Utils.log(TAG, "navigate to postcard ${postcard.originalUrl} onArrival" )
|
||||
}
|
||||
|
||||
override fun onActivityCreated(postcard: Navigator, activity: Activity) {
|
||||
Utils.log(TAG, "navigate to postcard ${postcard.originalUrl} onActivityCreated" )
|
||||
}
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
} else if (uri.scheme == MARKET) {
|
||||
val host = uri.host
|
||||
var id = ""
|
||||
try {
|
||||
id = uri.getQueryParameter("id") ?: ""
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
if (host != null) {
|
||||
if ("details" == host) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(
|
||||
EntranceConsts.KEY_TO,
|
||||
EntranceConsts.KEY_MARKET_DETAILS
|
||||
)
|
||||
bundle.putString(EntranceConsts.KEY_DATA, id)
|
||||
EntranceUtils.jumpActivity(context, bundle)
|
||||
} else {
|
||||
EntranceUtils.jumpActivity(context, Bundle()) // 跳转至首页
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,8 +14,8 @@ import androidx.core.app.NotificationCompat
|
||||
import androidx.core.text.bold
|
||||
import androidx.core.text.buildSpannedString
|
||||
import androidx.core.text.color
|
||||
import com.therouter.router.Route
|
||||
import com.therouter.TheRouter
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.gh.common.dialog.NewPrivacyPolicyDialogFragment
|
||||
import com.gh.common.util.DeviceTokenUtils
|
||||
import com.gh.common.util.DialogUtils
|
||||
@ -29,7 +29,6 @@ import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.tracker.TrackerLogger
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.iinterface.ISplashScreen
|
||||
import com.gh.gamecenter.core.provider.IAppProvider
|
||||
import com.gh.gamecenter.core.provider.IPackageUtilsProvider
|
||||
import com.gh.gamecenter.core.provider.IPushProvider
|
||||
@ -48,7 +47,7 @@ import java.util.*
|
||||
* 引导页面
|
||||
*/
|
||||
@Route(path = RouteConsts.activity.splashActivity)
|
||||
class SplashScreenActivity : BaseActivity(), ISplashScreen {
|
||||
class SplashScreenActivity : BaseActivity() {
|
||||
|
||||
private var mSharedPreferences: SharedPreferences? = null
|
||||
private var mIsNewForThisVersion = false
|
||||
@ -137,8 +136,9 @@ class SplashScreenActivity : BaseActivity(), ISplashScreen {
|
||||
}
|
||||
|
||||
private fun logAppLaunch() {
|
||||
val packageUtilsConfig = TheRouter.get(IPackageUtilsProvider::class.java)
|
||||
val appProvider = TheRouter.get(IAppProvider::class.java)
|
||||
val packageUtilsConfig =
|
||||
ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
|
||||
val appProvider = ARouter.getInstance().build(RouteConsts.provider.app).navigation() as? IAppProvider
|
||||
val signatureHash = packageUtilsConfig?.getApkSignatureByPackageName(this, packageName)?.get(0)
|
||||
val sideLoadInfo = packageUtilsConfig?.getSideLoadedInfo()
|
||||
val trackEvent = JSONObject()
|
||||
@ -282,11 +282,11 @@ class SplashScreenActivity : BaseActivity(), ISplashScreen {
|
||||
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
|
||||
SensorsBridge.setOAID(HaloApp.getInstance().oaid)
|
||||
|
||||
val pushProvider = TheRouter.get(IPushProvider::class.java)
|
||||
val registrationId = pushProvider?.getRegistrationId(this)
|
||||
if (!registrationId.isNullOrEmpty()) {
|
||||
SensorsBridge.profileAppend(KEY_REGISTRATION_ID, registrationId)
|
||||
}
|
||||
// val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
||||
// val registrationId = pushProvider?.getRegistrationId(this)
|
||||
// if (!registrationId.isNullOrEmpty()) {
|
||||
// SensorsBridge.profileSet(KEY_REGISTRATION_ID, registrationId)
|
||||
// }
|
||||
}
|
||||
|
||||
private fun prefetchData() {
|
||||
|
||||
@ -6,7 +6,7 @@ import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import com.therouter.router.Route
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
|
||||
@ -19,8 +19,8 @@ import android.util.Base64;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.therouter.router.Route;
|
||||
import com.therouter.TheRouter;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.IntegralLogHelper;
|
||||
import com.gh.gamecenter.common.callback.BiCallback;
|
||||
@ -52,7 +52,7 @@ import java.io.ByteArrayOutputStream;
|
||||
*/
|
||||
@Route(path = RouteConsts.activity.weiBoShareActivity)
|
||||
public class WeiBoShareActivity extends Activity implements WbShareCallback {
|
||||
private final IAppProvider mAppProvider = TheRouter.get(IAppProvider.class);
|
||||
private IAppProvider mAppProvider = (IAppProvider) ARouter.getInstance().build(RouteConsts.provider.app).navigation();
|
||||
|
||||
private static final String WEIBO_SCOPE = (
|
||||
"email,direct_messages_read,direct_messages_write,"
|
||||
|
||||
@ -455,17 +455,9 @@ class DetailViewHolder(
|
||||
}
|
||||
|
||||
ButtonStyle.RESERVED -> {
|
||||
if ("download" == mGameEntity.reserveStatus) {
|
||||
ReservationHelper.showDeleteReservationDialog(mViewHolder.context) {
|
||||
ReservationHelper.deleteReservation(mGameEntity) {
|
||||
DetailDownloadUtils.updateViewHolder(mViewHolder)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ReservationHelper.showCancelReservationDialog(mViewHolder.context, mGameEntity) {
|
||||
ReservationHelper.cancelReservation(mGameEntity) {
|
||||
DetailDownloadUtils.updateViewHolder(mViewHolder)
|
||||
}
|
||||
ReservationHelper.showCancelReservationDialog(mViewHolder.context, mGameEntity) {
|
||||
ReservationHelper.cancelReservation(mGameEntity) {
|
||||
DetailDownloadUtils.updateViewHolder(mViewHolder)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.gh.gamecenter.authorization
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import com.gh.common.util.CheckLoginUtils
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
@ -16,6 +18,7 @@ import com.gh.gamecenter.common.utils.viewModelProvider
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.databinding.ActivityAuthorizationBinding
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.login.user.UserRepository
|
||||
import com.gh.gamecenter.login.view.LoginActivity
|
||||
import com.gh.vspace.VHelper
|
||||
import com.lightgame.utils.Utils
|
||||
@ -68,6 +71,8 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
//授权token
|
||||
private var mToken = ""
|
||||
|
||||
private var loadingDialog: Dialog? = null
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.activity_authorization
|
||||
}
|
||||
@ -80,11 +85,16 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
mBinding = ActivityAuthorizationBinding.bind(mContentView)
|
||||
checkParam()
|
||||
initView()
|
||||
mBinding.authorizeBtn.postDelayed({
|
||||
mBaseHandler.post {
|
||||
if (loadingDialog == null) {
|
||||
loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
|
||||
}
|
||||
}
|
||||
UserRepository.getInstance().loginUserInfo.observe(this) {
|
||||
checkLogin {
|
||||
initUserInfo()
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
NewFlatLogUtils.logLoginFromGHZSShow(
|
||||
gameId = gameId,
|
||||
gameName = gameName
|
||||
@ -97,14 +107,21 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
}
|
||||
|
||||
private fun initData() {
|
||||
if (mToken.isNotEmpty() || isFinishing) return
|
||||
val loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
|
||||
if (mToken.isNotEmpty() || isFinishing) {
|
||||
loadingDialog?.dismiss()
|
||||
return
|
||||
}
|
||||
if (loadingDialog == null) {
|
||||
loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
|
||||
} else if (loadingDialog?.isShowing == false) {
|
||||
loadingDialog?.show()
|
||||
}
|
||||
mViewModel.getAccessToken(listOf(mContent), {
|
||||
mToken = it
|
||||
loadingDialog.dismiss()
|
||||
loadingDialog?.dismiss()
|
||||
}, {
|
||||
toast("获取token失败")
|
||||
loadingDialog.dismiss()
|
||||
loadingDialog?.dismiss()
|
||||
})
|
||||
}
|
||||
|
||||
@ -152,8 +169,8 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
private fun initView() {
|
||||
//通过包名获取app图标和名称
|
||||
val pkgName = mRemotePkgName ?: return
|
||||
val icon = packageManager.getApplicationIcon(pkgName)
|
||||
val name = packageManager.getApplicationLabel(packageManager.getApplicationInfo(pkgName, 0))
|
||||
val icon = PackageUtils.getIconByPackageName(this, pkgName)
|
||||
val name = PackageUtils.getNameByPackageName(this, pkgName)
|
||||
mBinding.authorizeAppIcon.setImageDrawable(icon)
|
||||
mBinding.authorizeAppName.text = name
|
||||
mBinding.authorizeBtn.setOnClickListener {
|
||||
@ -242,10 +259,10 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
VHelper.launch(this, gamePkg, ignoreGApps = true, showLoading = showLoading)
|
||||
return
|
||||
}
|
||||
val remotePkgName = this.mRemotePkgName
|
||||
if (remotePkgName != null) {// 跳转回其他授权app
|
||||
startActivity(packageManager.getLaunchIntentForPackage(remotePkgName))
|
||||
}
|
||||
// val remotePkgName = this.mRemotePkgName
|
||||
// if (remotePkgName != null) {// 跳转回其他授权app
|
||||
// startActivity(packageManager.getLaunchIntentForPackage(remotePkgName))
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user