abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/EmojiKeyButton.java
blob: ed1e027eb054359f90bca45523c3a4005300b383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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);
  }
}