#17037: Remove multi-level PreferenceScreen launch separate Activities instead
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java
index 0243e29..86519b9 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java
@@ -26,8 +26,7 @@
import com.savoirfairelinux.sflphone.service.ServiceConstants;
import com.savoirfairelinux.sflphone.service.StringMap;
-import java.util.Collection;
-import java.util.Set;
+import java.util.ArrayList;
public interface AccountDetail {
@@ -36,12 +35,14 @@
public String mKey;
public int mLabelId;
public boolean isTwoState;
+ public String mValue;
public PreferenceEntry(String key, int labelId)
{
mKey = key;
mLabelId = labelId;
isTwoState = false;
+ mValue = "";
}
public PreferenceEntry(String key, int labelId, boolean twoState)
@@ -49,11 +50,24 @@
mKey = key;
mLabelId = labelId;
isTwoState = twoState;
+ mValue = "";
+ }
+
+ public PreferenceEntry(String key, int labelId, boolean twoState, String value)
+ {
+ mKey = key;
+ mLabelId = labelId;
+ isTwoState = twoState;
+ mValue = value;
}
}
- public Set<String> getDetailKeys();
+ public ArrayList<PreferenceEntry> getDetailValues();
- public Collection<PreferenceEntry> getDetailValues();
+ public ArrayList<String> getValuesOnly();
+
+ public String getDetailString(String key);
+
+ public boolean getDetailBoolean();
}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java
index b9e9eee..0faa79a 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java
@@ -24,6 +24,8 @@
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.utils.AccountDetail;
+import android.util.Log;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
@@ -31,6 +33,9 @@
public class AccountDetailAdvanced implements AccountDetail {
+ private static final String TAG = "AccountDetailAdvanced";
+ public static final String BUNDLE_TAG = "AdvancedPreferenceArrayList";
+
public static final String CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
public static final String CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.registrationExpire";
public static final String CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus";
@@ -60,7 +65,7 @@
public static final String CONFIG_STUN_SERVER = "STUN.server";
public static final String CONFIG_STUN_ENABLE = "STUN.enable";
- private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
+ private ArrayList<AccountDetail.PreferenceEntry> privateArray;
public static ArrayList<AccountDetail.PreferenceEntry> getPreferenceEntries()
{
@@ -91,55 +96,66 @@
public AccountDetailAdvanced()
{
- privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
-
- privateMap.put(CONFIG_ACCOUNT_REGISTRATION_EXPIRE,
- new PreferenceEntry(CONFIG_ACCOUNT_REGISTRATION_EXPIRE, R.string.account_registration_exp_label));
- privateMap.put(CONFIG_ACCOUNT_REGISTRATION_STATUS,
- new PreferenceEntry(CONFIG_ACCOUNT_REGISTRATION_STATUS, R.string.account_registration_status_label));
- privateMap.put(CONFIG_ACCOUNT_REGISTRATION_STATE_CODE,
- new PreferenceEntry(CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, R.string.account_registration_code_label));
- privateMap.put(CONFIG_ACCOUNT_REGISTRATION_STATE_DESC,
- new PreferenceEntry(CONFIG_ACCOUNT_REGISTRATION_STATE_DESC, R.string.account_registration_state_label));
- privateMap.put(CONFIG_CREDENTIAL_NUMBER,
- new PreferenceEntry(CONFIG_CREDENTIAL_NUMBER, R.string.account_credential_count_label));
- privateMap.put(CONFIG_ACCOUNT_DTMF_TYPE,
- new PreferenceEntry(CONFIG_ACCOUNT_DTMF_TYPE, R.string.account_config_dtmf_type_label));
- privateMap.put(CONFIG_RINGTONE_PATH,
- new PreferenceEntry(CONFIG_RINGTONE_PATH, R.string.account_ringtone_path_label));
- privateMap.put(CONFIG_RINGTONE_ENABLED,
- new PreferenceEntry(CONFIG_RINGTONE_ENABLED, R.string.account_ringtone_enabled_label, true));
- privateMap.put(CONFIG_KEEP_ALIVE_ENABLED,
- new PreferenceEntry(CONFIG_KEEP_ALIVE_ENABLED, R.string.account_keep_alive_label, true));
- privateMap.put(CONFIG_ACCOUNT_AUTOANSWER,
- new PreferenceEntry(CONFIG_ACCOUNT_AUTOANSWER, R.string.account_account_interface_label, true));
- privateMap.put(CONFIG_LOCAL_INTERFACE,
- new PreferenceEntry(CONFIG_LOCAL_INTERFACE, R.string.account_local_interface_label));
- privateMap.put(CONFIG_INTERFACE,
- new PreferenceEntry(CONFIG_INTERFACE, R.string.account_account_interface_label));
- privateMap.put(CONFIG_PUBLISHED_SAMEAS_LOCAL,
- new PreferenceEntry(CONFIG_PUBLISHED_SAMEAS_LOCAL, R.string.account_published_same_as_local_label, true));
- privateMap.put(CONFIG_LOCAL_PORT,
- new PreferenceEntry(CONFIG_LOCAL_PORT, R.string.account_local_port_label));
- privateMap.put(CONFIG_PUBLISHED_PORT,
- new PreferenceEntry(CONFIG_PUBLISHED_PORT, R.string.account_published_port_label));
- privateMap.put(CONFIG_PUBLISHED_ADDRESS,
- new PreferenceEntry(CONFIG_PUBLISHED_ADDRESS, R.string.account_published_address_label));
- privateMap.put(CONFIG_DISPLAY_NAME,
- new PreferenceEntry(CONFIG_DISPLAY_NAME, R.string.account_displayname_label));
- privateMap.put(CONFIG_STUN_SERVER,
- new PreferenceEntry(CONFIG_STUN_SERVER, R.string.account_stun_server_label));
- privateMap.put(CONFIG_STUN_ENABLE,
- new PreferenceEntry(CONFIG_STUN_ENABLE, R.string.account_stun_enable_label, true));
+ privateArray = getPreferenceEntries();
}
- public Set<String> getDetailKeys()
+ public AccountDetailAdvanced(HashMap<String, String> pref)
{
- return privateMap.keySet();
+ privateArray = getPreferenceEntries();
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ p.mValue = pref.get(p.mKey);
+ }
}
- public Collection<AccountDetail.PreferenceEntry> getDetailValues()
+ public AccountDetailAdvanced(ArrayList<String> pref)
{
- return privateMap.values();
+ privateArray = getPreferenceEntries();
+
+ if(pref.size() != privateArray.size()) {
+ Log.i(TAG, "Error list are not of equal size");
+ }
+ else {
+ int index = 0;
+ for(String s : pref) {
+ privateArray.get(index).mValue = s;
+ }
+ }
}
+
+ public ArrayList<AccountDetail.PreferenceEntry> getDetailValues()
+ {
+ return privateArray;
+ }
+
+ public ArrayList<String> getValuesOnly()
+ {
+ ArrayList<String> valueList = new ArrayList<String>();
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ valueList.add(p.mValue);
+ }
+
+ return valueList;
+ }
+
+ public String getDetailString(String key)
+ {
+ String value = "";
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ if(p.mKey.equals(key)) {
+ value = p.mValue;
+ return value;
+ }
+ }
+
+ return value;
+ }
+
+ public boolean getDetailBoolean()
+ {
+ return true;
+ }
+
}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java
index 046e4f5..97e42e9 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java
@@ -24,6 +24,8 @@
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.utils.AccountDetail;
+import android.util.Log;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
@@ -31,9 +33,12 @@
public class AccountDetailBasic implements AccountDetail {
+ private static final String TAG = "AccountDetailBasic";
+ public static final String BUNDLE_TAG = "BasicPreferenceArrayList";
+
+ public static final String CONFIG_ACCOUNT_ENABLE = "Account.enable";
public static final String CONFIG_ACCOUNT_TYPE = "Account.type";
public static final String CONFIG_ACCOUNT_ALIAS = "Account.alias";
- public static final String CONFIG_ACCOUNT_ENABLE = "Account.enable";
public static final String CONFIG_ACCOUNT_HOSTNAME = "Account.hostname";
public static final String CONFIG_ACCOUNT_USERNAME = "Account.username";
public static final String CONFIG_ACCOUNT_ROUTESET = "Account.routeset";
@@ -42,16 +47,15 @@
public static final String CONFIG_ACCOUNT_DEFAULT_REALM = "*";
public static final String CONFIG_ACCOUNT_USERAGENT = "Account.useragent";
- private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
-
+ private ArrayList<AccountDetail.PreferenceEntry> privateArray;
public static ArrayList<AccountDetail.PreferenceEntry> getPreferenceEntries()
{
ArrayList<AccountDetail.PreferenceEntry> preference = new ArrayList<AccountDetail.PreferenceEntry>();
+ preference.add(new PreferenceEntry(CONFIG_ACCOUNT_ENABLE, R.string.account_enabled_label, true));
preference.add(new PreferenceEntry(CONFIG_ACCOUNT_TYPE, R.string.account_type_label));
preference.add(new PreferenceEntry(CONFIG_ACCOUNT_ALIAS, R.string.account_alias_label));
- preference.add(new PreferenceEntry(CONFIG_ACCOUNT_ENABLE, R.string.account_enabled_label, true));
preference.add(new PreferenceEntry(CONFIG_ACCOUNT_HOSTNAME, R.string.account_hostname_label));
preference.add(new PreferenceEntry(CONFIG_ACCOUNT_USERNAME, R.string.account_username_label));
preference.add(new PreferenceEntry(CONFIG_ACCOUNT_ROUTESET, R.string.account_routeset_label));
@@ -65,37 +69,66 @@
public AccountDetailBasic()
{
- privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
-
- privateMap.put(CONFIG_ACCOUNT_TYPE,
- new PreferenceEntry(CONFIG_ACCOUNT_TYPE, R.string.account_type_label));
- privateMap.put(CONFIG_ACCOUNT_ALIAS,
- new PreferenceEntry(CONFIG_ACCOUNT_ALIAS, R.string.account_alias_label));
- privateMap.put(CONFIG_ACCOUNT_ENABLE,
- new PreferenceEntry(CONFIG_ACCOUNT_ENABLE, R.string.account_enabled_label, true));
- privateMap.put(CONFIG_ACCOUNT_HOSTNAME,
- new PreferenceEntry(CONFIG_ACCOUNT_HOSTNAME, R.string.account_hostname_label));
- privateMap.put(CONFIG_ACCOUNT_USERNAME,
- new PreferenceEntry(CONFIG_ACCOUNT_USERNAME, R.string.account_username_label));
- privateMap.put(CONFIG_ACCOUNT_ROUTESET,
- new PreferenceEntry(CONFIG_ACCOUNT_ROUTESET, R.string.account_routeset_label));
- privateMap.put(CONFIG_ACCOUNT_PASSWORD,
- new PreferenceEntry(CONFIG_ACCOUNT_PASSWORD, R.string.account_password_label));
- privateMap.put(CONFIG_ACCOUNT_REALM,
- new PreferenceEntry(CONFIG_ACCOUNT_REALM, R.string.account_realm_label));
- privateMap.put(CONFIG_ACCOUNT_DEFAULT_REALM,
- new PreferenceEntry(CONFIG_ACCOUNT_DEFAULT_REALM, R.string.account_useragent_label));
- privateMap.put(CONFIG_ACCOUNT_USERAGENT,
- new PreferenceEntry(CONFIG_ACCOUNT_USERAGENT, R.string.account_autoanswer_label));
+ privateArray = getPreferenceEntries();
}
- public Set<String> getDetailKeys()
+ public AccountDetailBasic(HashMap<String, String> pref)
{
- return privateMap.keySet();
+ privateArray = getPreferenceEntries();
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ p.mValue = pref.get(p.mKey);
+ }
}
- public Collection<AccountDetail.PreferenceEntry> getDetailValues()
+ public AccountDetailBasic(ArrayList<String> pref)
{
- return privateMap.values();
+ privateArray = getPreferenceEntries();
+
+ if(pref.size() != privateArray.size()) {
+ Log.i(TAG, "Error list are not of equal size");
+ }
+ else {
+ int index = 0;
+ for(String s : pref) {
+ privateArray.get(index).mValue = s;
+ index++;
+ }
+ }
+ }
+
+ public ArrayList<AccountDetail.PreferenceEntry> getDetailValues()
+ {
+ return privateArray;
+ }
+
+ public ArrayList<String> getValuesOnly()
+ {
+ ArrayList<String> valueList = new ArrayList<String>();
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ valueList.add(p.mValue);
+ }
+
+ return valueList;
+ }
+
+ public String getDetailString(String key)
+ {
+ String value = "";
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ if(p.mKey.equals(key)) {
+ value = p.mValue;
+ return value;
+ }
+ }
+
+ return value;
+ }
+
+ public boolean getDetailBoolean()
+ {
+ return true;
}
}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java
index 1122924..d205419 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java
@@ -24,6 +24,8 @@
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.utils.AccountDetail;
+import android.util.Log;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
@@ -31,6 +33,9 @@
public class AccountDetailSrtp implements AccountDetail{
+ private static final String TAG = "AccountDetailSrtp";
+ public static final String BUNDLE_TAG = "SrtpPreferenceArrayList";
+
public static final String CONFIG_SRTP_ENABLE = "SRTP.enable";
public static final String CONFIG_SRTP_KEY_EXCHANGE = "SRTP.keyExchange";
public static final String CONFIG_SRTP_ENCRYPTION_ALGO = "SRTP.encryptionAlgorithm"; // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8
@@ -40,7 +45,7 @@
public static final String CONFIG_ZRTP_NOT_SUPP_WARNING = "ZRTP.notSuppWarning";
public static final String CONFIG_ZRTP_DISPLAY_SAS_ONCE = "ZRTP.displaySasOnce";
- private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
+ private ArrayList<AccountDetail.PreferenceEntry> privateArray;
public static ArrayList<AccountDetail.PreferenceEntry> getPreferenceEntries()
{
@@ -60,33 +65,66 @@
public AccountDetailSrtp()
{
- privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
-
- privateMap.put(CONFIG_SRTP_ENABLE,
- new PreferenceEntry(CONFIG_SRTP_ENABLE, R.string.account_srtp_enabled_label, true));
- privateMap.put(CONFIG_SRTP_KEY_EXCHANGE,
- new PreferenceEntry(CONFIG_SRTP_KEY_EXCHANGE, R.string.account_srtp_exchange_label, true));
- privateMap.put(CONFIG_SRTP_ENCRYPTION_ALGO,
- new PreferenceEntry(CONFIG_SRTP_ENCRYPTION_ALGO, R.string.account_encryption_algo_label, true));
- privateMap.put(CONFIG_SRTP_RTP_FALLBACK,
- new PreferenceEntry(CONFIG_SRTP_RTP_FALLBACK, R.string.account_srtp_fallback_label, true));
- privateMap.put(CONFIG_ZRTP_HELLO_HASH,
- new PreferenceEntry(CONFIG_ZRTP_HELLO_HASH, R.string.account_hello_hash_enable_label, true));
- privateMap.put(CONFIG_ZRTP_DISPLAY_SAS,
- new PreferenceEntry(CONFIG_ZRTP_DISPLAY_SAS, R.string.account_display_sas_label, true));
- privateMap.put(CONFIG_ZRTP_NOT_SUPP_WARNING,
- new PreferenceEntry(CONFIG_ZRTP_NOT_SUPP_WARNING, R.string.account_not_supported_warning_label, true));
- privateMap.put(CONFIG_ZRTP_DISPLAY_SAS_ONCE,
- new PreferenceEntry(CONFIG_ZRTP_DISPLAY_SAS_ONCE, R.string.account_display_sas_once_label, true));
+ privateArray = getPreferenceEntries();
}
- public Set<String> getDetailKeys()
+ public AccountDetailSrtp(HashMap<String, String> pref)
{
- return privateMap.keySet();
+ privateArray = getPreferenceEntries();
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ p.mValue = pref.get(p.mKey);
+ }
}
- public Collection<AccountDetail.PreferenceEntry> getDetailValues()
+ public AccountDetailSrtp(ArrayList<String> pref)
{
- return privateMap.values();
+ privateArray = getPreferenceEntries();
+
+ if(pref.size() != privateArray.size()) {
+ Log.i(TAG, "Error list are not of equal size");
+ }
+ else {
+ int index = 0;
+ for(String s : pref) {
+ privateArray.get(index).mValue = s;
+ index++;
+ }
+ }
+ }
+
+ public ArrayList<AccountDetail.PreferenceEntry> getDetailValues()
+ {
+ return privateArray;
+ }
+
+ public ArrayList<String> getValuesOnly()
+ {
+ ArrayList<String> valueList = new ArrayList<String>();
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ valueList.add(p.mValue);
+ }
+
+ return valueList;
+ }
+
+ public String getDetailString(String key)
+ {
+ String value = "";
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ if(p.mKey.equals(key)) {
+ value = p.mValue;
+ return value;
+ }
+ }
+
+ return value;
+ }
+
+ public boolean getDetailBoolean()
+ {
+ return true;
}
}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java
index 03efcd0..bd2d6e5 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java
@@ -24,12 +24,17 @@
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.utils.AccountDetail;
+import android.util.Log;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
import java.util.HashMap;
public class AccountDetailTls implements AccountDetail {
+
+ private static final String TAG = "AccountDetailTls";
+ public static final String BUNDLE_TAG = "TlsPreferenceArrayList";
public static final String CONFIG_TLS_LISTENER_PORT = "TLS.listenerPort";
public static final String CONFIG_TLS_ENABLE = "TLS.enable";
@@ -46,7 +51,7 @@
public static final String CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
public static final String CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
- private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
+ private ArrayList<AccountDetail.PreferenceEntry> privateArray;
public static ArrayList<AccountDetail.PreferenceEntry> getPreferenceEntries()
{
@@ -72,45 +77,66 @@
public AccountDetailTls()
{
- privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
-
- privateMap.put(CONFIG_TLS_LISTENER_PORT,
- new PreferenceEntry(CONFIG_TLS_LISTENER_PORT, R.string.account_listener_port_label));
- privateMap.put(CONFIG_TLS_ENABLE,
- new PreferenceEntry(CONFIG_TLS_ENABLE, R.string.account_tls_enabled_label, true));
- privateMap.put(CONFIG_TLS_CA_LIST_FILE,
- new PreferenceEntry(CONFIG_TLS_CA_LIST_FILE, R.string.account_tls_certificate_list_label));
- privateMap.put(CONFIG_TLS_CERTIFICATE_FILE,
- new PreferenceEntry(CONFIG_TLS_CERTIFICATE_FILE, R.string.account_tls_certificate_file_label));
- privateMap.put(CONFIG_TLS_PRIVATE_KEY_FILE,
- new PreferenceEntry(CONFIG_TLS_PRIVATE_KEY_FILE, R.string.account_tls_private_key_file_label));
- privateMap.put(CONFIG_TLS_PASSWORD,
- new PreferenceEntry(CONFIG_TLS_PASSWORD, R.string.account_tls_password_label));
- privateMap.put(CONFIG_TLS_METHOD,
- new PreferenceEntry(CONFIG_TLS_METHOD, R.string.account_tls_method_label));
- privateMap.put(CONFIG_TLS_CIPHERS,
- new PreferenceEntry(CONFIG_TLS_CIPHERS, R.string.account_tls_ciphers_label));
- privateMap.put(CONFIG_TLS_SERVER_NAME,
- new PreferenceEntry(CONFIG_TLS_SERVER_NAME, R.string.account_tls_server_name_label));
- privateMap.put(CONFIG_TLS_VERIFY_SERVER,
- new PreferenceEntry(CONFIG_TLS_VERIFY_SERVER, R.string.account_tls_verify_label, true));
- privateMap.put(CONFIG_TLS_VERIFY_CLIENT,
- new PreferenceEntry(CONFIG_TLS_VERIFY_CLIENT, R.string.account_tls_verify_client_label, true));
- privateMap.put(CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE,
- new PreferenceEntry(CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE, R.string.account_tls_require_client_certificat_label, true));
- privateMap.put(CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC,
- new PreferenceEntry(CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC, R.string.account_tls_negotiation_timeout_sec));
- privateMap.put(CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC,
- new PreferenceEntry(CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC, R.string.account_tls_negotiation_timeout_msec));
- }
-
- public Set<String> getDetailKeys()
- {
- return privateMap.keySet();
+ privateArray = getPreferenceEntries();
}
- public Collection<AccountDetail.PreferenceEntry> getDetailValues()
+ public AccountDetailTls(HashMap<String, String> pref)
{
- return privateMap.values();
+ privateArray = getPreferenceEntries();
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ p.mValue = pref.get(p.mKey);
+ }
+ }
+
+ public AccountDetailTls(ArrayList<String> pref)
+ {
+ privateArray = getPreferenceEntries();
+
+ if(pref.size() != privateArray.size()) {
+ Log.i(TAG, "Error list are not of equal size");
+ }
+ else {
+ int index = 0;
+ for(String s : pref) {
+ privateArray.get(index).mValue = s;
+ index++;
+ }
+ }
+ }
+
+ public ArrayList<AccountDetail.PreferenceEntry> getDetailValues()
+ {
+ return privateArray;
+ }
+
+ public ArrayList<String> getValuesOnly()
+ {
+ ArrayList<String> valueList = new ArrayList<String>();
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ valueList.add(p.mValue);
+ }
+
+ return valueList;
+ }
+
+ public String getDetailString(String key)
+ {
+ String value = "";
+
+ for(AccountDetail.PreferenceEntry p : privateArray) {
+ if(p.mKey.equals(key)) {
+ value = p.mValue;
+ return value;
+ }
+ }
+
+ return value;
+ }
+
+ public boolean getDetailBoolean()
+ {
+ return true;
}
}