Comments (7)
Hello @eemi2010,
You are right, i just checked it and after an hour finally i bypassed it!
This is the source-code:
AXrLottieEmoji-v2.zip
Explanation:
As you know, EditText extends TextView. But When you make a TextView Editable (instantiate android.widget.Editor
which is hide in SDK), The Editor draws and caches the text rendering. So calling invalidate()
doesn't redraw the text.
But there is another method in Editor
called invalidateTextDisplayList()
. Unfortunately you don't have access to that, Not even with reflection! (btw, reflection isn't a good choice here at all)
Some methods such as setTextColor(int)
, setEnabled(boolean)
and setShadowLayer(float, float, float, int)
will call invalidateTextDisplayList()
because of the changes in the editor.
But almost all methods have an internal if-condition to invalidate only if the state has changed!
As far as I checked, setShadowLayer() is the only one that calls invalidateTextDisplayList()
without checking any condition.
So here's the trick, instead of postInvalidate()
, I call setShadowLayer()
with the stored values and it does exactly what I want :)
Good Luck!
from axemojiview.
Hello @eemi2010, Nice question!
I just wrote a simple test project for this by creating a new TextView on top of AXEmojiTextView
called AXrLottieTextView
And another class called AXrLottieEmoji
(like AXPresetEmoji
, It will create AXrLottieDrawable
).
At the end AXrLottieEmojiManager
maps all of your AXrLottieEmoji
instances which AXEmojiTextView
can show.
This is the output:
Initializing (Application):
AXrLottie.init(this);
ArrayList<AXrLottieEmoji> emojis = new ArrayList<>();
emojis.add(new AXrLottieEmoji("\uD83D\uD83E\uD83F", "a.json"));
emojis.add(new AXrLottieEmoji("\uD83D\uD83E\uD84F", "b.json"));
AXrLottieEmojiManager.install(emojis);
AXEmojiManager.install(this, new AXAppleEmojiProvider(this));
And set the text (Activity)
AXrLottieTextView tv = findViewById(R.id.tv);
tv.setText("Hellπ World \uD83D\uD83E\uD83F\uD83D\uD83E\uD84F");
The unicodes I set for LottieEmojis are just for testing and don't mean anything!
from axemojiview.
This is dope !!!!!. Let me try and come back to you. Hopefully this can actually make it to the library. Would be terrific. Thanks a lot for you quick answer.
from axemojiview.
This is working great on AXEmojiTextView. Please can you provide an example with AXEmojiEditText. I tried to to the same as with AXEmojiTextView but on the onTextChanged method. But the emojis and not appearing. Can you please point me in the right direction.
Thanks a lot.
from axemojiview.
Having a look. Will give you feedback in a few. Thanks man. You rock.
from axemojiview.
This is working great for our needs. Thanks a million for your help. Like you can suspect we are trying to mimic the latest Telegram update and I think we got it to work.
Would be awesome if this could make it to the next version of the library.
from axemojiview.
I'm glad it helped. π
This sample is more related to AXrLottie than AXEmojiView. It works like a bridge between these two libraries, so I don't have plan to add it to the library for now, but you can easily add and use these few simple classes to your project and customize it however you want. Like loading lottie files from a link.
from axemojiview.
Related Issues (20)
- AXEmojiUtils.replaceWithEmojis not respecting emoji size ? HOT 4
- Search is not working HOT 1
- Is there a way to remove all variants? HOT 1
- Issue with showing "Smiling face with 3 Hearts" HOT 1
- How to implement the sticker inside custom keyboard? HOT 1
- Crash in Android 12 Samsung device HOT 1
- Can i use open EmojiView without using AXEmojiEditText HOT 2
- Can i use this library for opening emoji picker dialog like in Slack app
- It Doesn't Work on Android 12 HOT 2
- Such a nice library but doesn't work on Android 6, 7 and 12 HOT 1
- Expand to full screen HOT 6
- EmojiPopupLayout with AXSingleEmojiView fails to calculate height HOT 3
- When the popupLayout is hidden, the keyboard pops out the edittext as if leaving room for the PopupLayout. HOT 6
- Ω
- AxEmojiPopupLayout - Failed to instantiate one or more classes
- Is it feasible, to use TextView in AXEmojiRecyclerAdapter, if we only intent to support Google emoji in Android only?
- Help me!!! HOT 1
- NullPointerException object Pattern
- PROGUARD Rules needed to activate AXEmojiView
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from axemojiview.