From 902f7d8ee32a0d9c929835efe8327c8a340a6b5b Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Fri, 3 Feb 2012 17:59:39 +0400 Subject: [PATCH] edit lastcall message --- res/values/strings.xml | 7 ++++++ src/org/average/whereami/PhoneLog.java | 34 +++++++++++++++++++++----- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 83a28e1..11b7827 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -12,6 +12,13 @@ Необходимо авторизоваться (через меню) Женя отметка + Последний звонок + к Жене + от Жени + длительностью + минуту + минуты + минут больше суток назад меньше часа назад час с лишним назад diff --git a/src/org/average/whereami/PhoneLog.java b/src/org/average/whereami/PhoneLog.java index ff64fa9..708b88e 100644 --- a/src/org/average/whereami/PhoneLog.java +++ b/src/org/average/whereami/PhoneLog.java @@ -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"); } } -- 2.43.0