diff options
| author | juloo | 2015-08-02 23:36:22 +0200 |
|---|---|---|
| committer | juloo | 2015-08-02 23:36:22 +0200 |
| commit | 3d3aa4bc98ccaabcc71f3360c8bd53eea64cd093 (patch) | |
| tree | b5ee53eba83fc3eadba6d76f5d1b2c69c412bb17 /srcs | |
| parent | 6737bda40285bc8f1116b979934ffadd7439a335 (diff) | |
| download | unexpected-keyboard-3d3aa4bc98ccaabcc71f3360c8bd53eea64cd093.tar.gz unexpected-keyboard-3d3aa4bc98ccaabcc71f3360c8bd53eea64cd093.zip | |
Nothing
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2View.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index c2d9f85..705394d 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -39,14 +39,12 @@ public class Keyboard2View extends View public Keyboard2View(Context context, AttributeSet attrs) { super(context, attrs); - DisplayMetrics dm = context.getResources().getDisplayMetrics(); _verticalMargin = getResources().getDimension(R.dimen.vertical_margin); _horizontalMargin = getResources().getDimension(R.dimen.horizontal_margin); _keyHeight = getResources().getDimension(R.dimen.key_height); _keyPadding = getResources().getDimension(R.dimen.key_padding); _keyBgPadding = getResources().getDimension(R.dimen.key_bg_padding); _keyRound = getResources().getDimension(R.dimen.key_round); - _keyWidth = (dm.widthPixels - (_horizontalMargin * 2)) / KEY_PER_ROW; _keyBgPaint.setColor(getResources().getColor(R.color.key_bg)); _keyDownBgPaint.setColor(getResources().getColor(R.color.key_down_bg)); _keyLabelPaint.setColor(getResources().getColor(R.color.key_label)); @@ -203,6 +201,7 @@ public class Keyboard2View extends View @Override public void onMeasure(int wSpec, int hSpec) { + DisplayMetrics dm = getContext().getResources().getDisplayMetrics(); int height; if (_keyboard.getRows() == null) @@ -210,7 +209,8 @@ public class Keyboard2View extends View else height = (int)(_keyHeight * ((float)_keyboard.getRows().size()) + (_verticalMargin * 2)); - setMeasuredDimension(MeasureSpec.getSize(wSpec), height); + setMeasuredDimension(dm.widthPixels, height); + _keyWidth = (getWidth() - (_horizontalMargin * 2)) / KEY_PER_ROW; } @Override |
