Release 3.9.7

maths
Thomas 2 years ago
parent 98f8b269b0
commit 63e09ee9a4

@ -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", "version": "3.9.6",
"code": "441", "code": "441",

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

@ -85,7 +85,7 @@ public class Account implements Serializable {
if (display_name == null || display_name.isEmpty()) { if (display_name == null || display_name.isEmpty()) {
display_name = username; 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) { 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) { 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) { 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 { public static class AccountParams implements Serializable {

@ -56,7 +56,7 @@ public class Announcement {
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference) { 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);
} }
} }

@ -47,7 +47,7 @@ public class Field implements Serializable {
if (verified_at != null && value != null) { if (verified_at != null && value != null) {
value_span = new ForegroundColorSpan(ContextCompat.getColor(context, R.color.verified_text)); 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) { if (value_span != null && spannable != null) {
spannable.setSpan(value_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 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) { 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) { if (name_span != null && spannable != null) {
spannable.setSpan(name_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); spannable.setSpan(name_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
} }

@ -61,7 +61,7 @@ public class Poll implements Serializable {
public transient Spannable span_title; public transient Spannable span_title;
public Spannable getSpanTitle(Context context, Status status, WeakReference<View> viewWeakReference) { 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; return span_title;
} }
} }

@ -130,21 +130,21 @@ public class Status implements Serializable, Cloneable {
public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference, Callback callback) { public synchronized Spannable getSpanContent(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentSpan == null) { 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; return contentSpan;
} }
public synchronized Spannable getSpanSpoiler(Context context, WeakReference<View> viewWeakReference, Callback callback) { public synchronized Spannable getSpanSpoiler(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentSpoilerSpan == null) { 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; return contentSpoilerSpan;
} }
public synchronized Spannable getSpanTranslate(Context context, WeakReference<View> viewWeakReference, Callback callback) { public synchronized Spannable getSpanTranslate(Context context, WeakReference<View> viewWeakReference, Callback callback) {
if (contentTranslateSpan == null) { 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; return contentTranslateSpan;
} }

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

@ -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
Loading…
Cancel
Save