Fixed send message button enabled when it shouldn't and disabled when it shoudln't
This commit is contained in:
parent
c2bf86e159
commit
da46f33844
1 changed files with 6 additions and 1 deletions
|
@ -215,6 +215,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
});
|
});
|
||||||
|
|
||||||
mSendMessageButton = view.findViewById(R.id.send_message);
|
mSendMessageButton = view.findViewById(R.id.send_message);
|
||||||
|
mSendMessageButton.setEnabled(false);
|
||||||
mSendMessageButton.setOnClickListener(new View.OnClickListener() {
|
mSendMessageButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -229,7 +230,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
mSendMessageButton.setEnabled(mMessageTextToSend.getText().length() > 0);
|
mSendMessageButton.setEnabled(mMessageTextToSend.getText().length() > 0 || mFilesUploadLayout.getChildCount() > 0);
|
||||||
if (mChatRoom != null) {
|
if (mChatRoom != null) {
|
||||||
mChatRoom.compose();
|
mChatRoom.compose();
|
||||||
}
|
}
|
||||||
|
@ -505,12 +506,14 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
View pendingImage = (View)view.getTag();
|
View pendingImage = (View)view.getTag();
|
||||||
mFilesUploadLayout.removeView(pendingImage);
|
mFilesUploadLayout.removeView(pendingImage);
|
||||||
mAttachImageButton.setEnabled(true);
|
mAttachImageButton.setEnabled(true);
|
||||||
|
mSendMessageButton.setEnabled(mMessageTextToSend.getText().length() > 0 || mFilesUploadLayout.getChildCount() > 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mFilesUploadLayout.addView(pendingFile);
|
mFilesUploadLayout.addView(pendingFile);
|
||||||
|
|
||||||
mAttachImageButton.setEnabled(false); // For now limit file per message to 1
|
mAttachImageButton.setEnabled(false); // For now limit file per message to 1
|
||||||
|
mSendMessageButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addImageToPendingList(String path) {
|
private void addImageToPendingList(String path) {
|
||||||
|
@ -530,12 +533,14 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
View pendingImage = (View)view.getTag();
|
View pendingImage = (View)view.getTag();
|
||||||
mFilesUploadLayout.removeView(pendingImage);
|
mFilesUploadLayout.removeView(pendingImage);
|
||||||
mAttachImageButton.setEnabled(true);
|
mAttachImageButton.setEnabled(true);
|
||||||
|
mSendMessageButton.setEnabled(mMessageTextToSend.getText().length() > 0 || mFilesUploadLayout.getChildCount() > 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mFilesUploadLayout.addView(pendingImage);
|
mFilesUploadLayout.addView(pendingImage);
|
||||||
|
|
||||||
mAttachImageButton.setEnabled(false); // For now limit file per message to 1
|
mAttachImageButton.setEnabled(false); // For now limit file per message to 1
|
||||||
|
mSendMessageButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage() {
|
private void sendMessage() {
|
||||||
|
|
Loading…
Reference in a new issue