* #36758: add call hourm and ;issed calls highlighting
diff --git a/res/drawable/item_history_selector.xml b/res/drawable/item_history_selector.xml
index 9a557e3..3f8e34a 100644
--- a/res/drawable/item_history_selector.xml
+++ b/res/drawable/item_history_selector.xml
@@ -16,7 +16,7 @@
<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" />
+ <solid android:color="@color/transparent_light" />
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
diff --git a/res/layout/frag_history_detail.xml b/res/layout/frag_history_detail.xml
index ce33002..b523ea6 100644
--- a/res/layout/frag_history_detail.xml
+++ b/res/layout/frag_history_detail.xml
@@ -10,8 +10,7 @@
<RelativeLayout
android:id="@+id/iv"
android:layout_width="match_parent"
- android:layout_height="@dimen/header_history_detail"
- android:background="@color/sfl_light_blue" >
+ android:layout_height="@dimen/header_history_detail" >
<ImageView
android:id="@+id/contact_photo"
@@ -20,9 +19,10 @@
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp" />
- <RelativeLayout
+ <LinearLayout
+ android:id="@+id/call_main_action"
android:layout_width="0dp"
- android:layout_height="80dp"
+ android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
@@ -32,30 +32,15 @@
<TextView
android:id="@+id/history_call_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
android:singleLine="true"
- android:textStyle="bold" />
-
- <Button
- android:id="@+id/history_call_add"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:background="@drawable/item_generic_selector"
- android:paddingLeft="@dimen/padding_small"
- android:text="+Contacts"
- android:visibility="gone" />
- </RelativeLayout>
+ android:textSize="18sp" />
+ </LinearLayout>
</RelativeLayout>
<!-- Foreground -->
- <!-- You can place any of the items below as the foreground, but for most controll, add the scroll view yourself. -->
-
-
- <!-- <couk.jenxsol.parallaxscrollview.views.ObservableScrollView -->
<org.sflphone.views.parallaxscrollview.AnotherView
android:id="@+id/anotherView"
diff --git a/res/layout/item_history.xml b/res/layout/item_history.xml
index 743983d..310d7e7 100644
--- a/res/layout/item_history.xml
+++ b/res/layout/item_history.xml
@@ -72,7 +72,7 @@
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/photo"
android:paddingLeft="@dimen/padding_small"
- android:weightSum="3" >
+ android:weightSum="2" >
<TextView
android:id="@+id/incomings"
@@ -90,13 +90,6 @@
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall" />
- <TextView
- android:id="@+id/missed"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<Button
diff --git a/res/layout/item_history_call.xml b/res/layout/item_history_call.xml
index c6ba1fe..d675566 100644
--- a/res/layout/item_history_call.xml
+++ b/res/layout/item_history_call.xml
@@ -59,6 +59,15 @@
android:layout_toRightOf="@+id/history_call_state"
android:paddingLeft="@dimen/padding_small"
android:singleLine="true" />
+
+ <TextView
+ android:id="@+id/history_call_hour"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_toRightOf="@+id/history_call_date_formatted"
+ android:paddingLeft="@dimen/padding_small"
+ android:singleLine="true" />
<TextView
android:id="@+id/history_call_duration"
diff --git a/src/org/sflphone/client/DetailHistoryActivity.java b/src/org/sflphone/client/DetailHistoryActivity.java
index ab2a23d..27ef263 100644
--- a/src/org/sflphone/client/DetailHistoryActivity.java
+++ b/src/org/sflphone/client/DetailHistoryActivity.java
@@ -118,4 +118,10 @@
}
};
+ @Override
+ public void onCallDialed(String to) {
+ // TODO Stub de la méthode généré automatiquement
+
+ }
+
}
\ No newline at end of file
diff --git a/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java b/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
index 668ac3c..e697b7e 100644
--- a/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
+++ b/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
@@ -46,6 +46,7 @@
import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.MeasureSpec;
@@ -83,10 +84,16 @@
return null;
}
+ @Override
+ public void onCallDialed(String to) {
+ }
+
};
public interface Callbacks {
+ public void onCallDialed(String to);
+
public ISipService getService();
}
@@ -129,6 +136,15 @@
iv = (RelativeLayout) inflatedView.findViewById(R.id.iv);
((TextView) iv.findViewById(R.id.history_call_name)).setText(toDisplay.getContact().getmDisplayName());
+ ((LinearLayout) iv.findViewById(R.id.call_main_action)).setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ Log.i(TAG, "Clicking");
+ mCallbacks.onCallDialed(toDisplay.getNumber());
+ }
+ });
+
tasker = new ContactPictureTask(getActivity(), (ImageView) iv.findViewById(R.id.contact_photo), toDisplay.getContact());
tasker.run();
anotherView = (AnotherView) inflatedView.findViewById(R.id.anotherView);
@@ -227,6 +243,7 @@
entryView = new HistoryCallView();
entryView.historyCallState = (TextView) convertView.findViewById(R.id.history_call_state);
entryView.formatted_date = (TextView) convertView.findViewById(R.id.history_call_date_formatted);
+ entryView.formatted_hour = (TextView) convertView.findViewById(R.id.history_call_hour);
entryView.record = (Button) convertView.findViewById(R.id.history_call_record);
entryView.duration = (TextView) convertView.findViewById(R.id.history_call_duration);
@@ -240,7 +257,8 @@
entryView.historyCallState.setText(item.getDirection());
entryView.formatted_date.setText(item.getDate());
entryView.duration.setText(item.getDurationString());
- if(item.isIncoming() && item.isMissed())
+ entryView.formatted_hour.setText(item.getStartString("h:mm a"));
+ if (item.isIncoming() && item.isMissed())
convertView.setBackgroundColor(getResources().getColor(R.color.holo_red_light));
if (item.hasRecord()) {
@@ -277,6 +295,7 @@
public class HistoryCallView {
protected TextView historyCallState;
protected TextView formatted_date;
+ protected TextView formatted_hour;
protected Button record;
protected TextView duration;
}
diff --git a/src/org/sflphone/fragments/HistoryFragment.java b/src/org/sflphone/fragments/HistoryFragment.java
index beed111..94bc3b9 100644
--- a/src/org/sflphone/fragments/HistoryFragment.java
+++ b/src/org/sflphone/fragments/HistoryFragment.java
@@ -207,7 +207,6 @@
entryView.photo = (ImageButton) convertView.findViewById(R.id.photo);
entryView.displayName = (TextView) convertView.findViewById(R.id.display_name);
entryView.date = (TextView) convertView.findViewById(R.id.date_start);
- entryView.missed = (TextView) convertView.findViewById(R.id.missed);
entryView.incoming = (TextView) convertView.findViewById(R.id.incomings);
entryView.outgoing = (TextView) convertView.findViewById(R.id.outgoings);
entryView.replay = (Button) convertView.findViewById(R.id.replay);
@@ -224,7 +223,6 @@
infos_fetcher.execute(new ContactPictureTask(mContext, entryView.photo, dataset.get(pos).getContact()));
- entryView.missed.setText(getString(R.string.hist_missed_calls, dataset.get(pos).getMissed_sum()));
entryView.incoming.setText(getString(R.string.hist_in_calls, dataset.get(pos).getIncoming_sum()));
entryView.outgoing.setText(getString(R.string.hist_out_calls, dataset.get(pos).getOutgoing_sum()));
@@ -275,7 +273,6 @@
protected TextView displayName;
protected TextView date;
private Button replay;
- private TextView missed;
private TextView outgoing;
private TextView incoming;
}
diff --git a/src/org/sflphone/model/HistoryEntry.java b/src/org/sflphone/model/HistoryEntry.java
index a67067b..578a030 100644
--- a/src/org/sflphone/model/HistoryEntry.java
+++ b/src/org/sflphone/model/HistoryEntry.java
@@ -31,10 +31,14 @@
package org.sflphone.model;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.NavigableMap;
+import java.util.TimeZone;
import java.util.TreeMap;
import org.sflphone.service.ServiceConstants;
@@ -172,10 +176,10 @@
long call_start;
long call_end;
String number;
-
+
boolean missed;
String direction;
-
+
String recordPath;
String timeFormatted;
String displayName;
@@ -183,10 +187,10 @@
public HistoryCall(HashMap<String, String> entry) {
call_end = Long.parseLong(entry.get(ServiceConstants.history.TIMESTAMP_STOP_KEY));
call_start = Long.parseLong(entry.get(ServiceConstants.history.TIMESTAMP_START_KEY));
-
+
direction = entry.get(ServiceConstants.history.DIRECTION_KEY);
missed = entry.get(ServiceConstants.history.MISSED_KEY).contentEquals("true");
-
+
displayName = entry.get(ServiceConstants.history.DISPLAY_NAME_KEY);
recordPath = entry.get(ServiceConstants.history.RECORDING_PATH_KEY);
number = entry.get(ServiceConstants.history.PEER_NUMBER_KEY);
@@ -201,6 +205,16 @@
return timeFormatted;
}
+ public String getStartString(String format) {
+ Timestamp stamp = new Timestamp(call_start * 1000); // in milliseconds
+ Date date = new Date(stamp.getTime());
+ SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.getDefault());
+ sdf.setTimeZone(TimeZone.getDefault());
+ String formattedDate = sdf.format(date);
+ return formattedDate;
+
+ }
+
public String getDurationString() {
long duration = call_end - call_start;