Merge remote-tracking branch 'origin/release' into dev
# Conflicts: # dependencies.gradle
This commit is contained in:
@ -311,13 +311,14 @@ object DirectUtils {
|
||||
name = linkEntity.name,
|
||||
display = linkEntity.display ?: Display()
|
||||
),
|
||||
entrance
|
||||
entrance,
|
||||
exposureEvent
|
||||
)
|
||||
}
|
||||
|
||||
"column_collection", "专题合集" -> directToColumnCollection(context, linkEntity.link!!, -1, entrance)
|
||||
|
||||
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path)
|
||||
"server", "game_server", "开服表" -> directToGameServers(context, entrance, path, exposureEvent)
|
||||
|
||||
"top_game_comment" -> directToAmway(context, null, entrance, path)
|
||||
|
||||
@ -439,11 +440,28 @@ object DirectUtils {
|
||||
|
||||
"game_list" -> directToGameCollectionSquare(context, entrance, "", "", "")
|
||||
|
||||
"game_list_detail" -> directToGameCollectionDetail(context, linkEntity.link ?: "", entrance)
|
||||
"game_list_detail" -> directToGameCollectionDetail(
|
||||
context,
|
||||
linkEntity.link ?: "",
|
||||
entrance,
|
||||
exposureEvent = exposureEvent
|
||||
)
|
||||
|
||||
"explore_column", "game_explore" -> context.startActivity(DiscoveryActivity.getIntent(context, entrance))
|
||||
"explore_column", "game_explore" -> context.startActivity(
|
||||
DiscoveryActivity.getIntent(
|
||||
context,
|
||||
entrance,
|
||||
exposureEvent
|
||||
)
|
||||
)
|
||||
|
||||
"column_test_v2" -> context.startActivity(GameServerTestV2Activity.getIntent(context, entrance))
|
||||
"column_test_v2" -> context.startActivity(
|
||||
GameServerTestV2Activity.getIntent(
|
||||
context,
|
||||
entrance,
|
||||
exposureEvent
|
||||
)
|
||||
)
|
||||
|
||||
"" -> {
|
||||
// do nothing
|
||||
@ -1356,11 +1374,17 @@ object DirectUtils {
|
||||
* 跳转到板块
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToBlock(context: Context, blockData: SubjectRecommendEntity, entrance: String) {
|
||||
fun directToBlock(
|
||||
context: Context,
|
||||
blockData: SubjectRecommendEntity,
|
||||
entrance: String,
|
||||
exposureEvent: ExposureEvent? = null
|
||||
) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, BlockActivity::class.java.name)
|
||||
bundle.putParcelable(KEY_BLOCK_DATA, blockData)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -1368,10 +1392,11 @@ object DirectUtils {
|
||||
* 跳转到开服表
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToGameServers(context: Context, entrance: String, path: String) {
|
||||
fun directToGameServers(context: Context, entrance: String, path: String, exposureEvent: ExposureEvent? = null) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_TO, GameServersActivity::class.java.name)
|
||||
bundle.putString(KEY_ENTRANCE, ToolBarActivity.mergeEntranceAndPath(entrance, path))
|
||||
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -1821,7 +1846,8 @@ object DirectUtils {
|
||||
collectionId: String,
|
||||
blockId: String = "",
|
||||
blockName: String = "",
|
||||
entrance: String = ""
|
||||
entrance: String = "",
|
||||
exposureEvent: ExposureEvent? = null
|
||||
) {
|
||||
if (collectionId.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
@ -1830,6 +1856,7 @@ object DirectUtils {
|
||||
bundle.putString(KEY_BLOCK_NAME, blockName)
|
||||
bundle.putString(KEY_ENTRANCE, entrance)
|
||||
bundle.putString(KEY_COLLECTION_ID, collectionId)
|
||||
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@ -1865,13 +1892,20 @@ object DirectUtils {
|
||||
* 跳转至游戏单详情
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToGameCollectionDetail(context: Context, id: String, entrance: String? = null, path: String? = null) {
|
||||
fun directToGameCollectionDetail(
|
||||
context: Context,
|
||||
id: String,
|
||||
entrance: String? = null,
|
||||
path: String? = null,
|
||||
exposureEvent: ExposureEvent? = null
|
||||
) {
|
||||
if (id.isEmpty()) return
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_PATH, path)
|
||||
bundle.putString(KEY_TO, GameCollectionDetailActivity::class.java.name)
|
||||
bundle.putString(KEY_GAME_COLLECTION_ID, id)
|
||||
exposureEvent?.let { bundle.putParcelableArrayList(KEY_EXPOSURE_SOURCE_LIST, ArrayList(exposureEvent.source)) }
|
||||
jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
|
||||
@ -384,7 +384,9 @@ object DownloadObserver {
|
||||
"game_name", downloadEntity.name,
|
||||
"game_id", downloadEntity.gameId
|
||||
)
|
||||
} else if (downloadEntity.gameId != "62bd412bbbf04747cd3de539") {
|
||||
} else if (downloadEntity.gameId == Constants.HALO_FUN_GAME_ID) {
|
||||
SensorsBridge.trackEvent("HaloFunDownloadDone")
|
||||
} else if (downloadEntity.gameId != Constants.GHZS_GAME_ID && downloadEntity.getMetaExtra(Constants.EXTRA_DOWNLOAD_TYPE) != Constants.SIMULATOR_DOWNLOAD) {
|
||||
SensorsBridge.trackEvent(
|
||||
"DownloadProcessFinish",
|
||||
"game_id", downloadEntity.gameId,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.common.xapk
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
@ -20,13 +21,26 @@ import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.help.HelpAndFeedbackBridge
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.utils.Utils
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
object XapkDialogHelper {
|
||||
|
||||
private var mUnzipFailureDialogRef: WeakReference<Dialog>? = null
|
||||
|
||||
fun showUnzipFailureDialog(context: Context, downloadEntity: DownloadEntity, isManualAction: Boolean) {
|
||||
val trigger = if (isManualAction) "手动触发" else "自动触发"
|
||||
NewFlatLogUtils.logXApkUnzipFailedDialogShowed(trigger, downloadEntity.gameId, downloadEntity.name)
|
||||
DialogHelper.showGuideDialog(
|
||||
|
||||
val previousShowedDialog = mUnzipFailureDialogRef?.get()
|
||||
|
||||
if (previousShowedDialog != null
|
||||
&& previousShowedDialog.isShowing
|
||||
&& context == previousShowedDialog.ownerActivity) {
|
||||
// 上一个解压失败弹窗还在显示,当前 activity 不用再显示新的弹窗了
|
||||
return
|
||||
}
|
||||
|
||||
val dialog = DialogHelper.showGuideDialog(
|
||||
context = context,
|
||||
title = "",
|
||||
content = "未授权允许未知来源安装、数据包格式、设备兼容性…等均可能导致解压失败。\n如果开启权限后仍未能解决,请提交反馈帮助我们改进。",
|
||||
@ -107,6 +121,11 @@ object XapkDialogHelper {
|
||||
},
|
||||
extraConfig = DialogHelper.Config(showCloseIcon = true)
|
||||
)
|
||||
|
||||
if (context is Activity) {
|
||||
dialog?.setOwnerActivity(context)
|
||||
}
|
||||
mUnzipFailureDialogRef = WeakReference(dialog)
|
||||
}
|
||||
|
||||
}
|
||||
@ -145,7 +145,8 @@ object PackageObserver {
|
||||
mDownloadEntity?.let {
|
||||
if (it.isVGame()) return@let
|
||||
|
||||
if (it.isPluggable || it.isUpdate) {
|
||||
if (it.isPluggable
|
||||
|| (it.isUpdate && !PackageUtils.isInstalled(application, it.packageName))) {
|
||||
PackageInstaller.install(application, mDownloadEntity)
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ class BlockActivity : DownloadToolbarActivity() {
|
||||
}
|
||||
|
||||
override fun provideNormalIntent(): Intent {
|
||||
return getTargetIntent(this, BlockActivity::class.java, GameFragment::class.java)
|
||||
return getTargetIntent(this, BlockActivity::class.java, GameFragment::class.java, intent?.extras)
|
||||
}
|
||||
|
||||
override fun showDownloadMenu(): Boolean {
|
||||
|
||||
@ -474,6 +474,8 @@ public class MainActivity extends BaseActivity {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (mStartUpAdProvider != null) mStartUpAdProvider.cancelStartUpAd(this);
|
||||
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
releaseExoSourceCache();
|
||||
}
|
||||
@ -500,7 +502,6 @@ public class MainActivity extends BaseActivity {
|
||||
if (!showAd) {
|
||||
hideStartUp();
|
||||
hideStartUpAd();
|
||||
hideSDKStartUpAd();
|
||||
return;
|
||||
}
|
||||
final StartupAdEntity startUp = AdHelper.getStartUp();
|
||||
@ -612,16 +613,10 @@ public class MainActivity extends BaseActivity {
|
||||
startAdContainer.setVisibility(View.GONE);
|
||||
ExtensionsKt.removeFromParent(startAdContainer);
|
||||
}
|
||||
checkDialog();
|
||||
}
|
||||
|
||||
private void hideSDKStartUpAd() {
|
||||
showAd = false;
|
||||
getIntent().putExtra(SHOW_AD, false);
|
||||
View startAdContainer = findViewById(R.id.sdkStartAdContainer);
|
||||
if (startAdContainer != null) {
|
||||
startAdContainer.setVisibility(View.GONE);
|
||||
ExtensionsKt.removeFromParent(startAdContainer);
|
||||
View startSdkAdContainer = findViewById(R.id.sdkStartAdContainer);
|
||||
if (startSdkAdContainer != null) {
|
||||
startSdkAdContainer.setVisibility(View.GONE);
|
||||
ExtensionsKt.removeFromParent(startSdkAdContainer);
|
||||
if (mStartUpAdProvider != null) mStartUpAdProvider.cancelStartUpAd(this);
|
||||
}
|
||||
checkDialog();
|
||||
@ -687,7 +682,7 @@ public class MainActivity extends BaseActivity {
|
||||
FrameLayout adsFl = findViewById(R.id.adsFl);
|
||||
if (mStartUpAdProvider != null) {
|
||||
mStartUpAdProvider.initStartUpAd(startAdContainer, adsFl, showAd, () -> {
|
||||
hideSDKStartUpAd();
|
||||
hideStartUpAd();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@ -58,6 +58,7 @@ 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.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.ToastUtils;
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity;
|
||||
import com.gh.gamecenter.entity.VideoLinkEntity;
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils;
|
||||
@ -327,11 +328,11 @@ public class SkipActivity extends BaseActivity {
|
||||
entity.setLink(path);
|
||||
entity.setName(name);
|
||||
entity.setText(name);
|
||||
DirectUtils.directToBlock(this, entity, mEntrance);
|
||||
DirectUtils.directToBlock(this, entity, mEntrance, null);
|
||||
break;
|
||||
|
||||
case EntranceConsts.HOST_SERVER_BLOCK:
|
||||
DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器");
|
||||
DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器", null);
|
||||
break;
|
||||
|
||||
case EntranceConsts.HOST_AMWAY_BLOCK:
|
||||
@ -399,7 +400,7 @@ public class SkipActivity extends BaseActivity {
|
||||
DirectUtils.directToHelpAndFeedback(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position));
|
||||
break;
|
||||
case HOST_GAME_COLLECTION_DETAIL:
|
||||
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "");
|
||||
DirectUtils.directToGameCollectionDetail(this, path, ENTRANCE_BROWSER, "", null);
|
||||
break;
|
||||
case HOST_GAME_COLLECTION_SQUARE:
|
||||
DirectUtils.directToGameCollectionSquare(this, ENTRANCE_BROWSER, "", "", "");
|
||||
@ -450,6 +451,12 @@ public class SkipActivity extends BaseActivity {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
if (SkipActivity.this.isFinishing()) {
|
||||
ToastUtils.toast("创建桌面图标失败,请重试");
|
||||
return;
|
||||
}
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,9 @@ import com.gh.gamecenter.R
|
||||
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
|
||||
|
||||
/**
|
||||
* 猜你喜欢-发现页
|
||||
@ -27,9 +30,15 @@ class DiscoveryActivity : ToolBarActivity() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, entrance: String): Intent {
|
||||
fun getIntent(context: Context, entrance: String, exposureEvent: ExposureEvent? = null): Intent {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
exposureEvent?.let {
|
||||
bundle.putParcelableArrayList(
|
||||
EntranceConsts.KEY_EXPOSURE_SOURCE_LIST,
|
||||
ArrayList(exposureEvent.source)
|
||||
)
|
||||
}
|
||||
return getTargetIntent(context, DiscoveryActivity::class.java, DiscoveryFragment::class.java, bundle)
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,6 +151,8 @@ class DiscoveryFragment : LazyListFragment<DiscoveryItemData, DiscoveryViewModel
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
val basicExposureSource = arrayListOf<ExposureSource>().apply {
|
||||
arguments?.getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let { add(it) }
|
||||
arguments?.getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
|
||||
?.let { addAll(it) }
|
||||
}
|
||||
val outerSequence = requireArguments().getInt(EntranceConsts.KEY_POSITION, -1)
|
||||
|
||||
|
||||
@ -19,6 +19,8 @@ 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.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||
import com.gh.gamecenter.core.utils.CurrentActivityHolder
|
||||
@ -397,6 +399,21 @@ class UpdatableGameAdapter(private var mViewModel: UpdatableGameViewModel) :
|
||||
updateBtn.buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||
}
|
||||
}
|
||||
|
||||
SensorsBridge.trackEvent(
|
||||
"DownLoadbuttonClick",
|
||||
"game_id", downloadEntity?.gameId ?: "",
|
||||
"game_name", downloadEntity?.name ?: "",
|
||||
"game_type", downloadEntity?.meta?.get(Constants.GAME_TYPE) ?: "",
|
||||
"download_status", update.downloadStatusChinese,
|
||||
"button_name", str,
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
"page_id", GlobalActivityManager.getCurrentPageEntity().pageId,
|
||||
"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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,16 +6,17 @@ import androidx.lifecycle.*
|
||||
import com.gh.common.exposure.ExposureUtils
|
||||
import com.gh.common.exposure.ExposureUtils.logADownloadExposureEvent
|
||||
import com.gh.common.history.HistoryHelper.insertGameEntity
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.common.util.DataCollectionUtils
|
||||
import com.gh.common.util.PackageInstaller.createDownloadId
|
||||
import com.gh.common.util.PackageInstaller.getDownloadPathWithId
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.common.base.BaseSimpleDao
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager.getCurrentPageEntity
|
||||
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.SensorsBridge.trackEvent
|
||||
import com.gh.gamecenter.common.utils.addMetaExtra
|
||||
import com.gh.gamecenter.common.utils.secondOrNull
|
||||
import com.gh.gamecenter.common.utils.toProperReadableSize
|
||||
@ -23,10 +24,12 @@ import com.gh.gamecenter.common.utils.tryCatchInRelease
|
||||
import com.gh.gamecenter.core.utils.GsonUtils.toJson
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.UrlFilterUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation
|
||||
import com.gh.gamecenter.eventbus.EBDownloadChanged
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.PluginLocation
|
||||
import com.gh.gamecenter.feature.utils.ApkActiveUtils
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -634,6 +637,19 @@ class UpdatableGameViewModel(
|
||||
|
||||
// 收集下载数据
|
||||
DataCollectionUtils.uploadDownload(getApplication(), downloadEntity, "开始")
|
||||
|
||||
trackEvent(
|
||||
"DownloadProcessBegin",
|
||||
"game_id", gameEntity.id,
|
||||
"game_name", gameEntity.name!!,
|
||||
"game_type", gameEntity.categoryChinese,
|
||||
"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
|
||||
)
|
||||
}
|
||||
|
||||
private fun sizeStringToLong(sizeString: String): Long {
|
||||
|
||||
@ -49,6 +49,15 @@ data class GameUpdateEntity(
|
||||
var downloadStatus: String? = ""
|
||||
) {
|
||||
|
||||
val downloadStatusChinese: String
|
||||
get() = when (downloadStatus) {
|
||||
"on" -> "开启"
|
||||
"smooth" -> "畅玩"
|
||||
"appointment" -> "预约"
|
||||
"demo" -> "试玩"
|
||||
else -> ""
|
||||
}
|
||||
|
||||
fun isShowPlugin(location: PluginLocation): Boolean {
|
||||
if (plugin.isNullOrEmpty() || "open" == plugin || plugin == location.name) {
|
||||
return true
|
||||
|
||||
@ -6,6 +6,8 @@ import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class HomeSubSlide(
|
||||
@SerializedName("_id")
|
||||
val id: String = "",
|
||||
@SerializedName("link_type")
|
||||
val linkType: String = "",
|
||||
@SerializedName("link_id")
|
||||
|
||||
@ -136,6 +136,9 @@ class GameFragment : LazyFragment() {
|
||||
arguments?.getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let {
|
||||
add(it)
|
||||
}
|
||||
arguments?.getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)?.let {
|
||||
addAll(it)
|
||||
}
|
||||
add(
|
||||
ExposureSource(
|
||||
"板块",
|
||||
|
||||
@ -14,7 +14,8 @@ class CommonCollectionDetailActivity : ToolBarActivity() {
|
||||
return getTargetIntent(
|
||||
this,
|
||||
CommonCollectionDetailActivity::class.java,
|
||||
CommonCollectionDetailFragment::class.java
|
||||
CommonCollectionDetailFragment::class.java,
|
||||
intent?.extras
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@ class CommonCollectionDetailAdapter(
|
||||
val mViewModel: CommonCollectionDetailViewModel,
|
||||
val mBlockId: String,
|
||||
val mBlockName: String,
|
||||
val mEntrance: String
|
||||
val mEntrance: String,
|
||||
private val mBasicExposureSource: List<ExposureSource>?
|
||||
) : ListAdapter<CommonCollectionContentEntity>(context), IExposable {
|
||||
|
||||
private val mExposureEventSparseArray = SparseArray<ExposureEvent>()
|
||||
@ -98,13 +99,14 @@ class CommonCollectionDetailAdapter(
|
||||
if (linkEntity.type == "game") {
|
||||
mExposureEventSparseArray.put(
|
||||
position,
|
||||
ExposureEvent.createEvent(
|
||||
ExposureEvent.createEventWithSourceConcat(
|
||||
GameEntity(
|
||||
id = linkEntity.link,
|
||||
name = linkEntity.name
|
||||
).also {
|
||||
it.sequence = position
|
||||
},
|
||||
basicSource = mBasicExposureSource ?: listOf(),
|
||||
listOf(
|
||||
ExposureSource(
|
||||
"内容合集",
|
||||
|
||||
@ -21,6 +21,7 @@ import com.gh.gamecenter.common.view.GridSpacingItemDecoration
|
||||
import com.gh.gamecenter.common.view.VerticalItemDecoration
|
||||
import com.gh.gamecenter.databinding.FragmentListBaseSkeletonBinding
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureSource
|
||||
|
||||
class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollectionDetailViewModel>() {
|
||||
|
||||
@ -47,13 +48,16 @@ class CommonCollectionDetailFragment : LazyListFragment<LinkEntity, CommonCollec
|
||||
|
||||
override fun provideListAdapter(): ListAdapter<*> {
|
||||
if (mAdapter == null) {
|
||||
val exposureEvent =
|
||||
requireArguments().getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
|
||||
mAdapter = CommonCollectionDetailAdapter(
|
||||
requireContext(),
|
||||
mCollectionStyle,
|
||||
mViewModel,
|
||||
mBlockId,
|
||||
mBlockName,
|
||||
mEntrance
|
||||
mEntrance,
|
||||
exposureEvent
|
||||
)
|
||||
}
|
||||
return mAdapter!!
|
||||
|
||||
@ -62,12 +62,13 @@ class GameVerticalAdapter(
|
||||
// 你可能会问为什么这下面会有一些,"加1减1" 的魔法。没错,这里的 "加1减1"就是为了规避 bug,做出的一些 UI 补偿
|
||||
// bug 的表现可以 checkout https://git.shanqu.cc/android/playground/-/tree/test-snap_adapter_culprit 代码,然后滑动到最后一列体验一下
|
||||
var paddingEnd = if (isEndOfRow) 16F.dip2px() else 0F.dip2px()
|
||||
val height = 80F.dip2px()
|
||||
|
||||
holder.itemView.layoutParams = if (!isEndOfRow) {
|
||||
paddingEnd += 1
|
||||
ViewGroup.LayoutParams(mMaxWidth - 24F.dip2px(), ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
ViewGroup.LayoutParams(mMaxWidth - 24F.dip2px(), height)
|
||||
} else {
|
||||
ViewGroup.LayoutParams(mMaxWidth - 1, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
ViewGroup.LayoutParams(mMaxWidth - 1, height)
|
||||
}
|
||||
|
||||
val gameEntity = mSubjectEntity.data!![position + getIndex()]
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
package com.gh.gamecenter.geetest;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Build;
|
||||
|
||||
import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.core.utils.AppDebugConfig;
|
||||
import com.gh.gamecenter.common.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
@ -113,6 +116,10 @@ public class GeetestUtils {
|
||||
mRetryCount = 0;
|
||||
final GtDialog dialog = new GtDialog(context, params);
|
||||
|
||||
if (context instanceof Activity) {
|
||||
dialog.setOwnerActivity((Activity) context);
|
||||
}
|
||||
|
||||
// 启用debug可以在webview上看到验证过程的一些数据
|
||||
dialog.setDebug(AppDebugConfig.IS_DEBUG);
|
||||
|
||||
@ -128,85 +135,88 @@ public class GeetestUtils {
|
||||
|
||||
@Override
|
||||
public void gtCallReady(Boolean status) {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this, status, mProgressDialog.isShowing());
|
||||
}
|
||||
AppExecutor.getUiExecutor().execute(() -> {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this, status, mProgressDialog.isShowing());
|
||||
}
|
||||
|
||||
mRetryCount = 0;
|
||||
if (!mProgressDialog.isShowing()) {
|
||||
//被手动取消了,也就是其实用户想取消loading了,那么即使回调也不弹出
|
||||
return;
|
||||
}
|
||||
mRetryCount = 0;
|
||||
if (!mProgressDialog.isShowing()) {
|
||||
//被手动取消了,也就是其实用户想取消loading了,那么即使回调也不弹出
|
||||
return;
|
||||
}
|
||||
|
||||
mProgressDialog.dismiss();
|
||||
mProgressDialog.dismiss();
|
||||
|
||||
if (status) {
|
||||
// 验证加载完成
|
||||
RuntimeUtils.getInstance().runOnUiThread(new Runnable() {
|
||||
if (status) {
|
||||
// 验证加载完成
|
||||
Activity ownerActivity = dialog.getOwnerActivity();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (dialog != null) {
|
||||
dialog.show();
|
||||
}
|
||||
if (ownerActivity != null
|
||||
&& (ownerActivity.isFinishing()
|
||||
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) && ownerActivity.isDestroyed())) {
|
||||
// activity 不可见
|
||||
toastMsg(context, "验证加载超时,请重新尝试");
|
||||
} else {
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
// 验证加载超时,未准备完成
|
||||
toastMsg(context, "验证加载超时,请重新尝试");
|
||||
}
|
||||
} else {
|
||||
// 验证加载超时,未准备完成
|
||||
toastMsg(context, "验证加载超时,请重新尝试");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gtCallClose() {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this);
|
||||
}
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
// toastMsg("close geetest windows");
|
||||
AppExecutor.getUiExecutor().execute(() -> {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this);
|
||||
}
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gtError() {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this);
|
||||
}
|
||||
|
||||
if (mRetryCount < RETRY_MAX_COUNT) {
|
||||
mRetryCount++;
|
||||
checkServer(context);
|
||||
} else {
|
||||
if (mProgressDialog.isShowing()) {
|
||||
mProgressDialog.dismiss();
|
||||
AppExecutor.getUiExecutor().execute(() -> {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (mRetryCount < RETRY_MAX_COUNT) {
|
||||
mRetryCount++;
|
||||
checkServer(context);
|
||||
} else {
|
||||
if (mProgressDialog.isShowing()) {
|
||||
mProgressDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gtResult(boolean success, String result) {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this, success, result);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
AppExecutor.getUiExecutor().execute(() -> {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this, success, result);
|
||||
}
|
||||
if (mGeetestListener != null) {
|
||||
mGeetestListener.onVerified(result);
|
||||
}
|
||||
// toastMsg("client captcha succeed:" + result);
|
||||
Utils.log("client captcha succeed:" + result);
|
||||
} else {
|
||||
// 验证失败
|
||||
// toastMsg("client captcha failed:" + result);
|
||||
Utils.log("client captcha failed:" + result);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
if (dialog != null && dialog.isShowing()) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
if (mGeetestListener != null) {
|
||||
mGeetestListener.onVerified(result);
|
||||
}
|
||||
Utils.log("client captcha succeed:" + result);
|
||||
} else {
|
||||
// 验证失败
|
||||
Utils.log("client captcha failed:" + result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@ -218,7 +228,6 @@ public class GeetestUtils {
|
||||
if (AppDebugConfig.IS_DEBUG) {
|
||||
AppDebugConfig.logMethodWithParams(this);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ import android.graphics.Typeface
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.core.view.isVisible
|
||||
@ -34,7 +33,6 @@ import com.gh.gamecenter.feature.exposure.ExposureSource
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.home.HomeItemData
|
||||
import com.gh.gamecenter.home.HomeViewModel
|
||||
import splitties.views.dsl.core.endMargin
|
||||
import kotlin.math.abs
|
||||
|
||||
class HomeSlideWithCardsViewHolder(
|
||||
@ -257,11 +255,10 @@ class HomeSlideWithCardsViewHolder(
|
||||
source = listOf(
|
||||
ExposureSource(
|
||||
"右侧卡片",
|
||||
"${homeSubSlide.cardId} - ${getCardTypeChinese(homeSubSlide.cardType)}"
|
||||
"${homeSubSlide.id} - ${getCardTypeChinese(homeSubSlide.cardType)}"
|
||||
)
|
||||
)
|
||||
)
|
||||
itemData.exposureEventList?.add(exposureEvent)
|
||||
|
||||
when (homeSubSlide.cardType) {
|
||||
"column",
|
||||
@ -285,6 +282,14 @@ class HomeSlideWithCardsViewHolder(
|
||||
gameIconStackIv1.visibility = View.GONE
|
||||
}
|
||||
homeSubSlide.cardData.games.take(3).forEachIndexed { index, gameEntity ->
|
||||
itemData.exposureEventList?.add(
|
||||
getGameExposureEvent(
|
||||
homeSubSlide,
|
||||
gameEntity,
|
||||
position,
|
||||
basicExposureSource
|
||||
)
|
||||
)
|
||||
when (index) {
|
||||
0 -> gameIconStackIv3.displayGameIcon(gameEntity, true)
|
||||
1 -> gameIconStackIv2.displayGameIcon(gameEntity, true)
|
||||
@ -314,6 +319,17 @@ class HomeSlideWithCardsViewHolder(
|
||||
gameIconIv3.visibility = View.GONE
|
||||
}
|
||||
homeSubSlide.cardData.games.take(3).forEachIndexed { index, gameEntity ->
|
||||
val gameExposureEvent =
|
||||
getGameExposureEvent(homeSubSlide, gameEntity, position, basicExposureSource)
|
||||
itemData.exposureEventList?.add(
|
||||
getGameExposureEvent(
|
||||
homeSubSlide,
|
||||
gameEntity,
|
||||
position,
|
||||
basicExposureSource
|
||||
)
|
||||
)
|
||||
|
||||
when (index) {
|
||||
0 -> {
|
||||
gameIconIv1.displayGameIcon(gameEntity, true)
|
||||
@ -327,10 +343,11 @@ class HomeSlideWithCardsViewHolder(
|
||||
binding.root.context,
|
||||
gameEntity.id,
|
||||
BaseActivity.mergeEntranceAndPath("新首页", "右侧卡片"),
|
||||
exposureEvent
|
||||
gameExposureEvent
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
1 -> {
|
||||
gameIconIv2.displayGameIcon(gameEntity, true)
|
||||
gameIconIv2.setOnClickListener {
|
||||
@ -343,10 +360,11 @@ class HomeSlideWithCardsViewHolder(
|
||||
binding.root.context,
|
||||
gameEntity.id,
|
||||
BaseActivity.mergeEntranceAndPath("新首页", "右侧卡片"),
|
||||
exposureEvent
|
||||
gameExposureEvent
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
2 -> {
|
||||
gameIconIv3.displayGameIcon(gameEntity, true)
|
||||
gameIconIv3.setOnClickListener {
|
||||
@ -359,7 +377,7 @@ class HomeSlideWithCardsViewHolder(
|
||||
binding.root.context,
|
||||
gameEntity.id,
|
||||
BaseActivity.mergeEntranceAndPath("新首页", "右侧卡片"),
|
||||
exposureEvent
|
||||
gameExposureEvent
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -417,6 +435,8 @@ class HomeSlideWithCardsViewHolder(
|
||||
connect(textContainer.id, ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP)
|
||||
connect(textContainer.id, ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM)
|
||||
}.applyTo(cardContainer)
|
||||
|
||||
itemData.exposureEventList?.add(exposureEvent)
|
||||
}
|
||||
}
|
||||
|
||||
@ -431,17 +451,42 @@ class HomeSlideWithCardsViewHolder(
|
||||
source = listOf(
|
||||
ExposureSource(
|
||||
"右侧卡片",
|
||||
"${homeSubSlide.cardId} - ${getCardTypeChinese(homeSubSlide.cardType)}"
|
||||
"${homeSubSlide.id} - ${getCardTypeChinese(homeSubSlide.cardType)}"
|
||||
)
|
||||
),
|
||||
event = ExposureType.CLICK
|
||||
)
|
||||
)
|
||||
com.gh.common.util.NewFlatLogUtils.logRightSideCardClick(homeSubSlide, viewModel.refreshCount, "卡片")
|
||||
DirectUtils.directToLinkPage(cardCv.context, homeSubSlide.toLinkEntity(), "新首页", "右侧卡片", exposureEvent)
|
||||
DirectUtils.directToLinkPage(
|
||||
cardCv.context,
|
||||
homeSubSlide.toLinkEntity(),
|
||||
"新首页",
|
||||
"右侧卡片",
|
||||
exposureEvent
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getGameExposureEvent(
|
||||
homeSubSlide: HomeSubSlide,
|
||||
gameEntity: GameEntity,
|
||||
position: Int,
|
||||
basicExposureSource: List<ExposureSource>
|
||||
) = ExposureEvent.createEventWithSourceConcat(
|
||||
gameEntity = gameEntity.apply {
|
||||
sequence = position
|
||||
outerSequence = viewModel.refreshCount
|
||||
},
|
||||
basicSource = basicExposureSource,
|
||||
source = listOf(
|
||||
ExposureSource(
|
||||
"右侧卡片",
|
||||
"${homeSubSlide.id} - ${getCardTypeChinese(homeSubSlide.cardType)}"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
private fun updateImmersiveColor(color: Int) {
|
||||
callback.invoke(color)
|
||||
val gradientDrawable = DrawableView.getGradientDrawable(
|
||||
|
||||
@ -269,7 +269,11 @@ class VideoDescTopViewHolder(
|
||||
private fun getTextViewHeight(view: TextView, lineCount: Int = 0): Int {
|
||||
if (view.visibility == View.GONE) return 0
|
||||
val layout: Layout = view.layout ?: return 0
|
||||
val desired: Int = layout.getLineTop(if (lineCount > 0) lineCount else view.lineCount)
|
||||
val desired: Int = try {
|
||||
layout.getLineTop(if (lineCount > 0) lineCount else view.lineCount)
|
||||
} catch (e: ArrayIndexOutOfBoundsException) {
|
||||
layout.getLineTop(view.lineCount)
|
||||
}
|
||||
val padding = view.compoundPaddingTop + view.compoundPaddingBottom
|
||||
return desired + padding
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ class GameServersActivity : DownloadToolbarActivity() {
|
||||
{ MtaHelper.onEvent("开服表", "Tab", if (mServersTest?.isChecked == true) "开测" else "开服") }
|
||||
// init viewpager
|
||||
mFragments.add(GameServersPublishFragment())
|
||||
mFragments.add(GameServersTestFragment())
|
||||
mFragments.add(GameServersTestFragment().with(intent.extras))
|
||||
mViewpager?.setScrollable(false)
|
||||
mViewpager?.offscreenPageLimit = 1
|
||||
mViewpager?.adapter = FragmentAdapter(supportFragmentManager, mFragments)
|
||||
|
||||
@ -155,6 +155,8 @@ class GameServersTestFragment : LazyFragment() {
|
||||
|
||||
val exposureSource = if (arguments?.getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE) != null) {
|
||||
listOf<ExposureSource>(arguments?.getParcelable(EntranceConsts.KEY_EXPOSURE_SOURCE)!!)
|
||||
} else if (requireArguments().getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST) != null) {
|
||||
requireArguments().getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import com.gh.gamecenter.R
|
||||
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 java.util.ArrayList
|
||||
|
||||
class GameServerTestV2Activity : ToolBarActivity() {
|
||||
|
||||
@ -26,9 +28,15 @@ class GameServerTestV2Activity : ToolBarActivity() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, entrance: String): Intent {
|
||||
fun getIntent(context: Context, entrance: String, exposureEvent: ExposureEvent? = null): Intent {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
exposureEvent?.let {
|
||||
bundle.putParcelableArrayList(
|
||||
EntranceConsts.KEY_EXPOSURE_SOURCE_LIST,
|
||||
ArrayList(exposureEvent.source)
|
||||
)
|
||||
}
|
||||
return getTargetIntent(
|
||||
context,
|
||||
GameServerTestV2Activity::class.java,
|
||||
|
||||
@ -187,6 +187,8 @@ class GameServerTestV2ListFragment :
|
||||
val exposureSource =
|
||||
if (requireArguments().getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE) != null) {
|
||||
listOf<ExposureSource>(requireArguments().getParcelable(EntranceConsts.KEY_EXPOSURE_SOURCE)!!)
|
||||
} else if (requireArguments().getParcelableArrayList<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST) != null) {
|
||||
requireArguments().getParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
@ -1294,6 +1294,12 @@ object VHelper {
|
||||
|
||||
// 收集下载数据
|
||||
DataCollectionUtils.uploadDownload(HaloApp.getInstance(), originDownloadEntity, "开始")
|
||||
|
||||
SensorsBridge.trackEvent(
|
||||
"HaloFunGameDownloadClick",
|
||||
"game_name", originDownloadEntity.name,
|
||||
"game_id", originDownloadEntity.gameId
|
||||
)
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@ -267,8 +267,6 @@ class VSpaceDialogFragment : BaseDraggableDialogFragment() {
|
||||
downloadBtn.setText(R.string.install)
|
||||
downloadBtn.buttonStyle = DownloadButton.ButtonStyle.INSTALL_NORMAL
|
||||
|
||||
SensorsBridge.trackEvent("HaloFunDownloadDone")
|
||||
|
||||
downloadBtn.setOnClickListener {
|
||||
PackageInstaller.install(requireContext(), downloadEntity)
|
||||
SensorsBridge.trackEvent("HaloFunInstallButtonClick")
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
package com.gh.vspace.db
|
||||
|
||||
import androidx.room.TypeConverter
|
||||
import com.gh.gamecenter.common.utils.toObject
|
||||
import com.gh.gamecenter.common.utils.tryWithDefaultCatch
|
||||
import com.gh.gamecenter.core.utils.GsonUtils
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.download.DownloadStatus
|
||||
import org.json.JSONObject
|
||||
|
||||
class VGameConverter {
|
||||
|
||||
@ -13,7 +17,35 @@ class VGameConverter {
|
||||
|
||||
@TypeConverter
|
||||
fun convertString2DownloadEntity(string: String): DownloadEntity {
|
||||
return GsonUtils.fromJson(string, DownloadEntity::class.java)
|
||||
val downloadEntity = DownloadEntity()
|
||||
|
||||
val rawJsonObject = JSONObject(string)
|
||||
|
||||
val keys = rawJsonObject.keys()
|
||||
var tempSize = ""
|
||||
while (keys.hasNext()) {
|
||||
val key = keys.next()
|
||||
val value = rawJsonObject.optString(key)
|
||||
|
||||
if (value.startsWith("http")) {
|
||||
downloadEntity.url = value
|
||||
} else if (value.endsWith("apk")) {
|
||||
downloadEntity.path = value
|
||||
} else if (value.startsWith("{\"")) {
|
||||
downloadEntity.meta = value.toObject()
|
||||
downloadEntity.name = downloadEntity.meta["game_name"]
|
||||
} else if (value == tempSize) {
|
||||
tryWithDefaultCatch {
|
||||
downloadEntity.size = value.toLong()
|
||||
}
|
||||
} else {
|
||||
tempSize = value
|
||||
}
|
||||
}
|
||||
|
||||
downloadEntity.status = DownloadStatus.done
|
||||
|
||||
return downloadEntity
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user