kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix some group description UX oddities.
rodzic
dbabac34b0
commit
2651b789dd
|
@ -23,8 +23,6 @@ import org.thoughtcrime.securesms.util.LongClickCopySpan;
|
||||||
|
|
||||||
public final class GroupDescriptionUtil {
|
public final class GroupDescriptionUtil {
|
||||||
|
|
||||||
public static final int MAX_DESCRIPTION_LENGTH = 80;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a group description.
|
* 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.
|
* @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) {
|
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) {
|
if (linkify) {
|
||||||
int linkPattern = Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS;
|
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() {
|
ClickableSpan style = new ClickableSpan() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(@NonNull View widget) {
|
public void onClick(@NonNull View widget) {
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class EditProfileFragment extends LoggingFragment {
|
||||||
givenName.addTextChangedListener(new AfterTextChanged(s -> viewModel.setGivenName(s.toString())));
|
givenName.addTextChangedListener(new AfterTextChanged(s -> viewModel.setGivenName(s.toString())));
|
||||||
givenName.setHint(R.string.EditProfileFragment__group_name);
|
givenName.setHint(R.string.EditProfileFragment__group_name);
|
||||||
givenName.requestFocus();
|
givenName.requestFocus();
|
||||||
toolbar.setTitle(R.string.EditProfileFragment__edit_group_name_and_photo);
|
toolbar.setTitle(R.string.EditProfileFragment__edit_group);
|
||||||
preview.setVisibility(View.GONE);
|
preview.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (FeatureFlags.groupsV2Description()) {
|
if (FeatureFlags.groupsV2Description()) {
|
||||||
|
|
|
@ -2085,7 +2085,7 @@
|
||||||
<string name="EditAboutFragment_working_on_something_new">Working on something new</string>
|
<string name="EditAboutFragment_working_on_something_new">Working on something new</string>
|
||||||
|
|
||||||
<!-- EditProfileFragment -->
|
<!-- 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_name">Group name</string>
|
||||||
<string name="EditProfileFragment__group_description">Group description</string>
|
<string name="EditProfileFragment__group_description">Group description</string>
|
||||||
<string name="EditProfileFragment__support_link" translatable="false">https://support.signal.org/hc/articles/360007459591</string>
|
<string name="EditProfileFragment__support_link" translatable="false">https://support.signal.org/hc/articles/360007459591</string>
|
||||||
|
|
Ładowanie…
Reference in New Issue