diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b6e2e2bd8b..50de3686bd 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,6 +7,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/gh/common/constant/Config.java b/app/src/main/java/com/gh/common/constant/Config.java
index 8527b4e346..7badb27dda 100644
--- a/app/src/main/java/com/gh/common/constant/Config.java
+++ b/app/src/main/java/com/gh/common/constant/Config.java
@@ -26,6 +26,7 @@ import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.entity.AppEntity;
+import com.gh.gamecenter.entity.FloatWindowSettingEntity;
import com.gh.gamecenter.entity.GameGuidePopupEntity;
import com.gh.gamecenter.entity.NewApiSettingsEntity;
import com.gh.gamecenter.entity.NewSettingsEntity;
@@ -82,6 +83,8 @@ public class Config {
private static VSetting mVSetting;
private volatile static VNewSetting mVNewSetting;
+ private static FloatWindowSettingEntity mFloatWindowSetting;
+
private static AppEntity mNew32UpdateEntity;
private static BehaviorSubject vNewSettingSubject = BehaviorSubject.create();
private static GameGuidePopupEntity mGameGuidePopupEntity;
@@ -213,6 +216,21 @@ public class Config {
}
return mVNewSetting;
}
+ @Nullable
+ public static FloatWindowSettingEntity getFloatWindowSettingEntity() {
+ if (mFloatWindowSetting == null) {
+ try {
+ String json = SPUtils.getString(Constants.SP_FLOAT_WINDOW_SETTINGS);
+ if (!TextUtils.isEmpty(json)) {
+ mFloatWindowSetting = GsonUtils.fromJson(json, FloatWindowSettingEntity.class);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return mFloatWindowSetting;
+ }
+
@NonNull
public static Observable getVNewSettingObservable() {
@@ -330,6 +348,7 @@ public class Config {
refreshVSettingEntity();
getNewSetting();
+ getFloatWindowSetting();
RetrofitManager.getInstance()
.getApi().getGameGuidePopup(Build.MANUFACTURER, Build.VERSION.RELEASE, Build.MODEL, channel, BuildConfig.VERSION_NAME)
@@ -408,6 +427,20 @@ public class Config {
}
}
+ @SuppressLint("CheckResult")
+ private static void getFloatWindowSetting() {
+ RetrofitManager.getInstance().getNewApi()
+ .getFloatWindowSettings()
+ .subscribeOn(Schedulers.io())
+ .subscribe(new BiResponse() {
+ @Override
+ public void onSuccess(FloatWindowSettingEntity data) {
+ mFloatWindowSetting = data;
+ SPUtils.setString(Constants.SP_FLOAT_WINDOW_SETTINGS, GsonUtils.toJson(data));
+ }
+ });
+ }
+
public static void observePackageChange(NewApiSettingsEntity.PackageObserveActions packageObserveActions) {
PackageChangeBroadcastReceiver receiver = new PackageChangeBroadcastReceiver(packageObserveActions);
IntentFilter intentFilter = new IntentFilter();
diff --git a/app/src/main/java/com/gh/common/util/DirectUtils.kt b/app/src/main/java/com/gh/common/util/DirectUtils.kt
index 5d3f639e3c..4b0583a25b 100644
--- a/app/src/main/java/com/gh/common/util/DirectUtils.kt
+++ b/app/src/main/java/com/gh/common/util/DirectUtils.kt
@@ -179,7 +179,8 @@ object DirectUtils {
"bbs_section",
"qa",
"feedback",
- "toolkit"
+ "toolkit",
+ "float_window_game"
)
fun directToLinkPage(
@@ -551,6 +552,22 @@ object DirectUtils {
MiniGameItemHelper.launchMiniGame(it, Constants.WECHAT_MINI_GAME)
}
+ "float_window_game" -> linkEntity.link?.let { link ->
+ if (PackageUtils.isInstalled(context, Constants.TOOL_MAP_PACKAGE_NAME)) {
+ val intent = Intent(
+ Intent.ACTION_VIEW,
+ Uri.parse("ghtoolmap://floatWindow")
+ ).also {
+ it.addCategory(Intent.CATEGORY_DEFAULT)
+ it.addCategory(Intent.CATEGORY_BROWSABLE)
+ it.putExtra("gameId", linkEntity.link)
+ }
+ context.startActivity(intent)
+ } else {
+ directToGameDetail(context, Config.getFloatWindowSettingEntity()?.gameId ?: "")
+ }
+ }
+
"" -> {
// do nothing
}
diff --git a/app/src/main/java/com/gh/gamecenter/entity/FloatWindowSettingEntity.kt b/app/src/main/java/com/gh/gamecenter/entity/FloatWindowSettingEntity.kt
new file mode 100644
index 0000000000..d7f3a97efb
--- /dev/null
+++ b/app/src/main/java/com/gh/gamecenter/entity/FloatWindowSettingEntity.kt
@@ -0,0 +1,11 @@
+package com.gh.gamecenter.entity
+
+import com.google.gson.annotations.SerializedName
+
+class FloatWindowSettingEntity(
+ /**
+ * 光环工具服务APP的游戏ID
+ */
+ @SerializedName("game_id")
+ var gameId: String? = ""
+)
\ 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 9ab1bc95dd..4fee92cc4c 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
@@ -29,6 +29,7 @@ import com.gh.gamecenter.entity.DialogEntity;
import com.gh.gamecenter.entity.DiscoveryGameCardEntity;
import com.gh.gamecenter.entity.DiscoveryGameCardLabel;
import com.gh.gamecenter.entity.DiverterEntity;
+import com.gh.gamecenter.entity.FloatWindowSettingEntity;
import com.gh.gamecenter.entity.FollowCommonContentCollection;
import com.gh.gamecenter.entity.FollowDynamicEntity;
import com.gh.gamecenter.entity.FollowUserEntity;
@@ -836,6 +837,9 @@ public interface ApiService {
@Query("systemVersion") int systemVersion,
@Query("ghVersion") String ghVersion);
+ @GET("float_window_game/settings")
+ Single getFloatWindowSettings();
+
@GET("/settings/game_installed/whitelist")
Single getInstallWhitelist();
diff --git a/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java b/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java
index 2193fab82f..b31a615502 100644
--- a/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java
+++ b/module_common/src/main/java/com/gh/gamecenter/common/constant/Constants.java
@@ -209,6 +209,9 @@ public class Constants {
// 新接口配置项
public static final String SP_NEW_API_SETTINGS = "new_api_settings";
+ // 工具服务APP悬浮窗配置
+ public static final String SP_FLOAT_WINDOW_SETTINGS = "float_window_settings";
+
// 畅玩组件的配置
public static final String SP_V_SETTINGS = "v_settings";
@@ -469,6 +472,8 @@ public class Constants {
public static final String SP_BRAND_NEW_FIRST_LAUNCH_TIME = "brand_new_first_launch_time"; // 全新安装用户首次启动时间
-
public static final String IS_RESERVE_ONLINE_REMINDER = "is_reserve_online_reminder";
+
+ public static final String TOOL_MAP_PACKAGE_NAME = "com.gh.toolmap";// 光环工具服务APP包名
+
}