|
|
@ -104,6 +104,7 @@ public class SpannableHelper {
|
|
|
|
|
|
|
|
|
|
|
|
public static final String CLICKABLE_SPAN = "CLICKABLE_SPAN";
|
|
|
|
public static final String CLICKABLE_SPAN = "CLICKABLE_SPAN";
|
|
|
|
private static int linkColor;
|
|
|
|
private static int linkColor;
|
|
|
|
|
|
|
|
private static boolean underlineLinks;
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
@ -115,6 +116,7 @@ public class SpannableHelper {
|
|
|
|
int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
|
|
|
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 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);
|
|
|
|
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;
|
|
|
|
int link_color;
|
|
|
|
if (currentNightMode == Configuration.UI_MODE_NIGHT_NO && customLight) {
|
|
|
|
if (currentNightMode == Configuration.UI_MODE_NIGHT_NO && customLight) {
|
|
|
|
link_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_LINK), -1);
|
|
|
|
link_color = sharedpreferences.getInt(context.getString(R.string.SET_LIGHT_LINK), -1);
|
|
|
@ -309,7 +311,9 @@ public class SpannableHelper {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
|
|
|
|
if(!underlineLinks) {
|
|
|
|
ds.setUnderlineText(status != null && status.underlined);
|
|
|
|
ds.setUnderlineText(status != null && status.underlined);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (linkColor != -1) {
|
|
|
|
if (linkColor != -1) {
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -599,7 +603,9 @@ public class SpannableHelper {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
|
|
|
|
if(!underlineLinks) {
|
|
|
|
ds.setUnderlineText(status != null && status.underlined);
|
|
|
|
ds.setUnderlineText(status != null && status.underlined);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (linkColor != -1) {
|
|
|
|
if (linkColor != -1) {
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -744,7 +750,9 @@ public class SpannableHelper {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
|
|
|
|
if(!underlineLinks) {
|
|
|
|
ds.setUnderlineText(status != null && status.underlined);
|
|
|
|
ds.setUnderlineText(status != null && status.underlined);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (linkColor != -1) {
|
|
|
|
if (linkColor != -1) {
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -891,7 +899,9 @@ public class SpannableHelper {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
public void updateDrawState(@NonNull TextPaint ds) {
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
super.updateDrawState(ds);
|
|
|
|
|
|
|
|
if(!underlineLinks) {
|
|
|
|
ds.setUnderlineText(false);
|
|
|
|
ds.setUnderlineText(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (linkColor != -1) {
|
|
|
|
if (linkColor != -1) {
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
ds.setColor(linkColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|