mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Fix #310
This commit is contained in:
parent
0ad443bb31
commit
e300f73483
@ -31,7 +31,10 @@ import android.graphics.drawable.ColorDrawable;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.InputFilter;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -403,6 +406,31 @@ public class ChatController extends BaseController implements MessagesListAdapte
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
InputFilter[] filters = new InputFilter[1];
|
||||||
|
filters[0] = new InputFilter.LengthFilter(1000);
|
||||||
|
messageInputView.getInputEditText() .setFilters(filters);
|
||||||
|
|
||||||
|
messageInputView.getInputEditText().addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
if (s.length() == 1000) {
|
||||||
|
messageInputView.getInputEditText().setError(getResources().getString(R.string.nc_limit_hit));
|
||||||
|
} else {
|
||||||
|
messageInputView.getInputEditText().setError(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
messageInputView.setInputListener(input -> {
|
messageInputView.setInputListener(input -> {
|
||||||
sendMessage(input, 1);
|
sendMessage(input, 1);
|
||||||
return true;
|
return true;
|
||||||
|
@ -228,4 +228,7 @@ Find Nextcloud on https://nextcloud.com</string>
|
|||||||
<string name="nc_conversations_empty">You haven\'t talked to anyone yet!\n Tap to start a conversation.</string>
|
<string name="nc_conversations_empty">You haven\'t talked to anyone yet!\n Tap to start a conversation.</string>
|
||||||
<string name="nc_hello">Hello</string>
|
<string name="nc_hello">Hello</string>
|
||||||
|
|
||||||
|
<!-- Other -->
|
||||||
|
<string name="nc_limit_hit">1000 characters limit has been hit</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user