switch conversations fragment to data binder

This commit is contained in:
Daniel Gultsch 2018-02-21 11:04:48 +01:00
parent 5e7d1f7bcc
commit e9e616ebc7
5 changed files with 208 additions and 214 deletions

View file

@ -666,7 +666,7 @@ public class ConversationActivity extends XmppActivity
reInitLatestConversation();
} else {
this.mConversationFragment.messageListAdapter.updatePreferences();
this.mConversationFragment.messagesView.invalidateViews();
//this.mConversationFragment.messagesView.invalidateViews();
this.mConversationFragment.setupIme();
}

View file

@ -3,6 +3,7 @@ package eu.siacs.conversations.ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
@ -67,6 +68,7 @@ import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
import eu.siacs.conversations.databinding.FragmentConversationBinding;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.Contact;
@ -128,13 +130,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
final protected List<Message> messageList = new ArrayList<>();
protected Conversation conversation;
protected ListView messagesView;
private FragmentConversationBinding binding;
protected MessageAdapter messageListAdapter;
private EditMessage mEditMessage;
private ImageButton mSendButton;
private RelativeLayout snackbar;
private TextView snackbarMessage;
private TextView snackbarAction;
private Toast messageLoaderToast;
private ActivityResult postponedActivityResult = null;
@ -207,7 +206,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
return;
}
getActivity().runOnUiThread(() -> {
final int oldPosition = messagesView.getFirstVisiblePosition();
final int oldPosition = binding.messagesView.getFirstVisiblePosition();
Message message = null;
int childPos;
for (childPos = 0; childPos + oldPosition < messageList.size(); ++childPos) {
@ -217,7 +216,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
}
final String uuid = message != null ? message.getUuid() : null;
View v = messagesView.getChildAt(childPos);
View v = binding.messagesView.getChildAt(childPos);
final int pxOffset = (v == null) ? 0 : v.getTop();
ConversationFragment.this.conversation.populateWithMessages(ConversationFragment.this.messageList);
try {
@ -227,7 +226,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
messageListAdapter.notifyDataSetChanged();
int pos = Math.max(getIndexOf(uuid, messageList), 0);
messagesView.setSelectionFromTop(pos, pxOffset);
binding.messagesView.setSelectionFromTop(pos, pxOffset);
if (messageLoaderToast != null) {
messageLoaderToast.cancel();
}
@ -380,8 +379,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
case CANCEL:
if (conversation != null) {
if (conversation.setCorrectingMessage(null)) {
mEditMessage.setText("");
mEditMessage.append(conversation.getDraftMessage());
binding.textinput.setText("");
binding.textinput.append(conversation.getDraftMessage());
conversation.setDraftMessage(null);
} else if (conversation.getMode() == Conversation.MODE_MULTI) {
conversation.setNextCounterpart(null);
@ -428,12 +427,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
public Pair<Integer, Integer> getScrollPosition() {
if (this.messagesView.getCount() == 0 ||
this.messagesView.getLastVisiblePosition() == this.messagesView.getCount() - 1) {
if (this.binding.messagesView.getCount() == 0 ||
this.binding.messagesView.getLastVisiblePosition() == this.binding.messagesView.getCount() - 1) {
return null;
} else {
final int pos = messagesView.getFirstVisiblePosition();
final View view = messagesView.getChildAt(0);
final int pos = this.binding.messagesView.getFirstVisiblePosition();
final View view = this.binding.messagesView.getChildAt(0);
if (view == null) {
return null;
} else {
@ -444,7 +443,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
public void setScrollPosition(Pair<Integer, Integer> scrollPosition) {
if (scrollPosition != null) {
this.messagesView.setSelectionFromTop(scrollPosition.first, scrollPosition.second);
this.binding.messagesView.setSelectionFromTop(scrollPosition.first, scrollPosition.second);
}
}
@ -547,7 +546,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
private void sendMessage() {
final String body = mEditMessage.getText().toString();
final String body = this.binding.textinput.getText().toString();
final Conversation conversation = this.conversation;
if (body.length() == 0 || conversation == null) {
return;
@ -616,32 +615,21 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
public void updateChatMsgHint() {
final boolean multi = conversation.getMode() == Conversation.MODE_MULTI;
if (conversation.getCorrectingMessage() != null) {
this.mEditMessage.setHint(R.string.send_corrected_message);
this.binding.textinput.setHint(R.string.send_corrected_message);
} else if (multi && conversation.getNextCounterpart() != null) {
this.mEditMessage.setHint(getString(
this.binding.textinput.setHint(getString(
R.string.send_private_message_to,
conversation.getNextCounterpart().getResourcepart()));
} else if (multi && !conversation.getMucOptions().participating()) {
this.mEditMessage.setHint(R.string.you_are_not_participating);
this.binding.textinput.setHint(R.string.you_are_not_participating);
} else {
this.mEditMessage.setHint(UIHelper.getMessageHint(getActivity(), conversation));
this.binding.textinput.setHint(UIHelper.getMessageHint(getActivity(), conversation));
getActivity().invalidateOptionsMenu();
}
}
public void setupIme() {;
if (activity != null) {
if (activity.usingEnterKey() && activity.enterIsSend()) {
mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_FLAG_MULTI_LINE));
mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
} else if (activity.usingEnterKey()) {
mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
mEditMessage.setInputType(mEditMessage.getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
} else {
mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
mEditMessage.setInputType(mEditMessage.getInputType() | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE);
}
}
public void setupIme() {
this.binding.textinput.refreshIme();
}
private void handleActivityResult(ActivityResult activityResult) {
@ -658,7 +646,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
conversation.getAccount().getPgpDecryptionService().continueDecryption(data);
break;
case REQUEST_TRUST_KEYS_TEXT:
final String body = mEditMessage.getText().toString();
final String body = this.binding.textinput.getText().toString();
Message message = new Message(conversation, body, conversation.getNextEncryption());
sendAxolotlMessage(message);
break;
@ -784,31 +772,18 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_conversation, container, false);
view.setOnClickListener(null);
this.binding = DataBindingUtil.inflate(inflater,R.layout.fragment_conversation,container,false);
binding.getRoot().setOnClickListener(null); //TODO why the fuck did we do this?
mEditMessage = (EditMessage) view.findViewById(R.id.textinput);
mEditMessage.setOnClickListener(v -> {
if (activity != null) {
activity.hideConversationsOverview();
}
});
binding.textinput.addTextChangedListener(new StylingHelper.MessageEditorStyler(binding.textinput));
mEditMessage.addTextChangedListener(new StylingHelper.MessageEditorStyler(mEditMessage));
binding.textinput.setOnEditorActionListener(mEditorActionListener);
binding.textinput.setRichContentListener(new String[]{"image/*"}, mEditorContentListener);
mEditMessage.setOnEditorActionListener(mEditorActionListener);
mEditMessage.setRichContentListener(new String[]{"image/*"}, mEditorContentListener);
binding.textSendButton.setOnClickListener(this.mSendButtonListener);
mSendButton = (ImageButton) view.findViewById(R.id.textSendButton);
mSendButton.setOnClickListener(this.mSendButtonListener);
snackbar = (RelativeLayout) view.findViewById(R.id.snackbar);
snackbarMessage = (TextView) view.findViewById(R.id.snackbar_message);
snackbarAction = (TextView) view.findViewById(R.id.snackbar_action);
messagesView = (ListView) view.findViewById(R.id.messages_view);
messagesView.setOnScrollListener(mOnScrollListener);
messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
binding.messagesView.setOnScrollListener(mOnScrollListener);
binding.messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
messageListAdapter = new MessageAdapter((ConversationActivity) getActivity(), this.messageList);
messageListAdapter.setOnContactPictureClicked(message -> {
final boolean received = message.getStatus() <= Message.STATUS_RECEIVED;
@ -877,18 +852,18 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
});
messageListAdapter.setOnQuoteListener(this::quoteText);
messagesView.setAdapter(messageListAdapter);
binding.messagesView.setAdapter(messageListAdapter);
registerForContextMenu(messagesView);
registerForContextMenu(binding.messagesView);
return view;
return binding.getRoot();
}
private void quoteText(String text) {
if (mEditMessage.isEnabled()) {
if (binding.textinput.isEnabled()) {
text = text.replaceAll("(\n *){2,}", "\n").replaceAll("(^|\n)", "$1> ").replaceAll("\n$", "");
Editable editable = mEditMessage.getEditableText();
int position = mEditMessage.getSelectionEnd();
Editable editable = binding.textinput.getEditableText();
int position = binding.textinput.getSelectionEnd();
if (position == -1) position = editable.length();
if (position > 0 && editable.charAt(position - 1) != '\n') {
editable.insert(position++, "\n");
@ -899,12 +874,11 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
if (position < editable.length() && editable.charAt(position) != '\n') {
editable.insert(position, "\n");
}
mEditMessage.setSelection(position);
mEditMessage.requestFocus();
InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
.getSystemService(Context.INPUT_METHOD_SERVICE);
binding.textinput.setSelection(position);
binding.textinput.requestFocus();
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputMethodManager != null) {
inputMethodManager.showSoftInput(mEditMessage, InputMethodManager.SHOW_IMPLICIT);
inputMethodManager.showSoftInput(binding.textinput, InputMethodManager.SHOW_IMPLICIT);
}
}
}
@ -1507,7 +1481,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
if (conversation.setOutgoingChatState(Config.DEFAULT_CHATSTATE)) {
activity.xmppConnectionService.sendChatState(conversation);
}
this.mEditMessage.setText("");
this.binding.textinput.setText("");
this.conversation.setNextCounterpart(counterpart);
updateChatMsgHint();
updateSendButton();
@ -1519,17 +1493,17 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
message = message.next();
}
this.conversation.setCorrectingMessage(message);
final Editable editable = mEditMessage.getText();
final Editable editable = binding.textinput.getText();
this.conversation.setDraftMessage(editable.toString());
this.mEditMessage.setText("");
this.mEditMessage.append(message.getBody());
this.binding.textinput.setText("");
this.binding.textinput.append(message.getBody());
}
protected void highlightInConference(String nick) {
final Editable editable = mEditMessage.getText();
final Editable editable = this.binding.textinput.getText();
String oldString = editable.toString().trim();
final int pos = mEditMessage.getSelectionStart();
final int pos = this.binding.textinput.getSelectionStart();
if (oldString.isEmpty() || pos == 0) {
editable.insert(0, nick + ": ");
} else {
@ -1546,7 +1520,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
editable.insert(pos, (Character.isWhitespace(before) ? "" : " ") + nick + (Character.isWhitespace(after) ? "" : " "));
if (Character.isWhitespace(after)) {
mEditMessage.setSelection(mEditMessage.getSelectionStart() + 1);
this.binding.textinput.setSelection(this.binding.textinput.getSelectionStart() + 1);
}
}
}
@ -1560,7 +1534,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
messageListAdapter.stopAudioPlayer();
}
if (this.conversation != null) {
final String msg = mEditMessage.getText().toString();
final String msg = this.binding.textinput.getText().toString();
if (this.conversation.setNextMessage(msg)) {
this.activity.xmppConnectionService.updateConversation(this.conversation);
}
@ -1582,7 +1556,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
setupIme();
if (this.conversation != null) {
final String msg = mEditMessage.getText().toString();
final String msg = this.binding.textinput.getText().toString();
if (this.conversation.setNextMessage(msg)) {
activity.xmppConnectionService.updateConversation(conversation);
}
@ -1595,16 +1569,16 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
if (activity != null) {
this.mSendButton.setContentDescription(activity.getString(R.string.send_message_to_x, conversation.getName()));
this.binding.textSendButton.setContentDescription(activity.getString(R.string.send_message_to_x, conversation.getName()));
}
this.conversation = conversation;
this.mEditMessage.setKeyboardListener(null);
this.mEditMessage.setText("");
this.mEditMessage.append(this.conversation.getNextMessage());
this.mEditMessage.setKeyboardListener(this);
this.binding.textinput.setKeyboardListener(null);
this.binding.textinput.setText("");
this.binding.textinput.append(this.conversation.getNextMessage());
this.binding.textinput.setKeyboardListener(this);
messageListAdapter.updatePreferences();
this.messagesView.setAdapter(messageListAdapter);
this.binding.messagesView.setAdapter(messageListAdapter);
updateMessages();
this.conversation.messagesLoaded.set(true);
synchronized (this.messageList) {
@ -1617,7 +1591,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
int i = getIndexOf(first.getUuid(), this.messageList);
pos = i < 0 ? bottom : i;
}
messagesView.setSelection(pos);
this.binding.messagesView.setSelection(pos);
return pos == bottom;
}
}
@ -1736,26 +1710,23 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
protected void messageSent() {
mSendingPgpMessage.set(false);
mEditMessage.setText("");
this.binding.textinput.setText("");
if (conversation.setCorrectingMessage(null)) {
mEditMessage.append(conversation.getDraftMessage());
this.binding.textinput.append(conversation.getDraftMessage());
conversation.setDraftMessage(null);
}
if (conversation.setNextMessage(mEditMessage.getText().toString())) {
if (conversation.setNextMessage(this.binding.textinput.getText().toString())) {
activity.xmppConnectionService.updateConversation(conversation);
}
updateChatMsgHint();
new Handler().post(new Runnable() {
@Override
public void run() {
new Handler().post(() -> {
int size = messageList.size();
messagesView.setSelection(size - 1);
}
this.binding.messagesView.setSelection(size - 1);
});
}
public void setFocusOnInputField() {
mEditMessage.requestFocus();
this.binding.textinput.requestFocus();
}
public void doneSendingPgpMessage() {
@ -1765,16 +1736,16 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
private void updateEditablity() {
boolean canWrite = this.conversation.getMode() == Conversation.MODE_SINGLE || this.conversation.getMucOptions().participating() || this.conversation.getNextCounterpart() != null;
this.mEditMessage.setFocusable(canWrite);
this.mEditMessage.setFocusableInTouchMode(canWrite);
this.mSendButton.setEnabled(canWrite);
this.mEditMessage.setCursorVisible(canWrite);
this.binding.textinput.setFocusable(canWrite);
this.binding.textinput.setFocusableInTouchMode(canWrite);
this.binding.textSendButton.setEnabled(canWrite);
this.binding.textinput.setCursorVisible(canWrite);
}
public void updateSendButton() {
final Conversation c = this.conversation;
final Presence.Status status;
final String text = this.mEditMessage == null ? "" : this.mEditMessage.getText().toString();
final String text = this.binding.textinput == null ? "" : this.binding.textinput.getText().toString();
final SendButtonAction action = SendButtonTool.getAction(getActivity(),c,text);
if (activity.useSendButtonToIndicateStatus() && c.getAccount().getStatus() == Account.State.ONLINE) {
if (activity.xmppConnectionService != null && activity.xmppConnectionService.getMessageArchiveService().isCatchingUp(c)) {
@ -1787,8 +1758,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
} else {
status = Presence.Status.OFFLINE;
}
this.mSendButton.setTag(action);
this.mSendButton.setImageResource(SendButtonTool.getSendButtonImageResource(getActivity(), action, status));
this.binding.textSendButton.setTag(action);
this.binding.textSendButton.setImageResource(SendButtonTool.getSendButtonImageResource(getActivity(), action, status));
}
protected void updateDateSeparators() {
@ -1902,7 +1873,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
public void stopScrolling() {
long now = SystemClock.uptimeMillis();
MotionEvent cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0, 0, 0);
messagesView.dispatchTouchEvent(cancel);
binding.messagesView.dispatchTouchEvent(cancel);
}
private boolean showLoadMoreMessages(final Conversation c) {
@ -1925,20 +1896,20 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
protected void showSnackbar(final int message, final int action, final OnClickListener clickListener, final View.OnLongClickListener longClickListener) {
snackbar.setVisibility(View.VISIBLE);
snackbar.setOnClickListener(null);
snackbarMessage.setText(message);
snackbarMessage.setOnClickListener(null);
snackbarAction.setVisibility(clickListener == null ? View.GONE : View.VISIBLE);
this.binding.snackbar.setVisibility(View.VISIBLE);
this.binding.snackbar.setOnClickListener(null);
this.binding.snackbarMessage.setText(message);
this.binding.snackbarMessage.setOnClickListener(null);
this.binding.snackbarAction.setVisibility(clickListener == null ? View.GONE : View.VISIBLE);
if (action != 0) {
snackbarAction.setText(action);
this.binding.snackbarAction.setText(action);
}
snackbarAction.setOnClickListener(clickListener);
snackbarAction.setOnLongClickListener(longClickListener);
this.binding.snackbarAction.setOnClickListener(clickListener);
this.binding.snackbarAction.setOnLongClickListener(longClickListener);
}
protected void hideSnackbar() {
snackbar.setVisibility(View.GONE);
this.binding.snackbar.setVisibility(View.GONE);
}
protected void sendPlainTextMessage(Message message) {
@ -2072,11 +2043,11 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
if (text == null) {
return;
}
String previous = this.mEditMessage.getText().toString();
String previous = this.binding.textinput.getText().toString();
if (previous.length() != 0 && !previous.endsWith(" ")) {
text = " " + text;
}
this.mEditMessage.append(text);
this.binding.textinput.append(text);
}
@Override
@ -2133,8 +2104,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
} else {
lastCompletionLength = 0;
completionIndex = 0;
final String content = mEditMessage.getText().toString();
lastCompletionCursor = mEditMessage.getSelectionEnd();
final String content = this.binding.textinput.getText().toString();
lastCompletionCursor = this.binding.textinput.getSelectionEnd();
int start = lastCompletionCursor > 0 ? content.lastIndexOf(" ", lastCompletionCursor - 1) + 1 : 0;
firstWord = start == 0;
incomplete = content.substring(start, lastCompletionCursor);
@ -2149,12 +2120,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
Collections.sort(completions);
if (completions.size() > completionIndex) {
String completion = completions.get(completionIndex).substring(incomplete.length());
mEditMessage.getEditableText().delete(lastCompletionCursor, lastCompletionCursor + lastCompletionLength);
mEditMessage.getEditableText().insert(lastCompletionCursor, completion);
this.binding.textinput.getEditableText().delete(lastCompletionCursor, lastCompletionCursor + lastCompletionLength);
this.binding.textinput.getEditableText().insert(lastCompletionCursor, completion);
lastCompletionLength = completion.length();
} else {
completionIndex = -1;
mEditMessage.getEditableText().delete(lastCompletionCursor, lastCompletionCursor + lastCompletionLength);
this.binding.textinput.getEditableText().delete(lastCompletionCursor, lastCompletionCursor + lastCompletionLength);
lastCompletionLength = 0;
}
return true;

View file

@ -482,8 +482,7 @@ public abstract class XmppActivity extends AppCompatActivity {
}
protected SharedPreferences getPreferences() {
return PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
return PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
}
public boolean useSubjectToIdentifyConference() {

View file

@ -1,5 +1,7 @@
package eu.siacs.conversations.ui.widget;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.text.emoji.widget.EmojiAppCompatEditText;
import android.support.v13.view.inputmethod.EditorInfoCompat;
import android.support.v13.view.inputmethod.InputConnectionCompat;
@ -11,6 +13,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
import android.text.Spanned;
import android.util.AttributeSet;
import android.view.KeyEvent;
@ -18,6 +21,7 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
public class EditMessage extends EmojiAppCompatEditText {
@ -142,6 +146,23 @@ public class EditMessage extends EmojiAppCompatEditText {
}
}
public void refreshIme() {
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(getContext());
final boolean usingEnterKey = p.getBoolean("display_enter_key", getResources().getBoolean(R.bool.display_enter_key));
final boolean enterIsSend = p.getBoolean("enter_is_send", getResources().getBoolean(R.bool.enter_is_send));
if (usingEnterKey && enterIsSend) {
setInputType(getInputType() & (~InputType.TYPE_TEXT_FLAG_MULTI_LINE));
setInputType(getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
} else if (usingEnterKey) {
setInputType(getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
setInputType(getInputType() & (~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE));
} else {
setInputType(getInputType() | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
setInputType(getInputType() | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE);
}
}
public interface OnCommitContentListener {
boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts, String[] mimeTypes);
}

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -39,9 +41,9 @@
android:ems="10"
android:imeOptions="flagNoExtractUi|actionSend"
android:inputType="textShortMessage|textMultiLine|textCapSentences"
android:maxLines="8"
android:minHeight="48dp"
android:minLines="1"
android:maxLines="8"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
@ -58,8 +60,8 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="?attr/color_background_primary"
android:src="?attr/ic_send_text_offline"
android:contentDescription="@string/send_message"/>
android:contentDescription="@string/send_message"
android:src="?attr/ic_send_text_offline"/>
</RelativeLayout>
<RelativeLayout
@ -102,3 +104,4 @@
</RelativeLayout>
</RelativeLayout>
</layout>