* #36758: add Call buton in history detail screen, style adjustements
diff --git a/src/org/sflphone/client/DetailHistoryActivity.java b/src/org/sflphone/client/DetailHistoryActivity.java
index 27ef263..2c9da79 100644
--- a/src/org/sflphone/client/DetailHistoryActivity.java
+++ b/src/org/sflphone/client/DetailHistoryActivity.java
@@ -34,6 +34,8 @@
import org.sflphone.R;
import org.sflphone.fragments.DetailsHistoryEntryFragment;
import org.sflphone.fragments.HistoryFragment;
+import org.sflphone.model.Conference;
+import org.sflphone.model.SipCall;
import org.sflphone.service.ISipService;
import org.sflphone.service.SipService;
@@ -119,9 +121,16 @@
};
@Override
- public void onCallDialed(String to) {
- // TODO Stub de la méthode généré automatiquement
-
- }
+ public void onCall(SipCall call) {
+ Bundle bundle = new Bundle();
+ Conference tmp = new Conference("-1");
+ tmp.getParticipants().add(call);
+
+ bundle.putParcelable("conference", tmp);
+ Intent intent = new Intent().setClass(this, CallActivity.class);
+ intent.putExtra("resuming", false);
+ intent.putExtras(bundle);
+ startActivity(intent);
+ }
}
\ No newline at end of file
diff --git a/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java b/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
index 7f03e3f..72b990a 100644
--- a/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
+++ b/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
@@ -31,13 +31,19 @@
package org.sflphone.fragments;
+import java.io.InvalidObjectException;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.NavigableMap;
import org.sflphone.R;
import org.sflphone.adapters.ContactPictureTask;
+import org.sflphone.model.Account;
import org.sflphone.model.HistoryEntry;
import org.sflphone.model.HistoryEntry.HistoryCall;
+import org.sflphone.model.SipCall;
import org.sflphone.service.ISipService;
import org.sflphone.views.parallaxscrollview.AnotherView;
@@ -63,7 +69,6 @@
public class DetailsHistoryEntryFragment extends Fragment {
- View mheaderView;
DetailHistoryAdapter mAdapter;
HistoryEntry toDisplay;
private static final String TAG = DetailsHistoryEntryFragment.class.getSimpleName();
@@ -84,16 +89,16 @@
}
@Override
- public void onCallDialed(String to) {
+ public void onCall(SipCall call) {
}
};
public interface Callbacks {
- public void onCallDialed(String to);
-
public ISipService getService();
+
+ public void onCall(SipCall call);
}
@@ -119,11 +124,6 @@
super.onCreate(savedInstanceState);
toDisplay = (HistoryEntry) getArguments().get("entry");
-
- Log.i(TAG, "Ok, we got " + toDisplay.getIncoming_sum() + " incoming calls");
- Log.i(TAG, "Ok, we got " + toDisplay.getMissed_sum() + " missed calls");
- Log.i(TAG, "Ok, we got " + toDisplay.getOutgoing_sum() + " outgoing calls");
-
mAdapter = new DetailHistoryAdapter(toDisplay.getCalls(), getActivity());
}
@@ -145,13 +145,32 @@
tasker.run();
anotherView = (AnotherView) inflatedView.findViewById(R.id.anotherView);
- ((TextView) anotherView.findViewById(R.id.history_entry_number)).setText(toDisplay.getNumber());
+ ((TextView) anotherView.findViewById(R.id.history_entry_number)).setText(getString(R.string.detail_hist_call_number, toDisplay.getNumber()));
((RelativeLayout) anotherView.findViewById(R.id.call_main_action)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- Log.i(TAG, "Clicking");
- mCallbacks.onCallDialed(toDisplay.getNumber());
+ try {
+ SipCall.SipCallBuilder callBuilder = SipCall.SipCallBuilder.getInstance();
+
+ HashMap<String, String> details = (HashMap<String, String>) mCallbacks.getService().getAccountDetails(toDisplay.getAccountID());
+ ArrayList<HashMap<String, String>> creds;
+
+ creds = (ArrayList<HashMap<String, String>>) mCallbacks.getService().getCredentials(toDisplay.getAccountID());
+
+ callBuilder.startCallCreation().setAccount(new Account(toDisplay.getAccountID(), details, creds))
+ .setCallType(SipCall.state.CALL_TYPE_OUTGOING);
+ callBuilder.setContact(toDisplay.getContact());
+
+ mCallbacks.onCall(callBuilder.build());
+
+ } catch (RemoteException e) {
+ // TODO Bloc catch généré automatiquement
+ e.printStackTrace();
+ } catch (InvalidObjectException e) {
+ // TODO Bloc catch généré automatiquement
+ e.printStackTrace();
+ }
}
});
diff --git a/src/org/sflphone/model/SipCall.java b/src/org/sflphone/model/SipCall.java
index f70649b..d9db35a 100644
--- a/src/org/sflphone/model/SipCall.java
+++ b/src/org/sflphone/model/SipCall.java
@@ -35,8 +35,6 @@
import java.util.ArrayList;
import java.util.Random;
-import org.sflphone.service.StringMap;
-
import android.content.ContentResolver;
import android.os.Parcel;
import android.os.Parcelable;
diff --git a/src/org/sflphone/service/SipService.java b/src/org/sflphone/service/SipService.java
index e2c62f7..f4e79ff 100644
--- a/src/org/sflphone/service/SipService.java
+++ b/src/org/sflphone/service/SipService.java
@@ -34,6 +34,7 @@
import java.util.Random;
import org.sflphone.R;
+import org.sflphone.client.CallActivity;
import org.sflphone.client.HomeActivity;
import org.sflphone.model.Codec;
import org.sflphone.model.Conference;