#15735: Launch account creation panel from preferences
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4a0655e..3d7cf9c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -67,7 +67,8 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="com.savoirfairelinux.sflphone.client.SFLPhoneHome" />
</activity>
-
+ <activity android:name=".client.AccountCreationActivity"
+ android:label="@string/app_name"/>
<receiver
android:name=".client.receiver.NewOutgoingCallReceiver"
android:exported="true" >
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java b/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
new file mode 100644
index 0000000..11a7011
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.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.os.Bundle;
+import android.preference.PreferenceActivity;
+
+import com.savoirfairelinux.sflphone.R;
+
+public class AccountCreationActivity extends PreferenceActivity
+{
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.account_creation_preferences);
+ }
+}
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java b/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
index a73c050..02d87e0 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
+++ b/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
@@ -32,6 +32,7 @@
package com.savoirfairelinux.sflphone.client;
import android.app.Activity;
+import android.content.Intent;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
@@ -57,6 +58,7 @@
static final String TAG = "AccountManagementFragment";
static final String CURRENT_VALUE = "Current value:: ";
static final String DEFAULT_ACCOUNT_ID = "IP2IP";
+ static final int ACCOUNT_CREATE_REQUEST = 1;
private ISipService service;
// HashMap<String, String> mAccountDetails = null;
// ArrayList<String> mAccountList = null;
@@ -203,6 +205,12 @@
}
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == ACCOUNT_CREATE_REQUEST) {
+ }
+ }
+
boolean onTextEditPreferenceChange(Preference preference, Object newValue)
{
Log.i(TAG, "Account Preference Changed " + preference.getTitle());
@@ -220,13 +228,23 @@
};
- Preference.OnPreferenceClickListener preferenceClick = new Preference.OnPreferenceClickListener() {
+ Preference.OnPreferenceClickListener launchAccountCreationOnClick = new Preference.OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
- return false;
+ if(preference.getTitle() == "Touch to Create New Account") {
+ launchAccountCreationPanel();
+ }
+ return true;
}
};
- ArrayList<String> getAccountList()
+ private void launchAccountCreationPanel()
+ {
+ Log.i("MainSandbox", "launchPreferencePanel");
+ Intent intent = new Intent().setClass(getActivity(), AccountCreationActivity.class);
+ startActivityForResult(intent, ACCOUNT_CREATE_REQUEST);
+ }
+
+ private ArrayList<String> getAccountList()
{
ArrayList<String> accountList = null;
try {
@@ -241,7 +259,7 @@
return accountList;
}
- HashMap getAccountDetails(String accountID)
+ private HashMap getAccountDetails(String accountID)
{
HashMap accountDetails = null;
try {
@@ -276,8 +294,12 @@
for(String s : accountList)
root.addPreference(getAccountPreferenceScreen(s));
-
-
+
+ Preference createNewAccount = new Preference(currentContext);
+ createNewAccount.setTitle("Touch to Create New Account");
+ createNewAccount.setOnPreferenceClickListener(launchAccountCreationOnClick);
+ // createNewAccount.setIntent(new Intent().setClass(getActivity(), AccountCreationActivity.class));
+ root.addPreference(createNewAccount);
return root;
}