Liblinphone updated (fix) + tutorials back

This commit is contained in:
Sylvain Berfini 2013-01-16 16:06:57 +01:00
parent 80fb15f5c5
commit 6e5993379d
8 changed files with 501 additions and 1 deletions

View file

@ -6,6 +6,7 @@
<classpathentry kind="src" path="submodules/linphone/java/common"/>
<classpathentry kind="src" path="submodules/linphone/java/impl"/>
<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"/>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText android:layout_height="wrap_content" android:id="@+id/AddressId"
android:hint="sip:user@host:port" android:layout_width="fill_parent"
android:layout_weight="1" android:text="sip:[user@]host[:port]"></EditText>
<Button android:layout_height="wrap_content" android:id="@+id/CallButton"
android:text="Call" android:layout_width="wrap_content"></Button>
</LinearLayout>
<EditText android:layout_height="wrap_content" android:id="@+id/MyAddressId"
android:hint="enter my sip identity (sip:[user@]host)" android:layout_width="fill_parent"
android:visibility="gone" android:text=""></EditText>
<EditText android:hint="my password" android:id="@+id/Password"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:visibility="gone"></EditText>
<TextView android:layout_weight="1" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/OutputText"
android:text="Debug"></TextView>
<Button android:text="STOP" android:id="@+id/ButtonStop"
android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</LinearLayout>

View file

@ -0,0 +1,52 @@
/*
AndroidTutorialNotifier.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.tutorials;
import org.linphone.core.tutorials.TutorialNotifier;
import android.os.Handler;
import android.widget.TextView;
/**
* Write notifications to a TextView widget.
* This is an helper class, not a test activity.
*
* @author Guillaume Beraudo
*
*/
class AndroidTutorialNotifier extends TutorialNotifier {
private Handler mHandler;
private TextView outputTextView;
public AndroidTutorialNotifier(Handler mHandler, final TextView outputTextView) {
this.mHandler = mHandler;
this.outputTextView = outputTextView;
}
@Override
public void notify(final String s) {
mHandler.post(new Runnable() {
public void run() {
outputTextView.setText(s + "\n" + outputTextView.getText());
}
});
}
}

View file

@ -0,0 +1,111 @@
/*
TutorialBuddyStatusActivity.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.tutorials;
import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.tutorials.TutorialBuddyStatus;
import org.linphone.core.tutorials.TutorialNotifier;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Activity for displaying and starting the BuddyStatus example on Android phone.
*
* @author Guillaume Beraudo
*
*/
public class TutorialBuddyStatusActivity extends Activity {
private static final String defaultSipAddress = "sip:";
private TextView sipAddressWidget;
private TextView mySipAddressWidget;
private TextView mySipPasswordWidget;
private TutorialBuddyStatus tutorial;
private Handler mHandler = new Handler() ;
private Button buttonCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hello_world);
sipAddressWidget = (TextView) findViewById(R.id.AddressId);
sipAddressWidget.setText(defaultSipAddress);
mySipAddressWidget = (TextView) findViewById(R.id.MyAddressId);
mySipAddressWidget.setVisibility(View.VISIBLE);
mySipPasswordWidget = (TextView) findViewById(R.id.Password);
mySipPasswordWidget.setVisibility(TextView.VISIBLE);
// Output text to the outputText widget
final TextView outputText = (TextView) findViewById(R.id.OutputText);
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
// Create BuddyStatus object
tutorial = new TutorialBuddyStatus(notifier);
// Assign call action to call button
buttonCall = (Button) findViewById(R.id.CallButton);
buttonCall.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TutorialLaunchingThread thread = new TutorialLaunchingThread();
buttonCall.setEnabled(false);
thread.start();
}
});
// Assign stop action to stop button
Button buttonStop = (Button) findViewById(R.id.ButtonStop);
buttonStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tutorial.stopMainLoop();
}
});
}
private class TutorialLaunchingThread extends Thread {
@Override
public void run() {
super.run();
try {
String myIdentity = mySipAddressWidget.getText().length()>0?mySipAddressWidget.getText().toString():null;
String myPassword = mySipPasswordWidget.getText().length()>0?mySipPasswordWidget.getText().toString():null;
tutorial.launchTutorial(sipAddressWidget.getText().toString(), myIdentity, myPassword);
mHandler.post(new Runnable() {
public void run() {
buttonCall.setEnabled(true);
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
}

View file

@ -0,0 +1,100 @@
/*
TutorialChatRoomActivity.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.tutorials;
import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.tutorials.TutorialChatRoom;
import org.linphone.core.tutorials.TutorialNotifier;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Activity for displaying and starting the chatroom example on Android phone.
*
* @author Guillaume Beraudo
*
*/
public class TutorialChatRoomActivity extends Activity {
private static final String defaultSipAddress = "sip:";
private TextView sipAddressWidget;
private TutorialChatRoom tutorial;
private Handler mHandler = new Handler() ;
private Button buttonCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hello_world);
sipAddressWidget = (TextView) findViewById(R.id.AddressId);
sipAddressWidget.setText(defaultSipAddress);
// Output text to the outputText widget
final TextView outputText = (TextView) findViewById(R.id.OutputText);
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
// Create HelloWorld object
tutorial = new TutorialChatRoom(notifier);
// Assign call action to call button
buttonCall = (Button) findViewById(R.id.CallButton);
buttonCall.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TutorialLaunchingThread thread = new TutorialLaunchingThread();
buttonCall.setEnabled(false);
thread.start();
}
});
// Assign stop action to stop button
Button buttonStop = (Button) findViewById(R.id.ButtonStop);
buttonStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tutorial.stopMainLoop();
}
});
}
private class TutorialLaunchingThread extends Thread {
@Override
public void run() {
super.run();
try {
tutorial.launchTutorial(sipAddressWidget.getText().toString());
mHandler.post(new Runnable() {
public void run() {
buttonCall.setEnabled(true);
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
}

View file

@ -0,0 +1,100 @@
/*
TutorialHelloWorldActivity.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.tutorials;
import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.tutorials.TutorialHelloWorld;
import org.linphone.core.tutorials.TutorialNotifier;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Activity for displaying and starting the HelloWorld example on Android phone.
*
* @author Guillaume Beraudo
*
*/
public class TutorialHelloWorldActivity extends Activity {
private static final String defaultSipAddress = "sip:";
private TextView sipAddressWidget;
private TutorialHelloWorld tutorial;
private Handler mHandler = new Handler() ;
private Button buttonCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hello_world);
sipAddressWidget = (TextView) findViewById(R.id.AddressId);
sipAddressWidget.setText(defaultSipAddress);
// Output text to the outputText widget
final TextView outputText = (TextView) findViewById(R.id.OutputText);
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
// Create HelloWorld object
tutorial = new TutorialHelloWorld(notifier);
// Assign call action to call button
buttonCall = (Button) findViewById(R.id.CallButton);
buttonCall.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TutorialLaunchingThread thread = new TutorialLaunchingThread();
buttonCall.setEnabled(false);
thread.start();
}
});
// Assign stop action to stop button
Button buttonStop = (Button) findViewById(R.id.ButtonStop);
buttonStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tutorial.stopMainLoop();
}
});
}
private class TutorialLaunchingThread extends Thread {
@Override
public void run() {
super.run();
try {
tutorial.launchTutorial(sipAddressWidget.getText().toString());
mHandler.post(new Runnable() {
public void run() {
buttonCall.setEnabled(true);
}
});
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
}
}

View file

@ -0,0 +1,105 @@
/*
TutorialRegistrationActivity.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.tutorials;
import org.linphone.R;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.tutorials.TutorialNotifier;
import org.linphone.core.tutorials.TutorialRegistration;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Activity for displaying and starting the registration example on Android phone.
*
* @author Guillaume Beraudo
*
*/
public class TutorialRegistrationActivity extends TutorialHelloWorldActivity {
private static final String defaultSipAddress = "sip:";
private static final String defaultSipPassword = "";
private TextView sipAddressWidget;
private TextView sipPasswordWidget;
private TutorialRegistration tutorial;
private Button buttonCall;
private Handler mHandler = new Handler();
private TextView outputText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hello_world);
sipAddressWidget = (TextView) findViewById(R.id.AddressId);
sipAddressWidget.setText(defaultSipAddress);
sipPasswordWidget = (TextView) findViewById(R.id.Password);
sipPasswordWidget.setVisibility(TextView.VISIBLE);
sipPasswordWidget.setText(defaultSipPassword);
// Output text to the outputText widget
outputText = (TextView) findViewById(R.id.OutputText);
final TutorialNotifier notifier = new AndroidTutorialNotifier(mHandler, outputText);
// Create Tutorial object
tutorial = new TutorialRegistration(notifier);
// Assign call action to call button
buttonCall = (Button) findViewById(R.id.CallButton);
buttonCall.setText("Register");
buttonCall.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TutorialLaunchingThread thread = new TutorialLaunchingThread();
buttonCall.setEnabled(false);
thread.start();
}
});
Button buttonStop = (Button) findViewById(R.id.ButtonStop);
buttonStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tutorial.stopMainLoop();
}
});
}
private class TutorialLaunchingThread extends Thread {
@Override
public void run() {
super.run();
try {
tutorial.launchTutorial(
sipAddressWidget.getText().toString(),
sipPasswordWidget.getText().toString());
} catch (LinphoneCoreException e) {
e.printStackTrace();
outputText.setText(e.getMessage() +"\n"+outputText.getText());
}
}
}
}

@ -1 +1 @@
Subproject commit 5087bd396a86226764c611e3ddd804a46eb771c7
Subproject commit 140dd55563261f45206bfec8690ebefbbd638fcd