hide irrelevant preferences in RecipientPreferenceActivity

fixes #4505
Closes #4509
//FREEBIE
This commit is contained in:
agrajaghh 2015-11-13 00:48:03 +01:00 committed by Moxie Marlinspike
parent 43ebf829ca
commit ce617fb7cb

View File

@ -219,17 +219,14 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
vibratePreference.setValueIndex(2);
}
colorPreference.setEnabled(recipients.isSingleRecipient() && !recipients.isGroupRecipient());
if (!recipients.isSingleRecipient() || recipients.isGroupRecipient()) {
this.getPreferenceScreen().removePreference(colorPreference);
this.getPreferenceScreen().removePreference(blockPreference);
this.getPreferenceScreen().removePreference(identityPreference);
} else {
colorPreference.setChoices(MaterialColors.CONVERSATION_PALETTE.asConversationColorArray(getActivity()));
colorPreference.setValue(recipients.getColor().toActionBarColor(getActivity()));
if (!recipients.isSingleRecipient() || recipients.isGroupRecipient()) {
blockPreference.setEnabled(false);
identityPreference.setEnabled(false);
} else {
blockPreference.setEnabled(true);
identityPreference.setEnabled(true);
if (recipients.isBlocked()) blockPreference.setTitle(R.string.RecipientPreferenceActivity_unblock);
else blockPreference.setTitle(R.string.RecipientPreferenceActivity_block);
}