From 3a239c1eebf08ee80a1a05f0dc06fd54e52bf28d Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Fri, 3 Feb 2012 14:11:13 +0400 Subject: [PATCH] don't try nonexistent calendar --- res/values/strings.xml | 1 + src/org/average/whereami/PhoneLog.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b12cf71..5957bba 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7,6 +7,7 @@ Неудача Последнее обновление Неудачная попытка + Нет календаря с именем Необходимо авторизоваться (через меню) Женя отметка diff --git a/src/org/average/whereami/PhoneLog.java b/src/org/average/whereami/PhoneLog.java index 3bb34d2..2665c34 100644 --- a/src/org/average/whereami/PhoneLog.java +++ b/src/org/average/whereami/PhoneLog.java @@ -29,10 +29,12 @@ public final class PhoneLog extends Oracle { private String calendar_name; private String peer_name; private String calendar_id; + private String nocalendar; public PhoneLog(final Resources res, final PersistentStore store) { super(res, store); this.store = store; + nocalendar = res.getString(R.string.nocalendar); calendar_name = store.get("calendar_name"); peer_name = store.get("peer_name"); calendar_id = store.get("calendar_id"); @@ -50,7 +52,12 @@ public final class PhoneLog extends Oracle { calendar_id = scanCalendars(calendar_name); store.put("calendar_id", calendar_id); } - return scanEvents(calendar_id, peer_name); + if (calendar_id == null || calendar_id == "") { + return scanEvents(calendar_id, peer_name); + } else { + return nocalendar + " \"" + + calendar_name + "\""; + } } catch (GoogleJsonResponseException e) { Log.v(TAG, "GoogleJsonResponseException: " + e); if (e.getResponse().getStatusCode() == 401) { -- 2.43.0