1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 02:55:50 +01:00

Mi Band 8: Map emoji (inefficient)

This commit is contained in:
José Rebelo 2023-10-22 10:20:40 +01:00
parent 81ca617601
commit fa72820e5a

View File

@ -19,6 +19,8 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService; import nodomain.freeyourgadget.gadgetbridge.service.btle.GattService;
@ -86,4 +88,105 @@ public class XiaomiEncryptedSupport extends XiaomiSupport {
protected void startAuthentication(final TransactionBuilder builder) { protected void startAuthentication(final TransactionBuilder builder) {
authService.startEncryptedHandshake(builder); authService.startEncryptedHandshake(builder);
} }
@Override
public String customStringFilter(final String inputString) {
// TODO: Do this more efficiently - it iterates the input string 88 times...
String customString = inputString;
for (Map.Entry<String, String> emoji : EMOJI_MAP.entrySet()) {
customString = customString.replaceAll(emoji.getKey(), emoji.getValue());
}
return customString;
}
private static final Map<String, String> EMOJI_MAP = new LinkedHashMap<String, String>() {{
put("\uD83D\uDE0D", ""); // 😍
put("\uD83D\uDE18", ""); // 😘
put("\uD83D\uDE02", ""); // 😂
put("\uD83D\uDE0A", ""); // 😊
put("\uD83D\uDE0E", ""); // 😎
put("\uD83D\uDE09", ""); // 😉
put("\uD83D\uDC8B", ""); // 💋
put("\uD83D\uDC4D", ""); // 👍
put("\uD83E\uDD23", ""); // 🤣
put("\uD83D\uDC95", ""); // 💕
put("\uD83D\uDE00", ""); // 😀
put("\uD83D\uDE04", ""); // 😄
put("\uD83D\uDE2D", ""); // 😭
put("\uD83E\uDD7A", ""); // 🥺
put("\uD83D\uDE4F", ""); // 🙏
put("\uD83E\uDD70", ""); // 🥰
put("\uD83E\uDD14", ""); // 🤔
put("\uD83D\uDD25", ""); // 🔥
put("\uD83D\uDE29", ""); // 😩
put("\uD83D\uDE14", ""); // 😔
put("\uD83D\uDE01", ""); // 😁
put("\uD83D\uDC4C", ""); // 👌
put("\uD83D\uDE0F", ""); // 😏
put("\uD83D\uDE05", ""); // 😅
put("\uD83E\uDD0D", ""); // 🤍
put("\uD83D\uDC94", ""); // 💔
put("\uD83D\uDE0C", ""); // 😌
put("\uD83D\uDE22", ""); // 😢
put("\uD83D\uDC99", ""); // 💙
put("\uD83D\uDC9C", ""); // 💜
put("\uD83C\uDFB6", ""); // 🎶
put("\uD83D\uDE33", ""); // 😳
put("\uD83D\uDC96", ""); // 💖
put("\uD83D\uDE4C", ""); // 🙌
put("\uD83D\uDCAF", ""); // 💯
put("\uD83D\uDE48", ""); // 🙈
put("\uD83D\uDE0B", ""); // 😋
put("\uD83D\uDE11", ""); // 😑
put("\uD83D\uDE34", ""); // 😴
put("\uD83D\uDE2A", ""); // 😪
put("\uD83D\uDE1C", ""); // 😜
put("\uD83D\uDE1B", ""); // 😛
put("\uD83D\uDE1D", ""); // 😝
put("\uD83D\uDE1E", ""); // 😞
put("\uD83D\uDE15", ""); // 😕
put("\uD83D\uDC97", ""); // 💗
put("\uD83D\uDC4F", ""); // 👏
put("\uD83D\uDE10", ""); // 😐
put("\uD83D\uDC49", ""); // 👉
put("\uD83D\uDC9B", ""); // 💛
put("\uD83D\uDC9E", ""); // 💞
put("\uD83D\uDCAA", ""); // 💪
put("\uD83C\uDF39", ""); // 🌹
put("\uD83D\uDC80", ""); // 💀
put("\uD83D\uDE31", ""); // 😱
put("\uD83D\uDC98", ""); // 💘
put("\uD83E\uDD1F", ""); // 🤟
put("\uD83D\uDE21", ""); // 😡
put("\uD83D\uDCF7", ""); // 📷
put("\uD83C\uDF38", ""); // 🌸
put("\uD83D\uDE08", ""); // 😈
put("\uD83D\uDC48", ""); // 👈
put("\uD83C\uDF89", ""); // 🎉
put("\uD83D\uDC81", ""); // 💁
put("\uD83D\uDE4A", ""); // 🙊
put("\uD83D\uDC9A", ""); // 💚
put("\uD83D\uDE2B", ""); // 😫
put("\uD83D\uDE24", ""); // 😤
put("\uD83D\uDC93", ""); // 💓
put("\uD83C\uDF1A", ""); // 🌚
put("\uD83D\uDC47", ""); // 👇
put("\uD83D\uDE07", ""); // 😇
put("\uD83D\uDC4A", ""); // 👊
put("\uD83D\uDC51", ""); // 👑
put("\uD83D\uDE13", ""); // 😓
put("\uD83D\uDE3B", ""); // 😻
put("\uD83D\uDD34", ""); // 🔴
put("\uD83D\uDE25", ""); // 😥
put("\uD83E\uDD29", ""); // 🤩
put("\uD83D\uDE1A", ""); // 😚
put("\uD83D\uDE37", ""); // 😷
put("\uD83D\uDC4B", ""); // 👋
put("\uD83D\uDCA5", ""); // 💥
put("\uD83E\uDD2D", ""); // 🤭
put("\uD83C\uDF1F", ""); // 🌟
put("\uD83E\uDD71", ""); // 🥱
put("\uD83D\uDCA9", ""); // 💩
put("\uD83D\uDE80", ""); // 🚀
}};
} }