Search in sources :

Example 6 with ConfigKey

use of cx.ring.model.ConfigKey in project ring-client-android by savoirfairelinux.

the class AdvancedAccountFragment method initView.

@Override
public void initView(AccountConfig config, ArrayList<CharSequence> networkInterfaces) {
    for (ConfigKey confKey : config.getKeys()) {
        Preference pref = findPreference(confKey.key());
        if (pref != null) {
            pref.setOnPreferenceChangeListener(this);
            if (confKey == ConfigKey.LOCAL_INTERFACE) {
                String val = config.get(confKey);
                CharSequence[] display = networkInterfaces.toArray(new CharSequence[networkInterfaces.size()]);
                ListPreference listPref = (ListPreference) pref;
                listPref.setEntries(display);
                listPref.setEntryValues(display);
                listPref.setSummary(val);
                listPref.setValue(val);
            } else if (!confKey.isTwoState()) {
                String val = config.get(confKey);
                pref.setSummary(val);
                if (pref instanceof EditTextPreference) {
                    ((EditTextPreference) pref).setText(val);
                }
            } else {
                ((TwoStatePreference) pref).setChecked(config.getBool(confKey));
            }
        }
    }
}
Also used : ConfigKey(cx.ring.model.ConfigKey) ListPreference(android.support.v7.preference.ListPreference) TwoStatePreference(android.support.v7.preference.TwoStatePreference) Preference(android.support.v7.preference.Preference) EditTextPreference(android.support.v7.preference.EditTextPreference) EditTextIntegerPreference(cx.ring.views.EditTextIntegerPreference) PasswordPreference(cx.ring.views.PasswordPreference) ListPreference(android.support.v7.preference.ListPreference) EditTextPreference(android.support.v7.preference.EditTextPreference)

Aggregations

TwoStatePreference (android.support.v7.preference.TwoStatePreference)6 ConfigKey (cx.ring.model.ConfigKey)6 Preference (android.support.v7.preference.Preference)5 EditTextPreference (android.support.v7.preference.EditTextPreference)4 ListPreference (android.support.v7.preference.ListPreference)3 PasswordPreference (cx.ring.views.PasswordPreference)3 File (java.io.File)3 CredentialsPreference (cx.ring.views.CredentialsPreference)2 EditTextIntegerPreference (cx.ring.views.EditTextIntegerPreference)2 Uri (android.net.Uri)1 SwitchPreference (android.support.v14.preference.SwitchPreference)1