Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 1 | /** |
Alexandre Lision | c1024c0 | 2014-01-06 11:12:53 -0500 | [diff] [blame] | 2 | * Copyright (C) 2004-2014 Savoir-Faire Linux Inc. |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 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 | */ |
Alexandre Lision | 064e1e0 | 2013-10-01 16:18:42 -0400 | [diff] [blame] | 22 | package org.sflphone.account; |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 23 | |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 24 | import java.util.ArrayList; |
Alexandre Savard | 833616f | 2012-10-30 16:02:30 -0400 | [diff] [blame] | 25 | import java.util.HashMap; |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 26 | |
| 27 | public interface AccountDetail { |
| 28 | |
Alexandre Lision | c9c30b7 | 2013-11-18 16:27:26 -0500 | [diff] [blame] | 29 | public static final String TRUE_STR = "true"; |
| 30 | public static final String FALSE_STR = "false"; |
| 31 | |
alision | 5de9178 | 2013-07-10 10:47:30 -0400 | [diff] [blame] | 32 | public static class PreferenceEntry { |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 33 | public String mKey; |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 34 | public boolean isTwoState; |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 35 | public String mValue; |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 36 | |
Alexandre Lision | ab0cc9f | 2013-12-12 11:27:25 -0500 | [diff] [blame] | 37 | public PreferenceEntry(String key) { |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 38 | mKey = key; |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 39 | isTwoState = false; |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 40 | mValue = ""; |
alision | 5de9178 | 2013-07-10 10:47:30 -0400 | [diff] [blame] | 41 | |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 42 | } |
| 43 | |
Alexandre Lision | ab0cc9f | 2013-12-12 11:27:25 -0500 | [diff] [blame] | 44 | public PreferenceEntry(String key, boolean twoState) { |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 45 | mKey = key; |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 46 | isTwoState = twoState; |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 47 | mValue = ""; |
| 48 | } |
| 49 | |
Alexandre Lision | ab0cc9f | 2013-12-12 11:27:25 -0500 | [diff] [blame] | 50 | public PreferenceEntry(String key, boolean twoState, String value) { |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 51 | mKey = key; |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 52 | isTwoState = twoState; |
| 53 | mValue = value; |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 54 | } |
alision | 5de9178 | 2013-07-10 10:47:30 -0400 | [diff] [blame] | 55 | |
| 56 | public boolean isChecked() { |
| 57 | if (mValue.contentEquals("true")) |
| 58 | return true; |
| 59 | return false; |
| 60 | } |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 61 | } |
| 62 | |
alision | d9e2944 | 2013-04-17 16:10:18 -0400 | [diff] [blame] | 63 | public static final String TAG = "PreferenceHashMap"; |
| 64 | |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 65 | public ArrayList<PreferenceEntry> getDetailValues(); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 66 | |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 67 | public ArrayList<String> getValuesOnly(); |
| 68 | |
Alexandre Savard | 833616f | 2012-10-30 16:02:30 -0400 | [diff] [blame] | 69 | public HashMap<String, String> getDetailsHashMap(); |
| 70 | |
Alexandre Savard | 6883811 | 2012-10-30 11:34:43 -0400 | [diff] [blame] | 71 | public String getDetailString(String key); |
| 72 | |
alision | 5de9178 | 2013-07-10 10:47:30 -0400 | [diff] [blame] | 73 | public void setDetailString(String key, String newValue); |
Alexandre Savard | 833616f | 2012-10-30 16:02:30 -0400 | [diff] [blame] | 74 | |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 75 | } |