Emoji


Source link: https://github.com/vanniktech/Emoji

Emoji

A simple library to add Emoji support to your Android app. In a PopupWindow Emojis can be chosen. In order to edit and display text with Emojis this library provides public APIs: EmojiEditText, EmojiTextView & EmojiButton.

The library has 4 different providers to choose from ( iOS, EmojiOne, Google & Twitter).

iOS Emojis

For getting the above iOS Emojis simply add the dependency and code below.

compile 'com.vanniktech:emoji-ios:0.5.1'

And install the provider (preferably in your Application class):

EmojiManager.install(new IosEmojiProvider());
 // This line needs to be executed before any usage of EmojiTextView, EmojiEditText or EmojiButton.

EmojiOne

For getting the above EmojiOne Emojis simply add the dependency and code below.

compile 'com.vanniktech:emoji-one:0.5.1'

And install the provider (preferably in your Application class):

EmojiManager.install(new EmojiOneProvider());
 // This line needs to be executed before any usage of EmojiTextView, EmojiEditText or EmojiButton.

Google

For getting the above Google Emojis simply add the dependency and code below.

compile 'com.vanniktech:emoji-google:0.5.1'

And install the provider (preferably in your Application class):

EmojiManager.install(new GoogleEmojiProvider());
 // This line needs to be executed before any usage of EmojiTextView, EmojiEditText or EmojiButton.

Twitter

For getting the above Twitter Emojis simply add the dependency and code below.

compile 'com.vanniktech:emoji-twitter:0.5.1'

And install the provider (preferably in your Application class):

EmojiManager.install(new TwitterEmojiProvider());
 // This line needs to be executed before any usage of EmojiTextView, EmojiEditText or EmojiButton.

Custom Emojis

If you want to display your own Emojis you can create your own implementation of EmojiProvider and pass it to EmojiManager.install.

All of the core API lays in, which is being pulled in automatically by the provided implementations ( iOS, EmojiOne, Google & Twitter):

compile 'com.vanniktech:emoji:0.5.1'

Inserting Emojis

Declare your EmojiEditText in your layout xml file.

<com.vanniktech.emoji.EmojiEditText
android:id="@+id/emojiEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionSend"
android:inputType="textCapSentences|textMultiLine"
android:maxLines="3"/>

To open the EmojiPopup execute the code below:

final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(rootView).build(emojiEditText);
 emojiPopup.toggle();
 // Toggles visibility of the Popup. emojiPopup.dismiss();
 // Dismisses the Popup. emojiPopup.isShowing();
 // Returns true when Popup is showing.

The rootView is the rootView of your layout xml file which will be used for calculating the height of the keyboard. emojiEditText is the EmojiEditText that you declared in your layout xml file.

Displaying Emojis

<com.vanniktech.emoji.EmojiTextView
android:id="@+id/emojiTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Just use the EmojiTextView and call setText with the String that contains Unicode encoded Emojis. To change the size of the displayed Emojis use the lineHeight property from TextView.

Listeners

The EmojiPopup builder allows you to declare several listeners.

setOnSoftKeyboardCloseListener(OnSoftKeyboardCloseListener listener);
 setOnEmojiClickListener(OnEmojiClickListener listener);
 setOnSoftKeyboardOpenListener(OnSoftKeyboardOpenListener listener);
 setOnEmojiPopupShownListener(OnEmojiPopupShownListener listener);
 setOnEmojiPopupDismissListener(OnEmojiPopupDismissListener listener);
 setOnEmojiBackspaceClickListener(OnEmojiBackspaceClickListener listener);

Custom Recent Emoji implementation

You can pass your own implementation of the recent Emojis. Just let one of your classes implement the RecentEmoji interface and pass it when you're building the EmojiPopup:

setRecentEmoji(yourClassThatImplementsRecentEmoji)

If no instance or a null instance is set the default implementation will be used.

Custom Variant Emoji implementation

You can pass your own implementation of the variant Emojis. Just let one of your classes implement the VariantEmoji interface and pass it when you're building the EmojiPopup:

setVariantEmoji(yourClassThatImplementsVariantEmoji)

If no instance or a null instance is set the default implementation will be used.

Snapshots

This library is also distributed as a SNAPSHOT if you like to check out the latest features.

Note: The API is not stable and may change and break your code at any time if you use a SNAPSHOT.

Add this to your repositories:

maven {
 url "https://oss.sonatype.org/content/repositories/snapshots" 
}

And one of these to your dependencies:

compile 'com.vanniktech:emoji-ios:0.6.0-SNAPSHOT' compile 'com.vanniktech:emoji-one:0.6.0-SNAPSHOT' compile 'com.vanniktech:emoji-google:0.6.0-SNAPSHOT' compile 'com.vanniktech:emoji-twitter:0.6.0-SNAPSHOT'

Proguard

No configuration needed.

License

Copyright (C) 2016 Vanniktech - Niklas Baudy

Licensed under the Apache License, Version 2.0

Resources

Adapter and LayoutManager for Android RecyclerView which enables sticky header positioning.

A Library to show Round ImageView with Face Detection and text labels on right side. Best suited for person details.

OAuth RxJava extension for Android.

This library helps to display overlapping views (topmost) in order to show some kind of message to capture user attention. It can be an error, success message, loading bar or just simple text message.

This is a set of classes with a small, extensible API which provides basic abstractions for building your apps using VIPER architecture.

RxJava wrapper on Google's Firebase for Android library.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes