* #36758: add Call buton in history detail screen, style adjustements
diff --git a/res/drawable/item_generic_selector.xml b/res/drawable/item_generic_selector.xml
index 9a557e3..da0ba95 100644
--- a/res/drawable/item_generic_selector.xml
+++ b/res/drawable/item_generic_selector.xml
@@ -5,22 +5,16 @@
<solid android:color="@color/darker_gray" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
-
- <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item>
<item android:state_focused="true"><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/light" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
-
- <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item>
<item><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/light" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
-
- <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item>
-</selector>
+</selector>
\ No newline at end of file
diff --git a/res/drawable/item_history_selector.xml b/res/drawable/item_history_selector.xml
index a211cff..77f7649 100644
--- a/res/drawable/item_history_selector.xml
+++ b/res/drawable/item_history_selector.xml
@@ -5,22 +5,16 @@
<solid android:color="@color/transparent_grey" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
-
- <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item>
<item android:state_focused="true"><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/transparent_grey" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
-
- <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item>
<item><shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/transparent_light" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
-
- <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
</shape></item>
-</selector>
+</selector>
\ No newline at end of file
diff --git a/res/layout/frag_history_detail.xml b/res/layout/frag_history_detail.xml
index a4abfb2..e35588b 100644
--- a/res/layout/frag_history_detail.xml
+++ b/res/layout/frag_history_detail.xml
@@ -48,43 +48,6 @@
android:layout_height="match_parent"
android:orientation="vertical" >
- <RelativeLayout
- android:id="@+id/call_main_action"
- android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
- android:padding="5dp" >
-
- <TextView
- android:id="@+id/history_entry_number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_alignParentTop="true"
- android:singleLine="true"
- android:textSize="18sp" />
-
- <TextView
- android:id="@+id/history_entry_number_type"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:singleLine="true"
- android:textSize="18sp" />
-
- <View
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_toLeftOf="@+id/history_entry_text_message"
- android:background="@drawable/divider" />
-
- <ImageButton
- android:id="@+id/history_entry_text_message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true" />
- </RelativeLayout>
-
<LinearLayout
android:id="@+id/llMainHolder"
android:layout_width="match_parent"
@@ -92,6 +55,28 @@
android:layout_marginTop="@dimen/header_history_detail"
android:orientation="vertical" >
+ <RelativeLayout
+ android:id="@+id/call_main_action"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/listPreferredItemHeight"
+ android:background="@drawable/item_generic_selector" >
+
+ <TextView
+ android:id="@+id/history_entry_number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="10dp"
+ android:singleLine="true"
+ android:textSize="18sp" />
+ </RelativeLayout>
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="@drawable/divider" />
+
<LinearLayout
android:id="@+id/llMain"
android:layout_width="match_parent"
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index a55ebea..7828730 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -72,6 +72,9 @@
<string name="hist_out_calls">Sortant:%1$d</string>
<string name="hist_no_history">Pas d\'historique</string>
+ <!-- DetailsHistory Fragment -->
+ <string name="detail_hist_call_number">Appeler %1$s</string>
+
<!-- Home Fragment -->
<string name="home_conferences_title">Conférences</string>
<string name="home_calls_title">Appels</string>
diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml
deleted file mode 100644
index d408cbc..0000000
--- a/res/values-v11/styles.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
-
- <style name="AppTheme" parent="android:Theme.Holo.Light" />
-
-</resources>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 878e800..8d53be7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -71,6 +71,9 @@
<string name="hist_no_history">No history</string>
<string name="hist_in_calls">In:%1$d</string>
<string name="hist_out_calls">Out:%1$d</string>
+
+ <!-- DetailsHistory Fragment -->
+ <string name="detail_hist_call_number">Call %1$s</string>
<!-- Home Fragment -->
<string name="home_conferences_title">Conferences</string>
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;