mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-12-29 09:28:53 +01:00
25a6e71ee8
Allows to add more keys to the keyboard from a predefined list. The implementation doesn't use MultiSelectListPreference because it doesn't seem possible to change the item layout to properly show the rendered symbols.
30 lines
776 B
Java
30 lines
776 B
Java
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.handleKeyUp(_key, Pointers.Modifiers.EMPTY);
|
|
}
|
|
}
|