mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 17:27:45 +00:00
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:
parent
a413346610
commit
c6a4877391
@ -263,7 +263,8 @@ public class Emoji {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Pair<Integer, Drawable> getRecentlyUsed(int position, double size, PageLoadedListener pageLoadedListener) {
|
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));
|
return new Pair<Integer, Drawable>(Integer.parseInt(code, 16), getEmojiDrawable(code, size, pageLoadedListener));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,6 +330,7 @@ public class Emoji {
|
|||||||
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recentlyUsed.remove(asset);
|
||||||
recentlyUsed.add(asset);
|
recentlyUsed.add(asset);
|
||||||
|
|
||||||
if (recentlyUsed.size() > EMOJI_LRU_SIZE) {
|
if (recentlyUsed.size() > EMOJI_LRU_SIZE) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user