use of cx.ring.views.PasswordPreference in project ring-client-android by savoirfairelinux.
the class GeneralAccountFragment method setPreferenceDetails.
private void setPreferenceDetails(AccountConfig details) {
for (ConfigKey confKey : details.getKeys()) {
Preference pref = findPreference(confKey.key());
if (pref == null) {
continue;
}
if (!confKey.isTwoState()) {
String val = details.get(confKey);
((EditTextPreference) pref).setText(val);
if (pref instanceof PasswordPreference) {
StringBuilder tmp = new StringBuilder();
for (int i = 0; i < val.length(); ++i) {
tmp.append("*");
}
pref.setSummary(tmp.toString());
} else {
pref.setSummary(val);
}
} else {
((TwoStatePreference) pref).setChecked(details.getBool(confKey));
}
}
}
use of cx.ring.views.PasswordPreference in project ring-client-android by savoirfairelinux.
the class GeneralAccountFragment method onDisplayPreferenceDialog.
@Override
public void onDisplayPreferenceDialog(Preference preference) {
if (getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG) != null) {
return;
}
if (preference instanceof EditTextIntegerPreference) {
EditTextPreferenceDialog f = EditTextPreferenceDialog.newInstance(preference.getKey(), EditorInfo.TYPE_CLASS_NUMBER);
f.setTargetFragment(this, 0);
f.show(getFragmentManager(), DIALOG_FRAGMENT_TAG);
} else if (preference instanceof PasswordPreference) {
EditTextPreferenceDialog f = EditTextPreferenceDialog.newInstance(preference.getKey(), EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
f.setTargetFragment(this, 0);
f.show(getFragmentManager(), DIALOG_FRAGMENT_TAG);
} else {
super.onDisplayPreferenceDialog(preference);
}
}
use of cx.ring.views.PasswordPreference in project ring-client-android by savoirfairelinux.
the class AdvancedAccountFragment method onDisplayPreferenceDialog.
@Override
public void onDisplayPreferenceDialog(Preference preference) {
if (getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG) != null) {
return;
}
if (preference instanceof EditTextIntegerPreference) {
EditTextPreferenceDialog f = EditTextPreferenceDialog.newInstance(preference.getKey(), EditorInfo.TYPE_CLASS_NUMBER);
f.setTargetFragment(this, 0);
f.show(getFragmentManager(), DIALOG_FRAGMENT_TAG);
} else if (preference instanceof PasswordPreference) {
EditTextPreferenceDialog f = EditTextPreferenceDialog.newInstance(preference.getKey(), EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
f.setTargetFragment(this, 0);
f.show(getFragmentManager(), DIALOG_FRAGMENT_TAG);
} else {
super.onDisplayPreferenceDialog(preference);
}
}
use of cx.ring.views.PasswordPreference in project ring-client-android by savoirfairelinux.
the class AdvancedAccountFragment method onPreferenceChange.
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final ConfigKey key = ConfigKey.fromString(preference.getKey());
presenter.preferenceChanged(key, newValue);
if (preference instanceof TwoStatePreference) {
presenter.twoStatePreferenceChanged(key, newValue);
} else if (preference instanceof PasswordPreference) {
presenter.passwordPreferenceChanged(key, newValue);
preference.setSummary(TextUtils.isEmpty(newValue.toString()) ? "" : "******");
} else {
presenter.preferenceChanged(key, newValue);
preference.setSummary(newValue.toString());
}
return true;
}
Aggregations