From d5a3e7b345d894a1fc40691d1cd7c242947ebe11 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 21 Jun 2012 10:05:25 +0200 Subject: [PATCH] First changes for the new UI --- LinphoneCallLogImpl.java | 18 +++- LinphoneCoreImpl.java | 18 +++- tutorials/AndroidTutorialNotifier.java | 50 --------- tutorials/TutorialBuddyStatusActivity.java | 109 -------------------- tutorials/TutorialChatRoomActivity.java | 98 ------------------ tutorials/TutorialHelloWorldActivity.java | 98 ------------------ tutorials/TutorialRegistrationActivity.java | 103 ------------------ 7 files changed, 31 insertions(+), 463 deletions(-) delete mode 100644 tutorials/AndroidTutorialNotifier.java delete mode 100644 tutorials/TutorialBuddyStatusActivity.java delete mode 100644 tutorials/TutorialChatRoomActivity.java delete mode 100644 tutorials/TutorialHelloWorldActivity.java delete mode 100644 tutorials/TutorialRegistrationActivity.java diff --git a/LinphoneCallLogImpl.java b/LinphoneCallLogImpl.java index 1bdb8472..996b51c1 100644 --- a/LinphoneCallLogImpl.java +++ b/LinphoneCallLogImpl.java @@ -26,11 +26,14 @@ class LinphoneCallLogImpl implements LinphoneCallLog { private native long getFrom(long nativePtr); private native long getTo(long nativePtr); private native boolean isIncoming(long nativePtr); + private native int getStatus(long nativePtr); + private native String getStartDate(long nativePtr); + private native int getCallDuration(long nativePtr); + LinphoneCallLogImpl(long aNativePtr) { nativePtr = aNativePtr; } - public CallDirection getDirection() { return isIncoming(nativePtr)?CallDirection.Incoming:CallDirection.Outgoing; } @@ -43,7 +46,18 @@ class LinphoneCallLogImpl implements LinphoneCallLog { return new LinphoneAddressImpl(getTo(nativePtr)); } public CallStatus getStatus() { - throw new RuntimeException("not implemented yet"); + return LinphoneCallLog.CallStatus.fromInt(getStatus(nativePtr)); + } + + public long getNativePtr() { + return nativePtr; } + public String getStartDate() { + return getStartDate(nativePtr); + } + + public int getCallDuration() { + return getCallDuration(nativePtr); + } } diff --git a/LinphoneCoreImpl.java b/LinphoneCoreImpl.java index 54f6383a..75e88525 100644 --- a/LinphoneCoreImpl.java +++ b/LinphoneCoreImpl.java @@ -20,12 +20,10 @@ package org.linphone.core; import java.io.File; import java.io.IOException; -import java.util.Vector; class LinphoneCoreImpl implements LinphoneCore { - @SuppressWarnings("unused") private final LinphoneCoreListener mListener; //to make sure to keep a reference on this object private long nativePtr = 0; private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata); @@ -108,7 +106,9 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setMediaEncryption(long nativePtr, int menc); private native boolean isMediaEncryptionMandatory(long nativePtr); private native void setMediaEncryptionMandatory(long nativePtr, boolean yesno); - + private native void removeCallLog(long nativePtr, long callLogPtr); + private native int getMissedCallsCount(long nativePtr); + private native void resetMissedCallsCount(long nativePtr); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -704,4 +704,16 @@ class LinphoneCoreImpl implements LinphoneCore { { setCpuCountNative(count); } + + public int getMissedCallsCount() { + return getMissedCallsCount(nativePtr); + } + + public void removeCallLog(LinphoneCallLog log) { + removeCallLog(nativePtr, log.getNativePtr()); + } + + public void resetMissedCallsCount() { + resetMissedCallsCount(nativePtr); + } } diff --git a/tutorials/AndroidTutorialNotifier.java b/tutorials/AndroidTutorialNotifier.java deleted file mode 100644 index 7721f7dc..00000000 --- a/tutorials/AndroidTutorialNotifier.java +++ /dev/null @@ -1,50 +0,0 @@ -/* -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. - * 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()); - } - }); - } -} diff --git a/tutorials/TutorialBuddyStatusActivity.java b/tutorials/TutorialBuddyStatusActivity.java deleted file mode 100644 index 1bf4f981..00000000 --- a/tutorials/TutorialBuddyStatusActivity.java +++ /dev/null @@ -1,109 +0,0 @@ -/* -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:"; - 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(); - } - } - } -} diff --git a/tutorials/TutorialChatRoomActivity.java b/tutorials/TutorialChatRoomActivity.java deleted file mode 100644 index f7dab4ce..00000000 --- a/tutorials/TutorialChatRoomActivity.java +++ /dev/null @@ -1,98 +0,0 @@ -/* -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:"; - 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/tutorials/TutorialHelloWorldActivity.java b/tutorials/TutorialHelloWorldActivity.java deleted file mode 100644 index 60bd872c..00000000 --- a/tutorials/TutorialHelloWorldActivity.java +++ /dev/null @@ -1,98 +0,0 @@ -/* -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:"; - 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/tutorials/TutorialRegistrationActivity.java b/tutorials/TutorialRegistrationActivity.java deleted file mode 100644 index 94670480..00000000 --- a/tutorials/TutorialRegistrationActivity.java +++ /dev/null @@ -1,103 +0,0 @@ -/* -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:"; - 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()); - } - } - } -} -- 2.39.2