From eb4ac40051425d93c6339c37e78b4b31c689d1f9 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Mon, 4 Aug 2014 11:55:33 -0700 Subject: [PATCH] don't use old emoji recents, broken Fixes #1782 // FREEBIE --- src/org/thoughtcrime/securesms/util/Emoji.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/org/thoughtcrime/securesms/util/Emoji.java b/src/org/thoughtcrime/securesms/util/Emoji.java index fe8b1463d3..7521d5f97d 100644 --- a/src/org/thoughtcrime/securesms/util/Emoji.java +++ b/src/org/thoughtcrime/securesms/util/Emoji.java @@ -20,11 +20,6 @@ import android.util.SparseArray; import android.view.View; import com.google.thoughtcrimegson.Gson; -import com.google.thoughtcrimegson.GsonBuilder; -import com.google.thoughtcrimegson.JsonDeserializationContext; -import com.google.thoughtcrimegson.JsonDeserializer; -import com.google.thoughtcrimegson.JsonElement; -import com.google.thoughtcrimegson.JsonParseException; import com.google.thoughtcrimegson.reflect.TypeToken; import org.thoughtcrime.securesms.R; @@ -299,7 +294,7 @@ public class Emoji { private static class EmojiLRU { private static SharedPreferences prefs = null; private static LinkedHashSet recentlyUsed = null; - private static final String EMOJI_LRU_PREFERENCE = "pref_popular_emoji"; + private static final String EMOJI_LRU_PREFERENCE = "pref_recent_emoji"; private static final int EMOJI_LRU_SIZE = 50; private static void initializeCache(Context context) { @@ -310,16 +305,7 @@ public class Emoji { String serialized = prefs.getString(EMOJI_LRU_PREFERENCE, "[]"); Type type = new TypeToken>() { }.getType(); - JsonDeserializer backwardsDeserializer = new JsonDeserializer() { - @Override - public String deserialize(JsonElement jsonElement, Type type, - JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { - return jsonElement.getAsString().replace(".png", ""); - } - }; - - recentlyUsed = new GsonBuilder().registerTypeAdapter(String.class, backwardsDeserializer) - .create().fromJson(serialized, type); + recentlyUsed = new Gson().fromJson(serialized, type); } public static String[] getRecentlyUsed(Context context) {