mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-24 16:00:02 +00:00
Add a backspace key to the emoji drawer
This commit is contained in:
committed by
Jake McGinty
parent
40ce0cebe0
commit
3597915d17
@@ -9,6 +9,8 @@ import android.support.v4.view.ViewPager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -18,6 +20,7 @@ import android.widget.BaseAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
@@ -37,6 +40,7 @@ public class EmojiDrawer extends KeyboardAwareLinearLayout {
|
||||
private Emoji emoji;
|
||||
private ViewPager pager;
|
||||
private PagerSlidingTabStrip strip;
|
||||
private ImageButton backspace;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public EmojiDrawer(Context context) {
|
||||
@@ -76,7 +80,10 @@ public class EmojiDrawer extends KeyboardAwareLinearLayout {
|
||||
private void initializeResources() {
|
||||
this.pager = (ViewPager ) findViewById(R.id.emoji_pager);
|
||||
this.strip = (PagerSlidingTabStrip ) findViewById(R.id.tabs);
|
||||
this.backspace = (ImageButton ) findViewById(R.id.backspace);
|
||||
this.emoji = Emoji.getInstance(getContext());
|
||||
|
||||
this.backspace.setOnClickListener(new BackspaceClickListener());
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
@@ -149,6 +156,20 @@ public class EmojiDrawer extends KeyboardAwareLinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private class BackspaceClickListener implements OnClickListener {
|
||||
|
||||
private final KeyEvent deleteKeyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL);
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (composeText.getText().length() > 0) {
|
||||
composeText.dispatchKeyEvent(deleteKeyEvent);
|
||||
v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class EmojiGridAdapter extends BaseAdapter {
|
||||
|
||||
private final int type;
|
||||
|
||||
Reference in New Issue
Block a user