* #29924: added quick access to calls
diff --git a/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java b/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java
index 9cd73ff..9be19a4 100644
--- a/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java
+++ b/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java
@@ -29,18 +29,6 @@
for (int i = 0; i < swigmap.size(); ++i) {
HashMap<String, String> entry = new HashMap<String, String>();
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_ACCOUNT_ID_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_CALLID_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_CONFID_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_DISPLAY_NAME_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_PEER_NUMBER_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_RECORDING_PATH_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_STATE_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_TIMESTAMP_START_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_TIMESTAMP_STOP_KEY));
-// Log.i(TAG, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_AUDIO_CODEC_KEY));
-
-
entry.put(ServiceConstants.HISTORY_ACCOUNT_ID_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_ACCOUNT_ID_KEY));
entry.put(ServiceConstants.HISTORY_CALLID_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_CALLID_KEY));
entry.put(ServiceConstants.HISTORY_CONFID_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_CONFID_KEY));
diff --git a/src/com/savoirfairelinux/sflphone/adapters/SectionsPagerAdapter.java b/src/com/savoirfairelinux/sflphone/adapters/SectionsPagerAdapter.java
index 154dc61..f58ad4f 100644
--- a/src/com/savoirfairelinux/sflphone/adapters/SectionsPagerAdapter.java
+++ b/src/com/savoirfairelinux/sflphone/adapters/SectionsPagerAdapter.java
@@ -6,6 +6,7 @@
import android.app.FragmentManager;
import android.content.Context;
import android.os.Bundle;
+import android.os.RemoteException;
import android.support.v13.app.FragmentStatePagerAdapter;
import android.util.Log;
@@ -83,4 +84,14 @@
}
return null;
}
+
+ public void updateHome() {
+ try {
+ ((HomeFragment) fragments.get(1)).updateLists();
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch (Exception e1){
+ e1.printStackTrace();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/com/savoirfairelinux/sflphone/client/CallActivity.java b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
index a36df9d..4799565 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
@@ -75,8 +75,8 @@
CallListFragment mCallsFragment;
CallFragment mCurrentCallFragment;
private boolean fragIsChanging;
-
- /* result code sent in c&ase of call failure*/
+
+ /* result code sent in c&ase of call failure */
public static int RESULT_FAILURE = -10;
@Override
@@ -210,12 +210,9 @@
if (getIntent().getBooleanExtra("resuming", false)) {
Bundle b = new Bundle();
- try {
- b.putParcelable("conference", (Conference) service.getCurrentCall());
- mCurrentCallFragment.setArguments(b);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
+ b.putParcelable("conference", (Conference) getIntent().getParcelableExtra("conference"));
+ mCurrentCallFragment.setArguments(b);
+
} else {
mCurrentCallFragment.setArguments(getIntent().getExtras());
}
@@ -233,7 +230,6 @@
public void onServiceDisconnected(ComponentName arg0) {
}
};
-
@Override
public void incomingCall(Intent call) {
@@ -257,7 +253,7 @@
* newState = bundle.getString("State");
*/
// CallFragment fr = mCurrentCallFragment;
-
+
mCallsFragment.update();
if (mCurrentCallFragment != null)
@@ -413,7 +409,7 @@
public void onRecordCall(SipCall call) {
try {
-// service.setRecordPath(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator);
+ // service.setRecordPath(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator);
Log.w(TAG, "Recording path " + service.getRecordPath());
service.toggleRecordingCall(call.getCallId());
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
index b016529..cd6e592 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
@@ -59,7 +59,6 @@
import android.view.MenuItem;
import android.view.View;
import android.widget.RelativeLayout;
-import android.widget.TabHost.TabContentFactory;
import android.widget.Toast;
import com.savoirfairelinux.sflphone.R;
@@ -86,13 +85,7 @@
SectionsPagerAdapter mSectionsPagerAdapter = null;
static final String TAG = "SFLPhoneHomeActivity";
- /**
- * Fragments used
- */
private ContactListFragment mContactsFragment = null;
- // private DialingFragment mDialingFragment = null;
- // private CallElementListFragment mCallElementList = null;
- // private HistoryFragment mHistorySectionFragment = null;
private MenuFragment fMenu;
private boolean mBound = false;
@@ -438,7 +431,7 @@
String cID = b.getString("CallID");
String state = b.getString("State");
Log.i(TAG, "callStateChanged" + cID + " " + state);
- // mCallElementList.updateCall(cID, state);
+ mSectionsPagerAdapter.updateHome();
}
@@ -554,36 +547,6 @@
}
- /**
- * A simple factory that returns dummy views to the Tabhost
- *
- * @author mwho
- */
- class TabFactory implements TabContentFactory {
-
- private final Context mContext;
-
- /**
- * @param context
- */
- public TabFactory(Context context) {
- mContext = context;
- }
-
- /**
- * (non-Javadoc)
- *
- * @see android.widget.TabHost.TabContentFactory#createTabContent(java.lang.String)
- */
- public View createTabContent(String tag) {
- View v = new View(mContext);
- v.setMinimumWidth(0);
- v.setMinimumHeight(0);
- return v;
- }
-
- }
-
@Override
public void openDrawer() {
mDrawer.animateOpen();
@@ -614,10 +577,12 @@
}
@Override
- public void resumeCallActivity() {
+ public void selectedCall(Conference c) {
Intent intent = new Intent().setClass(this, CallActivity.class);
intent.putExtra("resuming", true);
+ intent.putExtra("conference", c);
startActivityForResult(intent, REQUEST_CODE_CALL);
}
+
}
diff --git a/src/com/savoirfairelinux/sflphone/fragments/HomeFragment.java b/src/com/savoirfairelinux/sflphone/fragments/HomeFragment.java
index e4dc552..eba51ee 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/HomeFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/HomeFragment.java
@@ -45,6 +45,8 @@
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;
import android.widget.Button;
import android.widget.ListView;
@@ -59,9 +61,8 @@
private static final String TAG = HomeFragment.class.getSimpleName();
private Callbacks mCallbacks = sDummyCallbacks;
- Button access_calls;
+// Button access_calls;
TextView nb_calls, nb_confs;
- ListView list_calls;
CallListAdapter confs_adapter;
private CallListAdapter calls_adapter;
@@ -78,7 +79,7 @@
}
@Override
- public void resumeCallActivity() {
+ public void selectedCall(Conference c) {
}
};
@@ -90,7 +91,7 @@
public ISipService getService();
- public void resumeCallActivity();
+ public void selectedCall(Conference c);
}
@@ -112,17 +113,7 @@
if (mCallbacks.getService() != null) {
try {
- HashMap<String, SipCall> calls = (HashMap<String, SipCall>) mCallbacks.getService().getCallList();
- HashMap<String, Conference> confs = (HashMap<String, Conference>) mCallbacks.getService().getConferenceList();
-
- updateCallList(calls);
- updateConferenceList(confs);
-
- if (!calls.isEmpty() || !confs.isEmpty()) {
- access_calls.setVisibility(View.VISIBLE);
- } else {
- access_calls.setVisibility(View.GONE);
- }
+ updateLists();
} catch (RemoteException e) {
Log.e(TAG, e.toString());
@@ -131,6 +122,14 @@
}
+ public void updateLists() throws RemoteException {
+ HashMap<String, SipCall> calls = (HashMap<String, SipCall>) mCallbacks.getService().getCallList();
+ HashMap<String, Conference> confs = (HashMap<String, Conference>) mCallbacks.getService().getConferenceList();
+
+ updateCallList(calls);
+ updateConferenceList(confs);
+ }
+
private void updateConferenceList(HashMap<String, Conference> confs) {
nb_confs.setText("" + confs.size());
confs_adapter.update(new ArrayList<Conference>(confs.values()));
@@ -145,7 +144,7 @@
confOne.getParticipants().add(call);
conferences.add(confOne);
}
-
+
calls_adapter.update(conferences);
}
@@ -187,28 +186,28 @@
Log.i(TAG, "onCreateView");
View inflatedView = inflater.inflate(R.layout.frag_home, container, false);
- access_calls = (Button) inflatedView.findViewById(R.id.access_callactivity);
-
nb_calls = (TextView) inflatedView.findViewById(R.id.calls_counter);
nb_confs = (TextView) inflatedView.findViewById(R.id.confs_counter);
- list_calls = (ListView) inflatedView.findViewById(R.id.calls_list);
confs_adapter = new CallListAdapter(getActivity());
((ListView) inflatedView.findViewById(R.id.confs_list)).setAdapter(confs_adapter);
-
+
calls_adapter = new CallListAdapter(getActivity());
((ListView) inflatedView.findViewById(R.id.calls_list)).setAdapter(calls_adapter);
-
- access_calls.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- mCallbacks.resumeCallActivity();
- }
- });
+ ((ListView) inflatedView.findViewById(R.id.calls_list)).setOnItemClickListener(callClickListener);
+ ((ListView) inflatedView.findViewById(R.id.confs_list)).setOnItemClickListener(callClickListener);
return inflatedView;
}
+
+ OnItemClickListener callClickListener= new OnItemClickListener() {
+
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View v, int arg2, long arg3) {
+ mCallbacks.selectedCall((Conference)v.getTag());
+ }
+ };
+
public class CallListAdapter extends BaseAdapter {
@@ -258,9 +257,6 @@
((TextView) convertView.findViewById(R.id.call_title)).setText(call.getParticipants().get(0).getContact().getmDisplayName());
} else {
String tmp = "Conference with " + call.getParticipants().size() + " participants";
- // for (SipCall c : call.getParticipants()) {
- // tmp += c.getContact().getmDisplayName() + " ";
- // }
((TextView) convertView.findViewById(R.id.call_title)).setText(tmp);
}
// ((TextView) convertView.findViewById(R.id.num_participants)).setText("" + call.getParticipants().size());