diff --git a/res/values/strings.xml b/res/values/strings.xml
index df0710e0c2..7d7e7c3343 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -451,6 +451,7 @@
Unblock
Enabled
Disabled
+ Available once a message has been sent or received.
Answering
diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java
index bd68b6d8ec..a89d3b1255 100644
--- a/src/org/thoughtcrime/securesms/ConversationActivity.java
+++ b/src/org/thoughtcrime/securesms/ConversationActivity.java
@@ -1026,6 +1026,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
public void onClick(View v) {
Intent intent = new Intent(ConversationActivity.this, RecipientPreferenceActivity.class);
intent.putExtra(RecipientPreferenceActivity.RECIPIENTS_EXTRA, recipients.getIds());
+ intent.putExtra(RecipientPreferenceActivity.CAN_HAVE_SAFETY_NUMBER_EXTRA,
+ isSecureText && !isSelfConversation());
startActivitySceneTransition(intent, titleView.findViewById(R.id.title), "recipient_name");
}
diff --git a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java
index bbd4109919..da6479e2d8 100644
--- a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java
+++ b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java
@@ -55,7 +55,8 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
{
private static final String TAG = RecipientPreferenceActivity.class.getSimpleName();
- public static final String RECIPIENTS_EXTRA = "recipient_ids";
+ public static final String RECIPIENTS_EXTRA = "recipient_ids";
+ public static final String CAN_HAVE_SAFETY_NUMBER_EXTRA = "can_have_safety_number";
private static final String PREFERENCE_MUTED = "pref_key_recipient_mute";
private static final String PREFERENCE_TONE = "pref_key_recipient_ringtone";
@@ -192,6 +193,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
private Recipients recipients;
private BroadcastReceiver staleReceiver;
private MasterSecret masterSecret;
+ private boolean canHaveSafetyNumber;
@Override
public void onCreate(Bundle icicle) {
@@ -200,7 +202,9 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
addPreferencesFromResource(R.xml.recipient_preferences);
initializeRecipients();
- this.masterSecret = getArguments().getParcelable("master_secret");
+ this.masterSecret = getArguments().getParcelable("master_secret");
+ this.canHaveSafetyNumber = getActivity().getIntent()
+ .getBooleanExtra(RecipientPreferenceActivity.CAN_HAVE_SAFETY_NUMBER_EXTRA, false);
this.findPreference(PREFERENCE_TONE)
.setOnPreferenceChangeListener(new RingtoneChangeListener());
@@ -299,6 +303,9 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
if (result.isPresent()) {
if (identityPreference != null) identityPreference.setOnPreferenceClickListener(new IdentityClickedListener(result.get()));
if (identityPreference != null) identityPreference.setEnabled(true);
+ } else if (canHaveSafetyNumber) {
+ if (identityPreference != null) identityPreference.setSummary(R.string.RecipientPreferenceActivity_available_once_a_message_has_been_sent_or_received);
+ if (identityPreference != null) identityPreference.setEnabled(false);
} else {
if (identityPreference != null) getPreferenceScreen().removePreference(identityPreference);
}