Commit d10c519a authored by Tiago Cunha's avatar Tiago Cunha

PR based feedback

parent 92b0eb83
...@@ -12,7 +12,7 @@ import android.view.inputmethod.EditorInfo; ...@@ -12,7 +12,7 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
import android.widget.EditText; import android.widget.EditText;
public class RocketChatEditText extends EditText { public class ImageKeyboardEditText extends EditText {
private final String[] mimeTypes = {"image/gif"}; private final String[] mimeTypes = {"image/gif"};
...@@ -29,23 +29,23 @@ public class RocketChatEditText extends EditText { ...@@ -29,23 +29,23 @@ public class RocketChatEditText extends EditText {
} }
}; };
private ContentListener listener; private OnCommitContentListener listener;
public RocketChatEditText(Context context) { public ImageKeyboardEditText(Context context) {
super(context); super(context);
} }
public RocketChatEditText(Context context, AttributeSet attrs) { public ImageKeyboardEditText(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
} }
public RocketChatEditText(Context context, AttributeSet attrs, int defStyleAttr) { public ImageKeyboardEditText(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
public RocketChatEditText(Context context, AttributeSet attrs, int defStyleAttr, public ImageKeyboardEditText(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) { int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
} }
...@@ -59,11 +59,11 @@ public class RocketChatEditText extends EditText { ...@@ -59,11 +59,11 @@ public class RocketChatEditText extends EditText {
.createWrapper(inputConnection, editorInfo, inputConnectionListener); .createWrapper(inputConnection, editorInfo, inputConnectionListener);
} }
public void setContentListener(ContentListener listener) { public void setContentListener(OnCommitContentListener listener) {
this.listener = listener; this.listener = listener;
} }
public interface ContentListener { public interface OnCommitContentListener {
boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags,
Bundle opts, String[] supportedMimeTypes); Bundle opts, String[] supportedMimeTypes);
} }
......
...@@ -12,7 +12,6 @@ import android.util.AttributeSet; ...@@ -12,7 +12,6 @@ import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
...@@ -27,7 +26,7 @@ public class MessageFormLayout extends LinearLayout { ...@@ -27,7 +26,7 @@ public class MessageFormLayout extends LinearLayout {
private ExtraActionSelectionClickListener extraActionSelectionClickListener; private ExtraActionSelectionClickListener extraActionSelectionClickListener;
private SubmitTextListener submitTextListener; private SubmitTextListener submitTextListener;
private RocketChatEditText.ContentListener listener; private ImageKeyboardEditText.OnCommitContentListener listener;
public MessageFormLayout(Context context) { public MessageFormLayout(Context context) {
super(context); super(context);
...@@ -79,7 +78,7 @@ public class MessageFormLayout extends LinearLayout { ...@@ -79,7 +78,7 @@ public class MessageFormLayout extends LinearLayout {
btnSubmit.setScaleY(0); btnSubmit.setScaleY(0);
btnSubmit.setVisibility(GONE); btnSubmit.setVisibility(GONE);
RocketChatEditText editText = (RocketChatEditText) composer.findViewById(R.id.editor); ImageKeyboardEditText editText = (ImageKeyboardEditText) composer.findViewById(R.id.editor);
editText.addTextChangedListener(new TextWatcher() { editText.addTextChangedListener(new TextWatcher() {
@Override @Override
...@@ -102,7 +101,7 @@ public class MessageFormLayout extends LinearLayout { ...@@ -102,7 +101,7 @@ public class MessageFormLayout extends LinearLayout {
} }
}); });
editText.setContentListener(new RocketChatEditText.ContentListener() { editText.setContentListener(new ImageKeyboardEditText.OnCommitContentListener() {
@Override @Override
public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags,
Bundle opts, String[] supportedMimeTypes) { Bundle opts, String[] supportedMimeTypes) {
...@@ -154,7 +153,7 @@ public class MessageFormLayout extends LinearLayout { ...@@ -154,7 +153,7 @@ public class MessageFormLayout extends LinearLayout {
composer.findViewById(R.id.btn_submit).setEnabled(enabled); composer.findViewById(R.id.btn_submit).setEnabled(enabled);
} }
public void setEditTextContentListener(RocketChatEditText.ContentListener listener) { public void setEditTextContentListener(ImageKeyboardEditText.OnCommitContentListener listener) {
this.listener = listener; this.listener = listener;
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
android:layout_height="32dp" android:layout_height="32dp"
android:layout_margin="8dp" /> android:layout_margin="8dp" />
<chat.rocket.android.widget.message.RocketChatEditText <chat.rocket.android.widget.message.ImageKeyboardEditText
android:id="@+id/editor" android:id="@+id/editor"
android:layout_width="0px" android:layout_width="0px"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
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