Add MMS info to conversation settings.

This commit is contained in:
Cody Henthorne
2020-09-21 11:20:10 -04:00
committed by Greyson Parrelli
parent 97b7b4a501
commit e3338dc3ff
5 changed files with 77 additions and 32 deletions

View File

@@ -14,6 +14,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.AppCompatTextView;
import org.thoughtcrime.securesms.R;
@@ -38,26 +39,7 @@ public class LearnMoreTextView extends AppCompatTextView {
private void init() {
setMovementMethod(LinkMovementMethod.getInstance());
ClickableSpan clickable = new ClickableSpan() {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(ThemeUtil.getThemedColor(getContext(), R.attr.colorAccent));
}
@Override
public void onClick(@NonNull View widget) {
if (linkListener != null) {
linkListener.onClick(widget);
}
}
};
link = new SpannableString(getContext().getString(R.string.LearnMoreTextView_learn_more));
link.setSpan(clickable, 0, link.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
setLinkTextInternal(R.string.LearnMoreTextView_learn_more);
visible = true;
}
@@ -81,6 +63,33 @@ public class LearnMoreTextView extends AppCompatTextView {
setTextInternal(baseText, visible ? BufferType.SPANNABLE : BufferType.NORMAL);
}
public void setLearnMoreVisible(boolean visible, @StringRes int linkText) {
setLinkTextInternal(linkText);
this.visible = visible;
setTextInternal(baseText, visible ? BufferType.SPANNABLE : BufferType.NORMAL);
}
private void setLinkTextInternal(@StringRes int linkText) {
ClickableSpan clickable = new ClickableSpan() {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setColor(ThemeUtil.getThemedColor(getContext(), R.attr.colorAccent));
}
@Override
public void onClick(@NonNull View widget) {
if (linkListener != null) {
linkListener.onClick(widget);
}
}
};
link = new SpannableString(getContext().getString(linkText));
link.setSpan(clickable, 0, link.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
private void setTextInternal(CharSequence text, BufferType type) {
if (visible) {
SpannableStringBuilder builder = new SpannableStringBuilder();