diff --git a/.classpath b/.classpath index 9ca73728a..c16c4b45f 100644 --- a/.classpath +++ b/.classpath @@ -4,6 +4,7 @@ + diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 668053512..77a1c1e62 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -20,6 +20,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -73,4 +104,4 @@ - \ No newline at end of file + diff --git a/deliver_sdk.sh b/deliver_sdk.sh new file mode 100755 index 000000000..c04ebb1f7 --- /dev/null +++ b/deliver_sdk.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +zip -r ../liblinphone-android-sdk.zip submodules/linphone/coreapi/help/java libs src/org/linphone/core submodules/linphone/java/j2se/ submodules/linphone/java/common res/layout/hello_world.xml diff --git a/libs/armeabi-v7a/liblinphone.so b/libs/armeabi-v7a/liblinphone.so index 703bc4a40..fe03a6a88 100755 Binary files a/libs/armeabi-v7a/liblinphone.so and b/libs/armeabi-v7a/liblinphone.so differ diff --git a/libs/armeabi/liblinphone.so b/libs/armeabi/liblinphone.so index 7c2dfabeb..a8d6b2321 100755 Binary files a/libs/armeabi/liblinphone.so and b/libs/armeabi/liblinphone.so differ diff --git a/res/layout/hello_world.xml b/res/layout/hello_world.xml new file mode 100644 index 000000000..c738cb2f1 --- /dev/null +++ b/res/layout/hello_world.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/src/org/linphone/BootReceiver.java b/src/org/linphone/BootReceiver.java index 836e62d12..097767fab 100644 --- a/src/org/linphone/BootReceiver.java +++ b/src/org/linphone/BootReceiver.java @@ -34,4 +34,5 @@ public class BootReceiver extends BroadcastReceiver { context.startService(lLinphoneServiceIntent);; } } + } diff --git a/src/org/linphone/core/LinphoneAddressImpl.java b/src/org/linphone/core/LinphoneAddressImpl.java index bf4670ec3..b9d290971 100644 --- a/src/org/linphone/core/LinphoneAddressImpl.java +++ b/src/org/linphone/core/LinphoneAddressImpl.java @@ -32,6 +32,9 @@ public class LinphoneAddressImpl implements LinphoneAddress { private native void setDisplayName(long ptr,String name); private native String toString(long ptr); + protected LinphoneAddressImpl(String identity) { + nativePtr = newLinphoneAddressImpl(identity, null); + } protected LinphoneAddressImpl(String username,String domain,String displayName) { nativePtr = newLinphoneAddressImpl("sip:"+username+"@"+domain, displayName); diff --git a/src/org/linphone/core/LinphoneChatRoomImpl.java b/src/org/linphone/core/LinphoneChatRoomImpl.java new file mode 100644 index 000000000..76874675d --- /dev/null +++ b/src/org/linphone/core/LinphoneChatRoomImpl.java @@ -0,0 +1,37 @@ +/* +LinphoneChatRoomImpl.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.core; + +class LinphoneChatRoomImpl implements LinphoneChatRoom { + protected final long nativePtr; + private native long getPeerAddress(long ptr); + private native void sendMessage(long ptr, String message); + + protected LinphoneChatRoomImpl(long aNativePtr) { + nativePtr = aNativePtr; + } + + public LinphoneAddress getPeerAddress() { + return new LinphoneAddressImpl(getPeerAddress(nativePtr)); + } + + public void sendMessage(String message) { + sendMessage(nativePtr,message); + } +} diff --git a/src/org/linphone/core/LinphoneCoreFactoryImpl.java b/src/org/linphone/core/LinphoneCoreFactoryImpl.java index e86f0b100..1b4e9aaf0 100644 --- a/src/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/src/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -39,8 +39,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } @Override - public LinphoneAddress createLinphoneAddress(String address) { - throw new RuntimeException("Not implemeneted yet"); + public LinphoneAddress createLinphoneAddress(String identity) { + return new LinphoneAddressImpl(identity); } @Override @@ -54,6 +54,15 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } } + @Override + public LinphoneCore createLinphoneCore(LinphoneCoreListener listener) throws LinphoneCoreException { + try { + return new LinphoneCoreImpl(listener); + } catch (IOException e) { + throw new LinphoneCoreException("Cannot create LinphoneCore",e); + } + } + @Override public LinphoneProxyConfig createProxyConfig(String identity, String proxy, String route, boolean enableRegister) throws LinphoneCoreException { @@ -70,14 +79,12 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } @Override - LinphoneFriend createLinphoneFriend(String friendUri) { - // TODO Auto-generated method stub - return null; + public LinphoneFriend createLinphoneFriend(String friendUri) { + return new LinphoneFriendImpl(friendUri); } @Override - LinphoneFriend createLinphoneFriend() { - // TODO Auto-generated method stub - return null; + public LinphoneFriend createLinphoneFriend() { + return createLinphoneFriend(null); } } diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java index aad67304a..657cdc407 100644 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ b/src/org/linphone/core/LinphoneCoreImpl.java @@ -68,10 +68,19 @@ class LinphoneCoreImpl implements LinphoneCore { private AndroidVideoWindowImpl mVideoWindow; private AndroidVideoWindowImpl mPreviewWindow; + private native void addFriend(long nativePtr,long friend); + private native void setPresenceInfo(long nativePtr,int minute_away, String alternative_contact,int status); + private native long createChatRoom(long nativePtr,String to); + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata); } + LinphoneCoreImpl(LinphoneCoreListener listener) throws IOException { + mListener=listener; + nativePtr = newLinphoneCore(listener,null,null,null); + } + protected void finalize() throws Throwable { } @@ -274,18 +283,18 @@ class LinphoneCoreImpl implements LinphoneCore { public void stopDtmf() { stopDtmf(nativePtr); } + public void addFriend(LinphoneFriend lf) throws LinphoneCoreException { - // TODO Auto-generated method stub + addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr); + + } + public void setPresenceInfo(int minute_away, String alternative_contact, + OnlineStatus status) { + setPresenceInfo(nativePtr,minute_away,alternative_contact,status.mValue); } public LinphoneChatRoom createChatRoom(String to) { - // TODO Auto-generated method stub - return null; - } - public void setPresenceInfo(int minuteAway, String alternativeContact, - OnlineStatus status) { - // TODO Auto-generated method stub - + return new LinphoneChatRoomImpl(createChatRoom(nativePtr,to)); } public void setPreviewWindow(VideoWindow w) { if (mPreviewWindow!=null) diff --git a/src/org/linphone/core/LinphoneFriendImpl.java b/src/org/linphone/core/LinphoneFriendImpl.java new file mode 100644 index 000000000..bae44679f --- /dev/null +++ b/src/org/linphone/core/LinphoneFriendImpl.java @@ -0,0 +1,80 @@ +/* +LinphoneFriendImpl.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.core; + +class LinphoneFriendImpl implements LinphoneFriend { + protected final long nativePtr; + private native long newLinphoneFriend(String friendUri); + private native void setAddress(long nativePtr,long friend); + private native long getAddress(long nativePtr); + private native void setIncSubscribePolicy(long nativePtr,int enumValue); + private native int getIncSubscribePolicy(long nativePtr); + private native void enableSubscribes(long nativePtr,boolean value); + private native boolean isSubscribesEnabled(long nativePtr); + private native int getStatus(long nativePtr); + private native void edit(long nativePtr); + private native void done(long nativePtr); + + private native void delete(long ptr); + boolean ownPtr = false; + protected LinphoneFriendImpl() { + nativePtr = newLinphoneFriend(null); + } + protected LinphoneFriendImpl(String friendUri) { + nativePtr = newLinphoneFriend(friendUri); + } + protected LinphoneFriendImpl(long aNativePtr) { + nativePtr = aNativePtr; + ownPtr=false; + } + protected void finalize() throws Throwable { + if (ownPtr) delete(nativePtr); + } + public void setAddress(LinphoneAddress anAddress) { + this.setAddress(nativePtr, ((LinphoneAddressImpl)anAddress).nativePtr); + + } + public LinphoneAddress getAddress() { + return new LinphoneAddressImpl(getAddress(nativePtr)); + } + public void setIncSubscribePolicy(SubscribePolicy policy) { + setIncSubscribePolicy(nativePtr,policy.mValue); + + } + public SubscribePolicy getIncSubscribePolicy() { + return SubscribePolicy.fromInt(getIncSubscribePolicy(nativePtr)) ; + } + public void enableSubscribes(boolean enable) { + enableSubscribes(nativePtr, enable); + } + public boolean isSubscribesEnabled() { + return isSubscribesEnabled(nativePtr); + } + + public OnlineStatus getStatus() { + return OnlineStatus.fromInt(getStatus(nativePtr)); + } + public void edit() { + edit(nativePtr); + } + public void done() { + done(nativePtr); + } + +} diff --git a/src/org/linphone/core/tutorials/AndroidTutorialNotifier.java b/src/org/linphone/core/tutorials/AndroidTutorialNotifier.java new file mode 100644 index 000000000..01e0555e2 --- /dev/null +++ b/src/org/linphone/core/tutorials/AndroidTutorialNotifier.java @@ -0,0 +1,49 @@ +/* +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.core.tutorials; + +import android.os.Handler; +import android.widget.TextView; + +/** + * Write notifications to a TextView widget. + * + * @author Guillaume Beraudo + * + */ +public 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()); + } + }); + } +} diff --git a/src/org/linphone/core/tutorials/TutorialBuddyStatusActivity.java b/src/org/linphone/core/tutorials/TutorialBuddyStatusActivity.java new file mode 100644 index 000000000..376afadfb --- /dev/null +++ b/src/org/linphone/core/tutorials/TutorialBuddyStatusActivity.java @@ -0,0 +1,98 @@ +/* +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.core.tutorials; + +import org.linphone.R; +import org.linphone.core.LinphoneCoreException; + +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:tested@10.0.2.6:5059"; + private TextView sipAddressWidget; + 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); + + // 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 { + tutorial.launchTutorial(sipAddressWidget.getText().toString()); + mHandler.post(new Runnable() { + public void run() { + buttonCall.setEnabled(true); + } + }); + } catch (LinphoneCoreException e) { + e.printStackTrace(); + } + } + } +} diff --git a/src/org/linphone/core/tutorials/TutorialChatRoomActivity.java b/src/org/linphone/core/tutorials/TutorialChatRoomActivity.java new file mode 100644 index 000000000..aa4623eeb --- /dev/null +++ b/src/org/linphone/core/tutorials/TutorialChatRoomActivity.java @@ -0,0 +1,98 @@ +/* +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.core.tutorials; + +import org.linphone.R; +import org.linphone.core.LinphoneCoreException; + +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:tested@10.0.2.6:5059"; + 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(); + } + } + } +} diff --git a/src/org/linphone/core/tutorials/TutorialHelloWorldActivity.java b/src/org/linphone/core/tutorials/TutorialHelloWorldActivity.java new file mode 100644 index 000000000..3ef643a61 --- /dev/null +++ b/src/org/linphone/core/tutorials/TutorialHelloWorldActivity.java @@ -0,0 +1,98 @@ +/* +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.core.tutorials; + +import org.linphone.R; +import org.linphone.core.LinphoneCoreException; + +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:tested@10.0.2.6:5059"; + 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(); + } + } + } +} diff --git a/src/org/linphone/core/tutorials/TutorialRegistrationActivity.java b/src/org/linphone/core/tutorials/TutorialRegistrationActivity.java new file mode 100644 index 000000000..4da10f632 --- /dev/null +++ b/src/org/linphone/core/tutorials/TutorialRegistrationActivity.java @@ -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.core.tutorials; + +import org.linphone.R; +import org.linphone.core.LinphoneCoreException; + +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:8182449901ip@mty11.axtel.net"; + private static final String defaultSipPassword = "49901"; + private TextView sipAddressWidget; + private TextView sipPasswordWidget; + private TutorialRegistration tutorial; + private Button buttonCall; + private Handler mHandler = new Handler(); + + + @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 + final TextView 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.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(), + sipPasswordWidget.getText().toString()); + mHandler.post(new Runnable() { + public void run() { + buttonCall.setEnabled(true); + } + }); + } catch (LinphoneCoreException e) { + e.printStackTrace(); + } + } + } +} diff --git a/submodules/linphone b/submodules/linphone index 92b5747b7..7db8fc8c9 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 92b5747b7cfcff39dd64bffae481d3c00dcee75a +Subproject commit 7db8fc8c965d7c482bec62d84c8030469f2fdef3