edit lastcall message
authorEugene Crosser <Eugene.Crosser@ru.ibm.com>
Fri, 3 Feb 2012 13:59:39 +0000 (17:59 +0400)
committerEugene Crosser <Eugene.Crosser@ru.ibm.com>
Fri, 3 Feb 2012 13:59:39 +0000 (17:59 +0400)
res/values/strings.xml
src/org/average/whereami/PhoneLog.java

index 83a28e140aab5834df42809414e95e4506034f36..11b7827b1cf5d86c2eb2dc34516ddde3f3fe724c 100644 (file)
     <string name="autherror">Необходимо авторизоваться (через меню)</string>
     <string name="myname">Женя</string>
     <string name="timestamp">отметка</string>
+    <string name="last_call">Последний звонок</string>
+    <string name="in_call">к Жене</string>
+    <string name="out_call">от Жени</string>
+    <string name="duration">длительностью</string>
+    <string name="minutes1">минуту</string>
+    <string name="minutes2to4">минуты</string>
+    <string name="minutes5up">минут</string>
     <string name="longago">больше суток назад</string>
     <string name="lessthanhour">меньше часа назад</string>
     <string name="onehour">час с лишним назад</string>
index ff64fa9b3863aaf9092064a3205bf51c34f9d840..708b88ef3d072d4f6213a3af82f3b481167d7986 100644 (file)
@@ -32,12 +32,26 @@ public final class PhoneLog extends Oracle {
        private String calendar_id;
        private String nocalendar;
        private String noevents;
+       private String last_call;
+       private String in_call;
+       private String out_call;
+       private String duration;
+       private String minutes1;
+       private String minutes2to4;
+       private String minutes5up;
 
        public PhoneLog(final Resources res, final PersistentStore store) {
                super(res, store);
                this.store = store;
                nocalendar = res.getString(R.string.nocalendar);
                noevents = res.getString(R.string.noevents);
+               last_call = res.getString(R.string.last_call);
+               in_call = res.getString(R.string.in_call);
+               out_call = res.getString(R.string.out_call);
+               duration = res.getString(R.string.duration);
+               minutes1 = res.getString(R.string.minutes1);
+               minutes2to4 = res.getString(R.string.minutes2to4);
+               minutes5up = res.getString(R.string.minutes5up);
                calendar_name = store.get("calendar_name");
                peer_name = store.get("peer_name");
                calendar_id = store.get("calendar_id");
@@ -167,12 +181,20 @@ public final class PhoneLog extends Oracle {
                                        Boolean latestWasOutgoing) {
                Time stime = new Time();
                stime.set(latestStartTime);
-               Long durms = latestStopTime - latestStartTime;
+               Long dur = (latestStopTime - latestStartTime) / 60000L;
                Log.v(TAG, "Chosen event: start " + stime +
-                       " for " + durms + " msec");
-               Long nowms = System.currentTimeMillis();
-               return "" + (latestWasOutgoing?"Out ":"In  ") +
-                       (durms/3600000) + " min " +
-                       stime.format("%H:%M");
+                       " for " + dur + " sec");
+               String minutes;
+               if (dur == 1) {
+                       minutes = minutes1;
+               } else if (dur < 5) {
+                       minutes = minutes2to4;
+               } else {
+                       minutes = minutes5up;
+               }
+               return last_call + " " +
+                       (latestWasOutgoing?out_call:in_call) +
+                       " " + duration + " " + dur + " " + minutes +
+                       " " + stime.format("%H:%M");
        }
 }