mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
Add a backspace key to the emoji drawer
This commit is contained in:
parent
40ce0cebe0
commit
3597915d17
@ -6,10 +6,25 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.astuetz.PagerSlidingTabStrip android:id="@+id/tabs"
|
||||
android:background="#ff333333"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp" />
|
||||
<LinearLayout android:background="#ff333333"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.astuetz.PagerSlidingTabStrip android:id="@+id/tabs"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="45dp" />
|
||||
|
||||
<ImageButton android:id="@+id/backspace"
|
||||
android:src="@drawable/ic_emoji_backspace"
|
||||
android:background="@color/emoji_tab_underline"
|
||||
android:paddingLeft="@dimen/emoji_drawer_left_right_padding"
|
||||
android:paddingRight="@dimen/emoji_drawer_left_right_padding"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v4.view.ViewPager android:id="@+id/emoji_pager"
|
||||
android:visibility="visible"
|
||||
|
@ -4,7 +4,7 @@
|
||||
<dimen name="min_emoji_drawer_height">200dp</dimen>
|
||||
<dimen name="emoji_drawer_item_padding">8dp</dimen>
|
||||
<dimen name="emoji_drawer_indicator_height">2dp</dimen>
|
||||
<dimen name="emoji_drawer_left_right_padding">15dp</dimen>
|
||||
<dimen name="emoji_drawer_left_right_padding">8dp</dimen>
|
||||
<dimen name="conversation_item_corner_radius">3dp</dimen>
|
||||
<dimen name="conversation_item_drop_shadow_dist">2dp</dimen>
|
||||
<dimen name="contact_selection_photo_size">50dp</dimen>
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user