Remove extra spaces at the bottom of some messages
This commit is contained in:
parent
bf9b3a6fac
commit
987d2cd4a2
|
@ -1,4 +1,7 @@
|
||||||
changed:
|
changed:
|
||||||
- Increase media description length to 1500 chars
|
- Increase media description length to 1500 chars
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
- Some issue with custom emoji
|
- Remove extra spaces at the bottom of messages
|
||||||
|
- Some issue with custom emoji
|
||||||
|
- Some crashes
|
|
@ -496,11 +496,11 @@ public class Status implements Parcelable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SpannableString spannableStringT;
|
SpannableStringBuilder spannableStringT;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString().replaceAll("[\\s]{2}", " "), Html.FROM_HTML_MODE_LEGACY));
|
spannableStringT = new SpannableStringBuilder(Html.fromHtml(spannableString.toString().replaceAll("[\\s]{2}", " "), Html.FROM_HTML_MODE_LEGACY));
|
||||||
else
|
else
|
||||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString().replaceAll("[\\s]{2}", " ")));
|
spannableStringT = new SpannableStringBuilder(Html.fromHtml(spannableString.toString().replaceAll("[\\s]{2}", " ")));
|
||||||
replaceQuoteSpans(context, spannableStringT);
|
replaceQuoteSpans(context, spannableStringT);
|
||||||
URLSpan[] spans = spannableStringT.getSpans(0, spannableStringT.length(), URLSpan.class);
|
URLSpan[] spans = spannableStringT.getSpans(0, spannableStringT.length(), URLSpan.class);
|
||||||
for (URLSpan span : spans) {
|
for (URLSpan span : spans) {
|
||||||
|
@ -565,7 +565,7 @@ public class Status implements Parcelable {
|
||||||
if (ssb.length() >= endPosition) {
|
if (ssb.length() >= endPosition) {
|
||||||
ssb.replace(startPosition, endPosition, key);
|
ssb.replace(startPosition, endPosition, key);
|
||||||
}
|
}
|
||||||
spannableStringT = SpannableString.valueOf(ssb);
|
spannableStringT = SpannableStringBuilder.valueOf(ssb);
|
||||||
endPosition = startPosition + key.length();
|
endPosition = startPosition + key.length();
|
||||||
}
|
}
|
||||||
//Accounts can be mentioned several times so we have to loop
|
//Accounts can be mentioned several times so we have to loop
|
||||||
|
@ -616,7 +616,7 @@ public class Status implements Parcelable {
|
||||||
if (ssb.length() >= endPosition) {
|
if (ssb.length() >= endPosition) {
|
||||||
ssb.replace(startPosition, endPosition, key);
|
ssb.replace(startPosition, endPosition, key);
|
||||||
}
|
}
|
||||||
spannableStringT = SpannableString.valueOf(ssb);
|
spannableStringT = SpannableStringBuilder.valueOf(ssb);
|
||||||
endPosition = startPosition + key.length();
|
endPosition = startPosition + key.length();
|
||||||
}
|
}
|
||||||
if (endPosition <= spannableStringT.toString().length() && endPosition >= startPosition) {
|
if (endPosition <= spannableStringT.toString().length() && endPosition >= startPosition) {
|
||||||
|
@ -835,7 +835,17 @@ public class Status implements Parcelable {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return spannableStringT;
|
|
||||||
|
Pattern carriagePattern = Pattern.compile("(\\n)+$");
|
||||||
|
matcher = carriagePattern.matcher(spannableStringT);
|
||||||
|
while (matcher.find()) {
|
||||||
|
int matchStart = matcher.start();
|
||||||
|
int matchEnd = matcher.end();
|
||||||
|
if (matchStart >= 0 && matchEnd <= spannableStringT.toString().length() && matchEnd >= matchStart) {
|
||||||
|
spannableStringT.delete(matchStart, matchEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SpannableString.valueOf(spannableStringT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void transformTranslation(Context context, Status status) {
|
public static void transformTranslation(Context context, Status status) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class CustomEmojiAdapter extends BaseAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||||
emoji.setDrawable(resource);
|
emoji.setDrawable(resource);
|
||||||
if( imageView != null && emoji.getDrawable() != null) {
|
if (imageView != null && emoji.getDrawable() != null) {
|
||||||
imageView.setImageDrawable(emoji.getDrawable());
|
imageView.setImageDrawable(emoji.getDrawable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue