summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2016-11-03 09:54:11 +0100
committerDanny Baumann <dannybaumann@web.de>2016-11-03 09:54:11 +0100
commit231c4979d6a10bf632d83032775b5b3bd7bf9a82 (patch)
treefe941241d2762601dc08dcb4c3a83dbf555fe5ba
parent30345abfb10472e2e3301891ff09f45014e51557 (diff)
downloadandroid_packages_inputmethods_LatinIME-231c4979d6a10bf632d83032775b5b3bd7bf9a82.tar.gz
android_packages_inputmethods_LatinIME-231c4979d6a10bf632d83032775b5b3bd7bf9a82.tar.bz2
android_packages_inputmethods_LatinIME-231c4979d6a10bf632d83032775b5b3bd7bf9a82.zip
Fix send button not being centered for non-standard densities.
Change-Id: I6e6717dc7487eeafca121e94d93aff5c3aae5f6c
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java13
1 files 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);