summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/KeyboardView.java
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2016-11-03 09:54:11 +0100
committerMichael Bestas <mkbestas@lineageos.org>2019-12-11 23:42:55 +0200
commit236264525568ab2b4ddc76e4262231df9fa66430 (patch)
tree924794cebbd1bfcb01f1dcd285bf81928a22fe1f /java/src/com/android/inputmethod/keyboard/KeyboardView.java
parentd4f923812316e97841fae197189c38ccde30203f (diff)
Fix send button not being centered for non-standard densities.
Change-Id: I6e6717dc7487eeafca121e94d93aff5c3aae5f6c
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/KeyboardView.java')
-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);