diff options
| -rw-r--r-- | project.properties | 2 | ||||
| -rw-r--r-- | res/values/strings.xml | 8 | ||||
| -rw-r--r-- | res/xml/settings.xml | 26 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2View.java | 17 |
4 files changed, 45 insertions, 8 deletions
diff --git a/project.properties b/project.properties index 00cf62b..916037e 100644 --- a/project.properties +++ b/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-22 +target=android-23 diff --git a/res/values/strings.xml b/res/values/strings.xml index 103d0d9..0928cce 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -27,4 +27,12 @@ <string name="pref_vibrate_duration_title">Duration</string> <string name="pref_vibrate_duration_summary">%sms</string> + <string name="pref_category_style">Style</string> + <string name="pref_margin_bottom_title">Margin bottom</string> + <string name="pref_margin_bottom_summary">%sdp</string> + <string name="pref_key_height_title">Key height</string> + <string name="pref_key_height_summary">%sdp</string> + <string name="pref_horizontal_margin_title">Horizontal margin</string> + <string name="pref_horizontal_margin_summary">%sdp</string> + </resources> diff --git a/res/xml/settings.xml b/res/xml/settings.xml index fe6dbef..2bc4299 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -50,4 +50,30 @@ max="50" /> </PreferenceCategory> + <PreferenceCategory android:title="@string/pref_category_style"> + <juloo.common.IntSlideBarPreference + android:key="margin_bottom" + android:title="@string/pref_margin_bottom_title" + android:summary="@string/pref_margin_bottom_summary" + android:defaultValue="5" + min="0" + max="50" + /> + <juloo.common.IntSlideBarPreference + android:key="key_height" + android:title="@string/pref_key_height_title" + android:summary="@string/pref_key_height_summary" + android:defaultValue="50" + min="30" + max="70" + /> + <juloo.common.IntSlideBarPreference + android:key="horizontal_margin" + android:title="@string/pref_horizontal_margin_title" + android:summary="@string/pref_horizontal_margin_summary" + android:defaultValue="3" + min="0" + max="15" + /> + </PreferenceCategory> </PreferenceScreen> 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; |
