Search in sources :

Example 1 with ContactIdentityManager

use of org.thoughtcrime.securesms.contacts.ContactIdentityManager in project Signal-Android by WhisperSystems.

the class AdvancedPreferenceFragment method initializeIdentitySelection.

private void initializeIdentitySelection() {
    ContactIdentityManager identity = ContactIdentityManager.getInstance(getActivity());
    Preference preference = this.findPreference(TextSecurePreferences.IDENTITY_PREF);
    if (identity.isSelfIdentityAutoDetected()) {
        this.getPreferenceScreen().removePreference(preference);
    } else {
        Uri contactUri = identity.getSelfIdentityUri();
        if (contactUri != null) {
            String contactName = ContactAccessor.getInstance().getNameFromContact(getActivity(), contactUri);
            preference.setSummary(String.format(getString(R.string.ApplicationPreferencesActivity_currently_s), contactName));
        }
        preference.setOnPreferenceClickListener(new IdentityPreferenceClickListener());
    }
}
Also used : ContactIdentityManager(org.thoughtcrime.securesms.contacts.ContactIdentityManager) CheckBoxPreference(android.preference.CheckBoxPreference) Preference(android.preference.Preference) Uri(android.net.Uri)

Aggregations

Uri (android.net.Uri)1 CheckBoxPreference (android.preference.CheckBoxPreference)1 Preference (android.preference.Preference)1 ContactIdentityManager (org.thoughtcrime.securesms.contacts.ContactIdentityManager)1