From 087a8daa68c681faf0cb8eda9ae18456b5c68166 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 06 四月 2021 17:47:29 +0800 Subject: [PATCH] 3.9.0正式版本 --- BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 45 insertions(+), 4 deletions(-) diff --git a/BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java b/BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java index 11ace81..5436446 100644 --- a/BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java +++ b/BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java @@ -4,12 +4,21 @@ 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 { @@ -56,17 +65,49 @@ public static BannerVO getMinePageBanner(Context context) { try { String config = getConfig("minePageBanner", context); - if (StringUtils.isEmpty(config)) { - BannerVO bannerVO = new Gson().fromJson(config, BannerVO.class); - return bannerVO; + 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<>(); + } + + 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