mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-01-01 02:49:08 +01:00
4127aa6f03
There was no free bits left to add new modifiers. Instead of increasing the width of the 'flags' field, refactor the way modifiers are represented and used. Modifers are now represented as independent values and stored in the 'code' field. A flag is added to distinguish between modifiers and keys with a key event. The most notable change is that modifiers can no longer be or-ed into a single value but have to be represented as an array.
29 lines
723 B
Java
29 lines
723 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(Theme.getSpecialKeyFont(context));
|
|
}
|
|
|
|
public void onClick(View v)
|
|
{
|
|
Config config = Config.globalConfig();
|
|
config.handler.handleKeyUp(_key, Pointers.Modifiers.EMPTY);
|
|
}
|
|
}
|