diff options
| author | jaguillo | 2015-09-30 22:47:18 +0200 |
|---|---|---|
| committer | jaguillo | 2015-09-30 22:48:16 +0200 |
| commit | 81ec226fcf6c154d4d4c30cfd74815b2ce562b25 (patch) | |
| tree | 1e7e012e759cdb49bb36abd019da5372e9cc2922 /srcs/juloo.keyboard2 | |
| parent | ca503b43a87b5f4112e0925642d84f65dd3ba9ee (diff) | |
| download | unexpected-keyboard-81ec226fcf6c154d4d4c30cfd74815b2ce562b25.tar.gz unexpected-keyboard-81ec226fcf6c154d4d4c30cfd74815b2ce562b25.zip | |
Add margin_bottom, key_height and horizontal_margin configs
Diffstat (limited to 'srcs/juloo.keyboard2')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2View.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 0e70282..b5148f7 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -3,14 +3,15 @@ package juloo.keyboard2; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Canvas; -import android.graphics.RectF; import android.graphics.Paint; -import android.preference.PreferenceManager; -import android.util.AttributeSet; -import android.util.DisplayMetrics; +import android.graphics.RectF; import android.os.Handler; import android.os.Message; import android.os.Vibrator; +import android.preference.PreferenceManager; +import android.util.AttributeSet; +import android.util.DisplayMetrics; +import android.util.TypedValue; import android.view.MotionEvent; import android.view.View; import java.util.LinkedList; @@ -35,10 +36,8 @@ public class Keyboard2View extends View private Handler _handler; private static int _currentWhat = 0; - private float _horizontalMargin; private float _marginTop; private float _keyWidth; - private float _keyHeight; private float _keyPadding; private float _keyBgPadding; private float _keyRound; @@ -49,6 +48,8 @@ public class Keyboard2View extends View private long _longPressTimeout = 600; private long _longPressInterval = 65; private float _marginBottom; + private float _keyHeight; + private float _horizontalMargin; private Paint _keyBgPaint = new Paint(); private Paint _keyDownBgPaint = new Paint(); @@ -91,7 +92,9 @@ public class Keyboard2View extends View _vibrateDuration = prefs.getInt("vibrate_duration", (int)_vibrateDuration); _longPressTimeout = prefs.getInt("longpress_timeout", (int)_longPressTimeout); _longPressInterval = prefs.getInt("longpress_interval", (int)_longPressInterval); - _marginBottom = prefs.getFloat("margin_bottom", _marginBottom); + _marginBottom = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, prefs.getInt("margin_bottom", (int)_marginBottom), getResources().getDisplayMetrics()); + _keyHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, prefs.getInt("key_height", (int)_keyHeight), getResources().getDisplayMetrics()); + _horizontalMargin = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, prefs.getInt("horizontal_margin", (int)_horizontalMargin), getResources().getDisplayMetrics()); String keyboardLayout = prefs.getString("keyboard_layout", null); int xmlRes = 0; |
