From 14323bedbd2108ee0f290be5f66c50f919f8bca9 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.com> Date: Wed, 24 Oct 2012 10:02:13 -0400 Subject: [PATCH] #16889: Launch CallActivity on new call --- AndroidManifest.xml | 2 + res/layout/activity_sflphone_home.xml | 2 +- res/layout/call_element_list.xml | 6 ++ .../sflphone/client/CallActivity.java | 47 ++++++++++++ .../sflphone/client/SFLPhoneHome.java | 11 +++ .../sflphone/service/CallManagerCallBack.java | 5 ++ .../sflphone/utils/AccountList.java | 43 +++++++++++ .../sflphone/utils/CallList.java | 73 +++++++++++++++++++ 8 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 src/com/savoirfairelinux/sflphone/client/CallActivity.java create mode 100644 src/com/savoirfairelinux/sflphone/utils/AccountList.java create mode 100644 src/com/savoirfairelinux/sflphone/utils/CallList.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3d7cf9cd3..f6ed3c599 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -69,6 +69,8 @@ as that of the covered work. </activity> <activity android:name=".client.AccountCreationActivity" android:label="@string/app_name"/> + <activity android:name=".client.CallActivity" + android:label="@string/app_name"/> <receiver android:name=".client.receiver.NewOutgoingCallReceiver" android:exported="true" > diff --git a/res/layout/activity_sflphone_home.xml b/res/layout/activity_sflphone_home.xml index bc7d2394a..851d06799 100644 --- a/res/layout/activity_sflphone_home.xml +++ b/res/layout/activity_sflphone_home.xml @@ -99,4 +99,4 @@ as that of the covered work. <!-- android:src="@drawable/ic_incomingcall" /> --> </LinearLayout> -</LinearLayout> \ No newline at end of file +</LinearLayout> diff --git a/res/layout/call_element_list.xml b/res/layout/call_element_list.xml index 015f1b460..1e80feecf 100644 --- a/res/layout/call_element_list.xml +++ b/res/layout/call_element_list.xml @@ -37,6 +37,12 @@ as that of the covered work. android:paddingLeft="8dp" android:paddingRight="8dp" > + <Button + android:id="@+id/account_selection_button" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:text="No Account Selected"/> + <ListView android:id="@id/android:list" android:layout_width="match_parent" diff --git a/src/com/savoirfairelinux/sflphone/client/CallActivity.java b/src/com/savoirfairelinux/sflphone/client/CallActivity.java new file mode 100644 index 000000000..925d8598d --- /dev/null +++ b/src/com/savoirfairelinux/sflphone/client/CallActivity.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. + * + * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> + * + * 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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ + +package com.savoirfairelinux.sflphone.client; + +import android.app.Activity; +import android.os.Bundle; + +import com.savoirfairelinux.sflphone.R; + +public class CallActivity extends Activity +{ + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.call_activity_layout); + } +} diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java index 861970cea..06e1eae3a 100644 --- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java +++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java @@ -438,6 +438,7 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC } public void processingNewCallAction() { + /* Log.d(TAG, "ProcessingNewCallAction()"); TextView textView = (TextView) findViewById(R.id.editAccountID); String accountID = mAccountList.currentAccountID; @@ -475,12 +476,15 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC callOnGoing = true; buttonCall.setEnabled(false); buttonHangup.setEnabled(true); + launchCallActivity(); //} } } catch (RemoteException e) { Log.e(TAG, "Cannot call service method", e); } + */ + launchCallActivity(); } public void processingHangUpAction() { @@ -507,4 +511,11 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC buttonCall.setImageResource(R.drawable.ic_call); } + + private void launchCallActivity() + { + Log.i(TAG, "Launch Call Activity"); + Intent intent = new Intent().setClass(this, CallActivity.class); + startActivity(intent); + } } diff --git a/src/com/savoirfairelinux/sflphone/service/CallManagerCallBack.java b/src/com/savoirfairelinux/sflphone/service/CallManagerCallBack.java index a453ae10c..602eaa959 100644 --- a/src/com/savoirfairelinux/sflphone/service/CallManagerCallBack.java +++ b/src/com/savoirfairelinux/sflphone/service/CallManagerCallBack.java @@ -11,6 +11,11 @@ public class CallManagerCallBack extends Callback { Log.d(TAG, "on_new_call_created(" + accountID + ", " + callID + ", " + to + ")"); } + @Override + public void on_call_state_changed(String callID, String state) { + Log.d(TAG, "on_call_state_changed(" + callID + ", " + state + ")"); + } + @Override public void on_incoming_call(String accountID, String callID, String from) { Log.d(TAG, "on_incoming_call(" + accountID + ", " + callID + ", " + from + ")"); diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountList.java b/src/com/savoirfairelinux/sflphone/utils/AccountList.java new file mode 100644 index 000000000..27604c5d3 --- /dev/null +++ b/src/com/savoirfairelinux/sflphone/utils/AccountList.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. + * + * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> + * + * 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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ + +package com.savoirfairelinux.sflphone.utils; + +public class AccountList +{ + static final String TAG = "AccountList"; + public String currentAccountID = "Account:1345153770"; + // private HashMap<String, AccountPreferenceScreen> mAccountList = new HashMap<String, AccountPreferenceScreen>(); + + public AccountList() { + + } +} diff --git a/src/com/savoirfairelinux/sflphone/utils/CallList.java b/src/com/savoirfairelinux/sflphone/utils/CallList.java new file mode 100644 index 000000000..20d3dae84 --- /dev/null +++ b/src/com/savoirfairelinux/sflphone/utils/CallList.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. + * + * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> + * + * 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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ + +package com.savoirfairelinux.sflphone.utils; + +import com.savoirfairelinux.sflphone.client.SipCall; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +import java.util.ArrayList; + +public class CallList extends BroadcastReceiver +{ + static final String TAG = "CallList"; + ArrayList<SipCall> mList = new ArrayList<SipCall>(); + + private enum Signals { + NEW_CALL_CREATED, + INCOMING_CALL, + INCOMING_MESSAGE, + CALL_STATE_CHANGED + } + + @Override + public void onReceive(Context context, Intent intent) + { + String signalName = intent.getStringExtra("signal-name"); + Log.d(TAG, "Signal received: " + signalName); + + Signals signalReceived = Signals.valueOf(signalName.toUpperCase()); + switch(signalReceived) { + case NEW_CALL_CREATED: + break; + case INCOMING_CALL: + break; + case INCOMING_MESSAGE: + break; + case CALL_STATE_CHANGED: + break; + } + } +} -- GitLab