Compare commits
37 Commits
fix/va-som
...
fix/system
| Author | SHA1 | Date | |
|---|---|---|---|
| f75396d7ae | |||
| 72c3df7fa6 | |||
| 2d4920cfb0 | |||
| 2d30b97cca | |||
| 40346e3c9a | |||
| 7f601c856a | |||
| 6e56f2e3a0 | |||
| e2fbda1e4c | |||
| 1e88ba8539 | |||
| 0f43b5610d | |||
| 04dcfbab2e | |||
| 8dd33cb599 | |||
| af5826962b | |||
| 9883f8d5c0 | |||
| 848207784e | |||
| fc294f9e7b | |||
| 96cd53a2c9 | |||
| 5458c93475 | |||
| 675d63c1d6 | |||
| 1040f5ff4d | |||
| 97be320529 | |||
| 0e086c9452 | |||
| 59cde4e2bf | |||
| cc0c7c7fae | |||
| 9e9ce6a84f | |||
| 7d0b500ff9 | |||
| 425456b263 | |||
| f6abab9a2d | |||
| d194f969e4 | |||
| 95f66344fb | |||
| 570e2fa9bc | |||
| 9e07080043 | |||
| e10a329159 | |||
| b3bc7b43f7 | |||
| 811d42457c | |||
| ac0b819ea9 | |||
| d931fb5940 |
@ -65,7 +65,7 @@ public class InstallUtils {
|
||||
if (!TextUtils.isEmpty(installVersion) && downloadEntity != null &&
|
||||
installVersion.equals(downloadEntity.getVersionName())) {
|
||||
if (!downloadEntity.isPluggable() || PackageUtils.isSignedByGh(context, packageName)) {
|
||||
EventBus.getDefault().post(new EBPackage(EBPackage.TYPE_INSTALLED, packageName, installVersion));
|
||||
EventBus.getDefault().post(new EBPackage(EBPackage.TYPE_INSTALLED, packageName, installVersion, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class InstallUtils {
|
||||
keys.add(packageName);
|
||||
} else if (!list.contains(packageName)) {
|
||||
keys.add(packageName);
|
||||
EventBus.getDefault().post(new EBPackage("卸载", packageName, ""));
|
||||
EventBus.getDefault().post(new EBPackage("卸载", packageName, "", false));
|
||||
}
|
||||
}
|
||||
for (String key : keys) {
|
||||
|
||||
@ -238,7 +238,7 @@ open class SearchActivity : BaseActivity() {
|
||||
GlobalActivityManager.getCurrentPageEntity().pageId,
|
||||
GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
key ?: "",
|
||||
TRACK_SEARCH_TYPE_DEFAULT,
|
||||
TRACK_SEARCH_TYPE_RANK,
|
||||
mSourceEntrance
|
||||
)
|
||||
}
|
||||
@ -433,12 +433,14 @@ open class SearchActivity : BaseActivity() {
|
||||
const val TRACK_SEARCH_TYPE_INPUT = "输入搜索"
|
||||
const val TRACK_SEARCH_TYPE_DEFAULT = "默认搜索"
|
||||
const val TRACK_SEARCH_TYPE_HISTORY = "历史搜索"
|
||||
const val TRACK_SEARCH_TYPE_RANK = "榜单搜索"
|
||||
|
||||
@JvmStatic
|
||||
fun toTrackSearchType(type: String) = when (type) {
|
||||
SearchType.AUTO.value -> TRACK_SEARCH_TYPE_AUTO
|
||||
SearchType.MANUAL.value -> TRACK_SEARCH_TYPE_INPUT
|
||||
SearchType.HISTORY.value -> TRACK_SEARCH_TYPE_HISTORY
|
||||
SearchType.RANK.value -> TRACK_SEARCH_TYPE_RANK
|
||||
else -> TRACK_SEARCH_TYPE_DEFAULT
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() {
|
||||
mViewModel.playedGames.observeNonNull(viewLifecycleOwner) {
|
||||
defaultViewModel?.isExistHotSearch = it.isNotEmpty()
|
||||
updateView()
|
||||
mBinding.searchDiscoveryList.run {
|
||||
mBinding.hotList.run {
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
adapter = AmwaySearchAdapter(context, mViewModel, "安利墙搜索-最近玩过").apply { setData(it) }
|
||||
}
|
||||
@ -43,7 +43,7 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() {
|
||||
|
||||
override fun initView() {
|
||||
mBinding = mAmwayBinding.searchContent
|
||||
mBinding.searchDiscoveryHeadContainer.headTitle.text = "最近玩过"
|
||||
mBinding.hotHeadContainer.headTitle.text = "最近玩过"
|
||||
mBinding.historyFlexContainer.setLimitHeight(mFlexMaxHeight)
|
||||
|
||||
updateHistorySearchView(null)
|
||||
|
||||
@ -309,7 +309,8 @@ class CategoryV2ListFragment : ListFragment<GameEntity, CategoryV2ListViewModel>
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
// 忽略首次初始化触发的事件
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,6 +161,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
|
||||
val showOnFailed = downloadManagerAd?.displayRule?.onFailedAction == "show"
|
||||
if ((showThirdPartyAd && thirdPartyAd != null) || (!showThirdPartyAd && thirdPartyAd != null && ownerAd == null)) {
|
||||
initThirdPartyAd(downloadManagerAd, thirdPartyAd) { isSuccess ->
|
||||
if (!isAdded) return@initThirdPartyAd
|
||||
mBinding.maskView.goneIf(!isSuccess)
|
||||
if (!isSuccess && ownerAd != null && showOnFailed) {
|
||||
mSlideInterval = ownerAd.adSource?.sliderInterval ?: -1
|
||||
@ -215,7 +216,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
|
||||
}
|
||||
|
||||
private fun initOwnerAd(adConfig: AdConfig) {
|
||||
if (adConfig.id.isEmpty()) return
|
||||
if (!isAdded || adConfig.id.isEmpty()) return
|
||||
mAdGameViewModel = viewModelProvider(AdGameViewModel.Factory(adConfig))
|
||||
initAdGameBanner(adConfig)
|
||||
mBinding.closeAdIv.setOnClickListener {
|
||||
@ -249,6 +250,7 @@ class DownloadFragment : BaseFragment_TabLayout() {
|
||||
adConfig.displayRule.onFailedAction == "show" && adConfig.thirdPartyAd != null) {
|
||||
// 自有广告游戏为空时,显示第三方广告
|
||||
initThirdPartyAd(adConfig, adConfig.thirdPartyAd) { isSuccess ->
|
||||
if (!isAdded) return@initThirdPartyAd
|
||||
mBinding.maskView.goneIf(!isSuccess)
|
||||
if (isSuccess) {
|
||||
SPUtils.setLong(Constants.SP_LAST_DOWNLOAD_MANAGER_AD_SHOW_TIME, System.currentTimeMillis())
|
||||
|
||||
@ -220,7 +220,7 @@ class NewInstalledGameFragment : ToolbarFragment() {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(packageEb: EBPackage) {
|
||||
if (packageEb.isInstalledOrUninstalled()) {
|
||||
if (!packageEb.fromInit && packageEb.isInstalledOrUninstalled()) {
|
||||
mInstallGameViewModel.initData(
|
||||
PackagesManager.filterSameApk(
|
||||
PackagesManager.filterDownloadBlackPackage(mPackageViewModel?.getGameInstalledLiveData()?.value as MutableList<GameInstall>?)
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
package com.gh.gamecenter.eventbus
|
||||
|
||||
class EBPackage(var type: String, var packageName: String, var versionName: String?) {
|
||||
/**
|
||||
* @param fromInit 实体生成是否来自于初始化
|
||||
*/
|
||||
class EBPackage(var type: String,
|
||||
var packageName: String,
|
||||
var versionName: String?,
|
||||
val fromInit: Boolean = false) {
|
||||
var gameId: String? = null
|
||||
var isVGame: Boolean = false // 是否是畅玩游戏
|
||||
|
||||
|
||||
@ -39,14 +39,14 @@ class ForumOrUserSearchDefaultFragment : SearchDefaultFragment() {
|
||||
|
||||
override fun initView() {
|
||||
mBinding = FragmentSearchDefaultBinding.bind(mCachedView)
|
||||
mBinding.searchDiscoveryTagHeadContainer.root.visibility = View.GONE
|
||||
mBinding.searchDiscoveryTagFlexContainer.visibility = View.GONE
|
||||
mBinding.hotTagHeadContainer.root.visibility = View.GONE
|
||||
mBinding.hotTagFlexContainer.visibility = View.GONE
|
||||
if (mEntrance == "论坛首页" || mEntrance == "搜索栏") {
|
||||
mBinding.searchDiscoveryHeadContainer.headTitle.text = "热门论坛"
|
||||
mBinding.hotHeadContainer.headTitle.text = "热门论坛"
|
||||
mViewModel.getForumSearchHotContent()
|
||||
} else {
|
||||
mBinding.searchDiscoveryHeadContainer.root.visibility = View.GONE
|
||||
mBinding.searchDiscoveryList.visibility = View.GONE
|
||||
mBinding.hotHeadContainer.root.visibility = View.GONE
|
||||
mBinding.hotList.visibility = View.GONE
|
||||
}
|
||||
val params = mBinding.historyHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams
|
||||
params.topMargin = 0.5f.dip2px()
|
||||
|
||||
@ -67,6 +67,8 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
|
||||
}
|
||||
|
||||
private fun showSubjectTab(linkEntityList: MutableList<LinkEntity>) {
|
||||
if (!isVisible) return
|
||||
|
||||
val subjectDataList = arrayListOf<SubjectData>()
|
||||
|
||||
for (link in linkEntityList) {
|
||||
|
||||
@ -968,7 +968,7 @@ class GameCollectionDetailFragment :
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
if (EBPackage.TYPE_INSTALLED == busFour.type
|
||||
&& UserManager.getInstance().isLoggedIn
|
||||
&& (mEntity?.count?.playedGame ?: 0) < (mEntity?.count?.game ?: 0)
|
||||
|
||||
@ -394,7 +394,7 @@ class SpecialDownloadDialogFragment : BaseDraggableDialogFragment() {
|
||||
SensorsBridge.trackDownloadComponentsContentClick(
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "unknown",
|
||||
gameSchemeType = gameEntity.gameBitChinese,
|
||||
gameSchemaType = gameEntity.gameBitChinese,
|
||||
downloadStatus = gameEntity.downloadStatusChinese,
|
||||
gameType = gameEntity.categoryChinese,
|
||||
downloadType = if (asVGame) "畅玩下载" else "本地下载",
|
||||
@ -405,7 +405,7 @@ class SpecialDownloadDialogFragment : BaseDraggableDialogFragment() {
|
||||
SensorsBridge.trackDownloadComponentsShow(
|
||||
gameId = gameEntity.id,
|
||||
gameName = gameEntity.name ?: "unknown",
|
||||
gameSchemeType = gameEntity.gameBitChinese,
|
||||
gameSchemaType = gameEntity.gameBitChinese,
|
||||
downloadStatus = gameEntity.downloadStatusChinese,
|
||||
gameType = gameEntity.categoryChinese,
|
||||
downloadType = if (asVGame) "畅玩下载" else "本地下载",
|
||||
|
||||
@ -123,8 +123,12 @@ abstract class BaseCustomViewHolder(
|
||||
_title.name = subject.name
|
||||
tvTitle.text = subject.name ?: ""
|
||||
}
|
||||
if (_title.rightText != subject.home) {
|
||||
_title.rightText = subject.home
|
||||
val home = subject.home ?: ""
|
||||
val homeText = subject.homeText ?: ""
|
||||
if (_title.rightHome != home || _title.rightText != homeText) {
|
||||
_title.rightHome = home
|
||||
_title.rightText = homeText
|
||||
|
||||
fun getHomeText(defaultResId: Int): String =
|
||||
if (subject.homeText.isNullOrBlank()) {
|
||||
defaultResId.toResString()
|
||||
@ -363,6 +367,7 @@ abstract class BaseCustomViewHolder(
|
||||
|
||||
data class TitleData(
|
||||
var name: String? = null,
|
||||
var rightHome: String? = null,
|
||||
var rightText: String? = null,
|
||||
var isRefresh: Boolean = false,
|
||||
var icon: String? = null,
|
||||
|
||||
@ -13,7 +13,7 @@ object HeadUpDisplayLogHelper {
|
||||
source = source,
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name
|
||||
@ -25,7 +25,7 @@ object HeadUpDisplayLogHelper {
|
||||
source = source,
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name
|
||||
@ -36,7 +36,7 @@ object HeadUpDisplayLogHelper {
|
||||
SensorsBridge.trackAutomaticInstallationPromptBarShow(
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name
|
||||
@ -47,7 +47,7 @@ object HeadUpDisplayLogHelper {
|
||||
SensorsBridge.trackAutomaticInstallationPromptBarClick(
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name
|
||||
|
||||
@ -119,7 +119,8 @@ object PackageRepository {
|
||||
packageKey = packageFilterManager.packageKey,
|
||||
filteredList = filteredList,
|
||||
isVGame = false,
|
||||
updateInstallStatus = true
|
||||
updateInstallStatus = true,
|
||||
fromInit = true
|
||||
)
|
||||
}
|
||||
},
|
||||
@ -256,13 +257,15 @@ object PackageRepository {
|
||||
* @param onWorkerThreadOnly 是否在工作线程执行
|
||||
* @param isVGame 包名列表是否为畅玩游戏
|
||||
* @param updateInstallStatus 更新安装状态 (通过 EventBus 来进行)
|
||||
* @param fromInit 是否来自数据首次初始化
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private fun loadInstalledGameDigestAndNotifyData(
|
||||
packageKey: String,
|
||||
filteredList: ArrayList<String>,
|
||||
isVGame: Boolean = false,
|
||||
updateInstallStatus: Boolean = false
|
||||
updateInstallStatus: Boolean = false,
|
||||
fromInit: Boolean = false
|
||||
) {
|
||||
var isNotifyUpdate = false
|
||||
val maxPageCount = (filteredList.size / PAGE_SIZE) + 1
|
||||
@ -291,7 +294,7 @@ object PackageRepository {
|
||||
|
||||
for (game in validGames) {
|
||||
val shouldNotifyChanges =
|
||||
validateGameAndPostChanges(gh_id, game, pkgName, isVGame, updateInstallStatus)
|
||||
validateGameAndPostChanges(gh_id, game, pkgName, isVGame, updateInstallStatus, fromInit)
|
||||
if (!isNotifyUpdate && shouldNotifyChanges) {
|
||||
isNotifyUpdate = true
|
||||
}
|
||||
@ -317,7 +320,8 @@ object PackageRepository {
|
||||
game: GameEntity,
|
||||
pkgName: String,
|
||||
isVGame: Boolean,
|
||||
updateInstallStatus: Boolean
|
||||
updateInstallStatus: Boolean,
|
||||
fromInit: Boolean = false
|
||||
): Boolean {
|
||||
if (ghId == null || ghId == game.id) {
|
||||
gameInstalled.add(GameInstall.transformGameInstall(game, pkgName, isVGame))
|
||||
@ -328,7 +332,7 @@ object PackageRepository {
|
||||
|
||||
if (updateInstallStatus) {
|
||||
EventBus.getDefault()
|
||||
.post(EBPackage(EBPackage.TYPE_INSTALLED, pkgName, game.getApk().firstOrNull()?.version))
|
||||
.post(EBPackage(EBPackage.TYPE_INSTALLED, pkgName, game.getApk().firstOrNull()?.version, fromInit))
|
||||
}
|
||||
|
||||
if (isCanUpdate || isCanPluggable) {
|
||||
|
||||
@ -72,7 +72,7 @@ public class PackageChangeBroadcastReceiver extends BroadcastReceiver {
|
||||
PackageHelper.refreshLocalPackageList();
|
||||
|
||||
String versionName = PackageUtils.getVersionNameByPackageName(packageName);
|
||||
EBPackage installEb = new EBPackage(EBPackage.TYPE_INSTALLED, packageName, versionName);
|
||||
EBPackage installEb = new EBPackage(EBPackage.TYPE_INSTALLED, packageName, versionName, false);
|
||||
if (PackageUtils.isAppOnForeground(context)) {
|
||||
PackageObserver.onPackageChanged(installEb, null);
|
||||
EventBus.getDefault().post(installEb);
|
||||
@ -102,7 +102,7 @@ public class PackageChangeBroadcastReceiver extends BroadcastReceiver {
|
||||
InstallUtils.getInstance().removeUninstall(packageName);
|
||||
PackageHelper.refreshLocalPackageList();
|
||||
|
||||
EBPackage uninstallEb = new EBPackage(EBPackage.TYPE_UNINSTALLED, packageName, "");
|
||||
EBPackage uninstallEb = new EBPackage(EBPackage.TYPE_UNINSTALLED, packageName, "", false);
|
||||
PackageObserver.onPackageChanged(uninstallEb, null);
|
||||
EventBus.getDefault().post(uninstallEb);
|
||||
if (webviewPackageName.equals(packageName)) {
|
||||
@ -118,7 +118,7 @@ public class PackageChangeBroadcastReceiver extends BroadcastReceiver {
|
||||
Utils.log(TAG, "替换了:" + packageName + "包名的程序");
|
||||
String versionName = PackageUtils.getVersionNameByPackageName(packageName);
|
||||
|
||||
EBPackage updateEb = new EBPackage(EBPackage.TYPE_REPLACED, packageName, versionName);
|
||||
EBPackage updateEb = new EBPackage(EBPackage.TYPE_REPLACED, packageName, versionName, false);
|
||||
EventBus.getDefault().post(updateEb);
|
||||
PackageObserver.onPackageChanged(updateEb, null);
|
||||
if (webviewPackageName.equals(packageName)) {
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
package com.gh.gamecenter.search
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Shader
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
@ -15,6 +18,7 @@ import androidx.viewpager.widget.PagerAdapter
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
import com.gh.common.filter.RegionSettingHelper
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
@ -31,7 +35,7 @@ import com.gh.gamecenter.databinding.TabItemSearchDefaultRankBinding
|
||||
import com.gh.gamecenter.db.ISearchHistoryDao
|
||||
import com.gh.gamecenter.db.SearchHistoryDao
|
||||
import com.gh.gamecenter.eventbus.EBSearch
|
||||
import com.gh.gamecenter.feature.entity.DiscoveryTagEntity
|
||||
import com.gh.gamecenter.feature.entity.HotTagEntity
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
@ -43,7 +47,7 @@ import org.json.JSONObject
|
||||
|
||||
open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
|
||||
private var mSearchDiscoveryTagList: List<DiscoveryTagEntity>? = null
|
||||
private var mHotTagList: List<HotTagEntity>? = null
|
||||
protected var mRankList: List<SettingsEntity.Search.RankList>? = null
|
||||
|
||||
protected lateinit var mBinding: FragmentSearchDefaultBinding
|
||||
@ -62,28 +66,28 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
|
||||
private val mDao by lazy { provideDao() }
|
||||
|
||||
private val mSearchDiscoveryTagClickListener: (Int) -> Unit = {
|
||||
val tag = mSearchDiscoveryTagList!![it]
|
||||
val keyword = tag.keyword
|
||||
if (keyword.isNotEmpty()) {
|
||||
PageSwitchDataHelper.pushCurrentPageData(
|
||||
hashMapOf(
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_TYPE, "游戏搜索-搜索发现"),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_ID, tag.id ?: ""),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_NAME, tag.text ?: " ")
|
||||
)
|
||||
private val mHotTagClickListener: (Int) -> Unit = {
|
||||
val tag = mHotTagList!![it]
|
||||
NewFlatLogUtils.logSearchHotTagClick(
|
||||
tag.name ?: "",
|
||||
tag.type ?: "",
|
||||
tag.link ?: "",
|
||||
tag.text ?: ""
|
||||
)
|
||||
DataLogUtils.uploadHotTagLog(context, tag.name)
|
||||
PageSwitchDataHelper.pushCurrentPageData(
|
||||
hashMapOf(
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_TYPE, "游戏搜索-热门标签"),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_ID, tag.id ?: ""),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_NAME, tag.name ?: " ")
|
||||
)
|
||||
SensorsBridge.trackEvent("SearchLabelClick", "label_name", tag.text ?: "", "label_id", tag.id ?: "")
|
||||
SensorsBridge.trackSearchDiscoveryClick(
|
||||
labelName = tag.text ?: "",
|
||||
labelId = tag.id ?: "",
|
||||
searchContent = keyword,
|
||||
position = it
|
||||
)
|
||||
mViewModel?.add(keyword)
|
||||
EventBus.getDefault().post(EBSearch("history", keyword))
|
||||
Util_System_Keyboard.hideSoftKeyboardByIBinder(context, mBinding.historyFlex.windowToken)
|
||||
}
|
||||
)
|
||||
SensorsBridge.trackEvent("SearchLabelClick", "label_name", tag.name ?: "", "label_id", tag.id ?: "")
|
||||
val exposureEvent = ExposureEvent.createEvent(
|
||||
null,
|
||||
source = listOf(ExposureSource("首页搜索", ""), ExposureSource("热门标签", tag.name ?: ""))
|
||||
)
|
||||
DirectUtils.directToLinkPage(requireContext(), tag, "(搜索-${tag.name})", "", exposureEvent) // 不需要path
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@ -136,20 +140,16 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
}
|
||||
mViewModel?.isExistRankList = mRankList?.isNotEmpty() == true
|
||||
|
||||
mSearchDiscoveryTagList = Config.getSettings()?.search?.discoveryTag
|
||||
mViewModel?.isExistSearchDiscoveryTag = mSearchDiscoveryTagList?.isNotEmpty() == true
|
||||
mHotTagList = Config.getSettings()?.search?.hotTag
|
||||
mViewModel?.isExistHotTag = mHotTagList?.isNotEmpty() == true
|
||||
|
||||
updateHistorySearchView(null)
|
||||
mViewModel?.historySearchLiveData?.observe(viewLifecycleOwner) {
|
||||
updateHistorySearchView(it)
|
||||
}
|
||||
|
||||
mBinding.searchDiscoveryTagFlexContainer.setLimitHeight(mFlexMaxHeight)
|
||||
createFlexContent(
|
||||
mBinding.searchDiscoveryTagFlex,
|
||||
getTagListString(),
|
||||
clickListener = mSearchDiscoveryTagClickListener
|
||||
)
|
||||
mBinding.hotTagFlexContainer.setLimitHeight(mFlexMaxHeight)
|
||||
createFlexContent(mBinding.hotTagFlex, getTagListString(), true, clickListener = mHotTagClickListener)
|
||||
initHeadView()
|
||||
initRankViewPager()
|
||||
}
|
||||
@ -178,12 +178,12 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
})
|
||||
}
|
||||
}
|
||||
mBinding.searchDiscoveryHeadContainer.headTitle.text = getString(R.string.search_hot)
|
||||
mBinding.searchDiscoveryHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.searchDiscoveryHeadContainer.headActionTv.visibility = View.GONE
|
||||
mBinding.searchDiscoveryTagHeadContainer.headTitle.text = getString(R.string.search_discovery_tag)
|
||||
mBinding.searchDiscoveryTagHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.searchDiscoveryTagHeadContainer.headActionTv.visibility = View.GONE
|
||||
mBinding.hotHeadContainer.headTitle.text = getString(R.string.search_hot)
|
||||
mBinding.hotHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.hotHeadContainer.headActionTv.visibility = View.GONE
|
||||
mBinding.hotTagHeadContainer.headTitle.text = getString(R.string.search_hot_tag)
|
||||
mBinding.hotTagHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.hotTagHeadContainer.headActionTv.visibility = View.GONE
|
||||
}
|
||||
|
||||
protected open fun initRankViewPager() {
|
||||
@ -318,8 +318,8 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
mBinding.historyHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE
|
||||
mBinding.historyFlex.visibility = if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE
|
||||
mBinding.searchDiscoveryTagHeadContainer.root.layoutParams =
|
||||
(mBinding.searchDiscoveryTagHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
mBinding.hotTagHeadContainer.root.layoutParams =
|
||||
(mBinding.hotTagHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
setMargins(
|
||||
0,
|
||||
if (mViewModel?.isExistHistory == true) 16F.dip2px() else 0,
|
||||
@ -327,22 +327,21 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
0
|
||||
)
|
||||
}
|
||||
mBinding.searchDiscoveryHeadContainer.root.layoutParams =
|
||||
(mBinding.searchDiscoveryHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
mBinding.hotHeadContainer.root.layoutParams =
|
||||
(mBinding.hotHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
setMargins(
|
||||
0,
|
||||
if (mViewModel?.isExistHistory == false && mViewModel?.isExistSearchDiscoveryTag == false) 16F.dip2px() else 0,
|
||||
if (mViewModel?.isExistHistory == false && mViewModel?.isExistHotTag == false) 16F.dip2px() else 0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
mBinding.searchDiscoveryTagHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistSearchDiscoveryTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.searchDiscoveryTagFlex.visibility =
|
||||
if (mViewModel?.isExistSearchDiscoveryTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.searchDiscoveryHeadContainer.root.visibility =
|
||||
mBinding.hotTagHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHotTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotTagFlex.visibility = if (mViewModel?.isExistHotTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE
|
||||
mBinding.searchDiscoveryList.visibility = if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotList.visibility = if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE
|
||||
mBinding.rankTabLayout.visibility = if (mViewModel?.isExistRankList == true) View.VISIBLE else View.GONE
|
||||
mBinding.rankTabIndicator.visibility = if (mViewModel?.isExistRankList == true) View.VISIBLE else View.GONE
|
||||
mBinding.rankViewPager.visibility = if (mViewModel?.isExistRankList == true) View.VISIBLE else View.GONE
|
||||
@ -364,9 +363,9 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
|
||||
private fun getTagListString(): List<String> {
|
||||
val list = ArrayList<String>()
|
||||
if (mSearchDiscoveryTagList != null) {
|
||||
for (entity in mSearchDiscoveryTagList!!) {
|
||||
entity.text?.let { list.add(it) }
|
||||
if (mHotTagList != null) {
|
||||
for (entity in mHotTagList!!) {
|
||||
entity.name?.let { list.add(it) }
|
||||
}
|
||||
}
|
||||
return list
|
||||
@ -375,6 +374,7 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
fun createFlexContent(
|
||||
flexView: FlexboxLayout,
|
||||
contentList: List<String>?,
|
||||
isHotTag: Boolean = false,
|
||||
clickListener: (Int) -> Unit
|
||||
) {
|
||||
|
||||
@ -388,12 +388,16 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
val params = FlexboxLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 24F.dip2px())
|
||||
flexCell.layoutParams = params
|
||||
|
||||
flexCell.setSingleLine()
|
||||
flexCell.ellipsize = TextUtils.TruncateAt.END
|
||||
flexCell.gravity = Gravity.CENTER
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(contentList[index], 6)
|
||||
flexCell.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
if (isHotTag && !mHotTagList.isNullOrEmpty() && mHotTagList!![index].isGuessSearch) {
|
||||
createSmartHotTagStyle(flexCell, contentList[index])
|
||||
} else {
|
||||
flexCell.setSingleLine()
|
||||
flexCell.ellipsize = TextUtils.TruncateAt.END
|
||||
flexCell.gravity = Gravity.CENTER
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(contentList[index], 6)
|
||||
flexCell.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
}
|
||||
flexCell.setPadding(8F.dip2px(), 0, 8F.dip2px(), 0)
|
||||
flexCell.background = if (mIsDarkModeOn) GradientDrawable().apply {
|
||||
setStroke(0.5F.dip2px(), Color.parseColor("#21FFFFFF"))
|
||||
@ -405,6 +409,30 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSmartHotTagStyle(flexCell: TextView, name: String) {
|
||||
flexCell.setDrawableStart(R.drawable.ic_smart_search)
|
||||
flexCell.compoundDrawablePadding = 4F.dip2px()
|
||||
flexCell.gravity = Gravity.CENTER_VERTICAL
|
||||
flexCell.typeface = Typeface.DEFAULT_BOLD
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(name, 6)
|
||||
flexCell.setTextColor(Color.WHITE)
|
||||
val colors =
|
||||
intArrayOf(com.gh.gamecenter.common.R.color.text_FFB749.toColor(requireContext()), com.gh.gamecenter.common.R.color.text_FF6D3C.toColor(requireContext()))
|
||||
val position = floatArrayOf(0F, 1F)
|
||||
val linearGradient = LinearGradient(
|
||||
0F,
|
||||
0F,
|
||||
flexCell.paint.textSize * flexCell.text.length,
|
||||
0F,
|
||||
colors,
|
||||
position,
|
||||
Shader.TileMode.CLAMP
|
||||
)
|
||||
flexCell.paint.shader = linearGradient
|
||||
flexCell.invalidate()
|
||||
}
|
||||
|
||||
private fun postExposureEvent(index: Int) {
|
||||
mRankList?.safelyGetInRelease(index)?.content?.forEach {
|
||||
if (it.link.type == "game") {
|
||||
@ -419,15 +447,11 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
super.onDarkModeChanged()
|
||||
initHeadView()
|
||||
mBinding.rootContainer.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_surface.toColor(requireContext()))
|
||||
mBinding.searchDiscoveryList.adapter?.run {
|
||||
mBinding.hotList.adapter?.run {
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
}
|
||||
mViewModel?.historySearchLiveData?.value?.let { updateHistorySearchView(it) }
|
||||
createFlexContent(
|
||||
mBinding.searchDiscoveryTagFlex,
|
||||
getTagListString(),
|
||||
clickListener = mSearchDiscoveryTagClickListener
|
||||
)
|
||||
createFlexContent(mBinding.hotTagFlex, getTagListString(), true, clickListener = mHotTagClickListener)
|
||||
}
|
||||
|
||||
protected open fun provideDao(): ISearchHistoryDao =
|
||||
|
||||
@ -11,7 +11,7 @@ class SearchDefaultViewModel(private val dao: ISearchHistoryDao) : ViewModel() {
|
||||
it
|
||||
}
|
||||
var isExistHotSearch: Boolean = false
|
||||
var isExistSearchDiscoveryTag: Boolean = false
|
||||
var isExistHotTag: Boolean = false
|
||||
var isExistHistory: Boolean = false
|
||||
var isExistRankList: Boolean = false
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ class SearchGameIndexFragment : ListFragment<GameEntity, SearchGameResultViewMod
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ class SearchGameResultAdapter(
|
||||
private val dao: ISearchHistoryDao,
|
||||
val listViewModel: SearchGameResultViewModel,
|
||||
val entrance: String,
|
||||
val type: String,
|
||||
var type: String,
|
||||
val sourceEntrance: String
|
||||
) : ListAdapter<SearchItemData>(context), IExposable {
|
||||
|
||||
|
||||
@ -376,6 +376,7 @@ open class SearchGameResultFragment : ListFragment<GameEntity, SearchGameResultV
|
||||
this.mKey = key
|
||||
this.mType = type
|
||||
mAdapter?.key = key
|
||||
mAdapter?.type = type
|
||||
mAdapter?.clearAdIdSet()
|
||||
mListViewModel?.updateSearchKeyWithType(key, type)
|
||||
mListViewModel?.clearSearchSubjects()
|
||||
@ -423,7 +424,7 @@ open class SearchGameResultFragment : ListFragment<GameEntity, SearchGameResultV
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@ package com.gh.gamecenter.search.viewmodel
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
|
||||
class SearchTabViewModel : ViewModel() {
|
||||
|
||||
@ -21,7 +21,8 @@ class SearchTabViewModel : ViewModel() {
|
||||
GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
location,
|
||||
searchKeyAndType.value?.first ?: "",
|
||||
searchKeyAndType.value?.second ?: "",
|
||||
searchKeyAndType.value?.let {
|
||||
SearchActivity.toTrackSearchType(it.second) } ?: "",
|
||||
text ?: "",
|
||||
position
|
||||
)
|
||||
|
||||
@ -207,7 +207,7 @@ open class SubjectListFragment : LazyListFragment<GameEntity, SubjectListViewMod
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ class TagsListFragment : ListFragment<GameEntity, TagsListViewModel>() {
|
||||
// 安装/卸载 事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(busFour: EBPackage) {
|
||||
if (busFour.isInstalledOrUninstalled()) {
|
||||
if (!busFour.fromInit && busFour.isInstalledOrUninstalled()) {
|
||||
mAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,9 @@ import com.gh.gamecenter.entity.DiverterEntity
|
||||
import com.gh.gamecenter.entity.MultiTabNav
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
@ -59,10 +62,13 @@ class MainWrapperRepository {
|
||||
private val mTabSelectEventFlow = MutableSharedFlow<MainSelectedEvent>()
|
||||
val tabSelectEventFlow = mTabSelectEventFlow as SharedFlow<MainSelectedEvent>
|
||||
|
||||
private var mDisposable: Disposable? = null
|
||||
private var mCheckGidCount = 0
|
||||
|
||||
fun init() {
|
||||
// 若 timeout 后数据未加载完成,则即便还没有回调也使用默认数据生成底部 tab
|
||||
emitDefaultTabDataAfterTimeout()
|
||||
getBypassList()
|
||||
checkGidAndGetBypassList()
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,8 +155,33 @@ class MainWrapperRepository {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkGidAndGetBypassList() {
|
||||
if (HaloApp.getInstance().gid.isNullOrEmpty()) {
|
||||
stopCheckGid()
|
||||
mDisposable = Observable.interval(100, TimeUnit.MILLISECONDS)
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.subscribe({
|
||||
mCheckGidCount++
|
||||
if (!HaloApp.getInstance().gid.isNullOrEmpty() || mCheckGidCount >= CHECK_GID_MAX_COUNT) {
|
||||
stopCheckGid()
|
||||
getBypassList()
|
||||
}
|
||||
}, {
|
||||
stopCheckGid()
|
||||
})
|
||||
} else {
|
||||
getBypassList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopCheckGid() {
|
||||
mDisposable?.dispose()
|
||||
mDisposable = null
|
||||
mCheckGidCount = 0
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun getBypassList() {
|
||||
private fun getBypassList() {
|
||||
val isInstallFirstAccess = TimeUtils.isToday(SPUtils.getLong(Constants.SP_BRAND_NEW_FIRST_LAUNCH_TIME) / 1000).toString()
|
||||
mNewApi.getDiverterList(isInstallFirstAccess, BYPASS_TYPE_BOTTOM_TAB)
|
||||
.subscribeOn(Schedulers.computation())
|
||||
@ -294,6 +325,7 @@ class MainWrapperRepository {
|
||||
|
||||
companion object : SingletonHolder<MainWrapperRepository>({ MainWrapperRepository() }) {
|
||||
private const val BYPASS_TIME_OUT = 1000L
|
||||
private const val CHECK_GID_MAX_COUNT = 5
|
||||
const val BYPASS_TYPE_BOTTOM_TAB = "bottom_tab"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.gh.ndownload.suspendwindow
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.app.Application.ActivityLifecycleCallbacks
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.core.view.ViewCompat
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
@ -128,7 +127,7 @@ class NDownloadDrawOverlayPermissionWindowController(val application: Applicatio
|
||||
SensorsBridge.trackDownloadSuspendedWindowGuideShow(
|
||||
gameId = downloadEntity.gameId,
|
||||
gameName = downloadEntity.name,
|
||||
gameSchemeType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
|
||||
gameType = downloadEntity.categoryChinese,
|
||||
downloadStatus = downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
|
||||
downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载"
|
||||
|
||||
@ -48,10 +48,17 @@ abstract class NDownloadSuspendWindow<T : View>(
|
||||
|
||||
fun attach() {
|
||||
if (!isAttached) {
|
||||
_isAttached = true
|
||||
windowManager.addView(root, layoutParams)
|
||||
context.registerComponentCallbacks(this)
|
||||
onAttach()
|
||||
try {
|
||||
_isAttached = true
|
||||
windowManager.addView(root, layoutParams)
|
||||
context.registerComponentCallbacks(this)
|
||||
onAttach()
|
||||
} catch (e: Throwable) {
|
||||
// 处理“Unable to add window android.view.ViewRootImpl$W@7bc9502 -- permission denied for window type 2038”的异常
|
||||
// 目前Sentry上仅Z10型号的手机报这个错误(Android 8.1.0),这里明明已经授予了SYSTEM_ALERT_WINDOW权限,但是就是会抛异常= =,只能暴力捕获处理了。。。
|
||||
// 相关异常的链接:https://sentry.shanqu.cc/organizations/lightgame/issues/407275/?project=22
|
||||
_isAttached = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
app/src/main/res/drawable-xxxhdpi/ic_smart_search.webp
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_smart_search.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@ -36,7 +36,7 @@
|
||||
</com.gh.gamecenter.common.view.LimitHeightLinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/searchDiscoveryTagHeadContainer"
|
||||
android:id="@+id/hotTagHeadContainer"
|
||||
layout="@layout/layout_subject_head"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
@ -45,14 +45,14 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/history_flex_container" />
|
||||
|
||||
<com.gh.gamecenter.common.view.LimitHeightLinearLayout
|
||||
android:id="@+id/search_discovery_tag_flex_container"
|
||||
android:id="@+id/hot_tag_flex_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/ui_surface"
|
||||
app:layout_constraintTop_toBottomOf="@id/searchDiscoveryTagHeadContainer">
|
||||
app:layout_constraintTop_toBottomOf="@id/hotTagHeadContainer">
|
||||
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
android:id="@+id/search_discovery_tag_flex"
|
||||
android:id="@+id/hot_tag_flex"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="16dp"
|
||||
@ -62,21 +62,21 @@
|
||||
</com.gh.gamecenter.common.view.LimitHeightLinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/searchDiscoveryHeadContainer"
|
||||
android:id="@+id/hotHeadContainer"
|
||||
layout="@layout/layout_subject_head"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/search_discovery_tag_flex_container" />
|
||||
app:layout_constraintTop_toBottomOf="@id/hot_tag_flex_container" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/search_discovery_list"
|
||||
android:id="@+id/hot_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintTop_toBottomOf="@+id/searchDiscoveryHeadContainer" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/hotHeadContainer" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/rankTabLayout"
|
||||
@ -91,7 +91,7 @@
|
||||
app:tabMode="scrollable"
|
||||
app:tabIndicator="@null"
|
||||
app:tabRippleColor="@color/transparent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_discovery_list"
|
||||
app:layout_constraintTop_toBottomOf="@+id/hot_list"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<string name="download_startall">全部開始</string>
|
||||
<string name="search_searching">搜索中...</string>
|
||||
<string name="search_hot">熱門搜索</string>
|
||||
<string name="search_discovery_tag">搜索發現</string>
|
||||
<string name="search_hot_tag">熱門標簽</string>
|
||||
<string name="search_history">歷史搜索</string>
|
||||
<string name="news_concenrn_game_mine">我關註的遊戲</string>
|
||||
<string name="news_search_input">請輸入搜索關鍵字</string>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<string name="download_startall">全部开始</string>
|
||||
<string name="search_searching">搜索中...</string>
|
||||
<string name="search_hot">热门搜索</string>
|
||||
<string name="search_discovery_tag">搜索发现</string>
|
||||
<string name="search_hot_tag">热门标签</string>
|
||||
<string name="search_history">历史搜索</string>
|
||||
<string name="news_concenrn_game_mine">我关注的游戏</string>
|
||||
<string name="news_search_input">请输入搜索关键字</string>
|
||||
|
||||
@ -17,8 +17,8 @@ buildscript {
|
||||
password("u9gZYH4MQEwLLQZK")
|
||||
}
|
||||
}
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url "https://maven.google.com" }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -41,7 +41,6 @@ allprojects {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/central'}
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/releases/' }
|
||||
@ -55,6 +54,7 @@ allprojects {
|
||||
// 配置HMS Core SDK的Maven仓地址。
|
||||
maven { url 'https://developer.huawei.com/repo/' }
|
||||
maven { url 'https://developer.hihonor.com/repo' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
task clean(type: Delete) {
|
||||
|
||||
@ -18,6 +18,7 @@ object NewLogUtils {
|
||||
private const val KEY_CONTENT_ID = "content_id"
|
||||
private const val KEY_CONTENT_TITLE = "content_title"
|
||||
private const val KEY_HELP_ID = "help_id"
|
||||
private const val KEY_QA_COLLECTION = "qa_collection"
|
||||
private const val KEY_SEARCH_KEY = "search_key"
|
||||
|
||||
private fun log(jsonObject: JSONObject, logStore: String = "event", uploadImmediately: Boolean = false) {
|
||||
@ -53,10 +54,11 @@ object NewLogUtils {
|
||||
}
|
||||
|
||||
//点击QA更多
|
||||
fun logClickQaMoreBtn(helpId: String) {
|
||||
fun logClickQaMoreBtn(helpId: String, qaCollection: String) {
|
||||
val json = json {
|
||||
KEY_EVENT to "qa_click_title_more"
|
||||
KEY_HELP_ID to helpId
|
||||
KEY_QA_COLLECTION to qaCollection
|
||||
KEY_META to LogUtils.getMetaObject()
|
||||
KEY_LAUNCH_ID to Tracker.launchId
|
||||
KEY_SESSION_ID to Tracker.sessionId
|
||||
|
||||
@ -209,9 +209,7 @@ class HelpAndFeedbackFragment : BaseLazyFragment() {
|
||||
mViewModel.selectedCategory.name == HelpAndFeedbackViewModel.MY_RELATED_QA_NAME
|
||||
)
|
||||
)
|
||||
if (mViewModel.selectedCategory.id.isNotEmpty()) {
|
||||
NewLogUtils.logClickQaMoreBtn(mViewModel.selectedCategory.id)
|
||||
}
|
||||
NewLogUtils.logClickQaMoreBtn(mViewModel.selectedCategory.id, mViewModel.selectedCategory.name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ class HelpContentAdapter(
|
||||
context: Context,
|
||||
private val mFragment: HelpContentFragment,
|
||||
private val mViewModel: NormalListViewModel<HelpEntity>,
|
||||
private val mQaId: String?,
|
||||
private val mIsFromHelpAndFeedback: Boolean,
|
||||
private val mQaCollectionId: String?,
|
||||
private val mNavigationTitle: String,
|
||||
private val searchType: String,
|
||||
@ -103,7 +103,7 @@ class HelpContentAdapter(
|
||||
)
|
||||
} else {
|
||||
NewLogUtils.logEnterQaContent(
|
||||
"其他位置",
|
||||
if (mIsFromHelpAndFeedback) "帮助与反馈" else "其他位置",
|
||||
entity.id,
|
||||
HtmlUtils.filterHtmlLabel(entity.title),
|
||||
entity.helpId,
|
||||
|
||||
@ -60,7 +60,7 @@ class HelpContentFragment : ListFragment<HelpEntity, NormalListViewModel<HelpEnt
|
||||
requireContext(),
|
||||
this,
|
||||
mListViewModel,
|
||||
mQaId,
|
||||
!mCategoryId.isNullOrEmpty() || mIsMyRelatedQA,
|
||||
mQaCollectionId,
|
||||
mNavigationTitle,
|
||||
mSearchType,
|
||||
|
||||
@ -61,7 +61,7 @@ class HelpQaCategoryAdapter(val context: Context, private val mQaCollectionId: S
|
||||
} else {
|
||||
MtaHelper.onEvent("意见反馈", "使用帮助点击", "点击更多+${helpCategoryEntity.name}")
|
||||
}
|
||||
NewLogUtils.logClickQaMoreBtn(helpCategoryEntity.id)
|
||||
NewLogUtils.logClickQaMoreBtn(helpCategoryEntity.id, helpCategoryEntity.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ object SensorsBridge {
|
||||
private const val KEY_LAST_PAGE_BUSINESS_ID = "last_page_business_id"
|
||||
private const val KEY_DOWNLOAD_STATUS = "download_status"
|
||||
private const val KEY_DOWNLOAD_TYPE = "download_type"
|
||||
private const val KEY_GAME_SCHEME_TYPE = "game_scheme_type"
|
||||
private const val KEY_GAME_SCHEMA_TYPE = "game_schema_type"
|
||||
private const val KEY_GAME_TYPE = "game_type"
|
||||
const val KEY_POSITION = "position"
|
||||
const val KEY_TAB_CONTENT = "tab_content"
|
||||
@ -88,8 +88,6 @@ object SensorsBridge {
|
||||
private const val KEY_VERIFICATION_TYPE = "verification_type"
|
||||
private const val KEY_VIDEO_ID = "video_id"
|
||||
private const val KEY_PLAY_TYPE = "play_type"
|
||||
private const val KEY_LABEL_NAME = "label_name"
|
||||
private const val KEY_LABEL_ID = "label_id"
|
||||
const val KEY_BOTTOM_TAB = "bottom_tab"
|
||||
const val KEY_MULTI_TAB_NAME = "several_tab_page_name"
|
||||
const val KEY_MULTI_TAB_ID = "several_tab_page_id"
|
||||
@ -293,8 +291,6 @@ object SensorsBridge {
|
||||
|
||||
private const val EVENT_COLUMN_TEST_CLICK = "ColumnTestClick"
|
||||
|
||||
private const val EVENT_SEARCH_DISCOVERY_CLICK = "SearchDiscoveryClick"
|
||||
|
||||
private const val EVENT_BYPASS_BROWSING = "BypassBrowsing"
|
||||
private const val EVENT_FAIL_BYPASS = "FailBypass"
|
||||
|
||||
@ -4013,7 +4009,7 @@ object SensorsBridge {
|
||||
* 触发时机:当下载悬浮窗引导图展示时触发上报
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
* @param gameSchemeType 游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 游戏架构类型:64位/32位
|
||||
* @param downloadStatus 游戏下载状态
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param downloadType 实际下载方式:本地下载/畅玩下载
|
||||
@ -4022,7 +4018,7 @@ object SensorsBridge {
|
||||
fun trackDownloadSuspendedWindowGuideShow(
|
||||
gameId: String,
|
||||
gameName: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
downloadStatus: String,
|
||||
gameType: String,
|
||||
downloadType: String
|
||||
@ -4030,7 +4026,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
@ -4070,7 +4066,7 @@ object SensorsBridge {
|
||||
* @param source 来源:游戏下载\重启APP
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameSchemeType 所上报游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 所上报游戏架构类型:64位/32位
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
@ -4079,7 +4075,7 @@ object SensorsBridge {
|
||||
source: String,
|
||||
downloadType: String,
|
||||
downloadStatus: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
gameType: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
@ -4088,7 +4084,7 @@ object SensorsBridge {
|
||||
KEY_SOURCE to source
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -4103,7 +4099,7 @@ object SensorsBridge {
|
||||
* @param source 来源:游戏下载\重启APP
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameSchemeType 所上报游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 所上报游戏架构类型:64位/32位
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
@ -4112,7 +4108,7 @@ object SensorsBridge {
|
||||
source: String,
|
||||
downloadType: String,
|
||||
downloadStatus: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
gameType: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
@ -4121,7 +4117,7 @@ object SensorsBridge {
|
||||
KEY_SOURCE to source
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -4135,7 +4131,7 @@ object SensorsBridge {
|
||||
* 触发时机:触发自动下载提示条展示时上报
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameSchemeType 所上报游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 所上报游戏架构类型:64位/32位
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
@ -4143,7 +4139,7 @@ object SensorsBridge {
|
||||
fun trackAutomaticInstallationPromptBarShow(
|
||||
downloadType: String,
|
||||
downloadStatus: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
gameType: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
@ -4151,7 +4147,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -4165,7 +4161,7 @@ object SensorsBridge {
|
||||
* 触发时机:触发自动下载提示条点击时上报
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameSchemeType 所上报游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 所上报游戏架构类型:64位/32位
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
@ -4173,7 +4169,7 @@ object SensorsBridge {
|
||||
fun trackAutomaticInstallationPromptBarClick(
|
||||
downloadType: String,
|
||||
downloadStatus: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
gameType: String,
|
||||
gameId: String,
|
||||
gameName: String
|
||||
@ -4181,7 +4177,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
@ -4195,7 +4191,7 @@ object SensorsBridge {
|
||||
* 触发时机:下载组件展示时上报
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
* @param gameSchemeType 游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 游戏架构类型:64位/32位
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
@ -4203,7 +4199,7 @@ object SensorsBridge {
|
||||
fun trackDownloadComponentsShow(
|
||||
gameId: String,
|
||||
gameName: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
downloadStatus: String,
|
||||
gameType: String,
|
||||
downloadType: String,
|
||||
@ -4211,7 +4207,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
@ -4225,7 +4221,7 @@ object SensorsBridge {
|
||||
* 触发时机:下载组件点击时上报
|
||||
* @param gameId 游戏ID
|
||||
* @param gameName 游戏名称
|
||||
* @param gameSchemeType 游戏架构类型:64位/32位
|
||||
* @param gameSchemaType 游戏架构类型:64位/32位
|
||||
* @param downloadStatus 所上报游戏下载状态
|
||||
* @param gameType 游戏的类型:单机、网游等
|
||||
* @param downloadType 所上报游戏的实际下载方式:本地下载/畅玩下载
|
||||
@ -4235,7 +4231,7 @@ object SensorsBridge {
|
||||
fun trackDownloadComponentsContentClick(
|
||||
gameId: String,
|
||||
gameName: String,
|
||||
gameSchemeType: String,
|
||||
gameSchemaType: String,
|
||||
downloadStatus: String,
|
||||
gameType: String,
|
||||
downloadType: String,
|
||||
@ -4245,7 +4241,7 @@ object SensorsBridge {
|
||||
val json = json {
|
||||
KEY_GAME_ID to gameId
|
||||
KEY_GAME_NAME to gameName
|
||||
KEY_GAME_SCHEME_TYPE to gameSchemeType
|
||||
KEY_GAME_SCHEMA_TYPE to gameSchemaType
|
||||
KEY_DOWNLOAD_STATUS to downloadStatus
|
||||
KEY_GAME_TYPE to gameType
|
||||
KEY_DOWNLOAD_TYPE to downloadType
|
||||
@ -4339,31 +4335,6 @@ object SensorsBridge {
|
||||
trackEvent(EVENT_HALO_SELF_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件ID:SearchDiscoveryClick
|
||||
* 事件名称:搜索发现点击事件
|
||||
* 触发时机:点击搜索发现时触发
|
||||
* @param labelName 标签名称
|
||||
* @param labelId 标签ID
|
||||
* @param searchContent 搜索内容
|
||||
* @param position 序号
|
||||
* @see EVENT_SEARCH_DISCOVERY_CLICK
|
||||
*/
|
||||
fun trackSearchDiscoveryClick(
|
||||
labelName: String,
|
||||
labelId: String,
|
||||
searchContent: String,
|
||||
position: Int
|
||||
) {
|
||||
val json = json {
|
||||
KEY_LABEL_NAME to labelName
|
||||
KEY_LABEL_ID to labelId
|
||||
KEY_SEARCH_CONTENT to searchContent
|
||||
KEY_POSITION to position
|
||||
}
|
||||
trackEvent(EVENT_SEARCH_DISCOVERY_CLICK, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件ID:BypassBrowsing
|
||||
* 事件名称:分流器访问事件
|
||||
|
||||
@ -6,6 +6,8 @@ import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ProcessUtil {
|
||||
@ -20,13 +22,25 @@ public class ProcessUtil {
|
||||
return currentProcessName;
|
||||
}
|
||||
|
||||
//1)通过Application的API获取当前进程名
|
||||
//0)通过反射 ActivityThread 获取实例再获取当前进程名
|
||||
currentProcessName = getCurrentProcessNameByActivityThreadInstance();
|
||||
if (!TextUtils.isEmpty(currentProcessName)) {
|
||||
return currentProcessName;
|
||||
}
|
||||
|
||||
//1)通过 CMD 获取当前进程名
|
||||
currentProcessName = getCurrentProcessNameByCMD(android.os.Process.myPid());
|
||||
if (!TextUtils.isEmpty(currentProcessName)) {
|
||||
return currentProcessName;
|
||||
}
|
||||
|
||||
//2)通过 Application 的 API 获取当前进程名
|
||||
currentProcessName = getCurrentProcessNameByApplication();
|
||||
if (!TextUtils.isEmpty(currentProcessName)) {
|
||||
return currentProcessName;
|
||||
}
|
||||
|
||||
//2)通过反射ActivityThread获取当前进程名
|
||||
//3)通过反射 ActivityThread 获取当前进程名
|
||||
currentProcessName = getCurrentProcessNameByActivityThread();
|
||||
if (!TextUtils.isEmpty(currentProcessName)) {
|
||||
return currentProcessName;
|
||||
@ -38,7 +52,7 @@ public class ProcessUtil {
|
||||
/**
|
||||
* 通过Application新的API获取进程名,无需反射,无需IPC,效率最高。
|
||||
*/
|
||||
public static String getCurrentProcessNameByApplication() {
|
||||
private static String getCurrentProcessNameByApplication() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
return Application.getProcessName();
|
||||
}
|
||||
@ -48,7 +62,7 @@ public class ProcessUtil {
|
||||
/**
|
||||
* 通过反射ActivityThread获取进程名,避免了ipc
|
||||
*/
|
||||
public static String getCurrentProcessNameByActivityThread() {
|
||||
private static String getCurrentProcessNameByActivityThread() {
|
||||
String processName = null;
|
||||
try {
|
||||
final Method declaredMethod = Class.forName("android.app.ActivityThread", false, Application.class.getClassLoader())
|
||||
@ -64,4 +78,52 @@ public class ProcessUtil {
|
||||
return processName;
|
||||
}
|
||||
|
||||
private static String getCurrentProcessNameByActivityThreadInstance() {
|
||||
try {
|
||||
// Get ActivityThread class
|
||||
Class<?> activityThreadClass = Class.forName("android.app.ActivityThread",false, Application.class.getClassLoader());
|
||||
|
||||
// Get the current ActivityThread instance
|
||||
Method currentActivityThreadMethod = activityThreadClass.getDeclaredMethod("currentActivityThread");
|
||||
currentActivityThreadMethod.setAccessible(true);
|
||||
Object activityThread = currentActivityThreadMethod.invoke(null);
|
||||
|
||||
// Get the getProcessName method
|
||||
Method getProcessNameMethod = activityThreadClass.getDeclaredMethod("getProcessName");
|
||||
getProcessNameMethod.setAccessible(true);
|
||||
|
||||
// Call the getProcessName method
|
||||
return (String) getProcessNameMethod.invoke(activityThread);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getCurrentProcessNameByCMD(int pid) {
|
||||
//get from /proc/PID/cmdline
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
br = new BufferedReader(new FileReader("/proc/" + pid + "/cmdline"));
|
||||
String processName = br.readLine();
|
||||
if (!TextUtils.isEmpty(processName)) {
|
||||
processName = processName.trim();
|
||||
if (!TextUtils.isEmpty(processName)) {
|
||||
return processName; //OK
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
} finally {
|
||||
try {
|
||||
if (br != null) {
|
||||
br.close();
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
//failed
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package com.gh.gamecenter.feature.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class DiscoveryTagEntity(
|
||||
@SerializedName("_id")
|
||||
var id: String? = "",
|
||||
var text: String? = "",
|
||||
@SerializedName("keyword")
|
||||
var _keyword: String? = ""
|
||||
) : Parcelable {
|
||||
val keyword get(): String {
|
||||
val keyword = this._keyword
|
||||
if (keyword.isNullOrEmpty()) {
|
||||
return text ?: ""
|
||||
}
|
||||
return keyword
|
||||
}
|
||||
}
|
||||
@ -70,8 +70,6 @@ class SettingsEntity(
|
||||
var hotSearch: List<HotSearch>? = listOf(),
|
||||
@SerializedName("tag")
|
||||
var hotTag: List<HotTagEntity>? = listOf(),
|
||||
@SerializedName("discover_tag")
|
||||
var discoveryTag: List<DiscoveryTagEntity>? = listOf(),
|
||||
@SerializedName("hot_list")
|
||||
var rankList: List<RankList>? = listOf(),
|
||||
@SerializedName("wechat_game_search_list")
|
||||
|
||||
2
vasdk
2
vasdk
Submodule vasdk updated: f932da435f...3755d97157
Reference in New Issue
Block a user