Add option to disable secondary accounts.
Useful for testing only one account without loosing the others.
This commit is contained in:
parent
abd5871b23
commit
38508fa787
4 changed files with 17 additions and 2 deletions
|
@ -2,6 +2,8 @@
|
|||
<resources>
|
||||
<!-- Do not translate any of the strings below -->
|
||||
|
||||
<string name="pref_disable_account_key">pref_disable_account_key</string>
|
||||
|
||||
<string name="pref_tunnel_key">pref_tunnel_key</string>
|
||||
<string name="pref_tunnel_mode_key">pref_tunnel_mode_key</string>
|
||||
<string name="tunnel_mode_entry_value_disabled">disabled</string>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="pref_disable_account">Disable</string>
|
||||
|
||||
<string name="pref_tunnel">Tunnel</string>
|
||||
<string name="pref_tunnel_host">Hostname</string>
|
||||
<string name="pref_tunnel_port">Port</string>
|
||||
|
|
|
@ -673,9 +673,12 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
lDefaultProxyConfig.enableRegister(true);
|
||||
lDefaultProxyConfig.done();
|
||||
}
|
||||
|
||||
|
||||
// Extra accounts
|
||||
for (int i = 1; i < getPrefExtraAccountsNumber(); i++) {
|
||||
if (getPrefBoolean(getString(R.string.pref_disable_account_key) + i, false)) {
|
||||
continue;
|
||||
}
|
||||
lUserName = getPrefString(getString(R.string.pref_username_key) + i, null);
|
||||
lPasswd = getPrefString(getString(R.string.pref_passwd_key) + i, null);
|
||||
if (lUserName != null && lUserName.length() > 0) {
|
||||
|
|
|
@ -77,7 +77,12 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity {
|
|||
outboundProxy.setTitle(getString(R.string.pref_enable_outbound_proxy));
|
||||
outboundProxy.setPersistent(true);
|
||||
outboundProxy.setKey(getString(R.string.pref_enable_outbound_proxy_key) + getAccountNumber(n));
|
||||
|
||||
|
||||
CheckBoxPreference disable = new CheckBoxPreference(this);
|
||||
disable.setTitle(getString(R.string.pref_disable_account));
|
||||
disable.setPersistent(true);
|
||||
disable.setKey(getString(R.string.pref_disable_account_key) + getAccountNumber(n));
|
||||
|
||||
final Preference delete = new Preference(this);
|
||||
delete.setTitle("Delete this account");
|
||||
delete.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
|
@ -91,6 +96,7 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity {
|
|||
editor.putString(getString(R.string.pref_domain_key) + i, prefs.getString(getString(R.string.pref_domain_key) + (i+1), null));
|
||||
editor.putString(getString(R.string.pref_proxy_key) + i, prefs.getString(getString(R.string.pref_proxy_key) + (i+1), null));
|
||||
editor.putBoolean(getString(R.string.pref_enable_outbound_proxy_key) + i, prefs.getBoolean(getString(R.string.pref_enable_outbound_proxy_key) + (i+1), false));
|
||||
editor.putBoolean(getString(R.string.pref_disable_account_key) + i, prefs.getBoolean(getString(R.string.pref_disable_account_key) + (i+1), false));
|
||||
}
|
||||
|
||||
int lastAccount = nbAccounts - 1;
|
||||
|
@ -99,6 +105,7 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity {
|
|||
editor.putString(getString(R.string.pref_domain_key) + lastAccount, null);
|
||||
editor.putString(getString(R.string.pref_proxy_key) + lastAccount, null);
|
||||
editor.putBoolean(getString(R.string.pref_enable_outbound_proxy_key) + lastAccount, false);
|
||||
editor.putBoolean(getString(R.string.pref_disable_account_key) + lastAccount, false);
|
||||
|
||||
int defaultAccount = prefs.getInt(getString(R.string.pref_default_account), 0);
|
||||
if (defaultAccount > n) {
|
||||
|
@ -138,6 +145,7 @@ public class LinphonePreferencesSIPAccountActivity extends PreferenceActivity {
|
|||
category.addPreference(domain);
|
||||
category.addPreference(proxy);
|
||||
category.addPreference(outboundProxy);
|
||||
category.addPreference(disable);
|
||||
category.addPreference(mainAccount);
|
||||
category.addPreference(delete);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue