From d5c17f5650113614a5e90a330837e26b99a54b07 Mon Sep 17 00:00:00 2001 From: Emeric Vigier <emeric.vigier@savoirfairelinux.com> Date: Wed, 29 Aug 2012 09:29:33 -0400 Subject: [PATCH] #15046: make outgoing call from java UI --- res/layout/test_layout.xml | 64 ++++++++++++++++++- .../sflphone/client/ManagerImpl.java | 1 + .../sflphone/client/SFLPhoneHome.java | 26 ++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/res/layout/test_layout.xml b/res/layout/test_layout.xml index 358961151..dd0f0774e 100644 --- a/res/layout/test_layout.xml +++ b/res/layout/test_layout.xml @@ -44,12 +44,74 @@ as that of the covered work. android:layout_alignParentTop="true" android:onClick="onClick" android:text="init" /> + + <TextView + android:id="@+id/textAccountID" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_below="@+id/buttonInit" + android:text="AccountID" + android:ems="10" /> + + <EditText + android:id="@+id/editAccountID" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_toRightOf="@+id/textAccountID" + android:layout_below="@+id/buttonInit" + android:ems="10" /> + + <TextView + android:id="@+id/textCallID" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_below="@+id/editAccountID" + android:text="callID" + android:ems="10" /> + + <EditText + android:id="@+id/editCallID" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_toRightOf="@+id/textCallID" + android:layout_below="@+id/editAccountID" + android:ems="10" /> + + <TextView + android:id="@+id/textTo" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_below="@+id/editCallID" + android:text="to" + android:ems="10" /> + + <EditText + android:id="@+id/editTo" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_toRightOf="@+id/textTo" + android:layout_below="@+id/editCallID" + android:ems="10" /> + + <Button + android:id="@+id/buttonCall" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/editTo" + android:onClick="onClick" + android:text="placeCall" /> <TextView android:id="@+id/callVoid_text" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@+id/buttonInit" + android:layout_below="@+id/buttonCall" android:text="callVoidText" /> <Button diff --git a/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java b/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java index 374214e44..24d363584 100644 --- a/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java +++ b/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java @@ -47,4 +47,5 @@ public class ManagerImpl { public static native void setSipLogLevel(String level); public static native String getJniString(); public static native void initN(String config_file); + public static native void placeCall(String accountID, String callID, String to); } diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java index 4e231c040..dad5be5d3 100644 --- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java +++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java @@ -50,6 +50,7 @@ import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.widget.EditText; import android.widget.TextView; import com.savoirfairelinux.sflphone.R; @@ -277,6 +278,31 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC public void onClick(View view) { switch (view.getId()) { + case R.id.buttonCall: + EditText editText = (EditText) findViewById(R.id.editAccountID); + String accountID = editText.getText().toString(); + if (accountID == null) { + Log.e(TAG, "accountID is " + accountID); + break; + } + + editText = (EditText) findViewById(R.id.editCallID); + String callID = editText.getText().toString(); + if (callID == null) { + Log.e(TAG, "callID is " + callID); + break; + } + + editText = (EditText) findViewById(R.id.editTo); + String to = editText.getText().toString(); + if (to == null) { + Log.e(TAG, "to string is " + to); + break; + } + + Log.d(TAG, "ManagerImpl.placeCall(" + accountID + ", " + callID + ", " + to + ");"); + ManagerImpl.placeCall(accountID, callID, to); + break; case R.id.buttonInit: ManagerImpl.initN(""); break; -- GitLab