Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. |
| 3 | * |
| 4 | * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * If you own a pjsip commercial license you can also redistribute it |
| 11 | * and/or modify it under the terms of the GNU Lesser General Public License |
| 12 | * as an android library. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | */ |
| 22 | package com.savoirfairelinux.sflphone.utils; |
| 23 | |
| 24 | import com.savoirfairelinux.sflphone.R; |
| 25 | import com.savoirfairelinux.sflphone.utils.AccountDetail; |
| 26 | |
| 27 | import java.util.Collection; |
| 28 | import java.util.Set; |
| 29 | import java.util.HashMap; |
| 30 | |
| 31 | public class AccountDetailBasic implements AccountDetail { |
| 32 | |
| 33 | public static final String CONFIG_ACCOUNT_TYPE = "Account.type"; |
| 34 | public static final String CONFIG_ACCOUNT_ALIAS = "Account.alias"; |
| 35 | public static final String CONFIG_ACCOUNT_ENABLE = "Account.enable"; |
| 36 | public static final String CONFIG_ACCOUNT_HOSTNAME = "Account.hostname"; |
| 37 | public static final String CONFIG_ACCOUNT_USERNAME = "Account.username"; |
| 38 | public static final String CONFIG_ACCOUNT_ROUTESET = "Account.routeset"; |
| 39 | public static final String CONFIG_ACCOUNT_PASSWORD = "Account.password"; |
| 40 | public static final String CONFIG_ACCOUNT_REALM = "Account.realm"; |
| 41 | public static final String CONFIG_ACCOUNT_DEFAULT_REALM = "*"; |
| 42 | public static final String CONFIG_ACCOUNT_USERAGENT = "Account.useragent"; |
| 43 | |
| 44 | private HashMap<String, AccountDetail.PreferenceEntry> privateMap; |
| 45 | |
| 46 | public AccountDetailBasic() |
| 47 | { |
| 48 | privateMap = new HashMap<String, AccountDetail.PreferenceEntry>(); |
| 49 | |
| 50 | privateMap.put(CONFIG_ACCOUNT_TYPE, |
| 51 | new PreferenceEntry(CONFIG_ACCOUNT_TYPE, R.string.account_type_label)); |
| 52 | privateMap.put(CONFIG_ACCOUNT_ALIAS, |
| 53 | new PreferenceEntry(CONFIG_ACCOUNT_ALIAS, R.string.account_alias_label)); |
| 54 | privateMap.put(CONFIG_ACCOUNT_ENABLE, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 55 | new PreferenceEntry(CONFIG_ACCOUNT_ENABLE, R.string.account_enabled_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 56 | privateMap.put(CONFIG_ACCOUNT_HOSTNAME, |
| 57 | new PreferenceEntry(CONFIG_ACCOUNT_HOSTNAME, R.string.account_hostname_label)); |
| 58 | privateMap.put(CONFIG_ACCOUNT_USERNAME, |
| 59 | new PreferenceEntry(CONFIG_ACCOUNT_USERNAME, R.string.account_username_label)); |
| 60 | privateMap.put(CONFIG_ACCOUNT_ROUTESET, |
| 61 | new PreferenceEntry(CONFIG_ACCOUNT_ROUTESET, R.string.account_routeset_label)); |
| 62 | privateMap.put(CONFIG_ACCOUNT_PASSWORD, |
| 63 | new PreferenceEntry(CONFIG_ACCOUNT_PASSWORD, R.string.account_password_label)); |
| 64 | privateMap.put(CONFIG_ACCOUNT_REALM, |
| 65 | new PreferenceEntry(CONFIG_ACCOUNT_REALM, R.string.account_realm_label)); |
| 66 | privateMap.put(CONFIG_ACCOUNT_DEFAULT_REALM, |
| 67 | new PreferenceEntry(CONFIG_ACCOUNT_DEFAULT_REALM, R.string.account_useragent_label)); |
| 68 | privateMap.put(CONFIG_ACCOUNT_USERAGENT, |
| 69 | new PreferenceEntry(CONFIG_ACCOUNT_USERAGENT, R.string.account_autoanswer_label)); |
| 70 | } |
| 71 | |
| 72 | public Set<String> getDetailKeys() |
| 73 | { |
| 74 | return privateMap.keySet(); |
| 75 | } |
| 76 | |
| 77 | public Collection<AccountDetail.PreferenceEntry> getDetailValues() |
| 78 | { |
| 79 | return privateMap.values(); |
| 80 | } |
| 81 | } |