[Bugfix] fix settings hide SipAccount settings entry

This commit is contained in:
Brieuc Viel 2017-08-01 09:45:12 +02:00
parent 6b0e06782e
commit a4d5f9e558

View file

@ -325,38 +325,39 @@ public class SettingsFragment extends PreferencesListFragment {
} }
private void initAccounts() { private void initAccounts() {
PreferenceCategory accounts = (PreferenceCategory) findPreference(getString(R.string.pref_sipaccounts_key)); if (!getResources().getBoolean(R.bool.hide_accounts)) {
accounts.removeAll(); PreferenceCategory accounts = (PreferenceCategory) findPreference(getString(R.string.pref_sipaccounts_key));
accounts.removeAll();
// Get already configured extra accounts // Get already configured extra accounts
int defaultAccountID = mPrefs.getDefaultAccountIndex(); int defaultAccountID = mPrefs.getDefaultAccountIndex();
int nbAccounts = mPrefs.getAccountCount(); int nbAccounts = mPrefs.getAccountCount();
for (int i = 0; i < nbAccounts; i++) { for (int i = 0; i < nbAccounts; i++) {
final int accountId = i; final int accountId = i;
// For each, add menus to configure it // For each, add menus to configure it
String username = mPrefs.getAccountUsername(accountId); String username = mPrefs.getAccountUsername(accountId);
String domain = mPrefs.getAccountDomain(accountId); String domain = mPrefs.getAccountDomain(accountId);
LedPreference account = new LedPreference(getActivity()); LedPreference account = new LedPreference(getActivity());
if (username == null) { if (username == null) {
account.setTitle(getString(R.string.pref_sipaccount)); account.setTitle(getString(R.string.pref_sipaccount));
} else { } else {
account.setTitle(username + "@" + domain); account.setTitle(username + "@" + domain);
}
if (defaultAccountID == i) {
account.setSummary(R.string.default_account_flag);
}
account.setOnPreferenceClickListener(new OnPreferenceClickListener()
{
public boolean onPreferenceClick(Preference preference) {
LinphoneActivity.instance().displayAccountSettings(accountId);
return false;
} }
});
updateAccountLed(account, username, domain, mPrefs.isAccountEnabled(i)); if (defaultAccountID == i) {
accounts.addPreference(account); account.setSummary(R.string.default_account_flag);
}
account.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
LinphoneActivity.instance().displayAccountSettings(accountId);
return false;
}
});
updateAccountLed(account, username, domain, mPrefs.isAccountEnabled(i));
accounts.addPreference(account);
}
} }
} }