Release 3.9.7

This commit is contained in:
Thomas 2022-12-07 18:37:18 +01:00
parent 98f8b269b0
commit 63e09ee9a4
9 changed files with 41 additions and 17 deletions

View File

@ -1,4 +1,9 @@
[
{
"version": "3.9.7",
"code": "442",
"note": "Added:\n- Dracula theme\n\nChanged:\n- Colors for Light/Dark/Black themes\n\nFixed:\n- Animated profile pictures not displayed\n- Mentions broken in profile bio and fields\n- Tag patterns in URL break the link\n- Typo in followed tags"
},
{
"version": "3.9.6",
"code": "441",

View File

@ -25,6 +25,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.SpannableString;
@ -262,6 +263,7 @@ public class ProfileActivity extends BaseActivity {
});
boolean disableGif = sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_GIF), false);
String targetedUrl = disableGif ? account.avatar_static : account.avatar;
// MastodonHelper.loadPPMastodon(binding.accountPp, account);
Glide.with(ProfileActivity.this)
.asDrawable()
.dontTransform()
@ -271,6 +273,11 @@ public class ProfileActivity extends BaseActivity {
public void onResourceReady(@NonNull final Drawable resource, Transition<? super Drawable> transition) {
binding.profilePicture.setImageDrawable(resource);
binding.accountPp.setImageDrawable(resource);
if (resource instanceof Animatable) {
binding.profilePicture.animate();
binding.accountPp.animate();
((Animatable) resource).start();
}
ActivityCompat.startPostponedEnterTransition(ProfileActivity.this);
}
@ -390,7 +397,7 @@ public class ProfileActivity extends BaseActivity {
TextView.BufferType.SPANNABLE);
binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance());
//MastodonHelper.loadPPMastodon(binding.accountPp, account);
binding.accountPp.setOnClickListener(v -> {
Intent intent = new Intent(ProfileActivity.this, MediaActivity.class);
Bundle b = new Bundle();

View File

@ -85,7 +85,7 @@ public class Account implements Serializable {
if (display_name == null || display_name.isEmpty()) {
display_name = username;
}
return SpannableHelper.convert(context, display_name, null, this, null, false, viewWeakReference);
return SpannableHelper.convert(context, display_name, null, this, null, false, false, viewWeakReference);
}
public synchronized Spannable getSpanDisplayName(Activity activity, WeakReference<View> viewWeakReference) {
@ -96,11 +96,11 @@ public class Account implements Serializable {
}
public synchronized Spannable getSpanDisplayNameTitle(Context context, WeakReference<View> viewWeakReference, String title) {
return SpannableHelper.convert(context, title, null, this, null, false, viewWeakReference);
return SpannableHelper.convert(context, title, null, this, null, false, false, viewWeakReference);
}
public synchronized Spannable getSpanNote(Context context, WeakReference<View> viewWeakReference) {
return SpannableHelper.convert(context, note, null, this, null, true, viewWeakReference);
return SpannableHelper.convert(context, note, null, this, null, true, true, viewWeakReference);
}
public static class AccountParams implements Serializable {

View File

@ -56,7 +56,7 @@ public class Announcement {
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference) {
return SpannableHelper.convert(context, content, null, null, this, true, viewWeakReference);
return SpannableHelper.convert(context, content, null, null, this, true, false, viewWeakReference);
}
}

View File

@ -47,7 +47,7 @@ public class Field implements Serializable {
if (verified_at != null && value != null) {
value_span = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.verified_text));
}
Spannable spannable = SpannableHelper.convert(context, value, null, account, null, true, viewWeakReference);
Spannable spannable = SpannableHelper.convert(context, value, null, account, null, true, true, viewWeakReference);
if (value_span != null && spannable != null) {
spannable.setSpan(value_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
@ -57,7 +57,7 @@ public class Field implements Serializable {
public synchronized Spannable getLabelSpan(Context context, Account account, WeakReference<View> viewWeakReference) {
Spannable spannable = SpannableHelper.convert(context, name, null, account, null, true, viewWeakReference);
Spannable spannable = SpannableHelper.convert(context, name, null, account, null, true, true, viewWeakReference);
if (name_span != null && spannable != null) {
spannable.setSpan(name_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}

View File

@ -61,7 +61,7 @@ public class Poll implements Serializable {
public transient Spannable span_title;
public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference) {
span_title = SpannableHelper.convert(context, title, status, null, null, false, viewWeakReference);
span_title = SpannableHelper.convert(context, title, status, null, null, false, false, viewWeakReference);
return span_title;
}
}

View File

@ -130,21 +130,21 @@ public class Status implements Serializable, Cloneable {
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentSpan == null) {
contentSpan = SpannableHelper.convert(context, content, this, null, null, true, viewWeakReference, callback);
contentSpan = SpannableHelper.convert(context, content, this, null, null, true, false, viewWeakReference, callback);
}
return contentSpan;
}
public synchronized Spannable getSpanSpoiler(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentSpoilerSpan == null) {
contentSpoilerSpan = SpannableHelper.convert(context, spoiler_text, this, null, null, true, viewWeakReference, callback);
contentSpoilerSpan = SpannableHelper.convert(context, spoiler_text, this, null, null, true, false, viewWeakReference, callback);
}
return contentSpoilerSpan;
}
public synchronized Spannable getSpanTranslate(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentTranslateSpan == null) {
contentTranslateSpan = SpannableHelper.convert(context, translationContent, this, null, null, true, viewWeakReference, callback);
contentTranslateSpan = SpannableHelper.convert(context, translationContent, this, null, null, true, false, viewWeakReference, callback);
}
return contentTranslateSpan;
}

View File

@ -91,13 +91,14 @@ public class SpannableHelper {
public static Spannable convert(Context context, String text,
Status status, Account account, Announcement announcement,
boolean convertHtml, WeakReference<View> viewWeakReference) {
return convert(context, text, status, account, announcement, convertHtml, viewWeakReference, null);
boolean convertHtml, boolean forceMentions, WeakReference<View> viewWeakReference) {
return convert(context, text, status, account, announcement, convertHtml, forceMentions, viewWeakReference, null);
}
public static Spannable convert(Context context, String text,
Status status, Account account, Announcement announcement,
boolean convertHtml,
boolean forceMentions,
WeakReference<View> viewWeakReference, Status.Callback callback) {
@ -155,7 +156,7 @@ public class SpannableHelper {
content.removeSpan(span);
}
//Make tags, mentions, groups
interaction(context, content, status, mentionList);
interaction(context, content, status, mentionList, forceMentions);
//Make all links
linkify(context, content, urlDetails);
linkifyURL(context, content, urlDetails);
@ -745,15 +746,15 @@ public class SpannableHelper {
}
}
private static void interaction(Context context, Spannable content, Status status, List<Mention> mentions) {
private static void interaction(Context context, Spannable content, Status status, List<Mention> mentions, boolean forceMentions) {
// --- For all patterns defined in Helper class ---
for (Map.Entry<Helper.PatternType, Pattern> entry : Helper.patternHashMap.entrySet()) {
Helper.PatternType patternType = entry.getKey();
Pattern pattern = entry.getValue();
Matcher matcher = pattern.matcher(content);
if (pattern == Helper.mentionPattern && mentions == null) {
if (pattern == Helper.mentionPattern && mentions == null && !forceMentions) {
continue;
} else if (pattern == Helper.mentionLongPattern && mentions == null) {
} else if (pattern == Helper.mentionLongPattern && mentions == null && !forceMentions) {
continue;
}

View File

@ -0,0 +1,11 @@
Added:
- Dracula theme
Changed:
- Colors for Light/Dark/Black themes
Fixed:
- Animated profile pictures not displayed
- Mentions broken in profile bio and fields
- Tag patterns in URL break the link
- Typo in followed tags