2015-10-24 16:32:49 +02:00
|
|
|
package juloo.keyboard2;
|
|
|
|
|
|
|
|
import android.content.Context;
|
2021-01-16 21:57:51 +01:00
|
|
|
import android.view.ContextThemeWrapper;
|
2015-10-24 16:32:49 +02:00
|
|
|
import android.view.MotionEvent;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.Button;
|
2021-01-16 21:57:51 +01:00
|
|
|
|
|
|
|
/* Emoji "types" are groups. This class is misnamed. */
|
2015-10-24 16:32:49 +02:00
|
|
|
|
|
|
|
public class EmojiTypeButton extends Button
|
|
|
|
implements View.OnTouchListener
|
|
|
|
{
|
|
|
|
private int _emojiType;
|
|
|
|
|
2021-01-16 21:57:51 +01:00
|
|
|
static private final int DEFAULT_GROUP = 0;
|
2015-10-27 15:05:50 +01:00
|
|
|
|
2021-01-16 21:57:51 +01:00
|
|
|
public EmojiTypeButton(Context context, int group_id, String symbol)
|
|
|
|
{
|
|
|
|
super(new ContextThemeWrapper(context, R.style.emojiTypeButton), null, 0);
|
|
|
|
_emojiType = group_id;
|
|
|
|
setText(symbol);
|
2015-10-24 16:32:49 +02:00
|
|
|
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);
|
2021-01-16 21:57:51 +01:00
|
|
|
emojiGrid.setEmojiGroup(_emojiType);
|
2015-10-24 16:32:49 +02:00
|
|
|
return (true);
|
|
|
|
}
|
|
|
|
}
|