Merge remote-tracking branch 'master/master' into bellesip

Conflicts:
	.gitmodules
	src/org/linphone/AccountPreferencesFragment.java
	submodules/linphone
This commit is contained in:
Sylvain Berfini 2013-03-22 12:08:09 +01:00
commit da9b8b368e
34 changed files with 280 additions and 82 deletions

View file

@ -5,10 +5,10 @@
<classpathentry kind="src" path="submodules/linphone/java/j2se"/>
<classpathentry kind="src" path="submodules/linphone/java/common"/>
<classpathentry kind="src" path="submodules/linphone/java/impl"/>
<classpathentry kind="src" path="submodules/externals/axmlrpc/src/main/java"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="lib" path="libs/aXMLRPC.jar"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry kind="lib" path="libs/gcm.jar"/>

3
.gitmodules vendored
View file

@ -67,3 +67,6 @@
[submodule "submodules/externals/cunit"]
path = submodules/externals/cunit
url = gitosis@git.linphone.org:cunit.git
[submodule "submodules/externals/axmlrpc"]
path = submodules/externals/axmlrpc
url = git://git.linphone.org/axmlrpc.git

View file

@ -1,3 +1,3 @@
source.dir=src:submodules/linphone/mediastreamer2/java/src:submodules/linphone/java/j2se:submodules/linphone/java/common:submodules/linphone/java/impl:submodules/linphone/coreapi/help/java
source.dir=src:submodules/linphone/mediastreamer2/java/src:submodules/linphone/java/j2se:submodules/linphone/java/common:submodules/linphone/java/impl:submodules/linphone/coreapi/help/java:submodules/externals/axmlrpc/src/main/java
key.store=bc-android.keystore
key.alias=nw8000

View file

@ -62,7 +62,7 @@
destdir="${javadoc.dir}"
verbose="off"
use="true"
classpath="${sdk.dir}/platforms/${target}/android.jar:libs/aXMLRPC.jar:libs/android-support-v4.jar:libs/gcm.jar"
classpath="${sdk.dir}/platforms/${target}/android.jar:libs/android-support-v4.jar:libs/gcm.jar"
sourcepath="${source.dir}:gen"
linkoffline="http://developer.android.com/reference file:/${sdk.dir}/docs/reference"
stylesheetfile="${sdk.dir}/docs/assets/android-developer-docs.css">

Binary file not shown.

View file

@ -81,6 +81,7 @@
android:paddingRight="5dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"

View file

@ -81,6 +81,7 @@
android:paddingRight="1dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"

View file

@ -81,6 +81,7 @@
android:paddingRight="7dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"

View file

@ -30,6 +30,7 @@
android:orientation="vertical">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -42,6 +43,7 @@
android:background="@drawable/setup_field_background" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -55,6 +57,7 @@
android:background="@drawable/setup_field_background" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_domain"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -30,6 +30,7 @@
android:orientation="vertical">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -42,6 +43,7 @@
android:background="@drawable/setup_field_background" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -34,6 +34,7 @@
android:layout_height="wrap_content">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -63,6 +64,7 @@
android:layout_height="wrap_content">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -75,6 +77,7 @@
android:background="@drawable/setup_field_background" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_password_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -108,6 +111,7 @@
android:layout_height="wrap_content">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -81,6 +81,7 @@
android:paddingRight="10dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"

View file

@ -70,6 +70,7 @@
android:paddingRight="5dp"/>
<EditText
android:textCursorDrawable="@null"
android:id="@+id/newFastChat"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -16,6 +16,7 @@
android:gravity="left" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/numoraddr"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -16,6 +16,7 @@
android:gravity="left" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/numoraddr"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -72,6 +72,7 @@
android:orientation="vertical">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/contactLastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -83,6 +84,7 @@
android:inputType="textPersonName|textCapWords"/>
<EditText
android:textCursorDrawable="@null"
android:id="@+id/contactFirstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -29,6 +29,7 @@
android:orientation="vertical">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -41,6 +42,7 @@
android:background="@drawable/setup_field_background" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -54,6 +56,7 @@
android:background="@drawable/setup_field_background" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_domain"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -29,6 +29,7 @@
android:orientation="vertical">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -41,6 +42,7 @@
android:background="@drawable/setup_field_background" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -33,6 +33,7 @@
android:layout_height="wrap_content">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -62,6 +63,7 @@
android:layout_height="wrap_content">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -73,19 +75,6 @@
android:textColor="@android:color/black"
android:background="@drawable/setup_field_background" />
<EditText
android:id="@+id/setup_password_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/setup_password"
android:hint="@string/setup_password_confirm_hint"
android:inputType="textPassword"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textColor="@android:color/black"
android:background="@drawable/setup_field_background" />
<ImageView
android:contentDescription="@string/content_description_setup_ok"
android:id="@+id/setup_password_ok"
@ -98,12 +87,44 @@
</RelativeLayout>
<RelativeLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_password_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/setup_password"
android:hint="@string/setup_password_confirm_hint"
android:inputType="textPassword"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:textColor="@android:color/black"
android:background="@drawable/setup_field_background" />
<ImageView
android:contentDescription="@string/content_description_setup_ok"
android:id="@+id/setup_confirm_password_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/wizard_notok"/>
</RelativeLayout>
<RelativeLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:textCursorDrawable="@null"
android:id="@+id/setup_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -169,7 +169,7 @@
android:contentDescription="@string/content_description_led"
android:id="@+id/statusLed"
android:paddingLeft="5dp"
android:src="@drawable/led_error"
android:src="@drawable/led_disconnected"
android:adjustViewBounds="true"
android:layout_centerVertical="true"
android:layout_width="wrap_content"

45
res/raw/lpconfig.xsd Normal file
View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.linphone.org/xsds/lpconfig.xsd"
xmlns:tns="http://www.linphone.org/xsds/lpconfig.xsd"
elementFormDefault="qualified">
<xs:element name="config" type="tns:LPConfig"></xs:element>
<xs:complexType name="LPConfig">
<xs:sequence>
<xs:element name="section" type="tns:LPSection" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LPSection">
<xs:sequence>
<xs:element name="entry" type="tns:LPEntry" maxOccurs="unbounded" minOccurs="0">
</xs:element>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"></xs:minLength>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="LPEntry">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="overwrite" type="xs:boolean"
use="optional" default="false">
</xs:attribute>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"></xs:minLength>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View file

@ -34,7 +34,7 @@
<bool name="show_statusbar_only_on_dialer">true</bool>
<bool name="lock_statusbar">false</bool>
<bool name="emoticons_in_messages">true</bool>
<bool name="only_display_username_if_unknown">true</bool>
<bool name="only_display_username_if_unknown">true</bool> <!-- Display username for all sip addresses (if not in contact and display name empty) -->
<bool name="display_messages_time_and_status">true</bool> <!-- Used to show the time of each message arrival -->
<bool name="display_time_aside">false</bool> <!-- if display_messages_time = true, display time on the side of the message instead of below -->
@ -64,5 +64,7 @@
<string name="about_bugreport_email">linphone-android@belledonne-communications.com</string>
<string name="temp_photo_name">linphone-android-photo-temp.jpg</string>
<string name="temp_photo_name_with_date">linphone-android-photo-%s.jpg</string>
<bool name="enable_call_notification">true</bool>
</resources>

View file

@ -103,12 +103,12 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
outboundProxy.setKey(getString(R.string.pref_enable_outbound_proxy_key) + key);
final Preference disable = advanced.getPreference(2);
disable.setEnabled(prefs.getInt(getString(R.string.pref_default_account_key), 0) != n);
disable.setEnabled(true);
Compatibility.setPreferenceChecked(disable, prefs.getBoolean(getString(R.string.pref_disable_account_key) + key, false));
disable.setKey(getString(R.string.pref_disable_account_key) + key);
final Preference delete = advanced.getPreference(4);
delete.setEnabled(prefs.getInt(getString(R.string.pref_default_account_key), 0) != n);
delete.setEnabled(true);
delete.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
int nbAccounts = prefs.getInt(getString(R.string.pref_extra_accounts), 1);
@ -124,21 +124,28 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
editor.putBoolean(getString(R.string.pref_disable_account_key) + getAccountNumber(i), prefs.getBoolean(getString(R.string.pref_disable_account_key) + getAccountNumber(i+1), false));
}
int lastAccount = nbAccounts - 1;
editor.putString(getString(R.string.pref_username_key) + getAccountNumber(lastAccount), null);
editor.putString(getString(R.string.pref_auth_userid_key) + getAccountNumber(lastAccount), null);
editor.putString(getString(R.string.pref_passwd_key) + getAccountNumber(lastAccount), null);
editor.putString(getString(R.string.pref_domain_key) + getAccountNumber(lastAccount), null);
editor.putString(getString(R.string.pref_proxy_key) + getAccountNumber(lastAccount), null);
editor.putBoolean(getString(R.string.pref_enable_outbound_proxy_key) + getAccountNumber(lastAccount), false);
editor.putBoolean(getString(R.string.pref_disable_account_key) + getAccountNumber(lastAccount), false);
if (n != 0) {
int lastAccount = nbAccounts - 1;
editor.putString(getString(R.string.pref_username_key) + getAccountNumber(lastAccount), null);
editor.putString(getString(R.string.pref_passwd_key) + getAccountNumber(lastAccount), null);
editor.putString(getString(R.string.pref_domain_key) + getAccountNumber(lastAccount), null);
editor.putString(getString(R.string.pref_proxy_key) + getAccountNumber(lastAccount), null);
editor.putBoolean(getString(R.string.pref_enable_outbound_proxy_key) + getAccountNumber(lastAccount), false);
editor.putBoolean(getString(R.string.pref_disable_account_key) + getAccountNumber(lastAccount), false);
int defaultAccount = prefs.getInt(getString(R.string.pref_default_account_key), 0);
if (defaultAccount > n) {
editor.putInt(getString(R.string.pref_default_account_key), defaultAccount - 1);
}
int defaultAccount = prefs.getInt(getString(R.string.pref_default_account_key), 0);
if (defaultAccount > n) {
editor.putInt(getString(R.string.pref_default_account_key), defaultAccount - 1);
}
editor.putInt(getString(R.string.pref_extra_accounts), nbAccounts - 1);
} else if (n == 0 && nbAccounts <= 1) {
editor.putString(getString(R.string.pref_username_key), "");
editor.putString(getString(R.string.pref_passwd_key), "");
editor.putString(getString(R.string.pref_domain_key), "");
} else {
editor.putInt(getString(R.string.pref_extra_accounts), nbAccounts - 1);
}
editor.putInt(getString(R.string.pref_extra_accounts), nbAccounts - 1);
editor.commit();
LinphoneActivity.instance().displaySettings();
@ -157,7 +164,6 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(getString(R.string.pref_default_account_key), n);
editor.commit();
delete.setEnabled(false);
disable.setEnabled(false);
Compatibility.setPreferenceChecked(disable, false);
preference.setEnabled(false);
@ -179,7 +185,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
int n = prefs.getInt(getString(R.string.pref_extra_accounts), 1);
String keyUsername = getString(R.string.pref_username_key) + (n-1 == 0 ? "" : Integer.toString(n-1));
String keyUsername = getString(R.string.pref_username_key) + getAccountNumber(n-1);
if (prefs.getString(keyUsername, "").equals("")) {
//If not, we suppress it to not display a blank field

View file

@ -235,7 +235,7 @@ public class EditContactFragment extends Fragment {
}
private View displayNumberOrAddress(final TableLayout controls, String numberOrAddress, boolean forceAddNumber) {
final boolean isSip = numberOrAddress.startsWith("sip:");
boolean isSip = numberOrAddress.startsWith("sip:");
if (isSip) {
if (firstSipAddressIndex == -1) {
firstSipAddressIndex = controls.getChildCount();
@ -243,7 +243,10 @@ public class EditContactFragment extends Fragment {
numberOrAddress = numberOrAddress.replace("sip:", "");
}
if ((getResources().getBoolean(R.bool.hide_phone_numbers_in_editor) && !isSip) || (getResources().getBoolean(R.bool.hide_sip_addresses_in_editor) && isSip)) {
return null;
if (forceAddNumber)
isSip = !isSip; // If number can't be displayed because we hide a sort of number, change that category
else
return null;
}
NewOrUpdatedNumberOrAddress tempNounoa;
@ -341,11 +344,6 @@ public class EditContactFragment extends Fragment {
if (isSip) {
controls.addView(view, controls.getChildCount());
if (deleteContact != null) {
// Move to the bottom the remove contact button
controls.removeView(deleteContact);
controls.addView(deleteContact, controls.getChildCount());
}
} else {
if (firstSipAddressIndex != -1) {
controls.addView(view, firstSipAddressIndex);
@ -353,6 +351,11 @@ public class EditContactFragment extends Fragment {
controls.addView(view);
}
}
if (deleteContact != null) {
// Move to the bottom the remove contact button
controls.removeView(deleteContact);
controls.addView(deleteContact, controls.getChildCount());
}
}
private void createNewContact() {

View file

@ -762,6 +762,8 @@ public class LinphoneActivity extends FragmentActivity implements
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null && lc.getDefaultProxyConfig() != null)
statusFragment.registrationStateChanged(lc.getDefaultProxyConfig().getState());
else
statusFragment.registrationStateChanged(RegistrationState.RegistrationNone);
}
}

View file

@ -42,8 +42,10 @@ import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import org.linphone.LinphoneSimpleListener.ConnectivityChangedListener;
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener;
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener.AudioState;
import org.linphone.LinphoneSimpleListener.LinphoneOnDTMFReceivedListener;
import org.linphone.LinphoneSimpleListener.LinphoneOnMessageReceivedListener;
import org.linphone.LinphoneSimpleListener.LinphoneServiceListener;
import org.linphone.core.CallDirection;
@ -144,6 +146,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
private String lastLcStatusMessage;
private String basePath;
private static boolean sExited;
private String contactParams;
private WakeLock mIncallWakeLock;
@ -445,7 +448,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
public void enableCamera(LinphoneCall call, boolean enable) {
if (call != null) {
call.enableCamera(enable);
LinphoneService.instance().refreshIncallIcon(mLc.getCurrentCall());
if (mServiceContext.getResources().getBoolean(R.bool.enable_call_notification))
LinphoneService.instance().refreshIncallIcon(mLc.getCurrentCall());
}
}
@ -663,7 +667,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
LinphoneProxyConfig lDefaultProxyConfig = mLc.getDefaultProxyConfig();
if (lDefaultProxyConfig !=null) {
if (lDefaultProxyConfig != null) {
//prefix
String lPrefix = getPrefString(R.string.pref_prefix_key, null);
if (lPrefix != null) {
@ -671,6 +675,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
//escape +
lDefaultProxyConfig.setDialEscapePlus(getPrefBoolean(R.string.pref_escape_plus_key, false));
} else if (LinphoneService.isReady()) {
LinphoneService.instance().onRegistrationStateChanged(RegistrationState.RegistrationNone, null);
}
}
@ -706,9 +712,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
String regId = getPrefString(R.string.push_reg_id_key, null);
String appId = getString(R.string.push_sender_id);
if (regId != null && getPrefBoolean(R.string.pref_push_notification_key, mR.getBoolean(R.bool.pref_push_notification_default))) {
String contactInfos = "app-id=" + appId + ";pn-type=google;pn-tok=" + regId + ";pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf;";
String contactInfos = "app-id=" + appId + ";pn-type=google;pn-tok=" + regId + ";pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-call-snd=ring.caf;pn-msg-snd=msg.caf";
proxycon.setContactParameters(contactInfos);
}
} else if (contactParams != null) {
proxycon.setContactParameters(contactParams);
}
mLc.addProxyConfig(proxycon);
@ -789,6 +797,10 @@ public final class LinphoneManager implements LinphoneCoreListener {
return defaultValue;
}
public void setContactParams(String params) {
contactParams = params;
}
public void initFromConf() throws LinphoneConfigException {
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && getPrefBoolean(R.string.pref_debug_key, mR.getBoolean(R.bool.pref_debug_default));
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
@ -1028,6 +1040,15 @@ public final class LinphoneManager implements LinphoneCoreListener {
Log.i(eventInfo.getTypeName()," connected: wifi only activated, setting network unreachable");
}
}
if (connectivityListener != null) {
connectivityListener.onConnectivityChanged(mServiceContext, eventInfo, cm);
}
}
private ConnectivityChangedListener connectivityListener;
public void addConnectivityChangedListener(ConnectivityChangedListener l) {
connectivityListener = l;
}
public interface EcCalibrationListener {
@ -1063,6 +1084,18 @@ public final class LinphoneManager implements LinphoneCoreListener {
//deprecated
}
@Override
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
Log.d("DTMF received: " + dtmf);
if (dtmfReceivedListener != null)
dtmfReceivedListener.onDTMFReceived(call, dtmf);
}
private LinphoneOnDTMFReceivedListener dtmfReceivedListener;
public void setOnDTMFReceivedListener(LinphoneOnDTMFReceivedListener listener) {
dtmfReceivedListener = listener;
}
@Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
if (mServiceContext.getResources().getBoolean(R.bool.disable_chat)) {
@ -1093,11 +1126,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
}
@Override
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
Log.d("DTMF received: " + dtmf);
}
public String getLastLcStatusMessage() {
return lastLcStatusMessage;
}
@ -1397,6 +1425,16 @@ public final class LinphoneManager implements LinphoneCoreListener {
return false;
}
public boolean acceptCall(LinphoneCall call) {
try {
mLc.acceptCall(call);
return true;
} catch (LinphoneCoreException e) {
Log.i(e, "Accept call failed");
}
return false;
}
public boolean acceptCallWithParams(LinphoneCall call, LinphoneCallParams params) {
try {
mLc.acceptCallWithParams(call, params);

View file

@ -291,6 +291,11 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
notifyWrapper(CUSTOM_NOTIF_ID, mCustomNotif);
}
public void removeCustomNotification() {
mNM.cancel(CUSTOM_NOTIF_ID);
resetIntentLaunchedOnNotificationClick();
}
public void displayMessageNotification(String fromSipUri, String fromName, String message) {
Intent notifIntent = new Intent(this, LinphoneActivity.class);
notifIntent.putExtra("GoToChat", true);
@ -513,6 +518,9 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
if ((state == RegistrationState.RegistrationFailed || state == RegistrationState.RegistrationCleared) && (LinphoneManager.getLc().getDefaultProxyConfig() == null || !LinphoneManager.getLc().getDefaultProxyConfig().isRegistered())) {
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_register_failure);
}
if (state == RegistrationState.RegistrationNone) {
sendNotification(IC_LEVEL_OFFLINE, R.string.notification_started);
}
mHandler.post(new Runnable() {
public void run() {
@ -567,10 +575,12 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
if (state == State.StreamsRunning) {
// Workaround bug current call seems to be updated after state changed to streams running
refreshIncallIcon(call);
if (getResources().getBoolean(R.bool.enable_call_notification))
refreshIncallIcon(call);
mWifiLock.acquire();
} else {
refreshIncallIcon(LinphoneManager.getLc().getCurrentCall());
if (getResources().getBoolean(R.bool.enable_call_notification))
refreshIncallIcon(LinphoneManager.getLc().getCurrentCall());
}
if ((state == State.CallEnd || state == State.Error) && LinphoneManager.getLc().getCallsNb() < 1) {
mWifiLock.release();

View file

@ -25,7 +25,10 @@ import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState;
import android.content.Context;
import android.media.MediaPlayer;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public interface LinphoneSimpleListener {
@ -67,4 +70,12 @@ public interface LinphoneSimpleListener {
public static interface LinphoneOnRegistrationStateChangedListener extends LinphoneSimpleListener {
void onRegistrationStateChanged(RegistrationState state);
}
public static interface ConnectivityChangedListener extends LinphoneSimpleListener {
void onConnectivityChanged(Context context, NetworkInfo eventInfo, ConnectivityManager cm);
}
public static interface LinphoneOnDTMFReceivedListener extends LinphoneSimpleListener {
void onDTMFReceived(LinphoneCall call, int dtmf);
}
}

View file

@ -29,13 +29,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import org.linphone.mediastream.video.capture.hwconf.Hacks;
@ -68,19 +67,15 @@ public final class LinphoneUtils {
private LinphoneUtils(){}
private static boolean preventVolumeBarToDisplay = false;
private static final String sipAddressRegExp = "^(sip:)?(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}(:[0-9]{2,5})?$";
private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$";
//private static final String sipAddressRegExp = "^(sip:)?(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}(:[0-9]{2,5})?$";
//private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$";
public static boolean isSipAddress(String numberOrAddress) {
Pattern p = Pattern.compile(sipAddressRegExp);
Matcher m = p.matcher(numberOrAddress);
return m != null && m.matches();
return LinphoneCoreFactory.instance().createLinphoneAddress(numberOrAddress) != null;
}
public static boolean isStrictSipAddress(String numberOrAddress) {
Pattern p = Pattern.compile(strictSipAddressRegExp);
Matcher m = p.matcher(numberOrAddress);
return m != null && m.matches();
return isSipAddress(numberOrAddress) && numberOrAddress.startsWith("sip:");
}
public static String getUsernameFromAddress(String address) {

View file

@ -281,6 +281,10 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
addAccount.setTitle(getString(R.string.pref_add_account));
addAccount.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
nbAccounts = prefs.getInt(getString(R.string.pref_extra_accounts), 0);
prefs.edit().putInt(getString(R.string.pref_extra_accounts), nbAccounts+1).commit();
addExtraAccountPreferencesButton(accounts, nbAccounts, true);
LinphoneActivity.instance().displayAccountSettings(nbAccounts);
nbAccounts++;

View file

@ -231,7 +231,7 @@ public class StatusFragment extends Fragment {
e.printStackTrace();
}
return -1;
return R.drawable.led_disconnected;
}
private String getStatusIconText(LinphoneCore.RegistrationState state) {
@ -253,7 +253,7 @@ public class StatusFragment extends Fragment {
e.printStackTrace();
}
return null;
return context.getString(R.string.status_not_connected);
}
private void startCallQuality() {

View file

@ -50,6 +50,7 @@ public class WizardFragment extends Fragment {
private boolean usernameOk = false;
private boolean passwordOk = false;
private boolean emailOk = false;
private boolean confirmPasswordOk = false;
private ImageView createAccount;
private TextView errorMessage;
@ -66,7 +67,10 @@ public class WizardFragment extends Fragment {
passwordConfirm = (EditText) view.findViewById(R.id.setup_password_confirm);
ImageView passwordOkIV = (ImageView) view.findViewById(R.id.setup_password_ok);
addXMLRPCPasswordHandler(password, passwordConfirm, passwordOkIV);
addXMLRPCPasswordHandler(password, passwordOkIV);
ImageView passwordConfirmOkIV = (ImageView) view.findViewById(R.id.setup_confirm_password_ok);
addXMLRPCConfirmPasswordHandler(password, passwordConfirm, passwordConfirmOkIV);
email = (EditText) view.findViewById(R.id.setup_email);
ImageView emailOkIV = (ImageView) view.findViewById(R.id.setup_email_ok);
@ -95,7 +99,7 @@ public class WizardFragment extends Fragment {
errorMessage.setText(R.string.wizard_server_unavailable);
usernameOk = false;
icon.setImageResource(R.drawable.wizard_notok);
createAccount.setEnabled(usernameOk && passwordOk && emailOk);
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
}
};
@ -108,7 +112,7 @@ public class WizardFragment extends Fragment {
errorMessage.setText(R.string.wizard_username_unavailable);
usernameOk = false;
icon.setImageResource(R.drawable.wizard_notok);
createAccount.setEnabled(usernameOk && passwordOk && emailOk);
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
}
};
@ -117,7 +121,7 @@ public class WizardFragment extends Fragment {
errorMessage.setText("");
icon.setImageResource(R.drawable.wizard_ok);
usernameOk = true;
createAccount.setEnabled(usernameOk && passwordOk && emailOk);
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
}
};
@ -253,12 +257,12 @@ public class WizardFragment extends Fragment {
errorMessage.setText(R.string.wizard_email_incorrect);
icon.setImageResource(R.drawable.wizard_notok);
}
createAccount.setEnabled(usernameOk && passwordOk && emailOk);
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
}
});
}
private void addXMLRPCPasswordHandler(final EditText field1, final EditText field2, final ImageView icon) {
private void addXMLRPCPasswordHandler(final EditText field1, final ImageView icon) {
TextWatcher passwordListener = new TextWatcher() {
public void afterTextChanged(Editable arg0) {
@ -271,21 +275,51 @@ public class WizardFragment extends Fragment {
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3)
{
passwordOk = false;
if (isPasswordCorrect(field1.getText().toString()) && field1.getText().toString().equals(field2.getText().toString())) {
if (isPasswordCorrect(field1.getText().toString())) {
passwordOk = true;
icon.setImageResource(R.drawable.wizard_ok);
errorMessage.setText("");
}
else {
if (isPasswordCorrect(field1.getText().toString())) {
errorMessage.setText(R.string.wizard_passwords_unmatched);
}
else {
errorMessage.setText(R.string.wizard_password_incorrect);
}
errorMessage.setText(R.string.wizard_password_incorrect);
icon.setImageResource(R.drawable.wizard_notok);
}
createAccount.setEnabled(usernameOk && passwordOk && emailOk);
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
}
};
field1.addTextChangedListener(passwordListener);
}
private void addXMLRPCConfirmPasswordHandler(final EditText field1, final EditText field2, final ImageView icon) {
TextWatcher passwordListener = new TextWatcher() {
public void afterTextChanged(Editable arg0) {
}
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
}
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3)
{
confirmPasswordOk = false;
if (field1.getText().toString().equals(field2.getText().toString())) {
confirmPasswordOk = true;
icon.setImageResource(R.drawable.wizard_ok);
if (!isPasswordCorrect(field1.getText().toString())) {
errorMessage.setText(R.string.wizard_password_incorrect);
}
else {
errorMessage.setText("");
}
}
else {
errorMessage.setText(R.string.wizard_passwords_unmatched);
icon.setImageResource(R.drawable.wizard_notok);
}
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
}
};

1
submodules/externals/axmlrpc vendored Submodule

@ -0,0 +1 @@
Subproject commit c47eaa453fb75d55d32304413672c16706af85e0

@ -1 +1 @@
Subproject commit ff2563b24413a364ee1ce57d4aff260761f19771
Subproject commit e1552ee1eef40ca9efeb0e814223cff17e580462