[android] Split out an EmojiTextInputView from TextInputViews

This also removes the TextInputController whose job is now done by the view.
This commit is contained in:
Torsten Grote
2018-12-05 12:39:13 -02:00
parent c7f4e976ed
commit 5fbacb4ee4
19 changed files with 294 additions and 921 deletions

View File

@@ -1,8 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#000000"
android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:parentTag="org.briarproject.briar.android.view.KeyboardAwareLinearLayout"
tools:showIn="@layout/fragment_reblog">
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/emoji_toggle"
android:layout_width="@dimen/text_input_height"
android:layout_height="@dimen/text_input_height"
android:layout_gravity="bottom"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/margin_small"
android:scaleType="center"
android:src="@drawable/ic_emoji_toggle"
app:tint="?attr/colorControlNormal"/>
<com.vanniktech.emoji.EmojiEditText
android:id="@+id/input_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@android:color/transparent"
android:inputType="textMultiLine|textCapSentences|textAutoCorrect"
android:minHeight="@dimen/text_input_height"
android:textColor="?android:attr/textColorPrimary"
tools:text="Line 1\nLine 2\nLine 3"/>
</merge>

View File

@@ -48,31 +48,12 @@
android:layout_height="wrap_content"
android:background="@color/card_background">
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/emoji_toggle"
android:layout_width="@dimen/text_input_height"
android:layout_height="@dimen/text_input_height"
android:layout_gravity="bottom"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/margin_small"
android:scaleType="center"
android:src="@drawable/ic_emoji_toggle"
app:tint="?attr/colorControlNormal"/>
<com.vanniktech.emoji.EmojiEditText
android:id="@+id/input_text"
<org.briarproject.briar.android.view.EmojiTextInputView
android:id="@+id/emojiTextInput"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="4"
android:minHeight="@dimen/text_input_height"
android:paddingLeft="2dp"
android:paddingStart="2dp"
android:textColor="?android:attr/textColorPrimary"
tools:ignore="RtlSymmetry"
tools:text="Line 1\nLine 2\nLine 3"/>
app:maxTextLines="4"/>
<FrameLayout
android:layout_width="@dimen/text_input_height"

View File

@@ -22,39 +22,12 @@
app:cardCornerRadius="0dp"
app:cardUseCompatPadding="false">
<LinearLayout
<org.briarproject.briar.android.view.EmojiTextInputView
android:id="@+id/emojiTextInput"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/emoji_toggle"
android:layout_width="@dimen/text_input_height"
android:layout_height="@dimen/text_input_height"
android:layout_gravity="bottom"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/margin_small"
android:scaleType="center"
android:src="@drawable/ic_emoji_toggle"
app:tint="?attr/colorControlNormal"/>
<com.vanniktech.emoji.EmojiEditText
android:id="@+id/input_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:gravity="bottom"
android:inputType="textMultiLine|textLongMessage|textCapSentences|textAutoCorrect"
android:minHeight="@dimen/text_input_height"
android:paddingBottom="10dp"
android:paddingEnd="@dimen/margin_small"
android:paddingRight="@dimen/margin_small"
android:paddingTop="@dimen/margin_small"
android:textColor="?android:attr/textColorPrimary"
tools:ignore="RtlSymmetry"
tools:text="Line 1\nLine 2\nLine 3"/>
</LinearLayout>
app:textPaddingBottom="10dp"
app:textPaddingEnd="@dimen/margin_medium"/>
</android.support.v7.widget.CardView>

View File

@@ -19,6 +19,12 @@
</attr>
</declare-styleable>
<declare-styleable name="EmojiTextInputView">
<attr name="textPaddingBottom" format="dimension"/>
<attr name="textPaddingEnd" format="dimension"/>
<attr name="maxTextLines" format="integer"/>
</declare-styleable>
<declare-styleable name="TextInputView">
<attr name="hint" format="string"/>
<attr name="allowEmptyText" format="boolean"/>