mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-03-02 15:36:32 +00:00
Update verified icon.
This commit is contained in:
committed by
Greyson Parrelli
parent
ba06efe35a
commit
b74f04495e
@@ -226,8 +226,8 @@ public abstract class MessageRecord extends DisplayRecord {
|
||||
} else if (isIdentityUpdate()) {
|
||||
return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_safety_number_with_s_has_changed, r.getDisplayName(context)), R.drawable.ic_update_safety_number_16);
|
||||
} else if (isIdentityVerified()) {
|
||||
if (isOutgoing()) return fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified, r.getDisplayName(context)), R.drawable.ic_update_verified_16);
|
||||
else return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified_from_another_device, r.getDisplayName(context)), R.drawable.ic_update_verified_16);
|
||||
if (isOutgoing()) return fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified, r.getDisplayName(context)), R.drawable.ic_safety_number_16);
|
||||
else return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified_from_another_device, r.getDisplayName(context)), R.drawable.ic_safety_number_16);
|
||||
} else if (isIdentityDefault()) {
|
||||
if (isOutgoing()) return fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified, r.getDisplayName(context)), R.drawable.ic_update_info_16);
|
||||
else return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified_from_another_device, r.getDisplayName(context)), R.drawable.ic_update_info_16);
|
||||
|
||||
@@ -438,7 +438,7 @@ final class GroupMemberListAdapter extends RecyclerView.Adapter<GroupMemberListA
|
||||
pendingMembers.getInviteCount(),
|
||||
displayName, pendingMembers.getInviteCount());
|
||||
|
||||
bindImageAndText(inviter, displayText, inviter.getAbout());
|
||||
bindImageAndText(inviter, displayText, inviter.getFilteredAbout());
|
||||
|
||||
if (pendingMembers.isCancellable() && adminActionsListener != null) {
|
||||
popupMenu.setMenu(R.menu.others_invite_pending_menu,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.thoughtcrime.securesms.profiles.manage;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
@@ -15,6 +16,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
@@ -25,11 +27,11 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import org.signal.core.util.BreakIteratorCompat;
|
||||
import org.signal.core.util.EditTextUtil;
|
||||
import org.signal.core.util.StringUtil;
|
||||
import org.signal.core.util.concurrent.LifecycleDisposable;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiUtil;
|
||||
import org.thoughtcrime.securesms.reactions.any.ReactWithAnyEmojiBottomSheetDialogFragment;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.signal.core.util.concurrent.LifecycleDisposable;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.adapter.AlwaysChangedDiffUtil;
|
||||
import org.thoughtcrime.securesms.util.text.AfterTextChanged;
|
||||
@@ -63,6 +65,7 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
|
||||
private ImageView emojiView;
|
||||
private EditText bodyView;
|
||||
private TextView countView;
|
||||
private TextView errorView;
|
||||
private CircularProgressMaterialButton saveButton;
|
||||
private EditAboutViewModel viewModel;
|
||||
private LifecycleDisposable lifecycleDisposable;
|
||||
@@ -79,6 +82,7 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
|
||||
this.emojiView = view.findViewById(R.id.edit_about_emoji);
|
||||
this.bodyView = view.findViewById(R.id.edit_about_body);
|
||||
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);
|
||||
|
||||
lifecycleDisposable = new LifecycleDisposable();
|
||||
@@ -92,6 +96,7 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
|
||||
|
||||
EditTextUtil.addGraphemeClusterLimitFilter(bodyView, ABOUT_MAX_GLYPHS);
|
||||
this.bodyView.addTextChangedListener(new AfterTextChanged(editable -> {
|
||||
checkValidText(editable.toString());
|
||||
trimFieldToMaxByteLength(editable);
|
||||
presentCount(editable.toString());
|
||||
}));
|
||||
@@ -126,6 +131,21 @@ public class EditAboutFragment extends Fragment implements EditProfileActivity.E
|
||||
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
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putString(KEY_SELECTED_EMOJI, selectedEmoji);
|
||||
|
||||
@@ -367,8 +367,11 @@ class Recipient(
|
||||
/** The badge to feature on a recipient's avatar, if any. */
|
||||
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. */
|
||||
val combinedAboutAndEmoji: String? by lazy { listOf(aboutEmoji, about).filter { it.isNotNullOrBlank() }.joinToString(separator = " ").nullIfBlank() }
|
||||
val combinedAboutAndEmoji: String? by lazy { listOf(aboutEmoji, filteredAbout).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. */
|
||||
val shouldBlurAvatar: Boolean
|
||||
|
||||
@@ -96,7 +96,7 @@ class AboutSheet : ComposeBottomSheetDialogFragment() {
|
||||
displayName = recipient.get().getDisplayName(requireContext()),
|
||||
shortName = recipient.get().getShortDisplayName(requireContext()),
|
||||
profileName = recipient.get().profileName.toString(),
|
||||
about = recipient.get().about,
|
||||
about = recipient.get().filteredAbout,
|
||||
verified = verified,
|
||||
hasAvatar = recipient.get().profileAvatarFileDetails.hasFile(),
|
||||
recipientForAvatar = recipient.get(),
|
||||
@@ -220,7 +220,7 @@ private fun Content(
|
||||
|
||||
if (!model.isSelf && model.verified) {
|
||||
AboutRow(
|
||||
startIcon = painterResource(id = R.drawable.check),
|
||||
startIcon = painterResource(id = R.drawable.symbol_safety_number_24),
|
||||
text = stringResource(id = R.string.AboutSheet__verified),
|
||||
modifier = Modifier.align(alignment = Alignment.Start),
|
||||
onClick = onClickSignalConnections
|
||||
|
||||
Reference in New Issue
Block a user