From 231c4979d6a10bf632d83032775b5b3bd7bf9a82 Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Thu, 3 Nov 2016 09:54:11 +0100 Subject: Fix send button not being centered for non-standard densities. Change-Id: I6e6717dc7487eeafca121e94d93aff5c3aae5f6c --- java/src/com/android/inputmethod/keyboard/KeyboardView.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 27e538cb7..c212cc1fb 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -355,12 +355,8 @@ public class KeyboardView extends View { if (key.needsToKeepBackgroundAspectRatio(mDefaultKeyLabelFlags) // HACK: To disable expanding normal/functional key background. && !key.hasCustomActionLabel()) { - final int intrinsicWidth = background.getIntrinsicWidth(); - final int intrinsicHeight = background.getIntrinsicHeight(); - final float minScale = Math.min( - keyWidth / (float)intrinsicWidth, keyHeight / (float)intrinsicHeight); - bgWidth = (int)(intrinsicWidth * minScale); - bgHeight = (int)(intrinsicHeight * minScale); + bgWidth = background.getIntrinsicWidth(); + bgHeight = background.getIntrinsicHeight(); bgX = (keyWidth - bgWidth) / 2; bgY = (keyHeight - bgHeight) / 2; } else { @@ -370,10 +366,7 @@ public class KeyboardView extends View { bgX = -padding.left; bgY = -padding.top; } - final Rect bounds = background.getBounds(); - if (bgWidth != bounds.right || bgHeight != bounds.bottom) { - background.setBounds(0, 0, bgWidth, bgHeight); - } + background.setBounds(0, 0, bgWidth, bgHeight); canvas.translate(bgX, bgY); background.draw(canvas); canvas.translate(-bgX, -bgY); -- cgit v1.2.3