diff options
| author | Jules Aguillon | 2023-10-28 20:14:32 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2023-10-28 20:14:32 +0200 |
| commit | 148bed769a14f9f5efed84e8d9391e0ace813bd2 (patch) | |
| tree | 80b0e2297e4abbef58ef4cfea705d60e57957f5c | |
| parent | 3d36ecb34d0555097d6cc82071acdda4e97b0a90 (diff) | |
| download | unexpected-keyboard-148bed769a14f9f5efed84e8d9391e0ace813bd2.tar.gz unexpected-keyboard-148bed769a14f9f5efed84e8d9391e0ace813bd2.zip | |
Add left/right slider to the emoji pane
This entirely changes the implementation of the bottom row in the emoji
pane.
| -rw-r--r-- | check_layout.py | 3 | ||||
| -rw-r--r-- | res/layout/emoji_pane.xml | 5 | ||||
| -rw-r--r-- | res/values/styles.xml | 9 | ||||
| -rw-r--r-- | res/xml/emoji_bottom_row.xml | 10 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/EmojiBottomRow.java | 14 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/EmojiKeyButton.java | 29 |
6 files changed, 27 insertions, 43 deletions
diff --git a/check_layout.py b/check_layout.py index 97887de..66b6bbe 100644 --- a/check_layout.py +++ b/check_layout.py @@ -6,7 +6,8 @@ warning_count = 0 KNOWN_NOT_LAYOUT = set([ "res/xml/number_row.xml", "res/xml/numpad.xml", "res/xml/pin.xml", "res/xml/bottom_row.xml", "res/xml/settings.xml", "res/xml/method.xml", - "res/xml/greekmath.xml", "res/xml/numeric.xml" ]) + "res/xml/greekmath.xml", "res/xml/numeric.xml", + "res/xml/emoji_bottom_row.xml" ]) def warn(msg): global warning_count diff --git a/res/layout/emoji_pane.xml b/res/layout/emoji_pane.xml index bdce8e0..6d53f86 100644 --- a/res/layout/emoji_pane.xml +++ b/res/layout/emoji_pane.xml @@ -3,9 +3,6 @@ <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:layout_width="fill_parent" android:layout_height="@dimen/emoji_grid_height" android:orientation="vertical" android:numColumns="auto_fit" android:columnWidth="45sp" android:background="?attr/colorKeyboard"/> <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"/> - <juloo.keyboard2.EmojiKeyButton style="@style/emojiKeyButton" key="backspace"/> - <juloo.keyboard2.EmojiKeyButton style="@style/emojiKeyButton" key="enter"/> + <juloo.keyboard2.EmojiBottomRow android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="?attr/emoji_key_bg"/> </LinearLayout> </LinearLayout> diff --git a/res/values/styles.xml b/res/values/styles.xml index d3283a7..fc753c3 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -8,15 +8,6 @@ <item name="android:textColor">?attr/emoji_key_text</item> <item name="android:textSize">18dp</item> </style> - <style name="emojiKeyButton"> - <item name="android:layout_width">0px</item> - <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">?attr/emoji_key_bg</item> - <item name="android:textColor">?attr/emoji_key_text</item> - <item name="android:textSize">18dp</item> - </style> <style name="emojiGridButton"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">fill_parent</item> diff --git a/res/xml/emoji_bottom_row.xml b/res/xml/emoji_bottom_row.xml new file mode 100644 index 0000000..68fb083 --- /dev/null +++ b/res/xml/emoji_bottom_row.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- The bottom row used in the emoji pane. --> +<keyboard bottom_row="false"> + <row height="0.95"> + <key key0="switch_back_emoji"/> + <key width="4" key0="space" key5="cursor_left" key6="cursor_right" slider="true"/> + <key key0="backspace"/> + <key key0="enter"/> + </row> +</keyboard> diff --git a/srcs/juloo.keyboard2/EmojiBottomRow.java b/srcs/juloo.keyboard2/EmojiBottomRow.java new file mode 100644 index 0000000..737367c --- /dev/null +++ b/srcs/juloo.keyboard2/EmojiBottomRow.java @@ -0,0 +1,14 @@ +package juloo.keyboard2; + +import android.content.Context; +import android.util.AttributeSet; + +public class EmojiBottomRow extends Keyboard2View +{ + public EmojiBottomRow(Context context, AttributeSet attrs) + { + super(context, attrs); + KeyboardData kw = KeyboardData.load(getResources(), R.xml.emoji_bottom_row); + setKeyboard(kw); + } +} diff --git a/srcs/juloo.keyboard2/EmojiKeyButton.java b/srcs/juloo.keyboard2/EmojiKeyButton.java deleted file mode 100644 index ed1e027..0000000 --- a/srcs/juloo.keyboard2/EmojiKeyButton.java +++ /dev/null @@ -1,29 +0,0 @@ -package juloo.keyboard2; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.View; -import android.widget.Button; - -public class EmojiKeyButton extends Button - implements View.OnClickListener -{ - KeyValue _key; - - public EmojiKeyButton(Context context, AttributeSet attrs) - { - super(context, attrs); - setOnClickListener(this); - String key_name = attrs.getAttributeValue(null, "key"); - _key = (key_name == null) ? null : KeyValue.getKeyByName(key_name); - setText(_key.getString()); - if (_key.hasFlags(KeyValue.FLAG_KEY_FONT)) - setTypeface(Theme.getKeyFont(context)); - } - - public void onClick(View v) - { - Config config = Config.globalConfig(); - config.handler.key_up(_key, Pointers.Modifiers.EMPTY); - } -} |
