Commit 2bef3fd7 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update messageFormLayout and message_composer.

parent bdc1c6b6
...@@ -14,8 +14,8 @@ import android.view.View; ...@@ -14,8 +14,8 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView;
import chat.rocket.android.widget.R; import chat.rocket.android.widget.R;
...@@ -23,8 +23,8 @@ public class MessageFormLayout extends LinearLayout { ...@@ -23,8 +23,8 @@ public class MessageFormLayout extends LinearLayout {
protected ViewGroup composer; protected ViewGroup composer;
private View btnExtra; private ImageButton attachmentImageButton;
private View btnSubmit; private ImageButton sendImageButton;
private ExtraActionSelectionClickListener extraActionSelectionClickListener; private ExtraActionSelectionClickListener extraActionSelectionClickListener;
private SubmitTextListener submitTextListener; private SubmitTextListener submitTextListener;
...@@ -55,18 +55,18 @@ public class MessageFormLayout extends LinearLayout { ...@@ -55,18 +55,18 @@ public class MessageFormLayout extends LinearLayout {
composer = (ViewGroup) LayoutInflater.from(getContext()) composer = (ViewGroup) LayoutInflater.from(getContext())
.inflate(R.layout.message_composer, this, false); .inflate(R.layout.message_composer, this, false);
btnExtra = composer.findViewById(R.id.btn_extras); attachmentImageButton = composer.findViewById(R.id.attachmentImageButton);
btnExtra.setOnClickListener(new OnClickListener() { attachmentImageButton.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
onExtraActionSelectionClick(); onExtraActionSelectionClick();
} }
}); });
btnSubmit = composer.findViewById(R.id.btn_submit); sendImageButton = composer.findViewById(R.id.sendImageButton);
btnSubmit.setOnClickListener(new OnClickListener() { sendImageButton.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
String messageText = getText(); String messageText = getText();
...@@ -76,11 +76,11 @@ public class MessageFormLayout extends LinearLayout { ...@@ -76,11 +76,11 @@ public class MessageFormLayout extends LinearLayout {
} }
}); });
btnSubmit.setScaleX(0); sendImageButton.setScaleX(0);
btnSubmit.setScaleY(0); sendImageButton.setScaleY(0);
btnSubmit.setVisibility(GONE); sendImageButton.setVisibility(GONE);
ImageKeyboardEditText editText = (ImageKeyboardEditText) composer.findViewById(R.id.editor); ImageKeyboardEditText editText = composer.findViewById(R.id.editor);
editText.addTextChangedListener(new TextWatcher() { editText.addTextChangedListener(new TextWatcher() {
@Override @Override
...@@ -94,11 +94,11 @@ public class MessageFormLayout extends LinearLayout { ...@@ -94,11 +94,11 @@ public class MessageFormLayout extends LinearLayout {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (TextUtils.getTrimmedLength(s) > 0) { if (TextUtils.getTrimmedLength(s) > 0) {
animateHide(btnExtra); animateHide(attachmentImageButton);
animateShow(btnSubmit); animateShow(sendImageButton);
} else { } else {
animateShow(btnExtra); animateShow(attachmentImageButton);
animateHide(btnSubmit); animateHide(sendImageButton);
} }
} }
}); });
...@@ -164,7 +164,7 @@ public class MessageFormLayout extends LinearLayout { ...@@ -164,7 +164,7 @@ public class MessageFormLayout extends LinearLayout {
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
getEditor().setEnabled(enabled); getEditor().setEnabled(enabled);
composer.findViewById(R.id.btn_submit).setEnabled(enabled); composer.findViewById(R.id.sendImageButton).setEnabled(enabled);
} }
public void setEditTextCommitContentListener( public void setEditTextCommitContentListener(
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="vertical"> android:layout_height="wrap_content"
android:minHeight="48dp"
<chat.rocket.android.widget.DividerView android:background="@drawable/top_shadow"
android:layout_width="match_parent" tools:context="chat.rocket.android.widget.message.MessageFormLayout">
android:layout_height="wrap_content" />
<chat.rocket.android.widget.message.ImageKeyboardEditText
<LinearLayout android:id="@+id/editor"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="bottom" android:layout_marginLeft="16dp"
android:orientation="horizontal"> android:layout_marginStart="16dp"
android:inputType="textCapSentences|textMultiLine"
<ImageView android:hint="@string/message_composer_message_hint"
android:id="@+id/emoji_keyboard_toggle" android:textSize="14sp"
android:layout_width="32dp" android:minLines="1"
android:layout_height="32dp" android:maxLines="4"
android:layout_margin="8dp" /> android:background="@null"
app:layout_constraintTop_toTopOf="parent"
<chat.rocket.android.widget.message.ImageKeyboardEditText app:layout_constraintLeft_toLeftOf="parent"
android:id="@+id/editor" app:layout_constraintRight_toLeftOf="@+id/imageButtonContainer"
android:layout_width="0px" app:layout_constraintBottom_toBottomOf="parent"/>
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" <android.support.constraint.ConstraintLayout
android:inputType="textCapSentences|textMultiLine" android:id="@+id/imageButtonContainer"
android:background="@null" android:layout_width="wrap_content"
android:layout_marginLeft="0dp" android:layout_height="wrap_content"
android:layout_marginRight="0dp" android:layout_marginLeft="16dp"
android:layout_marginTop="4dp" android:layout_marginStart="16dp"
android:layout_marginBottom="4dp" android:layout_marginRight="16dp"
android:padding="0dp" android:layout_marginEnd="16dp"
android:layout_weight="1" app:layout_constraintTop_toTopOf="@+id/editor"
android:textSize="14sp" app:layout_constraintRight_toRightOf="parent"
android:hint="@string/message_composer_message_hint" app:layout_constraintLeft_toRightOf="@+id/editor"
android:minLines="1" app:layout_constraintBottom_toBottomOf="@+id/editor">
android:maxLines="4" />
<ImageButton
<FrameLayout android:id="@+id/attachmentImageButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:tint="@color/colorDefaultMessageComposerIcon"
<ImageView app:srcCompat="@drawable/ic_attach_file_black_24dp"
android:id="@+id/btn_extras" android:background="?attr/selectableItemBackgroundBorderless"/>
android:layout_width="48dp"
android:layout_height="48dp" <ImageButton
android:padding="8dp" android:id="@+id/sendImageButton"
app:srcCompat="@drawable/ic_add_circle_outline_black_24dp" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
<ImageView android:tint="@color/colorAccent"
android:id="@+id/btn_submit" app:srcCompat="@drawable/ic_send_black_24dp"
android:layout_width="48dp" android:background="?attr/selectableItemBackgroundBorderless"/>
android:layout_height="48dp" </android.support.constraint.ConstraintLayout>
android:padding="8dp" </android.support.constraint.ConstraintLayout>
app:srcCompat="@drawable/ic_send_black_24dp" /> \ No newline at end of file
</FrameLayout>
</LinearLayout>
</LinearLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment