From 2eec3de87b6b616a69a46c1f97c2397159031d2f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 21 十一月 2023 18:01:43 +0800
Subject: [PATCH] 广告升级/bug修复

---
 BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java |  117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 117 insertions(+), 0 deletions(-)

diff --git a/BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java b/BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java
index dc28af9..58cbdff 100644
--- a/BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java
+++ b/BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java
@@ -3,10 +3,22 @@
 import android.content.Context;
 import android.content.SharedPreferences;
 
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
 import com.lcjian.library.util.common.StringUtils;
+import com.weikou.beibeivideo.entity.HomeAd;
+import com.weikou.beibeivideo.entity.vo.BannerVO;
 
+import org.json.JSONObject;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 public class ConfigUtil {
@@ -20,6 +32,12 @@
     }
 
 
+    /**
+     * 缃戦〉鍔犻�熷煙鍚�
+     *
+     * @param context
+     * @param hosts
+     */
     public static void saveWebSpeedUpHost(Context context, String hosts) {
         saveConfig("webSpeedUpHost", hosts, context);
     }
@@ -34,6 +52,105 @@
     }
 
 
+    /**
+     * 鎴戠殑椤甸潰banner
+     *
+     * @param context
+     * @param content
+     */
+    public static void saveMinePageBanner(Context context, String content) {
+        saveConfig("minePageBanner", content, context);
+    }
+
+    public static BannerVO getMinePageBanner(Context context) {
+        try {
+            String config = getConfig("minePageBanner", context);
+            if (!StringUtils.isEmpty(config)) {
+                JSONObject jsonObject = new JSONObject(config);
+                JSONObject params = jsonObject.optJSONObject("params");
+                jsonObject.remove("params");
+                BannerVO bannerVO = new Gson().fromJson(jsonObject.toString(), BannerVO.class);
+                if (params != null) {
+                    bannerVO.setParams(params.toString());
+                }
+                if (bannerVO.isShow())
+                    return bannerVO;
+            }
+        } catch (Exception e) {
+            e.getMessage();
+        }
+        return null;
+    }
+
+
+    /**
+     * 淇濆瓨鎾斁鍣ㄥ璺冲崗璁�
+     *
+     * @param context
+     * @param content
+     */
+    public static void savePlayerJumpOutProtocolPrefix(Context context, String content) {
+        saveConfig("jumpAppProtocolPrefix", content, context);
+    }
+
+    public static Set<String> getPlayerJumpOutProtocolPrefix(Context context) {
+        try {
+            String config = getConfig("jumpAppProtocolPrefix", context);
+            if (!StringUtils.isEmpty(config)) {
+                Type type = new TypeToken<Set<String>>() {
+                }.getType();
+                return new Gson().fromJson(config, type);
+            }
+        } catch (Exception e) {
+            e.getMessage();
+        }
+        return new HashSet<>();
+    }
+
+
+    /**
+     * 淇濆瓨璐拱璁板綍
+     *
+     * @param context
+     * @param content
+     */
+    public static void saveBuyRecordUrl(Context context, String content) {
+        saveConfig("buyRecordUrl", content, context);
+    }
+
+
+    public static String getBuyRecordUrl(Context context) {
+        return getConfig("buyRecordUrl", context);
+    }
+
+
+    public static void saveOnLining(Context context, boolean content) {
+        saveConfig("onLining", content+"", context);
+    }
+
+
+    public static boolean isOnLining(Context context) {
+        String onLine= getConfig("onLining", context);
+        if(StringUtils.isEmpty(onLine)){
+            return false;
+        }
+        return Boolean.parseBoolean(onLine);
+    }
+
+
+    public static void saveAiDaoMode(Context context, boolean content) {
+        saveConfig("aiDaoMode", content+"", context);
+    }
+
+    public static boolean isAiDaoMode(Context context){
+        String onLine= getConfig("aiDaoMode", context);
+        if(StringUtils.isEmpty(onLine)){
+            return false;
+        }
+        return Boolean.parseBoolean(onLine);
+    }
+
+
     private static void saveConfig(String key, String value, Context context) {
         SharedPreferences.Editor editor = context.getSharedPreferences("config", Context.MODE_PRIVATE).edit();
         editor.putString(key, value);

--
Gitblit v1.8.0