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