From c2bd7b69ac93720ca053a16c2925558148e86b44 Mon Sep 17 00:00:00 2001
From: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Date: Mon, 30 Sep 2013 10:45:00 -0400
Subject: [PATCH] * #30787: adjustements in history

---
 res/layout/frag_history.xml                   |  2 +-
 res/layout/item_history.xml                   | 67 ++++++++++---------
 res/values-fr/strings.xml                     | 10 ++-
 res/values/strings.xml                        | 10 ++-
 .../sflphone/fragments/DialingFragment.java   |  2 +-
 .../sflphone/fragments/HistoryFragment.java   | 13 ++--
 6 files changed, 58 insertions(+), 46 deletions(-)

diff --git a/res/layout/frag_history.xml b/res/layout/frag_history.xml
index d33694c80..71b6a6020 100644
--- a/res/layout/frag_history.xml
+++ b/res/layout/frag_history.xml
@@ -21,7 +21,7 @@
         android:layout_height="match_parent"
         android:layout_gravity="center"
         android:gravity="center"
-        android:text="@string/no_history"
+        android:text="@string/hist_no_history"
         android:textSize="30sp" />
 
 </LinearLayout>
\ No newline at end of file
diff --git a/res/layout/item_history.xml b/res/layout/item_history.xml
index 12caefc11..12440ab40 100644
--- a/res/layout/item_history.xml
+++ b/res/layout/item_history.xml
@@ -40,6 +40,7 @@ as that of the covered work.
         android:id="@+id/photo"
         android:layout_width="70dp"
         android:layout_height="70dp"
+        android:layout_centerVertical="true"
         android:scaleType="centerCrop" />
 
     <TextView
@@ -47,10 +48,10 @@ as that of the covered work.
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentTop="true"
-        android:layout_toRightOf="@+id/photo"
-        android:singleLine="true"
         android:layout_toLeftOf="@+id/action_call"
+        android:layout_toRightOf="@+id/photo"
         android:paddingLeft="@dimen/padding_small"
+        android:singleLine="true"
         android:textAppearance="?android:attr/textAppearanceMedium" />
 
     <TextView
@@ -71,42 +72,44 @@ as that of the covered work.
         android:paddingLeft="@dimen/padding_small"
         android:textAppearance="?android:attr/textAppearanceSmall" />
 
-    <LinearLayout
+    <TextView
+        android:id="@+id/incomings"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_alignLeft="@+id/duration"
         android:layout_below="@+id/duration"
-        android:layout_toRightOf="@+id/photo" >
-
-        <TextView
-            android:id="@+id/incomings"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingLeft="@dimen/padding_small"
-            android:textAppearance="?android:attr/textAppearanceSmall" />
+        android:paddingLeft="@dimen/padding_small"
+        android:textAppearance="?android:attr/textAppearanceSmall" />
 
-        <TextView
-            android:id="@+id/outgoings"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingLeft="@dimen/padding_small"
-            android:textAppearance="?android:attr/textAppearanceSmall" />
+    <TextView
+        android:id="@+id/outgoings"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignLeft="@+id/duration"
+        android:layout_below="@+id/incomings"
+        android:paddingLeft="@dimen/padding_small"
+        android:textAppearance="?android:attr/textAppearanceSmall" />
 
-        <TextView
-            android:id="@+id/missed"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingLeft="@dimen/padding_small"
-            android:textAppearance="?android:attr/textAppearanceSmall" />
+    <TextView
+        android:id="@+id/missed"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignLeft="@+id/duration"
+        android:layout_below="@+id/outgoings"
+        android:paddingLeft="@dimen/padding_small"
+        android:textAppearance="?android:attr/textAppearanceSmall" />
 
-        <Button
-            android:id="@+id/replay"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingLeft="@dimen/padding_small"
-            android:text="@string/replay_button"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:visibility="gone" />
-    </LinearLayout>
+    <Button
+        android:id="@+id/replay"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignBaseline="@+id/outgoings"
+        android:layout_margin="10dp"
+        android:layout_toRightOf="@+id/outgoings"
+        android:paddingLeft="@dimen/padding_small"
+        android:text="@string/hist_replay_button"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:visibility="gone" />
 
     <ImageButton
         android:id="@+id/action_call"
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index ec14928bd..f3ce6b4b8 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -64,12 +64,16 @@ as that of the covered work.
     <string name="menu_item_settings_interface">Interface</string>
 
     <!-- Dialing Fragment -->
-    <string name="error_no_number_dialed">Composez un numéro</string>
+    <string name="dial_error_no_number_dialed">Composez un numéro</string>
     <string name="dial_hint">Entrez un numéro</string>
 
     <!-- History Fragment -->
-    <string name="replay_button">Écouter</string>
-    <string name="no_history">Pas d\'historique</string>
+    <string name="hist_replay_button">Écouter</string>
+    <string name="hist_replay_button_stop">Stop</string>
+    <string name="hist_missed_calls">Manqué:%1$d</string>
+    <string name="hist_in_calls">Entrant:%1$d</string>
+    <string name="hist_out_calls">Sortant:%1$d</string>
+    <string name="hist_no_history">Pas d\'historique</string>
 
     <!-- Home Fragment -->
     <string name="home_conferences_title">Conférences</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f29589ec7..ba084bd2e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -64,12 +64,16 @@ as that of the covered work.
     <string name="menu_item_settings_interface">Interface</string>
     
     <!-- Dialing Fragmennt -->
-    <string name="error_no_number_dialed">Dial a number</string>
+    <string name="dial_error_no_number_dialed">Dial a number</string>
     <string name="dial_hint">Type phone number</string>
     
     <!-- History Fragment -->
-    <string name="replay_button">Replay</string>
-    <string name="no_history">No history</string>
+    <string name="hist_replay_button">Replay</string>
+    <string name="hist_replay_button_stop">Stop</string>
+    <string name="hist_no_history">No history</string>
+	<string name="hist_missed_calls">Missed:%1$d</string>
+    <string name="hist_in_calls">In:%1$d</string>
+    <string name="hist_out_calls">Out:%1$d</string>
     
     <!-- Home Fragment -->
     <string name="home_conferences_title">Conferences</string>
diff --git a/src/com/savoirfairelinux/sflphone/fragments/DialingFragment.java b/src/com/savoirfairelinux/sflphone/fragments/DialingFragment.java
index bc8506a8f..a446a3a1c 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/DialingFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/DialingFragment.java
@@ -125,7 +125,7 @@ public class DialingFragment extends Fragment implements OnTouchListener {
 
                 String to = textField.getText().toString();
                 if (to.contentEquals("")) {
-                    textField.setError(getString(R.string.error_no_number_dialed));
+                    textField.setError(getString(R.string.dial_error_no_number_dialed));
                 } else {
                     mCallbacks.onCallDialed(to);
                 }
diff --git a/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java b/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java
index 480b12299..1b8b04ac7 100644
--- a/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java
+++ b/src/com/savoirfairelinux/sflphone/fragments/HistoryFragment.java
@@ -218,9 +218,10 @@ public class HistoryFragment extends ListFragment implements LoaderCallbacks<Arr
 
             infos_fetcher.execute(new ContactPictureTask(mContext.getActivity(), entryView.photo, dataset.get(pos).getContact().getId()));
 
-            entryView.missed.setText("Missed:" + dataset.get(pos).getMissed_sum());
-            entryView.incoming.setText("In:" + dataset.get(pos).getIncoming_sum());
-            entryView.outgoing.setText("Out:" + dataset.get(pos).getOutgoing_sum());
+
+            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()));
 
             if (dataset.get(pos).getCalls().lastEntry().getValue().getRecordPath().length() > 0) {
                 entryView.replay.setVisibility(View.VISIBLE);
@@ -233,11 +234,11 @@ public class HistoryFragment extends ListFragment implements LoaderCallbacks<Arr
                             if ((Boolean) v.getTag(R.id.replay)) {
                                 mCallbacks.getService().startRecordedFilePlayback(dataset.get(pos).getCalls().lastEntry().getValue().getRecordPath());
                                 v.setTag(R.id.replay, false);
-                                ((Button)v).setText("Stop");
+                                ((Button)v).setText(getString(R.string.hist_replay_button_stop));
                             } else {
                                 mCallbacks.getService().stopRecordedFilePlayback(dataset.get(pos).getCalls().lastEntry().getValue().getRecordPath());
                                 v.setTag(R.id.replay, true);
-                                ((Button)v).setText("Replay");
+                                ((Button)v).setText(getString(R.string.hist_replay_button));
                             }
                         } catch (RemoteException e) {
                             // TODO Auto-generated catch block
@@ -247,7 +248,7 @@ public class HistoryFragment extends ListFragment implements LoaderCallbacks<Arr
                 });
             }
 
-            entryView.date.setText(dataset.get(pos).getCalls().lastEntry().getValue().getDate("yyyy-MM-dd"));
+            entryView.date.setText(dataset.get(pos).getCalls().lastEntry().getValue().getDate("hh:mm dd/MM/yyyy"));
             entryView.duration.setText(dataset.get(pos).getTotalDuration());
 
             return rowView;
-- 
GitLab