kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix diplay issue with note to self banner.
rodzic
e85adad2b4
commit
8efd07b3e2
|
@ -2100,7 +2100,7 @@ public class ConversationParentFragment extends Fragment
|
||||||
unverifiedBannerView.get().hide();
|
unverifiedBannerView.get().hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
titleView.setVerified(isSecureText && identityRecords.isVerified());
|
titleView.setVerified(isSecureText && identityRecords.isVerified() && !recipient.get().isSelf());
|
||||||
|
|
||||||
future.set(true);
|
future.set(true);
|
||||||
}
|
}
|
||||||
|
@ -2634,7 +2634,7 @@ public class ConversationParentFragment extends Fragment
|
||||||
|
|
||||||
Log.i(TAG, "onModified(" + recipient.getId() + ") " + recipient.getRegistered());
|
Log.i(TAG, "onModified(" + recipient.getId() + ") " + recipient.getRegistered());
|
||||||
titleView.setTitle(glideRequests, recipient);
|
titleView.setTitle(glideRequests, recipient);
|
||||||
titleView.setVerified(identityRecords.isVerified());
|
titleView.setVerified(identityRecords.isVerified() && !recipient.isSelf());
|
||||||
setBlockedUserState(recipient, isSecureText, isDefaultSms);
|
setBlockedUserState(recipient, isSecureText, isDefaultSms);
|
||||||
updateReminders();
|
updateReminders();
|
||||||
updateDefaultSubscriptionId(recipient.getDefaultSubscriptionId());
|
updateDefaultSubscriptionId(recipient.getDefaultSubscriptionId());
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.thoughtcrime.securesms.conversation;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Parcelable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -30,6 +32,9 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
||||||
|
|
||||||
public class ConversationTitleView extends RelativeLayout {
|
public class ConversationTitleView extends RelativeLayout {
|
||||||
|
|
||||||
|
private static final String STATE_ROOT = "root";
|
||||||
|
private static final String STATE_IS_SELF = "is_self";
|
||||||
|
|
||||||
private AvatarView avatar;
|
private AvatarView avatar;
|
||||||
private BadgeImageView badge;
|
private BadgeImageView badge;
|
||||||
private TextView title;
|
private TextView title;
|
||||||
|
@ -39,6 +44,7 @@ public class ConversationTitleView extends RelativeLayout {
|
||||||
private View verifiedSubtitle;
|
private View verifiedSubtitle;
|
||||||
private View expirationBadgeContainer;
|
private View expirationBadgeContainer;
|
||||||
private TextView expirationBadgeTime;
|
private TextView expirationBadgeTime;
|
||||||
|
private boolean isSelf;
|
||||||
|
|
||||||
public ConversationTitleView(Context context) {
|
public ConversationTitleView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
|
@ -66,7 +72,33 @@ public class ConversationTitleView extends RelativeLayout {
|
||||||
ViewUtil.setTextViewGravityStart(this.subtitle, getContext());
|
ViewUtil.setTextViewGravityStart(this.subtitle, getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NonNull Parcelable onSaveInstanceState() {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
|
bundle.putParcelable(STATE_ROOT, super.onSaveInstanceState());
|
||||||
|
bundle.putBoolean(STATE_IS_SELF, isSelf);
|
||||||
|
|
||||||
|
return bundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestoreInstanceState(Parcelable state) {
|
||||||
|
if (state instanceof Bundle) {
|
||||||
|
Parcelable rootState = ((Bundle) state).getParcelable(STATE_ROOT);
|
||||||
|
super.onRestoreInstanceState(rootState);
|
||||||
|
|
||||||
|
isSelf = ((Bundle) state).getBoolean(STATE_IS_SELF, false);
|
||||||
|
} else {
|
||||||
|
super.onRestoreInstanceState(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void showExpiring(@NonNull LiveRecipient recipient) {
|
public void showExpiring(@NonNull LiveRecipient recipient) {
|
||||||
|
isSelf = recipient.get().isSelf();
|
||||||
|
|
||||||
expirationBadgeTime.setText(ExpirationUtil.getExpirationAbbreviatedDisplayValue(getContext(), recipient.get().getExpiresInSeconds()));
|
expirationBadgeTime.setText(ExpirationUtil.getExpirationAbbreviatedDisplayValue(getContext(), recipient.get().getExpiresInSeconds()));
|
||||||
expirationBadgeContainer.setVisibility(View.VISIBLE);
|
expirationBadgeContainer.setVisibility(View.VISIBLE);
|
||||||
updateSubtitleVisibility();
|
updateSubtitleVisibility();
|
||||||
|
@ -78,6 +110,8 @@ public class ConversationTitleView extends RelativeLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(@NonNull GlideRequests glideRequests, @Nullable Recipient recipient) {
|
public void setTitle(@NonNull GlideRequests glideRequests, @Nullable Recipient recipient) {
|
||||||
|
isSelf = recipient != null && recipient.isSelf();
|
||||||
|
|
||||||
this.subtitleContainer.setVisibility(View.VISIBLE);
|
this.subtitleContainer.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (recipient == null) setComposeTitle();
|
if (recipient == null) setComposeTitle();
|
||||||
|
@ -169,7 +203,7 @@ public class ConversationTitleView extends RelativeLayout {
|
||||||
|
|
||||||
private void setSelfTitle() {
|
private void setSelfTitle() {
|
||||||
this.title.setText(R.string.note_to_self);
|
this.title.setText(R.string.note_to_self);
|
||||||
this.subtitleContainer.setVisibility(View.GONE);
|
updateSubtitleVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setIndividualRecipientTitle(@NonNull Recipient recipient) {
|
private void setIndividualRecipientTitle(@NonNull Recipient recipient) {
|
||||||
|
@ -177,15 +211,14 @@ public class ConversationTitleView extends RelativeLayout {
|
||||||
this.title.setText(displayName);
|
this.title.setText(displayName);
|
||||||
this.subtitle.setText(null);
|
this.subtitle.setText(null);
|
||||||
updateSubtitleVisibility();
|
updateSubtitleVisibility();
|
||||||
updateVerifiedSubtitleVisibility();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVerifiedSubtitleVisibility() {
|
private void updateVerifiedSubtitleVisibility() {
|
||||||
verifiedSubtitle.setVisibility(subtitle.getVisibility() != VISIBLE && verified.getVisibility() == VISIBLE ? VISIBLE : GONE);
|
verifiedSubtitle.setVisibility(!isSelf && subtitle.getVisibility() != VISIBLE && verified.getVisibility() == VISIBLE ? VISIBLE : GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSubtitleVisibility() {
|
private void updateSubtitleVisibility() {
|
||||||
subtitle.setVisibility(expirationBadgeContainer.getVisibility() != VISIBLE && !TextUtils.isEmpty(subtitle.getText()) ? VISIBLE : GONE);
|
subtitle.setVisibility(!isSelf && expirationBadgeContainer.getVisibility() != VISIBLE && !TextUtils.isEmpty(subtitle.getText()) ? VISIBLE : GONE);
|
||||||
updateVerifiedSubtitleVisibility();
|
updateVerifiedSubtitleVisibility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue