diff options
| -rw-r--r-- | res/layout/emoji_pane.xml | 4 | ||||
| -rw-r--r-- | res/layout/keyboard.xml | 2 | ||||
| -rw-r--r-- | res/values/colors.xml | 14 | ||||
| -rw-r--r-- | res/values/dimens.xml | 1 | ||||
| -rw-r--r-- | res/values/styles.xml | 13 | ||||
| -rw-r--r-- | res/values/themes.xml | 35 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/EmojiGridView.java | 5 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/Theme.java | 16 |
8 files changed, 59 insertions, 31 deletions
diff --git a/res/layout/emoji_pane.xml b/res/layout/emoji_pane.xml index 2d249f3..3c58330 100644 --- a/res/layout/emoji_pane.xml +++ b/res/layout/emoji_pane.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:hardwareAccelerated="false"> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:hardwareAccelerated="false" android:theme="@style/Dark"> <juloo.keyboard2.EmojiGroupButtonsBar android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"/> - <juloo.keyboard2.EmojiGridView android:id="@+id/emoji_grid" android:background="@color/bg" android:layout_width="fill_parent" android:layout_height="@dimen/emoji_grid_height"/> + <juloo.keyboard2.EmojiGridView android:id="@+id/emoji_grid" android:background="?attr/colorKeyboard" android:layout_width="fill_parent" android:layout_height="@dimen/emoji_grid_height"/> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <juloo.keyboard2.EmojiKeyButton style="@style/emojiKeyButton" key="switch_back_emoji"/> <juloo.keyboard2.EmojiKeyButton style="@style/emojiKeyButton" android:layout_weight="4" key="space"/> diff --git a/res/layout/keyboard.xml b/res/layout/keyboard.xml index 43b3e47..b15f6d0 100644 --- a/res/layout/keyboard.xml +++ b/res/layout/keyboard.xml @@ -1,2 +1,2 @@ <?xml version="1.0" encoding="utf-8"?> -<juloo.keyboard2.Keyboard2View xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/bg" android:hardwareAccelerated="false"/> +<juloo.keyboard2.Keyboard2View xmlns:android="http://schemas.android.com/apk/res/android" android:hardwareAccelerated="false" android:theme="@style/Dark" android:background="?attr/colorKeyboard"/> diff --git a/res/values/colors.xml b/res/values/colors.xml deleted file mode 100644 index 63d981b..0000000 --- a/res/values/colors.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <item name="bg" type="color">#1B1B1B</item> - <item name="key_bg" type="color">#303030</item> - <item name="key_down_bg" type="color">#1B1B1B</item> - <item name="key_label" type="color">#FFFFFF</item> - <item name="key_label_locked" type="color">#229933</item> - <item name="key_label_activated" type="color">#226b99</item> - <item name="key_sub_label" type="color">#A0A0A0</item> - <item name="emoji_button_bg" type="color">#202020</item> - <item name="emoji_color" type="color">#FFFFFF</item> - <item name="emoji_key_bg" type="color">@color/emoji_button_bg</item> - <item name="emoji_key_text" type="color">@color/key_label</item> -</resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index a8286cb..0fe54d3 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -12,4 +12,5 @@ <dimen name="sublabel_text_size">12dp</dimen> <dimen name="emoji_type_button_height">56dp</dimen> <dimen name="emoji_grid_height">250dp</dimen> + <dimen name="emoji_text_size">28dp</dimen> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 7dcbb33..bad63e1 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -4,8 +4,8 @@ <item name="android:padding">1px</item> <item name="android:gravity">center</item> <item name="android:minHeight">@dimen/label_text_size</item> - <item name="android:background">@color/emoji_button_bg</item> - <item name="android:textColor">@color/emoji_key_text</item> + <item name="android:background">?attr/emoji_button_bg</item> + <item name="android:textColor">?attr/emoji_key_text</item> <item name="android:textSize">@dimen/label_text_size</item> </style> <style name="emojiKeyButton"> @@ -13,8 +13,13 @@ <item name="android:layout_height">wrap_content</item> <item name="android:layout_weight">1</item> <item name="android:padding">0px</item> - <item name="android:background">@color/emoji_key_bg</item> - <item name="android:textColor">@color/emoji_key_text</item> + <item name="android:background">?attr/emoji_key_bg</item> + <item name="android:textColor">?attr/emoji_key_text</item> <item name="android:textSize">@dimen/label_text_size</item> </style> + <!-- Passed to TextView.setTextAppearance --> + <style name="emojiGridButton"> + <item name="android:textSize">@dimen/emoji_text_size</item> + <item name="android:textColor">?attr/emoji_color</item> + </style> </resources> diff --git a/res/values/themes.xml b/res/values/themes.xml new file mode 100644 index 0000000..02f97be --- /dev/null +++ b/res/values/themes.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <declare-styleable name="keyboard"> + <!-- The background of the keyboard --> + <attr name="colorKeyboard" format="color"/> + <!-- Background of the keys --> + <attr name="colorKey" format="color"/> + <!-- Background of the keys when pressed --> + <attr name="colorKeyActivated" format="color"/> + <!-- Label colors --> + <attr name="colorLabel" format="color"/> + <attr name="colorLabelActivated" format="color"/> + <attr name="colorLabelLocked" format="color"/> + <!-- Corner labels --> + <attr name="colorSubLabel" format="color"/> + <!-- Emoji panel --> + <attr name="emoji_button_bg" type="color" format="color"/> + <attr name="emoji_color" type="color" format="color"/> + <attr name="emoji_key_bg" type="color" format="color"/> + <attr name="emoji_key_text" type="color" format="color"/> + </declare-styleable> + <style name="Dark"> + <item name="colorKeyboard">#1B1B1B</item> + <item name="colorKey">#303030</item> + <item name="colorKeyActivated">#1B1B1B</item> + <item name="colorLabel">#FFFFFF</item> + <item name="colorLabelActivated">#226b99</item> + <item name="colorLabelLocked">#229933</item> + <item name="colorSubLabel">#A0A0A0</item> + <item name="emoji_button_bg" type="color">#202020</item> + <item name="emoji_color" type="color">#FFFFFF</item> + <item name="emoji_key_bg" type="color">?attr/emoji_button_bg</item> + <item name="emoji_key_text" type="color">?attr/colorLabel</item> + </style> +</resources> diff --git a/srcs/juloo.keyboard2/EmojiGridView.java b/srcs/juloo.keyboard2/EmojiGridView.java index 9fc08be..eb2d6df 100644 --- a/srcs/juloo.keyboard2/EmojiGridView.java +++ b/srcs/juloo.keyboard2/EmojiGridView.java @@ -24,7 +24,6 @@ public class EmojiGridView extends GridView public static final int GROUP_LAST_USE = -1; public static final int COLUMN_WIDTH = 192; - public static final float EMOJI_SIZE = 32.f; private static final String LAST_USE_PREF = "emoji_last_use"; @@ -120,10 +119,8 @@ public class EmojiGridView extends GridView public EmojiView(Context context) { super(context); - setTextSize(EMOJI_SIZE); + setTextAppearance(context, R.style.emojiGridButton); setGravity(Gravity.CENTER); - setBackgroundColor(0x0); - setTextColor(getResources().getColor(R.color.emoji_color)); setLayoutParams(new GridView.LayoutParams(GridView.LayoutParams.WRAP_CONTENT, GridView.LayoutParams.WRAP_CONTENT)); } diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java index af2f3d7..e90074b 100644 --- a/srcs/juloo.keyboard2/Theme.java +++ b/srcs/juloo.keyboard2/Theme.java @@ -2,6 +2,7 @@ package juloo.keyboard2; import android.content.Context; import android.content.res.Resources; +import android.content.res.TypedArray; import android.graphics.Paint; import android.graphics.Typeface; import android.util.AttributeSet; @@ -24,15 +25,18 @@ public class Theme public Theme(Context context, AttributeSet attrs) { + TypedArray s = context.getTheme().obtainStyledAttributes(attrs, R.styleable.keyboard, 0, R.style.Dark); + keyBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKey, 0)); + keyDownBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKeyActivated, 0)); + // colorKeyboard = s.getColor(R.styleable.keyboard_colorKeyboard, 0); + labelColor = s.getColor(R.styleable.keyboard_colorLabel, 0); + activatedColor = s.getColor(R.styleable.keyboard_colorLabelActivated, 0); + lockedColor = s.getColor(R.styleable.keyboard_colorLabelLocked, 0); + subLabelColor = s.getColor(R.styleable.keyboard_colorSubLabel, 0); + s.recycle(); Resources res = context.getResources(); - lockedColor = res.getColor(R.color.key_label_locked); - activatedColor = res.getColor(R.color.key_label_activated); - labelColor = res.getColor(R.color.key_label); - subLabelColor = res.getColor(R.color.key_sub_label); labelTextSize = res.getDimension(R.dimen.label_text_size); sublabelTextSize = res.getDimension(R.dimen.sublabel_text_size); - keyBgPaint.setColor(res.getColor(R.color.key_bg)); - keyDownBgPaint.setColor(res.getColor(R.color.key_down_bg)); _keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null); _keySubLabelPaint = initLabelPaint(Paint.Align.LEFT, null); Typeface specialKeyFont = getSpecialKeyFont(context); |
