Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center Emoji in line #121

Closed
Sese-Schneider opened this issue May 14, 2017 · 24 comments · Fixed by #146
Closed

Center Emoji in line #121

Sese-Schneider opened this issue May 14, 2017 · 24 comments · Fixed by #146
Milestone

Comments

@Sese-Schneider
Copy link

Hi,

is it somehow possible to center an emoji in its line?

7aee1719-fb3c-4110-b3ad-a08986765244

I manually set the lineheight via emojiTextView.setLineSpacing(0f, 1.5f);
Unfortunately the emoji "drops" and is not displayed centered.

I could not find any method in your files to do this.
If there is none could you add this in a future release please?

With kind regards,

Sebastian Schneider

@vanniktech
Copy link
Owner

I don't think you'll need to do anything in order to let it be centered. Maybe the line spacing is causing this dropping down effect.

@Sese-Schneider
Copy link
Author

How can i fix this then?
I just set the emoji size, text size and linespacing according to doc. emoji is unicode added

@vanniktech
Copy link
Owner

Can you try 0.5.0-SNAPSHOT and see whether this changes anything. Note: setEmojiSize has been removed and instead lineHeight from TextView is used.

@justmobilize
Copy link

justmobilize commented May 16, 2017

There are some other issues with the new line height settings. adding this:

android:lineSpacingMultiplier="2.5"
android:lineSpacingExtra="6dp"

causes this:
screenshot_20170516-105605

@vanniktech
Copy link
Owner

Interesting. Maybe support for those attributes have to be added too.

@justmobilize
Copy link

Might I suggest you leave both options in there? So if size is undefined it used the line height otherwise the emoji size?

I don't think line height will ever look right if changed, since it's all below the text. And I assume most people would want either centered or bottom aligned.

@vanniktech
Copy link
Owner

So using emojiSize if it's defined otherwise the line height?

@justmobilize
Copy link

I think that would be the best of both worlds.

@vanniktech
Copy link
Owner

@justmobilize would you like to submit a PR?

@Sese-Schneider
Copy link
Author

@vanniktech how can i include this update into my gradle files?

@vanniktech
Copy link
Owner

Use the maven snapshot url and use 0.5.0-SNAPSHOT.

@MobinHiq
Copy link

Unfortunately SNAPSHOT version has problems. When you leave the app and re-open it, the text box height becomes 0 and emojies vanish. Also emoji size has no effect still.

@vanniktech
Copy link
Owner

Which approach are you using?

@MobinHiq
Copy link

compile 'com.vanniktech:emoji-ios:0.5.0-SNAPSHOT' with a RecyclerView for messages. Look at this:
photo_2017-06-26_15-27-42
If the text is combined with Emojies then there is no problem, but if you just send emojies and you re-open the app then the line height gets 0 and as the image shows.

@vanniktech
Copy link
Owner

Hmm what does your xml layout declaration / java code look like? Try out the sample and just send an Emoji. In there it does work.

@MobinHiq
Copy link

Actually it works on Emulator with no problem! And if I change no non SNAPSHOT version then it would be fine but the emoji keyboard not closing on back press happens!

<com.vanniktech.emoji.EmojiTextView
android:id="@+id/textMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="textStart"
android:layout_gravity="start"
android:textStyle="normal"
android:textColor="@color/chatTextMainColor"
android:textSize="16sp" />

The code is exactly as your sample. I haven't add anything special.

@vanniktech
Copy link
Owner

Maybe the textStyle or textAlignment adding just emojis does work in the sample.

@MobinHiq
Copy link

MobinHiq commented Jun 27, 2017

Let me check more. The weird thing is that it doesn't have any problem in the emulator. Also if you remember in issue #138 and Ereza mentioned the same problem of line height becoming 0 and he thought he resolved it with removing the emoji size but it was not solved apparently.

@vanniktech
Copy link
Owner

Yup I do. I also yesterday briefly experimented with displaying the emoji in a bigger size when you only send one (similary to what Whatsapp & Slack does) and I also stumbled upon some problems. I definitely want this to get fixed before doing 0.5.0.

@MobinHiq
Copy link

That would be great if it's fixed soon. We plan to release and use your library in end of July so we would be really happy if it's fixed. But I will try to go around and test different cases to see if it's possible to fix it.

@vanniktech
Copy link
Owner

I'd fix it right away if the project I'm working on would require this library. Unfortunately priorities have changed recently and it's a complete side project.

I also created #148 for further discussion about the Emoji size potential.

@MobinHiq
Copy link

Excellent, we really appreciate your great work. Good luck.

@justmobilize
Copy link

I can also look into some of this. We are a handful of commits back (before the sizing started to change) and resizing single emojis (without text works).

@vanniktech
Copy link
Owner

I'd appreciate any help. I'm also waiting with 0.5.0 until this sizing is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants