Unexpected-Keyboard/srcs/juloo.keyboard2/EmojiTypeButton.java
Jules Aguillon 1cfecbdf48 Auto-format Java and XML files
Use xmllint.
Re-indent Java files using spaces.
2021-12-19 19:44:27 +01:00

38 lines
1000 B
Java

package juloo.keyboard2;
import android.content.Context;
import android.view.ContextThemeWrapper;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
/* Emoji "types" are groups. This class is misnamed. */
public class EmojiTypeButton extends Button
implements View.OnTouchListener
{
private int _emojiType;
static private final int DEFAULT_GROUP = 0;
public EmojiTypeButton(Context context, int group_id, String symbol)
{
super(new ContextThemeWrapper(context, R.style.emojiTypeButton), null, 0);
_emojiType = group_id;
setText(symbol);
setOnTouchListener(this);
}
public boolean onTouch(View view, MotionEvent event)
{
EmojiGridView emojiGrid;
if (event.getAction() != MotionEvent.ACTION_DOWN)
return (false);
emojiGrid = (EmojiGridView)((ViewGroup)(getParent().getParent())).findViewById(R.id.emoji_grid);
emojiGrid.setEmojiGroup(_emojiType);
return (true);
}
}