Unexpected-Keyboard/srcs/juloo.keyboard2/EmojiKeyButton.java
Jules Aguillon 81803c406a Separate handling of modifiers from KeyValue class
KeyValue defines an ADT and some of its values, it now contains public
final fields and no internal logic.
KeyModifier handles modifiers and accents and creates new instances of
KeyValue when needed.
This operation is now properly cached.
2021-04-18 23:28:49 +02:00

30 lines
682 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);
_key = KeyValue.getKeyByName(attrs.getAttributeValue(null, "key"));
setText(_key.symbol);
if ((_key.flags & KeyValue.FLAG_KEY_FONT) != 0)
setTypeface(((Keyboard2)context).getSpecialKeyFont());
}
public void onClick(View v)
{
Keyboard2 main = (Keyboard2)getContext();
main.handleKeyUp(_key, 0);
}
}