diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java b/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java index 6f65eaa6..c9918a70 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java @@ -104,6 +104,7 @@ public class SpannableHelper { public static final String CLICKABLE_SPAN = "CLICKABLE_SPAN"; private static int linkColor; + private static boolean underlineLinks; public static Spannable convert(Context context, String text, Status status, Account account, Announcement announcement, @@ -115,6 +116,7 @@ public class SpannableHelper { int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; boolean customLight = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_LIGHT_COLORS), false); boolean customDark = sharedpreferences.getBoolean(context.getString(R.string.SET_CUSTOMIZE_DARK_COLORS), false); + underlineLinks = sharedpreferences.getBoolean(context.getString(R.string.SET_UNDERLINE_CLICKABLE), false); int link_color; if (currentNightMode == Configuration.UI_MODE_NIGHT_NO && customLight) { link_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_LINK), -1); @@ -309,7 +311,9 @@ public class SpannableHelper { @Override public void updateDrawState(@NonNull TextPaint ds) { super.updateDrawState(ds); - ds.setUnderlineText(status != null && status.underlined); + if(!underlineLinks) { + ds.setUnderlineText(status != null && status.underlined); + } if (linkColor != -1) { ds.setColor(linkColor); } @@ -599,7 +603,9 @@ public class SpannableHelper { @Override public void updateDrawState(@NonNull TextPaint ds) { super.updateDrawState(ds); - ds.setUnderlineText(status != null && status.underlined); + if(!underlineLinks) { + ds.setUnderlineText(status != null && status.underlined); + } if (linkColor != -1) { ds.setColor(linkColor); } @@ -744,7 +750,9 @@ public class SpannableHelper { @Override public void updateDrawState(@NonNull TextPaint ds) { super.updateDrawState(ds); - ds.setUnderlineText(status != null && status.underlined); + if(!underlineLinks) { + ds.setUnderlineText(status != null && status.underlined); + } if (linkColor != -1) { ds.setColor(linkColor); } @@ -891,7 +899,9 @@ public class SpannableHelper { @Override public void updateDrawState(@NonNull TextPaint ds) { super.updateDrawState(ds); - ds.setUnderlineText(false); + if(!underlineLinks) { + ds.setUnderlineText(false); + } if (linkColor != -1) { ds.setColor(linkColor); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index abf0f150..97644ed2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1189,6 +1189,7 @@ SET_BOOST_ORIGINAL_DATE SET_MARKDOWN_SUPPORT SET_TRUNCATE_LINKS + SET_UNDERLINE_CLICKABLE SET_TRUNCATE_LINKS_MAX SET_HIDE_SINGLE_MEDIA_WITH_CARD @@ -1991,6 +1992,7 @@ There are missing media descriptions Truncate links + Underlines clickable elements Max chars in links diff --git a/app/src/main/res/xml/pref_timelines.xml b/app/src/main/res/xml/pref_timelines.xml index 4143933b..c59d8b78 100644 --- a/app/src/main/res/xml/pref_timelines.xml +++ b/app/src/main/res/xml/pref_timelines.xml @@ -64,6 +64,13 @@ app:singleLineTitle="false" app:title="@string/truncate_links" /> + +