From 21341c5213cf4f8f150ec68b50524cf16088bca4 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Mon, 1 Jun 2015 14:50:06 -0700 Subject: [PATCH] Fix >xxhdpi screens misrendering emoji Fixes #2957 Closes #3302 // FREEBIE --- .../securesms/components/emoji/EmojiProvider.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/components/emoji/EmojiProvider.java b/src/org/thoughtcrime/securesms/components/emoji/EmojiProvider.java index 5817b384b4..1d5b9234ef 100644 --- a/src/org/thoughtcrime/securesms/components/emoji/EmojiProvider.java +++ b/src/org/thoughtcrime/securesms/components/emoji/EmojiProvider.java @@ -73,9 +73,10 @@ public class EmojiProvider { int[] pages = ResUtil.getResourceIds(context, R.array.emoji_categories); this.context = context.getApplicationContext(); - this.drawHeight = context.getResources().getDimension(R.dimen.emoji_drawer_size); - this.drawWidth = drawHeight * ((double)EMOJI_RAW_WIDTH) / EMOJI_RAW_HEIGHT; - this.verticalPad = EMOJI_VERT_PAD * drawHeight / EMOJI_RAW_HEIGHT; + this.drawHeight = Math.min(context.getResources().getDimension(R.dimen.emoji_drawer_size), EMOJI_RAW_HEIGHT); + double drawScale = drawHeight / EMOJI_RAW_HEIGHT; + this.drawWidth = EMOJI_RAW_WIDTH * drawScale; + this.verticalPad = EMOJI_VERT_PAD * drawScale; Log.w(TAG, "draw size: " + drawWidth + "x" + drawHeight); for (int i = 0; i < pages.length; i++) { final EmojiPageBitmap page = new EmojiPageBitmap(i);