zomojis-android-library
This repository has a custom input view with Zomojis for Android apps.
Integration
public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
Zomojis.register(this);
}
}
Usage
register(Application appInstance)
Prepares the library with defaults.
Zomojis.register(this);
prepareKeyboard(Context context, EditText editText, int zomojiSize)
Initializes the resources required for the Zomoji keyboard and associates Zomoji inputs to the given EditText
. Invoke from activity's onCreate
) method to avoid lag while opening keyboard.
Zomojis.prepareKeyboard(myContext, myEditText, myZomojiSize);
getKeyBoard()
Returns the keyboard as a View
.
View view = Zomojis.getKeyboard(this);
myKeyboardLayout.addView(view);
getSpan(TextView textView, CharSequence text, int zomojiSize)
Parses the given characters into Zomojis and returns a Spannable
applied with Zomojis.
Spannable span = Zomojis.getSpan(myTextView, myText, myZomojiSize);
// do your your formatting to the span if you have any ...
myTextView.setText(span);
Note: If you want high quality Zomojis, invoke getSpan(TextView, CharSequence, int, boolean)
[boolean = true for High quality Zomoji]. Also keep in mind that high quality Zomojis may consume more memory and may cause performance issues.
isSingleZomoji()
Checks if the given text is a Zomoji. Returns true if the message is only a Zomoji.
if(Zomojis.isSingleZomoji(myText)) {
// With single Zomoji, you can choose between high quality rendering, display without background, etc.
}
else {
// With multiple Zomojis, you can use normal quality Zomojis.
}
unregister()
Releases the resources held by the library.
Zomojis.unregister();
Note: Invoke only from your LauncherActivity's onDestroy. Failing to invoke may cause memory leaks.