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/VideoUtil.java | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/BuWanVideo/src/com/weikou/beibeivideo/util/VideoUtil.java b/BuWanVideo/src/com/weikou/beibeivideo/util/VideoUtil.java index 2cf9d43..236d85b 100644 --- a/BuWanVideo/src/com/weikou/beibeivideo/util/VideoUtil.java +++ b/BuWanVideo/src/com/weikou/beibeivideo/util/VideoUtil.java @@ -4,6 +4,7 @@ import android.content.SharedPreferences; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.lcjian.library.util.common.StringUtils; import com.weikou.beibeivideo.entity.VideoDetailInfo; @@ -56,7 +57,10 @@ private static void saveTempVideoDetailList(Context context, List<VideoDetailInfo> detailInfos) { SharedPreferences sharedPreferences = context.getSharedPreferences("videoTempInfo", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); - editor.putString("videoDetailInfoList", new Gson().toJson(detailInfos)); + + Gson gson= new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); + + editor.putString("videoDetailInfoList", gson.toJson(detailInfos)); editor.commit(); } @@ -68,10 +72,11 @@ * @return */ private static List<VideoDetailInfo> getTempVideoDetailList(Context context) { + Gson gson= new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); SharedPreferences sharedPreferences = context.getSharedPreferences("videoTempInfo", Context.MODE_PRIVATE); String content = sharedPreferences.getString("videoDetailInfoList", ""); if (!StringUtils.isEmpty(content)) { - return new Gson().fromJson(content, new TypeToken<List<VideoDetailInfo>>() { + return gson.fromJson(content, new TypeToken<List<VideoDetailInfo>>() { }.getType()); } return new ArrayList<>(); -- Gitblit v1.8.0