]> average.org Git - WhereAmI.git/commitdiff
don't try nonexistent calendar
authorEugene Crosser <Eugene.Crosser@ru.ibm.com>
Fri, 3 Feb 2012 10:11:13 +0000 (14:11 +0400)
committerEugene Crosser <Eugene.Crosser@ru.ibm.com>
Fri, 3 Feb 2012 10:11:13 +0000 (14:11 +0400)
res/values/strings.xml
src/org/average/whereami/PhoneLog.java

index b12cf7127b854edf1231b0042e36eafe4ae9d241..5957bbaeb0e8d64a3a5880a48ee7f800922b2b68 100644 (file)
@@ -7,6 +7,7 @@
     <string name="failure">Неудача</string>
     <string name="lasttry">Последнее обновление</string>
     <string name="failtry">Неудачная попытка</string>
+    <string name="nocalendar">Нет календаря с именем</string>
     <string name="autherror">Необходимо авторизоваться (через меню)</string>
     <string name="myname">Женя</string>
     <string name="timestamp">отметка</string>
index 3bb34d25effe10a1f194e0b0fce055adc7812265..2665c340449914d3de40ae4352b12a562d2253d2 100644 (file)
@@ -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) {