Compare commits

..

2 Commits

581 changed files with 3702 additions and 21087 deletions

View File

@ -71,7 +71,8 @@ android_build:
exit_codes: 137
only:
- dev
- dev-5.32.0
- dev-5.29.0
- dev-5.30.0
# 代码检查
sonarqube_analysis:
@ -102,7 +103,8 @@ sonarqube_analysis:
exit_codes: 137
only:
- dev
- dev-5.32.0
- dev-5.29.0
- dev-5.30.0
## 发送简易检测结果报告
send_sonar_report:
@ -120,7 +122,8 @@ send_sonar_report:
exit_codes: 137
only:
- dev
- dev-5.32.0
- dev-5.29.0
- dev-5.30.0
oss-upload&send-email:
tags:
@ -152,4 +155,5 @@ oss-upload&send-email:
- /usr/local/bin/python /ci-android-mail.py
only:
- dev
- dev-5.32.0
- dev-5.29.0
- dev-5.30.0

View File

@ -30,7 +30,14 @@
### git 版本管理
本项目使用简化版的 git flow 来管理分支,细节请看 [光环安卓简单 git 规范](https://git.shanqu.cc/halo/android/assistant-android/-/wikis/%E5%85%89%E7%8E%AF%E5%AE%89%E5%8D%93%E7%AE%80%E5%8D%95-git-%E8%A7%84%E8%8C%83)
本项目使用简化版的 git flow 来管理分支,细节请看 [光环安卓简单 git 规范](https://git.ghzs.com/halo/android/assistant-android/-/wikis/%E5%85%89%E7%8E%AF%E5%AE%89%E5%8D%93%E7%AE%80%E5%8D%95-git-%E8%A7%84%E8%8C%83)
### API 环境配置
本项目使用 Build Variants 来切换 API 环境
* internal 为测试环境
* publish 为正式环境
### 图片资源配置
@ -46,3 +53,14 @@
* 本项目使用了微信的 [AndResGuard](https://github.com/shwenzhang/AndResGuard) 作为资源混淆压缩方案,新增需要使用 `getIdentifier` 获取的资源文件时需要添加至白名单
* 本项目默认使用 R8 作为混淆工具,往 proguard-rules.txt 添加 proguard 新配置项时请检查可用性(如语法等)
### APK打包配置
> 打内部测试包:`./scripts/test_build.sh`
> 打邮件测试包:`./scripts/jenkins_build.sh`
### TODO
* 把原有 EventBus 的消息 Type 统一到一个文件内
* 将实现细节从 View(Fragment、Activity) 剥离并以 MVVM 结构改造
* 重构 MainActivity

View File

@ -337,10 +337,7 @@ dependencies {
implementation(project(':module_core_feature')) {
exclude group: 'androidx.swiperefreshlayout'
}
// implementation(project(':module_feedback')) {
// exclude group: 'androidx.swiperefreshlayout'
// }
implementation(project(':feature:new_feedback',)) {
implementation(project(':module_feedback')) {
exclude group: 'androidx.swiperefreshlayout'
}
implementation(project(':module_sensors_data')) {

View File

@ -275,7 +275,7 @@
<activity
android:name="com.gh.gamecenter.VoteActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
<activity
android:name="com.gh.gamecenter.WeiBoShareActivity"

View File

@ -205,17 +205,14 @@ RE.setOutdent = function() {
RE.setJustifyLeft = function() {
document.execCommand('justifyLeft', false, null);
RE.enabledEditingItems()
}
RE.setJustifyCenter = function() {
document.execCommand('justifyCenter', false, null);
RE.enabledEditingItems()
}
RE.setJustifyRight = function() {
document.execCommand('justifyRight', false, null);
RE.enabledEditingItems()
}
RE.setBlockquote = function() {
@ -230,16 +227,6 @@ RE.insertImage = function(url) {
RE.insertHTML(html);
}
// 设置分割线
RE.insertHorizontalRule = function() {
document.execCommand('insertHorizontalRule', false, null);
}
// 设置编辑器默认换行符
RE.setDefaultParagraphSeparator = function(separator) {
document.execCommand('defaultParagraphSeparator', false, separator);
}
// 替换成缩略图
RE.replaceTbImage = function(imgRuleFlag, gifRuleFlag) {
var imgs = document.getElementsByTagName("img");
@ -352,9 +339,9 @@ RE.ImageClickListener = function() {
var img = imgs[i];
var imageClassName = img.className;
if (imageClassName == "image-link"|| img.className == "poster") continue;
window.NativeCallBack.invokeMethod("imageArr", img.src);
window.imagelistener.imageArr(img.src);
img.onclick = function() {
window.NativeCallBack.invokeMethod("imageClick", this.src);
window.imagelistener.imageClick(this.src);
}
}
}
@ -587,10 +574,6 @@ document.addEventListener("selectionchange", function(e) {
RE.sendElementNameToNative()
});
document.addEventListener("selectionchange", function(e) {
RE.enabledEditingItems(e)
});
RE.recursion = function(dom) {
var parenDom = dom.parentElement
if (parenDom && parenDom instanceof Element &&
@ -633,6 +616,7 @@ RE.sendElementNameToNative = function() {
// android function to open link
function customLinkgo(self) {
var datas = self.dataset.datas
// console.log(datas)
window.OnLinkClickListener.onClick(datas)
}

View File

@ -30,6 +30,7 @@ body {
}
#editor {
display: table-cell;
outline: 0px solid transparent;
background-repeat: no-repeat;
background-position: center;

View File

@ -23,7 +23,6 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.provider.IBeiziAdProvider
@ -34,6 +33,7 @@ import com.gh.gamecenter.core.utils.TimeUtils.getToday
import com.gh.gamecenter.entity.AdConfig
import com.gh.gamecenter.entity.StartupAdEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
@ -60,9 +60,6 @@ object AdDelegateHelper {
private val mGameSearchAdList: ArrayList<AdConfig> by lazy { arrayListOf() }
private var mVGameLaunchAd: AdConfig? = null
val vGameLaunchAd: AdConfig?
get() = mVGameLaunchAd
private const val AD_SDK_CSJ = "穿山甲"
private const val AD_SDK_BEIZI = "倍孜"
private const val AD_TYPE_SDK = "third_party_ads" // 第三方 SDK 广告

View File

@ -57,16 +57,11 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
private lateinit var mEditorFontItalic: CheckableImageView
private lateinit var mEditorFontStrikeThrough: CheckableImageView
private lateinit var mEditorFontUnderline: CheckableImageView
private lateinit var mEditorParagraphDivider: CheckableImageView
private lateinit var mEditorParagraphH1: CheckableImageView
private lateinit var mEditorParagraphH2: CheckableImageView
private lateinit var mEditorParagraphH3: CheckableImageView
private lateinit var mEditorParagraphH4: CheckableImageView
private lateinit var mEditorParagraphQuote: CheckableImageView
private lateinit var mEditorAlignLeft: CheckableImageView
private lateinit var mEditorAlignCenter: CheckableImageView
private lateinit var mEditorAlignRight: CheckableImageView
private lateinit var mEditorAlignContainer: View
private lateinit var mEditorFontContainer: View
private lateinit var mEditorParagraphContainer: View
private lateinit var mEditorLinkContainer: View
@ -102,7 +97,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.insertCustomStyleLink(insertData)
}
}
INSERT_ARTICLE_CODE -> {
val article =
data?.getParcelableExtra<ArticleEntity>(ArticleEntity::class.java.simpleName)
@ -112,7 +106,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.insertCustomStyleLink(insertData)
}
}
INSERT_GAME_CODE -> {
val game = data?.getParcelableExtra<GameEntity>(GameEntity::class.java.simpleName)
if (game != null) {
@ -121,7 +114,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.insertCustomStyleLink(insertData)
}
}
INSERT_GAME_COLLECTION_CODE -> {
val gameCollectionEntity =
data?.getParcelableExtra<GamesCollectionEntity>(GamesCollectionEntity::class.java.simpleName)
@ -131,11 +123,9 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.insertCustomStyleLink(insertData)
}
}
REQUEST_CODE_IMAGE -> {
if (data != null) mViewModel.uploadPic(data)
}
INSERT_MEDIA_VIDEO_CODE -> {
val localVideoList =
data?.getParcelableArrayListExtra<LocalVideoEntity>(LocalVideoEntity::class.java.name)
@ -145,14 +135,12 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
uploadVideo(localVideoList)
}
}
REQUEST_CODE_IMAGE_CROP -> {
val imagePath = data?.getStringExtra(CropImageActivity.RESULT_CLIP_PATH)
if (!imagePath.isNullOrEmpty()) {
mViewModel.uploadPoster(imagePath)
}
}
INSERT_VIDEO_CODE -> {
val videoEntity = data?.getParcelableExtra<MyVideoEntity>(MyVideoEntity::class.java.simpleName)
if (videoEntity != null) {
@ -206,12 +194,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mEditorParagraphH2 = findViewById(R.id.editor_paragraph_h2)
mEditorParagraphH3 = findViewById(R.id.editor_paragraph_h3)
mEditorParagraphH4 = findViewById(R.id.editor_paragraph_h4)
mEditorParagraphDivider = findViewById(R.id.editor_paragraph_divider)
mEditorParagraphQuote = findViewById(R.id.editor_paragraph_quote)
mEditorAlignLeft = findViewById(R.id.editor_align_left)
mEditorAlignCenter = findViewById(R.id.editor_align_center)
mEditorAlignRight = findViewById(R.id.editor_align_right)
mEditorAlignContainer = findViewById(R.id.editor_align_container)
mEditorFontContainer = findViewById(R.id.editor_font_container)
mEditorParagraphContainer = findViewById(R.id.editor_paragraph_container)
mEditorLinkContainer = findViewById(R.id.editor_link_container)
@ -258,13 +241,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mRichEditor.hasFocus()
} else false
}
mRichEditor.setOnDecorationChangeListener { _, types ->
mEditorAlignLeft.isChecked = types.contains(RichEditor.Type.JUSTIFYLEFT)
mEditorAlignCenter.isChecked = types.contains(RichEditor.Type.JUSTIFYCENTER)
mEditorAlignRight.isChecked = types.contains(RichEditor.Type.JUSTIFYRIGHT)
}
mOriginalCb.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
mOriginalTipsContainer.alpha = 0f
@ -349,9 +325,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
MtaHelper.onEvent(mtaEventName(), "文字样式", "文字样式-下滑线")
}
}
mEditorParagraphDivider.setOnClickListener {
mRichEditor.insertDivider()
}
mEditorParagraphH1.setOnClickListener {
if (mEditorParagraphH1.isChecked) {
mRichEditor.formatBlock()
@ -397,27 +370,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
}
mEditorParagraphQuote.isChecked = !mEditorParagraphQuote.isChecked
}
mEditorAlignLeft.setOnClickListener {
if (!mEditorAlignLeft.isChecked) {
mRichEditor.setAlignLeft()
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠左")
mEditorAlignLeft.isChecked = !mEditorAlignLeft.isChecked
}
}
mEditorAlignCenter.setOnClickListener {
if (!mEditorAlignCenter.isChecked) {
mRichEditor.setAlignCenter()
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠中")
mEditorAlignCenter.isChecked = !mEditorAlignCenter.isChecked
}
}
mEditorAlignRight.setOnClickListener {
if (!mEditorAlignRight.isChecked) {
mRichEditor.setAlignRight()
MtaHelper.onEvent(mtaEventName(), "文本对齐选项", "文本对齐选项-靠右")
mEditorAlignRight.isChecked = !mEditorAlignRight.isChecked
}
}
findViewById<View>(R.id.editor_link_answer).setOnClickListener {
MtaHelper.onEvent(mtaEventName(), "插入链接", "插入链接-回答")
startActivityForResult(
@ -497,22 +449,25 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
return
}
try {
PermissionHelper.checkStoragePermissionBeforeAction(this) {
val maxChooseCount = if (videoCount + 3 <= MAX_MEDIA_COUNT) 3 else MAX_MEDIA_COUNT - videoCount
startActivityForResult(
LocalMediaActivity.getIntent(
this@BaseRichEditorActivity,
LocalMediaActivity.ChooseType.VIDEO,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
), INSERT_MEDIA_VIDEO_CODE
)
NewLogUtils.logChooseMedia(
"view_media",
if (mtaEventName() == "提问帖") "提问帖" else "帖子",
"视频"
)
}
PermissionHelper.checkStoragePermissionBeforeAction(this,
object : EmptyCallback {
override fun onCallback() {
val maxChooseCount = if (videoCount + 3 <= MAX_MEDIA_COUNT) 3 else MAX_MEDIA_COUNT - videoCount
startActivityForResult(
LocalMediaActivity.getIntent(
this@BaseRichEditorActivity,
LocalMediaActivity.ChooseType.VIDEO,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
), INSERT_MEDIA_VIDEO_CODE
)
NewLogUtils.logChooseMedia(
"view_media",
if (mtaEventName() == "提问帖") "提问帖" else "帖子",
"视频"
)
}
})
} catch (e: Exception) {
toast(R.string.media_image_hint)
e.printStackTrace()
@ -527,16 +482,18 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
return
}
try {
PermissionHelper.checkStoragePermissionBeforeAction(this) {
val maxChooseCount = if (imageCount + 10 <= MAX_IMAGE_COUNT) 10 else MAX_IMAGE_COUNT - imageCount
val intent = LocalMediaActivity.getIntent(
this@BaseRichEditorActivity,
LocalMediaActivity.ChooseType.IMAGE,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
)
startActivityForResult(intent, REQUEST_CODE_IMAGE)
}
PermissionHelper.checkStoragePermissionBeforeAction(this, object : EmptyCallback {
override fun onCallback() {
val maxChooseCount = if (imageCount + 10 <= MAX_IMAGE_COUNT) 10 else MAX_IMAGE_COUNT - imageCount
val intent = LocalMediaActivity.getIntent(
this@BaseRichEditorActivity,
LocalMediaActivity.ChooseType.IMAGE,
maxChooseCount,
if (mtaEventName() == "提问帖") "发提问帖" else "发帖子"
)
startActivityForResult(intent, REQUEST_CODE_IMAGE)
}
})
} catch (e: Exception) {
toast(R.string.media_image_hint)
e.printStackTrace()
@ -559,7 +516,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mEditorFontContainer.visibility = if (mEditorFont.isChecked) View.VISIBLE else View.GONE
mEditorParagraphContainer.visibility =
if (mEditorFont.isChecked) View.VISIBLE else View.GONE
mEditorAlignContainer.visibility = if (mEditorFont.isChecked) View.VISIBLE else View.GONE
mEditorLinkContainer.visibility = View.GONE
mTagsContainer.visibility = View.GONE
mIsExtendedKeyboardShow = mEditorFont.isChecked
@ -581,7 +537,6 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
if (mEditorLink.isChecked) View.VISIBLE else View.GONE
mEditorLinkContainer.visibility = if (mEditorLink.isChecked) View.VISIBLE else View.GONE
mEditorFontContainer.visibility = View.GONE
mEditorAlignContainer.visibility = View.GONE
mEditorParagraphContainer.visibility = View.GONE
mTagsContainer.visibility = View.GONE
mIsExtendedKeyboardShow = mEditorLink.isChecked
@ -821,7 +776,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
const val INSERT_VIDEO_CODE = 415
const val MAX_INPUT_TEXT_NUM = 10000
const val MAX_MEDIA_COUNT = 20
const val MAX_IMAGE_COUNT = 70
const val MAX_IMAGE_COUNT = 35
const val REQUEST_CODE_IMAGE = 120
const val INSERT_MEDIA_VIDEO_CODE = 121

View File

@ -24,12 +24,10 @@ import com.gh.gamecenter.common.callback.BiCallback
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.NotificationUgc
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.provider.IHelpAndFeedbackProvider
import com.gh.gamecenter.common.tracker.Tracker
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.NewFlatLogUtils
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnIoThread
@ -41,6 +39,7 @@ import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.feature.entity.Badge
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.login.user.LoginTag
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.login.user.UserRepository
@ -536,18 +535,6 @@ class DefaultJsApi(
val downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(url, null, false)
?: DownloadManager.getInstance().getDownloadEntitySnapshot(vUrl, null, false)
NewFlatLogUtils.logGameInstall(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
trigger = "主动安装"
)
SensorsBridge.trackInstallGameClick(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
action = "主动安装"
)
downloadEntity?.let {
PackageInstaller.install(context, it, showUnzipToast = false)
}

View File

@ -350,8 +350,7 @@ object DefaultUrlHandler {
}
EntranceConsts.HOST_FORUM_DETAIL -> {
val sectionId = uri.getQueryParameter("section_id") ?: ""
DirectUtils.directForumDetailSection(context, id, sectionId, entrance)
DirectUtils.directForumDetail(context, id, entrance)
}
EntranceConsts.HOST_GAME_RATING_DETAIL -> {
@ -439,17 +438,17 @@ object DefaultUrlHandler {
directToFeedback(
context,
content,
null,
isQaFeedback,
qaContentId,
isPlugin = false,
isSmoothGame = false,
EntranceConsts.ENTRANCE_BROWSER
)
}
}
EntranceConsts.HOST_HELP_AND_FEEDBACK -> {
DirectUtils.directToHelpAndFeedback(context)
val position = uri.getQueryParameter("position") ?: ""
DirectUtils.directToHelpAndFeedback(context, position.toInt())
}
EntranceConsts.HOST_HELP_DETAIL -> {
@ -490,13 +489,12 @@ object DefaultUrlHandler {
val activityName = uri.getQueryParameter("activity_name") ?: ""
val gameId = uri.getQueryParameter("game_id") ?: ""
context.startActivity(
GameCollectionEditActivity.getCreateIntent(
GameCollectionEditActivity.getIntent(
context,
activityId,
activityName,
gameId,
entrance,
"其他"
entrance
)
)
}

View File

@ -11,7 +11,6 @@ class BrowserInstallHandler : ChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
BrowserInstallHelper.showBrowserInstallHintDialog(
context,
gameEntity,
gameEntity.isVGame() || gameEntity.isSplitXApk()
) {
if (hasNext()) {

View File

@ -9,7 +9,7 @@ class CheckDownloadHandler : ChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
val apk = gameEntity.getApk().safelyGetInRelease(0) ?: return
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {

View File

@ -2,22 +2,20 @@ package com.gh.common.chain
import android.content.Context
import com.gh.gamecenter.common.utils.PermissionHelper
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.feature.entity.GameEntity
class CheckStoragePermissionHandler : ChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
PermissionHelper.checkStoragePermissionBeforeAction(
context,
gameEntity.id,
gameEntity.name ?: "",
gameEntity.categoryChinese
) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {
processEndCallback?.invoke(null)
PermissionHelper.checkStoragePermissionBeforeAction(context, object : EmptyCallback {
override fun onCallback() {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {
processEndCallback?.invoke(null)
}
}
}
})
}
}

View File

@ -10,7 +10,7 @@ class UpdateNewSimulatorHandler: ChainHandler() {
override fun handleRequest(context: Context, gameEntity: GameEntity) {
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity) {
NewSimulatorGameManager.showUpdateNewsSimulator(context) {
if (hasNext()) {
getNext()?.handleRequest(context, gameEntity)
} else {

View File

@ -3,7 +3,6 @@ package com.gh.common.chain
import android.content.Context
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.feature.entity.GameEntity
@ -20,42 +19,13 @@ class VersionNumberHandler : ChainHandler() {
if (!gameEntity.isShowVersionNumber()) {
confirmCallback.invoke()
} else {
SensorsBridge.trackGameDemoDialogShow(
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
DialogHelper.showGuideDialog(
context,
"温馨提示",
gameEntity.getVersionNumberString(),
"继续下载",
R.string.cancel.toResString(),
{
confirmCallback.invoke()
SensorsBridge.trackGameDemoDialogClick(
buttonName = "继续下载",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
cancelClickCallback = {
SensorsBridge.trackGameDemoDialogClick(
buttonName = R.string.cancel.toResString(),
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
touchOutsideCallback = {
SensorsBridge.trackGameDemoDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
{ confirmCallback.invoke() },
extraConfig = DialogHelper.Config(titleIcon = R.drawable.ic_dialog_tips)
)
}

View File

@ -13,14 +13,14 @@ import android.widget.PopupWindow
import androidx.core.content.ContextCompat
import androidx.databinding.BindingAdapter
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.callback.OnViewClickListener
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.KaifuAddItemBinding
import com.gh.gamecenter.databinding.LayoutAddKaifuPopupBinding
import com.gh.gamecenter.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.feature.entity.ServerCalendarEntity
import com.gh.gamecenter.servers.add.AddKaiFuPopupAdapter
import java.text.SimpleDateFormat

View File

@ -64,8 +64,6 @@ import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
@ -400,7 +398,7 @@ public class BindingAdapters {
boolean isInstalled = PackageUtils.isInstalledFromAllPackage(v.getContext(), gameEntity.getSimulator().getApk().getPackageName());
if (downloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled) {
SimulatorDownloadManager.getInstance().showDownloadDialog(v.getContext(), gameEntity.getSimulator(),
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.getId(), gameEntity.getName(), gameEntity.getCategoryChinese(), null);
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.getId(), gameEntity.getName(), null);
return;
}
}
@ -485,19 +483,6 @@ public class BindingAdapters {
case INSTALL_PLUGIN:
case INSTALL_NORMAL:
if (gameEntity.getApk().size() == 1) {
NewFlatLogUtils.INSTANCE.logGameInstall(
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
"主动安装"
);
SensorsBridge.trackInstallGameClick(
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
"主动安装"
);
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
if (gameEntity.isVGame()) {

View File

@ -1,7 +1,6 @@
package com.gh.common.dialog
import android.app.Activity.RESULT_OK
import android.content.DialogInterface
import android.content.Intent
import android.os.Build
import android.os.Bundle
@ -19,10 +18,13 @@ import com.gh.common.xapk.XapkInstaller
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.PermissionHelper
import com.gh.gamecenter.common.utils.PermissionHelper.INSTALL_PERMISSION_CODE
import com.gh.gamecenter.common.utils.getExtension
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.core.utils.SPUtils
import com.lightgame.download.DownloadEntity
import com.lightgame.utils.Utils
import kotlin.random.Random
class InstallPermissionDialogFragment : BaseDialogFragment() {
@ -32,11 +34,8 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
var url: String = ""
var gameId: String = ""
var gameName: String = ""
var gameType: String = ""
var mCallBack: ((isFromPermissionGrantedCallback: Boolean) -> Unit)? = null
private var dismissByTouchInside = false
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
mView = inflater.inflate(R.layout.dialog_install_permission, null, false)
return mView
@ -56,12 +55,6 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
if (isXapk) NewFlatLogUtils.logXApkInstallPermissionDialogShowed(gameId, gameName)
SensorsBridge.trackInstallPermissionDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameType
)
val randomNumber = if (isXapk) 1 else Random.nextInt(2)
closeTv.goneIf(randomNumber == 0)
closeIv.goneIf(randomNumber != 0)
@ -71,38 +64,18 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
}
closeTv.setOnClickListener {
dismissByTouchInside = true
if (isXapk) {
NewFlatLogUtils.logXApkInstallPermissionDialogClick("尝试解压", false, gameId, gameName)
mCallBack?.invoke(false)
}
SensorsBridge.trackInstallPermissionDialogClick(
buttonName = "尝试解压",
gameId = gameId,
gameName = gameName,
gameType = gameType
)
dismiss()
}
closeIv.setOnClickListener {
dismissByTouchInside = true
if (isXapk) NewFlatLogUtils.logXApkInstallPermissionDialogClick("关闭", false, gameId, gameName)
SensorsBridge.trackInstallPermissionDialogClick(
buttonName = "关闭",
gameId = gameId,
gameName = gameName,
gameType = gameType
)
dismiss()
}
activateTv.setOnClickListener {
NewFlatLogUtils.logXApkInstallPermissionDialogClick("立即开启", false, gameId, gameName)
SensorsBridge.trackInstallPermissionDialogClick(
buttonName = "立即开启",
gameId = gameId,
gameName = gameName,
gameType = gameType
)
PermissionHelper.toInstallPermissionSetting(requireActivity())
if (isXapk) {
SPUtils.setString(Constants.SP_XAPK_UNZIP_ACTIVITY, requireActivity().javaClass.name)
@ -111,23 +84,9 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
}
}
override fun onDismiss(dialog: DialogInterface) {
if (!dismissByTouchInside) {
SensorsBridge.trackInstallPermissionDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameType
)
}
super.onDismiss(dialog)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK && requestCode == INSTALL_PERMISSION_CODE) {
dismissByTouchInside = true
NewFlatLogUtils.logXApkInstallPermissionDialogClick("立即开启", true, gameId, gameName)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
@ -177,7 +136,6 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
installPermissionDialogFragment.url = downloadEntity.url
installPermissionDialogFragment.gameId = downloadEntity.gameId
installPermissionDialogFragment.gameName = downloadEntity.name
installPermissionDialogFragment.gameType = downloadEntity.categoryChinese
val transaction: FragmentTransaction = activity.supportFragmentManager.beginTransaction()
transaction.show(installPermissionDialogFragment)
transaction.commit()
@ -188,7 +146,6 @@ class InstallPermissionDialogFragment : BaseDialogFragment() {
this.url = downloadEntity.url
this.gameId = downloadEntity.gameId
this.gameName = downloadEntity.name
this.gameType = downloadEntity.categoryChinese
}
installPermissionDialogFragment.show(
activity.supportFragmentManager,

View File

@ -2,7 +2,6 @@ package com.gh.common.dialog
import android.animation.ValueAnimator
import android.content.Context
import android.content.DialogInterface
import android.content.pm.PackageInfo
import android.os.Bundle
import android.view.LayoutInflater
@ -12,7 +11,6 @@ import android.view.animation.LinearInterpolator
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
@ -63,8 +61,6 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
var gameEntity: GameEntity? = null
var callBack: ConfirmListener? = null
private var mDismissByTouchInside = false
private val dataWatcher = object : DataWatcher() {
override fun onDataChanged(downloadEntity: DownloadEntity) {
val packageName = downloadEntity.packageName
@ -94,11 +90,6 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
EventBus.getDefault().register(this)
gameEntity?.let {
LogUtils.uploadPackageCheck("pkg_check_pop_click", "出现弹窗", it, "", "", "", "")
SensorsBridge.trackPkgCheckDialogShow(
gameId = it.id,
gameName = it.name ?: "",
gameType = it.categoryChinese
)
}
}
@ -137,18 +128,6 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
"",
""
)
SensorsBridge.trackPkgCheckDialogClick(
buttonName = "点击链接",
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?: "",
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
binding.noRemindAgainCb.isChecked
} else null,
linkId = link.link ?: "",
linkType = link.type ?: "",
linkText = link.linkText ?: ""
)
DirectUtils.directToLinkPage(requireContext(), link, "包名检测弹窗", "")
}.build()
spanBuilder.append(linkSpan)
@ -197,7 +176,6 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
}
val isAllPackageInstalled = isAllPackageInstalled(mAllInstalledPackages, entity)
if (isAllPackageInstalled) {
mDismissByTouchInside = true
callBack?.onConfirm()
dismissAllowingStateLoss()
} else {
@ -215,15 +193,6 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
"",
""
)
SensorsBridge.trackPkgCheckDialogClick(
buttonName = "点击前往下载",
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?: "",
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
binding.noRemindAgainCb.isChecked
} else null
)
DirectUtils.directToLinkPage(requireContext(), packageLink, "包名检测弹窗", "")
}
}
@ -237,19 +206,6 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
saveRecord(entity)
LogUtils.uploadPackageCheck("pkg_check_pop_click", "不再提示", gameEntity, "", "", "", "")
}
mDismissByTouchInside = true
SensorsBridge.trackPkgCheckDialogClick(
buttonName = binding.cancelTv.text.toString(),
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?: "",
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
binding.noRemindAgainCb.isChecked
} else null
)
dismissAllowingStateLoss()
}
}
@ -344,21 +300,6 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
DownloadManager.getInstance().removeObserver(dataWatcher)
}
override fun onDismiss(dialog: DialogInterface) {
if (!mDismissByTouchInside) {
SensorsBridge.trackPkgCheckDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity?.id ?: "",
gameName = gameEntity?.name ?: "",
gameType = gameEntity?.categoryChinese ?: "",
isNotPrompt = if (binding.noRemindAgainCb.isVisible) {
binding.noRemindAgainCb.isChecked
} else null
)
}
super.onDismiss(dialog)
}
//安装、卸载事件
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(busFour: EBPackage) {

View File

@ -62,17 +62,17 @@ object ExposureUtils {
host: String? = "unknown",
path: String? = "unknown",
downloadType: DownloadType
): ExposureEvent? {
) {
val gameEntity = entity.copy()
gameEntity.platform = platform
gameEntity.downloadCompleteType = downloadType.toString()
val traceEvent = trace?.toObject<ExposureEvent>()
if (TextUtils.isEmpty(entity.id)) return null
if (TextUtils.isEmpty(entity.id)) return
// 避免生成 trace 相同的下载完成事件,根据日志看下载完成的同一秒有可能生成两条
if (mDownloadCompleteTraceEventIdSet.contains(traceEvent?.id)) {
return null
return
}
traceEvent?.payload?.gameId?.let { mDownloadCompleteTraceEventIdSet.add(it) }
@ -91,8 +91,6 @@ object ExposureUtils {
ExposureManager.log(exposureEvent)
ExposureManager.commitSavedExposureEvents(forcedUpload = true)
return exposureEvent
}
@JvmStatic

View File

@ -1,134 +0,0 @@
package com.gh.common.prioritychain
import android.app.Activity
import android.view.Gravity
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.gh.common.util.NewFlatLogUtils
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.BaseFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.databinding.PopupAccelerateNotificationBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.fragment.MainWrapperViewModel
class AccelerateNotificationHandler(priority: Int) : PriorityChainHandler(priority) {
private var mActivity: Activity? = null
private var mBaseHandler: BaseFragment.BaseHandler? = null
private var mGameList: List<GameEntity>? = null
private var mViewModel: MainWrapperViewModel? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(
activity: Activity,
baseHandler: BaseFragment.BaseHandler,
gameEntityList: List<GameEntity>?,
viewModel: MainWrapperViewModel
) {
mActivity = activity
mGameList = gameEntityList
mBaseHandler = baseHandler
mViewModel = viewModel
if (getStatus() == STATUS_PENDING) {
if (gameEntityList == null) {
processNext()
} else {
onProcess()
}
} else {
if (gameEntityList == null) {
updateStatus(STATUS_INVALID)
} else {
updateStatus(STATUS_VALID)
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
val accelerateSet =
HashSet(SPUtils.getStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET))
if (!mGameList.isNullOrEmpty() && !accelerateSet.contains(mGameList!![0].messageId)) {
showAccelerateNotificationPopupWindow(mActivity!!, mViewModel, mBaseHandler, mGameList!![0]) {
processNext()
}
accelerateSet.add(mGameList!![0].messageId)
SPUtils.setStringSet(Constants.SP_ACCELERATE_NOTIFICATION_POP_UP_SET, accelerateSet)
} else {
processNext()
}
}
STATUS_INVALID -> {
processNext()
}
}
}
companion object {
fun showAccelerateNotificationPopupWindow(
activity: Activity,
viewModel: MainWrapperViewModel?,
baseHandler: BaseFragment.BaseHandler?,
gameEntity: GameEntity?,
dismissCallback: (() -> Unit)?
) {
val binding: PopupAccelerateNotificationBinding =
PopupAccelerateNotificationBinding.inflate(LayoutInflater.from(activity))
if (gameEntity != null) {
binding.gameIconView.displayGameIcon(gameEntity)
binding.gameNameTv.text = gameEntity.name
binding.root.setOnClickListener {
NewFlatLogUtils.logMessageInformClickPluginVersion(
gameEntity.id,
gameEntity.name!!
)
if (gameEntity.messageId.isNotEmpty()) {
// 把对应系统消息设为已读
viewModel?.postMessageRead(gameEntity.messageId)
}
GameDetailActivity.startGameDetailActivity(
context = activity,
gameId = gameEntity.id,
entrance = "首页插件上架弹窗",
defaultTab = -1,
isSkipGameComment = false,
scrollToLibao = false,
openVideoStreaming = false,
openPlatformWindow = true,
traceEvent = null
)
}
}
BugFixedPopupWindow(
binding.root,
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT
).apply {
isTouchable = true
isFocusable = true
isOutsideTouchable = true
animationStyle = R.style.popup_window_ease_in_and_out_anim_style
showAtLocation(
activity.window.decorView,
Gravity.TOP,
0,
DisplayUtils.getStatusBarHeight(activity.resources) + DisplayUtils.dip2px(42f)
)
setOnDismissListener {
dismissCallback?.invoke()
}
baseHandler?.postDelayed({ dismiss() }, 5000)
}
}
}
}

View File

@ -1,86 +0,0 @@
package com.gh.common.prioritychain
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.gamecenter.common.base.fragment.BaseLazyFragment
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IFloatingWindowProvider
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
import com.gh.gamecenter.floatingwindow.FloatingWindowEntity
import com.gh.gamecenter.fragment.WelcomeDialogFragment
import com.lightgame.utils.Utils
class FloatingWindowHandler(priority: Int) : PriorityChainHandler(priority) {
private var mFragment: BaseLazyFragment? = null
private var mRecyclerView: RecyclerView? = null
private var mWindowList: ArrayList<FloatingWindowEntity>? = null
fun setData(windowList: ArrayList<FloatingWindowEntity>?) {
mWindowList = windowList
if (mFragment != null) {
preProcess()
}
}
fun setView(
fragment: BaseLazyFragment,
recyclerView: RecyclerView
) {
mFragment = fragment
mRecyclerView = recyclerView
if (mWindowList != null) {
preProcess()
}
}
private fun preProcess() {
Utils.log(TAG, "FloatingWindowHandler preProcess windowSize is -> ${mWindowList?.size}")
if (getStatus() == STATUS_PENDING) {
if (!mWindowList.isNullOrEmpty()) {
onProcess()
} else {
processNext()
}
} else {
if (!mWindowList.isNullOrEmpty()) {
updateStatus(STATUS_VALID)
} else {
updateStatus(STATUS_INVALID)
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
val floatingWindowProvider =
ARouter.getInstance().build(RouteConsts.provider.floatingwindow)
.navigation() as? IFloatingWindowProvider<WelcomeDialogEntity>
// 强校验所有条件均通过才能显示
if (floatingWindowProvider == null || mFragment == null || mFragment?.isAdded == false || mRecyclerView == null) {
processNext()
return
}
floatingWindowProvider.showFloatingWindowOnly(
mFragment!!,
mRecyclerView!!,
mWindowList!!,
) {
val welcomeDialog = WelcomeDialogFragment.getInstance(it, true, mFragment)
welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
}
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -1,44 +0,0 @@
package com.gh.common.prioritychain
import com.gh.gamecenter.fragment.HomeSearchToolWrapperFragment
class HomePushHandler(priority: Int): PriorityChainHandler(priority) {
private var mHomeFragment: HomeSearchToolWrapperFragment? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(homeFragment: HomeSearchToolWrapperFragment?, shouldShow: Boolean) {
mHomeFragment = homeFragment
if (getStatus() == STATUS_PENDING) {
if (shouldShow && homeFragment != null) {
onProcess()
} else {
processNext()
}
} else {
if (shouldShow && homeFragment != null) {
updateStatus(STATUS_VALID)
} else {
updateStatus(STATUS_INVALID)
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
// 目前首页下拉二楼是首页最后一个弹窗类的东西,还没实现回调,如果有其它要在它后面弹出的,需要自行在它的实现结果后添加回调
mHomeFragment?.popUpHomePushIfNeeded {
processNext()
}
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -1,20 +0,0 @@
package com.gh.common.prioritychain
import com.gh.gamecenter.common.entity.NotificationUgc
import com.gh.gamecenter.common.utils.NotificationHelper
import com.gh.gamecenter.login.user.UserManager
class NotificationPermissionDialogHandler(priority: Int) : PriorityChainHandler(priority) {
override fun onProcess() {
// 仅登录后再启动光环时请求一次权限
if (UserManager.getInstance().isLoggedIn) {
NotificationHelper.showNotificationHintDialog(NotificationUgc.LOGIN) {
processNext()
}
} else {
processNext()
}
}
}

View File

@ -1,22 +0,0 @@
package com.gh.common.prioritychain
import java.util.*
import java.util.concurrent.PriorityBlockingQueue
class PriorityChain {
private val mHandlerQueue: Queue<PriorityChainHandler> = PriorityBlockingQueue()
fun addHandler(handler: PriorityChainHandler) {
mHandlerQueue.add(handler.also {
it.setPriorityChain(this)
})
}
fun start() {
mHandlerQueue.poll()?.process(mHandlerQueue)
}
fun isHandlerQueueEmpty() = mHandlerQueue.isEmpty()
}

View File

@ -1,71 +0,0 @@
package com.gh.common.prioritychain
import com.lightgame.utils.Utils
import java.util.*
abstract class PriorityChainHandler(private val mPriority: Int) : Comparable<PriorityChainHandler> {
private var mStatus = STATUS_UNKNOWN
private var mQueue: Queue<PriorityChainHandler>? = null
private var mPriorityChain: PriorityChain? = null
/**
* 获取当前 handler 的状态
* - 等待结果返回 STATUS_PENDING
* - 无需执行 STATUS_INVALID
* - 可执行 STATUS_VALID
* - 未知 STATUS_UNKNOWN
*/
fun getStatus(): Int = mStatus
fun updateStatus(status: Int) {
Utils.log(TAG, "${javaClass.simpleName} updateStatus $status")
mStatus = status
}
fun setPriorityChain(priorityChain: PriorityChain) {
mPriorityChain = priorityChain
}
fun process(queue: Queue<PriorityChainHandler>) {
Utils.log(TAG, "${javaClass.simpleName} process $mStatus")
mQueue = queue
// 若当前 handler 未经处理,将其状态改为 pending
if (mStatus == STATUS_UNKNOWN) {
updateStatus(STATUS_PENDING)
}
onProcess()
}
/**
* 执行相关功能的地方
*/
abstract fun onProcess()
/**
* 分发给下一个 handler 处理
*/
fun processNext() {
Utils.log(TAG, "${javaClass.simpleName} processNext $mStatus")
mQueue?.poll()?.process(mQueue!!)
}
override fun compareTo(other: PriorityChainHandler): Int {
return (mPriority - other.mPriority)
}
companion object {
internal const val STATUS_PENDING = 0
internal const val STATUS_INVALID = 1
internal const val STATUS_VALID = 2
internal const val STATUS_UNKNOWN = 3
const val TAG = "PriorityChainHandler"
}
}

View File

@ -1,47 +0,0 @@
package com.gh.common.prioritychain
import androidx.fragment.app.FragmentActivity
import com.gh.common.dialog.PrivacyPolicyDialogFragment
import com.gh.gamecenter.entity.DialogEntity
class PrivacyPolicyDialogHandler(priority: Int) : PriorityChainHandler(priority) {
private var mActivity: FragmentActivity? = null
private var mPrivacyPolicyEntity: DialogEntity.PrivacyPolicyEntity? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(fragmentActivity: FragmentActivity, privacyPolicyEntity: DialogEntity.PrivacyPolicyEntity?) {
mActivity = fragmentActivity
mPrivacyPolicyEntity = privacyPolicyEntity
if (getStatus() == STATUS_PENDING) {
if (privacyPolicyEntity == null) {
processNext()
} else {
onProcess()
}
} else {
if (privacyPolicyEntity == null) {
updateStatus(STATUS_INVALID)
} else {
updateStatus(STATUS_VALID)
}
}
}
override fun onProcess() {
when(getStatus()) {
STATUS_VALID -> {
PrivacyPolicyDialogFragment.show(mActivity!!, mPrivacyPolicyEntity) { _: Boolean? ->
processNext()
}
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -1,52 +0,0 @@
package com.gh.common.prioritychain
import androidx.fragment.app.Fragment
import com.gh.common.dialog.ReserveDialog
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.message.MessageUnreadRepository
class ReserveDialogHandler(priority: Int) : PriorityChainHandler(priority) {
private var mFragment: Fragment? = null
private var mReserveData: List<SimpleGameEntity>? = null
/**
* 提前预处理显示弹窗的内容
*/
fun doPreProcess(fragment: Fragment, reserveData: List<SimpleGameEntity>?) {
mFragment = fragment
mReserveData = reserveData
if (getStatus() == STATUS_PENDING) {
if (reserveData.isNullOrEmpty()) {
processNext()
} else {
onProcess()
}
} else {
if (reserveData.isNullOrEmpty()) {
updateStatus(STATUS_INVALID)
} else {
updateStatus(STATUS_VALID)
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
val reserveDialog = ReserveDialog.getInstance(mReserveData!!)
reserveDialog.setOnDismissListener {
MessageUnreadRepository.loadMessageUnreadData()
processNext()
}
reserveDialog.show(mFragment!!.childFragmentManager, "reserveDialog")
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -1,17 +0,0 @@
package com.gh.common.prioritychain
import android.content.Context
import com.gh.gamecenter.manager.UpdateManager
class UpdateDialogHandler(context: Context, priority: Int) : PriorityChainHandler(priority) {
private val mUpdateManager = UpdateManager.getInstance(context)
override fun onProcess() {
mUpdateManager.checkUpdate(true, null)
mUpdateManager.setDismissCallback {
processNext()
}
}
}

View File

@ -1,79 +0,0 @@
package com.gh.common.prioritychain
import android.graphics.Bitmap
import androidx.fragment.app.Fragment
import com.gh.gamecenter.common.callback.BiCallback
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
import com.gh.gamecenter.fragment.MainWrapperViewModel
import com.gh.gamecenter.fragment.WelcomeDialogFragment
import com.halo.assistant.HaloApp
class WelcomeDialogHandler(priority: Int): PriorityChainHandler(priority) {
private var mFragment: Fragment? = null
private var mWelcomeDialogEntity: WelcomeDialogEntity? = null
fun doPreProcess(fragment: Fragment, welcomeDialogEntity: WelcomeDialogEntity?) {
mFragment = fragment
mWelcomeDialogEntity = welcomeDialogEntity
val preLoadClosure = {
// 判断启动本次应用是否已经弹窗,不是的话弹启动弹窗
if (HaloApp.get(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false) == null) {
HaloApp.put(MainWrapperViewModel.SHOULD_SHOW_OPENING_DIALOG, false)
ImageUtils.getBitmap(mWelcomeDialogEntity!!.icon, object : BiCallback<Bitmap, Boolean> {
override fun onFirst(first: Bitmap) {
if (getStatus() == STATUS_PENDING) {
updateStatus(STATUS_VALID)
onProcess()
} else {
updateStatus(STATUS_VALID)
}
}
override fun onSecond(second: Boolean) {
processNext()
}
})
} else {
processNext()
}
}
if (getStatus() == STATUS_PENDING) {
if (welcomeDialogEntity == null) {
processNext()
} else {
preLoadClosure.invoke()
}
} else {
if (welcomeDialogEntity == null) {
updateStatus(STATUS_INVALID)
} else {
preLoadClosure.invoke()
}
}
}
override fun onProcess() {
when (getStatus()) {
STATUS_VALID -> {
if (mFragment == null || !mFragment!!.isAdded) {
updateStatus(STATUS_INVALID)
processNext()
} else {
val welcomeDialog = WelcomeDialogFragment.getInstance(mWelcomeDialogEntity)
welcomeDialog.setOnDismissListener {
processNext()
}
welcomeDialog.show(mFragment!!.childFragmentManager, "WelcomeDialog")
}
}
STATUS_INVALID -> {
processNext()
}
}
}
}

View File

@ -56,22 +56,6 @@ class ConfigProviderImpl : IConfigProvider {
return Config.getSettings()?.image?.oss?.gifWaterMark ?: ""
}
override fun getVideoSnapshotSuffix(): String {
return Config.getSettings()?.image?.oss?.snapshot ?: ""
}
override fun getImageCropSuffix(): String {
return Config.getSettings()?.image?.oss?.crop ?: ""
}
override fun getImageInfoSuffix(): String {
return Config.getSettings()?.image?.oss?.info ?: ""
}
override fun getImageResizeSuffix(): String {
return Config.getSettings()?.image?.oss?.resize ?: ""
}
override fun getQQ(): String {
return Config.getSettings()?.support?.qq ?: ""
}

View File

@ -1,7 +1,6 @@
package com.gh.common.provider
import android.content.Context
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.constant.RouteConsts
@ -54,16 +53,16 @@ class DirectProviderImpl : IDirectProvider {
DirectUtils.directDouyin(context, userId)
}
override fun directToSuggestionFromDiagnosis(context: Context, content: String, diagnosis: String) {
DirectUtils.directToSuggestion(context, content = content, diagnosis = diagnosis)
override fun directToSuggestionFromDiagnosis(context: Context, diagnosis: String) {
DirectUtils.directToSuggestion(context, diagnosis = diagnosis)
}
override fun directToQa(context: Context, text: String?, id: String) {
DirectUtils.directToQa(context, text, id)
}
override fun directToHelpAndFeedback(context: Context, bundle: Bundle?) {
DirectUtils.directToHelpAndFeedback(context, bundle)
override fun directToHelpAndFeedback(context: Context, position: Int) {
DirectUtils.directToHelpAndFeedback(context, position)
}
override fun directToQqGroup(context: Context, groupNumber: String?): Boolean {

View File

@ -5,11 +5,9 @@ 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
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.IDownloadButtonClickedProvider
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.packagehelper.PackageRepository
@ -27,7 +25,6 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
var downloadStatusInChinese = ""
var gameSchemaType = ""
var packageName = ""
var exposureSourceList: List<ExposureSource>? = null
val boundedObject = downloadButton.getObject()
@ -50,7 +47,6 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
downloadStatusInChinese = boundedObject.downloadStatusChinese
gameSchemaType = boundedObject.gameBitChinese
packageName = boundedObject.getUniquePackageName() ?: ""
exposureSourceList = boundedObject.exposureEvent?.source
}
is GameUpdateEntity -> {
@ -61,7 +57,6 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
gameTypeInChinese = boundedObject.categoryChinese
downloadStatusInChinese = boundedObject.downloadStatusChinese
packageName = boundedObject.packageName
exposureSourceList = boundedObject.exposureEvent?.source
}
is DownloadEntity -> {
@ -70,7 +65,6 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
gameCategory = boundedObject.getGameCategory()
downloadStatus = if (boundedObject.isVGame()) "畅玩" else "下载"
packageName = boundedObject.packageName
exposureSourceList = boundedObject.exposureTrace?.toObject<ExposureEvent>()?.source
}
}
@ -98,9 +92,8 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
) {
// 上报神策点击事件
SensorsBridge.trackEventWithExposureSource(
SensorsBridge.trackEvent(
"DownLoadbuttonClick",
exposureSourceList,
"game_id", gameId,
"game_name", gameName,
"game_type", gameTypeInChinese,
@ -112,9 +105,10 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
"page_business_id", GlobalActivityManager.getCurrentPageEntity().pageBusinessId,
"last_page_name", GlobalActivityManager.getLastPageEntity().pageName,
"last_page_id", GlobalActivityManager.getLastPageEntity().pageId,
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId,
"last_page_business_id", GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
}
}

View File

@ -6,6 +6,7 @@ import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.provider.ILinkDirectUtilsProvider
@ -47,6 +48,17 @@ class LinkDirectUtilsProviderImpl : ILinkDirectUtilsProvider {
DirectUtils.directToSuggestion(context, type, suggestHintType, content, isQaFeedback, qaContentId)
}
override fun directToSuggestion(
context: Context,
type: SuggestType,
suggestHintType: String?,
content: String?,
game: SimpleGameEntity,
platform: String
) {
DirectUtils.directToSuggestion(context, type, suggestHintType, content, game, platform)
}
override fun directToSuggestion(context: Context, type: SuggestType, hiddenHint: String) {
DirectUtils.directToSuggestion(context, type, hiddenHint)
}

View File

@ -41,7 +41,7 @@ object NewSimulatorGameManager {
private const val KEY_USE_DEBUG_API = "USE_DEBUG_API"
private const val KEY_META = "META"
// private const val GH_RETRO_EMU_APP_PACKAGE_NAME = "com.gh.retroemu"
// private const val GH_RETRO_EMU_APP_PACKAGE_NAME = "com.gh.retroemu"
private const val GH_RETRO_EMU_APP_LAUNCHER_ACTIVITY_NAME = "com.gh.retroemu.ui.SplashActivity"
@ -61,10 +61,10 @@ object NewSimulatorGameManager {
}
/**
* 弹出更新弹框
*/
* 弹出更新弹框
*/
@JvmStatic
fun showUpdateNewsSimulator(context: Context, gameEntity: GameEntity, callback: EmptyCallback? = null) {
fun showUpdateNewsSimulator(context: Context, callback: EmptyCallback? = null){
NewFlatLogUtils.logSimulatorUpdateAlertShow()
DialogHelper.showDialog(
context,
@ -76,13 +76,7 @@ object NewSimulatorGameManager {
NewFlatLogUtils.logSimulatorUpdateAlertClick("更新")
val simulator = Config.getNewSimulatorEntitySetting()
if (simulator != null) {
SimulatorDownloadManager.getInstance().showDownloadingDialog(
context,
simulator,
gameEntity.id,
gameEntity.name ?: "",
gameEntity.categoryChinese
)
SimulatorDownloadManager.getInstance().showDownloadingDialog(context, simulator)
}
},
cancelClickCallback = {
@ -133,10 +127,7 @@ object NewSimulatorGameManager {
)
val intent = Intent()
intent.setClassName(
SimulatorGameManager.NEW_SIMULATOR_PACKAGE_NAME,
GH_RETRO_EMU_APP_LAUNCHER_ACTIVITY_NAME
)
intent.setClassName(SimulatorGameManager.NEW_SIMULATOR_PACKAGE_NAME, GH_RETRO_EMU_APP_LAUNCHER_ACTIVITY_NAME)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.data = gamePackageFileUri
gameEntity.getApk().safelyGetInRelease(0)?.let { apk ->
@ -147,10 +138,7 @@ object NewSimulatorGameManager {
intent.putExtra(KEY_GAME_ICON, it)
intent.putExtra(KEY_GAME_PACKAGE_PATH, downloadEntity.path) // 游戏包文件路径,冗余参数)
intent.putExtra(KEY_GAME_PACKAGE_SDCARD_PATH, true)
intent.putExtra(
KEY_GAME_PACKAGE_LAST_MODIFICATION,
File(downloadEntity.path).lastModified()
) // 游戏包文件修改时间
intent.putExtra(KEY_GAME_PACKAGE_LAST_MODIFICATION, File(downloadEntity.path).lastModified()) // 游戏包文件修改时间
intent.putExtra(KEY_GAME_EMU_SYSTEM, gameEntity.simulatorType) // 模拟器类型
intent.putExtra(KEY_GAME_ID, gameEntity.id)
// TODO 补充光环模拟器的游戏 id

View File

@ -14,7 +14,6 @@ import com.gh.common.util.PackageInstaller
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.base.TrackableDialog
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
@ -48,7 +47,6 @@ class SimulatorDownloadManager private constructor() {
private var simulator: SimulatorEntity? = null
private var gameId: String = ""
private var gameName: String = ""
private var gameType: String = ""
private var downloadType: String = ""
private val dataWatcher = object : DataWatcher() {
@ -101,43 +99,33 @@ class SimulatorDownloadManager private constructor() {
downloadDialog?.dismiss()
}
}
DownloadStatus.diskisfull == downloadEntity.status -> {
ToastUtils.showToast("存储空间已满,下载任务已暂停")
}
DownloadStatus.diskioerror == downloadEntity.status -> {
ToastUtils.showToast("下载 IO 出现异常,下载任务已暂停")
}
DownloadStatus.neterror == downloadEntity.status -> {
ToastUtils.showToast("网络不稳定,下载任务已暂停")
}
DownloadStatus.timeout == downloadEntity.status -> {
ToastUtils.showToast("网络不稳定,下载任务已暂停")
}
DownloadStatus.notfound == downloadEntity.status -> {
ToastUtils.showToast("下载链接异常,请稍后重试")
}
DownloadStatus.uncertificated == downloadEntity.status -> {
ToastUtils.showToast("请先进行实名认证")
}
DownloadStatus.unqualified == downloadEntity.status -> {
ToastUtils.showToast("未成年人暂不允许在此时间下载游戏")
}
DownloadStatus.unavailable == downloadEntity.status -> {
ToastUtils.showToast("该游戏未接入防沉迷系统,暂不支持下载")
}
DownloadStatus.banned == downloadEntity.status -> {
ToastUtils.showToast("网络异常")
}
DownloadStatus.hijack == downloadEntity.status -> {
ToastUtils.showToast("网络劫持,请稍后重试")
}
@ -147,7 +135,7 @@ class SimulatorDownloadManager private constructor() {
}
fun showDownloadDialog(context: Context, simulator: SimulatorEntity?, location: SimulatorLocation) {
showDownloadDialog(context, simulator, location, "", "", "", null)
showDownloadDialog(context, simulator, location, "", "", null)
}
fun showDownloadDialog(
@ -156,7 +144,6 @@ class SimulatorDownloadManager private constructor() {
location: SimulatorLocation,
gameId: String = "",
gameName: String = "",
gameCategoryChinese: String = "",
cancelCallback: (() -> Unit)? = null
) {
if (context == null) return
@ -165,7 +152,6 @@ class SimulatorDownloadManager private constructor() {
this.simulator = simulator
this.gameId = gameId
this.gameName = gameName
this.gameType = gameCategoryChinese
PermissionHelper.checkGetInstalledAppsListBeforeAction(context, object : EmptyCallback {
override fun onCallback() {
@ -197,8 +183,7 @@ class SimulatorDownloadManager private constructor() {
return
}
val title = if (shouldShowUpdate && isInstalled) "更新模拟器" else "安装模拟器"
val message =
if (shouldShowUpdate && isInstalled) "检测到模拟器存在更高版本,是否前往更新" else "模拟器游戏需要先下载安装对应的模拟器,才可以运行"
val message = if (shouldShowUpdate && isInstalled) "检测到模拟器存在更高版本,是否前往更新" else "模拟器游戏需要先下载安装对应的模拟器,才可以运行"
val positiveText =
if (shouldShowUpdate && isInstalled) "更新(${simulator?.apk?.size}" else "下载(${simulator?.apk?.size}"
val negativeText = if (shouldShowUpdate && isInstalled) "下次再说" else "取消"
@ -210,25 +195,6 @@ class SimulatorDownloadManager private constructor() {
if (shouldShowUpdate && isInstalled) {
NewFlatLogUtils.logSimulatorUpdateAlertShow()
}
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
DialogHelper.showDialog(
context,
title,
@ -241,79 +207,16 @@ class SimulatorDownloadManager private constructor() {
cancelCallback?.invoke()
NewFlatLogUtils.logSimulatorUpdateAlertClick("取消")
MtaHelper.onEvent(trackableEntity.event, trackableEntity.key, "点击下次再说")
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = negativeText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = negativeText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
confirmClickCallback = {
showDownloadingDialog(context, simulator, gameId, gameName, gameCategoryChinese)
showDownloadingDialog(context, simulator)
NewFlatLogUtils.logSimulatorUpdateAlertClick("更新")
MtaHelper.onEvent(
trackableEntity.event,
trackableEntity.key,
if (shouldShowUpdate && isInstalled) "点击更新" else "点击下载"
)
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = positiveText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = positiveText,
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
touchOutsideCallback = {
if (shouldShowUpdate && isInstalled) {
SensorsBridge.trackSimulatorUpdateDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
} else {
SensorsBridge.trackSimulatorInstallDialogClick(
buttonName = "关闭弹窗",
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese,
lastPageId = GlobalActivityManager.getLastPageEntity().pageId,
lastPageName = GlobalActivityManager.getLastPageEntity().pageName,
lastPageBusinessId = GlobalActivityManager.getLastPageEntity().pageBusinessId
)
}
},
mtaEvent = trackableEntity.event, mtaKey = trackableEntity.key,
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
@ -325,13 +228,7 @@ class SimulatorDownloadManager private constructor() {
})
}
fun showDownloadingDialog(
context: Context,
simulator: SimulatorEntity?,
gameId: String = "",
gameName: String = "",
gameCategoryChinese: String = "",
) {
fun showDownloadingDialog(context: Context, simulator: SimulatorEntity?) {
mContextRef = WeakReference(context)
val msg = FileUtils.isCanDownload(context, simulator?.apk?.size)
if (!msg.isNullOrEmpty()) {
@ -364,11 +261,6 @@ class SimulatorDownloadManager private constructor() {
}
downloadDialog?.setOnDismissListener {
SensorsBridge.trackSimulatorDownloadDialogClose(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese
)
DownloadManager.getInstance().removeObserver(dataWatcher)
}
@ -381,7 +273,7 @@ class SimulatorDownloadManager private constructor() {
params?.width = context.resources.displayMetrics.widthPixels - DisplayUtils.dip2px(60f)
downloadDialog?.window?.attributes = params
download(simulator, gameId, gameName, gameCategoryChinese)
download(simulator)
}
private fun showNoneEmulatorDialog(context: Context) {
@ -401,12 +293,7 @@ class SimulatorDownloadManager private constructor() {
)
}
private fun download(
simulator: SimulatorEntity?,
gameId: String = "",
gameName: String = "",
gameCategoryChinese: String = ""
) {
private fun download(simulator: SimulatorEntity?) {
val apkEntity = simulator?.apk ?: return
val entity = DownloadManager.getInstance().getDownloadEntityByUrl(apkEntity.url)
@ -421,30 +308,18 @@ class SimulatorDownloadManager private constructor() {
DownloadStatus.diskisfull -> {
DownloadManager.getInstance().addObserver(dataWatcher)
uiExecutor.executeWithDelay(Runnable { DownloadManager.getInstance().resume(entity, true) }, 200)
SensorsBridge.trackSimulatorDownloadDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese
)
downloadDialog?.show()
}
DownloadStatus.done -> NDataChanger.notifyDataChanged(entity)
else -> createDownload(apkEntity, simulator, gameId, gameName, gameCategoryChinese)
else -> createDownload(apkEntity, simulator)
}
} else {
createDownload(apkEntity, simulator, gameId, gameName, gameCategoryChinese)
createDownload(apkEntity, simulator)
}
}
private fun createDownload(
apkEntity: ApkEntity,
simulator: SimulatorEntity,
gameId: String = "",
gameName: String = "",
gameCategoryChinese: String = ""
) {
private fun createDownload(apkEntity: ApkEntity, simulator: SimulatorEntity) {
DownloadManager.getInstance().addObserver(dataWatcher)
val downloadId = PackageInstaller.createDownloadId(simulator.name)
val downloadEntity = DownloadEntity()
@ -476,11 +351,6 @@ class SimulatorDownloadManager private constructor() {
downloadType,
""
)
SensorsBridge.trackSimulatorDownloadDialogShow(
gameId = gameId,
gameName = gameName,
gameType = gameCategoryChinese
)
downloadDialog?.show()
}

View File

@ -150,7 +150,7 @@ object SimulatorGameManager {
SimulatorDownloadManager.getInstance().showDownloadDialog(
AppManager.getInstance().recentActiveActivity, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name
?: "", gameEntity.categoryChinese
?: ""
) {
jumpToSimulator(downloadEntity, gameEntity)
}

View File

@ -109,12 +109,12 @@ object ArchiveDownloadButtonHelper {
R.string.archive_download_dialog_content.toResString(),
R.string.archive_download_dialog_confirm.toResString(),
R.string.cancel.toResString(),
confirmClickCallback = {
{
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.archive_download_dialog_confirm.toResString())
VHelper.disableLaunchGameAfterInstallation()
EventBus.getDefault().post(EBReuse("download"))
},
cancelClickCallback = {
{
NewFlatLogUtils.logCloudArchiveGameDownloadDialogClick(R.string.cancel.toResString())
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)

View File

@ -177,8 +177,6 @@ public class CommentUtils {
return null;
},
null,
null,
null,
new DialogHelper.Config("", false, true, true, false, -1)
);
break;

View File

@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
@ -34,7 +33,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -123,7 +121,7 @@ public class DialogUtils {
return dialog;
}
public static void checkDownload(Context context, String size, String gameId, String gameName, String gameCategoryChinese, CheckDownloadCallBack callBack) {
public static void checkDownload(Context context, String size, String gameId, String gameName, CheckDownloadCallBack callBack) {
if (!NetworkUtils.isNetworkConnected(context)) {
showNoConnectionDownloadDialog(context, () -> {
},
@ -140,8 +138,7 @@ public class DialogUtils {
() -> callBack.onResponse(false),
() -> callBack.onResponse(true),
gameId,
gameName,
gameCategoryChinese);
gameName);
}
}
@ -170,9 +167,7 @@ public class DialogUtils {
DialogHelper.showDialog(context, "下载提示", "网络异常,请检查手机网络状态", "知道了", "WiFi自动下载", listener::onConfirm, cancelListener::onCancel, false, "", "");
}
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener, String gameId, String gameName, String gameCategoryChinese) {
SensorsBridge.trackDownloadMobileDataDialogShow(gameId, gameName, gameCategoryChinese);
public static void showDownloadDialog(Context context, ConfirmListener listener, CancelListener cancelListener, String gameId, String gameName) {
context = checkDialogContext(context);
NewFlatLogUtils.logDownloadMobileDataDialogShow(gameId, gameName);
@ -187,7 +182,6 @@ public class DialogUtils {
Context finalContext = context;
allowOnce.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "允许一次");
SensorsBridge.trackDownloadMobileDataDialogClick("允许一次", gameId, gameName, gameCategoryChinese);
AppExecutor.getUiExecutor().executeWithDelay(() -> {
Utils.toast(finalContext, "已使用移动网络下载,请注意流量消耗");
}, 500);
@ -197,14 +191,12 @@ public class DialogUtils {
});
wifiAuto.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "WiFi自动下载");
SensorsBridge.trackDownloadMobileDataDialogClick("WiFi自动下载", gameId, gameName, gameCategoryChinese);
cancelListener.onCancel();
dialog.dismiss();
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "连上WiFi后自动下载");
});
allowAlways.setOnClickListener(v -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "总是允许");
SensorsBridge.trackDownloadMobileDataDialogClick("总是允许", gameId, gameName, gameCategoryChinese);
SPUtils.setBoolean(getTrafficDownloadHintKey(), false);
AppExecutor.getUiExecutor().executeWithDelay(() -> {
// 显示了弹窗以后,即便下面这个 toast 放在 listener.onConfirm 后调用也是显示 listener.onConfirm 里的 toast
@ -216,10 +208,7 @@ public class DialogUtils {
// MtaHelper.onEvent("移动网络下载", NetworkUtils.getMobileNetworkType(finalContext), "总是允许");
});
dialog.setOnCancelListener(downloadDialog -> {
NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "关闭弹窗");
SensorsBridge.trackDownloadMobileDataDialogClick("关闭弹窗", gameId, gameName, gameCategoryChinese);
});
dialog.setOnCancelListener(downloadDialog -> NewFlatLogUtils.logDownloadMobileDataDialogClick(gameId, gameName, "关闭弹窗"));
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
@ -741,12 +730,6 @@ public class DialogUtils {
// 海外下载地址弹窗
public static void showOverseaDownloadDialog(Context context, GameEntity gameEntity, @NonNull ConfirmListener listener) {
SensorsBridge.trackOverseasAddressDialogShow(
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
gameEntity.getCategoryChinese()
);
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
@ -756,19 +739,8 @@ public class DialogUtils {
View contentView = binding.getRoot();
binding.gameIcon.displayGameIcon(gameEntity);
AtomicBoolean dismissByTouchInside = new AtomicBoolean(false);
binding.closeIv.setOnClickListener(v -> {
dismissByTouchInside.set(true);
SensorsBridge.trackOverseasAddressDialogClick(
"取消",
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
gameEntity.getCategoryChinese()
);
dialog.dismiss();
});
binding.gameNameTv.setText(context.getString(R.string.dialog_oversea_hint, gameEntity.getName()));
binding.closeIv.setOnClickListener(v -> dialog.dismiss());
if ("show&download".equals(gameEntity.getOverseasAddressDialog().getStatus())) {
gameEntity.getApk().get(0).setUrl(gameEntity.getOverseasAddressDialog().getLink());
@ -776,13 +748,6 @@ public class DialogUtils {
binding.urlTv.setText(gameEntity.getOverseasAddressDialog().getLink());
binding.downloadBtn.setText("下载(" + gameEntity.getApk().get(0).getSize() + "");
binding.downloadBtn.setOnClickListener(v -> {
dismissByTouchInside.set(true);
SensorsBridge.trackOverseasAddressDialogClick(
"下载",
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
gameEntity.getCategoryChinese()
);
listener.onConfirm();
dialog.dismiss();
});
@ -792,17 +757,6 @@ public class DialogUtils {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
dialog.setOnDismissListener(dialog1 -> {
if (!dismissByTouchInside.get()) {
SensorsBridge.trackOverseasAddressDialogClick(
"关闭弹窗",
gameEntity.getId(),
gameEntity.getName() != null ? gameEntity.getName() : "",
gameEntity.getCategoryChinese()
);
}
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(contentView);
dialog.show();
@ -1255,7 +1209,7 @@ public class DialogUtils {
@Override
public Unit invoke() {
SimpleGameEntity entity = new SimpleGameEntity(gameId, gameName, "");
HelpAndFeedbackBridge.startSuggestionActivity(finalContext, SuggestType.GAME, "notfound", "模拟器安装包解析错误", entity);
HelpAndFeedbackBridge.startSuggestionActivity(finalContext, SuggestType.gameQuestion, "notfound", "模拟器安装包解析错误", entity, "-");
dialog.dismiss();
return null;
}

View File

@ -15,7 +15,6 @@ import com.gh.common.constant.Config
import com.gh.common.exposure.ExposureManager.log
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
import com.gh.common.util.EntranceUtils.jumpActivity
import com.gh.common.util.EntranceUtils.jumpActivityCompat
import com.gh.gamecenter.*
import com.gh.gamecenter.amway.AmwayActivity
import com.gh.gamecenter.catalog.CatalogActivity
@ -25,6 +24,7 @@ import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout
import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout
import com.gh.gamecenter.common.constant.CommonConsts
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.constant.EntranceConsts.*
@ -37,9 +37,7 @@ import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.discovery.DiscoveryActivity
import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.entity.VideoLinkEntity
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.entity.GameDetailServer
import com.gh.gamecenter.feature.entity.GameEntity
@ -227,7 +225,6 @@ object DirectUtils {
linkEntity.link!!.contains("v.douyin") && PackageHelper.localPackageNameSet.contains("com.ss.android.ugc.aweme") -> {
directDouyin(context, "1402577827140941")
}
else -> directToWebView(
context,
url = linkEntity.link!!,
@ -281,16 +278,7 @@ object DirectUtils {
)
}
"column_collection", "专题合集" -> directToColumnCollection(
context,
linkEntity.link!!,
-1,
entrance,
"",
linkEntity.blockId,
linkEntity.blockName,
exposureEvent
)
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance, "", exposureEvent)
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path, exposureEvent)
@ -310,7 +298,7 @@ object DirectUtils {
"libao", "礼包" -> directToGiftDetail(context, linkEntity.link ?: "", entrance)
"feedback" -> directToFeedback(context, linkEntity.name, false, "", false, false, entrance)
"feedback" -> directToFeedback(context, linkEntity.name, linkEntity.text, false, "", entrance)
"qa", "qa_content", "Q&A" -> directToQa(context, linkEntity.text ?: "", linkEntity.link ?: "")
@ -320,12 +308,7 @@ object DirectUtils {
?: ""
)
"anliwall", "安利墙" -> directToAmway(
context,
fixedTopAmwayCommentId = null,
entrance = entrance,
path = path
)
"anliwall", "安利墙" -> directToAmway(context, fixedTopAmwayCommentId = null, entrance = entrance, path = path)
"game_detail_comment" -> directToGameDetail(context, linkEntity.link ?: "", entrance)
@ -447,7 +430,6 @@ object DirectUtils {
"" -> {
// do nothing
}
else -> {
if (unknownCallback != null) {
unknownCallback.invoke()
@ -496,8 +478,6 @@ object DirectUtils {
position: Int = -1,
entrance: String,
columnName: String = "",
blockId: String = "",
blockName: String = "",
exposureEvent: ExposureEvent? = null
) {
if (id.isEmpty()) return
@ -506,11 +486,9 @@ object DirectUtils {
bundle.putString(KEY_ENTRANCE, entrance)
bundle.putString(KEY_COLLECTION_ID, id)
bundle.putString(KEY_COLUMNNAME, columnName)
bundle.putString(KEY_BLOCK_ID, blockId)
bundle.putString(KEY_BLOCK_NAME, blockName)
bundle.putInt(KEY_POSITION, position)
if (exposureEvent != null) {
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source))
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST ,ArrayList(exposureEvent.source))
}
jumpActivity(context, bundle)
}
@ -743,8 +721,7 @@ object DirectUtils {
) {
if (id.isEmpty()) return
val bundle = Bundle()
val subjectData =
SubjectData(subjectId = id, subjectName = subjectName, isOrder = false, isQQMiniGame = isQQMiniGame)
val subjectData = SubjectData(subjectId = id, subjectName = subjectName, isOrder = false, isQQMiniGame = isQQMiniGame)
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, SubjectActivity::class.java.name)
bundle.putParcelable(EntranceConsts.KEY_SUBJECT_DATA, subjectData)
@ -758,68 +735,72 @@ object DirectUtils {
// 反馈
@JvmStatic
fun directToFeedback(context: Context, content: String? = null, entrance: String? = null) {
directToFeedback(context, content, false, "", false, false, entrance)
directToFeedback(context, content, null, false, "", entrance)
}
@JvmStatic
fun directToFeedback(
context: Context,
content: String? = null,
hintType: String? = null,
isQaFeedback: Boolean = false,
qaContentId: String? = "",
isPlugin: Boolean = false,
isSmoothGame: Boolean = false,
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putBoolean(KEY_PLUGIN, isPlugin)
bundle.putBoolean(KEY_SMOOTH_GAME, isSmoothGame)
if (isPlugin) {
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【插件问题】")
}
if (isSmoothGame) {
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【畅玩问题】")
}
val destination = RouteConsts.activity.suggestionActivity.toDestinationClass()
bundle.putString(KEY_TO, destination?.name ?: "")
if (isQaFeedback) {
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
} else {
bundle.putString(KEY_CONTENT, content)
if (TextUtils.isEmpty(hintType)) {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.gameQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN)
} else {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
bundle.putString(KEY_SUGGEST_HINT_TYPE, hintType)
}
}
context.startActivity(HelpAndFeedbackBridge.getSuggestionCategoryIntent(context, bundle))
jumpActivity(context, bundle)
}
/**
* 跳转至使用帮助与反馈,请不要随意修改方法名
* 畅玩助手反馈跳转
*/
@JvmStatic
fun directToHelpAndFeedback(
fun directToVGameFeedback(
context: Context,
content: String? = null,
hintType: String? = null,
isQaFeedback: Boolean = false,
qaContentId: String? = "",
isPlugin: Boolean = false,
isSmoothGame: Boolean = false,
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putBoolean(KEY_PLUGIN, isPlugin)
bundle.putBoolean(KEY_SMOOTH_GAME, isSmoothGame)
if (isPlugin) {
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【插件问题】")
}
if (isSmoothGame) {
bundle.putString(KEY_HIDE_SUGGEST_HINT, "【畅玩问题】")
}
val destination = RouteConsts.activity.suggestionActivity.toDestinationClass()
bundle.putString(KEY_TO, destination?.name ?: "")
if (isQaFeedback) {
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.cwzsQuestion)
} else {
bundle.putString(KEY_CONTENT, content)
if (TextUtils.isEmpty(hintType)) {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.gameQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN)
} else {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.cwzsQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, hintType)
}
}
directToHelpAndFeedback(context, bundle)
EntranceUtils.jumpActivityCompat(context, bundle)
}
@JvmStatic
@ -1449,7 +1430,7 @@ object DirectUtils {
fun directForumDetailSection(
context: Context,
bbsId: String? = "",
sectionId: String? = "",
sectionId: String = "",
entrance: String? = null
) {
val bundle = Bundle()
@ -1544,14 +1525,15 @@ object DirectUtils {
/**
* 跳转至使用帮助与反馈,请不要随意修改方法名
* @param position 使用帮助:[CommonConsts.TAB_MAIN],意见反馈:[CommonConsts.TAB_SUB]
*/
@JvmStatic
fun directToHelpAndFeedback(context: Context, bundle: Bundle? = null) {
fun directToHelpAndFeedback(context: Context, position: Int = CommonConsts.TAB_MAIN) {
val destination = RouteConsts.activity.helpAndFeedbackActivity.toDestinationClass()
val newBundle = Bundle()
newBundle.putString(KEY_TO, destination?.name ?: "")
bundle?.let { newBundle.putAll(it) }
jumpActivityCompat(context, newBundle)
val bundle = Bundle()
bundle.putString(KEY_TO, destination?.name ?: "")
bundle.putInt(BaseActivity_TabLayout.PAGE_INDEX, position)
jumpActivity(context, bundle)
}
/**
@ -1932,16 +1914,16 @@ object DirectUtils {
@JvmStatic
fun directToSuggestion(
context: Context,
type: SuggestType = SuggestType.APP,
type: SuggestType = SuggestType.normal,
hiddenHint: String = "",
suggestHintType: String? = null,
content: String? = null,
platform: String = "",
game: SimpleGameEntity? = null,
isQaFeedback: Boolean = false,
qaContentId: String = "",
fromRatingKey: Boolean = false,
diagnosis: String = "",
forceLogin: Boolean = true,
requestCode: Int? = null
) {
val intent = HelpAndFeedbackBridge.getIntent(
@ -1950,12 +1932,12 @@ object DirectUtils {
hiddenHint,
suggestHintType,
content,
platform,
game,
isQaFeedback,
qaContentId,
fromRatingKey,
diagnosis,
forceLogin
diagnosis
)
if (requestCode != null) {
(context as Activity).startActivityForResult(intent, requestCode)
@ -1998,19 +1980,12 @@ object DirectUtils {
}
@JvmStatic
fun directToSuggestion(
context: Context,
type: SuggestType,
hiddenHint: String,
forceLogin: Boolean = true,
requestCode: Int?
) {
fun directToSuggestion(context: Context, type: SuggestType, hiddenHint: String, requestCode: Int?) {
directToSuggestion(
context = context,
type = type,
hiddenHint = hiddenHint,
suggestHintType = null,
forceLogin = forceLogin,
requestCode = requestCode,
)
}
@ -2035,6 +2010,26 @@ object DirectUtils {
)
}
@JvmStatic
fun directToSuggestion(
context: Context,
type: SuggestType,
suggestHintType: String? = null,
content: String? = null,
game: SimpleGameEntity,
platform: String = ""
) {
directToSuggestion(
context = context,
type = type,
hiddenHint = "",
suggestHintType = suggestHintType,
content = content,
game = game,
platform = platform
)
}
@JvmStatic
fun directToQGameHome(context: Context) {
context.startActivity(QGameHomeWrapperActivity.getIntent(context))

View File

@ -2,10 +2,7 @@ package com.gh.common.util
import android.content.Context
import android.os.Build
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.toResString
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameEntity
@ -24,43 +21,7 @@ object DownloadDialogHelper {
) {
val dialog = retrieveAvailableDialog(gameEntity, apkEntity)
if (dialog != null) {
SensorsBridge.trackGameDownloadDialogShow(
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
DialogHelper.showDialogWithHtmlContent(
context,
dialog.title,
dialog.content,
"继续下载",
"取消",
confirmClickCallback = {
SensorsBridge.trackGameDownloadDialogClick(
buttonName = "继续下载",
gameId = gameEntity.id ,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
cancelClickCallback = {
SensorsBridge.trackGameDownloadDialogClick(
buttonName = "取消",
gameId = gameEntity.id ,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
callback.onCallback()
},
touchOutsideCallback = {
SensorsBridge.trackGameDownloadDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity.id ,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
}
)
showDownloadDialog(context, dialog, callback)
} else {
callback.onCallback()
}
@ -148,4 +109,14 @@ object DownloadDialogHelper {
return null
}
private fun showDownloadDialog(context: Context, dialog: GameEntity.Dialog, callback: EmptyCallback) {
DialogHelper.showDialogWithHtmlContent(
context,
dialog.title,
dialog.content,
"继续下载",
"取消",
{ callback.onCallback() })
}
}

View File

@ -1,5 +1,6 @@
package com.gh.common.util
import android.annotation.SuppressLint
import android.content.Context
import android.os.Message
import android.text.TextUtils
@ -7,6 +8,7 @@ import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.collection.ArrayMap
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.gh.common.chain.*
import com.gh.common.constant.Config
import com.gh.common.dialog.DeviceRemindDialog
@ -30,16 +32,20 @@ import com.gh.gamecenter.common.base.GlobalActivityManager
import com.gh.gamecenter.common.callback.CancelListener
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.entity.LinkEntity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.provider.IQGameProvider
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.PluginLocation
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.manager.PackagesManager
import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.teenagermode.TeenagerModeActivity
import com.gh.vspace.VHelper
import com.lightgame.download.DownloadConfig
@ -636,43 +642,15 @@ object DownloadItemUtils {
gamePermissionDialogFragment?.dismissAllowingStateLoss()
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
downloadBtn.setOnClickListener {
SensorsBridge.trackAdolescentModeDialogShow(
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
DialogHelper.showDialog(
context,
"提示",
"当前处于儿童/青少年模式, \n暂不提供游戏下载",
"退出青少年模式",
"关闭",
confirmClickCallback = {
context.startActivity(TeenagerModeActivity.getIntent(context))
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "退出青少年模式",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
cancelClickCallback = {
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "关闭",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
touchOutsideCallback = {
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
extraConfig = DialogHelper.Config(
{ context.startActivity(TeenagerModeActivity.getIntent(context)) },
{},
DialogHelper.Config(
centerTitle = true,
centerContent = true
)
@ -699,7 +677,7 @@ object DownloadItemUtils {
}
},
{},
extraConfig = DialogHelper.Config(
DialogHelper.Config(
centerTitle = true,
centerContent = true
)
@ -822,13 +800,7 @@ object DownloadItemUtils {
if (downloadBtn is DownloadButton && downloadBtn.text == context.getString(R.string.launch)) {
clickRunnable.onCallback()
} else {
PermissionHelper.checkStoragePermissionBeforeAction(
context,
gameEntity.id,
gameEntity.name ?: "",
gameEntity.categoryChinese,
clickRunnable
)
PermissionHelper.checkStoragePermissionBeforeAction(context, clickRunnable)
}
}
} else {
@ -941,19 +913,6 @@ object DownloadItemUtils {
}
} else if (str == context.getString(R.string.install)) {
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apk.url)
com.gh.gamecenter.common.utils.NewFlatLogUtils.logGameInstall(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
trigger = "主动安装"
)
SensorsBridge.trackInstallGameClick(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
action = "主动安装"
)
if (gameEntity.simulator != null) {
val isInstalled =
PackageUtils.isInstalledFromAllPackage(context, gameEntity.simulator!!.apk!!.packageName)
@ -966,13 +925,8 @@ object DownloadItemUtils {
}
if (downloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled && !isInstalledNewSimulator) {
SimulatorDownloadManager.getInstance().showDownloadDialog(
context,
simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH,
gameEntity.id,
gameEntity.name!!,
gameEntity.categoryChinese,
null
context, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name!!, null
)
return
}
@ -987,7 +941,7 @@ object DownloadItemUtils {
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
NewSimulatorGameManager.showUpdateNewsSimulator(context, null)
return
}
val downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(gameEntity.getApk()[0].url)
@ -1023,8 +977,7 @@ object DownloadItemUtils {
context,
apk.size,
gameEntity.id,
gameEntity.name,
gameEntity.categoryChinese
gameEntity.name
) { isSubscribe: Boolean ->
update(context, gameEntity, entrance, location, isSubscribe, traceEvent)
}
@ -1162,16 +1115,7 @@ object DownloadItemUtils {
}
PackageUtils.isCanPluggable(apkEntity) -> {
DialogHelper.showPluginDialog(
context,
pluginDesc = gameEntity.pluginDesc,
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese,
platform = gameEntity.platform ?: ""
) {
PackageInstaller.uninstall(context, path)
}
DialogHelper.showPluginDialog(context, gameEntity.pluginDesc) { PackageInstaller.uninstall(context, path) }
}
else -> {

View File

@ -17,11 +17,6 @@ import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.common.eventbus.EBShowDialog
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.MtaHelper
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.common.utils.NewFlatLogUtils
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
@ -78,47 +73,19 @@ object DownloadObserver {
val currentActivity = AppManager.getInstance().currentActivity() ?: return
SensorsBridge.trackDownloadLinkRotDialogShow(
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
DialogHelper.showDialog(
currentActivity,
"下载失败",
"下载链接已失效,建议提交反馈",
"立即反馈",
"取消",
confirmClickCallback = {
{
HelpAndFeedbackBridge.startSuggestionActivity(
currentActivity,
SuggestType.GAME, "notfound",
"问题反馈:下载链接失效",
SuggestType.gameQuestion, "notfound",
StringUtils.buildString(downloadEntity.name, "问题反馈:下载链接失效"),
SimpleGameEntity(gameId, downloadEntity.name, "")
)
SensorsBridge.trackDownloadLinkRotDialogClick(
buttonName = "立即反馈",
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
},
cancelClickCallback = {
SensorsBridge.trackDownloadLinkRotDialogClick(
buttonName = "取消",
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
},
touchOutsideCallback = {
SensorsBridge.trackDownloadLinkRotDialogClick(
buttonName = "关闭弹窗",
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
gameType = downloadEntity.categoryChinese
)
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
@ -229,18 +196,6 @@ object DownloadObserver {
// 会有 ActivityNotFoundException 异常catch 掉不管了
tryWithDefaultCatch {
if (Constants.SILENT_UPDATE != downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE)) {
NewFlatLogUtils.logGameInstall(
gameId = downloadEntity.gameId ?: "",
gameName = downloadEntity.name ?: "",
trigger = "自动安装"
)
SensorsBridge.trackInstallGameClick(
gameName = downloadEntity.name,
gameId = downloadEntity.gameId,
action = "自动安装"
)
// TODO 在 Android 11 上没有授权安装未知应用的权限前第一次调用这个方法系统会杀掉我们的进程...
// 没能找到类似的解释,最接近的是这个 https://issuetracker.google.com/issues/154157387但也只是点授权杀进程而已
PackageInstaller.install(mApplication, downloadEntity);
@ -264,7 +219,7 @@ object DownloadObserver {
EBShowDialog(
BaseActivity.PLUGGABLE,
downloadEntity.path,
downloadEntity
downloadEntity.pluginDesc
)
)
@ -302,7 +257,7 @@ object DownloadObserver {
}
SimulatorDownloadManager.getInstance().showDownloadDialog(
currentActivity, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, downloadEntity.gameId, gameName, downloadEntity.categoryChinese, null
SimulatorDownloadManager.SimulatorLocation.LAUNCH, downloadEntity.gameId, gameName, null
)
SimulatorGameManager.recordDownloadSimulatorGame(downloadEntity.gameId, simulator.type)
SimulatorGameManager.postPlayedGame(downloadEntity.gameId, downloadEntity.packageName)
@ -322,17 +277,6 @@ object DownloadObserver {
) {
downloadEntity.meta[Constants.MARK_ALREADY_TRIGGERED_INSTALLATION] = "YES"
tryWithDefaultCatch {
NewFlatLogUtils.logGameInstall(
gameId = downloadEntity.gameId ?: "",
gameName = downloadEntity.name ?: "",
trigger = "自动安装"
)
SensorsBridge.trackInstallGameClick(
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
action = "自动安装"
)
PackageInstaller.install(mApplication, downloadEntity, false)
}
} else {
@ -342,15 +286,14 @@ object DownloadObserver {
EBShowDialog(
BaseActivity.PLUGGABLE,
downloadEntity.path,
downloadEntity
downloadEntity.pluginDesc
)
)
} else {
EventBus.getDefault().post(
EBShowDialog(
BaseActivity.SIGNATURE_CONFLICT,
downloadEntity.path,
downloadEntity
downloadEntity.path
)
)
}
@ -421,6 +364,35 @@ object DownloadObserver {
type = ExposureUtils.DownloadType.PLUGIN_DOWNLOAD
}
if (downloadEntity.isVGame()) {
SensorsBridge.trackEvent(
"HaloFunGameDownloadDone",
"game_name", downloadEntity.name,
"game_id", downloadEntity.gameId,
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位"
)
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
SensorsBridge.trackEvent(
"HaloFunDownloadDone",
"space_schema_type",
if (downloadEntity.packageName == VHelper.VSPACE_32BIT_PACKAGENAME) "32位" else "64位"
)
} else if (downloadEntity.gameId != Constants.GHZS_GAME_ID && downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD) {
SensorsBridge.trackEvent(
"DownloadProcessFinish",
"game_id", downloadEntity.gameId,
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
"game_type", downloadEntity.meta[Constants.GAME_CATEGORY_IN_CHINESE] ?: "",
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId
)
}
var downloadSpeed = 0L
val elapsedTimeString = downloadEntity.meta[DownloadConfig.KEY_DOWNLOAD_ELAPSED_TIME]
if (elapsedTimeString != null) {
@ -433,7 +405,7 @@ object DownloadObserver {
val isPlatformRecommend =
java.lang.Boolean.parseBoolean(downloadEntity.getMetaExtra(Constants.IS_PLATFORM_RECOMMEND))
val exposureEvent = ExposureUtils.logADownloadCompleteExposureEvent(
ExposureUtils.logADownloadCompleteExposureEvent(
GameEntity(
id = downloadEntity.gameId,
mName = downloadEntity.name.removeSuffix(Constants.GAME_NAME_DECORATOR),
@ -450,41 +422,6 @@ object DownloadObserver {
type
)
if (downloadEntity.isVGame()) {
SensorsBridge.trackEventWithExposureSource(
"HaloFunGameDownloadDone",
exposureEvent?.source,
"game_name", downloadEntity.name,
"game_id", downloadEntity.gameId,
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位"
)
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
SensorsBridge.trackEvent(
"HaloFunDownloadDone",
"space_schema_type",
if (downloadEntity.packageName == VHelper.VSPACE_32BIT_PACKAGENAME) "32位" else "64位"
)
}
if (downloadEntity.gameId != Constants.GHZS_GAME_ID
&& downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD
&& downloadEntity.gameId != Constants.HALO_FUN_GAME_ID) {
SensorsBridge.trackEventWithExposureSource(
"DownloadProcessFinish",
exposureEvent?.source,
"game_id", downloadEntity.gameId,
"game_name", downloadEntity.meta[Constants.GAME_NAME] ?: "",
"game_type", downloadEntity.meta[Constants.GAME_CATEGORY_IN_CHINESE] ?: "",
"game_schema_type", if (downloadEntity.getMetaExtra(VHelper.KEY_BIT) == "32") "32位" else "64位",
"page_name", getCurrentPageEntity().pageName,
"page_id", getCurrentPageEntity().pageId,
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId
)
}
DataCollectionUtils.uploadDownload(mApplication, downloadEntity, "完成")
}

View File

@ -15,19 +15,18 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.SplashScreenActivity;
import com.gh.gamecenter.common.avoidcallback.AvoidOnResultManager;
import com.gh.gamecenter.common.avoidcallback.Callback;
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.core.utils.ClassUtils;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.AppManager;
import com.lightgame.utils.Utils;
import org.json.JSONException;
@ -67,8 +66,8 @@ public class EntranceUtils {
public static void jumpActivity(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
if (AppManager.getInstance().findActivity(MainActivity.class) != null) {
// 应用正在运行,前台或后台且MainActivity在栈中
if (HaloApp.getInstance().isRunningForeground) {
// 应用正在运行,前台或后台
String to = bundle.getString(KEY_TO);
Class<?> clazz = ClassUtils.forName(to);
if (clazz == null) clazz = MainActivity.class;
@ -93,8 +92,8 @@ public class EntranceUtils {
public static void jumpActivity(Context context, Bundle nextToBundle, Bundle bundle, Callback callback) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
if (AppManager.getInstance().findActivity(MainActivity.class) != null) {
// 应用正在运行,前台或后台且MainActivity在栈中
if (HaloApp.getInstance().isRunningForeground) {
// 应用正在运行,前台或后台
String to = bundle.getString(KEY_TO);
Class<?> clazz = ClassUtils.forName(to);
if (clazz == null) clazz = MainActivity.class;

View File

@ -19,11 +19,13 @@ import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.R
import com.gh.gamecenter.WebActivity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.retrofit.ApiResponse
import com.gh.gamecenter.common.retrofit.EmptyResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.DataLogUtils
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.observableToMain
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.view.dsbridge.CompletionHandler
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnUiThread
@ -35,6 +37,7 @@ import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.entity.PluginLocation
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.utils.ApkActiveUtils
import com.gh.gamecenter.gamedetail.dialog.GamePermissionDialogFragment
@ -109,43 +112,15 @@ object GameActivityDownloadHelper {
// 青少年模式
private fun isTeenageMode(context: Context): Boolean {
if (SPUtils.getBoolean(Constants.SP_TEENAGER_MODE)) {
SensorsBridge.trackAdolescentModeDialogShow(
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
gameType = mGameEntity?.categoryChinese ?: ""
)
DialogHelper.showDialog(
context,
"提示",
"当前处于儿童/青少年模式, \n暂不提供游戏下载",
"退出青少年模式",
"关闭",
confirmClickCallback = {
context.startActivity(TeenagerModeActivity.getIntent(context))
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "退出青少年模式",
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
gameType = mGameEntity?.categoryChinese ?: ""
)
},
cancelClickCallback = {
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "关闭",
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
gameType = mGameEntity?.categoryChinese ?: ""
)
},
touchOutsideCallback = {
SensorsBridge.trackAdolescentModeDialogClick(
buttonName = "关闭弹窗",
gameId = mGameEntity?.id ?: "",
gameName = mGameEntity?.name ?: "",
gameType = mGameEntity?.categoryChinese ?: ""
)
},
extraConfig = DialogHelper.Config(
{ context.startActivity(TeenagerModeActivity.getIntent(context)) },
{},
DialogHelper.Config(
centerTitle = true,
centerContent = true
)
@ -260,7 +235,7 @@ object GameActivityDownloadHelper {
) {
GamePermissionDialogFragment.show((context as AppCompatActivity), gameEntity, gameEntity.info) {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
}
}
@ -284,8 +259,7 @@ object GameActivityDownloadHelper {
context,
apk.size,
gameEntity.id,
gameEntity.name,
gameEntity.categoryChinese
gameEntity.name
) { isSubscribe: Boolean ->
download(context, gameEntity, apk, isSubscribe, entrance, location, traceEvent)
}
@ -307,7 +281,7 @@ object GameActivityDownloadHelper {
DownloadDialog.showDownloadDialog(context, gameEntity, traceEvent, entrance, location)
} else {
CertificationDialog.showCertificationDialog(context, gameEntity) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
plugin(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
}
}
@ -321,18 +295,6 @@ object GameActivityDownloadHelper {
apk: ApkEntity,
downloadEntity: DownloadEntity?
) {
com.gh.gamecenter.common.utils.NewFlatLogUtils.logGameInstall(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
trigger = "主动安装"
)
SensorsBridge.trackInstallGameClick(
gameName = downloadEntity?.name ?: "",
gameId = downloadEntity?.gameId ?: "",
action = "主动安装"
)
val simulatorDownloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apk.url)
if (gameEntity.simulator != null) {
val isInstalled =
@ -348,7 +310,7 @@ object GameActivityDownloadHelper {
if (simulatorDownloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled && !isInstalledNewSimulator) {
SimulatorDownloadManager.getInstance().showDownloadDialog(
context, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name!!, gameEntity.categoryChinese, null
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name!!, null
)
return
}
@ -375,7 +337,7 @@ object GameActivityDownloadHelper {
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(gameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(context)) {
NewSimulatorGameManager.showUpdateNewsSimulator(context, gameEntity, null)
NewSimulatorGameManager.showUpdateNewsSimulator(context, null)
return
}
val simulatorDownloadEntity =
@ -412,7 +374,7 @@ object GameActivityDownloadHelper {
location: String,
traceEvent: ExposureEvent
) {
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name, gameEntity.categoryChinese) { isSubscribe: Boolean ->
DialogUtils.checkDownload(context, apk.size, gameEntity.id, gameEntity.name) { isSubscribe: Boolean ->
update(context, gameEntity, apk, entrance, location, isSubscribe, traceEvent)
}
}
@ -527,16 +489,7 @@ object GameActivityDownloadHelper {
gameEntity.getEntryMap().remove(apkEntity.getPlatform())
}
PackageUtils.isCanPluggable(apkEntity) -> {
DialogHelper.showPluginDialog(
context,
pluginDesc = gameEntity.pluginDesc,
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese,
platform = gameEntity.platform ?: ""
) {
PackageInstaller.uninstall(context, path)
}
DialogHelper.showPluginDialog(context, gameEntity.pluginDesc) { PackageInstaller.uninstall(context, path) }
}
else -> {
PackageInstaller.install(context, downloadEntity)

View File

@ -24,7 +24,7 @@ import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.PackageDialogEntity;
import com.gh.gamecenter.feature.entity.Questions;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.gamecenter.common.exposure.ExposureSource;
import com.gh.gamecenter.feature.exposure.ExposureSource;
import com.gh.gamecenter.login.user.UserManager;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.Utils;

View File

@ -1623,13 +1623,12 @@ object NewFlatLogUtils {
}
//新游开测详情页点击游戏类型
fun logGameTestDetailGameCategoryClick(tabName: String, gameCategory: String, gameTestStartType: String, isOn: Boolean) {
fun logGameTestDetailGameCategoryClick(tabName: String, gameCategory: String, gameTestStartType: String) {
val json = json {
"event" to "game_test_detail_game_category_click"
"tab_name" to tabName
KEY_GAME_CATEGORY to gameCategory
"game_test_start_type" to gameTestStartType
"is_on" to isOn
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
@ -2401,34 +2400,6 @@ object NewFlatLogUtils {
log(json)
}
// QA视频事件
@JvmStatic
fun logQAVideo(
event: String,
contentId: String,
contentTitle: String,
type: String,
sequence: Int,
videoId: String,
playAction: String,
playProcess: Float,
playTime: Int
) {
val json = json {
KEY_EVENT to event
"content_id" to contentId
"content_title" to contentTitle
"type" to type
"sequence" to sequence
"video_id" to videoId
"play_action" to playAction
"play_process" to playProcess
"play_time" to playTime
parseAndPutMeta().invoke(this)
}
log(json)
}
@JvmStatic
fun logQGameClick(qqGameId: String, qqGameName: String?) {
val json = json {

View File

@ -1646,7 +1646,7 @@ object NewLogUtils {
}
//进入创建游戏单
fun logEnterGameCollectionCreate(entrance: String) {
fun logEnterGameCollectionEdit(entrance: String) {
val json = json {
KEY_EVENT to "enter_game_collect_create_location"
KEY_ENTRANCE to entrance

View File

@ -16,7 +16,6 @@ import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.categoryChinese
import com.gh.gamecenter.common.utils.getExtension
import com.gh.gamecenter.common.utils.getMetaExtra
import com.gh.gamecenter.core.utils.CurrentActivityHolder
@ -121,24 +120,12 @@ object PackageInstaller {
}
} else {
if (isPluggin) {
DialogHelper.showPluginDialog(
context,
pluginDesc = downloadEntity?.pluginDesc,
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
gameType = downloadEntity?.categoryChinese ?: "",
platform = downloadEntity?.platform ?: ""
) {
DialogHelper.showPluginDialog(context, downloadEntity?.pluginDesc) {
uninstall(context, pkgPath)
}
} else {
// 非插件化的同包名不同签名冲突
DialogHelper.showSignatureConflictDialog(
context,
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
gameType = downloadEntity?.categoryChinese ?: ""
) {
DialogHelper.showSignatureConflictDialog(context) {
uninstall(context, pkgPath)
}
}
@ -330,13 +317,11 @@ object PackageInstaller {
showCloseIcon = true,
showAlternativeCancelStyle = !isTheFirstTimeToShowVpnHintDialog
),
uiModificationCallback = { binding ->
uiModificationCallback = { binding, dialog ->
binding.cancelTv.visibility = View.GONE
binding.closeContainer.setOnClickListener {
binding.markDismissByTouchInside()
install(currentActivity, pkgPath)
binding.dismiss()
dialog.dismiss()
downloadEntity?.let {
NewFlatLogUtils.logVpnHintDialogClick(it.gameId, it.name, "关闭按钮")

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.common.view
package com.gh.common.view
import android.content.Context
import android.util.AttributeSet
@ -7,19 +7,24 @@ import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import com.facebook.drawee.view.SimpleDraweeView
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.common.utils.rxTimer
import com.gh.gamecenter.common.R
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.R
import com.gh.gamecenter.feature.entity.SettingsEntity
import io.reactivex.disposables.Disposable
import kotlin.math.abs
/**
* 横向可滑动控件
*/
class HorizontalScrollableView : LinearLayout {
private var mDataList = ArrayList<Any>()
/**
* 视频流广告轮播控件
*/
class AdBannerView : LinearLayout {
private lateinit var mViewPager2: ViewPager2
private var mDatas = ArrayList<SettingsEntity.Advertisement>()
var isAutoPlay = true
private var currentPage = 0
private var autoDurationTime = 6000L
private var mRxTimer: Disposable? = null
@ -28,12 +33,9 @@ class HorizontalScrollableView : LinearLayout {
private var startX: Float = 0F
private var startY: Float = 0F
private val mTouchSlop = ViewConfiguration.get(context).scaledTouchSlop
private val bannerWidth = DisplayUtils.dip2px(52f)
var onItemClick: ((position: Int) -> Unit)? = null
private lateinit var mIndicatorLayout: LinearLayout
private lateinit var mViewPager2: ViewPager2
private var mWidth = ViewGroup.LayoutParams.WRAP_CONTENT
private var mHeight = ViewGroup.LayoutParams.WRAP_CONTENT
private var mAutoScrollEnabled = true
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
@ -43,30 +45,16 @@ class HorizontalScrollableView : LinearLayout {
initViews()
}
fun disableAutoScroll() {
mAutoScrollEnabled = false
}
fun setFixedWidthAndHeightForViewPager2(widthInDp: Int, heightInDp: Int) {
mWidth = widthInDp
mHeight = heightInDp
mViewPager2.layoutParams.apply {
width = mWidth
height = mHeight
}
}
private fun initViews() {
orientation = VERTICAL
mViewPager2 = ViewPager2(context).apply {
layoutParams = ViewGroup.LayoutParams(bannerWidth, bannerWidth)
orientation = ViewPager2.ORIENTATION_HORIZONTAL
registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
super.onPageSelected(position)
currentPage = position
if (mDataList.isNotEmpty()) {
slideIndicator(currentPage % mDataList.size)
}
slideIndicator(currentPage % mDatas.size)
}
})
}
@ -76,39 +64,35 @@ class HorizontalScrollableView : LinearLayout {
mIndicatorLayout = LinearLayout(context).apply {
orientation = HORIZONTAL
gravity = Gravity.CENTER
val params = LayoutParams(LayoutParams.MATCH_PARENT, 12F.dip2px())
params.topMargin = 4F.dip2px()
params.leftMargin = 6F.dip2px()
params.rightMargin = 6F.dip2px()
val params = LayoutParams(LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(5F))
params.topMargin = DisplayUtils.dip2px(8f)
layoutParams = params
background = context.resources.getDrawable(R.drawable.background_shape_10p_black_radius_6)
}
addView(mIndicatorLayout)
}
fun start(
datas: ArrayList<*>,
startFromCenter: Boolean,
newAdapter: RecyclerView.Adapter<*>
) {
if (datas.isEmpty()) throw IllegalArgumentException("列表不能为空")
fun start(datas: ArrayList<SettingsEntity.Advertisement>) {
if (datas.isNullOrEmpty()) throw IllegalArgumentException("广告列表不能为空")
val adapter = mViewPager2.adapter
mDataList = datas as ArrayList<Any>
mDatas = datas
if (adapter == null) {
mViewPager2.adapter = newAdapter
val bannerAdapter = AdBannerAdapter()
mViewPager2.adapter = bannerAdapter
} else {
adapter.notifyDataSetChanged()
}
currentPage = if (startFromCenter) getActualFirstPositionInCenter() else 0
currentPage = (mViewPager2.adapter as AdBannerAdapter).getActualFirstPositionInCenter()
mViewPager2.setCurrentItem(currentPage, false)
if (mDataList.size >= 1) {
resetIndicator()
if (mDatas.size > 1) {
addIndicator()
slideIndicator(currentPage % mDatas.size)
autoPlay()
}
}
private fun autoPlay() {
if (mAutoScrollEnabled && mDataList.size > 1) {
if (isAutoPlay && mDatas.size > 1) {
if (mRxTimer != null && !mRxTimer!!.isDisposed) {
mRxTimer?.dispose()
mRxTimer = null
@ -119,6 +103,7 @@ class HorizontalScrollableView : LinearLayout {
}
}
private fun slidePage() {
currentPage++
mViewPager2.setCurrentItem(currentPage, true)
@ -135,15 +120,9 @@ class HorizontalScrollableView : LinearLayout {
}
}
fun resetIndicator() {
private fun addIndicator() {
mIndicatorLayout.removeAllViews()
if (mDataList.size <= 1) {
mIndicatorLayout.visibility = View.GONE
return
}
mDataList.forEach { _ ->
mDatas.forEach { _ ->
val view = View(context).apply {
background = ContextCompat.getDrawable(context, R.drawable.selector_video_detail_ad_indicator)
val params = LayoutParams(DisplayUtils.dip2px(4F), DisplayUtils.dip2px(4F))
@ -153,10 +132,6 @@ class HorizontalScrollableView : LinearLayout {
}
mIndicatorLayout.addView(view)
}
if (mDataList.isNotEmpty()) {
slideIndicator(currentPage % mDataList.size)
}
}
private fun slideIndicator(position: Int) {
@ -166,15 +141,6 @@ class HorizontalScrollableView : LinearLayout {
}
}
private fun getActualFirstPositionInCenter(): Int {
if (mDataList.size == 1) return 0
var index = Int.MAX_VALUE / 2
if (index % mDataList.size != 0) {
index -= (index % mDataList.size)
}
return index - 1
}
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
val action = ev.action
if (action == MotionEvent.ACTION_DOWN) {
@ -187,7 +153,8 @@ class HorizontalScrollableView : LinearLayout {
lastY = ev.rawY
val distanceX = abs(lastX - startX)
val distanceY = abs(lastY - startY)
val disallowIntercept: Boolean = if (mViewPager2.orientation == ViewPager2.ORIENTATION_HORIZONTAL) {
val disallowIntercept: Boolean
disallowIntercept = if (mViewPager2.orientation == ViewPager2.ORIENTATION_HORIZONTAL) {
distanceX > mTouchSlop && distanceX > distanceY
} else {
distanceY > mTouchSlop && distanceY > distanceX
@ -207,8 +174,36 @@ class HorizontalScrollableView : LinearLayout {
}
}
fun getAdDatas(): ArrayList<Any> {
return mDataList
fun getAdDatas(): ArrayList<SettingsEntity.Advertisement> {
return mDatas
}
private inner class AdBannerAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return object :
RecyclerView.ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_ad_banner, parent, false)) {}
}
override fun getItemCount(): Int = if (mDatas.size == 1) mDatas.size else Int.MAX_VALUE
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val ad = mDatas[position % mDatas.size]
val view = holder.itemView as SimpleDraweeView
ImageUtils.display(view, ad.image)
holder.itemView.setOnClickListener {
onItemClick?.invoke(position % mDatas.size)
}
}
fun getActualFirstPositionInCenter(): Int {
if (mDatas.size == 1) return 0
var index = itemCount / 2
if (index % mDatas.size != 0) {
index -= (index % mDatas.size)
}
return index - 1
}
}
}

View File

@ -83,8 +83,8 @@ class FlexLinearLayout @JvmOverloads constructor(context: Context, attrs: Attrib
private fun addTags() {
removeAllViews()
mTags.forEachIndexed { index, tag ->
addView(createView(tag, index))
mTags.forEach {
addView(createView(it))
}
if (mTotalCount != mTags.size) {
val imageView = ImageView(context).apply {
@ -102,7 +102,7 @@ class FlexLinearLayout @JvmOverloads constructor(context: Context, attrs: Attrib
}
}
private fun createView(tag: TagStyleEntity, position: Int): View {
private fun createView(tag: TagStyleEntity): View {
return TextView(context).apply {
text = tag.name
includeFontPadding = false
@ -117,7 +117,7 @@ class FlexLinearLayout @JvmOverloads constructor(context: Context, attrs: Attrib
setTextColor(if (tag.isTop) "#${tag.color}".hexStringToIntColor() else R.color.text_title.toColor(context))
background = if (tag.isTop) createTopBackgroundDrawable(tag) else createNormalBackgroundDrawable()
setOnClickListener {
onClickListener?.onItemClickListener(tag, position)
onClickListener?.onItemClickListener(tag)
}
}
}
@ -140,6 +140,6 @@ class FlexLinearLayout @JvmOverloads constructor(context: Context, attrs: Attrib
interface OnItemClickListener {
fun onMoreClickListener()
fun onItemClickListener(tag: TagStyleEntity, position: Int)
fun onItemClickListener(tag: TagStyleEntity)
}
}

View File

@ -11,12 +11,9 @@ import android.util.AttributeSet;
import android.view.Gravity;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.Nullable;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.common.constant.Config;
@ -43,10 +40,8 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
* Copyright (C) 2017 Wasabeef
@ -65,12 +60,6 @@ import java.util.Map;
*/
public class RichEditor extends WebView {
/**
* 默认的编辑器换行符
*/
public final static String DEFAULT_PARAGRAPH_SEPARATOR = "p";
private boolean mContentOwner;
private boolean mInputEnabled;
@ -79,8 +68,6 @@ public class RichEditor extends WebView {
private EmptyCallback mInitialLayoutCallback;
private Map<String, DynamicJsInterface> mDynamicJsInterfaces = new HashMap<>();
private String mCurrentContent = "";
public enum Type {
@ -100,7 +87,7 @@ public class RichEditor extends WebView {
UNORDEREDLIST,
JUSTIFYCENTER,
JUSTIFYFULL,
JUSTIFYLEFT,
JUSTUFYLEFT,
JUSTIFYRIGHT
}
@ -129,7 +116,6 @@ public class RichEditor extends WebView {
private OnDecorationStateListener mDecorationStateListener;
private AfterInitialLoadListener mLoadListener;
private WebChromeClientListener mChromeClientListener;
private WebResourceRequestInterceptor mWebResourceRequestInterceptor;
private PageFinishedListener mPageFinishedListener;
public RichEditor(Context context) {
@ -187,10 +173,6 @@ public class RichEditor extends WebView {
mChromeClientListener = chromeClientListener;
}
public void setWebResourceRequestInterceptor(WebResourceRequestInterceptor interceptor) {
mWebResourceRequestInterceptor = interceptor;
}
public void setPageFinishedListener(PageFinishedListener pageFinishedListener) {
mPageFinishedListener = pageFinishedListener;
}
@ -414,14 +396,6 @@ public class RichEditor extends WebView {
exec("javascript:RE.insertImage('" + url + "');");
}
/**
* 插入分割线
*/
public void insertDivider() {
exec("javascript:RE.prepareInsert();");
exec("javascript:RE.insertHorizontalRule();");
}
public void insertHtml(String html) {
exec("javascript:RE.prepareInsert();");
exec("javascript:RE.insertHTML('" + html + "');");
@ -473,14 +447,6 @@ public class RichEditor extends WebView {
exec("javascript:RE.setBaseTextColor('" + hex + "');");
}
/**
* 设置编辑器默认换行符
* @param separator 换行符
*/
public void setDefaultParagraphSeparator(String separator) {
exec("javascript:RE.setDefaultParagraphSeparator('" + separator + "')");
}
public void insertPlaceholderImage(String id) {
exec("javascript:RE.prepareInsert();");
exec("javascript:RE.insertPlaceholderImage('" + id + "');");
@ -609,14 +575,6 @@ public class RichEditor extends WebView {
exec("javascript:RE.formatBlock();");
}
public void registerDynamicJsInterface(String method, DynamicJsInterface jsInterface) {
mDynamicJsInterfaces.put(method, jsInterface);
}
public void unregisterDynamicJsInterface(String method) {
mDynamicJsInterfaces.remove(method);
}
/**
* 调用 JS 方法,告诉网页端该 url 对应视频播放的进度
*/
@ -667,9 +625,6 @@ public class RichEditor extends WebView {
@Override
public void onPageFinished(WebView view, String url) {
isReady = url.equalsIgnoreCase(SETUP_HTML);
if (isReady) {
setDefaultParagraphSeparator(DEFAULT_PARAGRAPH_SEPARATOR);
}
if (mLoadListener != null) {
mLoadListener.onAfterInitialLoad(isReady);
}
@ -703,16 +658,6 @@ public class RichEditor extends WebView {
return super.shouldOverrideUrlLoading(view, url);
}
@Nullable
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
if (mWebResourceRequestInterceptor != null) {
return mWebResourceRequestInterceptor.shouldInterceptRequest(view, url);
}
return super.shouldInterceptRequest(view, url);
}
}
public void setContentOwner(boolean contentOwner) {
@ -729,10 +674,6 @@ public class RichEditor extends WebView {
boolean shouldOverrideUrlLoading(WebView view, String url);
}
public interface WebResourceRequestInterceptor {
WebResourceResponse shouldInterceptRequest(WebView view, String url);
}
public interface PageFinishedListener {
void onPageFinished();
}
@ -874,14 +815,6 @@ public class RichEditor extends WebView {
public void logMtaEvent(String event) {
// do nothing, mta is deprecated
}
@JavascriptInterface
public void invokeMethod(String method, String data) {
DynamicJsInterface jsInterface = mDynamicJsInterfaces.get(method);
if (jsInterface != null) {
jsInterface.invoke(data);
}
}
}
@Override
@ -894,8 +827,4 @@ public class RichEditor extends WebView {
mInitialLayoutCallback = null;
}
}
public interface DynamicJsInterface {
void invoke(String data);
}
}

View File

@ -14,7 +14,9 @@ import com.gh.gamecenter.common.activityresult.ActResultRequest
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.PermissionHelper
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.help.HelpAndFeedbackBridge
import com.lightgame.download.DownloadEntity
@ -29,18 +31,11 @@ object XapkDialogHelper {
val trigger = if (isManualAction) "手动触发" else "自动触发"
NewFlatLogUtils.logXApkUnzipFailedDialogShowed(trigger, downloadEntity.gameId, downloadEntity.name)
SensorsBridge.trackGameDecompressionFailedDialogShow(
downloadEntity.gameId,
downloadEntity.name,
downloadEntity.categoryChinese
)
val previousShowedDialog = mUnzipFailureDialogRef?.get()
if (previousShowedDialog != null
&& previousShowedDialog.isShowing
&& context == previousShowedDialog.ownerActivity
) {
&& context == previousShowedDialog.ownerActivity) {
// 上一个解压失败弹窗还在显示,当前 activity 不用再显示新的弹窗了
return
}
@ -62,13 +57,6 @@ object XapkDialogHelper {
downloadEntity.name
)
SensorsBridge.trackGameDecompressionFailedDialogClick(
buttonName = "开启权限",
downloadEntity.gameId,
downloadEntity.name,
downloadEntity.categoryChinese
)
// 记录应用重启前需要重解压的信息
SPUtils.setString(Constants.SP_XAPK_UNZIP_ACTIVITY, context.javaClass.name)
SPUtils.setString(Constants.SP_XAPK_URL, downloadEntity.url)
@ -100,10 +88,10 @@ object XapkDialogHelper {
}
},
cancelClickCallback = {
val hint = "游戏安装包解压失败,问题反馈:"
val hint = "" + downloadEntity.name + "游戏安装包解压失败,问题反馈:"
HelpAndFeedbackBridge.startSuggestionActivity(
context,
SuggestType.GAME,
SuggestType.normal,
null,
hint,
SimpleGameEntity(downloadEntity.gameId, downloadEntity.name, downloadEntity.icon)
@ -114,47 +102,23 @@ object XapkDialogHelper {
downloadEntity.gameId,
downloadEntity.name
)
SensorsBridge.trackGameDecompressionFailedDialogClick(
buttonName = "提交反馈",
downloadEntity.gameId,
downloadEntity.name,
downloadEntity.categoryChinese
)
},
uiModificationCallback = { binding ->
uiModificationCallback = { binding, dialog ->
binding.headIv.setBackgroundResource(R.drawable.dialog_unzip_failure_head_background)
binding.titleTv.visibility = View.GONE
// VectorDrawable 的动态颜色设置只在支持 Vector 的系统版本上生效,为了能方便复用资源不支持的就用默认颜色,又不是不能用!
binding.closeIv.setColorFilter(Color.WHITE)
binding.contentTv.setLineSpacing(5.0F.dip2px().toFloat(), 1.0F)
binding.closeContainer.setOnClickListener {
binding.markDismissByTouchInside()
NewFlatLogUtils.logXApkUnzipFailedDialogClick(
"关闭",
false,
downloadEntity.gameId,
downloadEntity.name
)
SensorsBridge.trackGameDecompressionFailedDialogClick(
buttonName = "关闭",
downloadEntity.gameId,
downloadEntity.name,
downloadEntity.categoryChinese
)
binding.dismiss()
dialog.dismiss()
}
},
touchOutsideCallback = {
SensorsBridge.trackGameDecompressionFailedDialogClick(
buttonName = "关闭弹窗",
downloadEntity.gameId,
downloadEntity.name,
downloadEntity.categoryChinese
)
},
extraConfig = DialogHelper.Config(showCloseIcon = true)
)

View File

@ -79,7 +79,6 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
if (MiuiUtils.isMiui() && !MiuiUtils.isMiuiOptimizationDisabled() && downloadEntity.format == Constants.XAPK_APKS_FORMAT) {// 小米手机开启miui以后需要引导用户关闭miui优化
DialogHelper.showMiuiOptimizationWarning(
context,
downloadEntity,
onHintClick = {
val guides = Config.getNewApiSettingsEntity()?.install
val miuiOptimizationGuide = guides?.guides?.findLast {
@ -100,7 +99,6 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
)
it.markDismissByTouchInside()
it.dismiss()
} else {
ToastUtils.showToast(context.getString(R.string.miui_open_adb_hint))
@ -186,12 +184,6 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
}
DownloadDataHelper.uploadDownloadStatusEvent(downloadEntity, "xapk解压失败")
SensorsBridge.trackGameDecompressionFailed(
downloadEntity.gameId,
downloadEntity.name,
downloadEntity.categoryChinese
)
}
debugOnly {

View File

@ -346,6 +346,24 @@ public class DownloadManager implements DownloadStatusListener {
ExtensionsKt.addMetaExtra(downloadEntity, DownloadConfig.KEY_PROGRESS_CALLBACK_INTERVAL, "200");
ExtensionsKt.addMetaExtra(downloadEntity, VHelper.KEY_REQUIRED_G_APPS, gameEntity.getGAppsSwitch());
ExtensionsKt.addMetaExtra(downloadEntity, VHelper.KEY_BIT, apkEntity.getBit());
SensorsBridge.trackEvent("HaloFunGameDownloadClick",
"game_name", gameEntity.getName(),
"game_id", gameEntity.getId(),
"game_schema_type", gameEntity.getGameBitChinese());
} else {
SensorsBridge.trackEvent("DownloadProcessBegin",
"game_id", gameEntity.getId(),
"game_name", gameEntity.getName(),
"game_type", gameEntity.getCategoryChinese(),
"game_schema_type", gameEntity.getGameBitChinese(),
"page_name", GlobalActivityManager.getCurrentPageEntity().getPageName(),
"page_id", GlobalActivityManager.getCurrentPageEntity().getPageId(),
"page_business_id", GlobalActivityManager.getCurrentPageEntity().getPageBusinessId(),
"last_page_name", GlobalActivityManager.getLastPageEntity().getPageName(),
"last_page_id", GlobalActivityManager.getLastPageEntity().getPageId(),
"last_page_business_id", GlobalActivityManager.getLastPageEntity().getPageBusinessId()
);
}
HashMap<String, String> map = PageSwitchDataHelper.popLastPageData();
@ -389,28 +407,6 @@ public class DownloadManager implements DownloadStatusListener {
AppDebugConfig.logMethodWithParams(DownloadManager.class, apkEntity.getUrl(), downloadEntity.getUrl(), method, entrance, location);
}
if (gameEntity.isVGame()) {
SensorsBridge.trackEventWithExposureSource("HaloFunGameDownloadClick",
downloadExposureEvent.getSource(),
"game_name", gameEntity.getName(),
"game_id", gameEntity.getId(),
"game_schema_type", gameEntity.getGameBitChinese());
}
SensorsBridge.trackEventWithExposureSource("DownloadProcessBegin",
downloadExposureEvent.getSource(),
"game_id", gameEntity.getId(),
"game_name", gameEntity.getName(),
"game_type", gameEntity.getCategoryChinese(),
"game_schema_type", gameEntity.getGameBitChinese(),
"page_name", GlobalActivityManager.getCurrentPageEntity().getPageName(),
"page_id", GlobalActivityManager.getCurrentPageEntity().getPageId(),
"page_business_id", GlobalActivityManager.getCurrentPageEntity().getPageBusinessId(),
"last_page_name", GlobalActivityManager.getLastPageEntity().getPageName(),
"last_page_id", GlobalActivityManager.getLastPageEntity().getPageId(),
"last_page_business_id", GlobalActivityManager.getLastPageEntity().getPageBusinessId()
);
//TODO remove
DownloadManager.getInstance().putStatus(downloadEntity.getUrl(), DownloadStatus.downloading);
@ -924,7 +920,7 @@ public class DownloadManager implements DownloadStatusListener {
for (DownloadEntity downloadEntity : getAllDownloadEntity()) {
if (!urlSet.contains(downloadEntity.getUrl())
&& (downloadEntity.getStatus().equals(DownloadStatus.downloading)
|| downloadEntity.getStatus().equals(DownloadStatus.waiting))) {
|| downloadEntity.getStatus().equals(DownloadStatus.waiting))) {
downloadEntity.setStatus(DownloadStatus.subscribe);
mDownloadDao.newOrUpdate(downloadEntity);
NDataChanger.INSTANCE.notifyDataChanged(downloadEntity);

View File

@ -12,8 +12,6 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.retrofit.EmptyResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.NewFlatLogUtils
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.isVGame
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.SPUtils
@ -149,22 +147,11 @@ object PackageObserver {
if (EBPackage.TYPE_UNINSTALLED == busFour.type) {
mPackageViewModel.addUninstalledGame(packageName)
mDownloadEntity?.let {
if (it.isVGame()) return@let
if (it.isPluggable
|| (it.isUpdate && !PackageUtils.isInstalled(application, it.packageName))) {
NewFlatLogUtils.logGameInstall(
gameId = mDownloadEntity.gameId,
gameName = mDownloadEntity.name,
trigger = "自动安装"
)
SensorsBridge.trackInstallGameClick(
gameId = mDownloadEntity.gameId,
gameName = mDownloadEntity.name,
action = "自动安装"
)
PackageInstaller.install(application, mDownloadEntity)
}
}

View File

@ -2,7 +2,6 @@ package com.gh.download.dialog
import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -15,6 +14,7 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.*
import androidx.recyclerview.widget.RecyclerView.SmoothScroller
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.common.util.*
import com.gh.download.DownloadManager
import com.gh.gamecenter.BuildConfig
@ -28,11 +28,9 @@ import com.gh.gamecenter.common.utils.throwExceptionInDebug
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.TimeElapsedHelper
import com.gh.gamecenter.databinding.DialogDownloadBinding
import com.gh.gamecenter.entity.GamePlatform
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.halo.assistant.HaloApp
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
@ -52,7 +50,8 @@ class DownloadDialog : BaseDraggableDialogFragment() {
private var mAdapter: DownloadDialogAdapter? = null
private var mTraceEvent: ExposureEvent? = null
private var mPlatformList: List<GamePlatform>? = null
private var mPlatformName: String = ""
private var mPackageName: String = ""
private var mParentBundle: Bundle? = null
// 合集页面保持和后台一样的顺序
@ -98,11 +97,8 @@ class DownloadDialog : BaseDraggableDialogFragment() {
super.onCreate(savedInstanceState)
mParentBundle = requireActivity().intent.extras?.getBundle(ToolBarActivity.NORMAL_FRAGMENT_BUNDLE)
mPlatformList = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
mParentBundle?.getParcelableArrayList(EntranceConsts.KEY_PLATFORMS, GamePlatform::class.java)
} else {
mParentBundle?.getParcelableArrayList(EntranceConsts.KEY_PLATFORMS)
}
mPlatformName = mParentBundle?.getString(EntranceConsts.KEY_PLATFORM, "") ?: ""
mPackageName = mParentBundle?.getString(EntranceConsts.KEY_PACKAGENAME, "") ?: ""
mGameEntity = requireArguments().getParcelable(GameEntity::class.java.simpleName)!!
mEntrance = requireArguments().getString(EntranceConsts.KEY_ENTRANCE) ?: ""
mLocation = requireArguments().getString(EntranceConsts.KEY_LOCATION) ?: ""
@ -176,37 +172,28 @@ class DownloadDialog : BaseDraggableDialogFragment() {
//自动下载
private fun performAutoDownload(itemList: List<DownloadDialogItemData>, recyclerView: RecyclerView) {
val platformList = this.mPlatformList
if (platformList.isNullOrEmpty()) return
if (mPlatformName.isEmpty() && mPackageName.isEmpty()) return
AppExecutor.uiExecutor.executeWithDelay({
recyclerView.adapter?.let {
for (i in 0 until it.itemCount) {
val apkEntity = itemList[i].normal ?: continue
val apkCollection = apkEntity.apkCollection
val platformName = platformList[0].name
val packageName = platformList[0].packageName
if (apkCollection != null) {// 插件集合首先切换到集合列表,再自动下载插件
if (apkCollection.name == platformName) {// 第一个需要自动下载的插件名称与插件集合名称相同
if (apkCollection != null) {
if (apkCollection.name == mPlatformName) {
scrollAndDownload(recyclerView, false, i)
break
} else {
// 插件集合列表中存在需要自动下载的插件
val matched = apkCollection.saveApkEntity?.any { entity ->
entity.getPlatformName() == platformName || entity.packageName == packageName
}
if (matched == true) {
scrollAndDownload(recyclerView, false, i)
break
apkCollection.saveApkEntity?.forEach { entity ->
if (entity.getPlatformName() == mPlatformName || entity.packageName == mPackageName) {
scrollAndDownload(recyclerView, false, i)
}
}
break
}
}
// 自动下载符合条件的插件
val matchPlatformIndex = platformList.indexOfFirst { platform ->
platform.name == apkEntity.getPlatformName() || platform.packageName == apkEntity.packageName
}
if (matchPlatformIndex != -1) {
if (apkEntity.getPlatformName() == mPlatformName || apkEntity.packageName == mPackageName) {
scrollAndDownload(recyclerView, true, i)
break
}
}
}

View File

@ -5,14 +5,14 @@ import android.graphics.drawable.GradientDrawable
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.callback.OnViewClickListener
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.common.util.*
import com.gh.gamecenter.NewsDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.callback.OnViewClickListener
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.lightgame.adapter.BaseRecyclerAdapter
class DownloadDialogAdapter(
@ -100,7 +100,7 @@ class DownloadDialogAdapter(
DirectUtils.directToQa(mContext, data.linkText, data.linkId)
}
"qa_collection" -> {
DirectUtils.directToHelpAndFeedback(mContext, isPlugin = true)
DirectUtils.directToQaCollection(mContext, data.linkText, data.linkId)
}
else -> {
//Utils.toast(mContext, "暂不支持类型:" + data.linkType)

View File

@ -11,6 +11,7 @@ import com.gh.common.dialog.CertificationDialog
import com.gh.common.dialog.DeviceRemindDialog
import com.gh.common.dialog.PackageCheckDialogFragment
import com.gh.common.util.*
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.common.util.DirectUtils.directToLinkPage
import com.gh.download.DownloadManager
import com.gh.download.server.BrowserInstallHelper
@ -18,14 +19,14 @@ import com.gh.gamecenter.DownloadManagerActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.NewFlatLogUtils
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.core.utils.SpeedUtils
import com.gh.gamecenter.databinding.DownloadDialogItemBinding
import com.gh.gamecenter.feature.entity.ApkEntity
import com.gh.gamecenter.feature.entity.GameCollectionEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.manager.PackagesManager
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
@ -278,28 +279,10 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
DownloadManager.getInstance().cancel(apkEntity.url)
} else {
if (PackageUtils.isCanPluggable(apkEntity)) {
DialogHelper.showPluginDialog(
it.context,
pluginDesc = gameEntity.pluginDesc,
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese,
platform = gameEntity.platform ?: ""
) {
DialogHelper.showPluginDialog(it.context, gameEntity.pluginDesc) {
PackageInstaller.uninstall(it.context, downloadEntity.path)
}
} else {
NewFlatLogUtils.logGameInstall(
gameId = downloadEntity.gameId ,
gameName = downloadEntity.name,
trigger = "主动安装"
)
SensorsBridge.trackInstallGameClick(
gameId = downloadEntity.gameId,
gameName = downloadEntity.name,
action = "主动安装"
)
PackageInstaller.install(it.context, downloadEntity)
}
}
@ -366,7 +349,6 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
if (msg.isNullOrEmpty()) {
BrowserInstallHelper.showBrowserInstallHintDialog(
context,
gameEntity,
gameEntity.isVGame() || gameEntity.isSplitXApk()
) {
DownloadDialogHelper.findAvailableDialogAndShow(
@ -386,8 +368,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
context,
apkEntity.size,
gameEntity.id,
gameEntity.name,
gameEntity.categoryChinese
gameEntity.name
) { isSubscribe ->
DownloadManager.createDownload(
context,

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.os.Build
import android.util.Base64
import com.gh.common.constant.Config
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.common.util.DirectUtils
import com.gh.common.util.LogUtils
import com.gh.common.util.PackageUtils
@ -12,14 +13,11 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.entity.ExposureEntity
import com.gh.gamecenter.common.loghub.LoghubUtils
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.tryCatchInRelease
import com.gh.gamecenter.core.utils.EmptyCallback
import com.gh.gamecenter.core.utils.GsonUtils
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.entity.NewSettingsEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.google.gson.JsonObject
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
@ -137,7 +135,6 @@ object BrowserInstallHelper {
@JvmStatic
fun showBrowserInstallHintDialog(
context: Context,
gameEntity: GameEntity,
skipBrowserInstallDialog: Boolean = false,
callback: EmptyCallback
) {
@ -156,12 +153,6 @@ object BrowserInstallHelper {
"当前安装方式为助手安装,下载安装游戏需要验证账户密码或指纹。如需免密码安装,可选择切换安装方式为“浏览器安装”"
}
SensorsBridge.trackSwitchInstallDialogShow(
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
DialogHelper.showDialog(
context,
title = "温馨提示",
@ -172,30 +163,10 @@ object BrowserInstallHelper {
val intent = ShellActivity.getIntent(context, ShellActivity.Type.SWITCH_INSTALL_METHOD, null)
context.startActivity(intent)
logOrdinaryBrowserEvent(Type.SWITCH_INSTALL_DIALOG_ACCESS)
SensorsBridge.trackSwitchInstallDialogClick(
buttonName = "切换安装方式",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
cancelClickCallback = {
callback.onCallback()
logOrdinaryBrowserEvent(Type.SWITCH_INSTALL_DIALOG_QUIT)
SensorsBridge.trackSwitchInstallDialogClick(
buttonName = "继续下载",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
touchOutsideCallback = {
SensorsBridge.trackSwitchInstallDialogClick(
buttonName = "关闭弹窗",
gameId = gameEntity.id,
gameName = gameEntity.name ?: "",
gameType = gameEntity.categoryChinese
)
},
extraConfig = DialogHelper.Config(hint = "修改路径:我的光环-设置-切换安装方式")
)
@ -214,8 +185,22 @@ object BrowserInstallHelper {
if (settingsEntity.installModel?.status == "matched") {
return true
}
settingsEntity.installModel?.whiteList?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return false
}
}
}
settingsEntity.installModel?.packages?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return true
}
}
}
return isConditionMatched(settingsEntity)
return false
}
}
@ -226,43 +211,26 @@ object BrowserInstallHelper {
fun isUseBrowserToInstallEnabledWithPackageMatched(): Boolean {
val settingsEntity = Config.getNewSettingsEntity()
return if (settingsEntity == null) {
false
if (settingsEntity == null) {
return false
} else {
isConditionMatched(settingsEntity)
}
}
/**
* 是否满足开启浏览器安装的条件
*/
private fun isConditionMatched(settingsEntity: NewSettingsEntity): Boolean {
settingsEntity.installModel?.whiteList?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return false
settingsEntity.installModel?.whiteList?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return false
}
}
}
}
settingsEntity.installModel?.packages?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return true
}
}
}
// 匹配部分字符串即可
settingsEntity.installModel?.regexPackages?.let {
for (packageNamePieces in it) {
for (installedPackageName in mAllInstalledPackageList) {
if (installedPackageName.contains(packageNamePieces)) {
settingsEntity.installModel?.packages?.let {
for (packageName in it) {
if (mAllInstalledPackageList.contains(packageName)) {
return true
}
}
}
}
return false
return false
}
}
fun onApkInstalled(path: String?) {

View File

@ -5,9 +5,9 @@ import android.content.Intent
import android.os.Bundle
import com.gh.base.DownloadToolbarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.game.GameFragment
class BlockActivity : DownloadToolbarActivity() {

View File

@ -12,7 +12,6 @@ import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.download.DownloadFragment;
import com.gh.vspace.VHelper;

View File

@ -10,9 +10,7 @@ import com.gh.common.exposure.ExposureManager.log
import com.gh.common.exposure.ExposureTraceUtils.appendTrace
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.toArrayList
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.entity.GamePlatform
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
@ -197,7 +195,6 @@ class GameDetailActivity : DownloadToolbarActivity() {
openPlatformWindow,
null,
null,
null,
traceEvent
)
}
@ -225,7 +222,6 @@ class GameDetailActivity : DownloadToolbarActivity() {
openPlatformWindow: Boolean = false,
platformName: String? = null,
packageName: String? = null,
platforms: List<GamePlatform>? = null,
traceEvent: ExposureEvent? = null
) {
val bundle = Bundle()
@ -265,13 +261,11 @@ class GameDetailActivity : DownloadToolbarActivity() {
}
if (openPlatformWindow) {
bundle.putBoolean(EntranceConsts.KEY_OPEN_PLATFORM_WINDOW, true)
if (!platforms.isNullOrEmpty()) {
bundle.putParcelableArrayList(EntranceConsts.KEY_PLATFORMS, platforms.toArrayList())
} else if (!platformName.isNullOrEmpty() || !packageName.isNullOrEmpty()) {
bundle.putParcelableArrayList(
EntranceConsts.KEY_PLATFORMS,
arrayListOf(GamePlatform(platformName, packageName))
)
if (!platformName.isNullOrEmpty()) {
bundle.putString(EntranceConsts.KEY_PLATFORM, platformName)
}
if (!packageName.isNullOrEmpty()) {
bundle.putString(EntranceConsts.KEY_PACKAGENAME, packageName)
}
}
if (scrollToLibao) {

View File

@ -385,9 +385,8 @@ class ImageViewerActivity : BaseActivity(), OnPageChangeListener {
private fun loadImageInfo(position: Int, width: Int) {
val url = mUrlList!![position]
val imageInfoConfig = Config.getSettings()?.image?.oss?.info ?: "?x-oss-process=image/info"
RetrofitManager.getInstance()
.api.getImageInfo("$url$imageInfoConfig")
.api.getImageInfo("$url?x-oss-process=image/info")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<ImageInfoEntity?>() {

View File

@ -38,13 +38,15 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelProviders;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.ad.AdDelegateHelper;
import com.gh.common.constant.Config;
import com.gh.common.exposure.ExposureManager;
import com.gh.common.filter.RegionSettingHelper;
import com.gh.common.history.HistoryDatabase;
import com.gh.common.history.HistoryHelper;
@ -61,6 +63,7 @@ import com.gh.common.util.ErrorHelper;
import com.gh.common.util.HomePluggableHelper;
import com.gh.common.util.LogUtils;
import com.gh.common.util.LunchType;
import com.gh.common.util.NewFlatLogUtils;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.WechatBindHelper;
@ -73,6 +76,8 @@ import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
import com.gh.gamecenter.common.constant.CommonConsts;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.entity.NotificationUgc;
import com.gh.gamecenter.common.entity.SuggestType;
import com.gh.gamecenter.common.eventbus.EBNetworkState;
import com.gh.gamecenter.common.eventbus.EBReuse;
@ -81,8 +86,8 @@ import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.NotificationHelper;
import com.gh.gamecenter.common.utils.ShareUtils;
import com.gh.gamecenter.core.AppExecutor;
import com.gh.gamecenter.core.utils.ClassUtils;
@ -91,18 +96,22 @@ import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.core.utils.SentryHelper;
import com.gh.gamecenter.core.utils.TimeUtils;
import com.gh.gamecenter.core.utils.ToastUtils;
import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.entity.StartupAdEntity;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.gamecenter.feature.exposure.ExposureSource;
import com.gh.gamecenter.feature.exposure.ExposureType;
import com.gh.gamecenter.feature.utils.PlatformUtils;
import com.gh.gamecenter.fragment.MainWrapperFragment;
import com.gh.gamecenter.fragment.MainWrapperViewModel;
import com.gh.gamecenter.home.skip.PackageSkipActivity;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.login.utils.QuickLoginHelper;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.manager.UpdateManager;
import com.gh.gamecenter.packagehelper.PackageViewModel;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.room.AppDatabase;
@ -162,8 +171,6 @@ public class MainActivity extends BaseActivity {
private PackageViewModel mPackageViewModel;
private MainWrapperViewModel mMainWrapperViewModel;
private MainWrapperFragment mMainWrapperFragment;
// 黄壮华 按连续按返回键两次才退出应用
@ -180,9 +187,6 @@ public class MainActivity extends BaseActivity {
HaloApp.getInstance().isAlreadyUpAndRunning = true;
mMainWrapperViewModel = new ViewModelProvider(this, new MainWrapperViewModel.Factory(HaloApp.getInstance()))
.get(MainWrapperViewModel.class);
super.onCreate(savedInstanceState);
setStatusBarColor(Color.TRANSPARENT);
@ -241,7 +245,7 @@ public class MainActivity extends BaseActivity {
return null;
},
() -> {
DirectUtils.directToSuggestion(MainActivity.this, SuggestType.APP, "APP闪退", false, 100);
DirectUtils.directToSuggestion(MainActivity.this, SuggestType.crash, "APP闪退", 100);
MtaHelper.onEventWithBasicDeviceInfo(
"闪退弹窗",
"玩家操作", "点击反馈");
@ -251,7 +255,7 @@ public class MainActivity extends BaseActivity {
DialogHelper.showCenterWarningDialog(this, "发生闪退", "光环助手刚刚发生了闪退,马上反馈以帮助我们更好地修复问题?(只需简单描述你刚才的操作)"
, "暂不", "马上反馈",
() -> {
DirectUtils.directToSuggestion(MainActivity.this, SuggestType.APP, "APP闪退", false, 100);
DirectUtils.directToSuggestion(MainActivity.this, SuggestType.crash, "APP闪退", 100);
MtaHelper.onEventWithBasicDeviceInfo(
"闪退弹窗",
"玩家操作", "点击反馈");
@ -335,15 +339,8 @@ public class MainActivity extends BaseActivity {
// 检查是否需要触发 XAPK 安装
AppExecutor.getUiExecutor().executeWithDelay(this::resumeXapkInstallIfNeeded, 150);
mMainWrapperViewModel.requestAllDialogData();
// TODO 去掉一键登录?
QuickLoginHelper.getPhoneInfo();
// TODO 搞清楚为什么这里要获取微信相关配置
WechatBindHelper.getWechatConfig(null);
// TODO 根据用户是否安装微博来确定是否需要初始化微博 SDK
initWBSDK();
CertificationSwitchHelper.getCertificationSwitch();
}
@ -583,10 +580,17 @@ public class MainActivity extends BaseActivity {
ExtensionsKt.removeFromParent(startSdkAdContainer);
AdDelegateHelper.INSTANCE.cancelSplashAd(this);
}
checkDialog();
}
// 通知优先级高的弹窗可以显示了
AppExecutor.getUiExecutor().execute(() -> {
mMainWrapperFragment.showDialog();
private void checkDialog() {
// 检查通知权限
checkNotificationPermission();
// 检查助手更新
AppExecutor.getIoExecutor().execute(() -> {
UpdateManager updateManager = UpdateManager.getInstance(this);
updateManager.checkUpdate(true, null);
updateManager.setDismissCallback(mMainWrapperFragment::getDialog);
});
}
@ -793,6 +797,13 @@ public class MainActivity extends BaseActivity {
});
}
private void checkNotificationPermission() {
// 仅登录后再启动光环时请求一次权限
if (UserManager.getInstance().isLoggedIn()) {
NotificationHelper.showNotificationHintDialog(NotificationUgc.LOGIN, null);
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && !mMainWrapperFragment.onHandleBackPressed()) {
@ -827,19 +838,7 @@ public class MainActivity extends BaseActivity {
"直接退出",
"立即安装",
() -> {
handler.postDelayed(() -> {
NewFlatLogUtils.INSTANCE.logGameInstall(
finalDownloadEntity.getGameId(),
finalDownloadEntity.getName(),
"主动安装"
);
SensorsBridge.trackInstallGameClick(
finalDownloadEntity.getGameId(),
finalDownloadEntity.getName(),
"主动安装"
);
PackageInstaller.install(MainActivity.this, finalDownloadEntity);
}, 200);
handler.postDelayed(() -> PackageInstaller.install(MainActivity.this, finalDownloadEntity), 200);
return null;
},
() -> {
@ -975,16 +974,6 @@ public class MainActivity extends BaseActivity {
if (!TextUtils.isEmpty(xapkUrl)) {
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntityByUrl(xapkUrl);
if (downloadEntity != null) {
NewFlatLogUtils.INSTANCE.logGameInstall(
downloadEntity.getGameId(),
downloadEntity.getName(),
"自动安装"
);
SensorsBridge.trackInstallGameClick(
downloadEntity.getGameId(),
downloadEntity.getName(),
"自动安装"
);
PackageInstaller.install(this, downloadEntity, false);
}
}

View File

@ -29,7 +29,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.ethanhua.skeleton.Skeleton;
import com.ethanhua.skeleton.ViewSkeletonScreen;
import com.gh.base.DownloadToolbarActivity;
import com.gh.common.exposure.ExposureManager;
import com.gh.common.filter.RegionSettingHelper;
import com.gh.common.history.HistoryHelper;
import com.gh.common.util.CheckLoginUtils;
@ -62,9 +61,6 @@ import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.MeEntity;
import com.gh.gamecenter.feature.entity.NewsEntity;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.gamecenter.common.exposure.ExposureSource;
import com.gh.gamecenter.feature.exposure.ExposureType;
import com.gh.gamecenter.feature.utils.ApkActiveUtils;
import com.gh.gamecenter.newsdetail.NewsDetailAdapter;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -76,7 +72,6 @@ import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.HashSet;
import io.reactivex.android.schedulers.AndroidSchedulers;
@ -131,8 +126,6 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
private NewsEntity mNewsEntity;
private DownloadEntity mDownloadEntity;
private ExposureEvent mExposureEvent;
private Boolean mHideUselessInfo = false; // 是否需要隐藏一些额外的信息(评论按钮等)
private Handler handler = new Handler();
@ -200,7 +193,7 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
private DetailViewHolder getDetailViewHolder() {
// 每次获取需要重新创建, 防止数据刷新
return new DetailViewHolder(mContentView, gameEntity, mDownloadEntity,
true, mEntrance, "新闻详情", adapter.getTitle(), mExposureEvent); // 下载按钮ViewHolder
true, mEntrance, "新闻详情", adapter.getTitle(), null); // 下载按钮ViewHolder
}
/**
@ -691,8 +684,6 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
ApkActiveUtils.filterHideApk(response);
gameEntity = response;
logExposure();
if (!mHideUselessInfo) {
adapter.setGameEntity(gameEntity);
adapter.notifyItemInserted(1);
@ -718,19 +709,6 @@ public class NewsDetailActivity extends DownloadToolbarActivity implements OnCli
});
}
private void logExposure() {
String sourceValue = mNewsEntity.getTitle() + "+" + mNewsEntity.getId();
ArrayList<ExposureSource> sourceList = new ArrayList<>();
sourceList.add(new ExposureSource("资讯文章", sourceValue));
mExposureEvent = ExposureEvent.createEvent(
gameEntity,
sourceList,
null,
ExposureType.EXPOSURE
);
ExposureManager.INSTANCE.log(mExposureEvent);
}
@Override
protected void onStop() {
super.onStop();

View File

@ -121,27 +121,6 @@ public class SkipActivity extends BaseActivity {
path = path.substring(1);
}
String platform = uri.getQueryParameter(KEY_PLATFORM);
String platformName = PlatformUtils.getInstance(this).getPlatformName(platform);
String gameId = uri.getQueryParameter(EntranceConsts.KEY_GAMEID);
String packageMd5 = uri.getQueryParameter(EntranceConsts.KEY_PACKAGE_MD5);
String isQaFeedbackString = uri.getQueryParameter(EntranceConsts.KEY_IS_QA_FEEDBACK);
String suggestionType = uri.getQueryParameter(KEY_TYPE);
boolean isQaFeedback = !TextUtils.isEmpty(isQaFeedbackString) && isQaFeedbackString.equals("true");
String content = (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) ?
String.format("%s—V%s—%sV%s",
uri.getQueryParameter(KEY_GAME_NAME),
uri.getQueryParameter(KEY_VERSION),
TextUtils.isEmpty(platformName) ? platform : platformName,
uri.getQueryParameter(KEY_PLATFORM_VERSION)) :
String.format("%s-%s-V%s\n游戏ID%s\n游戏包MD5%s\n",
uri.getQueryParameter(KEY_GAME_NAME),
TextUtils.isEmpty(platformName) ? platform : platformName,
uri.getQueryParameter(KEY_VERSION), gameId, packageMd5);
String qaId = uri.getQueryParameter("qa_id");
String qaContentId = uri.getQueryParameter(EntranceConsts.KEY_QA_CONTENT_ID);
String qaTitle = uri.getQueryParameter(EntranceConsts.KEY_QA_TITLE);
if (host != null) {
Intent intent;
switch (host) {
@ -162,12 +141,32 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directToSubject(this, path, uri.getQueryParameter(KEY_NAME), ENTRANCE_BROWSER, null, false);
break;
case HOST_SUGGESTION:
String platform = uri.getQueryParameter(KEY_PLATFORM);
String platformName = PlatformUtils.getInstance(this).getPlatformName(platform);
String gameId = uri.getQueryParameter(EntranceConsts.KEY_GAMEID);
String packageMd5 = uri.getQueryParameter(EntranceConsts.KEY_PACKAGE_MD5);
String isQaFeedbackString = uri.getQueryParameter(EntranceConsts.KEY_IS_QA_FEEDBACK);
String suggestionType = uri.getQueryParameter(KEY_TYPE);
boolean isQaFeedback = !TextUtils.isEmpty(isQaFeedbackString) && isQaFeedbackString.equals("true");
String content = (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) ?
String.format("%s—V%s—%sV%s",
uri.getQueryParameter(KEY_GAME_NAME),
uri.getQueryParameter(KEY_VERSION),
TextUtils.isEmpty(platformName) ? platform : platformName,
uri.getQueryParameter(KEY_PLATFORM_VERSION)) :
String.format("%s-%s-V%s\n游戏ID%s\n游戏包MD5%s\n",
uri.getQueryParameter(KEY_GAME_NAME),
TextUtils.isEmpty(platformName) ? platform : platformName,
uri.getQueryParameter(KEY_VERSION), gameId, packageMd5);
String qaId = uri.getQueryParameter("qa_id");
String qaContentId = uri.getQueryParameter(EntranceConsts.KEY_QA_CONTENT_ID);
String qaTitle = uri.getQueryParameter(EntranceConsts.KEY_QA_TITLE);
if (!TextUtils.isEmpty(qaId)) {
DirectUtils.directToQa(this, qaTitle, qaId);
} else if ("vgame".equals(suggestionType)) {
DirectUtils.directToFeedback(this, content, isQaFeedback, qaContentId, false, true, EntranceConsts.ENTRANCE_BROWSER);
DirectUtils.directToVGameFeedback(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
} else {
DirectUtils.directToFeedback(this, content, isQaFeedback, qaContentId, true, false, EntranceConsts.ENTRANCE_BROWSER);
DirectUtils.directToFeedback(this, content, null, isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
}
break;
case HOST_DOWNLOAD:
@ -336,7 +335,7 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directCategoryDirectory(this, path, title, ENTRANCE_BROWSER, "浏览器");
break;
case HOST_COLUMN_COLLECTION:
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "", "", "", null);
DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "", null);
break;
case EntranceConsts.HOST_BLOCK:
name = uri.getQueryParameter("name");
@ -402,8 +401,7 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directToHistoryApk(this, uri.getQueryParameter(EntranceConsts.KEY_GAME_ID));
break;
case EntranceConsts.HOST_FORUM_DETAIL:
String sectionId = uri.getQueryParameter("section_id");
DirectUtils.directForumDetailSection(this, id, sectionId, ENTRANCE_BROWSER);
DirectUtils.directForumDetail(this, id, ENTRANCE_BROWSER);
break;
case EntranceConsts.HOST_GAME_RATING_DETAIL:
DirectUtils.directToGameRatingDetail(this, uri.getQueryParameter(EntranceConsts.KEY_GAME_ID), uri.getQueryParameter(EntranceConsts.KEY_COMMENT_ID), ENTRANCE_BROWSER);
@ -413,11 +411,8 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directToForum(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position));
break;
case EntranceConsts.HOST_HELP_AND_FEEDBACK:
if ("vgame".equals(suggestionType)) {
DirectUtils.directToHelpAndFeedback(this, content, isQaFeedback, qaContentId, false, true, EntranceConsts.ENTRANCE_BROWSER);
} else {
DirectUtils.directToHelpAndFeedback(this, content, isQaFeedback, qaContentId, true, false, EntranceConsts.ENTRANCE_BROWSER);
}
position = uri.getQueryParameter("position");
DirectUtils.directToHelpAndFeedback(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position));
break;
case HOST_GAME_COLLECTION_DETAIL:
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "", null);

View File

@ -66,6 +66,8 @@ class SplashScreenActivity : BaseActivity() {
private var mShouldPrefetchData = true
private val mPermissions = arrayOf(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
PermissionHelper.PERMISSION_GET_INSTALLED_LIST
)

View File

@ -12,27 +12,28 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.gamecenter.common.entity.ExposureEntity;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.gamecenter.feature.exposure.ExposureSource;
import com.gh.gamecenter.feature.exposure.ExposureType;
import com.gh.gamecenter.common.utils.DataLogUtils;
import com.gh.common.util.DirectUtils;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.entity.ExposureEntity;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.common.exposure.ExposureSource;
import com.gh.gamecenter.common.utils.DataLogUtils;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
import com.gh.gamecenter.core.utils.StringUtils;
import com.gh.gamecenter.entity.SubjectRecommendEntity;
import com.gh.gamecenter.MainActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.exposure.ExposureEvent;
import com.gh.gamecenter.feature.exposure.ExposureType;
import com.gh.gamecenter.common.entity.LinkEntity;
import com.gh.gamecenter.entity.SubjectRecommendEntity;
import com.gh.gamecenter.game.data.GameItemData;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -142,17 +143,6 @@ public class ImagePagerAdapter extends RecyclingPagerAdapter {
DirectUtils.INSTANCE.directToLinkPage(mContext, slideEntity, entrance, "轮播图[" + slideEntity
.getText() + "=" + slideEntity.getType() + "=" + indexName + "]", finalExposureEvent);
JSONObject trackEvent = new JSONObject();
try {
trackEvent.put("position", index);
trackEvent.put("location", "版块");
trackEvent.put("block_name", mBlockData.getText());
trackEvent.put("block_id", mBlockData.getLink());
} catch (JSONException e) {
e.printStackTrace();
}
SensorsBridge.trackEvent("BannerClick", trackEvent);
});
mItemData.getExposureEventList().add(finalExposureEvent);

View File

@ -27,7 +27,6 @@ import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.LibaoDetailContentViewHolder;
import com.gh.gamecenter.adapter.viewholder.LibaoDetailTopViewHolder;
import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
import com.gh.gamecenter.common.entity.SimpleGameEntity;
import com.gh.gamecenter.common.entity.SuggestType;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.ExtensionsKt;
@ -40,9 +39,9 @@ import com.gh.gamecenter.core.utils.StringUtils;
import com.gh.gamecenter.databinding.LibaodetailItemContentBinding;
import com.gh.gamecenter.databinding.LibaodetailItemTopBinding;
import com.gh.gamecenter.entity.LibaoDetailEntity;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.LibaoEntity;
import com.gh.gamecenter.feature.entity.LibaoStatusEntity;
import com.gh.gamecenter.feature.entity.GameEntity;
import com.gh.gamecenter.feature.entity.MeEntity;
import com.gh.gamecenter.feature.entity.UserDataLibaoEntity;
import com.gh.gamecenter.feature.game.GameItemViewHolder;
@ -157,12 +156,12 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.initItemPadding();
viewHolder.getLoading().setVisibility(View.GONE);
SpannableStringBuilder builder = new SpanBuilder("此礼包有问题?点击反馈")
.click(mContext, 7, 11, R.color.theme_font, false, () -> {
HelpAndFeedbackBridge.startSuggestionActivity(mContext,
SuggestType.GAME, "libao",
StringUtils.buildString(mLibaoEntity.getName(), "有问题:"), new SimpleGameEntity(mLibaoEntity.getGame().getId(), mLibaoEntity.getGame().getName(), mLibaoEntity.getGame().getIcon()));
SuggestType.normal, "libao",
StringUtils.buildString(mLibaoEntity.getGame().getName(), "",
mLibaoEntity.getName(), "有问题:"));
return null;
})
.build();

View File

@ -0,0 +1,213 @@
package com.gh.gamecenter.adapter;
import static com.gh.common.constant.Config.URL_ARTICLE;
import static com.gh.gamecenter.R.string.loading;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.NewsDetailActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WebActivity;
import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder;
import com.gh.gamecenter.adapter.viewholder.ToolBoxViewHolder;
import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
import com.gh.gamecenter.common.entity.SuggestType;
import com.gh.gamecenter.common.entity.ToolBoxEntity;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.databinding.ToolboxItemBinding;
import com.gh.gamecenter.help.HelpAndFeedbackBridge;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.adapter.BaseRecyclerAdapter;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import retrofit2.HttpException;
/**
* Created by khy on 24/05/17.
*/
public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
private OnRequestCallBackListener mCallBackListener;
private List<ToolBoxEntity> mEntityList;
private String mSearchKey;
private boolean mIsSearch;
private boolean mIsLoading;
private boolean mIsOver;
private boolean mIsNetworkError;
private int mPage;
public ToolBoxRvAdapter(Context context, OnRequestCallBackListener listener, boolean isSearch, String key) {
super(context);
this.mIsSearch = isSearch;
this.mSearchKey = key;
mPage = 1;
mCallBackListener = listener;
mEntityList = new ArrayList<>();
loadData();
}
public void loadData() {
if (mIsLoading) {
return;
}
mIsLoading = true;
RetrofitManager.getInstance().getApi()
.getToolKitData(mPage, UrlFilterUtils.getFilterQuery("keyword", mIsSearch ? mSearchKey : ""))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<ToolBoxEntity>>() {
@Override
public void onResponse(List<ToolBoxEntity> response) {
super.onResponse(response);
if (response.size() > 0) {
mEntityList.addAll(response);
}
mCallBackListener.loadDone();
if (response.size() < 20) {
mIsOver = true;
}
notifyDataSetChanged();
mPage++;
mIsLoading = false;
if (mEntityList.size() == 0) {
mCallBackListener.loadEmpty();
}
}
@Override
public void onFailure(HttpException e) {
super.onFailure(e);
mIsLoading = false;
if (mEntityList.size() == 0) {
mCallBackListener.loadError();
} else {
mIsNetworkError = true;
notifyItemChanged(getItemCount() - 1);
}
}
});
}
@Override
public int getItemViewType(int position) {
if (position == 0) {
return 1;
} else if (position == getItemCount() - 1) {
return 2;
} else {
return 3;
}
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == 2) {
View view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
return new FooterViewHolder(view);
} else if (viewType == 1) {
View view = mLayoutInflater.inflate(R.layout.toolbox_hint_item, parent, false);
return new ReuseViewHolder(view);
} else {
View view = mLayoutInflater.inflate(R.layout.toolbox_item, parent, false);
return new ToolBoxViewHolder(ToolboxItemBinding.bind(view));
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof ToolBoxViewHolder) {
ToolBoxViewHolder viewHolder = (ToolBoxViewHolder) holder;
ToolBoxEntity toolBoxEntity = mEntityList.get(position - 1);
initToolBoxViewHolder(viewHolder, toolBoxEntity);
} else if (holder instanceof FooterViewHolder) {
FooterViewHolder viewHolder = (FooterViewHolder) holder;
initFooterViewHolder(viewHolder);
} else if (holder instanceof ReuseViewHolder) {
holder.itemView.setOnClickListener(v -> {
MtaHelper.onEvent("我的光环_新", "工具箱", "点击反馈");
HelpAndFeedbackBridge.startSuggestionActivity(mContext, SuggestType.normal, null, null);
});
}
}
@Override
public int getItemCount() {
if (mEntityList.size() > 0) {
return mEntityList.size() + 2;
} else {
return 0;
}
}
private void initFooterViewHolder(FooterViewHolder viewHolder) {
viewHolder.initItemPadding();
if (mIsNetworkError) {
viewHolder.getLoading().setVisibility(View.GONE);
viewHolder.getHint().setText(R.string.loading_failed_retry);
viewHolder.itemView.setClickable(true);
viewHolder.itemView.setOnClickListener(v -> loadData());
} else if (mIsOver) {
viewHolder.getLoading().setVisibility(View.GONE);
viewHolder.getHint().setText(R.string.loading_complete);
viewHolder.itemView.setClickable(false);
} else {
viewHolder.getLoading().setVisibility(View.VISIBLE);
viewHolder.getHint().setText(loading);
viewHolder.itemView.setClickable(false);
}
}
private void initToolBoxViewHolder(ToolBoxViewHolder viewHolder, final ToolBoxEntity toolBoxEntity) {
viewHolder.binding.toolboxItemDes.setText(toolBoxEntity.getDes());
viewHolder.binding.toolboxItemTitle.setText(toolBoxEntity.getName());
ImageUtils.display(viewHolder.binding.toolboxItemGameThumb, toolBoxEntity.getIcon());
viewHolder.itemView.setOnClickListener(v -> {
String url = toolBoxEntity.getUrl();
// http://www.ghzs666.com/article/59291e7ce9a64a496cfd6897.html
if (url != null && url.contains(URL_ARTICLE)) {
String newsId = url.substring(url.lastIndexOf("/") + 1, url.length() - 5); // 5: ".html"
Intent intent = NewsDetailActivity.getIntentById(mContext, newsId, "工具箱列表");
mContext.startActivity(intent);
} else {
mContext.startActivity(WebActivity.getWebByCollectionTools(mContext, toolBoxEntity, false));
}
});
}
public boolean isOver() {
return mIsOver;
}
public boolean isLoading() {
return mIsLoading;
}
public boolean isNetworkError() {
return mIsNetworkError;
}
}

View File

@ -59,7 +59,6 @@ import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.utils.DataLogUtils;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
import com.gh.gamecenter.common.utils.PermissionHelper;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
@ -187,33 +186,17 @@ public class DetailViewHolder {
XapkInstaller.cancelUnzipTask(mDownloadEntity);
return;
} else if (XapkUnzipStatus.FAILURE.name().equals(xapkStatus)) {
PermissionHelper.checkStoragePermissionBeforeAction(
mViewHolder.context,
mGameEntity.getId(),
mGameEntity.getName() != null ? mGameEntity.getName() : "",
mGameEntity.getCategoryChinese(),
() -> {
if (mDownloadEntity != null) {
final String path = mDownloadEntity.getPath();
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mViewHolder.context, R.string.install_failure_hint);
DownloadManager.getInstance().cancel(mDownloadEntity.getUrl());
} else {
NewFlatLogUtils.INSTANCE.logGameInstall(
mDownloadEntity.getGameId(),
mDownloadEntity.getName(),
"主动安装"
);
SensorsBridge.trackInstallGameClick(
mDownloadEntity.getGameId(),
mDownloadEntity.getName(),
"主动安装"
);
PackageInstaller.install(mViewHolder.context, mDownloadEntity);
}
}
});
PermissionHelper.checkStoragePermissionBeforeAction(mViewHolder.context, () -> {
if (mDownloadEntity != null) {
final String path = mDownloadEntity.getPath();
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mViewHolder.context, R.string.install_failure_hint);
DownloadManager.getInstance().cancel(mDownloadEntity.getUrl());
} else {
PackageInstaller.install(mViewHolder.context, mDownloadEntity);
}
}
});
return;
}
}
@ -291,7 +274,7 @@ public class DetailViewHolder {
//启动模拟器游戏
if (SimulatorGameManager.isSimulatorGame(mGameEntity)) {
if (NewSimulatorGameManager.shouldShowUpdateNewSimulatorAlert(mViewHolder.context)) {
NewSimulatorGameManager.showUpdateNewsSimulator(mViewHolder.context, mGameEntity, null);
NewSimulatorGameManager.showUpdateNewsSimulator(mViewHolder.context, null);
return;
}
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(mGameEntity.getApk().get(0).getUrl());
@ -314,19 +297,14 @@ public class DetailViewHolder {
PackageLauncher.launchApp(mViewHolder.context, mGameEntity, mGameEntity.getApk().get(0).getPackageName());
} else {
GamePermissionDialogFragment.show((AppCompatActivity) mViewHolder.context, mGameEntity, mGameEntity.getInfo(), () -> {
PermissionHelper.checkStoragePermissionBeforeAction(
mViewHolder.context,
mGameEntity.getId(),
mGameEntity.getName() != null ? mGameEntity.getName() : "",
mGameEntity.getCategoryChinese(),
() -> {
DownloadDialog.showDownloadDialog(
mViewHolder.context,
mGameEntity,
mTraceEvent,
StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"),
mName + ":" + mTitle);
});
PermissionHelper.checkStoragePermissionBeforeAction(mViewHolder.context, () -> {
DownloadDialog.showDownloadDialog(
mViewHolder.context,
mGameEntity,
mTraceEvent,
StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"),
mName + ":" + mTitle);
});
});
}
break;
@ -334,18 +312,6 @@ public class DetailViewHolder {
case INSTALL_NORMAL:
if (mGameEntity.getApk().isEmpty()) return;
NewFlatLogUtils.INSTANCE.logGameInstall(
mDownloadEntity.getGameId(),
mDownloadEntity.getName(),
"主动安装"
);
SensorsBridge.trackInstallGameClick(
mDownloadEntity.getGameId(),
mDownloadEntity.getName(),
"主动安装"
);
ApkEntity apk = mGameEntity.getApk().get(0);
DownloadEntity downloadEntity = SimulatorGameManager.findDownloadEntityByUrl(apk.getUrl());
if (mGameEntity.getSimulator() != null) {
@ -360,7 +326,7 @@ public class DetailViewHolder {
if (downloadEntity != null && SimulatorGameManager.isSimulatorGame(mGameEntity) && !isInstalled && !isInstalledNewSimulator) {
SimulatorDownloadManager.getInstance().showDownloadDialog(mViewHolder.context, simulator,
SimulatorDownloadManager.SimulatorLocation.LAUNCH, mGameEntity.getId(), mGameEntity.getName(), mGameEntity.getCategoryChinese(), null);
SimulatorDownloadManager.SimulatorLocation.LAUNCH, mGameEntity.getId(), mGameEntity.getName(), null);
return;
}
}
@ -370,26 +336,21 @@ public class DetailViewHolder {
return;
}
PermissionHelper.checkStoragePermissionBeforeAction(
mViewHolder.context,
mGameEntity.getId(),
mGameEntity.getName() != null ? mGameEntity.getName() : "",
mGameEntity.getCategoryChinese(),
() -> {
if (mDownloadEntity == null) {
mDownloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(mGameEntity);
}
PermissionHelper.checkStoragePermissionBeforeAction(mViewHolder.context, () -> {
if (mDownloadEntity == null) {
mDownloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(mGameEntity);
}
if (mDownloadEntity != null) {
final String path = mDownloadEntity.getPath();
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mViewHolder.context, R.string.install_failure_hint);
DownloadManager.getInstance().cancel(mDownloadEntity.getUrl());
} else {
PackageInstaller.install(mViewHolder.context, mDownloadEntity);
}
}
});
if (mDownloadEntity != null) {
final String path = mDownloadEntity.getPath();
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mViewHolder.context, R.string.install_failure_hint);
DownloadManager.getInstance().cancel(mDownloadEntity.getUrl());
} else {
PackageInstaller.install(mViewHolder.context, mDownloadEntity);
}
}
});
break;
case RESERVABLE:
GamePermissionDialogFragment.show((AppCompatActivity) mViewHolder.context, mGameEntity, mGameEntity.getInfo(), () -> {
@ -434,38 +395,11 @@ public class DetailViewHolder {
Utils.toast(mViewHolder.context, "正在加急更新版本,敬请后续留意");
break;
case TEENAGER_MODE:
SensorsBridge.trackAdolescentModeDialogShow(
mGameEntity.getId(),
mGameEntity.getName() != null ? mGameEntity.getName() : "",
mGameEntity.getCategoryChinese()
);
DialogHelper.showCenterDialog(
mViewHolder.context,
"提示", "当前处于儿童/青少年模式, \n暂不提供游戏下载", "退出青少年模式", "关闭",
() -> mViewHolder.context.startActivity(TeenagerModeActivity.getIntent(mViewHolder.context)),
() -> {
mViewHolder.context.startActivity(TeenagerModeActivity.getIntent(mViewHolder.context));
SensorsBridge.trackAdolescentModeDialogClick(
"退出青少年模式",
mGameEntity.getId(),
mGameEntity.getName() != null ? mGameEntity.getName() : "",
mGameEntity.getCategoryChinese()
);
},
() -> {
SensorsBridge.trackAdolescentModeDialogClick(
"关闭",
mGameEntity.getId(),
mGameEntity.getName() != null ? mGameEntity.getName() : "",
mGameEntity.getCategoryChinese()
);
},
() -> {
SensorsBridge.trackAdolescentModeDialogClick(
"关闭弹窗",
mGameEntity.getId(),
mGameEntity.getName() != null ? mGameEntity.getName() : "",
mGameEntity.getCategoryChinese()
);
}
);
break;

View File

@ -18,7 +18,6 @@ import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.DisplayUtils
@ -27,6 +26,7 @@ import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.databinding.AmwayCommentItemBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.gh.gamecenter.game.GameAndPosition
import com.gh.gamecenter.game.vertical.GameVerticalAdapter

View File

@ -10,6 +10,7 @@ import androidx.core.view.ViewCompat
import androidx.recyclerview.widget.RecyclerView
import com.ethanhua.skeleton.Skeleton
import com.gh.common.exposure.ExposureListener
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.common.util.DialogUtils
import com.gh.common.util.NewFlatLogUtils
import com.gh.common.xapk.XapkInstaller
@ -22,7 +23,6 @@ import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.eventbus.EBReuse
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.VerticalItemDecoration
import com.gh.gamecenter.core.utils.ClickUtils

View File

@ -5,7 +5,6 @@ import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.entity.SimpleGameEntity
import com.gh.gamecenter.common.entity.SuggestType
import com.gh.gamecenter.common.utils.observeNonNull
import com.gh.gamecenter.common.utils.viewModelProviderFromParent
@ -36,13 +35,7 @@ class AmwaySearchListFragment : ToolbarFragment() {
mBinding.noDataContainer.reuseNoneDataDescTv.text = "换个搜索词试试~"
mBinding.noDataContainer.reuseResetLoadTv.visibility = View.VISIBLE
mBinding.noDataContainer.reuseResetLoadTv.setOnClickListener {
HelpAndFeedbackBridge.startSuggestionActivity(
requireContext(),
SuggestType.UPDATE,
null,
null,
SimpleGameEntity(name = mViewModel.currentSearchKey)
)
HelpAndFeedbackBridge.startSuggestionActivity(requireContext(), SuggestType.gameCollect, "求游戏:")
}
mBinding.errorContainer.connectionReloadTv.setOnClickListener {

View File

@ -9,10 +9,10 @@ import com.gh.common.constant.Config
import com.gh.common.util.PackageHelper
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import com.lightgame.utils.Utils
@ -23,7 +23,6 @@ import retrofit2.HttpException
class AmwaySearchViewModel(application: Application) : AndroidViewModel(application) {
private var mTempSearchKey = ""
var currentSearchKey = ""
var loadStatus = MutableLiveData<LoadStatus>()
@ -42,7 +41,6 @@ class AmwaySearchViewModel(application: Application) : AndroidViewModel(applicat
fun getSearchResult(searchKey: String) {
mTempSearchKey = searchKey
currentSearchKey = searchKey
loadStatus.postValue(LoadStatus.INIT_LOADING)
RetrofitManager
.getInstance().api

View File

@ -6,14 +6,14 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.viewpager.widget.PagerAdapter
import com.facebook.drawee.view.SimpleDraweeView
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.RecyclingPagerAdapter
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.core.utils.PageSwitchDataHelper
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
class BannerAdapter(
private val mContext: Context,

View File

@ -11,7 +11,6 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.common.viewholder.FooterViewHolder
@ -19,6 +18,7 @@ import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.lightgame.download.DownloadEntity

View File

@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View
import com.ethanhua.skeleton.Skeleton
import com.gh.common.exposure.ExposureListener
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.common.util.DialogUtils
import com.gh.common.view.CatalogFilterView
import com.gh.common.xapk.XapkInstaller
@ -14,7 +15,6 @@ import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.observeNonNull
import com.gh.gamecenter.common.baselist.ListFragment
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.databinding.FragmentCatalogListBinding

View File

@ -13,18 +13,18 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.common.exposure.IExposable
import com.gh.common.util.*
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.PageSwitchDataHelper
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.entity.SpecialCatalogEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.subject.SubjectActivity.Companion.startSubjectActivity
class SpecialCatalogAdapter(
@ -156,13 +156,7 @@ class SpecialCatalogAdapter(
mExposureEventSparseArray.append(position, exposureEvent)
}
root.setOnClickListener {
DirectUtils.directToLinkPage(
mContext,
imageEntity.link,
"新分类-精选分类",
"图片",
exposureEvent
)
DirectUtils.directToLinkPage(mContext, imageEntity.link, "新分类-精选分类", "图片", exposureEvent)
mCatalogViewModel.logSpecialCatalogContentClick(
"图片",
imageEntity.image.title,
@ -182,10 +176,7 @@ class SpecialCatalogAdapter(
headMore.setOnClickListener {
if (entity.type == "专题合集") {
DirectUtils.directToColumnCollection(
mContext,
specialLink.link ?: "",
-1,
"(游戏-专题:" + specialLink.text + "-全部)"
mContext, specialLink.link ?: "", -1, "(游戏-专题:" + specialLink.text + "-全部)"
)
} else {
startSubjectActivity(
@ -284,7 +275,6 @@ class SpecialCatalogAdapter(
banners,
lastPageDataMap
)
banners.isNotEmpty() && pagerAdapter != null -> (pagerAdapter as BannerAdapter).checkResetData(itemData)
banners.isEmpty() -> binding.viewPager.adapter = null
}

View File

@ -7,8 +7,8 @@ import com.gh.common.filter.RegionSettingHelper
import com.gh.common.util.LogUtils
import com.gh.gamecenter.common.baselist.ListViewModel
import com.gh.gamecenter.common.entity.ExposureEntity
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.entity.SpecialCatalogEntity
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import io.reactivex.Observable

View File

@ -11,7 +11,6 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.common.viewholder.FooterViewHolder
@ -19,6 +18,7 @@ import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.lightgame.download.DownloadEntity

View File

@ -9,6 +9,7 @@ import androidx.core.view.GravityCompat
import androidx.drawerlayout.widget.DrawerLayout
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.common.util.LogUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.SearchActivity
@ -16,7 +17,6 @@ import com.gh.gamecenter.catalog.SpecialCatalogFragment
import com.gh.gamecenter.common.base.fragment.LazyFragment
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.FixLinearLayoutManager
import com.gh.gamecenter.core.utils.PageSwitchDataHelper

View File

@ -6,6 +6,9 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.databind.BindingAdapters
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.common.exposure.IExposable
import com.gh.common.util.DownloadItemUtils
import com.gh.gamecenter.GameDetailActivity
@ -14,7 +17,6 @@ import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.common.viewholder.FooterViewHolder
@ -23,8 +25,6 @@ import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.databinding.CategoryGameItemBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.lightgame.download.DownloadEntity
import org.json.JSONException

View File

@ -5,11 +5,11 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.gh.gamecenter.common.entity.ExposureEntity
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.common.exposure.ExposureUtils
import com.gh.gamecenter.core.utils.UrlFilterUtils
import com.gh.common.view.CategoryFilterView
import com.gh.gamecenter.common.baselist.ListViewModel
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.entity.SubjectSettingEntity
import com.gh.gamecenter.retrofit.RetrofitManager

View File

@ -278,7 +278,7 @@ class CloudArchiveManagerActivity : BaseActivity_TabLayout() {
}
override fun onError(e: Throwable?) {
toast("存档上传失败")
toast("上传失败")
}
},
null,

View File

@ -15,30 +15,26 @@ import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.exposure.IExposable
import com.gh.common.util.CheckLoginUtils
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler
import com.gh.common.util.*
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.adapter.viewholder.GameCollectionItemViewHolder
import com.gh.gamecenter.collection.GamesCollectionFragment.Companion.TYPE_USER
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler
import com.gh.gamecenter.collection.GamesCollectionFragment.Companion.TYPE_USER
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.core.utils.TimeUtils
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.ItemGameCollectionFlexTagBinding
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
import com.gh.gamecenter.entity.GamesCollectionEntity
import com.gh.gamecenter.entity.TagInfoEntity
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity
@ -402,146 +398,26 @@ class GamesCollectionAdapter(
}
private fun dealOption(content: String, entity: GamesCollectionEntity) {
val path = when (mViewModel.type) {
GamesCollectionFragment.TYPE_COLLECT -> "我的收藏"
GamesCollectionFragment.TYPE_HISTORY -> "浏览记录"
GamesCollectionFragment.TYPE_USER -> "个人主页"
else -> ""
}
when (content) {
"编辑" -> {
mContext.startActivity(GameCollectionEditActivity.getIntent(mContext, entity, path = path))
mContext.startActivity(GameCollectionEditActivity.getIntent(mContext, entity))
}
"投稿" -> {
SensorsBridge.trackEvent("GameCollectContributeClick", json {
"source_entrance" to path
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
if ((entity.count?.game ?: 0) >= 8) {
SensorsBridge.trackEvent("GameCollectContributeConfirmDialogShow", json {
"source_entrance" to path
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
DialogHelper.showDialog(
mContext,
"温馨提示",
"投稿通过后,将自动关闭“仅自己可见”,所有用户都能浏览到游戏单,确定投稿?",
"确定",
"取消",
{
SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json {
"source_entrance" to path
"button_name" to "确定"
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
mViewModel.publishGameCollection(entity)
},
{
SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json {
"source_entrance" to path
"button_name" to "取消"
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
},
{
SensorsBridge.trackEvent("GameCollectContributeConfirmDialogClick", json {
"source_entrance" to path
"button_name" to "关闭弹窗"
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
DialogHelper.showDialog(mContext, "温馨提示", "投稿通过后,将自动关闭“仅自己可见”,所有用户都能浏览到游戏单,确定投稿?", "确定", "取消", {
mViewModel.publishGameCollection(entity)
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
} else {
SensorsBridge.trackEvent("GameCollectContributeGameLackDialogShow", json {
"source_entrance" to path
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
DialogHelper.showDialog(
mContext,
"温馨提示",
"游戏单需要收录至少8个游戏才可以投稿至游戏单广场哦~",
"添加游戏",
"我知道了",
{
SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json {
"source_entrance" to path
"button_name" to "添加游戏"
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
mContext.startActivity(GameCollectionEditActivity.getIntent(mContext, entity, path = path))
},
{
SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json {
"source_entrance" to path
"button_name" to "我知道了"
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
},
{
SensorsBridge.trackEvent("GameCollectContributeGameLackDialogClick", json {
"source_entrance" to path
"button_name" to "关闭弹窗"
"game_num" to entity.count?.game
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
},
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
)
DialogHelper.showDialog(mContext, "温馨提示", "游戏单需要收录至少8个游戏才可以投稿至游戏单广场哦~", "添加游戏", "我知道了", {
mContext.startActivity(GameCollectionEditActivity.getIntent(mContext, entity))
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
}
"删除" -> {
SensorsBridge.trackEvent("GameCollectDeleteClick", json {
"source_entrance" to path
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
SensorsBridge.trackEvent("GameCollectDeleteDialogShow", json {
"source_entrance" to path
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
DialogHelper.showDialog(mContext, "温馨提示", "游戏单删除后将无法恢复,是否确认删除", "确定", "取消", {
SensorsBridge.trackEvent("GameCollectDeleteDialogClick", json {
"source_entrance" to path
"button_name" to "确定"
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
mViewModel.deleteGameCollection(entity)
}, {
SensorsBridge.trackEvent("GameCollectDeleteDialogClick", json {
"source_entrance" to path
"button_name" to "取消"
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
}, {
SensorsBridge.trackEvent("GameCollectDeleteDialogClick", json {
"source_entrance" to path
"button_name" to "关闭弹窗"
"game_collect_title" to entity.title
"game_collect_id" to entity.id
})
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
}

View File

@ -4,22 +4,20 @@ import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import com.gh.common.exposure.ExposureListener
import com.gh.gamecenter.common.constant.EntranceConsts.*
import com.gh.gamecenter.common.view.SpacingItemDecoration
import com.gh.gamecenter.R
import com.gh.gamecenter.common.baselist.ListFragment
import com.gh.gamecenter.common.baselist.LoadType
import com.gh.gamecenter.common.constant.EntranceConsts.*
import com.gh.gamecenter.common.eventbus.EBReuse
import com.gh.gamecenter.common.json.json
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.common.view.SpacingItemDecoration
import com.gh.gamecenter.entity.GamesCollectionEntity
import com.gh.gamecenter.history.IBatchDelete
import com.gh.gamecenter.history.ManageOption
import com.gh.gamecenter.common.eventbus.EBReuse
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import com.gh.gamecenter.history.IBatchDelete
import com.gh.gamecenter.history.ManageOption
class GamesCollectionFragment : ListFragment<GamesCollectionEntity, GamesCollectionViewModel>(), IBatchDelete {
@ -78,19 +76,6 @@ class GamesCollectionFragment : ListFragment<GamesCollectionEntity, GamesCollect
mListViewModel.publishLiveData.observe(viewLifecycleOwner) {
mListViewModel.load(LoadType.REFRESH)
val path = when (mType) {
TYPE_COLLECT -> "我的收藏"
TYPE_HISTORY -> "浏览记录"
TYPE_USER -> "个人主页"
else -> ""
}
SensorsBridge.trackEvent("GameCollectContributeSuccess", json {
"source_entrance" to path
"game_num" to it.count?.game
"game_collect_title" to it.title
"game_collect_id" to it.id
})
}
mListRv.addOnScrollListener(ExposureListener(this, provideListAdapter()))

View File

@ -8,6 +8,7 @@ import com.gh.gamecenter.common.base.activity.ToolBarActivity
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.updateStatusBarColor
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import java.util.ArrayList
/**

View File

@ -21,7 +21,6 @@ import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.StringUtils
@ -36,6 +35,7 @@ import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.gh.gamecenter.fragment.MainWrapperFragment

View File

@ -25,7 +25,6 @@ import com.gh.gamecenter.common.baselist.LazyListFragment
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.SPUtils
@ -35,6 +34,7 @@ import com.gh.gamecenter.databinding.LayoutPopupDiscoveryDislikeBinding
import com.gh.gamecenter.eventbus.EBDiscoverChanged
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.google.android.flexbox.FlexboxLayout
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity

View File

@ -18,17 +18,16 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout
import com.gh.gamecenter.common.databinding.FragmentDownloadBinding
import com.gh.gamecenter.common.eventbus.EBMiPush
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.common.utils.visibleIf
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.TabItemDownloadNumberBinding
import com.gh.gamecenter.entity.HomePluggableFilterEntity
import com.gh.gamecenter.feature.entity.PluginLocation
import com.gh.gamecenter.eventbus.EBDownloadChanged
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.eventbus.EBUISwitch
import com.gh.gamecenter.feature.entity.PluginLocation
import com.gh.gamecenter.manager.PackagesManager
import com.lightgame.download.DownloadStatus
import org.greenrobot.eventbus.EventBus
@ -52,8 +51,6 @@ class DownloadFragment : BaseFragment_TabLayout() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
SensorsBridge.trackDownloadManagerEnter()
mPermanentInactivePluggableApkList = HomePluggableHelper.getPermanentInactivePluggablePackage()
}
@ -148,8 +145,6 @@ class DownloadFragment : BaseFragment_TabLayout() {
override fun onPageSelected(index: Int) {
EventBus.getDefault().post(EBUISwitch(DownloadManagerActivity.TAG, index))
SensorsBridge.trackDownloadManagerTabSelect(mTabTitleList[index])
if (index == INDEX_UPDATE) {
mIsUpdateTabHasBeenSelected = true
updateUpdateHint()
@ -264,7 +259,6 @@ class DownloadFragment : BaseFragment_TabLayout() {
const val INDEX_UPDATE = 1
const val KEY_PATH_OF_PACKAGE_TO_INSTALL = "key_path_of_package_to_install"
const val KEY_URL_OF_PACKAGE_TO_INSTALL = "key_url_of_package_to_install"
}
}

View File

@ -222,10 +222,6 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
protected void initView(View view) {
super.initView(view);
String path = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_PATH);
String gameId = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_GAME_ID);
String gameName = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_GAME_NAME);
String gameType = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_GAME_TYPE);
String platform = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_PLATFORM);
String pluginDesc = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_PLUGIN_DESC);
url = getActivity().getIntent().getStringExtra(EntranceConsts.KEY_URL);
@ -302,7 +298,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
});
if (path != null) {
adapter.showPluginDialog(path, pluginDesc, gameId, gameName, gameType, platform);
adapter.showPluginDialog(path, pluginDesc);
}
mBinding.downloadmanagerTvAllstart.setOnClickListener(this);
}
@ -348,14 +344,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
public void onEventMainThread(EBMiPush mipush) {
if ("plugin_install".equals(mipush.getFrom())) {
DownloadEntity downloadEntity = (DownloadEntity) mipush.getObj();
adapter.showPluginDialog(
downloadEntity.getPath(),
downloadEntity.getPluginDesc(),
downloadEntity.getGameId(),
downloadEntity.getName(),
ExtensionsKt.getCategoryChinese(downloadEntity),
downloadEntity.getPlatform()
);
adapter.showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
}
}

View File

@ -17,7 +17,11 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageLauncher;
import com.gh.common.util.PackageUtils;
import com.gh.common.xapk.XapkDialogHelper;
import com.gh.gamecenter.common.entity.IconFloat;
import com.gh.gamecenter.feature.utils.PlatformUtils;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.common.xapk.XapkInstaller;
import com.gh.common.xapk.XapkUnzipStatus;
import com.gh.download.DownloadManager;
@ -25,20 +29,15 @@ import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.DownloadHeadViewHolder;
import com.gh.gamecenter.adapter.viewholder.GameDownloadViewHolder;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.entity.IconFloat;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.gamecenter.common.utils.NetworkUtils;
import com.gh.gamecenter.common.utils.NewFlatLogUtils;
import com.gh.gamecenter.common.utils.PermissionHelper;
import com.gh.gamecenter.common.utils.SensorsBridge;
import com.gh.gamecenter.core.utils.SpeedUtils;
import com.gh.gamecenter.databinding.DownloadmanagerItemHeadBinding;
import com.gh.gamecenter.databinding.FmDownloadmanagerItemBinding;
import com.gh.gamecenter.eventbus.EBDownloadChanged;
import com.gh.gamecenter.feature.utils.PlatformUtils;
import com.gh.gamecenter.feature.view.DownloadButton;
import com.gh.gamecenter.manager.PackagesManager;
import com.lightgame.adapter.BaseRecyclerAdapter;
import com.lightgame.download.DownloadConfig;
@ -279,43 +278,20 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
return;
} else if (XapkUnzipStatus.FAILURE.name().equals(currentXApkStatus)
|| XapkUnzipStatus.SUCCESS.name().equals(currentXApkStatus)) {
PermissionHelper.checkStoragePermissionBeforeAction(
mContext,
downloadEntity.getGameId(),
downloadEntity.getName(),
ExtensionsKt.getCategoryChinese(downloadEntity),
() -> {
final String path = downloadEntity.getPath();
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
showPluginDialog(
downloadEntity.getPath(),
downloadEntity.getPluginDesc(),
downloadEntity.getGameId(),
downloadEntity.getName(),
ExtensionsKt.getGameCategory(downloadEntity),
downloadEntity.getPlatform()
);
} else {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
removeDownload(downloadEntity);
} else {
NewFlatLogUtils.INSTANCE.logGameInstall(
downloadEntity.getGameId(),
downloadEntity.getName(),
"主动安装"
);
SensorsBridge.trackInstallGameClick(
downloadEntity.getGameId(),
downloadEntity.getName(),
"主动安装"
);
PackageInstaller.install(mContext, downloadEntity);
}
}
});
PermissionHelper.checkStoragePermissionBeforeAction(mContext, () -> {
final String path = downloadEntity.getPath();
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
} else {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
removeDownload(downloadEntity);
} else {
PackageInstaller.install(mContext, downloadEntity);
}
}
});
return;
}
@ -324,75 +300,47 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
case timeout:
case neterror:
case subscribe:
PermissionHelper.checkStoragePermissionBeforeAction(
mContext,
downloadEntity.getGameId(),
downloadEntity.getName(),
ExtensionsKt.getCategoryChinese(downloadEntity),
() -> {
// 下载管理不用判断是否大于50M
DialogUtils.checkDownload(mContext, Float.toString(100F), downloadEntity.getGameId(), downloadEntity.getName(), ExtensionsKt.getGameCategory(downloadEntity), isSubscribe -> {
if (isSubscribe) {
DownloadManager.getInstance().subscribe(downloadEntity);
statusMap.put(url, DownloadStatus.subscribe.getStatus());
notifyItemChanged(mDownloadedList.isEmpty() ? 0 : 1 + mDownloadedList
.size());
} else {
viewHolder.binding.dmItemTvSpeed.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font));
viewHolder.binding.dmItemTvSpeed.setText(String.format("%s(剩%s)",
SpeedUtils.getSpeed(downloadEntity.getSpeed()),
SpeedUtils.getRemainTime(downloadEntity.getSize(),
downloadEntity.getProgress(), downloadEntity.getSpeed() * 1024)));
viewHolder.binding.dmItemTvStartorpause.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
viewHolder.binding.dmItemTvStartorpause.setText(downloadEntity.getPercent() + "%");
viewHolder.binding.dmItemTvStartorpause.setProgress((int) (downloadEntity.getPercent() * 10));
statusMap.put(url, DownloadStatus.downloading.getStatus());
notifyItemChanged(mDownloadedList.isEmpty() ? 0 : 1 + mDownloadedList
.size());
DownloadManager.getInstance().resume(downloadEntity, true);
}
});
});
PermissionHelper.checkStoragePermissionBeforeAction(mContext, () -> {
// 下载管理不用判断是否大于50M
DialogUtils.checkDownload(mContext, Float.toString(100F), downloadEntity.getGameId(), downloadEntity.getName(), isSubscribe -> {
if (isSubscribe) {
DownloadManager.getInstance().subscribe(downloadEntity);
statusMap.put(url, DownloadStatus.subscribe.getStatus());
notifyItemChanged(mDownloadedList.isEmpty() ? 0 : 1 + mDownloadedList
.size());
} else {
viewHolder.binding.dmItemTvSpeed.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font));
viewHolder.binding.dmItemTvSpeed.setText(String.format("%s(剩%s)",
SpeedUtils.getSpeed(downloadEntity.getSpeed()),
SpeedUtils.getRemainTime(downloadEntity.getSize(),
downloadEntity.getProgress(), downloadEntity.getSpeed() * 1024)));
viewHolder.binding.dmItemTvStartorpause.setButtonStyle(DownloadButton.ButtonStyle.DOWNLOADING_NORMAL);
viewHolder.binding.dmItemTvStartorpause.setText(downloadEntity.getPercent() + "%");
viewHolder.binding.dmItemTvStartorpause.setProgress((int) (downloadEntity.getPercent() * 10));
statusMap.put(url, DownloadStatus.downloading.getStatus());
notifyItemChanged(mDownloadedList.isEmpty() ? 0 : 1 + mDownloadedList
.size());
DownloadManager.getInstance().resume(downloadEntity, true);
}
});
});
break;
case done:
if (str.equals(mContext.getString(R.string.install))) {
PermissionHelper.checkStoragePermissionBeforeAction(
mContext,
downloadEntity.getGameId(),
downloadEntity.getName(),
ExtensionsKt.getCategoryChinese(downloadEntity),
() -> {
final String path = downloadEntity.getPath();
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
showPluginDialog(
downloadEntity.getPath(),
downloadEntity.getPluginDesc(),
downloadEntity.getGameId(),
downloadEntity.getName(),
ExtensionsKt.getGameCategory(downloadEntity),
downloadEntity.getPlatform()
);
} else {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
removeDownload(downloadEntity);
} else {
NewFlatLogUtils.INSTANCE.logGameInstall(
downloadEntity.getGameId(),
downloadEntity.getName(),
"主动安装"
);
SensorsBridge.trackInstallGameClick(
downloadEntity.getGameId(),
downloadEntity.getName(),
"主动安装"
);
PackageInstaller.install(mContext, downloadEntity);
}
}
});
PermissionHelper.checkStoragePermissionBeforeAction(mContext, () -> {
final String path = downloadEntity.getPath();
if (downloadEntity.isPluggable()
&& PackagesManager.isInstalled(downloadEntity.getPackageName())) {
showPluginDialog(downloadEntity.getPath(), downloadEntity.getPluginDesc());
} else {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
removeDownload(downloadEntity);
} else {
PackageInstaller.install(mContext, downloadEntity);
}
}
});
} else if (str.equals(mContext.getString(R.string.launch))) {
PackageLauncher.launchApp(mContext, null, downloadEntity.getPackageName());
}
@ -529,15 +477,8 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
// 显示插件化
void showPluginDialog(
final String path,
final String pluginDesc,
final String gameId,
final String gameName,
final String gameType,
final String platform
) {
DialogHelper.showPluginDialog(mContext, pluginDesc, gameId, gameName, gameType, platform, () -> {
void showPluginDialog(final String path, final String pluginDesc) {
DialogHelper.showPluginDialog(mContext, pluginDesc, () -> {
if (FileUtils.isEmptyFile(path)) {
Utils.toast(mContext, R.string.install_failure_hint);
} else {

View File

@ -8,7 +8,10 @@ import androidx.core.graphics.drawable.toBitmap
import androidx.core.graphics.drawable.toDrawable
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.common.exposure.IExposable
import com.gh.common.simulator.SimulatorGameManager.isSimulatorGame
import com.gh.common.util.*
@ -16,13 +19,10 @@ import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.utils.putWidgetBusinessName
import com.gh.gamecenter.common.utils.safelyGetInRelease
import com.gh.gamecenter.feature.databinding.GameItemBinding
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureType
import com.gh.gamecenter.feature.utils.PlatformUtils
import com.gh.gamecenter.feature.game.GameItemViewHolder
import com.gh.gamecenter.manager.PackagesManager

View File

@ -9,24 +9,23 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.setPadding
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
import com.gh.gamecenter.feature.exposure.ExposureSource
import com.gh.common.exposure.IExposable
import com.gh.common.util.*
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.download.DownloadManager
import com.gh.download.dialog.DownloadDialog
import com.gh.gamecenter.DownloadManagerActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.exposure.ExposureSource
import com.gh.gamecenter.common.databinding.LayoutPopupContainerBinding
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.NewFlatLogUtils
import com.gh.gamecenter.common.view.BugFixedPopupWindow
import com.gh.gamecenter.core.utils.CurrentActivityHolder
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.entity.GameUpdateEntity
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.feature.exposure.ExposureEvent.Companion.createEvent
import com.gh.gamecenter.feature.view.DownloadButton
import com.gh.gamecenter.home.BlankDividerViewHolder
import com.gh.gamecenter.manager.PackagesManager
import com.lightgame.download.DownloadEntity
@ -383,17 +382,12 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
return@setOnClickListener
}
(CurrentActivityHolder.getCurrentActivity() as? FragmentActivity)?.checkStoragePermissionBeforeAction(
gameId = downloadEntity?.gameId ?: "",
gameName = downloadEntity?.name ?: "",
gameType = downloadEntity?.categoryChinese ?: ""
) {
(CurrentActivityHolder.getCurrentActivity() as? FragmentActivity)?.checkStoragePermissionBeforeAction {
DialogUtils.checkDownload(
updateBtn.context,
update.size,
downloadEntity?.gameId ?: "",
downloadEntity?.name ?: "",
downloadEntity?.categoryChinese ?: ""
downloadEntity?.name ?: ""
) { isSubscribe: Boolean ->
if (str.contains("")) {
if (update.pluggableCollection != null) {
@ -437,21 +431,10 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
updateBtn.progress = (downloadEntity.percent * 10).toInt()
}
} else if (updateBtn.context.getString(R.string.install) == str) {
val download = DownloadManager.getInstance()
.getDownloadEntityByUrl(update.url)
NewFlatLogUtils.logGameInstall(
download?.gameId ?: "",
download?.name ?: "",
"主动安装"
)
SensorsBridge.trackInstallGameClick(
download?.gameId ?: "",
download?.name ?: "",
"主动安装"
)
PackageInstaller.install(
updateBtn.context,
downloadEntity
DownloadManager.getInstance()
.getDownloadEntityByUrl(update.url)
)
} else {
if (downloadEntity != null) {

View File

@ -17,6 +17,7 @@ import com.gh.gamecenter.common.base.GlobalActivityManager.getLastPageEntity
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.utils.SensorsBridge.trackEvent
import com.gh.gamecenter.core.utils.GsonUtils.toJson
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.core.utils.UrlFilterUtils
@ -687,9 +688,8 @@ class UpdatableGameViewModel(
// 收集下载数据
DataCollectionUtils.uploadDownload(getApplication(), downloadEntity, "开始")
SensorsBridge.trackEventWithExposureSource(
trackEvent(
"DownloadProcessBegin",
event.source,
"game_id", update.id,
"game_name", update.name ?: "",
"game_type", update.categoryChinese,
@ -698,7 +698,7 @@ class UpdatableGameViewModel(
"page_business_id", getCurrentPageEntity().pageBusinessId,
"last_page_name", getLastPageEntity().pageName,
"last_page_id", getLastPageEntity().pageId,
"last_page_business_id", getLastPageEntity().pageBusinessId,
"last_page_business_id", getLastPageEntity().pageBusinessId
)
}

View File

@ -10,7 +10,6 @@ data class CommonCollectionEntity(
val name: String = "",
val type: String = "",
val style: String = "",
val more: Int = 0,
@SerializedName("home_page_style")
val homePageStyle: String = "horizontal_sliding", //首页样式 横排滑动horizontal_sliding 竖排一行两个1-2
@SerializedName("vertical_line")

View File

@ -1,7 +1,6 @@
package com.gh.gamecenter.entity
import android.os.Parcelable
import com.gh.gamecenter.feature.entity.WelcomeDialogEntity
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize

Some files were not shown because too many files have changed in this diff Show More