Release 3.36.1

This commit is contained in:
Thomas 2020-07-09 11:43:55 +02:00
parent 93e2237fb9
commit 6cbbd7032a
3 changed files with 44 additions and 40 deletions

View File

@ -6,8 +6,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 29
versionCode 374 versionCode 375
versionName "2.36.0" versionName "2.36.1"
multiDexEnabled true multiDexEnabled true
renderscriptTargetApi 28 as int renderscriptTargetApi 28 as int
renderscriptSupportModeEnabled true renderscriptSupportModeEnabled true

View File

@ -8,6 +8,7 @@ changed:
- Allow cross-account replies on followed instances - Allow cross-account replies on followed instances
Fixed: Fixed:
- Crash when having custom emoji in display name
- Crash when adding media - Crash when adding media
- Remove extra spaces at the bottom of messages - Remove extra spaces at the bottom of messages
- Some issue with custom emoji - Some issue with custom emoji

View File

@ -1972,8 +1972,9 @@ public class Helper {
activity.finish(); //User is logged out to get a new token activity.finish(); //User is logged out to get a new token
} else { } else {
makeEmojis(activity, username, account.getDisplayNameSpan(), account.getEmojis());
username.setText(String.format("@%s", account.getUsername() + "@" + account.getInstance())); username.setText(String.format("@%s", account.getUsername() + "@" + account.getInstance()));
makeEmojis(activity, displayedName, account.getDisplayNameSpan(), account.getEmojis());
displayedName.setText(account.getDisplayNameSpan(), TextView.BufferType.SPANNABLE); displayedName.setText(account.getDisplayNameSpan(), TextView.BufferType.SPANNABLE);
loadGiF(activity, account, profilePicture); loadGiF(activity, account, profilePicture);
String urlHeader = !disableGif ? account.getHeader() : account.getHeader_static(); String urlHeader = !disableGif ? account.getHeader() : account.getHeader_static();
@ -4411,51 +4412,53 @@ public class Helper {
if (emojis != null && emojis.size() > 0) { if (emojis != null && emojis.size() > 0) {
for (final Emojis emoji : emojis) { for (final Emojis emoji : emojis) {
Glide.with(context) if (isValidContextForGlide(context)) {
.asDrawable() Glide.with(context)
.load(disableAnimatedEmoji ? emoji.getStatic_url() : emoji.getUrl()) .asDrawable()
.into(new CustomTarget<Drawable>() { .load(disableAnimatedEmoji ? emoji.getStatic_url() : emoji.getUrl())
@Override .into(new CustomTarget<Drawable>() {
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { @Override
final String targetedEmoji = ":" + emoji.getShortcode() + ":"; public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
if (contentSpan != null && contentSpan.toString().contains(targetedEmoji)) { final String targetedEmoji = ":" + emoji.getShortcode() + ":";
//emojis can be used several times so we have to loop if (contentSpan != null && contentSpan.toString().contains(targetedEmoji)) {
for (int startPosition = -1; (startPosition = contentSpan.toString().indexOf(targetedEmoji, startPosition + 1)) != -1; startPosition++) { //emojis can be used several times so we have to loop
final int endPosition = startPosition + targetedEmoji.length(); for (int startPosition = -1; (startPosition = contentSpan.toString().indexOf(targetedEmoji, startPosition + 1)) != -1; startPosition++) {
if (endPosition <= contentSpan.toString().length() && endPosition >= startPosition) { final int endPosition = startPosition + targetedEmoji.length();
ImageSpan imageSpan; if (endPosition <= contentSpan.toString().length() && endPosition >= startPosition) {
try { ImageSpan imageSpan;
resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context)); try {
resource.setVisible(true, true); resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context));
imageSpan = new ImageSpan(resource); resource.setVisible(true, true);
contentSpan.setSpan( imageSpan = new ImageSpan(resource);
imageSpan, startPosition, contentSpan.setSpan(
endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); imageSpan, startPosition,
if (customTextView instanceof CustomTextView) { endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
((CustomTextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE); if (customTextView instanceof CustomTextView) {
} else if (customTextView instanceof RadioButton) { ((CustomTextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
((RadioButton) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE); } else if (customTextView instanceof RadioButton) {
} else if (customTextView instanceof CheckBox) { ((RadioButton) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
((CheckBox) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE); } else if (customTextView instanceof CheckBox) {
} else if (customTextView instanceof AppCompatTextView) { ((CheckBox) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
((AppCompatTextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE); } else if (customTextView instanceof AppCompatTextView) {
} else if (customTextView instanceof TextView) { ((AppCompatTextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
((TextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE); } else if (customTextView instanceof TextView) {
} ((TextView) customTextView).setText(contentSpan, TextView.BufferType.SPANNABLE);
}
} catch (Exception ignored) { } catch (Exception ignored) {
}
} }
} }
} }
} }
}
@Override @Override
public void onLoadCleared(@Nullable Drawable placeholder) { public void onLoadCleared(@Nullable Drawable placeholder) {
} }
}); });
}
} }
} }
} }