Unexpected-Keyboard/srcs/juloo.keyboard2/EmojiKeyButton.java
Jules Aguillon 078dbcd5ff Refactor: Move editing code from to KeyEventHandler
Remove the code dealing with InputMethodConnection from 'Keyboard2' and
move it into 'KeyEventHandler', where more editing actions can now be
implemented.

Autocapitalisation is also moved, the IReceiver interface is simplified.
2022-11-13 16:28:39 +01:00

30 lines
771 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.key_up(_key, Pointers.Modifiers.EMPTY);
}
}