Fix some group description UX oddities.

This commit is contained in:
Cody Henthorne 2021-05-26 10:42:36 -04:00
parent dbabac34b0
commit 2651b789dd
3 changed files with 6 additions and 6 deletions

View file

@ -23,8 +23,6 @@ import org.thoughtcrime.securesms.util.LongClickCopySpan;
public final class GroupDescriptionUtil {
public static final int MAX_DESCRIPTION_LENGTH = 80;
/**
* Set a group description.
*
@ -34,7 +32,9 @@ public final class GroupDescriptionUtil {
* @param moreClick Callback for when truncating and need to show more via another means. Required to enable truncating.
*/
public static void setText(@NonNull Context context, @NonNull EmojiTextView emojiTextView, @NonNull String description, boolean linkify, @Nullable Runnable moreClick) {
SpannableString descriptionSpannable = new SpannableString(description);
boolean shouldEllipsize = moreClick != null;
String scrubbedDescription = shouldEllipsize ? description.replaceAll("\\n", " ") : description;
SpannableString descriptionSpannable = new SpannableString(scrubbedDescription);
if (linkify) {
int linkPattern = Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS;
@ -56,7 +56,7 @@ public final class GroupDescriptionUtil {
}
}
if (moreClick != null) {
if (shouldEllipsize) {
ClickableSpan style = new ClickableSpan() {
@Override
public void onClick(@NonNull View widget) {

View file

@ -181,7 +181,7 @@ public class EditProfileFragment extends LoggingFragment {
givenName.addTextChangedListener(new AfterTextChanged(s -> viewModel.setGivenName(s.toString())));
givenName.setHint(R.string.EditProfileFragment__group_name);
givenName.requestFocus();
toolbar.setTitle(R.string.EditProfileFragment__edit_group_name_and_photo);
toolbar.setTitle(R.string.EditProfileFragment__edit_group);
preview.setVisibility(View.GONE);
if (FeatureFlags.groupsV2Description()) {

View file

@ -2085,7 +2085,7 @@
<string name="EditAboutFragment_working_on_something_new">Working on something new</string>
<!-- EditProfileFragment -->
<string name="EditProfileFragment__edit_group_name_and_photo">Edit group name and photo</string>
<string name="EditProfileFragment__edit_group">Edit group</string>
<string name="EditProfileFragment__group_name">Group name</string>
<string name="EditProfileFragment__group_description">Group description</string>
<string name="EditProfileFragment__support_link" translatable="false">https://support.signal.org/hc/articles/360007459591</string>