Add margin_bottom, key_height and horizontal_margin configs

This commit is contained in:
jaguillo 2015-09-30 22:47:18 +02:00
parent ca503b43a8
commit 81ec226fcf
4 changed files with 45 additions and 8 deletions

View File

@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-22
target=android-23

View File

@ -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>

View File

@ -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="100"
/>
<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="60"
/>
<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="20"
/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -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;