Fix #249
This commit is contained in:
parent
8b40643e63
commit
b44e3424e3
|
@ -433,9 +433,10 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s){
|
public void afterTextChanged(Editable s){
|
||||||
updateCharCounter(s);
|
updateCharCounter();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
spoilerEdit.addTextChangedListener(new SimpleTextWatcher(e->updateCharCounter()));
|
||||||
if(replyTo!=null){
|
if(replyTo!=null){
|
||||||
replyText.setText(getString(R.string.in_reply_to, replyTo.account.displayName));
|
replyText.setText(getString(R.string.in_reply_to, replyTo.account.displayName));
|
||||||
ArrayList<String> mentions=new ArrayList<>();
|
ArrayList<String> mentions=new ArrayList<>();
|
||||||
|
@ -523,7 +524,9 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
private void updateCharCounter(CharSequence text){
|
private void updateCharCounter(){
|
||||||
|
CharSequence text=mainEditText.getText();
|
||||||
|
|
||||||
String countableText=TwitterTextEmojiRegex.VALID_EMOJI_PATTERN.matcher(
|
String countableText=TwitterTextEmojiRegex.VALID_EMOJI_PATTERN.matcher(
|
||||||
MENTION_PATTERN.matcher(
|
MENTION_PATTERN.matcher(
|
||||||
URL_PATTERN.matcher(text).replaceAll("$2xxxxxxxxxxxxxxxxxxxxxxx")
|
URL_PATTERN.matcher(text).replaceAll("$2xxxxxxxxxxxxxxxxxxxxxxx")
|
||||||
|
@ -535,6 +538,9 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
charCount++;
|
charCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hasSpoiler){
|
||||||
|
charCount+=spoilerEdit.length();
|
||||||
|
}
|
||||||
charCounter.setText(String.valueOf(charLimit-charCount));
|
charCounter.setText(String.valueOf(charLimit-charCount));
|
||||||
trimmedCharCount=text.toString().trim().length();
|
trimmedCharCount=text.toString().trim().length();
|
||||||
updatePublishButtonState();
|
updatePublishButtonState();
|
||||||
|
@ -1019,6 +1025,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
spoilerEdit.setText("");
|
spoilerEdit.setText("");
|
||||||
spoilerBtn.setSelected(false);
|
spoilerBtn.setSelected(false);
|
||||||
mainEditText.requestFocus();
|
mainEditText.requestFocus();
|
||||||
|
updateCharCounter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue