* #23362 First implementation of History
Swip wrapper created -> VectMap
Added new layout, adapter, handler for history
* #23361 Small fix
Modified Default value in res/xml/account_creation_preferences.xml eth0 -> wlan0
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6c6345f..bd695be 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -34,8 +34,8 @@
android:versionName="1.0" >
<uses-sdk
- android:minSdkVersion="13"
- android:targetSdkVersion="15" />
+ android:minSdkVersion="11"
+ android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
@@ -46,6 +46,8 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".client.SFLphoneApplication"
diff --git a/bin/AndroidManifest.xml b/bin/AndroidManifest.xml
index 6c6345f..bd695be 100644
--- a/bin/AndroidManifest.xml
+++ b/bin/AndroidManifest.xml
@@ -34,8 +34,8 @@
android:versionName="1.0" >
<uses-sdk
- android:minSdkVersion="13"
- android:targetSdkVersion="15" />
+ android:minSdkVersion="11"
+ android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
@@ -46,6 +46,8 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".client.SFLphoneApplication"
diff --git a/res/layout/activity_sflphone_home.xml b/res/layout/activity_sflphone_home.xml
index 22f8022..424ecff 100644
--- a/res/layout/activity_sflphone_home.xml
+++ b/res/layout/activity_sflphone_home.xml
@@ -46,49 +46,11 @@
android:orientation="horizontal" >
<android.support.v4.view.ViewPager
- xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
- <EditText
- android:id="@+id/phoneNumberTextEntry"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:inputType="phone"
- android:hint="Type phone number"
- android:layout_below="@+id/buttonCall"/>
- <LinearLayout
- android:id="@+id/callButtonLayout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="0.5"
- android:gravity="center_horizontal"
- android:orientation="horizontal" >
- <ImageButton
- android:id="@+id/buttonCall"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight=".5"
- android:layout_margin="10dp"
- android:background="@drawable/call_button"
- android:gravity="center_vertical"
- android:onClick="onClick"
- android:src="@drawable/ic_call" />
-
- <ImageButton
- android:id="@+id/buttonHangUp"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight=".5"
- android:layout_margin="10dp"
- android:background="@drawable/hangup_button"
- android:gravity="center_vertical"
- android:onClick="onClick"
- android:src="@drawable/ic_hangup" />
- </LinearLayout>
-
-</LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/frag_call_element.xml b/res/layout/frag_call_element.xml
index 5f5bd84..bb4cbf4 100644
--- a/res/layout/frag_call_element.xml
+++ b/res/layout/frag_call_element.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!--
+<!--
Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
Author: Adrien Beraud <adrien.beraud@gmail.com>
@@ -28,34 +28,54 @@
Corresponding Source for a non-source form of such a combination
shall include the source code for the parts of OpenSSL used as well
as that of the covered work.
- -->
+-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:paddingLeft="8dp"
- android:paddingRight="8dp" >
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp" >
<com.savoirfairelinux.sflphone.account.AccountSelectionSpinner
android:id="@+id/account_selection_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <ListView
+ android:id="@id/android:list"
+ style="@style/CallElementList"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_width="match_parent"/>
+ android:layout_above="@+id/phoneNumberTextEntry"
+ android:layout_below="@+id/account_selection_button"
+ android:drawSelectorOnTop="false" />
- <ListView
- android:id="@id/android:list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- style="@style/CallElementList"
- android:drawSelectorOnTop="false" />
+ <TextView
+ android:id="@id/android:empty"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_centerInParent="true"
+ android:gravity="center"
+ android:text="No data" />
- <TextView
- android:id="@id/android:empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center"
- android:gravity="center"
- android:text="No data" />
+ <EditText
+ android:id="@+id/phoneNumberTextEntry"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/buttonCall"
+ android:hint="Type phone number"
+ android:inputType="phone" />
-</LinearLayout>
+ <ImageButton
+ android:id="@+id/buttonCall"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_margin="10dp"
+ android:background="@drawable/call_button"
+ android:gravity="center_vertical"
+ android:onClick="onClick"
+ android:src="@drawable/ic_call" />
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/frag_history.xml b/res/layout/frag_history.xml
new file mode 100644
index 0000000..ab2e1ae
--- /dev/null
+++ b/res/layout/frag_history.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <ListView
+ android:id="@id/android:list"
+ style="@style/CallElementList"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:drawSelectorOnTop="false" />
+
+ <TextView
+ android:id="@id/android:empty"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:text="No history" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/xml/account_creation_preferences.xml b/res/xml/account_creation_preferences.xml
index e726149..3c06f2c 100644
--- a/res/xml/account_creation_preferences.xml
+++ b/res/xml/account_creation_preferences.xml
@@ -173,16 +173,16 @@
android:id="@+id/account_creation_local_interface"
android:key="Account.localInterface"
android:persistent="false"
- android:defaultValue="eth0"
+ android:defaultValue="wlan0"
android:title="Local Interface"
- android:summary="eth0"/>
+ android:summary="wlan0"/>
<EditTextPreference
android:id="@+id/account_creation_interface"
android:key="Account.interface"
android:persistent="false"
- android:defaultValue="eht0"
+ android:defaultValue="wlan0"
android:title="Interface"
- android:summary="eth0"/>
+ android:summary="wlan0"/>
<CheckBoxPreference
android:id="@+id/account_creation_published_sameas_local"
android:key="Account.publishedSameAsLocal"
diff --git a/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java b/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java
new file mode 100644
index 0000000..a52aec6
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java
@@ -0,0 +1,228 @@
+package com.savoirfairelinux.sflphone.account;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import android.util.Log;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.service.ServiceConstants;
+import com.savoirfairelinux.sflphone.service.StringMap;
+import com.savoirfairelinux.sflphone.service.VectMap;
+
+public class HistoryHandler {
+ private static final String TAG = HistoryHandler.class.getSimpleName();
+
+ public static class PreferenceEntry {
+ public String mKey;
+ public int mLabelId;
+
+ public PreferenceEntry(String key, int labelId) {
+ mKey = key;
+ mLabelId = labelId;
+ }
+ }
+
+ public static ArrayList<PreferenceEntry> getBasicDetailsKeys() {
+ ArrayList<PreferenceEntry> basicDetailKeys = new ArrayList<PreferenceEntry>();
+
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_TYPE, R.string.account_type_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_ALIAS, R.string.account_alias_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_ENABLE, R.string.account_enabled_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME, R.string.account_hostname_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_USERNAME, R.string.account_username_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_ROUTESET, R.string.account_routeset_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_PASSWORD, R.string.account_password_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_REALM, R.string.account_realm_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_DEFAULT_REALM, R.string.account_useragent_label));
+ basicDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_USERAGENT, R.string.account_autoanswer_label));
+
+ return basicDetailKeys;
+ }
+
+ public static ArrayList<PreferenceEntry> getAdvancedDetailsKeys() {
+ ArrayList<PreferenceEntry> advancedDetailKeys = new ArrayList<PreferenceEntry>();
+
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE, R.string.account_registration_exp_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS, R.string.account_registration_status_label));
+ advancedDetailKeys
+ .add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, R.string.account_registration_code_label));
+ advancedDetailKeys
+ .add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_DESC, R.string.account_registration_state_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_CREDENTIAL_NUMBER, R.string.account_credential_count_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_DTMF_TYPE, R.string.account_config_dtmf_type_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_RINGTONE_PATH, R.string.account_ringtone_path_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_RINGTONE_ENABLED, R.string.account_ringtone_enabled_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_KEEP_ALIVE_ENABLED, R.string.account_keep_alive_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ACCOUNT_AUTOANSWER, R.string.account_account_interface_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_LOCAL_INTERFACE, R.string.account_local_interface_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_INTERFACE, R.string.account_account_interface_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_PUBLISHED_SAMEAS_LOCAL, R.string.account_published_same_as_local_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_LOCAL_PORT, R.string.account_local_port_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_PUBLISHED_PORT, R.string.account_published_port_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_PUBLISHED_ADDRESS, R.string.account_published_address_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_DISPLAY_NAME, R.string.account_displayname_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_STUN_SERVER, R.string.account_stun_server_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_STUN_ENABLE, R.string.account_stun_enable_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_SRTP_ENABLE, R.string.account_srtp_enabled_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_SRTP_KEY_EXCHANGE, R.string.account_srtp_exchange_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_SRTP_ENCRYPTION_ALGO, R.string.account_encryption_algo_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_SRTP_RTP_FALLBACK, R.string.account_srtp_fallback_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ZRTP_HELLO_HASH, R.string.account_hello_hash_enable_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ZRTP_DISPLAY_SAS, R.string.account_display_sas_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ZRTP_NOT_SUPP_WARNING, R.string.account_not_supported_warning_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_ZRTP_DISPLAY_SAS_ONCE, R.string.account_display_sas_once_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_LISTENER_PORT, R.string.account_listener_port_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_ENABLE, R.string.account_tls_enabled_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_CA_LIST_FILE, R.string.account_tls_certificate_list_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_CERTIFICATE_FILE, R.string.account_tls_certificate_file_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_PRIVATE_KEY_FILE, R.string.account_tls_private_key_file_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_PASSWORD, R.string.account_tls_password_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_METHOD, R.string.account_tls_method_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_CIPHERS, R.string.account_tls_ciphers_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_SERVER_NAME, R.string.account_tls_server_name_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_VERIFY_SERVER, R.string.account_tls_verify_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_VERIFY_CLIENT, R.string.account_tls_verify_client_label));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE,
+ R.string.account_tls_require_client_certificat_label));
+ advancedDetailKeys
+ .add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC, R.string.account_tls_negotiation_timeout_sec));
+ advancedDetailKeys.add(new PreferenceEntry(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC,
+ R.string.account_tls_negotiation_timeout_msec));
+
+ return advancedDetailKeys;
+ }
+
+ public static StringMap convertFromNativeToSwig(HashMap<String, String> nativemap) {
+ StringMap swigmap = new StringMap();
+
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_ALIAS, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_USERNAME, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_USERNAME));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_PASSWORD, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_PASSWORD));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_ROUTESET, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_ROUTESET));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE));
+
+ swigmap.set(ServiceConstants.CONFIG_LOCAL_INTERFACE, nativemap.get(ServiceConstants.CONFIG_LOCAL_INTERFACE));
+ swigmap.set(ServiceConstants.CONFIG_STUN_SERVER, nativemap.get(ServiceConstants.CONFIG_STUN_SERVER));
+ swigmap.set(ServiceConstants.CONFIG_TLS_ENABLE, nativemap.get(ServiceConstants.CONFIG_TLS_ENABLE));
+ swigmap.set(ServiceConstants.CONFIG_SRTP_ENABLE, nativemap.get(ServiceConstants.CONFIG_SRTP_ENABLE));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_TYPE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_TYPE));
+
+ // swigmap.set(ServiceConstants.CONFIG_ACCOUNT_MAILBOX, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_MAILBOX));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_ENABLE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_ENABLE));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_DESC, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_DESC));
+
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_AUTOANSWER, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_AUTOANSWER));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_DTMF_TYPE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_DTMF_TYPE));
+ swigmap.set(ServiceConstants.CONFIG_KEEP_ALIVE_ENABLED, nativemap.get(ServiceConstants.CONFIG_KEEP_ALIVE_ENABLED));
+ swigmap.set(ServiceConstants.CONFIG_LOCAL_PORT, nativemap.get(ServiceConstants.CONFIG_LOCAL_PORT));
+ swigmap.set(ServiceConstants.CONFIG_PUBLISHED_ADDRESS, nativemap.get(ServiceConstants.CONFIG_PUBLISHED_ADDRESS));
+
+ swigmap.set(ServiceConstants.CONFIG_PUBLISHED_PORT, nativemap.get(ServiceConstants.CONFIG_PUBLISHED_PORT));
+ swigmap.set(ServiceConstants.CONFIG_PUBLISHED_SAMEAS_LOCAL, nativemap.get(ServiceConstants.CONFIG_PUBLISHED_SAMEAS_LOCAL));
+ swigmap.set(ServiceConstants.CONFIG_RINGTONE_ENABLED, nativemap.get(ServiceConstants.CONFIG_RINGTONE_ENABLED));
+ swigmap.set(ServiceConstants.CONFIG_RINGTONE_PATH, nativemap.get(ServiceConstants.CONFIG_RINGTONE_PATH));
+ swigmap.set(ServiceConstants.CONFIG_ACCOUNT_USERAGENT, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_USERAGENT));
+
+ swigmap.set(ServiceConstants.CONFIG_SRTP_KEY_EXCHANGE, nativemap.get(ServiceConstants.CONFIG_SRTP_KEY_EXCHANGE));
+ swigmap.set(ServiceConstants.CONFIG_SRTP_RTP_FALLBACK, nativemap.get(ServiceConstants.CONFIG_SRTP_RTP_FALLBACK));
+ swigmap.set(ServiceConstants.CONFIG_STUN_ENABLE, nativemap.get(ServiceConstants.CONFIG_STUN_ENABLE));
+ swigmap.set(ServiceConstants.CONFIG_TLS_CERTIFICATE_FILE, nativemap.get(ServiceConstants.CONFIG_TLS_CERTIFICATE_FILE));
+ swigmap.set(ServiceConstants.CONFIG_TLS_CA_LIST_FILE, nativemap.get(ServiceConstants.CONFIG_TLS_CA_LIST_FILE));
+
+ swigmap.set(ServiceConstants.CONFIG_TLS_CIPHERS, nativemap.get(ServiceConstants.CONFIG_TLS_CIPHERS));
+ swigmap.set(ServiceConstants.CONFIG_TLS_LISTENER_PORT, nativemap.get(ServiceConstants.CONFIG_TLS_LISTENER_PORT));
+ swigmap.set(ServiceConstants.CONFIG_TLS_METHOD, nativemap.get(ServiceConstants.CONFIG_TLS_METHOD));
+ // swigmap.set(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC, nativemap.get(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC));
+ // swigmap.set(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC, nativemap.get(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC));
+
+ swigmap.set(ServiceConstants.CONFIG_TLS_PASSWORD, nativemap.get(ServiceConstants.CONFIG_TLS_PASSWORD));
+ swigmap.set(ServiceConstants.CONFIG_TLS_PRIVATE_KEY_FILE, nativemap.get(ServiceConstants.CONFIG_TLS_PRIVATE_KEY_FILE));
+ swigmap.set(ServiceConstants.CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE, nativemap.get(ServiceConstants.CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE));
+ swigmap.set(ServiceConstants.CONFIG_TLS_SERVER_NAME, nativemap.get(ServiceConstants.CONFIG_TLS_SERVER_NAME));
+ swigmap.set(ServiceConstants.CONFIG_TLS_VERIFY_CLIENT, nativemap.get(ServiceConstants.CONFIG_TLS_VERIFY_CLIENT));
+
+ swigmap.set(ServiceConstants.CONFIG_TLS_VERIFY_SERVER, nativemap.get(ServiceConstants.CONFIG_TLS_VERIFY_SERVER));
+ swigmap.set(ServiceConstants.CONFIG_ZRTP_DISPLAY_SAS, nativemap.get(ServiceConstants.CONFIG_ZRTP_DISPLAY_SAS));
+ swigmap.set(ServiceConstants.CONFIG_ZRTP_DISPLAY_SAS_ONCE, nativemap.get(ServiceConstants.CONFIG_ZRTP_DISPLAY_SAS_ONCE));
+ swigmap.set(ServiceConstants.CONFIG_ZRTP_HELLO_HASH, nativemap.get(ServiceConstants.CONFIG_ZRTP_HELLO_HASH));
+ swigmap.set(ServiceConstants.CONFIG_ZRTP_NOT_SUPP_WARNING, nativemap.get(ServiceConstants.CONFIG_ZRTP_NOT_SUPP_WARNING));
+
+ return swigmap;
+ }
+
+ public static ArrayList<HashMap<String, String>> convertSwigToNative(VectMap swigmap) {
+
+ ArrayList<HashMap<String, String>> nativemap = new ArrayList<HashMap<String, String>>();
+
+ Log.w(TAG, "size history " + swigmap.size());
+
+ for (int i = 0; i < swigmap.size(); ++i) {
+ HashMap<String, String> entry = new HashMap<String, String>();
+
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_ACCOUNT_ID_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_CALLID_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_CONFID_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_DISPLAY_NAME_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_PEER_NUMBER_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_RECORDING_PATH_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_STATE_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_TIMESTAMP_START_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_TIMESTAMP_STOP_KEY));
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_AUDIO_CODEC_KEY));
+ try {
+ if(swigmap.get(i).get(ServiceConstants.HISTORY_MISSED_STRING) != null)
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_MISSED_STRING));
+ if(swigmap.get(i).get(ServiceConstants.HISTORY_INCOMING_STRING) != null)
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_INCOMING_STRING));
+ if(swigmap.get(i).get(ServiceConstants.HISTORY_OUTGOING_STRING) != null)
+ Log.i(TAG, swigmap.get(i).get(ServiceConstants.HISTORY_OUTGOING_STRING));
+
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+
+ entry.put(ServiceConstants.HISTORY_ACCOUNT_ID_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_ACCOUNT_ID_KEY));
+ entry.put(ServiceConstants.HISTORY_CALLID_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_CALLID_KEY));
+ entry.put(ServiceConstants.HISTORY_CONFID_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_CONFID_KEY));
+ entry.put(ServiceConstants.HISTORY_DISPLAY_NAME_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_DISPLAY_NAME_KEY));
+ entry.put(ServiceConstants.HISTORY_PEER_NUMBER_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_PEER_NUMBER_KEY));
+ entry.put(ServiceConstants.HISTORY_RECORDING_PATH_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_RECORDING_PATH_KEY));
+ entry.put(ServiceConstants.HISTORY_STATE_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_STATE_KEY));
+ entry.put(ServiceConstants.HISTORY_TIMESTAMP_START_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_TIMESTAMP_START_KEY));
+ entry.put(ServiceConstants.HISTORY_TIMESTAMP_STOP_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_TIMESTAMP_STOP_KEY));
+ entry.put(ServiceConstants.HISTORY_AUDIO_CODEC_KEY, swigmap.get(i).get(ServiceConstants.HISTORY_AUDIO_CODEC_KEY));
+
+ try {
+ if(swigmap.get(i).get(ServiceConstants.HISTORY_MISSED_STRING) != null)
+ entry.put(ServiceConstants.HISTORY_MISSED_STRING, swigmap.get(i).get(ServiceConstants.HISTORY_MISSED_STRING));
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+ try {
+ if(swigmap.get(i).get(ServiceConstants.HISTORY_INCOMING_STRING) != null)
+ entry.put(ServiceConstants.HISTORY_INCOMING_STRING, swigmap.get(i).get(ServiceConstants.HISTORY_INCOMING_STRING));
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+ try {
+ if(swigmap.get(i).get(ServiceConstants.HISTORY_OUTGOING_STRING) != null)
+ entry.put(ServiceConstants.HISTORY_OUTGOING_STRING, swigmap.get(i).get(ServiceConstants.HISTORY_OUTGOING_STRING));
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+
+
+
+
+
+
+ nativemap.add(entry);
+ }
+
+ return nativemap;
+ }
+}
\ No newline at end of file
diff --git a/src/com/savoirfairelinux/sflphone/adapters/HistoryAdapter.java b/src/com/savoirfairelinux/sflphone/adapters/HistoryAdapter.java
new file mode 100644
index 0000000..8fc7d22
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/adapters/HistoryAdapter.java
@@ -0,0 +1,99 @@
+package com.savoirfairelinux.sflphone.adapters;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.adapters.CallElementAdapter.CallElementView;
+import com.savoirfairelinux.sflphone.model.SipCall;
+import com.savoirfairelinux.sflphone.service.ServiceConstants;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class HistoryAdapter extends BaseAdapter{
+
+ Context mContext;
+ ArrayList<HashMap<String, String>> dataset;
+
+
+ public HistoryAdapter(Activity activity, ArrayList<HashMap<String, String>> entries) {
+ mContext = activity;
+ dataset = entries;
+ }
+
+ @Override
+ public View getView(int pos, View convertView, ViewGroup arg2) {
+ View rowView = convertView;
+ HistoryView entryView = null;
+
+ if (rowView == null) {
+ // Get a new instance of the row layout view
+ LayoutInflater inflater = LayoutInflater.from(mContext);
+ rowView = inflater.inflate(R.layout.item_contact, null);
+
+ // Hold the view objects in an object
+ // so they don't need to be re-fetched
+ entryView = new HistoryView();
+ entryView.displayName = (TextView) rowView.findViewById(R.id.display_name);
+
+ rowView.setTag(entryView);
+ } else {
+ entryView = (HistoryView) rowView.getTag();
+ }
+
+ // Transfer the stock data from the data object
+ // to the view objects
+
+// SipCall call = (SipCall) mCallList.values().toArray()[position];
+ entryView.displayName.setText(dataset.get(pos).get(ServiceConstants.HISTORY_ACCOUNT_ID_KEY));
+// entryView.phones.setText(call.getPhone());
+// entryView.state.setText(CURRENT_STATE_LABEL + call.getCallStateString());
+
+ return rowView;
+
+ }
+
+ /*********************
+ * ViewHolder Pattern
+ *********************/
+ public class HistoryView {
+ protected ImageView photo;
+ protected TextView displayName;
+ protected TextView phones;
+ public TextView state;
+ }
+
+ @Override
+ public int getCount() {
+
+ return dataset.size();
+ }
+
+ @Override
+ public HashMap<String, String> getItem(int pos) {
+ return dataset.get(pos);
+ }
+
+ @Override
+ public long getItemId(int arg0) {
+ return 0;
+ }
+
+ public void clear() {
+ dataset.clear();
+
+ }
+
+ public void addAll(ArrayList<HashMap<String, String>> history) {
+ dataset.addAll(history);
+
+ }
+
+}
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java b/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
index a11b80c..e682b2b 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
@@ -43,6 +43,7 @@
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.util.Log;
@@ -115,10 +116,10 @@
srtpDetails = new AccountDetailSrtp();
tlsDetails = new AccountDetailTls();
- addPreferenceListener(basicDetails);
- addPreferenceListener(advancedDetails);
- addPreferenceListener(srtpDetails);
- addPreferenceListener(tlsDetails);
+ addPreferenceListener(basicDetails, changeBasicPreferenceListener);
+ addPreferenceListener(advancedDetails, changeAdvancedPreferenceListener);
+ addPreferenceListener(srtpDetails, changeSrtpPreferenceListener);
+ addPreferenceListener(tlsDetails, changeTlsPreferenceListener);
}
@@ -141,10 +142,10 @@
setPreferenceDetails(srtpDetails);
setPreferenceDetails(tlsDetails);
- addPreferenceListener(basicDetails);
- addPreferenceListener(advancedDetails);
- addPreferenceListener(srtpDetails);
- addPreferenceListener(tlsDetails);
+ addPreferenceListener(basicDetails, changeBasicPreferenceListener);
+ addPreferenceListener(advancedDetails, changeAdvancedPreferenceListener);
+ addPreferenceListener(srtpDetails, changeSrtpPreferenceListener);
+ addPreferenceListener(tlsDetails, changeTlsPreferenceListener);
}
@Override
@@ -274,6 +275,30 @@
}
};
+ Preference.OnPreferenceChangeListener changeAdvancedPreferenceListener = new Preference.OnPreferenceChangeListener() {
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ preference.setSummary((CharSequence) newValue);
+ advancedDetails.setDetailString(preference.getOrder(), ((CharSequence) newValue).toString());
+ return true;
+ }
+ };
+
+ Preference.OnPreferenceChangeListener changeTlsPreferenceListener = new Preference.OnPreferenceChangeListener() {
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ preference.setSummary((CharSequence) newValue);
+ tlsDetails.setDetailString(preference.getOrder(), ((CharSequence) newValue).toString());
+ return true;
+ }
+ };
+
+ Preference.OnPreferenceChangeListener changeSrtpPreferenceListener = new Preference.OnPreferenceChangeListener() {
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ preference.setSummary((CharSequence) newValue);
+ srtpDetails.setDetailString(preference.getOrder(), ((CharSequence) newValue).toString());
+ return true;
+ }
+ };
+
private void setPreferenceDetails(AccountDetail details) {
for (AccountDetail.PreferenceEntry p : details.getDetailValues()) {
Preference pref = mPreferenceManager.findPreference(p.mKey);
@@ -286,12 +311,12 @@
}
}
- private void addPreferenceListener(AccountDetail details) {
+ private void addPreferenceListener(AccountDetail details, OnPreferenceChangeListener listener) {
for (AccountDetail.PreferenceEntry p : details.getDetailValues()) {
Preference pref = mPreferenceManager.findPreference(p.mKey);
if (pref != null) {
if (!p.isTwoState) {
- pref.setOnPreferenceChangeListener(changeBasicPreferenceListener);
+ pref.setOnPreferenceChangeListener(listener);
}
}
}
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
index 34d3ab5..39af89f 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
@@ -30,8 +30,6 @@
*/
package com.savoirfairelinux.sflphone.client;
-import java.util.Random;
-
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
@@ -50,13 +48,9 @@
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.EditText;
import android.widget.ImageButton;
import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.client.receiver.CallListReceiver;
import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
import com.savoirfairelinux.sflphone.fragments.ContactListFragment;
import com.savoirfairelinux.sflphone.fragments.HistoryFragment;
@@ -66,7 +60,7 @@
import com.savoirfairelinux.sflphone.service.ISipService;
import com.savoirfairelinux.sflphone.service.SipService;
-public class SFLPhoneHomeActivity extends Activity implements ActionBar.TabListener, CallElementListFragment.Callbacks {
+public class SFLPhoneHomeActivity extends Activity implements ActionBar.TabListener, CallElementListFragment.Callbacks, HistoryFragment.Callbacks {
SectionsPagerAdapter mSectionsPagerAdapter = null;
static final String TAG = "SFLPhoneHome";
private static final int REQUEST_CODE_PREFERENCES = 1;
@@ -76,9 +70,6 @@
private HistoryFragment mHistorySectionFragment = null;
private boolean mBound = false;
private ISipService service;
- // public AccountListReceiver mAccountList;
- // public CallListReceiver mCallList = new CallListReceiver(this);
- private SFLphoneApplication mApplication;
private static final int ACTION_BAR_TAB_CONTACT = 0;
private static final int ACTION_BAR_TAB_CALL = 1;
@@ -102,7 +93,7 @@
/* putFragment (Bundle bundle, String key, Fragment fragment) */
getFragmentManager().putFragment(bundle, mSectionsPagerAdapter.getClassName(i), mSectionsPagerAdapter.getFragment(i));
} catch (IllegalStateException e) {
- Log.e(TAG, "IllegalStateException: fragment=" + mSectionsPagerAdapter.getFragment(i));
+ Log.e(TAG, e.toString()+"fragment=" + mSectionsPagerAdapter.getFragment(i));
}
}
Log.w(TAG, "onSaveInstanceState()");
@@ -112,8 +103,6 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mApplication = (SFLphoneApplication) getApplication();
-
// Bind to LocalService
if (!mBound) {
Log.i(TAG, "onStart: Binding service...");
@@ -180,23 +169,13 @@
actionBar.setSelectedNavigationItem(ACTION_BAR_TAB_CALL);
- buttonCall = (ImageButton) findViewById(R.id.buttonCall);
- buttonHangup = (ImageButton) findViewById(R.id.buttonHangUp);
-
- buttonCall.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- processingNewCallAction();
- }
- });
-
- buttonHangup.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- processingHangUpAction();
-
- }
- });
+ // buttonHangup.setOnClickListener(new OnClickListener() {
+ // @Override
+ // public void onClick(View v) {
+ // processingHangUpAction();
+ //
+ // }
+ // });
// IntentFilter callFilter = new IntentFilter(CallManagerCallBack.NEW_CALL_CREATED);
// callFilter.addAction(CallManagerCallBack.INCOMING_CALL);
@@ -210,7 +189,7 @@
accountFilter.addAction(ConfigurationManagerCallback.ACCOUNT_STATE_CHANGED);
// LocalBroadcastManager.getInstance(this).registerReceiver(mAccountList, accountFilter);
-// SipCall.setSFLPhoneHomeContext(this);
+ // SipCall.setSFLPhoneHomeContext(this);
}
@Override
@@ -260,9 +239,8 @@
super.onDestroy();
}
-
- public void launchCallActivity(SipCall.CallInfo infos)
- {
+
+ public void launchCallActivity(SipCall.CallInfo infos) {
Log.i(TAG, "Launch Call Activity");
Bundle bundle = new Bundle();
bundle.putParcelable("CallInfo", infos);
@@ -280,7 +258,7 @@
public void incomingCall(Intent call) throws RemoteException {
Log.i(TAG, "Incoming call transfered from Service");
SipCall.CallInfo infos = new SipCall.CallInfo(call);
-
+
SipCall c = new SipCall(infos);
mCallElementList.addCall(c);
}
@@ -290,7 +268,7 @@
Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
String cID = b.getString("CallID");
String state = b.getString("State");
- Log.i(TAG,"callStateChanged"+cID+" "+state);
+ Log.i(TAG, "callStateChanged" + cID + " " + state);
mCallElementList.updateCall(cID, state);
}
@@ -300,20 +278,22 @@
public void onServiceConnected(ComponentName className, IBinder binder) {
service = ISipService.Stub.asInterface(binder);
+
+ mBound = true;
+ mCallElementList.onServiceSipBinded(service);
+ mHistorySectionFragment.onServiceSipBinded(service);
+ Log.d(TAG, "Service connected service=" + service);
+
try {
service.registerClient(callback);
} catch (RemoteException e) {
Log.e(TAG, e.toString());
}
- mApplication.setSipService(service);
- mBound = true;
- mCallElementList.onServiceSipBinded(service);
- Log.d(TAG, "Service connected service=" + service);
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
- mApplication.setSipService(null);
+
mBound = false;
Log.d(TAG, "Service disconnected service=" + service);
}
@@ -363,36 +343,6 @@
// Log.d(TAG, "onTabReselected");
}
-
- public void processingNewCallAction() {
- // String accountID = mAccountList.currentAccountID;
- Log.w(TAG, "processingNewCallAction() mCallElementList=" + mCallElementList);
- String accountID = mCallElementList.getSelectedAccount();
- EditText editText = (EditText) findViewById(R.id.phoneNumberTextEntry);
- String to = editText.getText().toString();
-
- Random random = new Random();
- String callID = Integer.toString(random.nextInt());
- SipCall.CallInfo info = new SipCall.CallInfo();
-
- info.mCallID = callID;
- info.mAccountID = accountID;
- info.mDisplayName = "Cool Guy!";
- info.mPhone = to;
- info.mEmail = "coolGuy@coolGuy.com";
- info.mCallType = SipCall.CALL_TYPE_OUTGOING;
-
- SipCall call = CallListReceiver.getCallInstance(info);
- launchCallActivity(call.mCallInfo);
-
- try {
- service.placeCall(info.mAccountID, info.mCallID, info.mPhone);
- } catch (RemoteException e) {
- Log.e(TAG, "Cannot call service method", e);
- }
- mCallElementList.addCall(call);
- }
-
public void processingHangUpAction() {
SipCall call = (SipCall) buttonHangup.getTag();
if (call != null)
@@ -420,7 +370,7 @@
break;
case 1:
mCallElementList = new CallElementListFragment();
-// SipCall.setCallElementList(mCallElementList);
+ // SipCall.setCallElementList(mCallElementList);
// mCallElementList.setAccountList(mAccountList);
fragment = mCallElementList;
Log.w(TAG, "getItem() CallElementList=" + fragment);
@@ -513,7 +463,12 @@
@Override
public void onCallSelected(SipCall c) {
launchCallActivity(c.mCallInfo);
-
+
+ }
+
+ @Override
+ public ISipService getService() {
+ return service;
}
}
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
index 00d3023..6d2643f 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhonePreferenceActivity.java
@@ -36,7 +36,6 @@
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
-import android.app.ListFragment;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
diff --git a/src/com/savoirfairelinux/sflphone/fragments/ButtonSectionFragment.java b/src/com/savoirfairelinux/sflphone/fragments/ButtonSectionFragment.java
deleted file mode 100644
index 280f3dc..0000000
--- a/src/com/savoirfairelinux/sflphone/fragments/ButtonSectionFragment.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.savoirfairelinux.sflphone.fragments;
-
-import android.app.Fragment;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.EditText;
-
-import com.savoirfairelinux.sflphone.R;
-import com.savoirfairelinux.sflphone.model.Numpad;
-
-public class ButtonSectionFragment extends Fragment
-{
- static final String TAG = "ButtonSectionFragment";
- EditText mTextEntry;
-
-
- public ButtonSectionFragment()
- {
- setRetainInstance(true);
- }
-
- public static final String ARG_SECTION_NUMBER = "section_number";
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)
- {
- View view;
- Log.i(TAG, "onCreateView" );
- view = inflater.inflate(R.layout.frag_button_section, parent, false);
-
- Numpad numpad = (Numpad) view.findViewById(R.id.numPad);
-
- mTextEntry = (EditText) parent.findViewById(R.id.phoneNumberTextEntry);
- if(mTextEntry == null){
- Log.i(TAG,"NULL");
- }
-
- numpad.setEditText(mTextEntry);
-
-
- return view;
- }
-
- public void onClick(){
- Log.i(TAG,"onClik");
- }
-}
diff --git a/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java b/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
index 82d3aba..05c4660 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/CallElementListFragment.java
@@ -33,6 +33,7 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.Random;
import android.app.Activity;
import android.app.AlertDialog;
@@ -60,7 +61,10 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.View.OnClickListener;
import android.widget.AdapterView;
+import android.widget.EditText;
+import android.widget.ImageButton;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
@@ -72,6 +76,7 @@
import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
import com.savoirfairelinux.sflphone.client.receiver.AccountListReceiver;
+import com.savoirfairelinux.sflphone.client.receiver.CallListReceiver;
import com.savoirfairelinux.sflphone.model.SipCall;
import com.savoirfairelinux.sflphone.service.ISipService;
@@ -84,6 +89,8 @@
private String mCurFilter;
private SFLPhoneHomeActivity sflphoneHome;
private ISipService service;
+ ImageButton buttonCall;
+ EditText phoneField;
private AccountSelectionSpinner mAccountSelectionSpinner;
private AccountListReceiver mAccountList;
private boolean isReady = false;
@@ -101,6 +108,11 @@
public void onCallSelected(SipCall c) {
}
+ @Override
+ public ISipService getService() {
+ // TODO Auto-generated method stub
+ return null;
+ }
};
/**
@@ -109,6 +121,8 @@
*/
public interface Callbacks {
public void onCallSelected(SipCall c);
+
+ public ISipService getService();
}
@@ -302,23 +316,58 @@
View inflatedView = inflater.inflate(R.layout.frag_call_element, container, false);
mAccountSelectionSpinner = (AccountSelectionSpinner) inflatedView.findViewById(R.id.account_selection_button);
+ phoneField = (EditText) inflatedView.findViewById(R.id.phoneNumberTextEntry);
+ buttonCall = (ImageButton) inflatedView.findViewById(R.id.buttonCall);
+
+ buttonCall.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ processingNewCallAction();
+ }
+ });
+
isReady = true;
- if (service != null) {
- onServiceSipBinded(service);
+ if (mCallbacks.getService() != null) {
+
+ onServiceSipBinded(mCallbacks.getService());
}
return inflatedView;
}
+
+ public void processingNewCallAction() {
+ // String accountID = mAccountList.currentAccountID;
+ String accountID = mAccountSelectionSpinner.getAccount();
+
+ String to = phoneField.getText().toString();
+
+ Random random = new Random();
+ String callID = Integer.toString(random.nextInt());
+ SipCall.CallInfo info = new SipCall.CallInfo();
+
+ info.mCallID = callID;
+ info.mAccountID = accountID;
+ info.mDisplayName = "Cool Guy!";
+ info.mPhone = to;
+ info.mEmail = "coolGuy@coolGuy.com";
+ info.mCallType = SipCall.CALL_TYPE_OUTGOING;
+
+ SipCall call = CallListReceiver.getCallInstance(info);
+ mCallbacks.onCallSelected(call);
+
+
+ try {
+ service.placeCall(info.mAccountID, info.mCallID, info.mPhone);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
+ addCall(call);
+ }
+
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
Log.i(TAG, "onCreateLoader");
- // return new CursorLoader(getActivity(), CommonDataKinds.Phone.CONTENT_URI, null,null,null, null);
-
- // This is called when a new Loader needs to be created. This
- // sample only has one Loader, so we don't care about the ID.
- // First, pick the base URI to use depending on whether we are
- // currently filtering.
Uri baseUri;
if (mCurFilter != null) {
@@ -368,8 +417,8 @@
service = isip;
ArrayList<String> accountList;
try {
- accountList = (ArrayList<String>) service.getAccountList();
- mAccountSelectionSpinner.populate(service, accountList);
+ accountList = (ArrayList<String>) mCallbacks.getService().getAccountList();
+ mAccountSelectionSpinner.populate(mCallbacks.getService(), accountList);
} catch (RemoteException e) {
Log.i(TAG, e.toString());
}
diff --git a/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java b/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java
index 23d98f5..e0fd151 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java
@@ -1,23 +1,120 @@
package com.savoirfairelinux.sflphone.fragments;
-import android.app.Fragment;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import android.app.Activity;
+import android.app.ListFragment;
import android.os.Bundle;
-import android.view.Gravity;
+import android.os.RemoteException;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.TextView;
-public class HistoryFragment extends Fragment {
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.adapters.HistoryAdapter;
+import com.savoirfairelinux.sflphone.model.SipCall;
+import com.savoirfairelinux.sflphone.service.ISipService;
+public class HistoryFragment extends ListFragment {
+
+ private static final String TAG = HistoryFragment.class.getSimpleName();
public static final String ARG_SECTION_NUMBER = "section_number";
+ private boolean isReady;
+ private ISipService service;
+ HistoryAdapter mAdapter;
+ private Callbacks mCallbacks = sDummyCallbacks;
+ /**
+ * A dummy implementation of the {@link Callbacks} interface that does nothing. Used only when this fragment is not attached to an activity.
+ */
+ private static Callbacks sDummyCallbacks = new Callbacks() {
+ @Override
+ public void onCallSelected(SipCall c) {
+ }
+
+ @Override
+ public ISipService getService() {
+ Log.i(TAG, "Dummy");
+ return null;
+ }
+
+ };
+
+ public interface Callbacks {
+ public void onCallSelected(SipCall c);
+
+ public ISipService getService();
+
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ isReady = false;
+ if (!(activity instanceof Callbacks)) {
+ throw new IllegalStateException("Activity must implement fragment's callbacks.");
+ }
+
+ mCallbacks = (Callbacks) activity;
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ mCallbacks = sDummyCallbacks;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // mAdapter = new HistoryAdapter(getActivity(),new ArrayList<HashMap<String, String>>());
+ }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
- TextView textView = new TextView(getActivity());
- textView.setGravity(Gravity.CENTER);
- Bundle args = getArguments();
- textView.setText("ARG_SECTION_NUMBER=" + Integer.toString(args.getInt(ARG_SECTION_NUMBER)));
- return textView;
+ View inflatedView = inflater.inflate(R.layout.frag_history, parent, false);
+ isReady = true;
+ if (isReady) {
+ Log.i(TAG, "C PRET");
+ }
+ return inflatedView;
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ Log.w(TAG, "onStart");
+ if (mCallbacks.getService() != null) {
+
+ Log.i(TAG, "oncreateview");
+ onServiceSipBinded(mCallbacks.getService());
+ }
+ }
+
+ /**
+ * Called by activity to pass a reference to sipservice to Fragment.
+ *
+ * @param isip
+ */
+ public void onServiceSipBinded(ISipService isip) {
+ Log.w(TAG, "onServiceSipBinded");
+ if (isReady) {
+ service = isip;
+ ArrayList<HashMap<String, String>> history;
+ try {
+ history = (ArrayList<HashMap<String, String>>) mCallbacks.getService().getHistory();
+ Log.i(TAG, "history size:" + history.size());
+ mAdapter = new HistoryAdapter(getActivity(), history);
+ getListView().setAdapter(mAdapter);
+ mAdapter.notifyDataSetChanged();
+
+ } catch (RemoteException e) {
+ Log.i(TAG, e.toString());
+ }
+ } else {
+ Log.w(TAG, "nor Ready");
+ }
+
}
}
diff --git a/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerJNI.java b/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerJNI.java
index 6106216..765a8bf 100644
--- a/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerJNI.java
+++ b/src/com/savoirfairelinux/sflphone/service/ConfigurationManagerJNI.java
@@ -231,6 +231,10 @@
SFLPhoneserviceJNI.ConfigurationManagerJNI_setAccountsOrder(swigCPtr, this, order);
}
+ public VectMap getHistory() {
+ return new VectMap(SFLPhoneserviceJNI.ConfigurationManagerJNI_getHistory(swigCPtr, this), true);
+ }
+
public String getAddrFromInterfaceName(String arg0) {
return SFLPhoneserviceJNI.ConfigurationManagerJNI_getAddrFromInterfaceName(swigCPtr, this, arg0);
}
@@ -251,12 +255,12 @@
SFLPhoneserviceJNI.ConfigurationManagerJNI_setShortcuts(swigCPtr, this, StringMap.getCPtr(shortcutsMap), shortcutsMap);
}
- public SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_t_t getCredentials(String accountID) {
- return new SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_t_t(SFLPhoneserviceJNI.ConfigurationManagerJNI_getCredentials(swigCPtr, this, accountID), true);
+ public VectMap getCredentials(String accountID) {
+ return new VectMap(SFLPhoneserviceJNI.ConfigurationManagerJNI_getCredentials(swigCPtr, this, accountID), true);
}
- public void setCredentials(String accountID, SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_t_t details) {
- SFLPhoneserviceJNI.ConfigurationManagerJNI_setCredentials(swigCPtr, this, accountID, SWIGTYPE_p_std__vectorT_std__mapT_std__string_std__string_t_t.getCPtr(details));
+ public void setCredentials(String accountID, VectMap details) {
+ SFLPhoneserviceJNI.ConfigurationManagerJNI_setCredentials(swigCPtr, this, accountID, VectMap.getCPtr(details), details);
}
public ConfigurationManagerJNI() {
diff --git a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
index cb7bf46..ac4e9c1 100644
--- a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
+++ b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
@@ -16,5 +16,6 @@
void setAccountDetails(in String accountId, in Map accountDetails);
void setAudioPlugin(in String callID);
String getCurrentAudioOutputPlugin();
+ List getHistory();
void registerClient(in ISipClient callback);
}
diff --git a/src/com/savoirfairelinux/sflphone/service/ServiceConstants.java b/src/com/savoirfairelinux/sflphone/service/ServiceConstants.java
index 6b00ac2..271ecb2 100644
--- a/src/com/savoirfairelinux/sflphone/service/ServiceConstants.java
+++ b/src/com/savoirfairelinux/sflphone/service/ServiceConstants.java
@@ -69,5 +69,22 @@
public static final String CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireClientCertificate";
public static final String CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
public static final String CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
+
+
+ public static final String HISTORY_ACCOUNT_ID_KEY = "accountid";
+ public static final String HISTORY_CALLID_KEY = "callid";
+ public static final String HISTORY_CONFID_KEY = "confid";
+ public static final String HISTORY_DISPLAY_NAME_KEY = "display_name";
+ public static final String HISTORY_PEER_NUMBER_KEY = "peer_number";
+ public static final String HISTORY_RECORDING_PATH_KEY = "recordfile";
+ public static final String HISTORY_STATE_KEY = "state";
+ public static final String HISTORY_TIMESTAMP_START_KEY = "timestamp_start";
+ public static final String HISTORY_TIMESTAMP_STOP_KEY = "timestamp_stop";
+ public static final String HISTORY_AUDIO_CODEC_KEY = "audio_codec";
+ public static final String HISTORY_VIDEO_CODEC_KEY = "video_codec";
+ public static final String HISTORY_MISSED_STRING = "missed";
+ public static final String HISTORY_INCOMING_STRING = "incoming";
+ public static final String HISTORY_OUTGOING_STRING = "outgoing";
+
}
diff --git a/src/com/savoirfairelinux/sflphone/service/SipService.java b/src/com/savoirfairelinux/sflphone/service/SipService.java
index 6edce10..c8a871a 100644
--- a/src/com/savoirfairelinux/sflphone/service/SipService.java
+++ b/src/com/savoirfairelinux/sflphone/service/SipService.java
@@ -45,6 +45,7 @@
import android.widget.Toast;
import com.savoirfairelinux.sflphone.account.AccountDetailsHandler;
+import com.savoirfairelinux.sflphone.account.HistoryHandler;
import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
public class SipService extends Service {
@@ -201,7 +202,6 @@
return configurationManagerJNI.getAccountDetails(id);
}
}
- ;
AccountDetails runInstance = new AccountDetails(accountID);
getExecutor().execute(runInstance);
@@ -272,6 +272,29 @@
public void registerClient(ISipClient callback) throws RemoteException {
client = callback;
}
+
+ @Override
+ public ArrayList<HashMap<String, String>> getHistory() throws RemoteException {
+ class History extends SipRunnableWithReturn {
+
+ @Override
+ protected VectMap doRun() throws SameThreadException {
+ Log.i(TAG, "SipService.getHistory() thread running...");
+
+ return configurationManagerJNI.getHistory();
+ }
+ }
+
+ History runInstance = new History();
+ getExecutor().execute(runInstance);
+ while (!runInstance.isDone()) {
+ }
+ VectMap swigmap = (VectMap) runInstance.getVal();
+
+ ArrayList<HashMap<String, String>> nativemap = HistoryHandler.convertSwigToNative(swigmap);
+
+ return nativemap;
+ }
};
private BroadcastReceiver IncomingReceiver = new BroadcastReceiver() {
diff --git a/src/com/savoirfairelinux/sflphone/service/VectMap.java b/src/com/savoirfairelinux/sflphone/service/VectMap.java
new file mode 100644
index 0000000..bb7b31f
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/service/VectMap.java
@@ -0,0 +1,78 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.8
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package com.savoirfairelinux.sflphone.service;
+
+public class VectMap {
+ private long swigCPtr;
+ protected boolean swigCMemOwn;
+
+ protected VectMap(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(VectMap obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if (swigCPtr != 0) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ SFLPhoneserviceJNI.delete_VectMap(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+ }
+
+ public VectMap() {
+ this(SFLPhoneserviceJNI.new_VectMap__SWIG_0(), true);
+ }
+
+ public VectMap(long n) {
+ this(SFLPhoneserviceJNI.new_VectMap__SWIG_1(n), true);
+ }
+
+ public long size() {
+ return SFLPhoneserviceJNI.VectMap_size(swigCPtr, this);
+ }
+
+ public long capacity() {
+ return SFLPhoneserviceJNI.VectMap_capacity(swigCPtr, this);
+ }
+
+ public void reserve(long n) {
+ SFLPhoneserviceJNI.VectMap_reserve(swigCPtr, this, n);
+ }
+
+ public boolean isEmpty() {
+ return SFLPhoneserviceJNI.VectMap_isEmpty(swigCPtr, this);
+ }
+
+ public void clear() {
+ SFLPhoneserviceJNI.VectMap_clear(swigCPtr, this);
+ }
+
+ public void add(StringMap x) {
+ SFLPhoneserviceJNI.VectMap_add(swigCPtr, this, StringMap.getCPtr(x), x);
+ }
+
+ public StringMap get(int i) {
+ return new StringMap(SFLPhoneserviceJNI.VectMap_get(swigCPtr, this, i), false);
+ }
+
+ public void set(int i, StringMap val) {
+ SFLPhoneserviceJNI.VectMap_set(swigCPtr, this, i, StringMap.getCPtr(val), val);
+ }
+
+}