Created
February 2, 2016 05:39
-
-
Save numa08/bd7e88084d7b123b46c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private InputFilter mEmojiFilter = (source, start, end, dest, dstart, dend) -> { | |
if (source.length() == 0) { | |
return source; | |
} | |
// 入力された1文字が2バイト以上の物について、絵文字かどうか判断をする。 | |
// UTF-8 の絵文字の文字コードについては、 Wikipedia を参照した | |
// https://en.wikipedia.org/wiki/Emoji#Unicode_blocks | |
final int codePoint = Character.codePointAt(source, 0); | |
if ( | |
(codePoint >= 0x1F300 && codePoint <= 0x1F5FF ) || | |
(codePoint >= 0x1F900 && codePoint <= 0x1F9FF ) || | |
(codePoint >= 0x1F600 && codePoint <= 0x1F64F ) || | |
(codePoint >= 0x1F680 && codePoint <= 0x1F6FF ) || | |
(codePoint >= 0x2600 && codePoint <= 0x26FF ) || | |
(codePoint >= 0x2700 && codePoint <= 0x27BF ) | |
){ | |
return ""; | |
} | |
return source; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment