Fix recent emoji sort order

The recent emoji tab was sorting emoji as last in last out instead
of last in first out. Also, if an emoji was already in the recent
emoji cache its order would not be updated on reinsert.

Fixes #2967
Closes #2946

// FREEBIE
This commit is contained in:
Rhodey Orbits 2015-04-15 11:07:49 -07:00 committed by Moxie Marlinspike
parent a413346610
commit c6a4877391

View File

@ -263,7 +263,8 @@ public class Emoji {
}
public Pair<Integer, Drawable> getRecentlyUsed(int position, double size, PageLoadedListener pageLoadedListener) {
String code = EmojiLRU.getRecentlyUsed(context)[position];
String[] recentlyUsed = EmojiLRU.getRecentlyUsed(context);
String code = recentlyUsed[recentlyUsed.length - 1 - position];
return new Pair<Integer, Drawable>(Integer.parseInt(code, 16), getEmojiDrawable(code, size, pageLoadedListener));
}
@ -329,6 +330,7 @@ public class Emoji {
prefs = PreferenceManager.getDefaultSharedPreferences(context);
}
recentlyUsed.remove(asset);
recentlyUsed.add(asset);
if (recentlyUsed.size() > EMOJI_LRU_SIZE) {