* #38138: added clear history feature for debugging.
diff --git a/src/org/sflphone/fragments/HistoryFragment.java b/src/org/sflphone/fragments/HistoryFragment.java
index 2c1624a..cd5f3e7 100644
--- a/src/org/sflphone/fragments/HistoryFragment.java
+++ b/src/org/sflphone/fragments/HistoryFragment.java
@@ -34,6 +34,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import android.view.*;
import org.sflphone.R;
import org.sflphone.adapters.ContactPictureTask;
import org.sflphone.client.DetailHistoryActivity;
@@ -50,10 +51,7 @@
import android.support.v4.app.ListFragment;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
import android.view.View.OnClickListener;
-import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
@@ -110,9 +108,32 @@
}
@Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ super.onCreateOptionsMenu(menu, inflater);
+ inflater.inflate(R.menu.history, menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.menu_clear_history:
+ try {
+ mCallbacks.getService().clearHistory();
+ getLoaderManager().restartLoader(LoaderConstants.HISTORY_LOADER, null, this);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAdapter = new HistoryAdapter(getActivity(), new ArrayList<HistoryEntry>());
+ setHasOptionsMenu(true);
}
@Override
@@ -146,6 +167,7 @@
public void onStart() {
super.onStart();
Log.w(TAG, "onStart");
+ getActivity().supportInvalidateOptionsMenu();
getLoaderManager().restartLoader(LoaderConstants.HISTORY_LOADER, null, this);
}
@@ -167,7 +189,7 @@
@Override
public View getView(final int pos, View convertView, ViewGroup arg2) {
- HistoryView entryView = null;
+ HistoryView entryView;
if (convertView == null) {
// Get a new instance of the row layout view
@@ -237,9 +259,11 @@
}
- /*********************
+ /**
+ * ******************
* ViewHolder Pattern
- *********************/
+ * *******************
+ */
public class HistoryView {
public ImageButton photo;
protected TextView displayName;
diff --git a/src/org/sflphone/loaders/HistoryLoader.java b/src/org/sflphone/loaders/HistoryLoader.java
index 0609450..0bdb7ba 100644
--- a/src/org/sflphone/loaders/HistoryLoader.java
+++ b/src/org/sflphone/loaders/HistoryLoader.java
@@ -75,9 +75,10 @@
}
try {
ArrayList<HashMap<String, String>> history = (ArrayList<HashMap<String, String>>) service.getHistory();
+
for (HashMap<String, String> entry : history) {
- CallContact contact = null;
+ CallContact contact;
String contactName = entry.get(ServiceConstants.history.DISPLAY_NAME_KEY);
String number_called = entry.get(ServiceConstants.history.PEER_NUMBER_KEY);
if (contactName.isEmpty()) {
diff --git a/src/org/sflphone/receivers/OutgoingCallReceiver.java b/src/org/sflphone/receivers/OutgoingCallReceiver.java
deleted file mode 100644
index 3baea2c..0000000
--- a/src/org/sflphone/receivers/OutgoingCallReceiver.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2004-2014 Savoir-Faire Linux Inc.
- *
- * Author: Alexandre Lision <alexandre.lision@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 org.sflphone.receivers;
-
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.util.Log;
-
-/**
- * External Receiver, registered in Android System
- * @author lisional
- *
- */
-public class OutgoingCallReceiver extends BroadcastReceiver
-{
-
- @Override
- public void onReceive(Context context, Intent intent)
- {
- String incomingNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
- Log.d("NewOutgoingCallReceiver", ">>>>>> Intent.EXTRA_PHONE_NUMBER: " + incomingNumber);
- //setResultData(null);
-
-
- }
-
-}
diff --git a/src/org/sflphone/service/ISipService.aidl b/src/org/sflphone/service/ISipService.aidl
index c1718d3..9d8a326 100644
--- a/src/org/sflphone/service/ISipService.aidl
+++ b/src/org/sflphone/service/ISipService.aidl
@@ -37,6 +37,7 @@
/* History */
List getHistory();
+ void clearHistory();
/* Notification */
void createNotification();
diff --git a/src/org/sflphone/service/SipService.java b/src/org/sflphone/service/SipService.java
index 0f8d141..439a6ab 100644
--- a/src/org/sflphone/service/SipService.java
+++ b/src/org/sflphone/service/SipService.java
@@ -629,6 +629,18 @@
return nativemap;
}
+ @Override
+ public void clearHistory() throws RemoteException {
+ getExecutor().execute(new SipRunnable() {
+ @Override
+ protected void doRun() throws SameThreadException {
+ Log.i(TAG, "SipService.clearHistory() thread running...");
+ configurationManagerJNI.clearHistory();
+ }
+ });
+
+ }
+
/*************************
* Transfer related API
*************************/