Skip to content
Snippets Groups Projects
Commit 0038a614 authored by Emeric Vigier's avatar Emeric Vigier
Browse files

#17220: fix service NullPointerException issue

Conflicts:

	src/com/savoirfairelinux/sflphone/client/CallElementList.java
parent 13179524
No related branches found
No related tags found
No related merge requests found
...@@ -72,7 +72,7 @@ public class AccountManagementFragment extends PreferenceFragment ...@@ -72,7 +72,7 @@ public class AccountManagementFragment extends PreferenceFragment
static final int ACCOUNT_CREATE_REQUEST = 1; static final int ACCOUNT_CREATE_REQUEST = 1;
static final int ACCOUNT_EDIT_REQUEST = 2; static final int ACCOUNT_EDIT_REQUEST = 2;
private SFLPhonePreferenceActivity sflphonePreferenceActivity; private SFLPhonePreferenceActivity sflphonePreferenceActivity;
private ISipService service; private ISipService service = null;
ArrayList<AccountDetail.PreferenceEntry> basicDetailKeys = null; ArrayList<AccountDetail.PreferenceEntry> basicDetailKeys = null;
ArrayList<AccountDetail.PreferenceEntry> advancedDetailKeys = null; ArrayList<AccountDetail.PreferenceEntry> advancedDetailKeys = null;
...@@ -106,6 +106,19 @@ public class AccountManagementFragment extends PreferenceFragment ...@@ -106,6 +106,19 @@ public class AccountManagementFragment extends PreferenceFragment
Log.i(TAG, "Create Account Management Fragment"); Log.i(TAG, "Create Account Management Fragment");
/*
* FIXME if service cannot be obtained from SFLPhonePreferenceActivity,
* then get it from Application
*/
service = sflphonePreferenceActivity.getSipService();
if (service == null) {
service = ((SFLphoneApplication)sflphonePreferenceActivity.getApplication()).getSipService();
if (service == null) {
Log.e(TAG, "onCreate() service=" + service);
}
}
Log.w(TAG, "onCreate() service=" + service);
setPreferenceScreen(getAccountListPreferenceScreen()); setPreferenceScreen(getAccountListPreferenceScreen());
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver, new IntentFilter("accounts-changed")); LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver, new IntentFilter("accounts-changed"));
......
...@@ -83,6 +83,7 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade ...@@ -83,6 +83,7 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
private CallElementAdapter mAdapter; private CallElementAdapter mAdapter;
private String mCurFilter; private String mCurFilter;
private SFLPhoneHome sflphoneHome; private SFLPhoneHome sflphoneHome;
private SFLphoneApplication sflphoneApplication;
private ISipService service; private ISipService service;
private AccountSelectionButton mAccountSelectionButton; private AccountSelectionButton mAccountSelectionButton;
private AccountList mAccountList; private AccountList mAccountList;
...@@ -303,6 +304,8 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade ...@@ -303,6 +304,8 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
Log.i(TAG, "On Long Click"); Log.i(TAG, "On Long Click");
final CharSequence[] items = {"Hang up Call", "Send Message", "Add to Conference"}; final CharSequence[] items = {"Hang up Call", "Send Message", "Add to Conference"};
final SipCall call = (SipCall) mAdapter.getItem(pos); final SipCall call = (SipCall) mAdapter.getItem(pos);
// FIXME
service = sflphoneApplication.getSipService();
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Action to perform with " + call.mCallInfo.mDisplayName) builder.setTitle("Action to perform with " + call.mCallInfo.mDisplayName)
.setCancelable(true) .setCancelable(true)
......
...@@ -89,6 +89,7 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList ...@@ -89,6 +89,7 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
Activity mContext; Activity mContext;
String mCurFilter; String mCurFilter;
private SFLPhoneHome sflphoneHome; private SFLPhoneHome sflphoneHome;
private SFLphoneApplication sflphoneApplication;
private ISipService service; private ISipService service;
private AccountSelectionButton mAccountSelectionButton; private AccountSelectionButton mAccountSelectionButton;
private AccountList mAccountList; private AccountList mAccountList;
...@@ -103,8 +104,9 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList ...@@ -103,8 +104,9 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
sflphoneHome = (SFLPhoneHome) activity; sflphoneHome = (SFLPhoneHome) activity;
service = ((SFLphoneApplication) sflphoneHome.getApplication()).getSipService(); sflphoneApplication = (SFLphoneApplication) sflphoneHome.getApplication();
mAccountList = ((SFLphoneApplication)sflphoneHome.getApplication()).getAccountList(); service = sflphoneApplication.getSipService();
mAccountList = sflphoneApplication.getAccountList();
Log.i(TAG, "onAttach() service=" + service + ", mAccountList=" + mAccountList); Log.i(TAG, "onAttach() service=" + service + ", mAccountList=" + mAccountList);
} }
...@@ -228,6 +230,8 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList ...@@ -228,6 +230,8 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
// TODO getCallInstnace should be implemented in SipCallList // TODO getCallInstnace should be implemented in SipCallList
// final SipCall call = SipCall.getCallInstance(info); // final SipCall call = SipCall.getCallInstance(info);
final SipCall call = new SipCall(info); final SipCall call = new SipCall(info);
// FIXME
service = sflphoneApplication.getSipService();
AlertDialog.Builder builder = new AlertDialog.Builder(mContext); AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle("Action to perform with " + call.mCallInfo.mDisplayName) builder.setTitle("Action to perform with " + call.mCallInfo.mDisplayName)
.setCancelable(true) .setCancelable(true)
......
...@@ -142,8 +142,8 @@ public class SFLPhonePreferenceActivity extends Activity implements ActionBar.Ta ...@@ -142,8 +142,8 @@ public class SFLPhonePreferenceActivity extends Activity implements ActionBar.Ta
mBound = false; mBound = false;
} }
stopService(new Intent(this, SipService.class)); // stopService(new Intent(this, SipService.class));
serviceIsOn = false; // serviceIsOn = false;
super.onDestroy(); super.onDestroy();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment