From 3de0348c8df17da7708961f002c4a964321284be Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Sun, 5 Feb 2012 20:34:48 +0400 Subject: [PATCH] fix grammar of the message --- res/values/strings.xml | 1 + src/org/average/whereami/PhoneLog.java | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 1e8e10e..fe162bb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -16,6 +16,7 @@ к Жене от Жени длиной + меньше минуту минуты минут diff --git a/src/org/average/whereami/PhoneLog.java b/src/org/average/whereami/PhoneLog.java index fb319a4..00de545 100644 --- a/src/org/average/whereami/PhoneLog.java +++ b/src/org/average/whereami/PhoneLog.java @@ -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; } } -- 2.43.0