Update emojis in about status.
This commit is contained in:
parent
ca0062f46e
commit
d0162d0b21
7 changed files with 3 additions and 39 deletions
|
@ -438,7 +438,7 @@ final class GroupMemberListAdapter extends RecyclerView.Adapter<GroupMemberListA
|
||||||
pendingMembers.getInviteCount(),
|
pendingMembers.getInviteCount(),
|
||||||
displayName, pendingMembers.getInviteCount());
|
displayName, pendingMembers.getInviteCount());
|
||||||
|
|
||||||
bindImageAndText(inviter, displayText, inviter.getFilteredAbout());
|
bindImageAndText(inviter, displayText, inviter.getAbout());
|
||||||
|
|
||||||
if (pendingMembers.isCancellable() && adminActionsListener != null) {
|
if (pendingMembers.isCancellable() && adminActionsListener != null) {
|
||||||
popupMenu.setMenu(R.menu.others_invite_pending_menu,
|
popupMenu.setMenu(R.menu.others_invite_pending_menu,
|
||||||
|
|
|
@ -65,7 +65,6 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
|
||||||
private ImageView emojiView;
|
private ImageView emojiView;
|
||||||
private EditText bodyView;
|
private EditText bodyView;
|
||||||
private TextView countView;
|
private TextView countView;
|
||||||
private TextView errorView;
|
|
||||||
private CircularProgressMaterialButton saveButton;
|
private CircularProgressMaterialButton saveButton;
|
||||||
private EditAboutViewModel viewModel;
|
private EditAboutViewModel viewModel;
|
||||||
private LifecycleDisposable lifecycleDisposable;
|
private LifecycleDisposable lifecycleDisposable;
|
||||||
|
@ -82,7 +81,6 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
|
||||||
this.emojiView = view.findViewById(R.id.edit_about_emoji);
|
this.emojiView = view.findViewById(R.id.edit_about_emoji);
|
||||||
this.bodyView = view.findViewById(R.id.edit_about_body);
|
this.bodyView = view.findViewById(R.id.edit_about_body);
|
||||||
this.countView = view.findViewById(R.id.edit_about_count);
|
this.countView = view.findViewById(R.id.edit_about_count);
|
||||||
this.errorView = view.findViewById(R.id.edit_about_error);
|
|
||||||
this.saveButton = view.findViewById(R.id.edit_about_save);
|
this.saveButton = view.findViewById(R.id.edit_about_save);
|
||||||
|
|
||||||
lifecycleDisposable = new LifecycleDisposable();
|
lifecycleDisposable = new LifecycleDisposable();
|
||||||
|
@ -96,7 +94,6 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
|
||||||
|
|
||||||
EditTextUtil.addGraphemeClusterLimitFilter(bodyView, ABOUT_MAX_GLYPHS);
|
EditTextUtil.addGraphemeClusterLimitFilter(bodyView, ABOUT_MAX_GLYPHS);
|
||||||
this.bodyView.addTextChangedListener(new AfterTextChanged(editable -> {
|
this.bodyView.addTextChangedListener(new AfterTextChanged(editable -> {
|
||||||
checkValidText(editable.toString());
|
|
||||||
trimFieldToMaxByteLength(editable);
|
trimFieldToMaxByteLength(editable);
|
||||||
presentCount(editable.toString());
|
presentCount(editable.toString());
|
||||||
}));
|
}));
|
||||||
|
@ -131,21 +128,6 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
|
||||||
ViewUtil.focusAndMoveCursorToEndAndOpenKeyboard(bodyView);
|
ViewUtil.focusAndMoveCursorToEndAndOpenKeyboard(bodyView);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkValidText(String text) {
|
|
||||||
boolean isInvalid = false;
|
|
||||||
for (Character emoji : StringUtil.FILTERED_EMOJIS) {
|
|
||||||
if (text.contains(Character.toString(emoji))) {
|
|
||||||
isInvalid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int colorRes = isInvalid ? R.color.signal_colorError : R.color.signal_colorPrimary;
|
|
||||||
bodyView.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(requireContext(), colorRes)));
|
|
||||||
errorView.setVisibility(isInvalid ? View.VISIBLE : View.GONE);
|
|
||||||
saveButton.setEnabled(!isInvalid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
outState.putString(KEY_SELECTED_EMOJI, selectedEmoji);
|
outState.putString(KEY_SELECTED_EMOJI, selectedEmoji);
|
||||||
|
|
|
@ -367,11 +367,8 @@ class Recipient(
|
||||||
/** The badge to feature on a recipient's avatar, if any. */
|
/** The badge to feature on a recipient's avatar, if any. */
|
||||||
val featuredBadge: Badge? = badges.firstOrNull()
|
val featuredBadge: Badge? = badges.firstOrNull()
|
||||||
|
|
||||||
/** A string filtering out banned emojis from the about text */
|
|
||||||
val filteredAbout: String? by lazy { about?.filterNot { StringUtil.FILTERED_EMOJIS.contains(it) } }
|
|
||||||
|
|
||||||
/** A string combining the about emoji + text for displaying various places. */
|
/** A string combining the about emoji + text for displaying various places. */
|
||||||
val combinedAboutAndEmoji: String? by lazy { listOf(aboutEmoji, filteredAbout).filter { it.isNotNullOrBlank() }.joinToString(separator = " ").nullIfBlank() }
|
val combinedAboutAndEmoji: String? by lazy { listOf(aboutEmoji, about).filter { it.isNotNullOrBlank() }.joinToString(separator = " ").nullIfBlank() }
|
||||||
|
|
||||||
/** Whether or not we should blur the recipient's avatar when showing it in the chat list and other locations. */
|
/** Whether or not we should blur the recipient's avatar when showing it in the chat list and other locations. */
|
||||||
val shouldBlurAvatar: Boolean
|
val shouldBlurAvatar: Boolean
|
||||||
|
|
|
@ -96,7 +96,7 @@ class AboutSheet : ComposeBottomSheetDialogFragment() {
|
||||||
displayName = recipient.get().getDisplayName(requireContext()),
|
displayName = recipient.get().getDisplayName(requireContext()),
|
||||||
shortName = recipient.get().getShortDisplayName(requireContext()),
|
shortName = recipient.get().getShortDisplayName(requireContext()),
|
||||||
profileName = recipient.get().profileName.toString(),
|
profileName = recipient.get().profileName.toString(),
|
||||||
about = recipient.get().filteredAbout,
|
about = recipient.get().about,
|
||||||
verified = verified,
|
verified = verified,
|
||||||
hasAvatar = recipient.get().profileAvatarFileDetails.hasFile(),
|
hasAvatar = recipient.get().profileAvatarFileDetails.hasFile(),
|
||||||
recipientForAvatar = recipient.get(),
|
recipientForAvatar = recipient.get(),
|
||||||
|
|
|
@ -59,17 +59,6 @@
|
||||||
app:layout_constraintTop_toTopOf="@id/edit_about_body"
|
app:layout_constraintTop_toTopOf="@id/edit_about_body"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/edit_about_body"/>
|
app:layout_constraintBottom_toBottomOf="@id/edit_about_body"/>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/edit_about_error"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="6dp"
|
|
||||||
style="@style/Signal.Text.Caption"
|
|
||||||
android:textColor="@color/signal_colorError"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/edit_about_body"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/edit_about_body"
|
|
||||||
android:text="@string/EditAboutFragment_one_or_more_characters" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/edit_about_count"
|
android:id="@+id/edit_about_count"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -3323,8 +3323,6 @@
|
||||||
<string name="EditAboutFragment_free_to_chat">Free to chat</string>
|
<string name="EditAboutFragment_free_to_chat">Free to chat</string>
|
||||||
<string name="EditAboutFragment_taking_a_break">Taking a break</string>
|
<string name="EditAboutFragment_taking_a_break">Taking a break</string>
|
||||||
<string name="EditAboutFragment_working_on_something_new">Working on something new</string>
|
<string name="EditAboutFragment_working_on_something_new">Working on something new</string>
|
||||||
<!-- Error text shown when the About text contains an invalid character -->
|
|
||||||
<string name="EditAboutFragment_one_or_more_characters">One or more characters is invalid.</string>
|
|
||||||
|
|
||||||
<!-- EditProfileFragment -->
|
<!-- EditProfileFragment -->
|
||||||
<string name="EditProfileFragment__edit_group">Edit group</string>
|
<string name="EditProfileFragment__edit_group">Edit group</string>
|
||||||
|
|
|
@ -22,8 +22,6 @@ public final class StringUtil {
|
||||||
'\u200B', // zero-width space
|
'\u200B', // zero-width space
|
||||||
'\u2800'); // braille blank
|
'\u2800'); // braille blank
|
||||||
|
|
||||||
public static final List<Character> FILTERED_EMOJIS = List.of('\u2713', '\u2714', '\u2611', '\u221A', '\u26C9', '\u26CA', '\u26DB');
|
|
||||||
|
|
||||||
private static final Pattern ALL_ASCII_PATTERN = Pattern.compile("^[\\x00-\\x7F]*$");
|
private static final Pattern ALL_ASCII_PATTERN = Pattern.compile("^[\\x00-\\x7F]*$");
|
||||||
|
|
||||||
private static final class Bidi {
|
private static final class Bidi {
|
||||||
|
|
Loading…
Add table
Reference in a new issue