diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index faaa7f844a..8a3e9190c1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -612,6 +612,14 @@
+
+
+
+
+
+
+
+
{
- CertificationDialog.showCertificationDialog(v.getContext(), gameEntity, () -> {
- DialogUtils.showVersionNumberDialog(v.getContext(), gameEntity, () -> {
- DialogUtils.showOverseaDownloadDialog(v.getContext(), gameEntity, () -> {
- DialogUtils.checkDownload(v.getContext(), apk.getSize(),
- isSubscribe -> download(progressBar, gameEntity, traceEvent, isSubscribe, entrance, location));
+ PackageCheckDialogFragment.show((AppCompatActivity) v.getContext(), gameEntity.getPackageDialog(), () -> {
+ DownloadDialogHelper.findAvailableDialogAndShow(v.getContext(), gameEntity, apk, () -> {
+ CertificationDialog.showCertificationDialog(v.getContext(), gameEntity, () -> {
+ DialogUtils.showVersionNumberDialog(v.getContext(), gameEntity, () -> {
+ DialogUtils.showOverseaDownloadDialog(v.getContext(), gameEntity, () -> {
+ DialogUtils.checkDownload(v.getContext(), apk.getSize(),
+ isSubscribe -> download(progressBar, gameEntity, traceEvent, isSubscribe, entrance, location));
+ });
});
});
});
});
} else {
- CertificationDialog.showCertificationDialog(v.getContext(), gameEntity, () -> {
- DialogUtils.showVersionNumberDialog(v.getContext(), gameEntity, () -> {
- DownloadDialog.showDownloadDialog(
- v.getContext(),
- gameEntity,
- traceEvent,
- entrance,
- location + ":" + gameEntity.getName());
+ PackageCheckDialogFragment.show((AppCompatActivity) v.getContext(), gameEntity.getPackageDialog(), () -> {
+ CertificationDialog.showCertificationDialog(v.getContext(), gameEntity, () -> {
+ DialogUtils.showVersionNumberDialog(v.getContext(), gameEntity, () -> {
+ DownloadDialog.showDownloadDialog(
+ v.getContext(),
+ gameEntity,
+ traceEvent,
+ entrance,
+ location + ":" + gameEntity.getName());
+ });
});
});
}
diff --git a/app/src/main/java/com/gh/common/dialog/PackageCheckDialogFragment.kt b/app/src/main/java/com/gh/common/dialog/PackageCheckDialogFragment.kt
new file mode 100644
index 0000000000..a5a91fbb3a
--- /dev/null
+++ b/app/src/main/java/com/gh/common/dialog/PackageCheckDialogFragment.kt
@@ -0,0 +1,259 @@
+package com.gh.common.dialog
+
+import android.content.Context
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.LinearLayout
+import android.widget.RelativeLayout
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.gh.base.BaseRecyclerViewHolder
+import com.gh.common.constant.Constants
+import com.gh.common.util.*
+import com.gh.common.view.CustomLinkMovementMethod
+import com.gh.gamecenter.R
+import com.lightgame.dialog.BaseDialogFragment
+import com.gh.gamecenter.databinding.FragmentPackageCheckBinding
+import com.gh.gamecenter.databinding.PackageCheckItemBinding
+import com.gh.gamecenter.entity.DetectionObjectEntity
+import com.gh.gamecenter.entity.PackageDialogEntity
+import com.gh.gamecenter.eventbus.EBPackage
+import com.lightgame.adapter.BaseRecyclerAdapter
+import io.reactivex.disposables.Disposable
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 包名检测弹窗
+ */
+class PackageCheckDialogFragment : BaseDialogFragment() {
+
+ private lateinit var binding: FragmentPackageCheckBinding
+ private var mTotalWidth = 0f
+ private val mDuration = 3000
+ private var mDisposable: Disposable? = null
+ private var mAdapter: PackageCheckAdapter? = null
+ var packageDialogEntity: PackageDialogEntity? = null
+ var callBack: DialogUtils.ConfirmListener? = null
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ binding = FragmentPackageCheckBinding.inflate(inflater, container, false)
+ return binding.root
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ packageDialogEntity?.let {
+ changeParams(it.detectionObjects.size)
+
+ binding.packageRv.layoutManager = LinearLayoutManager(requireContext())
+ mAdapter = PackageCheckAdapter(requireContext())
+ binding.packageRv.adapter = mAdapter
+
+ binding.titleTv.text = it.title
+ binding.contentTv.text = it.content
+
+ val spanBuilder = SpanBuilder(it.linkHintText).build()
+ it.links.forEachIndexed { index, packageLink ->
+ val linkSpan = SpanBuilder(packageLink.text).click(0, packageLink.text.length, R.color.theme_font, true) {
+ val linkEntity = packageLink.transform()
+ DirectUtils.directToLinkPage(requireContext(), linkEntity, "包名检测弹窗", "")
+ }.build()
+ spanBuilder.append(linkSpan)
+ if (index != it.links.size - 1) {
+ spanBuilder.append("、")
+ }
+ }
+ binding.linkHintTv.text = spanBuilder
+ binding.linkHintTv.movementMethod = CustomLinkMovementMethod.getInstance()
+
+ when (it.level) {
+ "HINT_SKIP" -> {
+ binding.cancelTv.text = "取消"
+ binding.noRemindAgainCb.visibility = View.GONE
+ }
+ "ALWAYS_HINT" -> {
+ binding.cancelTv.text = "我知道了"
+ binding.noRemindAgainCb.visibility = View.GONE
+ }
+ else -> {
+ binding.cancelTv.text = "我知道了"
+ binding.noRemindAgainCb.visibility = View.VISIBLE
+ }
+ }
+ initListener(it)
+ }
+ checkPackage()
+ }
+
+ private fun changeParams(size: Int) {
+ val params = binding.packageRv.layoutParams as LinearLayout.LayoutParams
+ params.height = if (size > 3) (28f.dip2px() * 3.5).toInt() else 28f.dip2px() * size
+ binding.packageRv.layoutParams = params
+ }
+
+ private fun initListener(entity: PackageDialogEntity) {
+ binding.downloadBtn.setOnClickListener {
+ if (binding.noRemindAgainCb.isChecked) {
+ SPUtils.setBoolean(Constants.SP_PACKAGE_CHECK, true)
+ }
+ val isAllPackageInstalled = isAllPackageInstalled(entity.detectionObjects)
+ if (isAllPackageInstalled) {
+ callBack?.onConfirm()
+ dismissAllowingStateLoss()
+ } else {
+ val packageLink = entity.links.find { it.buttonLink }
+ if (packageLink != null) {
+ val linkEntity = packageLink.transform()
+ DirectUtils.directToLinkPage(requireContext(), linkEntity, "包名检测弹窗", "")
+ }
+ }
+ }
+
+ binding.cancelTv.setOnClickListener {
+ if (entity.level != "HINT_SKIP") {
+ callBack?.onConfirm()
+ }
+ if (binding.noRemindAgainCb.isChecked) {
+ SPUtils.setBoolean(Constants.SP_PACKAGE_CHECK, true)
+ }
+ dismissAllowingStateLoss()
+ }
+ }
+
+ private fun isAllPackageInstalled(detectionObjects: ArrayList): Boolean {
+ var isInstalled = true
+ val allPackageName = PackageUtils.getAllPackageName(requireContext())
+ detectionObjects.forEach { entity ->
+ entity.packages.forEach {
+ if (!allPackageName.contains(it)) {
+ isInstalled = false
+ return isInstalled
+ }
+ }
+ }
+ return isInstalled
+ }
+
+ private fun checkPackage() {
+ var index = 0
+ mTotalWidth = (DisplayUtils.getScreenWidth() - 108f.dip2px()).toFloat()
+ mDisposable = rxTimer(1) {
+ val width = (mTotalWidth / mDuration) * it
+ val params = binding.progressView.layoutParams as RelativeLayout.LayoutParams
+ params.width = width.toInt()
+ binding.progressView.layoutParams = params
+
+ packageDialogEntity?.detectionObjects?.let { objects ->
+ if (objects.isNotEmpty()) {
+ val averageTime = if (objects.size == 1) {
+ mDuration
+ } else {
+ mDuration / (objects.size - 1)
+ }
+ if (it % averageTime == 0L && index < objects.size) {
+ mAdapter?.setListData(objects[index])
+ binding.packageRv.smoothScrollToPosition((mAdapter?.itemCount ?: 0) - 1)
+ index++
+ }
+ }
+ }
+
+ if (it >= mDuration) {
+ mDisposable?.dispose()
+ binding.downloadBtn.isEnabled = true
+ binding.progressText.text = "检测完成"
+ binding.progressView.background = ContextCompat.getDrawable(requireContext(), R.drawable.package_check_complete_bg)
+ }
+ }
+ }
+
+ override fun onStart() {
+ super.onStart()
+ val width = requireContext().resources.displayMetrics.widthPixels - 60F.dip2px()
+ val height = ViewGroup.LayoutParams.WRAP_CONTENT
+ dialog?.window?.setLayout(width, height)
+ dialog?.setCanceledOnTouchOutside(true)
+ }
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ if (mDisposable?.isDisposed == false) {
+ mDisposable?.dispose()
+ }
+ }
+
+ //安装、卸载事件
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ fun onEventMainThread(busFour: EBPackage) {
+ if ("安装" == busFour.type || "卸载" == busFour.type) {
+ mAdapter?.notifyDataSetChanged()
+ }
+ }
+
+ class PackageCheckAdapter(val context: Context) : BaseRecyclerAdapter(context) {
+ private val entities: ArrayList = arrayListOf()
+ fun setListData(entity: DetectionObjectEntity) {
+ entities.add(entity)
+ notifyDataSetChanged()
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
+ return PackageCheckViewHolder(PackageCheckItemBinding.bind(LayoutInflater.from(context).inflate(R.layout.package_check_item, parent, false)))
+ }
+
+ override fun getItemCount(): Int = entities.size
+
+ override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
+ if (holder is PackageCheckViewHolder) {
+ val entity = entities[position]
+ holder.binding.entity = entity
+ var isAllInstalled = true
+ entity.packages.forEach {
+ val isInstalled = PackageUtils.isInstalled(context, it)
+ if (!isInstalled) {
+ isAllInstalled = false
+ return@forEach
+ }
+ }
+ if (isAllInstalled) {
+ holder.binding.statusTv.text = "已安装"
+ holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.theme_font))
+ } else {
+ holder.binding.statusTv.text = "未安装"
+ holder.binding.statusTv.setTextColor(ContextCompat.getColor(context, R.color.text_FF4147))
+ }
+ }
+ }
+ }
+
+ class PackageCheckViewHolder(val binding: PackageCheckItemBinding) : BaseRecyclerViewHolder(binding.root)
+
+ companion object {
+ @JvmStatic
+ fun show(activity: AppCompatActivity, packageDialogEntity: PackageDialogEntity?, callBack: DialogUtils.ConfirmListener) {
+ if (packageDialogEntity == null) {
+ callBack.onConfirm()
+ return
+ }
+ val isChoose = SPUtils.getBoolean(Constants.SP_PACKAGE_CHECK, false)
+ if (packageDialogEntity.level == "OPTIONAL_HINT" && isChoose) {
+ callBack.onConfirm()
+ return
+ }
+
+ var dialogFragment = activity.supportFragmentManager.findFragmentByTag(PackageCheckDialogFragment::class.java.simpleName) as? PackageCheckDialogFragment
+ if (dialogFragment == null) {
+ dialogFragment = PackageCheckDialogFragment()
+ }
+ dialogFragment.packageDialogEntity = packageDialogEntity
+ dialogFragment.callBack = callBack
+
+ dialogFragment.show(activity.supportFragmentManager, PackageCheckDialogFragment::class.java.simpleName)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gh/common/util/DownloadItemUtils.java b/app/src/main/java/com/gh/common/util/DownloadItemUtils.java
index 87c18e4fd5..e571a1e0fa 100644
--- a/app/src/main/java/com/gh/common/util/DownloadItemUtils.java
+++ b/app/src/main/java/com/gh/common/util/DownloadItemUtils.java
@@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.gh.common.constant.Config;
import com.gh.common.dialog.CertificationDialog;
import com.gh.common.dialog.DeviceRemindDialog;
+import com.gh.common.dialog.PackageCheckDialogFragment;
import com.gh.common.dialog.ReserveDialogFragment;
import com.gh.common.exposure.ExposureEvent;
import com.gh.common.history.HistoryHelper;
@@ -507,14 +508,16 @@ public class DownloadItemUtils {
clickCallback.onCallback();
}
PermissionHelper.checkStoragePermissionBeforeAction(context, () -> {
- CertificationDialog.showCertificationDialog(context, gameEntity, () -> {
- DialogUtils.showVersionNumberDialog(context, gameEntity, () -> {
- DownloadDialog.showDownloadDialog(
- v.getContext(),
- gameEntity,
- traceEvent,
- entrance,
- location);
+ PackageCheckDialogFragment.show((AppCompatActivity) context, gameEntity.getPackageDialog(), () -> {
+ CertificationDialog.showCertificationDialog(context, gameEntity, () -> {
+ DialogUtils.showVersionNumberDialog(context, gameEntity, () -> {
+ DownloadDialog.showDownloadDialog(
+ v.getContext(),
+ gameEntity,
+ traceEvent,
+ entrance,
+ location);
+ });
});
});
});
@@ -614,14 +617,16 @@ public class DownloadItemUtils {
clickCallback.onCallback();
}
PermissionHelper.checkStoragePermissionBeforeAction(context, () -> {
- CertificationDialog.showCertificationDialog(context, gameEntity, () -> {
- DialogUtils.showVersionNumberDialog(context, gameEntity, () -> {
- DownloadDialog.showDownloadDialog(
- v.getContext(),
- gameEntity,
- traceEvent,
- entrance,
- location);
+ PackageCheckDialogFragment.show((AppCompatActivity) context, gameEntity.getPackageDialog(), () -> {
+ CertificationDialog.showCertificationDialog(context, gameEntity, () -> {
+ DialogUtils.showVersionNumberDialog(context, gameEntity, () -> {
+ DownloadDialog.showDownloadDialog(
+ v.getContext(),
+ gameEntity,
+ traceEvent,
+ entrance,
+ location);
+ });
});
});
});
@@ -652,24 +657,27 @@ public class DownloadItemUtils {
if (str.equals(context.getString(R.string.download))) {
// 先弹下载弹窗(如果需要的话)
- DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, () -> {
- CertificationDialog.showCertificationDialog(context, gameEntity, () -> {
- DialogUtils.showOverseaDownloadDialog(context, gameEntity, () -> {
- DialogUtils.checkDownload(context, apk.getSize(),
- isSubscribe -> download(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
+ PackageCheckDialogFragment.show((AppCompatActivity) context, gameEntity.getPackageDialog(), () -> {
+ DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, () -> {
+ CertificationDialog.showCertificationDialog(context, gameEntity, () -> {
+ DialogUtils.showOverseaDownloadDialog(context, gameEntity, () -> {
+ DialogUtils.checkDownload(context, apk.getSize(),
+ isSubscribe -> download(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
+ });
});
});
});
-
DataLogUtils.uploadGameLog(context, gameEntity.getId(), gameEntity.getName(), entrance);
} else if (str.equals(context.getString(R.string.attempt))) {
- DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, () -> {
- CertificationDialog.showCertificationDialog(context, gameEntity, () -> {
- DialogUtils.showVersionNumberDialog(context, gameEntity, () -> {
- DialogUtils.showOverseaDownloadDialog(context, gameEntity, () -> {
- DialogUtils.checkDownload(context, apk.getSize(),
- isSubscribe -> download(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
+ PackageCheckDialogFragment.show((AppCompatActivity) context, gameEntity.getPackageDialog(), () -> {
+ DownloadDialogHelper.findAvailableDialogAndShow(context, gameEntity, apk, () -> {
+ CertificationDialog.showCertificationDialog(context, gameEntity, () -> {
+ DialogUtils.showVersionNumberDialog(context, gameEntity, () -> {
+ DialogUtils.showOverseaDownloadDialog(context, gameEntity, () -> {
+ DialogUtils.checkDownload(context, apk.getSize(),
+ isSubscribe -> download(context, gameEntity, downloadBtn, entrance, location, isSubscribe, traceEvent));
+ });
});
});
});
diff --git a/app/src/main/java/com/gh/common/util/EntranceUtils.java b/app/src/main/java/com/gh/common/util/EntranceUtils.java
index 6a7109b97a..a957e24945 100644
--- a/app/src/main/java/com/gh/common/util/EntranceUtils.java
+++ b/app/src/main/java/com/gh/common/util/EntranceUtils.java
@@ -215,6 +215,7 @@ public class EntranceUtils {
public static final String KEY_BBS_ID = "bbs_id";
public static final String KEY_DIAGNOSIS = "diagnosis";
public static final String KEY_SIMULATOR = "simulator";
+ public static final String KEY_MARKET_DETAILS = "market_details";
public static void jumpActivity(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
diff --git a/app/src/main/java/com/gh/common/util/SpanBuilder.kt b/app/src/main/java/com/gh/common/util/SpanBuilder.kt
index 4c13c49de9..dec35a5c5f 100644
--- a/app/src/main/java/com/gh/common/util/SpanBuilder.kt
+++ b/app/src/main/java/com/gh/common/util/SpanBuilder.kt
@@ -70,12 +70,12 @@ class SpanBuilder(content: CharSequence) {
return this
}
- fun click(start: Int, end: Int, colorRes: Int, onClick: () -> Unit): SpanBuilder {
+ fun click(start: Int, end: Int, colorRes: Int, isUnderlineText: Boolean = false, onClick: () -> Unit): SpanBuilder {
val clickSpan = object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.color = ContextCompat.getColor(HaloApp.getInstance().application, colorRes)
- ds.isUnderlineText = false
+ ds.isUnderlineText = isUnderlineText
}
override fun onClick(widget: View) {
diff --git a/app/src/main/java/com/gh/common/view/AdBannerView.kt b/app/src/main/java/com/gh/common/view/AdBannerView.kt
index 26dde9c6c0..48d75974bb 100644
--- a/app/src/main/java/com/gh/common/view/AdBannerView.kt
+++ b/app/src/main/java/com/gh/common/view/AdBannerView.kt
@@ -3,7 +3,6 @@ package com.gh.common.view
import android.content.Context
import android.util.AttributeSet
import android.view.*
-import android.widget.ImageView
import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
@@ -14,7 +13,6 @@ import com.gh.common.util.ImageUtils
import com.gh.common.util.rxTimer
import com.gh.gamecenter.R
import com.gh.gamecenter.entity.SettingsEntity
-import com.squareup.picasso.Picasso
import io.reactivex.disposables.Disposable
import kotlin.math.abs
diff --git a/app/src/main/java/com/gh/gamecenter/MainActivity.java b/app/src/main/java/com/gh/gamecenter/MainActivity.java
index 159afbed88..82aaca5791 100644
--- a/app/src/main/java/com/gh/gamecenter/MainActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/MainActivity.java
@@ -19,6 +19,7 @@ import android.util.Log;
import android.view.KeyEvent;
import androidx.annotation.NonNull;
+import androidx.annotation.RestrictTo;
import androidx.lifecycle.ViewModelProviders;
import com.gh.base.AppUncaughtHandler;
@@ -71,6 +72,7 @@ import com.gh.gamecenter.eventbus.EBPackage;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.fragment.MainWrapperFragment;
+import com.gh.gamecenter.gamedetail.GameDetailFragment;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.manager.UpdateManager;
import com.gh.gamecenter.manager.UserManager;
@@ -78,12 +80,14 @@ import com.gh.gamecenter.normal.NormalFragment;
import com.gh.gamecenter.packagehelper.PackageRepository;
import com.gh.gamecenter.packagehelper.PackageViewModel;
import com.gh.gamecenter.qa.CommunityFragment;
+import com.gh.gamecenter.retrofit.BiResponse;
import com.gh.gamecenter.retrofit.EmptyResponse;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.suggest.SuggestSelectFragment;
import com.gh.gamecenter.suggest.SuggestType;
import com.google.gson.Gson;
+import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.halo.assistant.HaloApp;
import com.halo.assistant.fragment.SettingsFragment;
@@ -96,6 +100,7 @@ import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
+import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;
@@ -125,9 +130,11 @@ import static com.gh.common.util.EntranceUtils.HOST_QQ;
import static com.gh.common.util.EntranceUtils.HOST_QQ_GROUP;
import static com.gh.common.util.EntranceUtils.HOST_WEB;
import static com.gh.common.util.EntranceUtils.KEY_DATA;
+import static com.gh.common.util.EntranceUtils.KEY_MARKET_DETAILS;
import static com.gh.common.util.EntranceUtils.KEY_NEXT_TO;
import static com.gh.common.util.EntranceUtils.KEY_TO;
import static com.gh.common.util.EntranceUtils.KEY_TYPE;
+import static com.gh.common.util.ExtensionsKt.singleToMain;
import static com.gh.gamecenter.fragment.MainWrapperFragment.INDEX_PERSONAL;
import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
import static com.gh.gamecenter.personal.PersonalFragment.LOGOUT_TAG;
@@ -399,6 +406,9 @@ public class MainActivity extends BaseActivity {
SimulatorGameManager.launchSimulatorGame(downloadEntity, gameEntity);
}
break;
+ case KEY_MARKET_DETAILS:
+ redirectGameDetail(bundle.getString(KEY_DATA));
+ break;
}
}
}
@@ -412,6 +422,29 @@ public class MainActivity extends BaseActivity {
}, 500);
}
+ /**
+ * 应用跳转
+ * @param packageName
+ */
+ @SuppressLint("CheckResult")
+ private void redirectGameDetail(String packageName) {
+ RetrofitManager.getInstance(this).getApi().redirectGameDetail(packageName)
+ .compose(singleToMain())
+ .subscribe(new BiResponse() {
+ @Override
+ public void onSuccess(JsonObject data) {
+ String gameId = data.get("game_id").getAsString();
+ DirectUtils.directToGameDetail(MainActivity.this, gameId, GameDetailFragment.INDEX_DESC, "应用跳转");
+ }
+
+ @Override
+ public void onFailure(@NotNull Exception exception) {
+ super.onFailure(exception);
+ DirectUtils.directToGameDetail(MainActivity.this, "", GameDetailFragment.INDEX_DESC, "应用跳转");
+ }
+ });
+ }
+
private void checkNotificationPermission() {
// 仅登录后再启动光环时请求一次权限
if (UserManager.getInstance().isLoggedIn()) {
diff --git a/app/src/main/java/com/gh/gamecenter/SkipActivity.java b/app/src/main/java/com/gh/gamecenter/SkipActivity.java
index e2e0af420f..0f7231a3e1 100644
--- a/app/src/main/java/com/gh/gamecenter/SkipActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/SkipActivity.java
@@ -80,310 +80,325 @@ public class SkipActivity extends BaseActivity {
Uri uri = getIntent().getData();
Bundle bundle;
if (uri != null) {
- if (CommonDebug.IS_DEBUG) {
- Utils.log("SkipActivity:: Uri=>" + uri.toString());
- }
- String host = uri.getHost();
- String path = uri.getPath();
+ if ("ghzhushou".equals(uri.getScheme())) {
+ if (CommonDebug.IS_DEBUG) {
+ Utils.log("SkipActivity:: Uri=>" + uri.toString());
+ }
+ String host = uri.getHost();
+ String path = uri.getPath();
- String to = uri.getQueryParameter("to");
- String type = uri.getQueryParameter("type");
- String name = uri.getQueryParameter("name");
- String referer = uri.getQueryParameter("referer");
- String id = uri.getQueryParameter("id");
- if (!TextUtils.isEmpty(path)) {
- path = path.substring(1);
- }
+ String to = uri.getQueryParameter("to");
+ String type = uri.getQueryParameter("type");
+ String name = uri.getQueryParameter("name");
+ String referer = uri.getQueryParameter("referer");
+ String id = uri.getQueryParameter("id");
+ if (!TextUtils.isEmpty(path)) {
+ path = path.substring(1);
+ }
- if (host != null) {
- Intent intent;
- switch (host) {
- case HOST_ARTICLE:
- DirectUtils.directToArticle(this, path, ENTRANCE_BROWSER);
- break;
- case HOST_GAME:
- DirectUtils.directToGameDetail(this, path, ENTRANCE_BROWSER, "true".equals(uri.getQueryParameter("auto_download")), to, null);
- break;
- case HOST_COLUMN:
- DirectUtils.directToSubject(this, path, uri.getQueryParameter(KEY_NAME), ENTRANCE_BROWSER);
- break;
- case HOST_SUGGESTION:
- String platform = uri.getQueryParameter(KEY_PLATFORM);
- String platformName = PlatformUtils.getInstance(this).getPlatformName(platform);
- String gameId = uri.getQueryParameter(EntranceUtils.KEY_GAMEID);
- String packageMd5 = uri.getQueryParameter(EntranceUtils.KEY_PACKAGE_MD5);
- String content = (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) ?
- String.format("%s-%s-V%s,",
- uri.getQueryParameter(KEY_GAME_NAME),
- TextUtils.isEmpty(platformName) ? platform : platformName,
- uri.getQueryParameter(KEY_VERSION)) :
- String.format("%s-%s-V%s\n游戏ID:%s\n游戏包MD5:%s\n",
- uri.getQueryParameter(KEY_GAME_NAME),
- TextUtils.isEmpty(platformName) ? platform : platformName,
- uri.getQueryParameter(KEY_VERSION), gameId, packageMd5);
- String qaId = uri.getQueryParameter("qa_id");
- String qaTitle = uri.getQueryParameter(EntranceUtils.KEY_QA_TITLE);
- if (!TextUtils.isEmpty(qaId)) {
- DirectUtils.directToQa(this, qaTitle, qaId);
- } else {
- DirectUtils.directToFeedback(this, content, ENTRANCE_BROWSER);
- }
- break;
- case HOST_DOWNLOAD:
- DirectUtils.directToDownloadManagerAndStartUpdate(this, path, uri.getQueryParameter(KEY_PACKAGENAME), ENTRANCE_BROWSER);
- break;
- case HOST_ANSWER:
- DirectUtils.directToAnswerDetail(this, path, ENTRANCE_BROWSER, "浏览器");
- break;
- case HOST_QUESTION:
- DirectUtils.directToQuestionDetail(this, path, ENTRANCE_BROWSER, "浏览器");
- break;
- case HOST_TOOLBOX:
- DirectUtils.directToToolbox(this, uri.getQueryParameter("gameId"), uri.getQueryParameter("toolboxUrl"), ENTRANCE_BROWSER);
- break;
- case HOST_COMMUNITY:
- UserManager.getInstance().setCommunityData(new CommunityEntity(path, name));
- // 把切换放到 MainActivity 处理
- if (RunningUtils.isRunning(this)
- && MainActivity.class.getName().equals(RunningUtils.getBaseActivity(this))) {
- intent = new Intent(this, MainActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- intent.putExtra(MainActivity.SWITCH_TO_COMMUNITY, true);
- } else {
- bundle = new Bundle();
- bundle.putBoolean(MainActivity.SWITCH_TO_COMMUNITY, true);
- intent = SplashScreenActivity.getSplashScreenIntent(this, bundle);
- }
- startActivity(intent);
- break;
- // 社区文章格式一
- case "community.article":
- DirectUtils.directToCommunityArticle(this, uri.getQueryParameter("articleId"), uri.getQueryParameter("communityId"), ENTRANCE_BROWSER, "浏览器");
- break;
- // 社区文章格式二
- case "communities":
- String communityId = "";
- String typeId = "";
- String[] split = path.split("/");
- for (String text : split) {
- if (TextUtils.isEmpty(communityId)) {
- communityId = text;
- continue;
- }
- if (TextUtils.isEmpty(type)) {
- type = text;
- continue;
- }
- if (TextUtils.isEmpty(typeId)) {
- typeId = text;
- }
- }
- if ("articles".equals(type)) {
- DirectUtils.directToCommunityArticle(this, typeId, communityId, ENTRANCE_BROWSER, "浏览器");
+ if (host != null) {
+ Intent intent;
+ switch (host) {
+ case HOST_ARTICLE:
+ DirectUtils.directToArticle(this, path, ENTRANCE_BROWSER);
break;
- }
- break;
- case HOST_VIDEO:
- DirectUtils.directToVideoDetail(this, path, VideoDetailContainerViewModel.Location.HOTTEST_GAME_VIDEO.getValue(),
- false, id, ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer);
- break;
- case HOST_UPLOAD_VIDEO://跳转上传视频
- String titleParameter = uri.getQueryParameter("title");
- String title = TextUtils.isEmpty(titleParameter) ? "" : "#" + titleParameter + "#";
- String categoryId = uri.getQueryParameter("category_id");
- String link = uri.getQueryParameter("link");
- gameId = uri.getQueryParameter("gameId");
- String gameName = uri.getQueryParameter("gameName");
- String tagActivityId = uri.getQueryParameter("tagActivityId");
- String tagActivityName = uri.getQueryParameter("tagActivityName");
- VideoLinkEntity linkEntity = new VideoLinkEntity(title, categoryId, link, tagActivityId, tagActivityName);
-
- SimpleGameEntity simpleGameEntity = new SimpleGameEntity(gameId != null ? gameId : "", gameName != null ? gameName : "", "");
- Bundle nextToBundle = VideoManagerActivity.getVideoManagerBundle(linkEntity, simpleGameEntity, EntranceUtils.ENTRANCE_BROWSER, "");
- CheckLoginUtils.checkLogin(this, nextToBundle, true, EntranceUtils.ENTRANCE_BROWSER, () ->
- DirectUtils.directToVideoManager(SkipActivity.this, linkEntity, simpleGameEntity, EntranceUtils.ENTRANCE_BROWSER, "浏览器"));
- break;
- case HOST_VIDEO_SINGLE:
- DirectUtils.directToVideoDetail(this, path, VideoDetailContainerViewModel.Location.SINGLE_VIDEO.getValue(),
- false, "", ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer);
- break;
- case HOST_VIDEO_MORE:
- gameId = uri.getQueryParameter("gameId");
- String act = uri.getQueryParameter("act");
- String fieldId = uri.getQueryParameter("fieldId");
- String sectionName = uri.getQueryParameter("sectionName");
- String paginationType = uri.getQueryParameter("paginationType");//活动分页方式 page filter
- String location;
- if (!TextUtils.isEmpty(act)) {
- location = VideoDetailContainerViewModel.Location.VIDEO_ACTIVITY.getValue();
- } else if (!TextUtils.isEmpty(fieldId)) {
- location = VideoDetailContainerViewModel.Location.GAME_ZONE.getValue();
- } else {
- location = path;
- }
- DirectUtils.directToVideoDetail(this, path, location,
- false, TextUtils.isEmpty(gameId) ? "" : gameId, ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer,
- TextUtils.isEmpty(type) ? "" : type, TextUtils.isEmpty(act) ? "" : act, TextUtils.isEmpty(paginationType) ? "page" : paginationType, TextUtils.isEmpty(fieldId) ? "" : fieldId,
- TextUtils.isEmpty(sectionName) ? "" : sectionName);
- break;
- case HOST_VIDEO_STREAMING_HOME:
- // 把切换放到 MainActivity 处理
- if (RunningUtils.isRunning(this)
- && MainActivity.class.getName().equals(RunningUtils.getBaseActivity(this))) {
- intent = new Intent(this, MainActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- intent.putExtra(MainActivity.SWITCH_TO_VIDEO, true);
- } else {
- bundle = new Bundle();
- bundle.putBoolean(MainActivity.SWITCH_TO_VIDEO, true);
- intent = SplashScreenActivity.getSplashScreenIntent(this, bundle);
- }
- startActivity(intent);
- break;
- case HOST_VIDEO_STREAMING_DESC:
- DirectUtils.directToGameDetailVideoStreaming(this, path, ENTRANCE_BROWSER);
- break;
- case HOST_VIDEO_COLLECTION:
- DirectUtils.directToGameVideo(this, path, ENTRANCE_BROWSER, "浏览器");
- break;
- case HOST_QQ:
- bundle = new Bundle();
- bundle.putString(KEY_TO, HOST_QQ);
- bundle.putString(KEY_DATA, path);
- EntranceUtils.jumpActivity(this, bundle);
- break;
- case HOST_QQ_GROUP:
- bundle = new Bundle();
- bundle.putString(KEY_TO, HOST_QQ_GROUP);
- bundle.putString(KEY_DATA, path);
- EntranceUtils.jumpActivity(this, bundle);
- break;
- case HOST_QQ_QUN:
- String key = uri.getQueryParameter("key");
- bundle = new Bundle();
- bundle.putString(KEY_TO, HOST_QQ_GROUP);
- bundle.putString(KEY_DATA, key);
- EntranceUtils.jumpActivity(this, bundle);
- break;
- case HOST_WEB:
- bundle = new Bundle();
- bundle.putString(KEY_TO, HOST_WEB);
- bundle.putString(KEY_DATA, to);
- bundle.putString(KEY_TYPE, type);
- EntranceUtils.jumpActivity(this, bundle);
- break;
- case HOST_LIBAO:
- DirectUtils.directToGiftDetail(this, path, ENTRANCE_BROWSER);
- break;
- case HOST_USERHOME:
- String position = uri.getQueryParameter("position");
- DirectUtils.directToHomeActivity(this, path, TextUtils.isEmpty(position) ? -1 : Integer.parseInt(position), ENTRANCE_BROWSER, "浏览器");
- break;
- case HOST_COMMUNITY_COLUMN:
- CommunityEntity community = new CommunityEntity();
- community.setId(uri.getQueryParameter("community_id"));
- community.setName(uri.getQueryParameter("community_name"));
- String columnId = uri.getQueryParameter("column_id");
- DirectUtils.directToCommunityColumn(this, community, columnId, ENTRANCE_BROWSER, "");
- break;
-
- case HOST_CATEGORY:
- title = uri.getQueryParameter("title");
- DirectUtils.directCategoryDirectory(this, path, title, ENTRANCE_BROWSER, "浏览器");
- break;
- case HOST_COLUMN_COLLECTION:
- DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "浏览器");
- break;
- case HOST_COMMUNITY_QUESTION_LABEL_DETAIL:
- community = new CommunityEntity();
- community.setId(uri.getQueryParameter("community_id"));
- community.setName(uri.getQueryParameter("community_name"));
- String tag = uri.getQueryParameter("tag");
- DirectUtils.directAskColumnLabelDetail(this, tag, community, ENTRANCE_BROWSER, "浏览器");
- break;
- case HOST_COMMUNITY_COLUMN_DETAIL:
- community = new CommunityEntity();
- community.setId(uri.getQueryParameter("community_id"));
- community.setName(uri.getQueryParameter("community_name"));
- columnId = uri.getQueryParameter("column_id");
- DirectUtils.directAskColumnDetail(this, columnId, community, ENTRANCE_BROWSER, "浏览器");
- break;
- case EntranceUtils.HOST_BLOCK:
- name = uri.getQueryParameter("name");
- SubjectRecommendEntity entity = new SubjectRecommendEntity();
- entity.setLink(path);
- entity.setName(name);
- entity.setText(name);
- DirectUtils.directToBlock(this, entity, mEntrance);
- break;
-
- case EntranceUtils.HOST_SERVER_BLOCK:
- DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器");
- break;
-
- case EntranceUtils.HOST_AMWAY_BLOCK:
- DirectUtils.directToAmway(this, null, ENTRANCE_BROWSER, "浏览器");
- break;
-
- case EntranceUtils.HOST_HELP:
- name = uri.getQueryParameter("name");
- DirectUtils.directToQa(this, name, path);
- break;
-
- case EntranceUtils.HOST_HELP_COLLECTION:
- name = uri.getQueryParameter("name");
- DirectUtils.directToQaCollection(this, name, path);
- break;
- case EntranceUtils.HOST_GAME_UPLOAD:
- DirectUtils.directGameUpload(this, ENTRANCE_BROWSER, "浏览器");
- break;
- case EntranceUtils.HOST_GAME_ZONE:
- String zoneUrl = uri.getQueryParameter("url");
- DirectUtils.directGameZone(this, path, zoneUrl, ENTRANCE_BROWSER);
- break;
- case EntranceUtils.HOST_LINK:
- try {
- String dataString = uri.getQueryParameter("data");
- if (!TextUtils.isEmpty(dataString)) {
- byte[] linkData = Base64.decode(dataString, Base64.DEFAULT);
- String linkDataString = new String(linkData, "UTF-8");
- LinkEntity le = GsonUtils.INSTANCE.getGson().fromJson(linkDataString, LinkEntity.class);
- DirectUtils.directToLinkPage(this, le, ENTRANCE_BROWSER, "");
+ case HOST_GAME:
+ DirectUtils.directToGameDetail(this, path, ENTRANCE_BROWSER, "true".equals(uri.getQueryParameter("auto_download")), to, null);
+ break;
+ case HOST_COLUMN:
+ DirectUtils.directToSubject(this, path, uri.getQueryParameter(KEY_NAME), ENTRANCE_BROWSER);
+ break;
+ case HOST_SUGGESTION:
+ String platform = uri.getQueryParameter(KEY_PLATFORM);
+ String platformName = PlatformUtils.getInstance(this).getPlatformName(platform);
+ String gameId = uri.getQueryParameter(EntranceUtils.KEY_GAMEID);
+ String packageMd5 = uri.getQueryParameter(EntranceUtils.KEY_PACKAGE_MD5);
+ String content = (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(packageMd5)) ?
+ String.format("%s-%s-V%s,",
+ uri.getQueryParameter(KEY_GAME_NAME),
+ TextUtils.isEmpty(platformName) ? platform : platformName,
+ uri.getQueryParameter(KEY_VERSION)) :
+ String.format("%s-%s-V%s\n游戏ID:%s\n游戏包MD5:%s\n",
+ uri.getQueryParameter(KEY_GAME_NAME),
+ TextUtils.isEmpty(platformName) ? platform : platformName,
+ uri.getQueryParameter(KEY_VERSION), gameId, packageMd5);
+ String qaId = uri.getQueryParameter("qa_id");
+ String qaTitle = uri.getQueryParameter(EntranceUtils.KEY_QA_TITLE);
+ if (!TextUtils.isEmpty(qaId)) {
+ DirectUtils.directToQa(this, qaTitle, qaId);
+ } else {
+ DirectUtils.directToFeedback(this, content, ENTRANCE_BROWSER);
}
- } catch (Exception e) {
- e.printStackTrace();
- toast(e.getMessage());
- }
- break;
- case EntranceUtils.HOST_GAME_NEWS:
- DirectUtils.directToGameNews(
- this,
- uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
- uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
- EntranceUtils.ENTRANCE_BROWSER);
- break;
- case EntranceUtils.HOST_GAME_CALENDAR:
- DirectUtils.directToGameServerCalendar(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID));
- break;
- case EntranceUtils.HOST_HISTORY_APK:
- DirectUtils.directToHistoryApk(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID));
- break;
- case EntranceUtils.HOST_FORUM_DETAIL:
- DirectUtils.directForumDetail(this, id, ENTRANCE_BROWSER);
- break;
- case EntranceUtils.HOST_GAME_RATING_DETAIL:
- DirectUtils.directToGameRatingDetail(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID), uri.getQueryParameter(EntranceUtils.KEY_COMMENT_ID), ENTRANCE_BROWSER);
- break;
- case EntranceUtils.HOST_FORUM:
- DirectUtils.directToForum(this);
- break;
- case EntranceUtils.HOST_HELP_AND_FEEDBACK:
- position = uri.getQueryParameter("position");
- DirectUtils.directToHelpAndFeedback(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position));
- break;
- default:
+ break;
+ case HOST_DOWNLOAD:
+ DirectUtils.directToDownloadManagerAndStartUpdate(this, path, uri.getQueryParameter(KEY_PACKAGENAME), ENTRANCE_BROWSER);
+ break;
+ case HOST_ANSWER:
+ DirectUtils.directToAnswerDetail(this, path, ENTRANCE_BROWSER, "浏览器");
+ break;
+ case HOST_QUESTION:
+ DirectUtils.directToQuestionDetail(this, path, ENTRANCE_BROWSER, "浏览器");
+ break;
+ case HOST_TOOLBOX:
+ DirectUtils.directToToolbox(this, uri.getQueryParameter("gameId"), uri.getQueryParameter("toolboxUrl"), ENTRANCE_BROWSER);
+ break;
+ case HOST_COMMUNITY:
+ UserManager.getInstance().setCommunityData(new CommunityEntity(path, name));
+ // 把切换放到 MainActivity 处理
+ if (RunningUtils.isRunning(this)
+ && MainActivity.class.getName().equals(RunningUtils.getBaseActivity(this))) {
+ intent = new Intent(this, MainActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.putExtra(MainActivity.SWITCH_TO_COMMUNITY, true);
+ } else {
+ bundle = new Bundle();
+ bundle.putBoolean(MainActivity.SWITCH_TO_COMMUNITY, true);
+ intent = SplashScreenActivity.getSplashScreenIntent(this, bundle);
+ }
+ startActivity(intent);
+ break;
+ // 社区文章格式一
+ case "community.article":
+ DirectUtils.directToCommunityArticle(this, uri.getQueryParameter("articleId"), uri.getQueryParameter("communityId"), ENTRANCE_BROWSER, "浏览器");
+ break;
+ // 社区文章格式二
+ case "communities":
+ String communityId = "";
+ String typeId = "";
+ String[] split = path.split("/");
+ for (String text : split) {
+ if (TextUtils.isEmpty(communityId)) {
+ communityId = text;
+ continue;
+ }
+ if (TextUtils.isEmpty(type)) {
+ type = text;
+ continue;
+ }
+ if (TextUtils.isEmpty(typeId)) {
+ typeId = text;
+ }
+ }
+ if ("articles".equals(type)) {
+ DirectUtils.directToCommunityArticle(this, typeId, communityId, ENTRANCE_BROWSER, "浏览器");
+ break;
+ }
+ break;
+ case HOST_VIDEO:
+ DirectUtils.directToVideoDetail(this, path, VideoDetailContainerViewModel.Location.HOTTEST_GAME_VIDEO.getValue(),
+ false, id, ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer);
+ break;
+ case HOST_UPLOAD_VIDEO://跳转上传视频
+ String titleParameter = uri.getQueryParameter("title");
+ String title = TextUtils.isEmpty(titleParameter) ? "" : "#" + titleParameter + "#";
+ String categoryId = uri.getQueryParameter("category_id");
+ String link = uri.getQueryParameter("link");
+ gameId = uri.getQueryParameter("gameId");
+ String gameName = uri.getQueryParameter("gameName");
+ String tagActivityId = uri.getQueryParameter("tagActivityId");
+ String tagActivityName = uri.getQueryParameter("tagActivityName");
+ VideoLinkEntity linkEntity = new VideoLinkEntity(title, categoryId, link, tagActivityId, tagActivityName);
+
+ SimpleGameEntity simpleGameEntity = new SimpleGameEntity(gameId != null ? gameId : "", gameName != null ? gameName : "", "");
+ Bundle nextToBundle = VideoManagerActivity.getVideoManagerBundle(linkEntity, simpleGameEntity, EntranceUtils.ENTRANCE_BROWSER, "");
+ CheckLoginUtils.checkLogin(this, nextToBundle, true, EntranceUtils.ENTRANCE_BROWSER, () ->
+ DirectUtils.directToVideoManager(SkipActivity.this, linkEntity, simpleGameEntity, EntranceUtils.ENTRANCE_BROWSER, "浏览器"));
+ break;
+ case HOST_VIDEO_SINGLE:
+ DirectUtils.directToVideoDetail(this, path, VideoDetailContainerViewModel.Location.SINGLE_VIDEO.getValue(),
+ false, "", ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer);
+ break;
+ case HOST_VIDEO_MORE:
+ gameId = uri.getQueryParameter("gameId");
+ String act = uri.getQueryParameter("act");
+ String fieldId = uri.getQueryParameter("fieldId");
+ String sectionName = uri.getQueryParameter("sectionName");
+ String paginationType = uri.getQueryParameter("paginationType");//活动分页方式 page filter
+ String location;
+ if (!TextUtils.isEmpty(act)) {
+ location = VideoDetailContainerViewModel.Location.VIDEO_ACTIVITY.getValue();
+ } else if (!TextUtils.isEmpty(fieldId)) {
+ location = VideoDetailContainerViewModel.Location.GAME_ZONE.getValue();
+ } else {
+ location = path;
+ }
+ DirectUtils.directToVideoDetail(this, path, location,
+ false, TextUtils.isEmpty(gameId) ? "" : gameId, ENTRANCE_BROWSER, "浏览器", TextUtils.isEmpty(referer) ? "" : referer,
+ TextUtils.isEmpty(type) ? "" : type, TextUtils.isEmpty(act) ? "" : act, TextUtils.isEmpty(paginationType) ? "page" : paginationType, TextUtils.isEmpty(fieldId) ? "" : fieldId,
+ TextUtils.isEmpty(sectionName) ? "" : sectionName);
+ break;
+ case HOST_VIDEO_STREAMING_HOME:
+ // 把切换放到 MainActivity 处理
+ if (RunningUtils.isRunning(this)
+ && MainActivity.class.getName().equals(RunningUtils.getBaseActivity(this))) {
+ intent = new Intent(this, MainActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.putExtra(MainActivity.SWITCH_TO_VIDEO, true);
+ } else {
+ bundle = new Bundle();
+ bundle.putBoolean(MainActivity.SWITCH_TO_VIDEO, true);
+ intent = SplashScreenActivity.getSplashScreenIntent(this, bundle);
+ }
+ startActivity(intent);
+ break;
+ case HOST_VIDEO_STREAMING_DESC:
+ DirectUtils.directToGameDetailVideoStreaming(this, path, ENTRANCE_BROWSER);
+ break;
+ case HOST_VIDEO_COLLECTION:
+ DirectUtils.directToGameVideo(this, path, ENTRANCE_BROWSER, "浏览器");
+ break;
+ case HOST_QQ:
+ bundle = new Bundle();
+ bundle.putString(KEY_TO, HOST_QQ);
+ bundle.putString(KEY_DATA, path);
+ EntranceUtils.jumpActivity(this, bundle);
+ break;
+ case HOST_QQ_GROUP:
+ bundle = new Bundle();
+ bundle.putString(KEY_TO, HOST_QQ_GROUP);
+ bundle.putString(KEY_DATA, path);
+ EntranceUtils.jumpActivity(this, bundle);
+ break;
+ case HOST_QQ_QUN:
+ String key = uri.getQueryParameter("key");
+ bundle = new Bundle();
+ bundle.putString(KEY_TO, HOST_QQ_GROUP);
+ bundle.putString(KEY_DATA, key);
+ EntranceUtils.jumpActivity(this, bundle);
+ break;
+ case HOST_WEB:
+ bundle = new Bundle();
+ bundle.putString(KEY_TO, HOST_WEB);
+ bundle.putString(KEY_DATA, to);
+ bundle.putString(KEY_TYPE, type);
+ EntranceUtils.jumpActivity(this, bundle);
+ break;
+ case HOST_LIBAO:
+ DirectUtils.directToGiftDetail(this, path, ENTRANCE_BROWSER);
+ break;
+ case HOST_USERHOME:
+ String position = uri.getQueryParameter("position");
+ DirectUtils.directToHomeActivity(this, path, TextUtils.isEmpty(position) ? -1 : Integer.parseInt(position), ENTRANCE_BROWSER, "浏览器");
+ break;
+ case HOST_COMMUNITY_COLUMN:
+ CommunityEntity community = new CommunityEntity();
+ community.setId(uri.getQueryParameter("community_id"));
+ community.setName(uri.getQueryParameter("community_name"));
+ String columnId = uri.getQueryParameter("column_id");
+ DirectUtils.directToCommunityColumn(this, community, columnId, ENTRANCE_BROWSER, "");
+ break;
+
+ case HOST_CATEGORY:
+ title = uri.getQueryParameter("title");
+ DirectUtils.directCategoryDirectory(this, path, title, ENTRANCE_BROWSER, "浏览器");
+ break;
+ case HOST_COLUMN_COLLECTION:
+ DirectUtils.directToColumnCollection(this, path, -1, ENTRANCE_BROWSER, "浏览器");
+ break;
+ case HOST_COMMUNITY_QUESTION_LABEL_DETAIL:
+ community = new CommunityEntity();
+ community.setId(uri.getQueryParameter("community_id"));
+ community.setName(uri.getQueryParameter("community_name"));
+ String tag = uri.getQueryParameter("tag");
+ DirectUtils.directAskColumnLabelDetail(this, tag, community, ENTRANCE_BROWSER, "浏览器");
+ break;
+ case HOST_COMMUNITY_COLUMN_DETAIL:
+ community = new CommunityEntity();
+ community.setId(uri.getQueryParameter("community_id"));
+ community.setName(uri.getQueryParameter("community_name"));
+ columnId = uri.getQueryParameter("column_id");
+ DirectUtils.directAskColumnDetail(this, columnId, community, ENTRANCE_BROWSER, "浏览器");
+ break;
+ case EntranceUtils.HOST_BLOCK:
+ name = uri.getQueryParameter("name");
+ SubjectRecommendEntity entity = new SubjectRecommendEntity();
+ entity.setLink(path);
+ entity.setName(name);
+ entity.setText(name);
+ DirectUtils.directToBlock(this, entity, mEntrance);
+ break;
+
+ case EntranceUtils.HOST_SERVER_BLOCK:
+ DirectUtils.directToGameServers(this, ENTRANCE_BROWSER, "浏览器");
+ break;
+
+ case EntranceUtils.HOST_AMWAY_BLOCK:
+ DirectUtils.directToAmway(this, null, ENTRANCE_BROWSER, "浏览器");
+ break;
+
+ case EntranceUtils.HOST_HELP:
+ name = uri.getQueryParameter("name");
+ DirectUtils.directToQa(this, name, path);
+ break;
+
+ case EntranceUtils.HOST_HELP_COLLECTION:
+ name = uri.getQueryParameter("name");
+ DirectUtils.directToQaCollection(this, name, path);
+ break;
+ case EntranceUtils.HOST_GAME_UPLOAD:
+ DirectUtils.directGameUpload(this, ENTRANCE_BROWSER, "浏览器");
+ break;
+ case EntranceUtils.HOST_GAME_ZONE:
+ String zoneUrl = uri.getQueryParameter("url");
+ DirectUtils.directGameZone(this, path, zoneUrl, ENTRANCE_BROWSER);
+ break;
+ case EntranceUtils.HOST_LINK:
+ try {
+ String dataString = uri.getQueryParameter("data");
+ if (!TextUtils.isEmpty(dataString)) {
+ byte[] linkData = Base64.decode(dataString, Base64.DEFAULT);
+ String linkDataString = new String(linkData, "UTF-8");
+ LinkEntity le = GsonUtils.INSTANCE.getGson().fromJson(linkDataString, LinkEntity.class);
+ DirectUtils.directToLinkPage(this, le, ENTRANCE_BROWSER, "");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ toast(e.getMessage());
+ }
+ break;
+ case EntranceUtils.HOST_GAME_NEWS:
+ DirectUtils.directToGameNews(
+ this,
+ uri.getQueryParameter(EntranceUtils.KEY_GAME_ID),
+ uri.getQueryParameter(EntranceUtils.KEY_GAME_NAME),
+ EntranceUtils.ENTRANCE_BROWSER);
+ break;
+ case EntranceUtils.HOST_GAME_CALENDAR:
+ DirectUtils.directToGameServerCalendar(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID));
+ break;
+ case EntranceUtils.HOST_HISTORY_APK:
+ DirectUtils.directToHistoryApk(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID));
+ break;
+ case EntranceUtils.HOST_FORUM_DETAIL:
+ DirectUtils.directForumDetail(this, id, ENTRANCE_BROWSER);
+ break;
+ case EntranceUtils.HOST_GAME_RATING_DETAIL:
+ DirectUtils.directToGameRatingDetail(this, uri.getQueryParameter(EntranceUtils.KEY_GAME_ID), uri.getQueryParameter(EntranceUtils.KEY_COMMENT_ID), ENTRANCE_BROWSER);
+ break;
+ case EntranceUtils.HOST_FORUM:
+ DirectUtils.directToForum(this);
+ break;
+ case EntranceUtils.HOST_HELP_AND_FEEDBACK:
+ position = uri.getQueryParameter("position");
+ DirectUtils.directToHelpAndFeedback(this, TextUtils.isEmpty(position) ? 0 : Integer.parseInt(position));
+ break;
+ default:
+ EntranceUtils.jumpActivity(this, new Bundle()); // 跳转至首页
+ return;
+ }
+ }
+ } else if ("market".equals(uri.getScheme())) {
+ String host = uri.getHost();
+ String id = uri.getQueryParameter("id");
+ if (host != null) {
+ if ("details".equals(host)) {
+ bundle = new Bundle();
+ bundle.putString(KEY_TO, EntranceUtils.KEY_MARKET_DETAILS);
+ bundle.putString(KEY_DATA, id);
+ EntranceUtils.jumpActivity(this, bundle);
+ } else {
EntranceUtils.jumpActivity(this, new Bundle()); // 跳转至首页
- return;
+ }
}
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/DetailViewHolder.java b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/DetailViewHolder.java
index 64d412511a..c204fb320e 100644
--- a/app/src/main/java/com/gh/gamecenter/adapter/viewholder/DetailViewHolder.java
+++ b/app/src/main/java/com/gh/gamecenter/adapter/viewholder/DetailViewHolder.java
@@ -12,6 +12,7 @@ import androidx.fragment.app.FragmentActivity;
import com.gh.common.dialog.CertificationDialog;
import com.gh.common.dialog.DeviceRemindDialog;
import com.gh.common.dialog.GameOffServiceDialogFragment;
+import com.gh.common.dialog.PackageCheckDialogFragment;
import com.gh.common.dialog.ReserveDialogFragment;
import com.gh.common.exposure.ExposureEvent;
import com.gh.common.history.HistoryHelper;
@@ -43,6 +44,7 @@ import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.gamedetail.GameDetailFragment;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.FileUtils;
+import com.lightgame.utils.AppManager;
import com.lightgame.utils.Utils;
import org.greenrobot.eventbus.EventBus;
@@ -165,25 +167,29 @@ public class DetailViewHolder {
PermissionHelper.checkStoragePermissionBeforeAction(mViewHolder.context, () -> {
if (mGameEntity.getApk().size() == 1) {
ApkEntity apk = mGameEntity.getApk().get(0);
- DownloadDialogHelper.findAvailableDialogAndShow(mViewHolder.context, mGameEntity, apk,
- () -> {
- CertificationDialog.showCertificationDialog(mViewHolder.context, mGameEntity, () -> {
- DialogUtils.showVersionNumberDialog(mViewHolder.context, mGameEntity, () -> {
- DialogUtils.showOverseaDownloadDialog(mViewHolder.context, mGameEntity, () -> {
- DialogUtils.checkDownload(mViewHolder.context, apk.getSize(), this::download);
- });
+ PackageCheckDialogFragment.show((AppCompatActivity) mViewHolder.context, mGameEntity.getPackageDialog(), () -> {
+ DownloadDialogHelper.findAvailableDialogAndShow(mViewHolder.context, mGameEntity, apk, () -> {
+ CertificationDialog.showCertificationDialog(mViewHolder.context, mGameEntity, () -> {
+ DialogUtils.showVersionNumberDialog(mViewHolder.context, mGameEntity, () -> {
+ DialogUtils.showOverseaDownloadDialog(mViewHolder.context, mGameEntity, () -> {
+ DialogUtils.checkDownload(mViewHolder.context, apk.getSize(), this::download);
});
});
});
+ });
+ });
+
} else {
- CertificationDialog.showCertificationDialog(mViewHolder.context, mGameEntity, () -> {
- DialogUtils.showVersionNumberDialog(mViewHolder.context, mGameEntity, () -> {
- DownloadDialog.showDownloadDialog(
- mViewHolder.context,
- mGameEntity,
- mTraceEvent,
- StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"),
- mName + ":" + mTitle);
+ PackageCheckDialogFragment.show((AppCompatActivity) mViewHolder.context, mGameEntity.getPackageDialog(), () -> {
+ CertificationDialog.showCertificationDialog(mViewHolder.context, mGameEntity, () -> {
+ DialogUtils.showVersionNumberDialog(mViewHolder.context, mGameEntity, () -> {
+ DownloadDialog.showDownloadDialog(
+ mViewHolder.context,
+ mGameEntity,
+ mTraceEvent,
+ StringUtils.buildString(mEntrance, "+(", mName, "[", mTitle, "])"),
+ mName + ":" + mTitle);
+ });
});
});
}
diff --git a/app/src/main/java/com/gh/gamecenter/entity/GameEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/GameEntity.kt
index d097349bf6..7eb7e27f47 100644
--- a/app/src/main/java/com/gh/gamecenter/entity/GameEntity.kt
+++ b/app/src/main/java/com/gh/gamecenter/entity/GameEntity.kt
@@ -223,8 +223,10 @@ data class GameEntity(
@SerializedName("is_recently_played")
var isRecentlyPlayed: Boolean = false,
var active: Boolean = true,
+ @SerializedName("package_dialog")
+ val packageDialog: PackageDialogEntity? = null,
- // 本地字段,使用镜像信息
+ // 本地字段,使用镜像信息
var useMirrorInfo: Boolean = false,
// 从启动弹窗跳转到对应游戏列表时候记录的启动弹窗数据 (ugly ugly ugly)
var welcomeDialogId: String? = null,
diff --git a/app/src/main/java/com/gh/gamecenter/entity/PackageDialogEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/PackageDialogEntity.kt
new file mode 100644
index 0000000000..2462a17888
--- /dev/null
+++ b/app/src/main/java/com/gh/gamecenter/entity/PackageDialogEntity.kt
@@ -0,0 +1,44 @@
+package com.gh.gamecenter.entity
+
+import android.os.Parcelable
+import com.google.gson.annotations.SerializedName
+import kotlinx.android.parcel.Parcelize
+
+@Parcelize
+data class PackageDialogEntity(
+ val title: String = "",
+ val content: String = "",
+ @SerializedName("detection_objects")
+ val detectionObjects: ArrayList = arrayListOf(),
+ @SerializedName("link_hint_text")
+ val linkHintText: String = "",
+ val links: ArrayList = arrayListOf(),
+ val level: String = "HINT_SKIP"// 弹窗级别,HINT_SKIP(提示且跳转)、ALWAYS_HINT(仅提示(每次提示))、OPTIONAL_HINT(仅提示(可不再提示))
+) : Parcelable
+
+@Parcelize
+data class DetectionObjectEntity(
+ val text: String = "",
+ val packages: ArrayList = arrayListOf()
+) : Parcelable
+
+@Parcelize
+data class PackageLink(
+ val text: String = "",
+ @SerializedName("link_type")
+ val linkType: String = "",
+ @SerializedName("link_id")
+ val linkId: String = "",
+ @SerializedName("link_text")
+ val linkText: String = "",
+ @SerializedName("button_link")
+ val buttonLink: Boolean = false
+) : Parcelable {
+ fun transform(): LinkEntity {
+ val entity = LinkEntity()
+ entity.linkText = linkText
+ entity.type = linkType
+ entity.link = linkId
+ return entity
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java
index 9fe942e066..091c532484 100644
--- a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java
+++ b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java
@@ -2753,4 +2753,10 @@ public interface ApiService {
*/
@GET("./bbses:search")
Observable> searchForumContent(@QueryMap HashMap map, @Query("page") int page);
+
+ /**
+ * 应用跳转
+ */
+ @GET("packages/{package}/redirect")
+ Single redirectGameDetail(@Path("package") String packageName);
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/package_check_complete_bg.xml b/app/src/main/res/drawable/package_check_complete_bg.xml
new file mode 100644
index 0000000000..47afa8527b
--- /dev/null
+++ b/app/src/main/res/drawable/package_check_complete_bg.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_package_check.xml b/app/src/main/res/layout/fragment_package_check.xml
new file mode 100644
index 0000000000..7db9c07e21
--- /dev/null
+++ b/app/src/main/res/layout/fragment_package_check.xml
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/package_check_item.xml b/app/src/main/res/layout/package_check_item.xml
new file mode 100644
index 0000000000..ec9d2a191c
--- /dev/null
+++ b/app/src/main/res/layout/package_check_item.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 9e731edf75..d097824ed9 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -211,6 +211,9 @@
#FFA142
#06CCF4
#F8A142
+ #f9f9f9
+ #FF4147
+ #a9a9a9
#99666666