Coder Social home page Coder Social logo

emoji4j's Introduction

emoji4j

Build Status Coverage Status Apache 2.0 Maven Central Java Doc

[WARNING]: This project is not actively being maintainted. You may use vdurmont/emoji-java as an alternative.

Java library to convert short codes, html entities to emojis and vice-versa. Also supports parsing emoticons, surrogate html entities.

Inspired by vdurmont/emoji-java, emoji4j adds more goodies and helpers to deal with emojis. The emoji data is based on the database from github/gemoji and ASCII emoticons data from wooorm/emoticon.

Usage

Stable:

<dependency>
	<groupId>com.kcthota</groupId>
	<artifactId>emoji4j</artifactId>
	<version>6.0</version>
</dependency>

Examples:

getEmoji

Get emoji by unicode, short code, decimal or hexadecimal html entity

Emoji emoji = EmojiUtils.getEmoji("๐Ÿญ"); //get emoji by unicode character

EmojiUtils.getEmoji("blue_car").getEmoji(); //returns ๐Ÿš™

EmojiUtils.getEmoji(":blue_car:").getEmoji(); //also returns ๐Ÿš™

EmojiUtils.getEmoji("&#x1f42d;").getEmoji(); //returns ๐Ÿญ

EmojiUtils.getEmoji("&#128045;").getEmoji(); //also returns ๐Ÿญ

EmojiUtils.getEmoji(":)").getEmoji(); //returns ๐Ÿ˜ƒ

EmojiUtils.getEmoji("&#55357;&#56833;").getEmoji(); //returns ๐Ÿ˜

The Emoji Object

Conversion from unicode, short code, hexadecimal and decimal html entities is pretty easy.

Emoji emoji = EmojiUtils.getEmoji("๐Ÿญ");

emoji.getEmoji(); //returns ๐Ÿญ

emoji.getDecimalHtml(); //returns &#128045;

emoji.getHexHtml(); //return &#x1f42d;

emoji.getAliases(); //returns a collection of aliases. ["mouse"]

isEmoji

Verifies if the passed string is an emoji character

EmojiUtils.isEmoji("๐Ÿญ"); //returns true

EmojiUtils.isEmoji("blue_car"); //returns true

EmojiUtils.isEmoji(":coyote:"); //returns false

EmojiUtils.isEmoji("&#x1f42d;"); //returns true

EmojiUtils.isEmoji("&#128045;"); //returns true

emojify

Emojifies the passed string

String text = "A :cat:, :dog: and a :mouse: became friends<3. For :dog:'s birthday party, they all had :hamburger:s, :fries:s, :cookie:s and :cake:.";

EmojiUtils.emojify(text); //returns A ๐Ÿฑ, ๐Ÿถ and a ๐Ÿญ became friendsโค๏ธ. For ๐Ÿถ's birthday party, they all had ๐Ÿ”s, ๐ŸŸs, ๐Ÿชs and ๐Ÿฐ.

String text = "A &#128049;, &#x1f436; and a :mouse: became friends. For the :dog:'s birthday party, they all had :hamburger:s, :fries:s, :cookie:s and :cake:."

EmojiUtils.emojify(text); //returns A ๐Ÿฑ, ๐Ÿถ and a ๐Ÿญ became friends. For the ๐Ÿถ's birthday party, they all had ๐Ÿ”s, ๐ŸŸs, ๐Ÿชs and ๐Ÿฐ.

String text=":):-),:-):-]:-xP=*:*<3:P:p,=-)";

EmojiUtils.emojify(text); //returns ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜…๐Ÿ˜ƒ๐Ÿ˜ถ๐Ÿ˜๐Ÿ˜—๐Ÿ˜—โค๏ธ๐Ÿ˜›๐Ÿ˜›๐Ÿ˜…

htmlify

Converts unicode characters in text to corresponding decimal html entities

String text = "A :cat:, :dog: and a :mouse: became friends. For the :dog:'s birthday party, they all had :hamburger:s, :fries:s, :cookie:s and :cake:.";

EmojiUtils.htmlify(text); //returns A &#128049;, &#128054; and a &#128045; became friends. For the &#128054;'s birthday party, they all had &#127828;s, &#127839;s, &#127850;s and &#127856;.

String text = "A ๐Ÿฑ, ๐Ÿถ and a ๐Ÿญ became friends. For the ๐Ÿถ's birthday party, they all had ๐Ÿ”s, ๐ŸŸs, ๐Ÿชs and ๐Ÿฐ."

EmojiUtils.htmlify(text); //also returns A &#128049;, &#128054; and a &#128045; became friends. For the &#128054;'s birthday party, they all had &#127828;s, &#127839;s, &#127850;s and &#127856;.

hexHtmlify

Converts unicode characters in text to corresponding decimal hexadecimal html entities

String text = "A :cat:, :dog: and a :mouse: became friends. For the :dog:'s birthday party, they all had :hamburger:s, :fries:s, :cookie:s and :cake:.";

EmojiUtils.hexHtmlify(text); //returns A &#x1f431;, &#x1f436; and a &#x1f42d; became friends. For the &#x1f436;'s birthday party, they all had &#x1f354;s, &#x1f35f;s, &#x1f36a;s and &#x1f370;.

String text = "A ๐Ÿฑ, ๐Ÿถ and a ๐Ÿญ became friends. For the ๐Ÿถ's birthday party, they all had ๐Ÿ”s, ๐ŸŸs, ๐Ÿชs and ๐Ÿฐ."

EmojiUtils.hexHtmlify(text); //returns A &#x1f431;, &#x1f436; and a &#x1f42d; became friends. For the &#x1f436;'s birthday party, they all had &#x1f354;s, &#x1f35f;s, &#x1f36a;s and &#x1f370;.

htmlify as Surrogate Entities

Converts unicode characters in text to corresponding decimal surrogate html entities

String text = "๐Ÿ˜ƒ";

EmojiUtils.htmlify(text, true); //returns &#55357;&#56835;

##shortCodify

String text = "A ๐Ÿฑ, ๐Ÿถ and a ๐Ÿญ became friendsโค๏ธ. For ๐Ÿถ's birthday party, they all had ๐Ÿ”s, ๐ŸŸs, ๐Ÿชs and ๐Ÿฐ.";

EmojiUtils.shortCodify(text); //returns A :cat:, :dog: and a :mouse: became friends:heart:. For :dog:'s birthday party, they all had :hamburger:s, :fries:s, :cookie:s and :cake:.

text = ":):-),:-):-]:-xP=*:*<3:P:p,=-)";

EmojiUtils.shortCodify(text); //returns :smiley::smiley::sweat_smile::smiley::no_mouth::stuck_out_tongue_closed_eyes::kissing::kissing::heart::stuck_out_tongue::stuck_out_tongue::sweat_smile:

RemoveAllEmojis

Removes unicode emoji characters from the passed string

String emojiText = "A ๐Ÿฑ, ๐Ÿฑ and a ๐Ÿญ became friendsโค๏ธ. For ๐Ÿถ's birthday party, they all had ๐Ÿ”s, ๐ŸŸs, ๐Ÿชs and ๐Ÿฐ.";

EmojiUtils.removeAllEmojis(emojiText);//"A ,  and a  became friends. For 's birthday party, they all had s, s, s and .

countEmojis

Counts emojis in a String

String text = "A &#128049;, &#x1f436;,&nbsp;:coyote: and a :mouse: became friends. For :dog:'s birthday party, they all had ๐Ÿ”s, :fries:s, :cookie:s and :cake:.";

EmojiUtils.countEmojis(text); //returns 8

Stop words support

Add stop words to filter out certain words from emoji conversion

String text = "http://www.github.com and https://www.google.com are awesome :-).";

EmojiManager.addStopWords("http://", "https://");

EmojiUtils.emojify(userText) //returns http://www.github.com and https://www.google.com are awesome ๐Ÿ˜ƒ.

License:

Copyright 2016 Krishna Chaitanya Thota ([email protected])

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

github/gemoji's license:

octocat, squirrel, shipit Copyright (c) 2013 GitHub Inc. All rights reserved.

bowtie, neckbeard, fu Copyright (c) 2013 37signals, LLC. All rights reserved.

feelsgood, finnadie, goberserk, godmode, hurtrealbad, rage 1-4, suspect Copyright (c) 2013 id Software. All rights reserved.

trollface Copyright (c) 2013 whynne@deviantart. All rights reserved.

All other images Copyright (c) 2013 Apple Inc. All rights reserved.

wooorm/emoticon's license:

Copyright (c) 2014 Titus Wormer [email protected]

Bitdeli Badge

emoji4j's People

Contributors

bitdeli-chef avatar danthe1st avatar kcthota avatar zeryther avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emoji4j's Issues

Will this repo be maintained?

I ask because I could need Emoji4J for my project but 900-1000 Emojis are missing. And I cannot find a good alternative.

Not Supporting JDK 8

Using V6.0.

Fail: emoji4j/EmojiUtils has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
java.lang.UnsupportedClassVersionError: emoji4j/EmojiUtils has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

image

Build APK error : Program type already present: emoji4j.AbstractEmoji

Program type already present: emoji4j.AbstractEmoji
Message{kind=ERROR, text=Program type already present: emoji4j.AbstractEmoji, sources=[Unknown source file], tool name=Optional.of(D8)}

Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: D:\android studio project\app\build\intermediates\transforms\dexBuilder\debug\34, D:\android studio project\app\build\intermediates\transforms\externalLibsDexMerger\debug\0

Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete

Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: emoji4j.AbstractEmoji

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: Error while generating the main dex list.
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
... 33 more
Caused by: com.android.build.api.transform.TransformException: Error while generating the main dex list.
at com.android.build.gradle.internal.transforms.D8MainDexListTransform.transform(D8MainDexListTransform.kt:144)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
... 49 more
Caused by: com.android.builder.multidex.D8MainDexList$MainDexListException: com.android.tools.r8.errors.CompilationError: Program type already present: emoji4j.AbstractEmoji
at com.android.builder.multidex.D8MainDexList.generate(D8MainDexList.java:87)
at com.android.build.gradle.internal.transforms.D8MainDexListTransform.transform(D8MainDexListTransform.kt:131)
... 52 more
Caused by: com.android.tools.r8.errors.CompilationError: Program type already present: emoji4j.AbstractEmoji
at com.android.tools.r8.utils.ProgramClassCollection.resolveClassConflictImpl(ProgramClassCollection.java:64)
at com.android.tools.r8.utils.ProgramClassCollection.lambda$create$0(ProgramClassCollection.java:25)
at java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:1990)
at com.android.tools.r8.utils.ProgramClassCollection.create(ProgramClassCollection.java:24)
at com.android.tools.r8.graph.LazyLoadedDexApplication$Builder.build(LazyLoadedDexApplication.java:124)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:123)
at com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:86)
at com.android.tools.r8.GenerateMainDexList.run(GenerateMainDexList.java:40)
at com.android.tools.r8.GenerateMainDexList.run(GenerateMainDexList.java:110)
at com.android.builder.multidex.D8MainDexList.generate(D8MainDexList.java:83)
... 53 more

Compilation error in Android Studio

Warning:Ignoring InnerClasses attribute for an anonymous inner class
(net.sf.cglib.transform.impl.UndeclaredThrowableTransformer$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is not an inner class.

Please update the lib.

Can not build when included in android project

Error:PARSE ERROR:
Error:unsupported class file version 52.0
Error:...while parsing emoji4j/Emoji.class
Error:PARSE ERROR:
Error:unsupported class file version 52.0
Error:...while parsing emoji4j/AbstractEmoji.class
Error:2 errors; aborting
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'J:\jdk1.8.0_77\bin\java.exe'' finished with non-zero exit value 1

Exception in Initializer Error

I got java.lang.ExceptionInInitializerError when calling the countEmojis method. You can see my code below:

String message = listItem.getMessage(); if (!TextUtils.isEmpty(message) && EmojiUtils.countEmojis(message) > 0) { holder.tvEmoji.setText(message); holder.tvEmoji.setVisibility(View.VISIBLE); holder.tvMessage.setVisibility(GONE); } else { holder.tvMessage.setText(message); holder.tvMessage.setVisibility(View.VISIBLE); holder.tvEmoji.setVisibility(GONE); }

I'm using this version:
implementation 'com.kcthota:emoji4j:6.0'

Here's the exception screenshot:
init

Complete Stack Trace:
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.drudotstech.queenstatus, PID: 8236 java.lang.ExceptionInInitializerError at ch.lambdaj.proxy.ProxyUtil.createEnhancer(ProxyUtil.java:89) at ch.lambdaj.proxy.ProxyUtil.createProxy(ProxyUtil.java:49) at ch.lambdaj.function.argument.ArgumentsFactory.createPlaceholder(ArgumentsFactory.java:52) at ch.lambdaj.function.argument.ArgumentsFactory.registerNewArgument(ArgumentsFactory.java:45) at ch.lambdaj.function.argument.ArgumentsFactory.createArgument(ArgumentsFactory.java:39) at ch.lambdaj.function.argument.ArgumentsFactory.createArgument(ArgumentsFactory.java:31) at ch.lambdaj.Lambda.on(Lambda.java:44) at emoji4j.EmojiUtils.getEmoji(EmojiUtils.java:40) at emoji4j.EmojiUtils.isEmoji(EmojiUtils.java:60) at emoji4j.EmojiUtils.countEmojis(EmojiUtils.java:169) at com.drudotstech.queenstatus.adapters.chat.MessagesAdapter.onBindViewHolder(MessagesAdapter.java:96) at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7065) at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7107) at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6012) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6279) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:640) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134) at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3540) at android.view.View.measure(View.java:22216) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:22216) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:22216) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145) at android.view.View.measure(View.java:22216) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1539) at android.widget.LinearLayout.measureVertical(LinearLayout.java:823) at android.widget.LinearLayout.onMeasure(LinearLayout.java:702) at android.view.View.measure(View.java:22216) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:22216) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1539) at android.widget.LinearLayout.measureVertical(LinearLayout.java:823) at android.widget.LinearLayout.onMeasure(LinearLayout.java:702) at android.view.View.measure(View.java:22216) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:831) at android.view.View.measure(View.java:22216) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2589) E/AndroidRuntime: at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1631) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1885) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1515) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7266) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981) at android.view.Choreographer.doCallbacks(Choreographer.java:790) at android.view.Choreographer.doFrame(Choreographer.java:721) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:101) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7425) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237) at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69) ... 67 more Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219) ... 72 more Caused by: java.lang.UnsupportedOperationException: can't load this type of class file at java.lang.ClassLoader.defineClass(ClassLoader.java:591) ... 75 more

Searching

Hi !

Thanks for making this library, that too with emoticons. I'm trying to implement emoji search in an Android keyboard and was wondering if there's a way to efficiently search for emojis/emoticons based on alias. It would be great if there is a search function in the library.

hexHtmlify changes non-emoji text

hexHtmlify appears to change more than it should. I have a message with "back in town @ 4:30-5:00 pm." in the text and it replace it with "back in town @ 4๐Ÿ‘จ0-5๐Ÿ˜ฎ0 pm." which is completely incorrect for what I want.

To be honest, I have text where I'm just changing unicode characters to hex html. Is it possible to update the method call to pass in an option to only replace unicode characters? Maybe even have the option configurable to whatever representations of emoji your trying to replace? If I can do that then this problem goes way.

Emoji Not Identified

The following emoticon does not appear to be identified correctly:

๐Ÿ˜”๏ฟฝ

U+1F614 PENSIVE FACE character

When trying to remove this using the removeAllEmojis() it is not identified.

RuntimeException in removeAllEmojis

java.lang.UnsupportedOperationException caused by Emoji.java's matcher.group("H") (as Matcher.group takes an int parameter.

StackTrace

                                       java.lang.ExceptionInInitializerError
                                                                              at emoji4j.EmojiManager.data(EmojiManager.java:38)
                                                                              at emoji4j.EmojiUtils.removeAllEmojis(EmojiUtils.java:241)
                                                                              at com.algolia.musicologist.ui.MainActivity$say$1.run(MainActivity.kt:161)
                                                                              at android.os.Handler.handleCallback(Handler.java:751)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                              at android.os.Looper.loop(Looper.java:241)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6274)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                                                                           Caused by: java.lang.RuntimeException: N/A
                                                                              at [Source: libcore.io.ClassPathURLStreamHandler$ClassPathURLConnection$1@356b422; line: 78, column: 14] (through reference chain: java.util.ArrayList[4]->emoji4j.Emoji["emoji"])
                                                                              at emoji4j.EmojiManager.<clinit>(EmojiManager.java:29)
                                                                              at emoji4j.EmojiManager.data(EmojiManager.java:38)ย 
                                                                              at emoji4j.EmojiUtils.removeAllEmojis(EmojiUtils.java:241)ย 
                                                                              at com.algolia.musicologist.ui.MainActivity$say$1.run(MainActivity.kt:161)ย 
                                                                              at android.os.Handler.handleCallback(Handler.java:751)ย 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)ย 
                                                                              at android.os.Looper.loop(Looper.java:241)ย 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6274)ย 
                                                                              at java.lang.reflect.Method.invoke(Native Method)ย 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)ย 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)ย 
                                                                           Caused by: com.fasterxml.jackson.databind.JsonMappingException: N/A
                                                                              at [Source: libcore.io.ClassPathURLStreamHandler$ClassPathURLConnection$1@356b422; line: 78, column: 14] (through reference chain: java.util.ArrayList[4]->emoji4j.Emoji["emoji"])
                                                                              at com.fasterxml.jackson.databind.deser.SettableBeanProperty._throwAsIOE(SettableBeanProperty.java:537)
                                                                              at com.fasterxml.jackson.databind.deser.SettableBeanProperty._throwAsIOE(SettableBeanProperty.java:518)
                                                                              at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:99)
                                                                              at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260)
                                                                              at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
                                                                              at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:277)
                                                                              at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:249)
                                                                              at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:26)
                                                                              at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3788)
                                                                              at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2863)
                                                                              at emoji4j.EmojiManager.<clinit>(EmojiManager.java:25)
                                                                              at emoji4j.EmojiManager.data(EmojiManager.java:38)ย 
                                                                              at emoji4j.EmojiUtils.removeAllEmojis(EmojiUtils.java:241)ย 
                                                                              at com.algolia.musicologist.ui.MainActivity$say$1.run(MainActivity.kt:161)ย 
                                                                              at android.os.Handler.handleCallback(Handler.java:751)ย 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)ย 
                                                                              at android.os.Looper.loop(Looper.java:241)ย 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:6274)ย 
                                                                              at java.lang.reflect.Method.invoke(Native Method)ย 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)ย 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)ย 
                                                                           Caused by: java.lang.UnsupportedOperationException
                                                                              at java.util.regex.Matcher.group(Matcher.java:383)
                                                                              at emoji4j.Emoji.setDecimalHtml(Emoji.java:92)
                                                                              at emoji4j.Emoji.setEmoji(Emoji.java:41)
                                                                              at java.lang.reflect.Method.invoke(Native Method)

.isEmoji throws Lambda errors

Calling .isEmoji on a string returns me the following error and stack trace:

java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
        at ch.lambdaj.proxy.ProxyUtil.createEnhancer(ProxyUtil.java:89)
        at ch.lambdaj.proxy.ProxyUtil.createProxy(ProxyUtil.java:49)
        at ch.lambdaj.function.argument.ArgumentsFactory.createPlaceholder(ArgumentsFactory.java:52)
        at ch.lambdaj.function.argument.ArgumentsFactory.registerNewArgument(ArgumentsFactory.java:45)
        at ch.lambdaj.function.argument.ArgumentsFactory.createArgument(ArgumentsFactory.java:39)
        at ch.lambdaj.function.argument.ArgumentsFactory.createArgument(ArgumentsFactory.java:31)
        at ch.lambdaj.Lambda.on(Lambda.java:44)
        at emoji4j.EmojiUtils.getEmoji(EmojiUtils.java:40)
        at emoji4j.EmojiUtils.isEmoji(EmojiUtils.java:60)
        at Allegiance.util.DisUtil.isEmote(DisUtil.java:431)

emojify not working with multi symbol emojis

emojify does not reverse hexHtmlify for 3 and 4 character emojis
e.g.
EmojiUtils.emojify(EmojiUtils.hexHtmlify("๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ") produces "๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ฆโ€"
not "๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ"

It is not replacing the joiner html encoding &#x200d.

(the github preview is converging the output back to the single emoji character so look at the original input)

(trying to expand what it actually produces as github preview is losing the expansion)

The following is what it produces (without the single quotes!)

EmojiUtils.emojify(EmojiUtils.hexHtmlify("๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆ") produces
๐Ÿ‘จ'&#x200d'; '๐Ÿ‘จ&#x200d';'๐Ÿ‘ฆ&#x200d';๐Ÿ‘ฆ'

Hope this can be fixed

Combined Emojis (Skin Color) are not displayed

Hi,
the following code returns Null:
Emoji e = EmojiUtils.getEmoji("&#128077;&#127996;"); // e returns Null
expected output:
๐Ÿ‘๐Ÿผ

is there a way to make this working?

EmojiUtils.emojify() emojifies https://

As in the topic. Whenever I want to emojify text that contains some hyperlink it detects emoji in https:// Is there any way I could exclude links form emojifying? It would be perfect if there was option to emojify only emojis separated by blanks from other characters

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.