1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 19:06:53 +01:00

Merge remote-tracking branch 'github/pr/1424'

This commit is contained in:
cpfeiffer 2019-02-13 23:06:34 +01:00
commit 373e38eace

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2015-2019 Andreas Shimokawa, Carsten Pfeiffer, Daniele
Gobbetti, Matthieu Baerts
Gobbetti, Matthieu Baerts, Taavi Eomäe
This file is part of Gadgetbridge.
@ -20,10 +20,14 @@ package nodomain.freeyourgadget.gadgetbridge.util;
import android.content.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.wax911.emojify.EmojiManager;
import io.wax911.emojify.EmojiUtils;
public class EmojiConverter {
private static final Logger LOG = LoggerFactory.getLogger(EmojiConverter.class);
private static final String[][] simpleEmojiMapping = {
{"\uD83D\uDE00", ":-D"}, // grinning
@ -81,8 +85,12 @@ public class EmojiConverter {
private static String convertAdvancedEmojiToAscii(String text, Context context) {
initEmojiData(context);
try {
return EmojiUtils.shortCodify(text);
} catch (Exception e){
LOG.warn("An exception occured when converting advanced emoji to ASCII", text);
return text;
}
}
public static String convertUnicodeEmojiToAscii(String text, Context context) {