Add left/right slider to the emoji pane

This entirely changes the implementation of the bottom row in the emoji
pane.
This commit is contained in:
Jules Aguillon 2023-10-28 20:14:32 +02:00
parent 3d36ecb34d
commit 148bed769a
6 changed files with 27 additions and 43 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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