]> average.org Git - WhereAmI.git/commitdiff
fix grammar of the message
authorEugene Crosser <crosser@average.org>
Sun, 5 Feb 2012 16:34:48 +0000 (20:34 +0400)
committerEugene Crosser <crosser@average.org>
Sun, 5 Feb 2012 16:34:48 +0000 (20:34 +0400)
res/values/strings.xml
src/org/average/whereami/PhoneLog.java

index 1e8e10e813d8b63c45be81632540a31eba6e1f76..fe162bbeb3688b07b42e7bd387da4716c3d8d400 100644 (file)
@@ -16,6 +16,7 @@
     <string name="in_call">к Жене</string>
     <string name="out_call">от Жени</string>
     <string name="duration">длиной</string>
+    <string name="lessthan">меньше</string>
     <string name="minutes1">минуту</string>
     <string name="minutes2to4">минуты</string>
     <string name="minutes5up">минут</string>
index fb319a46a494441188226dfdfac600783c454487..00de54578c712e35b2674c8811022a38afcfc579 100644 (file)
@@ -37,6 +37,7 @@ public final class PhoneLog extends Oracle {
        private String in_call;
        private String out_call;
        private String duration;
+       private String lessthan;
        private String minutes1;
        private String minutes2to4;
        private String minutes5up;
@@ -51,6 +52,7 @@ public final class PhoneLog extends Oracle {
                in_call = res.getString(R.string.in_call);
                out_call = res.getString(R.string.out_call);
                duration = res.getString(R.string.duration);
+               lessthan = res.getString(R.string.lessthan);
                minutes1 = res.getString(R.string.minutes1);
                minutes2to4 = res.getString(R.string.minutes2to4);
                minutes5up = res.getString(R.string.minutes5up);
@@ -186,11 +188,17 @@ public final class PhoneLog extends Oracle {
                stime.set(latestStartTime);
                Long dur = (latestStopTime - latestStartTime) / 60000L;
                Log.v(TAG, "Chosen event: start " + stime +
-                       " for " + dur + " sec");
+                       " for " + dur + " min");
                String minutes;
-               if (dur == 1) {
+               String howlong = dur.toString();
+               if (dur == 0) {
+                       howlong = lessthan;
+                       minutes = minutes2to4;
+               } else if ((dur / 10) == 1) {
+                       minutes = minutes5up;
+               } else if ((dur % 10) == 1) {
                        minutes = minutes1;
-               } else if (dur < 5) {
+               } else if ((dur % 10) < 5) {
                        minutes = minutes2to4;
                } else {
                        minutes = minutes5up;
@@ -198,6 +206,6 @@ public final class PhoneLog extends Oracle {
                return last_call +
                        " " + (latestWasOutgoing?out_call:in_call) +
                        " " + sayWhen.say(latestStartTime) +
-                       " " + duration + " " + dur + " " + minutes;
+                       " " + duration + " " + howlong + " " + minutes;
        }
 }